From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Cc: johnpol@2ka.mipt.ru
Subject: [PATCH] w1: get rid of the potential problems with atomic operations.
Date: Fri, 4 Mar 2005 12:39:43 -0800 [thread overview]
Message-ID: <1109968783581@kroah.com> (raw)
In-Reply-To: <11099687823191@kroah.com>
ChangeSet 1.2085, 2005/03/02 16:59:41-08:00, johnpol@2ka.mipt.ru
[PATCH] w1: get rid of the potential problems with atomic operations.
Get rid of the potential problems with atomic operations.
According to upcoming atomic_ops.txt by David Miller and Anton Blanchard
some archs may reoder atomic operations with nonatomic, since
the former are always visible but the latter are not, this can lead
to unpredicted behaviour.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/w1/w1_family.c | 2 ++
drivers/w1/w1_therm.c | 2 ++
2 files changed, 4 insertions(+)
diff -Nru a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
--- a/drivers/w1/w1_family.c 2005-03-04 12:37:51 -08:00
+++ b/drivers/w1/w1_family.c 2005-03-04 12:37:51 -08:00
@@ -138,7 +138,9 @@
void __w1_family_get(struct w1_family *f)
{
+ smp_mb__before_atomic_inc();
atomic_inc(&f->refcnt);
+ smp_mb__after_atomic_inc();
}
EXPORT_SYMBOL(w1_family_get);
diff -Nru a/drivers/w1/w1_therm.c b/drivers/w1/w1_therm.c
--- a/drivers/w1/w1_therm.c 2005-03-04 12:37:51 -08:00
+++ b/drivers/w1/w1_therm.c 2005-03-04 12:37:51 -08:00
@@ -104,6 +104,7 @@
int i, max_trying = 10;
atomic_inc(&sl->refcnt);
+ smp_mb__after_atomic_inc();
if (down_interruptible(&sl->master->mutex)) {
count = 0;
goto out_dec;
@@ -179,6 +180,7 @@
out:
up(&dev->mutex);
out_dec:
+ smp_mb__before_atomic_inc();
atomic_dec(&sl->refcnt);
return count;
next prev parent reply other threads:[~2005-03-04 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-04 20:39 [BK PATCH] W1 patches for 2.6.11 Greg KH
2005-03-04 20:39 ` [PATCH] w1/w1_therm: replace schedule_timeout() with msleep_interruptible() Greg KH
2005-03-04 20:39 ` [PATCH] w1: dscore cleanups. 2/2 Greg KH
2005-03-04 20:39 ` [PATCH] w1: Core cleanup 1/2 Greg KH
2005-03-04 20:39 ` [PATCH] w1: fix some compiler warnings generated by the last "static" patch Greg KH
2005-03-04 20:39 ` [PATCH] w1: replace obsoleted *sleep_on* Greg KH
2005-03-04 20:39 ` Greg KH [this message]
2005-03-04 20:39 ` [PATCH] drivers/w1/*: convert to pci_register_driver Greg KH
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=1109968783581@kroah.com \
--to=greg@kroah.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.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