Skip to contentSkip to conversation

dom0 boot failure with 256G

DISCUSSION Mukesh Rathor 5 participants 16 messages Jun 5, 2008 – Jun 7, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I've been intensely debugging a dom0 crash right at boot in pagetable_init() with 256G. We are running 64bit hyp with 32bit dom0. This on xen 3.1.3, which seems to have fixes from changeset 16548.

It boils down to this:

crash occurs in dom0: mfn_to_pfn() during machine_to_phys_mapping[mfn] lookup where mfn == 0x3f2ec09 is too big. The table starts at: 0xf5800000 which I see comes from MACH2PHYS_VIRT_START.

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

moving along, in alloc_domheap_pages() :
bits = domain_clamp_alloc_bitsize(d, bits ? : (BITS_PER_LONG+PAGE_SHIFT));

  domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits)
  {
      if ( (d == NULL) || !is_pv_32on64_domain(d) )
              return bits;
      return min(d->arch.physaddr_bitsize, bits);
           ---> here : physaddr: 0x1019, bits:76 ?????
           ---> i'm thinking bits should be 36+12 == 48 ??
  }

finally, call to alloc_heap_pages(...) returns frames too high, pg ptr is returned at : ffff82849df30000 (zone_hi == 0x27)

On a side note, is my understanding correct that while a guest pfn must always be < 36 bits for a PAE 32 guest, the mfn doesn't have to be?

thanks
mukesh

#1 lore raw
Quoted 4 lines

I've been intensely debugging a dom0 crash right at boot in pagetable_init() with 256G. We are running 64bit hyp with 32bit
dom0.
This on xen 3.1.3, which seems to have fixes from changeset 16548.

256GB is more than a 32b dom0 can handle. Presumably it works if you set dom0_mem= to something smaller?

We should probably make the clipping of dom0 memory to something like 64GB automatic.

Ian

Quoted 8 lines

It boils down to this:

crash occurs in dom0: mfn_to_pfn() during
machine_to_phys_mapping[mfn]
lookup where mfn == 0x3f2ec09 is too big. The table starts at:
0xf5800000
which I see comes from MACH2PHYS_VIRT_START.

Quoted 6 lines

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be

32,

Quoted 15 lines
   36, or 64????????

moving along, in alloc_domheap_pages() :
bits = domain_clamp_alloc_bitsize(d, bits ? :
(BITS_PER_LONG+PAGE_SHIFT));

   domain_clamp_alloc_bitsize(struct domain *d, unsigned int bits)
   {
       if ( (d == NULL) || !is_pv_32on64_domain(d) )
               return bits;
       return min(d->arch.physaddr_bitsize, bits);
            ---> here : physaddr: 0x1019, bits:76 ?????
            ---> i'm thinking bits should be 36+12 == 48 ??
   }
Quoted 7 lines

finally, call to alloc_heap_pages(...) returns frames too high, pg ptr is returned at : ffff82849df30000 (zone_hi == 0x27)

On a side note, is my understanding correct that while a guest pfn
must
always be < 36 bits for a PAE 32 guest, the mfn doesn't have to

be?

Quoted 10 lines

thanks
mukesh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 10 lines · Ian Pratt
Quoted 4 lines

I've been intensely debugging a dom0 crash right at boot in pagetable_init() with 256G. We are running 64bit hyp with 32bit
dom0.
This on xen 3.1.3, which seems to have fixes from changeset 16548.

256GB is more than a 32b dom0 can handle. Presumably it works if you set dom0_mem= to something smaller?

We should probably make the clipping of dom0 memory to something like 64GB automatic.

Xen ought to have crashed during dom0 build in that case, being unable to allocate enough memory of the restricted address width supported by the 32b dom0 guest. I agree that dom0_mem should be automatically intelligently clamped. Currently nr_pages is clamped to UINT_MAX (!) for a 32b dom0, which is still rather a big number.

I'll have to sketch out exactly what that physaddr_bitsize computation is doing and see if I can make sense of it...

-- Keir

#11 lore raw
In reply to Mukesh Rathor
Quoted 5 lines · Mukesh Rathor
   d->arch.physaddr_bitsize =
           fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
             + (PAGE_SIZE - 2);
   which is set to 0x1019, totally baffling me. I'd expect it to be 32,
   36, or 64????????

PAGE_SIZE should be PAGE_SHIFT. If you fix that then you may discover that dom0 can no longer be built (since there is not enough memory below 64GB to build a ~256GB dom0, which is the default that the dom0 builder will go for) so make sure you have a suitably restrictive dom0_mem= option on your Xen command line. As Ian says we should fix that more nicely.

-- Keir

#12 lore raw
In reply to Mukesh Rathor
Quoted 7 lines

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

Of course it should be PAGE_SHIFT in here! c/s 14097 screwed this up
- sorry, my fault.

