Skip to content

Commit

Permalink
x86, UV: Fix smp_processor_id() use in a preemptable region
Browse files Browse the repository at this point in the history
Fix a call by tunables_write() to smp_processor_id() within a
preemptable region.

Call get_cpu()/put_cpu() around the region where the returned
cpu number is actually used, which makes it non-preemptable.

A DEBUG_PREEMPT warning is prevented.

UV does not support cpu hotplug yet, but this is a step toward
that ability as well.

Signed-off-by: Cliff Wickman <cpw@sgi.com>
Link: http://lkml.kernel.org/r/20110621122242.086384966@sgi.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
cpw@sgi.com authored and Ingo Molnar committed Jun 21, 2011
1 parent 6885685 commit 00b30cf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/platform/uv/tlb_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,10 @@ static ssize_t tunables_write(struct file *file, const char __user *user,

instr[count] = '\0';

bcp = &per_cpu(bau_control, smp_processor_id());

cpu = get_cpu();
bcp = &per_cpu(bau_control, cpu);
ret = parse_tunables_write(bcp, instr, count);
put_cpu();
if (ret)
return ret;

Expand Down

0 comments on commit 00b30cf

Please sign in to comment.