WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH] i386 linux: make 32-bit PAE kernel work when bui

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, "Jan Beulich" <JBeulich@xxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] i386 linux: make 32-bit PAE kernel work when built with newer gcc
From: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Date: Tue, 14 Mar 2006 13:15:59 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 14 Mar 2006 12:20:13 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcZHXfO9gQ7RCcr/TGe8LG7qVaNEqwAAqiGA
Thread-topic: [Xen-devel] [PATCH] i386 linux: make 32-bit PAE kernel work when built with newer gcc
 

> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Keir Fraser
> Sent: 14 March 2006 11:53
> To: Jan Beulich
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Xen-devel] [PATCH] i386 linux: make 32-bit PAE 
> kernel work when built with newer gcc
> 
> 
> On 14 Mar 2006, at 10:40, Jan Beulich wrote:
> 
> >> Won't this need a barrier() (compile barrier) between the 
> updates of 
> >> low and high portions?
> >
> > No, I can't see why. The compiler isn't permitted to 
> re-order separate 
> > writes across sequence points (which is different from a 
> single 64-bit 
> > write, where the compiler is only expected to carry out the full 
> > 64-bit write prior to the next sequence point, but nothing 
> requires it 
> > to do this in any particular order).
> 
> The compiler is certainly allowed to reorder those updates. 
> The constraints on a conforming implementation of C99 are 
> pretty weak, and don't say anything about obeying the rules 
> for access/update ordering on non-volatile objects. Whether 
> gcc reorders such updates is another matter. :-)
> 
> If I build the following with -O2 on x86/64 gcc 4.1, the 
> compiler removes the first update of x. If I take a signal 
> after the update of y, the signal handler can see y==2, z!=2 
> but also x!=2, which disobeys the semantics of the C99 
> abstract machine semantics:
> int x, y, z;
> void foo(void) { x = 2; y = 2; z = 2; x = 0; }
> 
> Really it's safer just to include the barrier(), and makes 
> our ordering requirement explicit in the code.

In my personal opinion this is also better in the sense that it makes it
CLEAR to the reader of the code, what's meant to happen. 

Relying on the compiler to "do the right thing" in these circumstances
tend to break when a new compiler version comes out. And it can be VERY
hard to figure out right in some cases [where it works 99999 times out
of 100000, and then randomly crashes on the 100000th time...]. 

--
Mats
> 
>   -- Keir
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • RE: [Xen-devel] [PATCH] i386 linux: make 32-bit PAE kernel work when built with newer gcc, Petersson, Mats <=