From: David Daney <ddaney.cavm@gmail.com>
To: Christoph Lameter <cl@linux.com>,
Ralf Baechle <ralf@linux-mips.org>,
linux-mips <linux-mips@linux-mips.org>
Cc: Tejun Heo <tj@kernel.org>,
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>
Subject: Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
Date: Thu, 19 Dec 2013 15:08:06 -0800 [thread overview]
Message-ID: <52B37C56.7090302@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1312191506370.17603@nuc>
[-- Attachment #1: Type: text/plain, Size: 915 bytes --]
On 12/19/2013 01:10 PM, Christoph Lameter wrote:
> On Thu, 19 Dec 2013, David Daney wrote:
>
>>> 16:07:58.244398747 -0600
>>> @@ -43,7 +43,7 @@ DECLARE_PER_CPU(struct mips_fpu_emulator
>>> #define MIPS_FPU_EMU_INC_STATS(M) \
>>> do {
>>> \
>>> preempt_disable(); \
>>> - __local_inc(&__get_cpu_var(fpuemustats).M); \
>>> + __this_cpu_inc(fpuemustats.M); \
>>> preempt_enable(); \
>>> } while (0)
>>>
>>
>> Something seems to be incorrect in this bit.
>
> Hrmm.. yes this is a local_t so the this_cpu_inc would not work unless
> fpuemustats is defined differently.
>
See the attached patch. Feel free to include it as part of your patch set.
I tested it on a 64-bit OCTEON system. I think it will work on 32-bit
systems as well.
> Use
>
> __local_inc(this_cpu_ptr(fpuemustats.M);
>
No, I couldn't get various incantations of that to work either.
> instead until then.
>
[-- Attachment #2: 0001-MIPS-Replace-__get_cpu_var-uses-in-FPU-emulator.patch --]
[-- Type: text/x-patch, Size: 2182 bytes --]
>From cc9590cf4d75cf7fd36a58be132d35fbbe536a64 Mon Sep 17 00:00:00 2001
From: David Daney <david.daney@cavium.com>
Date: Thu, 19 Dec 2013 14:00:17 -0800
Subject: [PATCH] MIPS: Replace __get_cpu_var uses in FPU emulator.
The use of __this_cpu_inc() requires a fundamental integer type, so
change the type of all the counters to unsigned long, which is the
same width they were before, but not wrapped in local_t.
Signed-off-by: David Daney <david.daney@cavium.com>
---
arch/mips/include/asm/fpu_emulator.h | 14 +++++++-------
arch/mips/math-emu/cp1emu.c | 6 +++---
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index 2abb587..619fa5f 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -30,12 +30,12 @@
#ifdef CONFIG_DEBUG_FS
struct mips_fpu_emulator_stats {
- local_t emulated;
- local_t loads;
- local_t stores;
- local_t cp1ops;
- local_t cp1xops;
- local_t errors;
+ unsigned long emulated;
+ unsigned long loads;
+ unsigned long stores;
+ unsigned long cp1ops;
+ unsigned long cp1xops;
+ unsigned long errors;
};
DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
@@ -43,7 +43,7 @@ DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
#define MIPS_FPU_EMU_INC_STATS(M) \
do { \
preempt_disable(); \
- __local_inc(&__get_cpu_var(fpuemustats).M); \
+ __this_cpu_inc(fpuemustats.M); \
preempt_enable(); \
} while (0)
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index efe0088..b853d05 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -2110,13 +2110,13 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
static int fpuemu_stat_get(void *data, u64 *val)
{
int cpu;
- unsigned long sum = 0;
+ u64 sum = 0;
for_each_online_cpu(cpu) {
struct mips_fpu_emulator_stats *ps;
- local_t *pv;
+ unsigned long *pv;
ps = &per_cpu(fpuemustats, cpu);
pv = (void *)ps + (unsigned long)data;
- sum += local_read(pv);
+ sum += *pv;
}
*val = sum;
return 0;
--
1.7.11.7
next prev parent reply other threads:[~2013-12-19 23:08 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 15:50 [PATCH 00/40] percpu: Consistent per cpu operations V2 Christoph Lameter
2013-12-19 15:50 ` [PATCH 01/40] mm: Replace __get_cpu_var uses with this_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 02/40] tracing: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 03/40] percpu: Replace __get_cpu_var " Christoph Lameter
2013-12-19 15:50 ` [PATCH 04/40] kernel misc: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 05/40] drivers/char/random: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 06/40] drivers/cpuidle: Replace __get_cpu_var uses for address calculation Christoph Lameter
2013-12-19 15:50 ` [PATCH 07/40] drivers/oprofile: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 08/40] drivers/leds: Replace __get_cpu_var use through this_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 09/40] drivers/clocksource: Replace __get_cpu_var used for address calculation Christoph Lameter
2013-12-19 15:50 ` [PATCH 10/40] staging/zsmalloc: Replace instances of using __get_cpu_var " Christoph Lameter
2013-12-19 15:50 ` [PATCH 11/40] parisc: Replace __get_cpu_var uses " Christoph Lameter
2013-12-19 15:50 ` [PATCH 12/40] metag: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 13/40] drivers/net/ethernet/tile: " Christoph Lameter
2013-12-19 15:59 ` Chris Metcalf
2013-12-19 15:50 ` [PATCH 14/40] percpu: Add raw_cpu_ops Christoph Lameter
2013-12-19 15:50 ` [PATCH 15/40] mm: Use raw_cpu ops for determining current NUMA node Christoph Lameter
2013-12-19 15:50 ` [PATCH 16/40] modules: Use raw_cpu_write for initialization of per cpu refcount Christoph Lameter
2013-12-19 15:50 ` [PATCH 17/40] net: Replace __this_cpu_inc in route.c with raw_cpu_inc Christoph Lameter
2013-12-19 15:50 ` [PATCH 18/40] percpu: Add preemption checks to __this_cpu ops Christoph Lameter
2013-12-19 17:16 ` David Daney
2013-12-19 17:37 ` Christoph Lameter
2013-12-19 15:50 ` [PATCH 19/40] time: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 20/40] scheduler: Replace __get_cpu_var with this_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 21/40] block: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 22/40] rcu: Replace __this_cpu_ptr uses " Christoph Lameter
2013-12-19 15:50 ` [PATCH 23/40] watchdog: Replace __raw_get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 24/40] net: Replace get_cpu_var through this_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 25/40] md: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 26/40] irqchips: Replace __this_cpu_ptr uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 27/40] x86: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 28/40] arm: Replace __this_cpu_ptr with raw_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 29/40] mips: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 17:46 ` David Daney
2013-12-19 21:10 ` Christoph Lameter
2013-12-19 23:08 ` David Daney [this message]
2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
2013-12-19 21:31 ` Christoph Lameter
2013-12-19 15:50 ` [PATCH 30/40] s390: rename __this_cpu_ptr to raw_cpu_ptr Christoph Lameter
2013-12-19 15:50 ` [PATCH 31/40] ia64: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 32/40] powerpc: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 33/40] sparc: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 34/40] tile: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 35/40] blackfin: " Christoph Lameter
2013-12-19 15:50 ` [PATCH 36/40] avr32: Replace __get_cpu_var with __this_cpu_write Christoph Lameter
2013-12-19 15:50 ` [PATCH 37/40] alpha: Replace __get_cpu_var Christoph Lameter
2013-12-19 21:18 ` Richard Henderson
2013-12-19 21:47 ` Max Filippov
2013-12-20 17:59 ` Christoph Lameter
2013-12-19 15:50 ` [PATCH 38/40] sh: Replace __get_cpu_var uses Christoph Lameter
2013-12-19 15:50 ` [PATCH 39/40] Remove __get_cpu_var and __raw_get_cpu_var macros [only in 3.15] Christoph Lameter
2013-12-19 15:50 ` [PATCH 40/40] 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=52B37C56.7090302@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=akpm@linuxfoundation.org \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ralf@linux-mips.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/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).