[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1186682275.9669.12.camel@localhost>
Date: Thu, 09 Aug 2007 19:57:55 +0200
From: Martin Schwidefsky <schwidefsky@...ibm.com>
To: Chuck Ebbert <cebbert@...hat.com>
Cc: Chris Snook <csnook@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
akpm@...ux-foundation.org, ak@...e.de, heiko.carstens@...ibm.com,
davem@...emloft.net, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, wensong@...ux-vs.org, horms@...ge.net.au,
wjiang@...ilience.com, cfriesen@...tel.com, zlynx@....org
Subject: Re: [PATCH] make atomic_t volatile on all architectures
On Thu, 2007-08-09 at 13:36 -0400, Chuck Ebbert wrote:
> > Fair enough. Casting to (volatile int *) will give us the behavior
> > people expect when using atomic_t without needing to use inefficient
> > barriers.
> >
>
> You can use this forget() macro to make the compiler reread a
> variable:
>
> #define forget(var) asm volatile ("" : "=m"(var))
You need to specify a "m"(var) input constraint as well. Without it the
compiler might remove the initialization of var. E.g.
void fn(void)
{
int var = 0;
forget(var);
/* now var can have any value. */
}
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists