public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Nicolas Pitre <nico@cam.org>,
	Christoph Hellwig <hch@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Arjan van de Ven <arjanv@infradead.org>,
	Jes Sorensen <jes@trained-monkey.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Oleg Nesterov <oleg@tv-sign.ru>,
	David Howells <dhowells@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Benjamin LaHaise <bcrl@kvack.org>,
	Steven Rostedt <rostedt@goodmis.org>, Andi Kleen <ak@suse.de>
Subject: Re: [patch 0/9] mutex subsystem, -V4
Date: Thu, 22 Dec 2005 22:04:46 +0100	[thread overview]
Message-ID: <20051222210446.GA16092@elte.hu> (raw)
In-Reply-To: <20051222165828.GA5268@flint.arm.linux.org.uk>


* Russell King <rmk+lkml@arm.linux.org.uk> wrote:

> > but couldnt you implement atomic_dec_return() with the ll/sc 
> > instructions? Something like:
> > 
> > repeat:
> >        ldrex   r1, [r0]
> >        sub     r1, r1, #1
> >        strex   r2, r1, [r0]
> >        orrs    r0, r2, r1
> >        jneq    repeat
> > 
> > (shot-in-the-dark guess at ARMv6 assembly)
> 
> atomic_dec_return() would be:
> 
> 1:	ldrex	r1, [r0]
> 	sub	r1, r1, #1
> 	strex	r2, r1, [r0]
> 	teq	r2, #0
> 	bne	1b
> 	@ result in r1
> 
> But that's not really the main point Nico's making.  Yes, on ARMv6 
> there is little difference.  However, ARMv6 is _not_ mainstream yet.  
> The previous generation which do not have this is currently 
> mainstream.

i think there is some miscommunication here. I am actually on your side, 
and i spent all my day enabling the best mutex variant on both the v5 
and v6 version of your CPU. What we were doing was to discuss the 
details of getting there. So dont shoot the messenger, ok?

This is Nico's point i replied to:

> > [...] on ARMv6 at least this can be improved even further, but a
> > special implementation which is neither a fully qualified atomic
> > decrement nor an atomic swap is needed. [...]

and this was my reply:

> i'm curious, how would this ARMv6 solution look like, and what would 
> be the advantages over the atomic swap based variant?

to which Nico replied with an ll/sc implementation, which very much 
looked like atomic_dec_return(). That's all i said. Nobody is trying to
shut out anything from anywhere, and certainly not me. I am _enabling_
your stuff. I'm just trying to find the most maintainable and still most 
flexible solution.

> Nico's point still stands though - and I'd like to ask a more direct 
> question.  There is an efficient implementation for ARMv5 CPUs which 
> it appears we're being denied the ability to use.

do you realize that i've enabled this efficient implementation via 
CONFIG_MUTEX_XCHG_ALGORITHM? Do you realize that you _dont_ have to use 
extremely heavy IRQ-disabling ops on ARM to enable mutexes? Do you 
realize that what we are down to now are 1-2 instructions of 
differences?

The discussion was not about ARMv5 at all. The discussion was about the 
claim that 'ARMv6 is somehow magical that it needs its own stuff'. No it 
isnt magical, it's a sane CPU that can implement a sane 
atomic_dec_return(), or even better, a sane atomic_*_call_if_*() 
primitive. Or whatever primitive we end up having - i dont mind if it's 
called __mutex_whatever, as long as it has a _well defined_ meaning.

what i _DONT_ want is some over-opaque per-arch thing that will again 
escallate into the same situation as semaphores: 23 different 
implementations nobody is able to change at once, nobody is able to add 
features or debugging to, and by today there's probably is no single 
person on this planet who knows all 23 of them to begin with.

