From: Grant Grundler <grundler@parisc-linux.org>
To: Paul Mackerras <paulus@samba.org>
Cc: Grant Grundler <grundler@parisc-linux.org>,
Brian King <brking@us.ibm.com>, Andrew Morton <akpm@osdl.org>,
greg@kroah.com, matthew@wil.cx, benh@kernel.crashing.org,
ak@muc.de, linux-kernel@vger.kernel.org,
alan@lxorguk.ukuu.org.uk, linux-pci@atrey.karlin.mff.cuni.cz
Subject: Re: [PATCH 1/2] pci: Block config access during BIST (resend)
Date: Wed, 7 Sep 2005 19:21:16 -0600 [thread overview]
Message-ID: <20050908012116.GB2065@colo.lackof.org> (raw)
In-Reply-To: <17183.27667.47675.454393@cargo.ozlabs.ibm.com>
On Thu, Sep 08, 2005 at 08:39:15AM +1000, Paul Mackerras wrote:
> Grant Grundler writes:
>
> > I would argue it more obvious. People looking at the code
> > are immediately going to realize it was a deliberate choice to
> > not use a spinlock.
>
> It achieves exactly the same effect as spin_lock/spin_unlock, just
> more verbosely. :)
Not exactly identical. spin_try_lock() doesn't attempt to acquire
the lock and thus force exclusive access to the cacheline.
Other than that, I agree with you.
I don't see a problem with being verbose here since putting
a spinlock around something that's already atomic (assignment)
even caught Andrew's attention.
> > relax_cpu() doesn't do that?
>
> No, how can it, when it doesn't get told which virtual cpu to yield
> to? spin_lock knows which virtual cpu to yield to because we store
> that in the lock variable.
Ah ok. I was expecting relax_cpu() to just pick a "random" different one.
:^)
> > it's not wrong - just misleading IMHO. There is no
> > "critical section" in that particular chunk of code.
>
> Other code is using the lock to ensure the atomicity of a compound
> action, which involves the testing the flag and taking some action
> based on the value of the flag. We take the lock to preserve that
> atomicity. Locks are often used to make a set of compound actions
> atomic with respect to each other, which is what we're doing here.
Yes.
We agree this chunk only needs to wait until the lock is released.
Other critical sections need to acquire/release the lock.
> > If relax_cpu doesn't allow time-slice donation, then I guess
> > spinlock/unlock with only a comment inside it explain why
> > would be ok too.
>
> Preferable, in fact. :)
Ok. I was just suggesting the alternative since
Andrew (correctly) questioned the use of a spinlock
and it didn't look right to me either.
thanks,
grant
next prev parent reply other threads:[~2005-09-08 1:15 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-10 14:49 [PATCH 1/1] " brking
2005-01-10 16:10 ` Andi Kleen
2005-01-10 16:25 ` Brian King
2005-01-10 16:29 ` Andi Kleen
2005-01-10 22:57 ` Brian King
2005-01-11 14:37 ` Alan Cox
2005-01-11 17:33 ` Andi Kleen
2005-01-11 22:17 ` Brian King
2005-01-13 15:36 ` Alan Cox
2005-01-13 15:35 ` Alan Cox
2005-01-13 18:03 ` Andi Kleen
2005-01-13 18:46 ` Alan Cox
2005-01-13 20:23 ` Andi Kleen
2005-01-13 19:44 ` Alan Cox
2005-01-13 21:50 ` Andi Kleen
2005-01-15 0:33 ` Alan Cox
2005-01-15 1:44 ` Andi Kleen
2005-01-15 1:01 ` Alan Cox
2005-01-15 6:20 ` Benjamin Herrenschmidt
2005-01-16 0:58 ` Alan Cox
2005-01-16 4:01 ` Benjamin Herrenschmidt
2005-01-16 4:48 ` Andi Kleen
2005-01-16 20:53 ` Benjamin Herrenschmidt
2005-01-16 22:07 ` Andi Kleen
2005-01-16 22:14 ` Benjamin Herrenschmidt
2005-01-16 21:10 ` Alan Cox
2005-01-18 15:14 ` Brian King
2005-01-18 23:31 ` Andi Kleen
2005-01-18 23:36 ` Brian King
2005-01-19 22:40 ` Alan Cox
2005-01-26 16:34 ` Brian King
2005-01-26 22:10 ` Benjamin Herrenschmidt
2005-01-27 15:53 ` Alan Cox
2005-01-27 18:44 ` Brian King
2005-01-27 23:15 ` Benjamin Herrenschmidt
2005-01-28 14:35 ` Brian King
2005-02-01 7:27 ` Greg KH
2005-02-01 15:12 ` Brian King
2005-02-01 15:44 ` Matthew Wilcox
2005-02-01 17:35 ` Brian King
2005-02-01 17:47 ` Matthew Wilcox
2005-02-01 19:01 ` Brian King
2005-02-01 23:00 ` Benjamin Herrenschmidt
2005-02-02 15:33 ` Brian King
2005-02-08 20:08 ` Greg KH
2005-06-21 16:08 ` Brian King
2005-08-23 15:11 ` [PATCH 1/2] " Brian King
2005-08-23 15:14 ` [PATCH 2/2] ipr: " Brian King
2005-09-01 23:03 ` [PATCH 1/2] pci: " Andrew Morton
2005-09-02 23:56 ` Brian King
2005-09-02 22:43 ` Grant Grundler
2005-09-02 23:11 ` Paul Mackerras
2005-09-03 0:08 ` Grant Grundler
2005-09-03 23:37 ` Brian King
2005-09-03 19:39 ` Grant Grundler
2005-09-05 18:31 ` Brian King
2005-09-06 4:48 ` Grant Grundler
2005-09-06 14:28 ` Brian King
2005-09-07 5:49 ` Paul Mackerras
2005-09-07 14:58 ` Grant Grundler
2005-09-07 22:39 ` Paul Mackerras
2005-09-08 1:21 ` Grant Grundler [this message]
2005-09-08 3:05 ` Brian King
2005-09-08 4:08 ` Grant Grundler
2005-02-01 18:58 ` [PATCH 1/1] " Greg KH
2005-02-01 23:07 ` Benjamin Herrenschmidt
2005-02-01 22:58 ` Benjamin Herrenschmidt
2005-01-10 19:23 ` Alan Cox
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=20050908012116.GB2065@colo.lackof.org \
--to=grundler@parisc-linux.org \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=brking@us.ibm.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=matthew@wil.cx \
--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
all inboxes | Powered by JetHome®