All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Huang Ying <ying.huang@intel.com>,
	huang ying <huang.ying.caritas@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Len Brown <lenb@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: Re: [PATCH -v4 1/2] lib, Make gen_pool memory allocator lockless
Date: Thu, 18 Nov 2010 17:43:41 +0900	[thread overview]
Message-ID: <20101118084341.GA23766@linux-sh.org> (raw)
In-Reply-To: <1290069275.2109.1290.camel@laptop>

On Thu, Nov 18, 2010 at 09:34:35AM +0100, Peter Zijlstra wrote:
> On Thu, 2010-11-18 at 09:14 +0800, Huang Ying wrote:
> > On Wed, 2010-11-17 at 19:53 +0800, Peter Zijlstra wrote:
> > > On Wed, 2010-11-17 at 19:47 +0800, huang ying wrote:
> > > > On Wed, Nov 17, 2010 at 6:40 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> > > > > On Wed, 2010-11-17 at 10:18 +0800, Huang Ying wrote:
> > > > >>
> > > > >> cmpxchg has been used in that way by ftrace and perf for a long time. So
> > > > >> I agree to make it a requirement on future architecture ports.
> > > > >
> > > > > Neither mandate an architecture do this though, only that when an
> > > > > architecture wants to support either feature and has NMIs (not all archs
> > > > > have NMI equivalents) it has to be safe.
> > > > 
> > > > So we can make sure cmpxchg can be used in lock-less code on
> > > > architectures with perf, irq_work or ftrace enabled?
> > > 
> > > It had better, otherwise stuff is broken.
> > 
> > Take a look at superh architecture cmpxchg implementation. It seems that
> > cmpxchg is implemented with special instruction if CONFIG_GUSA_RB=y or
> > CONFIG_CPU_SH4A=y, otherwise it is implemented with local_irq_save. Is
> > it possible that superh has not PMU support if CONFIG_GUSA_RB=n and
> > CONFIG_CPU_SH4A=n, so that perf work properly but no NMI safe cmpxchg in
> > that situation?
> 
> Dunno, you forgot to CC the author of that code.. I've really no clue
> about SH.

At the moment it's only SH-4 and SH-4A CPUs that implement PMU support,
so all of these are covered by a theoretically NMI-safe cmpxchg
implementation. This is more by coincidence than design, though.

The only cause for concern really is SH-2A which supports hardware
breakpoints (and perf events by proxy) but doesn't contain a PMU, and
only uses an IRQs disabled cmpxchg for the moment. It also supports
ftrace. I suppose I'll need to come up with a hack for this case..

  reply	other threads:[~2010-11-18  8:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16  0:53 [PATCH -v4 0/2] Lockless memory allocator and list Huang Ying
2010-11-16  0:53 ` [PATCH -v4 1/2] lib, Make gen_pool memory allocator lockless Huang Ying
2010-11-16 21:50   ` Andrew Morton
2010-11-17  2:18     ` Huang Ying
2010-11-17  2:35       ` Andrew Morton
2010-11-17  3:03         ` Huang Ying
2010-11-17  3:57           ` Andrew Morton
2010-11-17  6:05             ` Huang Ying
2010-11-17 10:49               ` Peter Zijlstra
2010-11-17 11:16                 ` huang ying
2010-11-17 11:16                   ` huang ying
2010-11-17 11:38                   ` Peter Zijlstra
2010-11-17 10:40       ` Peter Zijlstra
2010-11-17 11:47         ` huang ying
2010-11-17 11:53           ` Peter Zijlstra
2010-11-18  1:14             ` Huang Ying
2010-11-18  8:34               ` Peter Zijlstra
2010-11-18  8:43                 ` Paul Mundt [this message]
2010-11-18  8:57                   ` Peter Zijlstra
2010-11-18  9:03                     ` Paul Mundt
2010-11-16  0:53 ` [PATCH -v4 2/2] lib, Add lock-less NULL terminated single list Huang Ying
2010-11-16 11:50   ` Peter Zijlstra
2010-11-16 16:33     ` Linus Torvalds
2010-11-16 16:33       ` Linus Torvalds
2010-11-16 11:49 ` [PATCH -v4 0/2] Lockless memory allocator and list Peter Zijlstra
2010-11-16 16:38   ` Linus Torvalds
2010-11-16 18:04     ` Peter Zijlstra
2010-11-17  1:45       ` Huang Ying
2010-11-17  1:03     ` Huang Ying

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=20101118084341.GA23766@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=huang.ying.caritas@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.