[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200710030149.24914.nickpiggin@yahoo.com.au>
Date: Wed, 3 Oct 2007 01:49:24 +1000
From: Nick Piggin <nickpiggin@...oo.com.au>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Chuck Ebbert <cebbert@...hat.com>,
Arjan van de Ven <arjan@...radead.org>,
Kirill Korotaev <dev@...nvz.org>,
Andrew Morton <akpm@...l.org>, Andi Kleen <ak@...e.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devel@...nvz.org
Subject: Re: [PATCH] mark read_crX() asm code as volatile
On Wednesday 03 October 2007 16:18, H. Peter Anvin wrote:
> Nick Piggin wrote:
> >> This should work because the result gets used before reading again:
> >>
> >> read_cr3(a);
> >> write_cr3(a | 1);
> >> read_cr3(a);
> >>
> >> But this might be reordered so that b gets read before the write:
> >>
> >> read_cr3(a);
> >> write_cr3(a | 1);
> >> read_cr3(b);
> >>
> >> ?
> >
> > I don't see how, as write_cr3 clobbers memory.
>
> Because read_cr3() doesn't depend on memory, and b could be stored in a
> register.
How does the compiler know it doesn't depend on memory?
How do you say it depends on memory? You really need something
as heavy as volatile?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists