All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gordan Bobic <gordan@bobich.net>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xen.org
Subject: Re: HVM support for e820_host (Was: Bug: Limitation of <=2GB RAM in domU persists with 4.3.0)
Date: Fri, 06 Sep 2013 14:34:54 +0100	[thread overview]
Message-ID: <ce43c627d6f85f9d8c4a97621d3650e5@mail.shatteredsilicon.net> (raw)
In-Reply-To: <20130906130435.GE2590@phenom.dumpdata.com>

 On Fri, 6 Sep 2013 09:04:35 -0400, Konrad Rzeszutek Wilk 
 <konrad.wilk@oracle.com> wrote:
> On Thu, Sep 05, 2013 at 11:33:18PM +0100, Gordan Bobic wrote:
>> On 09/05/2013 10:13 PM, Gordan Bobic wrote:
>>
>> >I seem to be getting two different E820 table dumps with 
>> e820_host=1:
>> >
>> >(XEN) HVM1: BIOS map:
>> >(XEN) HVM1:  f0000-fffff: Main BIOS
>> >(XEN) HVM1: build_e820_table:91 got 8 op.nr_entries
>> >(XEN) HVM1: E820 table:
>> >(XEN) HVM1:  [00]: 00000000:00000000 - 00000000:3f790000: RAM
>> >(XEN) HVM1:  [01]: 00000000:3f790000 - 00000000:3f79e000: ACPI
>> >(XEN) HVM1:  [02]: 00000000:3f79e000 - 00000000:3f7d0000: NVS
>> >(XEN) HVM1:  [03]: 00000000:3f7d0000 - 00000000:3f7e0000: RESERVED
>> >(XEN) HVM1:  HOLE: 00000000:3f7e0000 - 00000000:3f7e7000
>> >(XEN) HVM1:  [04]: 00000000:3f7e7000 - 00000000:40000000: RESERVED
>> >(XEN) HVM1:  HOLE: 00000000:40000000 - 00000000:fee00000
>> >(XEN) HVM1:  [05]: 00000000:fee00000 - 00000000:fee01000: RESERVED
>> >(XEN) HVM1:  HOLE: 00000000:fee01000 - 00000000:ffc00000
>> >(XEN) HVM1:  [06]: 00000000:ffc00000 - 00000001:00000000: RESERVED
>> >(XEN) HVM1:  [07]: 00000001:00000000 - 00000001:68870000: RAM
>>
>> I get it - this is the host e820 map. In dom0, dmesg shows:
>>
>> e820: BIOS-provided physical RAM map:
>> Xen: [mem 0x0000000000000000-0x000000000009cfff] usable
>> Xen: [mem 0x000000000009d000-0x00000000000fffff] reserved
>> Xen: [mem 0x0000000000100000-0x000000003f78ffff] usable
>> Xen: [mem 0x000000003f790000-0x000000003f79dfff] ACPI data
>> Xen: [mem 0x000000003f79e000-0x000000003f7cffff] ACPI NVS
>> Xen: [mem 0x000000003f7d0000-0x000000003f7dffff] reserved
>> Xen: [mem 0x000000003f7e7000-0x000000003fffffff] reserved
>> Xen: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
>> Xen: [mem 0x00000000ffc00000-0x00000000ffffffff] reserved
>> Xen: [mem 0x0000000100000000-0x0000000cbfffffff] usable
>>
>> That tallies up with the above map exactly. So far so good. Not sure
>> if the following is relevant, but here it is anyway just in case:
>>
>> e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
>> e820: remove [mem 0x000a0000-0x000fffff] usable
>> [...]
>> e820: last_pfn = 0xcc0000 max_arch_pfn = 0x400000000
>> e820: last_pfn = 0x3f790 max_arch_pfn = 0x400000000
>> [...]
>> Zone ranges:
>>   DMA      [mem 0x00001000-0x00ffffff]
>>   DMA32    [mem 0x01000000-0xffffffff]
>>   Normal   [mem 0x100000000-0xcbfffffff]
>> [...]
>> e820: [mem 0x40000000-0xfedfffff] available for PCI devices
>>
>>
>> >(XEN) HVM1: E820 table:
>> >(XEN) HVM1:  [00]: 00000000:00000000 - 00000000:0009e000: RAM
>> >(XEN) HVM1:  [01]: 00000000:0009e000 - 00000000:000a0000: RESERVED
>> >(XEN) HVM1:  HOLE: 00000000:000a0000 - 00000000:000e0000
>> >(XEN) HVM1:  [02]: 00000000:000e0000 - 00000000:00100000: RESERVED
>> >(XEN) HVM1:  [03]: 00000000:00100000 - 00000000:a7800000: RAM
>> >(XEN) HVM1:  HOLE: 00000000:a7800000 - 00000000:fc000000
>> >(XEN) HVM1:  [04]: 00000000:fc000000 - 00000001:00000000: RESERVED
>> >(XEN) HVM1: Invoking ROMBIOS ...
>>
>> Comparing this to the above, it seems that 9d000-9e000 is marked as
>> reserved in dom0, but RAM in domU. Am I right in thinking that
>> dom0(usable) == domU(RAM) in terms of meaning?
>>
>> What does "HOLE" actually mean in domU? Does it mean this space is
>> OK to map domU IOMEM into? Or something else? Either way full
>> possible chasl summary:
>>
>> dom0: reserved	9d000-9e000
>> domU: RAM	9d000-9e000
>>
>> dom0: reserved	a0000-dffff
>> domU: HOLE	a0000-dffff
>>
>> dom0: ACPI data	3f790000-3f79dfff
>> dom0: ACPI NVS	3f79e000-3f7cffff
>> dom0: reserved	3f7d0000-3f7dffff
>> dom0: reserved
>
>
> .. you are missing a range here.

 It wasn't meant as an exhaustive list, I was only looking at the
 interesting/overlapping areas.

>> domU: RAM	00100000-a7800000
>>
>> Then there seems to be a hole in dom0:
>> 40000000-fedfffff which talles up with the dom0 dmesg output above
>> about it being for the PCI devices, i.e. that's the IOMEM region
>> (from 1GB to a lilttle under 4GB).
>>
>> But in domU, the 40000000-a77fffff is available as RAM.
>
> OK, so that is the goal - make hvmloader construct the E820 memory
> layout and all of its pieces to fit that layout.

 I am actually leaning toward only copying the holes from the
 host E820. The domU already seems to be successfully using various
 memory ranges that correspond to reserved and acpi ranges, so
 it doesn't look like these are a problem.

>> On the face of it, that's actually fine - my PCI IOMEM mappings show
>> the lowest mapping (according to lspci -vvv) starts at a8000000,
>
> <surprise>

 Indeed - on the host, the hole is 1GB-4GB, but there is no IOMEM
 mapped between 1024M and 2688MB. Hence why I can get away with a
 domU memory allocation up to 2688MB.

>> which falls into the domU area marked as "HOLE" (a7800000-fc000000).
>> And this does in fact appears to be where domU maps the GPU in both
>> of my VMs:
>>
>> E0000000-E7FFFFFF
>> E8000000-EBFFFFFF
>> EC000000-EDFFFFFF
>>
>> and this doesn't overlap with any mapped PCI IOMEM according to 
>> lspci.
>>
>> If we assume that anything below a8000000 doesn't actually matter in
>> this case (since if I give up to a8000000 memory to a domU
>> everything works absolutely fine indefinitely, I am at a loss to
>
>
> Just to make sure I am not leading you astray. You are getting _no_ 
> crashes
> when you have a guest with 1GB?

 I haven't tried limiting a guest to 1GB recently. My PCI passthrough
 domUs all have 2688MB assigned, and this works fine. More than that
 and they crash eventually. Does that answer your question? Or were
 you after something very specific to the 1GB domU case?

>> explain what is actually going wrong and why the crash is still
>> occuring - unless some other piece of hardware is having it's domU
>> IOMEM mapped somewhere in the range f3df4000-fec8b000 and that is
>> causing a memory overwrite.
>>
>> I am just not seeing any obvious memory stomp at the moment...
>
> Neither am I.

 I may have pasted the wrong domU e820. I have a sneaky suspicion
 that this above map was from a domU with 2688MB of RAM assigned,
 hence why there is on domU RAM in the map above a7800000. I'll
 re-check when I'm in front of that machine again.

 Are you OK with the plan to _only_ copy the holes from host E820
 to the hvmloader E820? I think this would be sufficient and not
 cause any undue problems. The only things that would need to
 change are:
 1) Enlarge the domU hole
 2) Do something with the top reserved block, starting at
 RESERVED_MEMBASE=0xFC000000. What is this actually for? It
 overlaps with the host memory hole which extends all the way up
 to 0xfee00000. If it must be where it is, this could be
 problematic. What to do in this case?

 This does, also bring up another question - is there any point
 in bothering with matching the host holes? I would hazard a
 guess that no physical hardware is likely to have a memory
 hole bigger than 3GB under the 4GB limit.

 So would it perhaps be neater, easier, more consistent and
 more debuggable to just make the hvmloader put in a hole
 between 0x40000000-0xffffffff (the whole 3GB) by default?
 Or is that deemed to be too crippling for 32-bit non-PAE
 domUs (and are there enough of these aroudn to matter?)?

 Caveat - this alone wouldn't cover any other weirdness such as
 the odd memory hole 0x3f7e0000-0x3f7e7000 on my hardware. Was
 this what you were thinking about when asking whether my domUs
 work OK with 1GB of RAM? Since that is just under the 1GB
 limit.

 To clarify, I am not suggesting just hard coding a 3GB memory
 hole - I am suggesting defaulting to at least that and them
 mapping in any additional memory holes as well. My reasoning
 behind this suggestion is that it would make things more
 consistent between different (possibly dissimilar) hosts.

 Gordan

  reply	other threads:[~2013-09-06 13:34 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 22:34 Bug: Limitation of <=2GB RAM in domU persists with 4.3.0 Gordan Bobic
2013-07-24 14:08 ` Konrad Rzeszutek Wilk
2013-07-24 14:17   ` Gordan Bobic
2013-07-24 16:06     ` Konrad Rzeszutek Wilk
2013-07-24 16:14       ` Gordan Bobic
2013-07-24 16:31         ` Konrad Rzeszutek Wilk
2013-07-24 17:26           ` Gordan Bobic
2013-07-24 22:15           ` Gordan Bobic
2013-07-25 19:18             ` George Dunlap
2013-07-25 21:48               ` Gordan Bobic
2013-07-25 22:23                 ` Gordan Bobic
2013-07-26  0:21                   ` Ian Campbell
2013-07-26  1:15                     ` Andrew Bobulsky
2013-07-26  9:28                       ` Gordan Bobic
2013-07-26 13:11                         ` Gordan Bobic
2013-07-31 17:53                           ` George Dunlap
2013-07-31 17:56                             ` Andrew Cooper
2013-07-31 19:36                               ` Gordan Bobic
2013-07-31 19:35                             ` Gordan Bobic
2013-08-01  9:15                               ` George Dunlap
2013-08-01 13:10                                 ` Fabio Fantoni
2013-08-02 14:43                                   ` George Dunlap
2013-07-28 10:26                       ` Konrad Rzeszutek Wilk
2013-07-28 21:24                         ` Gordan Bobic
2013-07-28 23:17                           ` Konrad Rzeszutek Wilk
2013-07-28 23:30                             ` Gordan Bobic
2013-07-29  9:53                             ` Ian Campbell
2013-07-26  9:23                     ` Gordan Bobic
2013-07-29 11:14                       ` Ian Campbell
2013-07-29 18:04                       ` Konrad Rzeszutek Wilk
2013-09-03 13:53                         ` Gordan Bobic
2013-09-03 14:59                           ` Konrad Rzeszutek Wilk
2013-09-03 19:47                             ` HVM support for e820_host (Was: Bug: Limitation of <=2GB RAM in domU persists with 4.3.0) Gordan Bobic
2013-09-03 20:35                               ` Gordan Bobic
2013-09-03 20:49                                 ` Gordan Bobic
2013-09-03 21:10                                   ` Konrad Rzeszutek Wilk
2013-09-03 21:24                                     ` Gordan Bobic
2013-09-03 21:30                                       ` Konrad Rzeszutek Wilk
2013-09-04  0:18                                         ` Gordan Bobic
2013-09-04 14:08                                           ` Konrad Rzeszutek Wilk
2013-09-04 14:23                                             ` Gordan Bobic
2013-09-04 18:00                                               ` Konrad Rzeszutek Wilk
2013-09-03 21:08                                 ` Konrad Rzeszutek Wilk
2013-09-04  9:21                                   ` Gordan Bobic
2013-09-04 11:01                                   ` Gordan Bobic
2013-09-04 13:11                                     ` Gordan Bobic
2013-09-04 20:18                                       ` Gordan Bobic
2013-09-05  2:04                                       ` Konrad Rzeszutek Wilk
2013-09-05  9:41                                         ` Gordan Bobic
2013-09-05 10:00                                           ` Gordan Bobic
2013-09-05 12:36                                             ` Konrad Rzeszutek Wilk
2013-09-05 10:26                                         ` Gordan Bobic
2013-09-05 12:38                                           ` Konrad Rzeszutek Wilk
2013-09-05 21:13                                         ` Gordan Bobic
2013-09-05 21:29                                           ` Gordan Bobic
2013-09-05 21:46                                             ` Gordan Bobic
2013-09-05 22:23                                           ` Konrad Rzeszutek Wilk
2013-09-05 22:42                                             ` Gordan Bobic
2013-09-06 13:09                                               ` Konrad Rzeszutek Wilk
2013-09-06 14:09                                                 ` Gordan Bobic
2013-09-05 22:45                                             ` Gordan Bobic
2013-09-05 23:01                                               ` Konrad Rzeszutek Wilk
2013-09-06 12:23                                                 ` Gordan Bobic
2013-09-06 13:20                                                   ` Konrad Rzeszutek Wilk
2013-09-06 14:45                                                     ` Gordan Bobic
2013-09-05 22:33                                           ` Gordan Bobic
2013-09-06 13:04                                             ` Konrad Rzeszutek Wilk
2013-09-06 13:34                                               ` Gordan Bobic [this message]
2013-09-06 14:32                                                 ` Konrad Rzeszutek Wilk
2013-09-06 16:30                                                   ` Gordan Bobic
2013-09-06 19:54                                                     ` Gordan Bobic
2013-09-10 13:35                                                       ` Konrad Rzeszutek Wilk
2013-09-10 15:04                                                         ` Gordan Bobic
2013-07-25 21:26           ` Bug: Limitation of <=2GB RAM in domU persists with 4.3.0 Gordan Bobic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce43c627d6f85f9d8c4a97621d3650e5@mail.shatteredsilicon.net \
    --to=gordan@bobich.net \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.