[FOSS_TLK]security: tlk_driver: get_cpu() in place of smp_processor_id()
Vandana Salve [Fri, 7 Nov 2014 11:15:52 +0000 (16:15 +0530)]
if DEBUG_PREEMPT is enabled, smp_processor_id() "helpfully"
screams when called outside preemptible, so making use of
get_cpu/put_cpu in place of smp_processor_id

<3>[  168.572811] BUG: using smp_processor_id() in preemptible [00000000] code: vpr-shrink_thre/67
<4>[  168.582061] caller is te_set_vpr_params+0x44/0x100
<4>[  168.586998] CPU: 0 PID: 67 Comm: vpr-shrink_thre Tainted: G        W    3.10.49-g5870b28 #1
<4>[  168.595633] Call trace:
<4>[  168.598439] [<ffffffc000089c78>] dump_backtrace+0x0/0xf4
<4>[  168.603917] [<ffffffc000089f70>] show_stack+0x10/0x1c
<4>[  168.609187] [<ffffffc00035cb90>] dump_stack+0x1c/0x28
<4>[  168.614364] [<ffffffc000371a08>] debug_smp_processor_id+0xd4/0xfc
<4>[  168.620647] [<ffffffc00032f634>] te_set_vpr_params+0x40/0x100
<4>[  168.626413] [<ffffffc0008c6e90>] tegra_update_resize_cfg+0x50/0xa8
<4>[  168.632609] [<ffffffc00050d778>] shrink_chunk_locked+0x1b0/0x288
<4>[  168.638640] [<ffffffc00050d8fc>] shrink_resizable_heap+0xac/0xd8
<4>[  168.644681] [<ffffffc00050ded8>] shrink_thread+0x64/0x90

Change-Id: Ief7da2098080b764d1946da088cc4d72634f572d
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/755003
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

security/tlk_driver/ote_comms.c

index 6003848..1a3c3fa 100644 (file)
@@ -325,8 +325,9 @@ int te_set_vpr_params(void *vpr_base, size_t vpr_size)
        if (current->flags &
            (PF_WQ_WORKER | PF_NO_SETAFFINITY | PF_KTHREAD)) {
                struct tlk_smc_work_args work_args;
-               int cpu = cpu_logical_map(smp_processor_id());
+               int cpu = cpu_logical_map(get_cpu());
 
+               put_cpu();
                work_args.arg0 = TE_SMC_PROGRAM_VPR;
                work_args.arg1 = (uintptr_t)vpr_base;
                work_args.arg2 = vpr_size;