From: Ralf Baechle <ralf@linux-mips.org>
To: Daniel Jacobowitz <dan@debian.org>
Cc: linux-mips@linux-mips.org
Subject: Re: Fix some (maybe) missing syncs in bitops.h
Date: Mon, 24 Jan 2005 21:05:35 +0000 [thread overview]
Message-ID: <20050124210535.GA2797@linux-mips.org> (raw)
In-Reply-To: <20050121010403.GA10371@nevyn.them.org>
On Thu, Jan 20, 2005 at 08:04:03PM -0500, Daniel Jacobowitz wrote:
> If I'm reading the broadcom documentation right, the semantics of set_bit
> and test_and_set_bit require a sync at the end on this architecture.
Linux semantics of the bit functions are less than obvious. The functions
set_bit, change_bit and clear_bit may be atomic but they don't have memory
barrier semantics, that is memory accesses before the function call may be
reordered to be executed after the function has been completed or vice
versa. The test_and_{set,clear,change}_bit functions however have memory
barrier semantics. The intended use is something like:
if (!test_and_set_bit(bitnr, bitmap)) {
/* we got the bit */
... do something ...
smp_mb__before_clear_bit();
clear_bit(bitnr, bitmap);
smp_mb__after_clear_bit();
} else
printk("Bit was already set by somebody else\n");
> I've been trying to track down a nasty signal delivery bug that I thought
> was a TIF_SIGPENDING not being visible on the other CPU early enough. Turns
> out that wasn't the problem, but I still think the syncs are correct, so I'm
> posting the patch.
And the code indeed seems to be ok as it is.
Ralf
next prev parent reply other threads:[~2005-01-24 21:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-21 1:04 Fix some (maybe) missing syncs in bitops.h Daniel Jacobowitz
2005-01-24 21:05 ` Ralf Baechle [this message]
2005-01-24 21:21 ` Daniel Jacobowitz
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=20050124210535.GA2797@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=dan@debian.org \
--cc=linux-mips@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.