From: Christoph Lameter <cl@linux.com>
To: Tejun Heo <tj@kernel.org>
Cc: akpm@linuxfoundation.org, rostedt@goodmis.org,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Hedi Berriche <hedi@sgi.com>, Mike Travis <travis@sgi.com>,
Dimitri Sivanich <sivanich@sgi.com>
Subject: [PATCH 17/31] uv: Replace __get_cpu_var
Date: Fri, 20 Jun 2014 14:31:32 -0500 [thread overview]
Message-ID: <20140620193126.861853673@linux.com> (raw)
In-Reply-To: 20140620193115.547427118@linux.com
[-- Attachment #1: this_uv --]
[-- Type: text/plain, Size: 4841 bytes --]
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>
Index: linux/arch/x86/include/asm/uv/uv_hub.h
===================================================================
--- linux.orig/arch/x86/include/asm/uv/uv_hub.h 2014-06-16 09:45:44.948069805 -0500
+++ linux/arch/x86/include/asm/uv/uv_hub.h 2014-06-16 09:47:15.326306504 -0500
@@ -601,16 +601,16 @@
struct uv_cpu_nmi_s {
struct uv_hub_nmi_s *hub;
- atomic_t state;
- atomic_t pinging;
+ int state;
+ int pinging;
int queries;
int pings;
};
-DECLARE_PER_CPU(struct uv_cpu_nmi_s, __uv_cpu_nmi);
-#define uv_cpu_nmi (__get_cpu_var(__uv_cpu_nmi))
+DECLARE_PER_CPU(struct uv_cpu_nmi_s, uv_cpu_nmi);
+
#define uv_hub_nmi (uv_cpu_nmi.hub)
-#define uv_cpu_nmi_per(cpu) (per_cpu(__uv_cpu_nmi, cpu))
+#define uv_cpu_nmi_per(cpu) (per_cpu(uv_cpu_nmi, cpu))
#define uv_hub_nmi_per(cpu) (uv_cpu_nmi_per(cpu).hub)
/* uv_cpu_nmi_states */
Index: linux/arch/x86/platform/uv/uv_nmi.c
===================================================================
--- linux.orig/arch/x86/platform/uv/uv_nmi.c 2014-06-16 09:45:44.948069805 -0500
+++ linux/arch/x86/platform/uv/uv_nmi.c 2014-06-16 09:45:44.944069883 -0500
@@ -215,7 +215,7 @@
int nmi = 0;
local64_inc(&uv_nmi_count);
- uv_cpu_nmi.queries++;
+ this_cpu_inc(uv_cpu_nmi.queries);
do {
nmi = atomic_read(&hub_nmi->in_nmi);
@@ -293,7 +293,7 @@
int cpu;
for_each_cpu(cpu, uv_nmi_cpu_mask)
- atomic_set(&uv_cpu_nmi_per(cpu).pinging, 1);
+ uv_cpu_nmi_per(cpu).pinging = 1;
apic->send_IPI_mask(uv_nmi_cpu_mask, APIC_DM_NMI);
}
@@ -304,8 +304,8 @@
int cpu;
for_each_cpu(cpu, uv_nmi_cpu_mask) {
- atomic_set(&uv_cpu_nmi_per(cpu).pinging, 0);
- atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_OUT);
+ uv_cpu_nmi_per(cpu).pinging = 0;
+ uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_OUT;
cpumask_clear_cpu(cpu, uv_nmi_cpu_mask);
}
}
@@ -328,7 +328,7 @@
int loop_delay = uv_nmi_loop_delay;
for_each_cpu(j, uv_nmi_cpu_mask) {
- if (atomic_read(&uv_cpu_nmi_per(j).state)) {
+ if (uv_cpu_nmi_per(j).state) {
cpumask_clear_cpu(j, uv_nmi_cpu_mask);
if (++k >= n)
break;
@@ -359,7 +359,7 @@
static void uv_nmi_wait(int master)
{
/* indicate this cpu is in */
- atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_IN);
+ this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_IN);
/* if not the first cpu in (the master), then we are a slave cpu */
if (!master)
@@ -419,7 +419,7 @@
"UV:%sNMI process trace for CPU %d\n", dots, cpu);
show_regs(regs);
}
- atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
+ this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_DUMP_DONE);
}
/* Trigger a slave cpu to dump it's state */
@@ -427,20 +427,20 @@
{
int retry = uv_nmi_trigger_delay;
- if (atomic_read(&uv_cpu_nmi_per(cpu).state) != UV_NMI_STATE_IN)
+ if (uv_cpu_nmi_per(cpu).state != UV_NMI_STATE_IN)
return;
- atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP);
+ uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_DUMP;
do {
cpu_relax();
udelay(10);
- if (atomic_read(&uv_cpu_nmi_per(cpu).state)
+ if (uv_cpu_nmi_per(cpu).state
!= UV_NMI_STATE_DUMP)
return;
} while (--retry > 0);
pr_crit("UV: CPU %d stuck in process dump function\n", cpu);
- atomic_set(&uv_cpu_nmi_per(cpu).state, UV_NMI_STATE_DUMP_DONE);
+ uv_cpu_nmi_per(cpu).state = UV_NMI_STATE_DUMP_DONE;
}
/* Wait until all cpus ready to exit */
@@ -488,7 +488,7 @@
} else {
while (!atomic_read(&uv_nmi_slave_continue))
cpu_relax();
- while (atomic_read(&uv_cpu_nmi.state) != UV_NMI_STATE_DUMP)
+ while (this_cpu_read(uv_cpu_nmi.state) != UV_NMI_STATE_DUMP)
cpu_relax();
uv_nmi_dump_state_cpu(cpu, regs);
}
@@ -615,7 +615,7 @@
local_irq_save(flags);
/* If not a UV System NMI, ignore */
- if (!atomic_read(&uv_cpu_nmi.pinging) && !uv_check_nmi(hub_nmi)) {
+ if (!this_cpu_read(uv_cpu_nmi.pinging) && !uv_check_nmi(hub_nmi)) {
local_irq_restore(flags);
return NMI_DONE;
}
@@ -639,7 +639,7 @@
uv_call_kgdb_kdb(cpu, regs, master);
/* Clear per_cpu "in nmi" flag */
- atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_OUT);
+ this_cpu_write(uv_cpu_nmi.state, UV_NMI_STATE_OUT);
/* Clear MMR NMI flag on each hub */
uv_clear_nmi(cpu);
@@ -666,16 +666,16 @@
{
int ret;
- uv_cpu_nmi.queries++;
- if (!atomic_read(&uv_cpu_nmi.pinging)) {
+ this_cpu_inc(uv_cpu_nmi.queries);
+ if (!this_cpu_read(uv_cpu_nmi.pinging)) {
local64_inc(&uv_nmi_ping_misses);
return NMI_DONE;
}
- uv_cpu_nmi.pings++;
+ this_cpu_inc(uv_cpu_nmi.pings);
local64_inc(&uv_nmi_ping_count);
ret = uv_handle_nmi(reason, regs);
- atomic_set(&uv_cpu_nmi.pinging, 0);
+ this_cpu_write(uv_cpu_nmi.pinging, 0);
return ret;
}
next prev parent reply other threads:[~2014-06-20 19:32 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 19:31 [PATCH 00/31] percpu: Consistent per cpu operations V5 Christoph Lameter
2014-06-20 19:31 ` [PATCH 01/31] kernel misc: Replace __get_cpu_var uses Christoph Lameter
2014-07-18 23:26 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 02/31] time: " Christoph Lameter
2014-06-20 19:31 ` [PATCH 03/31] scheduler: Replace __get_cpu_var with this_cpu_ptr Christoph Lameter
2014-07-18 23:27 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 04/31] block: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2014-07-18 23:28 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 05/31] drivers/char/random: Replace __get_cpu_var uses Christoph Lameter
2014-07-18 23:28 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 06/31] drivers/cpuidle: Replace __get_cpu_var uses for address calculation Christoph Lameter
2014-07-18 23:28 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 07/31] drivers/oprofile: " Christoph Lameter
2014-07-18 23:28 ` Tejun Heo
2014-07-19 11:54 ` Robert Richter
2014-06-20 19:31 ` [PATCH 08/31] drivers/clocksource: Replace __get_cpu_var used " Christoph Lameter
2014-07-18 23:29 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 09/31] drivers/net/ethernet/tile: Replace __get_cpu_var uses " Christoph Lameter
2014-07-18 23:29 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 10/31] watchdog: Replace __raw_get_cpu_var uses Christoph Lameter
2014-07-18 23:29 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 11/31] net: Replace get_cpu_var through this_cpu_ptr Christoph Lameter
2014-07-18 23:29 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 12/31] md: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2014-07-18 23:29 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 13/31] metag: Replace __get_cpu_var uses for address calculation Christoph Lameter
2014-07-18 23:30 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 14/31] drivers/net/ethernet/tile: __get_cpu_var call introduced in 3.14 Christoph Lameter
2014-07-18 23:30 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 15/31] irqchips: Replace __this_cpu_ptr uses Christoph Lameter
2014-07-18 23:30 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 16/31] x86: Replace __get_cpu_var uses Christoph Lameter
2014-06-20 19:31 ` Christoph Lameter [this message]
2014-07-18 23:30 ` [PATCH 17/31] uv: Replace __get_cpu_var Tejun Heo
2014-06-20 19:31 ` [PATCH 18/31] arm: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2014-07-18 23:31 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 19/31] MIPS: Replace __get_cpu_var uses in FPU emulator Christoph Lameter
2014-06-20 20:07 ` David Daney
2014-07-18 23:31 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 20/31] mips: Replace __get_cpu_var uses Christoph Lameter
2014-07-18 23:31 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 21/31] s390: " Christoph Lameter
2014-07-18 23:32 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 22/31] s390: cio driver &__get_cpu_var replacements Christoph Lameter
2014-07-18 23:32 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 23/31] ia64: Replace __get_cpu_var uses Christoph Lameter
2014-07-18 23:32 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 24/31] alpha: Replace __get_cpu_var Christoph Lameter
2014-07-18 23:32 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 25/31] powerpc: Replace __get_cpu_var uses Christoph Lameter
2014-06-20 19:31 ` [PATCH 26/31] tile: " Christoph Lameter
2014-07-18 23:33 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 27/31] tile: Use this_cpu_ptr() for hardware counters Christoph Lameter
2014-07-18 23:33 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 28/31] blackfin: Replace __get_cpu_var uses Christoph Lameter
2014-07-18 23:33 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 29/31] avr32: Replace __get_cpu_var with __this_cpu_write Christoph Lameter
2014-07-18 23:33 ` Tejun Heo
2014-06-20 19:31 ` [PATCH 30/31] Remove __get_cpu_var and __raw_get_cpu_var macros [only in 3.17] Christoph Lameter
2014-06-20 19:31 ` [PATCH 31/31] percpu: Remove __this_cpu_ptr Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140620193126.861853673@linux.com \
--to=cl@linux.com \
--cc=akpm@linuxfoundation.org \
--cc=hedi@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sivanich@sgi.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=travis@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).