summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorHyung Taek Ryoo <hryoo@nvidia.com>2013-01-30 20:50:03 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:57:25 -0700
commit8a096ca49ce509c663a29fbf7ea456ac4625f24e (patch)
treeff9cbc759cec3e372740d0d690215952fc2768d7 /security
parentf79f8957f08be9e94204d95430ee7123ecfaa226 (diff)
security: tf_driver: fix incorrect cpu affinity in tf_driver
This change fixes incorrect cpu affinity after excuting tf_driver. The process using tf_driver sometimes can't be schecduled to available onlined cpu. It is because cpu affinity has changed after using tf_driver. tf_driver saves current cpu affinity by calling sched_getaffinity which returns cpu affinity AND-masked by onlined cpus. tf_driver should save just current cpu affinity, not cpu affinity AND-masked by onlined cpus. bug 1218943 cherry picked from commit bba209aa7fe8b4f52f5d42acc1b21d8f54c18fe0) Reviewed-on: http://git-master/r/#change,195830 Change-Id: I4f39b9768f95dd773582fbff6bb4577c3debd9b3 Signed-off-by: Hyung Taek Ryoo <hryoo@nvidia.com> Reviewed-on: http://git-master/r/198844 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'security')
-rw-r--r--security/tf_driver/tf_comm.c2
-rw-r--r--security/tf_driver/tf_comm_tz.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/security/tf_driver/tf_comm.c b/security/tf_driver/tf_comm.c
index b3d58e202f4b..01538249264f 100644
--- a/security/tf_driver/tf_comm.c
+++ b/security/tf_driver/tf_comm.c
@@ -1461,7 +1461,7 @@ int tf_send_receive(struct tf_comm *comm,
#ifdef CONFIG_SMP
cpu_set(0, local_cpu_mask);
- sched_getaffinity(0, &saved_cpu_mask);
+ cpumask_copy(&saved_cpu_mask, tsk_cpus_allowed(current));
ret_affinity = sched_setaffinity(0, &local_cpu_mask);
if (ret_affinity != 0)
dprintk(KERN_ERR "sched_setaffinity #1 -> 0x%lX", ret_affinity);
diff --git a/security/tf_driver/tf_comm_tz.c b/security/tf_driver/tf_comm_tz.c
index a0e9941832f5..0f36209add7a 100644
--- a/security/tf_driver/tf_comm_tz.c
+++ b/security/tf_driver/tf_comm_tz.c
@@ -61,7 +61,7 @@ static inline void tf_smc_generic_call(
cpumask_t local_cpu_mask = CPU_MASK_NONE;
cpu_set(0, local_cpu_mask);
- sched_getaffinity(0, &saved_cpu_mask);
+ cpumask_copy(&saved_cpu_mask, tsk_cpus_allowed(current));
ret = sched_setaffinity(0, &local_cpu_mask);
if (ret != 0)
dprintk(KERN_ERR "sched_setaffinity #1 -> 0x%lX", ret);