public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andrew Morton <akpm@osdl.org>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Zdenek Kabelac <zdenek.kabelac@gmail.com>,
	pm list <linux-pm@lists.linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	davem@davemloft.net, Pierre Ossman <drzeus-mmc@drzeus.cx>
Subject: Re: [patch] Re: using long instead of atomic_t when only set/read	is required
Date: Mon, 3 Mar 2008 18:24:10 +0100	[thread overview]
Message-ID: <20080303172410.GA13869@elf.ucw.cz> (raw)
In-Reply-To: <20080303154831.22a4eb14@core>

Hi!

> > Ok, so linux actually atomicity of long?
                         ^~-- assumes should be here.

> No it doesn't. And even if it did you couldn't use long for this because
> atomic_t also ensures the points operations complete are defined. You
> might just about get away with volatile long * objects on x86 for simple
> assignments but for anything else gcc can and will generate code to
> update values whichever way it feels best - which includes turning
> 
> 	long *x = a + b;
> 
> into
> 
> 	*x = a;
> 	*x += b;

Ok, I can understand the gcc side. But do we actually run on an
architecture where

long *x;

*x = 0;

racing with 

*x = 0x12345678;

can produce

*x == 0x12340000;

or something like that? I'm told RCU relies on architectures not doing
this, and I'd like to get this clarified.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2008-03-03 17:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080225090316.GA420@elf.ucw.cz>
2008-02-25 14:46 ` using long instead of atomic_t when only set/read is required (was Re: [Bug 10030] Suspend doesn't work when SD card is inserted) Alan Stern
     [not found] ` <Pine.LNX.4.44L0.0802250943410.3549-100000@iolanthe.rowland.org>
2008-03-03 12:08   ` [patch] Re: using long instead of atomic_t when only set/read is required Pavel Machek
     [not found]   ` <20080303120842.GA28369@elf.ucw.cz>
2008-03-03 15:42     ` Alan Stern
2008-03-03 15:48     ` Alan Cox
     [not found]     ` <Pine.LNX.4.44L0.0803031023550.3611-100000@iolanthe.rowland.org>
2008-03-03 15:53       ` Alan Cox
     [not found]       ` <20080303155330.39e45ad4@core>
2008-03-03 17:11         ` Alan Stern
2008-03-03 17:16         ` Nick Piggin
2008-03-03 17:31           ` Paul E. McKenney
2008-03-03 17:33           ` Alan Cox
2008-03-03 17:22       ` Paul E. McKenney
     [not found]     ` <20080303154831.22a4eb14@core>
2008-03-03 17:24       ` Pavel Machek [this message]
2008-03-03 20:27         ` Rafael J. Wysocki
     [not found]         ` <200803032127.30761.rjw@sisk.pl>
2008-03-03 21:12           ` Paul E. McKenney
2008-03-03 22:23           ` Linus Torvalds
     [not found] <Pine.LNX.4.44L0.0803031207120.3611-100000@iolanthe.rowland.org>
2008-03-03 17:26 ` Linus Torvalds
2008-03-03 17:44   ` Pavel Machek
2008-03-06 15:58   ` Mark Lord
     [not found]   ` <47D014A6.9090300@rtr.ca>
2008-03-06 16:11     ` Linus Torvalds
     [not found]     ` <alpine.LFD.1.00.0803060807120.12253@woody.linux-foundation.org>
2008-03-06 16:27       ` Mark Lord
     [not found] <20080303174422.GB13869@elf.ucw.cz>
2008-03-03 19:27 ` Alan Stern

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=20080303172410.GA13869@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@davemloft.net \
    --cc=drzeus-mmc@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zdenek.kabelac@gmail.com \
    /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