[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen 4.6.0-rc1 build with lock_profile=y crash_debug=y, frame_pointer=y and domain.c:241: error: negative width in bit-field â<anonymous>â



On Tue, Aug 25, 2015 at 06:41:06PM +0100, Andrew Cooper wrote:
> On 25/08/15 18:09, Konrad Rzeszutek Wilk wrote:
> > On Tue, Aug 25, 2015 at 05:48:58PM +0100, Andrew Cooper wrote:
> >> On 25/08/15 17:43, Konrad Rzeszutek Wilk wrote:
> >>> I am troubleshooting an locking issue and figured I would enable extra 
> >>> options.
> >>>
> >>> But now I am hitting this build issue:
> >>>
> >>> domain.c:241: error: negative width in bit-field â<anonymous>â
> >>>
> >>> Which is:
> >>>
> >>>  229 struct domain *alloc_domain_struct(void)
> >>>  230 {
> >>>  231     struct domain *d;
> >>> ...
> >>>  241     BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
> >>>
> >>> Thoughts?
> >> That is to catch the case where sizeof struct domain exceeds PAGE_SIZE.
> >>
> >> The logic behind this was to prevent needing order 1 allocations for
> >> domains or vcpus, and therefore allocation failures in heavily memory
> >> fragmented situations.
> >>
> >> It means we will probably need to find some other areas of struct domain
> >> to shrink, or move out into a separate xmalloc().
> >>
> >> For straight debugging, it is acceptable to drop the BUILD_BUG_ON().  If
> >> we can't drop the size of struct domain, we might want to move to using
> >> vmalloc() instead.
> > It is big. pahole says:
> >
> >    /* size: 4352, cachelines: 68, members: 74 */ 
> >     /* sum members: 4238, holes: 9, sum holes: 34 */ 
> >     /* padding: 80 */ 
> >     /* paddings: 1, sum paddings: 4 */
> 
> So by rearranging to reduce padding, it would easily fit ;p
> 
> >
> > Would this patch be OK then:
> > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > index 045f6ff..cc9ce0b 100644
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -238,7 +238,9 @@ struct domain *alloc_domain_struct(void)
> >      if ( unlikely(!bits) )
> >           bits = _domain_struct_bits();
> >  
> > +#ifndef LOCK_PROFILE
> >      BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
> > +#endif
> >      d = alloc_xenheap_pages(0, MEMF_bits(bits));
> >      if ( d != NULL )
> >          clear_page(d);
> >
> > (not compile tested nor runtime tested)
> 
> Either remove it locally for debugging, or use something like
> 
> #if sizeof(*d) <= PAGE_SIZE
> ... alloc_xenheap_pages(0, MEMF_bits(bits));
> #else
> ... vzalloc(sizeof(*d), ...);
> #endif
> 
> Although this would require passing memflags to the v?alloc()
> infrastructure.


With
commit fd280f57975d813cbacb3e5d31843ec8bd5b52e7
Author: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date:   Tue Aug 25 16:50:03 2015 -0400

    lock: Try build
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 045f6ff..a36a5d8 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -238,8 +238,12 @@ struct domain *alloc_domain_struct(void)
     if ( unlikely(!bits) )
          bits = _domain_struct_bits();
 
+#ifndef LOCK_PROFILE
     BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
     d = alloc_xenheap_pages(0, MEMF_bits(bits));
+#else
+    d = vzalloc(sizeof(*d));
+#endif
     if ( d != NULL )
         clear_page(d);
     return d;
@@ -248,7 +252,11 @@ struct domain *alloc_domain_struct(void)
 void free_domain_struct(struct domain *d)
 {
     lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
+#ifndef LOCK_PROFILE
     free_xenheap_page(d);
+#else
+    vfree(d);
+#endif
 }
 
 struct vcpu *alloc_vcpu_struct(void)

it blows up later:

(XEN) Xen version 4.6.0-rc (konrad@(none)) (gcc (GCC) 4.4.4 20100503 (Red Hat 
4.4.4-2)) debug=y Tue Aug 25 16:51:ign-buses,verbose com1=115200,8n1,pci 
console=com1 tmem=1 tmem_compress=1 tmem_dedup=1 sync_console dom0_max_vcpus=1 
cpufreq=xen:performance dom0_mem=max:2G apic=debug loglvl=all guest_loglvl=all
(XEN) Video information:
(XEN)  VGA is text mode 80x25, font 8x16
(XEN)  VBE/DDC methods: V2; EDID transfer time: 1 seconds
(XEN) Disc information:
(XEN)  Found 0 MBR signatures
(XEN)  Found 2 EDD information structures
(XEN) Xen-e820 RAM map:
(XEN)  0000000000000000 - 000000000009a800 (usable)
(XEN)  000000000009a800 - 00000000000a0000 (reserved)
(XEN)  00000000000e0000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 0000000020000000 (usable)
(XEN)  0000000020000000 - 0000000020200000 (reserved)
(XEN)  0000000020200000 - 0000000040000000 (usable)
(XEN)  0000000040000000 - 0000000040200000 (reserved)
(XEN)  0000000040200000 - 000000009e856000 (usable)
(XEN)  000000009e856000 - 000000009e85f000 (ACPI data)
(XEN)  000000009e85f000 - 000000009e8aa000 (ACPI NVS)
(XEN)  000000009e8aa000 - 000000009e8b2000 (usable)
(XEN)  000000009e8b2000 - 000000009e9a5000 (reserved)
(XEN)  000000009e9a5000 - 000000009e9a7000 (usable)
(XEN)  000000009e9a7000 - 000000009ebc6000 (reserved)
(XEN)  000000009ebc6000 - 000000009ebc7000 (usable)
(XEN)  000000009ebc7000 - 000000009ebd7000 (reserved)
(XEN)  000000009ebd7000 - 000000009ebf5000 (ACPI NVS)
(XEN)  000000009ebf5000 - 000000009ec19000 (reserved)
(XEN)  000000009ec19000 - 000000009ec5c000 (ACPI NVS)
(XEN)  000000009ec5c000 - 000000009ee7c000 (reserved)
(XEN)  000000009ee7c000 - 000000009f000000 (usable)
(XEN)  000000009f800000 - 00000000bfa00000 (reserved)
(XEN)  00000000fed1c000 - 00000000fed40000 (reserved)
(XEN)  00000000ff000000 - 0000000100000000 (reserved)
(XEN)  0000000100000000 - 000000043e600000 (usable)
(XEN) ACPI: RSDP 000F0450, 0024 (r2  INTEL)
(XEN) ACPI: XSDT 9E856070, 0064 (r1 INTEL  DQ67SW    1072009 AMI     10013)
(XEN) ACPI: FACP 9E85DBC0, 00F4 (r4 INTEL  DQ67SW    1072009 AMI     10013)
(XEN) ACPI: DSDT 9E856168, 7A54 (r2 INTEL  DQ67SW         16 INTL 20051117)
(XEN) ACPI: FACS 9EBDBF80, 0040
(XEN) ACPI: APIC 9E85DCB8, 0072 (r3 INTEL  DQ67SW    1072009 AMI     10013)
(XEN) ACPI: TCPA 9E85DD30, 0032 (r2 INTEL  DQ67SW          1 MSFT  1000013)
(XEN) ACPI: SSDT 9E85DD68, 0102 (r1 INTEL  DQ67SW          1 MSFT  3000001)
(XEN) ACPI: MCFG 9E85DE70, 003C (r1 INTEL  DQ67SW    1072009 MSFT       97)
(XEN) ACPI: HPET 9E85DEB0, 0038 (r1 INTEL  DQ67SW    1072009 AMI.        4)
(XEN) ACPI: ASF! 9E85DEE8, 00A0 (r32 INTEL  DQ67SW          1 TFSM    F4240)
(XEN) ACPI: DMAR 9E85DF88, 00E8 (r1 INTEL  DQ67SW          1 INTL        1)
(XEN) System RAM: 15819MB (16199164kB)
(XEN) No NUMA configuration found
(XEN) Faking a node at 0000000000000000-000000043e600000
(XEN) Domain heap initialised
(XEN) Allocated console ring of 1048576 KiB.
(XEN) found SMP MP-table at 000fda50
(XEN) DMI 2.6 present.
(XEN) Using APIC driver default
(XEN) ACPI: PM-Timer IO Port: 0x4_id[0x01] lapic_id[0x00] enabled)
(XEN) Processor #0 6:10 APIC version 21
(XEN) ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled)
(XEN) Processor #2 6:10 APIC version 21
(XEN) ACPI: LAPIC (acpi_id[0x03] lapic_id[0x04] enabled)
(XEN) Processor #4 6:10 APIC version 21
(XEN) ACPI: LAPIC (acpi_id[0x04] lapic_id[0x06] enabled)
(XEN) Processor #6 6:10 APIC version 21
(XEN) ACPI: LAPIC_NMI (acpi_id[0xff] high edge lint[0x1])
(XEN) ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
(XEN) IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
(XEN) ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
(XEN) ACPI: IRQ0 used by override.
(XEN) ACPI: IRQ2 used by override.
(XEN) ACPI: IRQ9 used by override.
(XEN) Enabling APIC mode:  Flat.  Using 1 I/O APICs
(XEN) ACPI: HPET id: 0x8086a701 base: 0xfed00000
(XEN) ERST table was not found
(XEN) Using ACPI (MADT) for SMP configuration information
(XEN) SMP: Allowing 4 CPUs (0 hotplug CPUs)
(XEN) NR_CPUS:384 nr_cpumask_bits:64
(XEN) IRQ limits: 24 GSI, 760 MSI/MSI-X
(XEN) Switched to APIC driver x2apic_cluster.
(XEN) xstate_init: using cntxt_size: 0x340 and states: 0x7
(XEN) mce_intel.c:735: MCA Capability: BCAST 1 SER 0 CMCI 1 firstbank 0 
extended MCE MSR 0
(XEN) Intel machine check reporting enabled
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Detected 3292.563 MHz processor.
(XEN) Assertion '(page->count_info & ~PGC_xen_heap) == 0' failed at mm.c:449
(XEN) ----CPU:    0
(XEN) RIP:    e008:[<ffff82d080175336>] share_xen_page_with_guest+0x178/0x20f
(XEN) RFLAGS: 0000000000010082   CONTEXT: hypervisor
(XEN) rax: 8000000000000001   rbx: ffff82c00020b000   rcx: 0000000000000001
(XEN) rdx: bfffffffffffffff   rsi: ffff82d080353218   rdi: 000000007c9455a3
(XEN) rbp: ffff82d0802f7de8   rsp: ffff82d0802f7dc8   r8:  ffff82e000000000
(XEN) r9:  0000000000000000   r10: 0000000000000000   r11: 0000000000000000
(XEN) r12: ffff82e000001340   r13: ffff82c00020b030   r14: 0000000000000000
(XEN) r15: 0000000000020000   cr0: 000000008005003b   cr4: 00000000000406e0
(XEN) cr3: 000000009e6a0000   cr2: 0000000000000000
(XEN) ds: 0000   es: 0000   fs: 0000   gs: 0000   ss: 0000   cs: e008
(XEN) Xen stack trace from rsp=ffff82d0802f7dc8:
(XEN)    000000000000009a 0000000000000003 0000000000000100 ffff82d080330c60
(XEN)    ffff82d0802f7e28 ffff82d0802c2a23 ffff83042f6c0eb0 ffff82d0802f0000
(XEN)    ffff830000073fb0 ffff83042f6c0eb0 ffff82d08028eca8 ffff82d080353420
(XEN)    ffff82d0802f7f08 ffff82d0802ca10f 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 ffffffd0802f0000 ffff82d08026777a
(XEN)    00000000012dd000 0000000000000000 00000000ffffffff 0000000000100000
(XEN)    0000000300000000 ffff830000000006 0000000000253580 00000004ffffffff
(XEN)    ffff830000073e80 ffff82d080353420 0000000800000000 000000010000006e
(XEN)    0000000000000003 00000000000002f8 0000000000000000 0000000000000000
(XEN)    000000000000180a 00000000010ff9c0 0000000000000000 00000000016d5018
(XEN)    0000000000000000 ffff82d080100073 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    ffff83009e9a5000 0000000000000000 0000000000000000
(XEN) Xen call trace:
(XEN)    [<ffff82d080175336>] share_xen_page_with_guest+0x178/0x20f
(XEN)    [<ffff82d0802c2a23>] arch_init_memory+0x2a2/0x55f
(XEN)    [<ffff82d0802ca10f>] __start_xen+0x4aa4/0x509e
(XEN)    [<ffff82d080100073>] __high_start+0x53/0x58
(XEN) 
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Assertion '(page->count_info & ~PGC_xen_heap) == 0' failed at mm.c:449
(XEN) ****************************************
(XEN) 
(XEN) Reboot in five seconds...
(XEN) Resetting with ACPI MEMORY or I/O RESET_REG.

telnet> Connection closed.
[Connecting to system 31 ]

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.