summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorHyung Taek Ryoo <hryoo@nvidia.com>2013-01-30 20:50:03 -0800
committerMrutyunjay Sawant <msawant@nvidia.com>2013-02-12 10:00:40 -0800
commitfb75b69aa8238c06c4344b8248fc231749aa639f (patch)
tree964c7de7f1b5f27858fd8c9870463a65e5ea372c /security
parentccdd63f8a2ce1e82564a8f3cdec84ab2ba346032 (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: I5fbc1e6a3c67fbd01e4f2f5321aea168f7ba07c9 Signed-off-by: Hyung Taek Ryoo <hryoo@nvidia.com> Reviewed-on: http://git-master/r/198842 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);