if you sense me trying to avoid something then that's it: ambiguities in 
the arch-level implementation, because they end up stiffling the generic 
code.

	Ingo

  reply	other threads:[~2005-12-22 21:05 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22 11:41 [patch 0/9] mutex subsystem, -V4 Ingo Molnar
2005-12-22 11:53 ` Christoph Hellwig
2005-12-22 12:45   ` Ingo Molnar
2005-12-22 15:34   ` Nicolas Pitre
2005-12-22 15:40     ` Ingo Molnar
2005-12-22 16:32       ` Nicolas Pitre
2005-12-22 16:44         ` Ingo Molnar
2005-12-22 16:58           ` Russell King
2005-12-22 21:04             ` Ingo Molnar [this message]
2005-12-22 21:26               ` Russell King
2005-12-22 21:27               ` Nicolas Pitre
2005-12-22 21:37                 ` [patch 1/2] mutex subsystem: basic per arch fast path primitives Nicolas Pitre
2005-12-22 21:53                   ` Christoph Hellwig
2005-12-22 21:40                 ` [patch 2/2] mutex subsystem: use the per architecture fast path lock_unlock defines Nicolas Pitre
2005-12-22 21:54                 ` [patch 0/9] mutex subsystem, -V4 Ingo Molnar
2005-12-22 16:58           ` Nicolas Pitre
2005-12-22 17:20     ` Christoph Hellwig
2005-12-22 17:33     ` Steven Rostedt
2005-12-22 18:24       ` Nicolas Pitre
2005-12-22 11:54 ` Andrew Morton
2005-12-22 12:20   ` Ingo Molnar
2005-12-22 13:07     ` Andrew Morton
2005-12-22 13:23       ` Arjan van de Ven
2005-12-22 13:44         ` Andrew Morton
2005-12-22 14:11           ` Alan Cox
2005-12-22 23:30             ` Andrew Morton
2005-12-22 23:34               ` Christoph Hellwig
     [not found]                 ` <32801.10.10.10.28.1135295357.squirrel@linux1>
2005-12-22 23:49                   ` Sean
2005-12-22 23:53                     ` Randy.Dunlap
     [not found]                       ` <50572.10.10.10.28.1135296023.squirrel@linux1>
2005-12-23  0:00                         ` Sean
2005-12-23  0:00                       ` Steven Rostedt
     [not found]                 ` <20051222221311.2f6056ec.akpm@osdl.org>
2005-12-23 14:24                   ` Nicolas Pitre
2005-12-23 14:51                     ` Andrew Morton
2005-12-23 14:57                       ` Russell King
2005-12-23 15:04                         ` Xavier Bestel
2005-12-23 15:27                           ` Andrew Morton
2005-12-23 15:00                       ` Steven Rostedt
2006-01-03 17:54                       ` Abhijit Bhopatkar
2005-12-25 16:08                 ` Roman Zippel
2005-12-25 22:54                   ` Ingo Molnar
2005-12-26 21:49                     ` Roman Zippel
2005-12-25 23:04                   ` Andrew Morton
2005-12-25 23:22                     ` Ingo Molnar
2005-12-26 10:35                       ` Andrew Morton
2005-12-26 10:42                         ` Arjan van de Ven
2005-12-26 11:11                           ` Andrew Morton
2005-12-26 17:15                             ` Mike Galbraith
2005-12-26 17:44                               ` Lee Revell
2005-12-27  0:32                             ` David Lang
2005-12-26 18:15                           ` Linus Torvalds
2005-12-27 14:42                         ` Ingo Molnar
2005-12-27 23:02                           ` Andrew Morton
2005-12-26  0:33                     ` Moore's law (was Re: [patch 0/9] mutex subsystem, -V4) Pavel Machek
2006-01-05 15:30                       ` Andi Kleen
2006-01-05 19:08                         ` Pavel Machek
2005-12-26 15:29                     ` [patch 0/9] mutex subsystem, -V4 Nicolas Pitre
2005-12-22 15:46           ` Thomas Gleixner
2005-12-22 17:40             ` Linus Torvalds
2005-12-22 20:09               ` Steven Rostedt
2005-12-22 17:17           ` Christoph Hellwig
2005-12-22 15:19       ` Nicolas Pitre
2005-12-22 21:43       ` Paul Mackerras

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=20051222210446.GA16092@elte.hu \
    --to=mingo@elte.hu \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjanv@infradead.org \
    --cc=bcrl@kvack.org \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=jes@trained-monkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@cam.org \
    --cc=oleg@tv-sign.ru \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@osdl.org \
    --cc=zwane@arm.linux.org.uk \
    /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