public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: discuss@x86-64.org
Cc: Andrey Savochkin <saw@sawoct.com>, Kirill Korotaev <dev@sw.ru>,
	linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
	Andrew Morton <akpm@osdl.org>,
	xemul@sw.ru, st@sw.ru
Subject: Re: [discuss] Re: SMP syncronization on AMD processors (broken?)
Date: Thu, 6 Oct 2005 16:02:29 +0200	[thread overview]
Message-ID: <200510061602.30558.ak@suse.de> (raw)
In-Reply-To: <20051006174604.B10342@castle.nmd.msu.ru>

On Thursday 06 October 2005 15:46, Andrey Savochkin wrote:
> On Thu, Oct 06, 2005 at 03:32:30PM +0200, Andi Kleen wrote:
> > Kirill Korotaev <dev@sw.ru> writes:
> > > Please help with a not simple question about spin_lock/spin_unlock on
> > > SMP archs. The question is whether concurrent spin_lock()'s should
> > > acquire it in more or less "fair" fashinon or one of CPUs can starve
> > > any arbitrary time while others do reacquire it in a loop.
> >
> > They are not fully fair because of the NUMAness of the system.
> > Same on many other NUMA systems.
> >
> > We considered long ago to use queued locks to avoid this, but
> > they are quite costly for the uncongested case and never seemed worth it.
> >
> > So live with it.
>
> Well, it's hard to swallow...
> It's not about being not fully fair, it's about deadlocks that started
> to appear after code changes inside retry loops...

Don't do that then.

> A practical question is whether there is an "official" way to tell the CPU
> that it should synchronize with memory, or if you have ideas how to make it
> less costly than queued locks.

I don't think there is an way specified in the architecture. So you're
definitely in undocumented system dependent territory if you attempt this.

delay.

Or maybe a write combining access (movnti) follwed with a sfence.
 

> A theoretical question is how many places in the kernel use such retry
> loops that may start to fail some day (or on some machines)...

We already have such cases - e.g. our rwlocks always had such a deadlock
even on SMP systems. As far as I know it has been reported exactly once on a 
64CPU IA64 system, but it wasn't possible to fix it without large scale
changes so it was ignored.   I am not aware of the problem ever happening on a 
production system.

And in general fairness was never a force of Linux. A lot of subsystems
do resource handling / sharing without taking it into account. And so far
we got away with it.

I'm not saying it's a good thing, but that general strategy  
doesn't seem to have hurt us significantly so far and the fixes are usually
worse than the problems.

-Andi

  reply	other threads:[~2005-10-06 14:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-06 13:05 SMP syncronization on AMD processors (broken?) Kirill Korotaev
2005-10-06 13:14 ` linux-os (Dick Johnson)
2005-10-06 13:19 ` Arjan van de Ven
2005-10-06 13:32   ` Andrey Savochkin
2005-10-06 14:22     ` Arjan van de Ven
2005-10-06 13:32 ` Andi Kleen
2005-10-06 13:46   ` Andrey Savochkin
2005-10-06 14:02     ` Andi Kleen [this message]
2005-10-06 14:52     ` Linus Torvalds
2005-10-06 15:21       ` Andrey Savochkin
2005-10-06 15:46         ` Linus Torvalds
2005-10-11  0:59         ` Andrew Morton
2005-10-11  1:20           ` Andi Kleen
2005-10-11  3:20             ` Joe Seigh
2005-10-06 13:50   ` Eric Dumazet
2005-10-06 13:56     ` [discuss] " Andi Kleen
2005-10-06 14:10       ` Eric Dumazet
2005-10-06 14:11         ` Andi Kleen
2005-10-06 14:45 ` Linus Torvalds
2005-10-06 15:34   ` Hugh Dickins
2005-10-06 15:53     ` Eric Dumazet
2005-10-06 16:01     ` Linus Torvalds
2005-10-07 20:38 ` Joe Seigh
2005-10-07 20:57   ` Stephen Hemminger
2005-10-13 18:24 ` Joe Seigh

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=200510061602.30558.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=dev@sw.ru \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saw@sawoct.com \
    --cc=st@sw.ru \
    --cc=torvalds@osdl.org \
    --cc=xemul@sw.ru \
    /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