ANDROID: sched: add hook to set_cpus_allowed_ptr_locked

It is necessary to update the valid mask to implement CPU Pause
from a vendor module. Introduce a hook to allow this.

Bug: 205164003
Change-Id: Ic99b74d17f361453b044e115a54698e566db13b6
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
This commit is contained in:
Stephen Dickey
2021-11-04 15:25:35 -07:00
committed by Todd Kjos
parent ca2177d4a0
commit a027f0d72e
3 changed files with 8 additions and 0 deletions

View File

@@ -196,3 +196,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked);

View File

@@ -267,6 +267,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup,
TP_ARGS(rq, p, preempt, nopreempt, wake_flags, se, pse, next_buddy_marked,
granularity), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_ptr_locked,
TP_PROTO(const struct cpumask *cpu_valid_mask, const struct cpumask *new_mask,
unsigned int *dest_cpu),
TP_ARGS(cpu_valid_mask, new_mask, dest_cpu), 1);
DECLARE_HOOK(android_vh_free_task,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));

View File

@@ -2844,6 +2844,8 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
* immediately required to distribute the tasks within their new mask.
*/
dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask);
trace_android_rvh_set_cpus_allowed_ptr_locked(cpu_valid_mask, new_mask, &dest_cpu);
if (dest_cpu >= nr_cpu_ids) {
ret = -EINVAL;
goto out;