From: Will Deacon <will.deacon@arm.com>
To: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>,
"akpm@linuxfoundation.org" <akpm@linuxfoundation.org>,
Russell King <linux@arm.linux.org.uk>,
Catalin Marinas <Catalin.Marinas@arm.com>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Steven Rostedt <srostedt@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [gcv v3 27/35] arm: Replace __get_cpu_var uses
Date: Wed, 4 Sep 2013 10:33:35 +0100 [thread overview]
Message-ID: <20130904093335.GA8007@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <00000140e4440576-ae4236ee-3073-4f94-b569-d17396e57513-000000@email.amazonses.com>
Hi Christoph,
On Tue, Sep 03, 2013 at 03:39:57PM +0100, Christoph Lameter wrote:
> On Fri, 30 Aug 2013, Will Deacon wrote:
> > ...so I don't think this is quite right, and indeed, we get a bunch of errors
> > from GCC:
> >
> > arch/arm/kernel/hw_breakpoint.c: In function ‘arch_install_hw_breakpoint’:
> > arch/arm/kernel/hw_breakpoint.c:347:33: error: incompatible types when assigning to type ‘struct perf_event *[16]’ from type ‘struct perf_event **’
> > arch/arm/kernel/hw_breakpoint.c:347:1: error: incompatible types when assigning to type ‘struct perf_event *[16]’ from type ‘struct perf_event **’
> > arch/arm/kernel/hw_breakpoint.c:347:1: error: incompatible types when assigning to type ‘struct perf_event *[16]’ from type ‘struct perf_event **’
> > arch/arm/kernel/hw_breakpoint.c:347:1: error: incompatible types when assigning to type ‘struct perf_event *[16]’ from type ‘struct perf_event **’
>
> Did you apply the first patch of this series which is a bug fix?
No, sorry, I didn't see that. Do you have a branch anywhere that I can play
with?
> > changing to match your recipe still doesn't work, however:
> >
> > arch/arm/kernel/hw_breakpoint.c: In function ‘arch_install_hw_breakpoint’:
> > arch/arm/kernel/hw_breakpoint.c:347:33: error: cast specifies array type
>
> Yep that is the macro bug that was fixed in the first patch.
Ok. Sorry for the noise.
> > >
> > > WARN_ON(preemptible());
> > >
> > > - if (local_inc_return(&__get_cpu_var(mde_ref_count)) == 1)
> > > + if (this_cpu_inc_return(mde_ref_count) == 1)
> > > enable = DBG_MDSCR_MDE;
> >
> > I'm not sure that this is safe. We rely on local_inc_return to be atomic
> > with respect to the current CPU, which will end up being a wrapper around
> > atomic64_inc_return. However, this_cpu_inc_return simply uses a lock, so
> > other people accessing the count in a different manner (local_dec_and_test
> > below) may break local atomicity unless we start disabling interrupts or
> > something horrible like that.
>
> I do not see any special code for ARM for this_cpu_inc_return. The
> fallback solution in the core code is to disable interrupts for the
> inc_return and arch/arm/include/asm/percpu.h includes
> asm-generic/percpu.h.
>
> Where did you see it using a lock?
God knows! You're completely right, and we simply disable interrupts which I
somehow misread as taking a lock. However, is it guaranteed that mixing
an atomic64_* access with a this_cpu_inc_return will retain atomicity
between the two? E.g. if you get interrupted during an atomic64_xchg
operation, the interrupt handler issues this_cpu_inc_return, then on return
to the xchg operation it must reissue any reads that had been executed
prior to the interrupt. This should work on ARM/ARM64 (returning from the
interrupt will clear the exclusive monitor) but I don't know about other
architectures.
Will
next prev parent reply other threads:[~2013-09-04 9:33 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130828193457.140443630@linux.com>
2013-08-28 19:34 ` [gcv v3 01/35] x86: Use this_cpu_inc/dec for debug registers Christoph Lameter
2013-08-28 19:34 ` [gcv v3 02/35] percpu: Make __verify_pcu_ptr handle per cpu pointers to arrays Christoph Lameter
2013-08-28 19:46 ` [gcv v3 34/35] metag: Replace __get_cpu_var uses Christoph Lameter
2013-08-28 19:46 ` Christoph Lameter
2013-08-28 19:46 ` [gcv v3 23/35] s390: " Christoph Lameter
2013-08-28 19:46 ` Christoph Lameter
2013-08-28 19:46 ` [gcv v3 20/35] zcache/zsmalloc: " Christoph Lameter
2013-08-28 19:46 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 03/35] Coccinelle script for __get_cpu_var conversion Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 09/35] block: Replace __get_cpu_var uses Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 18/35] drivers/leds: " Christoph Lameter
2013-09-03 20:40 ` Bryan Wu
2013-08-28 19:48 ` [gcv v3 22/35] mips: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 12/35] watchdog: " Christoph Lameter
2013-08-28 19:48 ` [gcv v3 06/35] scheduler: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-29 7:58 ` Peter Zijlstra
2013-08-29 10:01 ` Ingo Molnar
2013-08-29 16:57 ` Christoph Lameter
2013-08-29 17:32 ` Steven Rostedt
2013-08-29 18:15 ` Christoph Lameter
2013-08-29 18:30 ` Steven Rostedt
2013-08-29 18:30 ` Steven Rostedt
2013-09-03 14:26 ` Christoph Lameter
2013-09-03 14:45 ` Frederic Weisbecker
2013-09-03 15:44 ` Steven Rostedt
2013-09-03 17:09 ` Christoph Lameter
2013-08-30 6:54 ` Ingo Molnar
2013-08-28 19:48 ` [gcv v3 04/35] net: " Christoph Lameter
2013-08-28 19:48 ` [gcv v3 16/35] drivers/oprofile: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 28/35] blackfin: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 32/35] arc: " Christoph Lameter
2013-08-29 6:33 ` Vineet Gupta
2013-08-29 16:43 ` Christoph Lameter
2013-09-04 7:46 ` Vineet Gupta
2013-09-04 14:14 ` Christoph Lameter
2013-09-05 5:01 ` Vineet Gupta
2013-09-05 14:19 ` Christoph Lameter
2013-09-05 14:29 ` Vineet Gupta
2013-09-05 14:29 ` Vineet Gupta
2013-08-28 19:48 ` [gcv v3 19/35] drivers: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-29 10:30 ` James Hogan
2013-08-28 19:48 ` [gcv v3 07/35] mm: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 08/35] tracing: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-29 21:26 ` Steven Rostedt
2013-09-03 14:34 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 25/35] powerpc: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 21:18 ` Geert Uytterhoeven
2013-08-29 16:41 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 05/35] time: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 17/35] drivers/net/ethernet/tile: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 13/35] kernel misc: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 11/35] percpu: " Christoph Lameter
2013-08-28 19:48 ` [gcv v3 10/35] rcu: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-31 20:36 ` Paul E. McKenney
2013-09-04 14:19 ` Christoph Lameter
2013-09-04 14:19 ` Christoph Lameter
2013-09-04 19:41 ` Paul E. McKenney
2013-09-04 19:51 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 35/35] Remove __get_cpu_var and __raw_get_cpu_var macros [only in 3.13] Christoph Lameter
2013-08-28 19:48 ` [gcv v3 26/35] sparc: Replace __get_cpu_var uses Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 14/35] drivers/char: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 29/35] avr32: " Christoph Lameter
2013-08-28 19:48 ` [gcv v3 24/35] ia64: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 21/35] x86: " Christoph Lameter
2013-08-28 19:48 ` Christoph Lameter
2013-08-28 19:48 ` [gcv v3 27/35] arm: " Christoph Lameter
2013-08-28 19:54 ` Russell King - ARM Linux
2013-08-28 20:42 ` Christoph Lameter
2013-08-28 20:42 ` Christoph Lameter
2013-08-30 10:01 ` Will Deacon
2013-09-03 14:39 ` Christoph Lameter
2013-09-04 9:33 ` Will Deacon [this message]
2013-09-04 9:33 ` Will Deacon
2013-09-04 14:17 ` Christoph Lameter
2013-09-04 14:23 ` Will Deacon
2013-09-04 14:54 ` Christoph Lameter
2013-09-04 17:46 ` Will Deacon
2013-09-04 18:09 ` Christoph Lameter
2013-09-04 18:21 ` Will Deacon
2013-09-04 18:21 ` Will Deacon
2013-09-04 18:31 ` Christoph Lameter
[not found] ` <alpine.DEB.2.02.1309041324530.26497@gentwo.org>
2013-09-04 20:58 ` Christoph Lameter
2013-09-05 13:03 ` Will Deacon
2013-09-05 13:03 ` Will Deacon
2013-09-05 14:24 ` Christoph Lameter
2013-09-05 17:28 ` Will Deacon
2013-09-05 17:52 ` Christoph Lameter
2013-09-06 11:04 ` Will Deacon
2013-09-06 15:39 ` Christoph Lameter
2013-08-28 20:06 ` [gcv v3 30/35] alpha: Replace __get_cpu_var Christoph Lameter
2013-08-28 20:06 ` [gcv v3 15/35] drivers/cpuidle: Replace __get_cpu_var uses Christoph Lameter
2013-08-28 20:06 ` Christoph Lameter
2013-08-28 20:06 ` [gcv v3 33/35] parisc: " Christoph Lameter
2013-08-28 20:06 ` Christoph Lameter
2013-08-28 20:46 ` [gcv v3 31/35] sh: " Christoph Lameter
2013-08-28 20:46 ` 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=20130904093335.GA8007@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=akpm@linuxfoundation.org \
--cc=cl@linux.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=srostedt@redhat.com \
--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).