Skip to content

Commit e163217

Browse files
Christoph Lameterhtejun
authored andcommitted
uv: Replace __get_cpu_var
Use __this_cpu_read instead. Cc: Hedi Berriche <hedi@sgi.com> Cc: Mike Travis <travis@sgi.com> Cc: Dimitri Sivanich <sivanich@sgi.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 89cbc76 commit e163217

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

arch/x86/include/asm/uv/uv_hub.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,16 +601,16 @@ struct uv_hub_nmi_s {
601601

602602
struct uv_cpu_nmi_s {
603603
struct uv_hub_nmi_s *hub;
604-
atomic_t state;
605-
atomic_t pinging;
604+
int state;
605+
int pinging;
606606
int queries;
607607
int pings;
608608
};
609609

610-
DECLARE_PER_CPU(struct uv_cpu_nmi_s, __uv_cpu_nmi);
611-
#define uv_cpu_nmi (__get_cpu_var(__uv_cpu_nmi))
610+
DECLARE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
611+
612612
#define uv_hub_nmi (uv_cpu_nmi.hub)
613-
#define uv_cpu_nmi_per(cpu) (per_cpu(__uv_cpu_nmi, cpu))
613+
#define uv_cpu_nmi_per(cpu) (per_cpu(uv_cpu_nmi, cpu))
614614
#define uv_hub_nmi_per(cpu) (uv_cpu_nmi_per(cpu).hub)
615615

616616
/* uv_cpu_nmi_states */

arch/x86/platform/uv/uv_nmi.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363

6464
static struct uv_hub_nmi_s **uv_hub_nmi_list;
6565

66-
DEFINE_PER_CPU(struct uv_cpu_nmi_s, __uv_cpu_nmi);
67-
EXPORT_PER_CPU_SYMBOL_GPL(__uv_cpu_nmi);
66+
DEFINE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
67+
EXPORT_PER_CPU_SYMBOL_GPL(uv_cpu_nmi);
6868

6969
static unsigned long nmi_mmr;
7070
static unsigned long nmi_mmr_clear;
@@ -215,7 +215,7 @@ static int uv_check_nmi(struct uv_hub_nmi_s *hub_nmi)
215215
int nmi = 0;
216216

217217
local64_inc(&uv_nmi_count);
218-
uv_cpu_nmi.queries++;
218+
this_cpu_inc(uv_cpu_nmi.queries);
219219

220220
do {
221221
nmi = atomic_read(&hub_nmi->in_nmi);
@@ -293,7 +293,7 @@ static void uv_nmi_nr_cpus_ping(void)
293293
int cpu;
294294

295295
for_each_cpu(cpu, uv_nmi_cpu_mask)
296-
atomic_set(&uv_cpu_nmi_per(cpu).pinging, 1);
296+
uv_cpu_nmi_per(cpu).pinging = 1;
297297

298298
apic->send_IPI_mask(uv_nmi_cpu_mask, APIC_DM_NMI);
299299
}
@@ -304,8 +304,8 @@ static void uv_nmi_cleanup_mask(void)
304304
int cpu;
305305

306306
for_each_cpu(cpu, uv_nmi_cpu_mask) {
307-
atomic_set(&uv_cpu_nmi_per(cpu).pinging, 0);
308-
atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_OUT);
307+
uv_cpu_nmi_per(cpu).pinging = 0;
308+
uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_OUT;
309309
cpumask_clear_cpu(cpu, uv_nmi_cpu_mask);
310310
}
311311
}
@@ -328,7 +328,7 @@ static int uv_nmi_wait_cpus(int first)
328328
int loop_delay = uv_nmi_loop_delay;
329329

330330
for_each_cpu(j, uv_nmi_cpu_mask) {
331-
if (atomic_read(&uv_cpu_nmi_per(j).state)) {
331+
if (uv_cpu_nmi_per(j).state) {
332332
cpumask_clear_cpu(j, uv_nmi_cpu_mask);
333333
if (++k >= n)
334334
break;
@@ -359,7 +359,7 @@ static int uv_nmi_wait_cpus(int first)
359359
static void uv_nmi_wait(int master)
360360
{
361361
/* indicate this cpu is in */
362-
atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_IN);
362+
this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_IN);
363363

364364
/* if not the first cpu in (the master), then we are a slave cpu */
365365
if (!master)
@@ -419,28 +419,28 @@ static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs)
419419
"UV:%sNMI process trace for CPU %d\n", dots, cpu);
420420
show_regs(regs);
421421
}
422-
atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
422+
this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
423423
}
424424

425425
/* Trigger a slave cpu to dump it's state */
426426
static void uv_nmi_trigger_dump(int cpu)
427427
{
428428
int retry = uv_nmi_trigger_delay;
429429

430-
if (atomic_read(&uv_cpu_nmi_per(cpu).state) != UV_NMI_STATE_IN)
430+
if (uv_cpu_nmi_per(cpu).state != UV_NMI_STATE_IN)
431431
return;
432432

433-
atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP);
433+
uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_DUMP;
434434
do {
435435
cpu_relax();
436436
udelay(10);
437-
if (atomic_read(&uv_cpu_nmi_per(cpu).state)
437+
if (uv_cpu_nmi_per(cpu).state
438438
!= UV_NMI_STATE_DUMP)
439439
return;
440440
} while (--retry > 0);
441441

442442
pr_crit("UV: CPU %d stuck in process dump function\n", cpu);
443-
atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP_DONE);
443+
uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_DUMP_DONE;
444444
}
445445

446446
/* Wait until all cpus ready to exit */
@@ -488,7 +488,7 @@ static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master)
488488
} else {
489489
while (!atomic_read(&uv_nmi_slave_continue))
490490
cpu_relax();
491-
while (atomic_read(&uv_cpu_nmi.state) != UV_NMI_STATE_DUMP)
491+
while (this_cpu_read(uv_cpu_nmi.state) != UV_NMI_STATE_DUMP)
492492
cpu_relax();
493493
uv_nmi_dump_state_cpu(cpu, regs);
494494
}
@@ -615,7 +615,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
615615
local_irq_save(flags);
616616

617617
/* If not a UV System NMI, ignore */
618-
if (!atomic_read(&uv_cpu_nmi.pinging) && !uv_check_nmi(hub_nmi)) {
618+
if (!this_cpu_read(uv_cpu_nmi.pinging) && !uv_check_nmi(hub_nmi)) {
619619
local_irq_restore(flags);
620620
return NMI_DONE;
621621
}
@@ -639,7 +639,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
639639
uv_call_kgdb_kdb(cpu, regs, master);
640640

641641
/* Clear per_cpu "in nmi" flag */
642-
atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_OUT);
642+
this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_OUT);
643643

644644
/* Clear MMR NMI flag on each hub */
645645
uv_clear_nmi(cpu);
@@ -666,16 +666,16 @@ static int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
666666
{
667667
int ret;
668668

669-
uv_cpu_nmi.queries++;
670-
if (!atomic_read(&uv_cpu_nmi.pinging)) {
669+
this_cpu_inc(uv_cpu_nmi.queries);
670+
if (!this_cpu_read(uv_cpu_nmi.pinging)) {
671671
local64_inc(&uv_nmi_ping_misses);
672672
return NMI_DONE;
673673
}
674674

675-
uv_cpu_nmi.pings++;
675+
this_cpu_inc(uv_cpu_nmi.pings);
676676
local64_inc(&uv_nmi_ping_count);
677677
ret = uv_handle_nmi(reason, regs);
678-
atomic_set(&uv_cpu_nmi.pinging, 0);
678+
this_cpu_write(uv_cpu_nmi.pinging, 0);
679679
return ret;
680680
}
681681

0 commit comments

Comments
 (0)