Explicitly tag every anonymous aggregate in the public headers.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Xen staging patchbot-unstable
# HG changeset patch
# User Keir Fraser <[email protected]>
# Date 1206526490 0
# Node ID5d25187bac941611a8a836b668a398a72df0afb0
# Parent966c04d42e94546287a1145c82e13073f28ef116Explicitly tag every anonymous aggregate in the public headers.
ia64 build fix.
--
xen/arch/ia64/vmx/save.c +1 -0
@@ -21,6 +21,7 @@*/ #include <xen/types.h> +#include <public/xen.h> #include <xen/hvm/save.h> void arch_hvm_save (struct domain *d,struct hvm_save_header *hdr)
xen/arch/ia64/xen/dom_fw_common.c +1 -0
@@ -20,6 +20,7 @@#include <assert.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include <asm/bundle.h>
xen/arch/ia64/xen/dom_fw_domu.c +1 -0
@@ -37,6 +37,7 @@#include <errno.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include "xg_private.h"
resend
Quoted 47 lines · Alex Williamson
Quoted 6 lines · Xen staging patchbot-unstable
# HG changeset patch
# User Keir Fraser <[email protected]>
# Date 1206526490 0
# Node ID5d25187bac941611a8a836b668a398a72df0afb0
# Parent966c04d42e94546287a1145c82e13073f28ef116Explicitly tag every anonymous aggregate in the public headers.ia64 build fix.
Signed-off-by Alex Williamson <[email protected]>--
diff -r
b6d15be09aecxen/arch/ia64/vmx/save.cxen/arch/ia64/vmx/save.c +1
-0@@ -21,6 +21,7 @@*/ #include <xen/types.h> +#include <public/xen.h> #include <xen/hvm/save.h> void arch_hvm_save (struct domain *d,struct hvm_save_header *hdr)diff -r
b6d15be09aecxen/arch/ia64/xen/dom_fw_common.cxen/arch/ia64/xen/dom_fw_common.c +1
-0@@ -20,6 +20,7 @@#include <assert.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include <asm/bundle.h> diff -r
b6d15be09aecxen/arch/ia64/xen/dom_fw_domu.cxen/arch/ia64/xen/dom_fw_domu.c +1
-0@@ -37,6 +37,7 @@#include <errno.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include "xg_private.h"
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.
xen/arch/ia64/vmx/save.c +1 -0
@@ -21,6 +21,7 @@*/ #include <xen/types.h> +#include <public/xen.h> #include <xen/hvm/save.h> void arch_hvm_save (struct domain *d,struct hvm_save_header *hdr)
xen/arch/ia64/xen/dom_fw_common.c +1 -0
@@ -20,6 +20,7 @@#include <assert.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include <asm/bundle.h>
xen/arch/ia64/xen/dom_fw_domu.c +1 -0
@@ -37,6 +37,7 @@#include <errno.h> #include <inttypes.h> +#include <xen/xen.h> #include <xen/arch-ia64.h> #include "xg_private.h"
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Xen staging patchbot-unstable
# HG changeset patch
# User Keir Fraser <[email protected]>
# Date 1206526490 0
# Node ID5d25187bac941611a8a836b668a398a72df0afb0
# Parent966c04d42e94546287a1145c82e13073f28ef116Explicitly tag every anonymous aggregate in the public headers.
My previous fix allowed this to build on ia64, but it turns out
there's still a boot issue that I don't understand. As is, we take a nested dtlb fault on boot, which hg bisect determines is caused by this patch. From a simple test program, I can verify that only the outermost __extension__ is necessary to include code w/ -std=c99. So embedding an __extension__ within an __extension__ isn't necessary, but I don't know why it actually changes the behavior of the code. The patch below reverts a few chucks of this cset and gets us booting again. FWIW, I'm using gcc-4.1.2. Thanks,
Alex
---
xen/include/public/arch-ia64.h +3 -3
@@ -182,7 +182,7 @@ struct mapped_regs {unsigned long reserved4[76 ]; __anonymous_union {unsigned long vcr[128 ]; - __anonymous_struct { + struct { unsigned long dcr; // CR0 unsigned long itm; unsigned long iva;
@@ -216,7 +216,7 @@ struct mapped_regs { }; __anonymous_union {unsigned long reserved5[128 ]; - __anonymous_struct { +struct {unsigned long precover_ifs;unsigned long unat;// not sure if this is needed until NaT arch is done int interrupt_collection_enabled;// virtual psr.ic
@@ -609,7 +609,7 @@ struct xen_ia64_opt_feature {unsigned long cmd;/* Which feature */ unsigned char on;/* Switch feature on/off */ __anonymous_union { - __anonymous_struct { +struct {/* The page protection bit mask of the pte. * This will be or'ed with the pte. */ unsigned long pgprot;
Quoted 9 lines · Alex Williamson
My previous fix allowed this to build on ia64, but it turns out
there's still a boot issue that I don't understand. As is, we take a nested dtlb fault on boot, which hg bisect determines is caused by this patch. From a simple test program, I can verify that only the outermost__extension__is necessary to include code w/ -std=c99. So embedding an__extension__within an__extension__isn't necessary, but I don't know why it actually changes the behavior of the code. The patch below reverts a few chucks of this cset and gets us booting again. FWIW, I'm using gcc-4.1.2. Thanks,
Playing around with this a bit I can't see what changes for having nested usage of __extension__. I'm using gcc 4.1 but on x86_64.
Could you play around with sizeof() and offsetof() and find out exactly what's getting laid out differently? Maybe we'll have to do some of the reversion that you suggest (or just revert the whole lot and assert __GNUC__ and !__STRICT_ANSI__ at the top of the file). But it'd be nice to know a bit more about what's going on here.
-- Keir
Quoted 12 lines · Keir Fraser
Quoted 9 lines · Alex Williamson
My previous fix allowed this to build on ia64, but it turns out
there's still a boot issue that I don't understand. As is, we take a nested dtlb fault on boot, which hg bisect determines is caused by this patch. From a simple test program, I can verify that only the outermost__extension__is necessary to include code w/ -std=c99. So embedding an__extension__within an__extension__isn't necessary, but I don't know why it actually changes the behavior of the code. The patch below reverts a few chucks of this cset and gets us booting again. FWIW, I'm using gcc-4.1.2. Thanks,
Quoted 8 lines
Playing around with this a bit I can't see what changes for having nested usage of
__extension__. I'm using gcc 4.1 but onx86_64.Could you play around with
sizeof()andoffsetof()and find out exactly what's getting laid out differently? Maybe we'll have to do some of the reversion that you suggest (or just revert the whole lot and assert__GNUC__and !__STRICT_ANSI__ at the top of the file). But it'd be nice to know a bit more about what's going on here.
Ok, here's what I found out:
# struct xen_ia64_opt_feature with __anonymous_struct:
sizeof(struct xen_ia64_opt_feature): 24offsetof(struct xen_ia64_opt_feature, pgprot): 16
# without:
sizeof(struct xen_ia64_opt_feature): 32offsetof(struct xen_ia64_opt_feature, pgprot): 16
The sizeof the struct changes, and it can't possible be 24 bytes if an 8 byte pgprot starts at offset 16 and is followed by another 8 bytes, so the size is wrong with the __extension__ attribute.
--
# struct mapped_regs with __anonymous_struct:
sizeof(struct mapped_regs): 4096offsetof(struct mapped_regs, dcr): 2048offsetof(struct mapped_regs, rsv6): 2048offsetof(struct mapped_regs, precover_ifs): 3072offsetof(struct mapped_regs, tmp): 3072
# without:
sizeof(struct mapped_regs): 4096offsetof(struct mapped_regs, dcr): 2048offsetof(struct mapped_regs, rsv6): 2704offsetof(struct mapped_regs, precover_ifs): 3072offsetof(struct mapped_regs, tmp): 3280
This time the sizeof is correct, and the offset of the first entries in the struct are correct, but the last entry in the struct is at the same offset as the first, which is obviously unintended.
It seems pretty clear that in nesting __extension__ attributes in this manner, the struct is actually ignored and the compiler is treating the everything that was in the struct as a separate member of the union. In the mapped_regs example, the structure size remains correct only because the union is full padded out using the full size arrays. Please apply the patch I sent previously to revert the nested __extension__ attributes. Thanks,
Alex
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.
Quoted 7 lines · Alex Williamson
It seems pretty clear that in nesting
__extension__attributes in this manner, the struct is actually ignored and the compiler is treating the everything that was in the struct as a separate member of the union. In themapped_regsexample, the structure size remains correct only because the union is full padded out using the full size arrays. Please apply the patch I sent previously to revert the nested__extension__attributes. Thanks,
__extension__ seems worryingly half-baked. We're better off asserting !__STRICT_ANSI__ in my opinion. I don't suppose you much care either way as long as ia64 boot works again. :-)
-- Keir
Quoted 10 lines · Keir Fraser
Quoted 7 lines · Alex Williamson
It seems pretty clear that in nesting
__extension__attributes in this manner, the struct is actually ignored and the compiler is treating the everything that was in the struct as a separate member of the union. In themapped_regsexample, the structure size remains correct only because the union is full padded out using the full size arrays. Please apply the patch I sent previously to revert the nested__extension__attributes. Thanks,
Quoted 3 lines
__extension__seems worryingly half-baked. We're better off asserting !__STRICT_ANSI__ in my opinion. I don't suppose you much care either way as long as ia64 boot works again. :-)
Yup ;^) FWIW, I still haven't been able to create a simple test
program that shows this behavior. For these tests I've had to resort to putting printks in xen. There must be some build option we use that tickles this issue. Still, not good for an option that claims to have no side effects. Thanks,
Alex
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.
Quoted 9 lines · Alex Williamson
(quoted diff) +0
-0@@ -609,7 +609,7 @@ struct xen_ia64_opt_feature {unsigned long cmd; /* Which feature */
unsigned char on; /* Switch feature on/off */__anonymous_union{(quoted diff) +1
-1- __anonymous_struct { + struct {/* The page protection bit mask of the pte.
* This will be or'ed with the pte. */
unsigned long pgprot;
I have no idea if it's the cause of this particular boot breakage, but I reckon that an anonymous union containing a single anonymous struct can be simplified. Or perhaps, if the union is there for stylistic reasons, a single extra field in the union would fix things?
-- Keir
Quoted 16 lines · Keir Fraser
Quoted 9 lines · Alex Williamson
(quoted diff) +0
-0@@ -609,7 +609,7 @@ struct xen_ia64_opt_feature {unsigned long cmd; /* Which feature */
unsigned char on; /* Switch feature on/off */__anonymous_union{(quoted diff) +1
-1- __anonymous_struct { + struct {/* The page protection bit mask of the pte.
* This will be or'ed with the pte. */
unsigned long pgprot;I have no idea if it's the cause of this particular boot breakage, but I reckon that an anonymous union containing a single anonymous struct can be simplified. Or perhaps, if the union is there for stylistic reasons, a single extra field in the union would fix things?
I toggled this one separately exactly for that reason, but it's not
the one. I still haven't isolated a particular reason why it fails in a test program, but I'll keep trying. Thanks,
Alex
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.