From: Paul Mackerras <paulus@samba.org>
To: Nick Piggin <npiggin@suse.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [patch] xmon bitlock fix
Date: Tue, 20 Nov 2007 16:28:02 +1100 [thread overview]
Message-ID: <18242.28770.6643.679177@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <20071120050826.GA18332@wotan.suse.de>
Nick Piggin writes:
> xmon uses a bit lock spinlock but doesn't close the critical section
> when releasing it. It doesn't seem like a big deal because it will
> eventually break out of the lock anyway, but presumably that's only
> in exceptional cases where some error is tolerated, while the lack of a memory
> barrier could allow incorrect results during normal functioning operation
> as well.
>
> Convert it to use a regular spinlock instead.
I'd rather not. The idea is that xmon is as independent as possible
of the rest of the kernel, so that it will work even when lots of
kernel data structures are corrupted. If spinlocks were simple spin
loops then maybe, but they're not these days.
As for the memory barrier comment, I don't think it is a reason, since
test_and_set_bit acts as a barrier, and in any case the worst thing
that could happen is that the characters from different cpu's outputs
get interleaved (that's one reason why the loop has a timeout, the
other is for robustness).
In any case this is in arch/ppc which is dying code. I don't think
there are any SMP platforms supported in arch/ppc any more except for
some (fairly rare) PReP platforms, and I hope to get PReP moved over
soon.
Finally, why do you say that it doesn't close the critical section?
Possibly the "locked" variable is badly named (it's zero when we get
the lock) but AFAICS the code is actually correct.
Paul.
next prev parent reply other threads:[~2007-11-20 5:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 5:08 [patch] xmon bitlock fix Nick Piggin
2007-11-20 5:09 ` [patch] powerpc: hash lock use lock bitops Nick Piggin
2007-11-20 6:08 ` Benjamin Herrenschmidt
2007-11-20 6:26 ` Nick Piggin
2007-11-20 7:10 ` Benjamin Herrenschmidt
2007-11-20 5:28 ` Paul Mackerras [this message]
2007-11-20 6:03 ` [patch] xmon bitlock fix Nick Piggin
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=18242.28770.6643.679177@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=npiggin@suse.de \
/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).