xen/arch/x86/domain.c +1 -1
Index: 2008-05-08/xen/arch/x86/domain.c
===================================================================
@@ -353,7 +353,7 @@ int switch_compat(struct domain *d)
 
     d->arch.physaddr_bitsize =
         fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
-        + (PAGE_SIZE - 2);
+        + (PAGE_SHIFT - 2);
 
     return 0;
 
xen/arch/x86/domain_build.c +1 -1
Index: 2008-05-08/xen/arch/x86/domain_build.c
===================================================================
@@ -366,7 +366,7 @@ int __init construct_dom0(
     if ( is_pv_32on64_domain(d) )
         d->arch.physaddr_bitsize =
             fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
-            + (PAGE_SIZE - 2);
+            + (PAGE_SHIFT - 2);
 #endif
 
     /*
#3 lore raw
In reply to Keir Fraser
Quoted 11 lines · Keir Fraser
Quoted 5 lines

256GB is more than a 32b dom0 can handle. Presumably it works if you set dom0_mem= to something smaller?

We should probably make the clipping of dom0 memory to something like 64GB automatic.

Xen ought to have crashed during dom0 build in that case, being unable to allocate enough memory of the restricted address width supported by the 32b dom0 guest. I agree that dom0_mem should be automatically intelligently clamped. Currently nr_pages is clamped to UINT_MAX (!) for a 32b dom0, which is still rather a big number.

Actually compat guests are good for up to 128GB, so you should be fine with no dom0_mem= parameter.

-- Keir

#4 lore raw
Quoted 3 lines · Keir Fraser

Actually compat guests are good for up to 128GB, so you should be fine with no dom0_mem= parameter.

Real PAE processors are limited to 2^36 = 64GB, and the guest kernel may mask ptes at that point.

J

#5 lore raw
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 3 lines · Keir Fraser

Actually compat guests are good for up to 128GB, so you should be fine with no dom0_mem= parameter.

Real PAE processors are limited to 2^36 = 64GB, and the guest kernel may mask ptes at that point.

A paravirtualised kernel needs to have its PAGE_MASK widened. This is a bug we've bumped into once or twice.

-- Keir

#6 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 05.06.08 14:58 >>>

Quoted 5 lines · Jeremy Fitzhardinge
Quoted 3 lines · Keir Fraser

Actually compat guests are good for up to 128GB, so you should be fine with no dom0_mem= parameter.

Quoted 5 lines
Quoted 2 lines

Real PAE processors are limited to 2^36 = 64GB, and the guest kernel may mask ptes at that point.

A paravirtualised kernel needs to have its PAGE_MASK widened. This is a bug we've bumped into once or twice.

Even a native kernel ought to honor the physical address width the processor supports rather than arbitrarily masking off bits just because original PAE only supported 36 bits.

Jan

#7 lore raw
Quoted 6 lines · Jan Beulich
Quoted 2 lines

A paravirtualised kernel needs to have its PAGE_MASK widened. This is a bug we've bumped into once or twice.

Even a native kernel ought to honor the physical address width the processor supports rather than arbitrarily masking off bits just because original PAE only supported 36 bits.

Yes, both Intel and AMD have wider PAE addressing these days.

-- Keir

#8 lore raw
In reply to Jan Beulich
Quoted 7 lines · Jan Beulich
Quoted 3 lines

A paravirtualised kernel needs to have its PAGE_MASK widened. This is a bug we've bumped into once or twice.

Even a native kernel ought to honor the physical address width the processor supports rather than arbitrarily masking off bits just because original PAE only supported 36 bits.

Current 2.6 is too strict about this. I'll queue up a patch to fix it.

J

#10 lore raw
In reply to Ian Pratt
Quoted 6 lines · Ian Pratt <Ian.Pratt <at> eu.citrix.com> writes:
Quoted 5 lines

I've been intensely debugging a dom0 crash right at boot in pagetable_init() with 256G. We are running 64bit hyp with 32bit
dom0.
This on xen 3.1.3, which seems to have fixes from changeset 16548.

Quoted 9 lines

256GB is more than a 32b dom0 can handle. Presumably it works if you set dom0_mem= to something smaller?

We should probably make the clipping of dom0 memory to something like 64GB automatic.

Ian

..........

My apologies, I forgot to mention dom0_mem is set to : dom0_mem=569M

(XEN) Command line: console=com2,ttyS0 com2=115200,8n1 earlykdb dom0_mem=569M mem=256G

Things are fine with mem=128G. I've not tried 192G or other number. I just started debugging.....

I'll try with :

Quoted 7 lines
   d->arch.physaddr_bitsize =
Quoted 4 lines

fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

PAGE_SIZE should be PAGE_SHIFT. If you fix that then you may discover ...

thanks
mukesh

#13 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 7 lines

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

Of course it should be PAGE_SHIFT in here! c/s 14097 screwed this up
- sorry, my fault.

Yup, that fixed it. Can you pl explain in couple sentences how we are getting at the physaddr_bitsize here? I still don't understand why 37 is an OK size for a 32-PAE guest (i thought 36 was max).

Thanks,
Mukesh

#9 lore raw
In reply to Keir Fraser
Quoted 15 lines · Keir Fraser
Quoted 10 lines · Keir Fraser
Quoted 5 lines

256GB is more than a 32b dom0 can handle. Presumably it works if you set dom0_mem= to something smaller?

We should probably make the clipping of dom0 memory to something like 64GB automatic.

Xen ought to have crashed during dom0 build in that case, being unable to allocate enough memory of the restricted address width supported by the 32b dom0 guest. I agree that dom0_mem should be automatically intelligently clamped. Currently nr_pages is clamped to UINT_MAX (!) for a 32b dom0, which is still rather a big number.

Quoted 5 lines

Actually compat guests are good for up to 128GB, so you should be fine with no dom0_mem= parameter.

-- Keir

No, it crashed without dom0_mem paramater after I fixed the physaddr_bitsize in construct_dom0(). It looked like it was allocating almost 256G to dom0... things are fine now with dom0_mem= specified.

thanks
mukesh

#14 lore raw
In reply to Mukesh Rathor
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Mukesh Rathor <[email protected]> 06.06.08 04:43 >>>

Quoted 8 lines · Jan Beulich
Quoted 7 lines

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

Quoted 6 lines
Quoted 3 lines

Of course it should be PAGE_SHIFT in here! c/s 14097 screwed this up
- sorry, my fault.

Yup, that fixed it. Can you pl explain in couple sentences how we are getting at the physaddr_bitsize here?

The whole hypervisor hole is used solely for the (compatibility) m2p map when running on a 64-bit hypervisor. Hence the size of that hole, rounded down to a power of two, determines the address restriction a domain must be assigned. A kernel could theoretically specify being able to tolerate a larger hole (though XEN_ELFNOTE_HV_START_LOW), so to increase the physical address width it can get memory from.

Quoted 2 lines

I still don't understand why 37 is an OK size for a 32-PAE guest (i thought 36 was max).

36 was the original max, but even on native hardware you can go beyond that nowadays. On 64-bit Xen, this was a natural extension even independent of confirming hardware support of wider than 36-bit physical addresses for 32-bit code.

Of course, we all realize that giving dom0 128G won't do any good, afair even native Linux can't reasonably deal with 64G (due to the huge memmap needed in lowmem). But allowing an as wide as possible range to get memory from for the domain is certainly very desirable (I am actually considering ideas on how to overcome even that limit, as in practical uses this is really undesirable to have, since there's no way to balloon out specific memory [i.e. such below the 37-bit address boundary] from other domains).

Jan

#15 lore raw
Quoted 37 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Mukesh Rathor <[email protected]> 06.06.08 04:43 >>>

Quoted 7 lines · Jan Beulich
Quoted 7 lines

Trying to figure the hyp out, I notice phys addr is set as:

d->arch.physaddr_bitsize =
fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ (PAGE_SIZE - 2);
which is set to 0x1019, totally baffling me. I'd expect it to be 32, 36, or 64????????

Quoted 4 lines
Quoted 3 lines

Of course it should be PAGE_SHIFT in here! c/s 14097 screwed this up
- sorry, my fault.

Yup, that fixed it. Can you pl explain in couple sentences how we are getting at the physaddr_bitsize here?

The whole hypervisor hole is used solely for the (compatibility) m2p map when running on a 64-bit hypervisor. Hence the size of that hole, rounded down to a power of two, determines the address restriction a domain must be assigned. A kernel could theoretically specify being able to tolerate a larger hole (though XEN_ELFNOTE_HV_START_LOW), so to increase the physical address width it can get memory from.

Quoted 1 line

I still don't understand why 37 is an OK size for a 32-PAE guest (i thought 36 was max).

36 was the original max, but even on native hardware you can go beyond that nowadays. On 64-bit Xen, this was a natural extension even independent of confirming hardware support of wider than 36-bit physical addresses for 32-bit code.

Of course, we all realize that giving dom0 128G won't do any good, afair even native Linux can't reasonably deal with 64G (due to the huge memmap needed in lowmem). But allowing an as wide as possible range to get memory from for the domain is certainly very desirable (I am actually considering ideas on how to overcome even that limit, as in practical uses this is really undesirable to have, since there's no way to balloon out specific memory [i.e. such below the 37-bit address boundary] from other domains).

Quoted 1 line

Jan

Got it. Thanks a lot, appreciate your time.

Mukesh