From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH 1/2] x86/xen: do not identity map UNUSABLE regions in the machine E820
Date: Fri, 16 Aug 2013 11:23:56 -0400 [thread overview]
Message-ID: <20130816152356.GC12047@konrad-lan.dumpdata.com> (raw)
In-Reply-To: <1376664176-27535-2-git-send-email-david.vrabel@citrix.com>
On Fri, Aug 16, 2013 at 03:42:55PM +0100, David Vrabel wrote:
> From: David Vrabel <david.vrabel@citrix.com>
>
> If there are UNUSABLE regions in the machine memory map, dom0 will
> attempt to map them 1:1 which is not permitted by Xen and the kernel
> will crash.
>
> There isn't anything interesting in the UNUSABLE region that the dom0
> kernel needs access to so we can avoid making the 1:1 mapping and
> treat it as RAM.
>
> We only do this for dom0, as we do not expect any domU to ever have a
> UNUSABLE region in their pseudo-physical map.
Hm, you are going to be disappointed that this is in libxl:
/* Lastly, convert the RAM to UNSUABLE. Look in the Linux kernel
at git commit 2f14ddc3a7146ea4cd5a3d1ecd993f85f2e4f948
"xen/setup: Inhibit resource API from using System RAM E820
gaps as PCI mem gaps" for full explanation. */
if (end > ram_end)
src[i].type = E820_UNUSABLE;
}
>
> This fixes a boot failure on hosts with tboot.
>
> tboot marks a region in the e820 map as unusable and the dom0 kernel
> would attempt to map this region and Xen does not permit unusable
> regions to be mapped by guests.
>
> (XEN) 0000000000000000 - 0000000000060000 (usable)
> (XEN) 0000000000060000 - 0000000000068000 (reserved)
> (XEN) 0000000000068000 - 000000000009e000 (usable)
> (XEN) 0000000000100000 - 0000000000800000 (usable)
> (XEN) 0000000000800000 - 0000000000972000 (unusable)
>
> tboot marked this region as unusable.
>
> (XEN) 0000000000972000 - 00000000cf200000 (usable)
> (XEN) 00000000cf200000 - 00000000cf38f000 (reserved)
> (XEN) 00000000cf38f000 - 00000000cf3ce000 (ACPI data)
> (XEN) 00000000cf3ce000 - 00000000d0000000 (reserved)
> (XEN) 00000000e0000000 - 00000000f0000000 (reserved)
> (XEN) 00000000fe000000 - 0000000100000000 (reserved)
> (XEN) 0000000100000000 - 0000000630000000 (usable)
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
> arch/x86/xen/setup.c | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index 056d11f..5a093b7 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -313,6 +313,17 @@ static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
> e820_add_region(start, end - start, type);
> }
>
> +void xen_ignore_unusable(struct e820entry *list, size_t map_size)
> +{
> + struct e820entry *entry;
> + unsigned int i;
> +
> + for (i = 0, entry = list; i < map_size; i++, entry++) {
> + if (entry->type == E820_UNUSABLE)
> + entry->type = E820_RAM;
> + }
> +}
> +
> /**
> * machine_specific_memory_setup - Hook for machine specific memory setup.
> **/
> @@ -353,6 +364,16 @@ char * __init xen_memory_setup(void)
> }
> BUG_ON(rc);
>
> + /*
> + * Xen won't allow a 1:1 mapping to be created to UNUSABLE
> + * regions, so if we're using the machine memory map leave the
> + * region as RAM as it is in the pseudo-physical map.
> + *
> + * UNUSABLE regions are not expected in domUs.
> + */
> + if (xen_initial_domain())
> + xen_ignore_unusable(map, memmap.nr_entries);
> +
> /* Make sure the Xen-supplied memory map is well-ordered. */
> sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
>
> --
> 1.7.2.5
>
next prev parent reply other threads:[~2013-08-16 15:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 14:42 [PATCHv5 0/2] x86/xen: fix dom0 boot with tboot David Vrabel
2013-08-16 14:42 ` [PATCH 1/2] x86/xen: do not identity map UNUSABLE regions in the machine E820 David Vrabel
2013-08-16 15:23 ` Konrad Rzeszutek Wilk [this message]
2013-08-16 17:20 ` David Vrabel
2013-08-16 14:42 ` [PATCH 2/2] x86/xen: during early setup, only 1:1 map the ISA region David Vrabel
2013-08-16 15:25 ` Konrad Rzeszutek Wilk
2013-08-16 15:39 ` David Vrabel
2013-08-16 15:04 ` [PATCHv5 0/2] x86/xen: fix dom0 boot with tboot David Vrabel
2013-08-16 15:09 ` Ian Campbell
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=20130816152356.GC12047@konrad-lan.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.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.