linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Bill Huey (hui) <billh@gnuppy.monkey.org>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	"Bill Huey \(hui\)" <billh@gnuppy.monkey.org>,
	mingo@elte.hu
Subject: Re: [patch 2/6 -rt] powerpc 2.6.20-rt8: to convert spinlocks to raw ones.
Date: Wed, 7 Mar 2007 16:43:44 -0800	[thread overview]
Message-ID: <20070308004344.GA23200@gnuppy.monkey.org> (raw)
In-Reply-To: <17903.12035.781782.317694@cargo.ozlabs.ibm.com>

On Thu, Mar 08, 2007 at 08:30:43AM +1100, Paul Mackerras wrote:
> Sergei Shtylyov writes:
> 
> >     I've floowed up to my patch with such explanation. In the context of an-rt 
> > patch itself, it was just too clear, hence I didn't go into explanations in 
> > the patch itself. :-)
> 
> Well, it might be clear, to you, now, with the context in your head.
> But if such a patch is to go into a git tree, and somebody comes along
> in 3 years time and wants to know exactly why you made that change
> (and maybe that somebody is you :), then they will need more detail -
> such as how you came to the conclusion that those locks and no others
> needed to be changed, for instance.
> 
> At least give some of the reasoning behind your choice of which locks
> to convert, so that in future, if the patch turns out to have
> introduced a bug somehow, the person debugging it can either identify
> that there was a flaw in your logic, or else understand something that
> you have seen that they missed.

Paul,

It has to do with how locking is done in the -rt patch itself. It's probably
before the time of general maintainers since the -rt patch hasn't been fully
merged, but I agree a document needs to be written outlining what needs to
be changed to spinlocks and what locks can be emulated with the rtmutex.c/rt.c
logic. There aren't that many people that know specifically unless they've
tried to map out chunks of the Linux kernel for this purpose in the first
place. I only know because of my own parallel effort to get the kernel to be
preemptive (the old mmLinux project that I abandoned for Ingo's stuff).

Generally, things that run within interrupt contexts need to be spinlocks.
The interrupt controller is one of those things obviously, the timer interrupt
for practical reasons such as performance and other places so that locking is
outside of direct control and scope of the scheduler. Of course the scheduler's
runqueues needs to be spinlocked for the reasons above otherwise your system
is stuck with a kind chicken and the egg problem interacting with the scheduler. 

The places that need to be reverted to raw spinlocks are generally either
acquired by function calls that allocate the spinlock at a terminal of the
kernel's lock graph or isolated from other callers completely (parts of the
timer for logic for instance). It's all about the collision of various lock
(preemptive and non-preemptive) subtrees and how to avoid scheduling within
atomic violations that lead to deadlocks. The -rt patch gets arbitrary
preemption abilities by shrinking the non-preemptive sub-tree bit to the bare
essentials of what will let a system to run yet still preserve all of
the expected locking semantics of a critical section.

Otherwise everything by default is backed by a blocking rtmutex identity
to provide for correct preemptivity behavior within critical sections. That
is why these reverts are needed to restore the mathematical correctness of
the kernel's locking structures.

I hope this is helpful.

bill

  reply	other threads:[~2007-03-08  1:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07  1:34 [patch 0/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings for PowerPC(ppc64) Tsutomu OWA
2007-03-07  1:36 ` [patch 1/6 -rt] powerpc 2.6.20-rt8: add preemption checks for NEED_RESCHED_DELAYED Tsutomu OWA
2007-03-16 19:20   ` Sergei Shtylyov
2007-03-19  0:00     ` Tsutomu OWA
2007-03-07  1:37 ` [patch 2/6 -rt] powerpc 2.6.20-rt8: to convert spinlocks to raw ones Tsutomu OWA
2007-03-07 14:38   ` Sergei Shtylyov
2007-03-07 14:43     ` Benjamin Herrenschmidt
2007-03-07 14:54       ` Sergei Shtylyov
2007-03-07 16:49     ` Paul Mackerras
2007-03-07 17:30       ` Sergei Shtylyov
2007-03-07 19:21         ` Paul Mackerras
2007-03-07 21:21           ` Sergei Shtylyov
2007-03-07 21:30             ` Paul Mackerras
2007-03-08  0:43               ` Bill Huey [this message]
2007-03-08  3:26                 ` Paul Mackerras
2007-03-08  4:00                   ` Bill Huey
2007-03-07  1:39 ` [patch 3/6 -rt] powerpc 2.6.20-rt8: fix a runtime warning for smp_processor_id() Tsutomu OWA
2007-03-07  1:42 ` [RFC] [patch 4/6 -rt] powerpc 2.6.20-rt8: fix a runtime warnings for xmon Tsutomu OWA
2007-03-07  9:16   ` Ingo Molnar
2007-03-07 10:10     ` Benjamin Herrenschmidt
2007-03-07 10:54       ` Tsutomu OWA
2007-03-07 11:06     ` Arnd Bergmann
2007-03-07  1:45 ` [RFC] [patch 5/6] powerpc 2.6.20-rt8: fix a boot error for handle_percpu_irq Tsutomu OWA
2007-03-07 21:29   ` Sergei Shtylyov
2007-03-07  1:47 ` [patch 6/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings Tsutomu OWA
2007-03-07  9:13 ` [patch 0/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings for PowerPC(ppc64) Ingo Molnar
2007-03-07 14:26 ` Sergei Shtylyov
2007-03-08  2:28   ` Tsutomu OWA

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=20070308004344.GA23200@gnuppy.monkey.org \
    --to=billh@gnuppy.monkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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).