* Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
[not found] ` <alpine.DEB.2.10.1312191506370.17603@nuc>
@ 2013-12-19 23:08 ` David Daney
2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
0 siblings, 2 replies; 5+ messages in thread
From: David Daney @ 2013-12-19 23:08 UTC (permalink / raw)
To: Christoph Lameter, Ralf Baechle, linux-mips
Cc: Tejun Heo, akpm, rostedt, linux-kernel, Ingo Molnar,
Peter Zijlstra, Thomas Gleixner
[-- 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.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
2013-12-19 23:08 ` [PATCH 29/40] mips: Replace __get_cpu_var uses David Daney
@ 2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2013-12-20 17:43 UTC (permalink / raw)
To: David Daney
Cc: Ralf Baechle, linux-mips, Tejun Heo, akpm, rostedt, linux-kernel,
Ingo Molnar, Peter Zijlstra, Thomas Gleixner
[-- Attachment #1: Type: TEXT/PLAIN, Size: 172 bytes --]
On Thu, 19 Dec 2013, David Daney wrote:
> See the attached patch. Feel free to include it as part of your patch set.
Looks good. I will place this before the mips patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-PATCH; NAME=0001-MIPS-Replace-__get_cpu_var-uses-in-FPU-emulator.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
2013-12-20 17:43 ` Christoph Lameter
@ 2013-12-20 17:43 ` Christoph Lameter
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2013-12-20 17:43 UTC (permalink / raw)
To: David Daney
Cc: Ralf Baechle, linux-mips, Tejun Heo, akpm, rostedt, linux-kernel,
Ingo Molnar, Peter Zijlstra, Thomas Gleixner
[-- Attachment #1: Type: TEXT/PLAIN, Size: 172 bytes --]
On Thu, 19 Dec 2013, David Daney wrote:
> See the attached patch. Feel free to include it as part of your patch set.
Looks good. I will place this before the mips patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-PATCH; NAME=0001-MIPS-Replace-__get_cpu_var-uses-in-FPU-emulator.patch, Size: 2181 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
2013-12-19 23:08 ` [PATCH 29/40] mips: Replace __get_cpu_var uses David Daney
2013-12-20 17:43 ` Christoph Lameter
@ 2013-12-20 17:49 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2013-12-20 17:49 UTC (permalink / raw)
To: David Daney
Cc: Ralf Baechle, linux-mips, Tejun Heo, akpm, rostedt, linux-kernel,
Ingo Molnar, Peter Zijlstra, Thomas Gleixner
[-- Attachment #1: Type: TEXT/PLAIN, Size: 245 bytes --]
On Thu, 19 Dec 2013, David Daney wrote:
> > Use
> >
> > __local_inc(this_cpu_ptr(fpuemustats.M);
> >
>
> No, I couldn't get various incantations of that to work either.
Your patch removes the last use of local.h by mips arch code by the way.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-PATCH; NAME=0001-MIPS-Replace-__get_cpu_var-uses-in-FPU-emulator.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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 29/40] mips: Replace __get_cpu_var uses
2013-12-20 17:49 ` Christoph Lameter
@ 2013-12-20 17:49 ` Christoph Lameter
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2013-12-20 17:49 UTC (permalink / raw)
To: David Daney
Cc: Ralf Baechle, linux-mips, Tejun Heo, akpm, rostedt, linux-kernel,
Ingo Molnar, Peter Zijlstra, Thomas Gleixner
[-- Attachment #1: Type: TEXT/PLAIN, Size: 245 bytes --]
On Thu, 19 Dec 2013, David Daney wrote:
> > Use
> >
> > __local_inc(this_cpu_ptr(fpuemustats.M);
> >
>
> No, I couldn't get various incantations of that to work either.
Your patch removes the last use of local.h by mips arch code by the way.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-PATCH; NAME=0001-MIPS-Replace-__get_cpu_var-uses-in-FPU-emulator.patch, Size: 2181 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-20 17:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20131219155015.443763038@linux.com>
[not found] ` <20131219155033.834416420@linux.com>
[not found] ` <52B330F3.4090603@gmail.com>
[not found] ` <alpine.DEB.2.10.1312191506370.17603@nuc>
2013-12-19 23:08 ` [PATCH 29/40] mips: Replace __get_cpu_var uses David Daney
2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:43 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
2013-12-20 17:49 ` Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox