2011-06-21 12:22:50

by Cliff Wickman

[permalink] [raw]
Subject: [patch 1/8 v5] x86, UV: smp_processor_id in a preemptable region

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.

Signed-off-by: Cliff Wickman <[email protected]>
---

A DEBUG_PREEMPT warning is prevented.
UV does not support cpu hotplug yet, but this is a step toward that ability.

arch/x86/platform/uv/tlb_uv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux/arch/x86/platform/uv/tlb_uv.c
===================================================================
--- linux.orig/arch/x86/platform/uv/tlb_uv.c
+++ linux/arch/x86/platform/uv/tlb_uv.c
@@ -1334,9 +1334,10 @@ static ssize_t tunables_write(struct fil

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;


2011-06-21 15:16:29

by Cliff Wickman

[permalink] [raw]
Subject: [tip:x86/uv] x86, UV: Fix smp_processor_id() use in a preemptable region

Commit-ID: 00b30cf04a775b5292ab704f782394e36e25617d
Gitweb: http://git.kernel.org/tip/00b30cf04a775b5292ab704f782394e36e25617d
Author: [email protected] <[email protected]>
AuthorDate: Tue, 21 Jun 2011 07:21:26 -0500
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 21 Jun 2011 14:50:31 +0200

x86, UV: Fix smp_processor_id() use in a preemptable region

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 <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/platform/uv/tlb_uv.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index 68e467f..34be650 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -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;