Skip to contentSkip to conversation

libxc: support building large pv-domains

PATCH Applied Juergen Gross 4 participants 29 messages Sep 11, 2015 – Oct 2, 2015

v1 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover libxc: support building large pv-domains

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic pages
libxc: create p2m list outside of kernel mapping if supported

 tools/libxc/include/xc_dom.h |   4 +-
 tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++--------------
 tools/libxc/xc_dom_x86.c     | 120 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 204 insertions(+), 43 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/5 libxc: remove allocate member from struct xc_dom_image

The allocate() callback in struct xc_dom_image is never set. Remove it.

---
 tools/libxc/include/xc_dom.h | 2 --
 tools/libxc/xc_dom_core.c    | 4 ----
 2 files changed, 6 deletions(-)
tools/libxc/include/xc_dom.h +0 -2
index 600aef6..a4ca8a4 100644
@@ -177,8 +177,6 @@ struct xc_dom_image {
 
     /* kernel loader */
     struct xc_dom_arch *arch_hooks;
-    /* allocate up to virt_alloc_end */
-    int (*allocate) (struct xc_dom_image * dom, xen_vaddr_t up_to);
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
tools/libxc/xc_dom_core.c +0 -4
index 8466677..b432762 100644
@@ -579,8 +579,6 @@ int xc_dom_alloc_segment(struct xc_dom_image *dom,
 
     seg->vend = start + pages * page_size;
     dom->virt_alloc_end = seg->vend;
-    if (dom->allocate)
-        dom->allocate(dom, dom->virt_alloc_end);
 
     DOMPRINTF("%-20s:   %-12s : 0x%" PRIx64 " -> 0x%" PRIx64
               "  (pfn 0x%" PRIpfn " + 0x%" PRIpfn " pages)",
@@ -603,8 +601,6 @@ int xc_dom_alloc_page(struct xc_dom_image *dom, char *name)
 
     start = dom->virt_alloc_end;
     dom->virt_alloc_end += page_size;
-    if (dom->allocate)
-        dom->allocate(dom, dom->virt_alloc_end);
     pfn = (start - dom->parms.virt_base) / page_size;
 
     DOMPRINTF("%-20s:   %-12s : 0x%" PRIx64 " (pfn 0x%" PRIpfn ")",
Signature · 1 line
2.1.4
Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] libxc: remove allocate member from struct xc_dom_image

Juergen Gross writes ("[PATCH 1/5] libxc: remove allocate member from struct xc_dom_image"):

Quoted 1 line

The allocate() callback in struct xc_dom_image is never set. Remove it.

Applied
#3 lore raw

Re: [PATCH 1/5] libxc: remove allocate member from struct xc_dom_image

Quoted 5 lines · Ian Jackson

Juergen Gross writes ("[PATCH 1/5] libxc: remove allocate member from struct xc_dom_image"):

Quoted 1 line

The allocate() callback in struct xc_dom_image is never set. Remove it.

Applied to staging.

This will have a trivial context conflict for Roger's series, which adds a new field to xc_dom_image below the *allocate which is being removed here.

#4 lore raw

Re: [PATCH 1/5] libxc: remove allocate member from struct xc_dom_image

Quoted 8 lines · Ian Campbell
Quoted 5 lines · Ian Jackson

Juergen Gross writes ("[PATCH 1/5] libxc: remove allocate member from struct xc_dom_image"):

Quoted 1 line

The allocate() callback in struct xc_dom_image is never set. Remove it.

Applied to staging.

Really? Can't see it there.

Juergen

Quoted 9 lines

This will have a trivial context conflict for Roger's series, which adds a new field to xc_dom_image below the *allocate which is being removed here.

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

#5 lore raw

Re: [PATCH 1/5] libxc: remove allocate member from struct xc_dom_image

Quoted 4 lines · Juergen Gross
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Ian Jackson

Juergen Gross writes ("[PATCH 1/5] libxc: remove allocate member from struct xc_dom_image"):

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

The allocate() callback in struct xc_dom_image is never set. Remove it.

Applied to staging.

Really? Can't see it there.

Indeed, I seem to have somehow not actually applied it. I've put it back in my queue folder and I'll pick it up when I next go over that.

Sorry for the noise.

Ian.

#6 lore raw

PATCH 2/5 libxc: do initrd processing of domain builder in own function

In reply to Juergen Gross

Factor out the initrd processing in xc_dom_build_image() into an own function to prepare starting a domain with unmapped initrd.

---
 tools/libxc/xc_dom_core.c | 77 ++++++++++++++++++++++++++---------------------
 1 file changed, 43 insertions(+), 34 deletions(-)
tools/libxc/xc_dom_core.c +43 -34
index b432762..b510bbd 100644
@@ -953,6 +953,48 @@ int xc_dom_update_guest_p2m(struct xc_dom_image *dom)
     return 0;
 }
 
+static int xc_dom_build_ramdisk(struct xc_dom_image *dom)
+{
+    size_t unziplen, ramdisklen;
+    void *ramdiskmap;
+
+    if ( !dom->ramdisk_seg.vstart )
+    {
+        unziplen = xc_dom_check_gzip(dom->xch,
+                                     dom->ramdisk_blob, dom->ramdisk_size);
+        if ( xc_dom_ramdisk_check_size(dom, unziplen) != 0 )
+            unziplen = 0;
+    }
+    else
+        unziplen = 0;
+
+    ramdisklen = unziplen ? unziplen : dom->ramdisk_size;
+
+    if ( xc_dom_alloc_segment(dom, &dom->ramdisk_seg, "ramdisk",
+                              dom->ramdisk_seg.vstart, ramdisklen) != 0 )
+        goto err;
+    ramdiskmap = xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg);
+    if ( ramdiskmap == NULL )
+    {
+        DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg) => NULL",
+                  __FUNCTION__);
+        goto err;
+    }
+    if ( unziplen )
+    {
+        if ( xc_dom_do_gunzip(dom->xch, dom->ramdisk_blob, dom->ramdisk_size,
+                              ramdiskmap, ramdisklen) == -1 )
+            goto err;
+    }
+    else
+        memcpy(ramdiskmap, dom->ramdisk_blob, dom->ramdisk_size);
+
+    return 0;
+
+ err:
+    return -1;
+}
+
 int xc_dom_build_image(struct xc_dom_image *dom)
 {
     unsigned int page_size;
@@ -980,41 +1022,8 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     /* load ramdisk */
     if ( dom->ramdisk_blob )
     {
-        size_t unziplen, ramdisklen;
-        void *ramdiskmap;
-
-        if ( !dom->ramdisk_seg.vstart )
-        {
-            unziplen = xc_dom_check_gzip(dom->xch,
-                                         dom->ramdisk_blob, dom->ramdisk_size);
-            if ( xc_dom_ramdisk_check_size(dom, unziplen) != 0 )
-                unziplen = 0;
-        }
-        else
-            unziplen = 0;
-
-        ramdisklen = unziplen ? unziplen : dom->ramdisk_size;
-
-        if ( xc_dom_alloc_segment(dom, &dom->ramdisk_seg, "ramdisk",
-                                  dom->ramdisk_seg.vstart,
-                                  ramdisklen) != 0 )
+        if ( xc_dom_build_ramdisk(dom) != 0 )
             goto err;
-        ramdiskmap = xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg);
-        if ( ramdiskmap == NULL )
-        {
-            DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->ramdisk_seg) => NULL",
-                      __FUNCTION__);
-            goto err;
-        }
-        if ( unziplen )
-        {
-            if ( xc_dom_do_gunzip(dom->xch,
-                                  dom->ramdisk_blob, dom->ramdisk_size,
-                                  ramdiskmap, ramdisklen) == -1 )
-                goto err;
-        }
-        else
-            memcpy(ramdiskmap, dom->ramdisk_blob, dom->ramdisk_size);
     }
 
     /* load devicetree */
Signature · 1 line
2.1.4
Acked-by on v1 2/5
#7 lore raw

Re: [PATCH 2/5] libxc: do initrd processing of domain builder in own function

Juergen Gross writes ("[PATCH 2/5] libxc: do initrd processing of domain builder in own function"):

Quoted 2 lines

Factor out the initrd processing in xc_dom_build_image() into an own function to prepare starting a domain with unmapped initrd.

I haven't checked that this is just code motion and the obvious refactoring, but it looks like it is. On that basis

#8 lore raw

Re: [PATCH 2/5] libxc: do initrd processing of domain builder in own function

Quoted 9 lines · Ian Jackson

Juergen Gross writes ("[PATCH 2/5] libxc: do initrd processing of domain builder in own function"):

Quoted 2 lines

Factor out the initrd processing in xc_dom_build_image() into an own function to prepare starting a domain with unmapped initrd.

I haven't checked that this is just code motion and the obvious refactoring, but it looks like it is. On that basis

Doesn't look to conflict with Roger's series, so applied.

Ian.

#9 lore raw

PATCH 3/5 libxc: create unmapped initrd in domain builder if supported

In reply to Juergen Gross

In case the kernel of a new pv-domU indicates it is supporting an unmapped initrd, don't waste precious virtual space for the initrd, but allocate only guest physical memory for it.

---
 tools/libxc/xc_dom_core.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
tools/libxc/xc_dom_core.c +22 -2
index b510bbd..bb668b1 100644
@@ -1019,8 +1019,10 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     if ( dom->kernel_loader->loader(dom) != 0 )
         goto err;
 
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )
     {
         if ( xc_dom_build_ramdisk(dom) != 0 )
             goto err;
@@ -1059,10 +1061,28 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     }
     if ( dom->alloc_bootstack )
         dom->bootstack_pfn = xc_dom_alloc_page(dom, "boot stack");
+
     DOMPRINTF("%-20s: virt_alloc_end : 0x%" PRIx64 "",
               __FUNCTION__, dom->virt_alloc_end);
     DOMPRINTF("%-20s: virt_pgtab_end : 0x%" PRIx64 "",
               __FUNCTION__, dom->virt_pgtab_end);
+
+    /* Prepare allocating unmapped memory. */
+    if ( dom->virt_pgtab_end )
+        dom->virt_alloc_end = dom->virt_pgtab_end;
+
+    /* Load ramdisk if no initial mapping required. */
+    if ( dom->ramdisk_blob && !dom->ramdisk_seg.vstart &&
+         dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num )
+    {
+        if ( xc_dom_build_ramdisk(dom) != 0 )
+            goto err;
+        dom->flags |= SIF_MOD_START_PFN;
+        dom->ramdisk_seg.vend = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart;
+        dom->ramdisk_seg.vstart = dom->ramdisk_seg.pfn;
+        dom->ramdisk_seg.vend += dom->ramdisk_seg.vstart;
+    }
+
     return 0;
 
  err:
Signature · 1 line
2.1.4
#10 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

Juergen Gross writes ("[PATCH 3/5] libxc: create unmapped initrd in domain builder if supported"):

Quoted 3 lines

In case the kernel of a new pv-domU indicates it is supporting an unmapped initrd, don't waste precious virtual space for the initrd, but allocate only guest physical memory for it.

...

The name of this ELFNOTE suggests that it applies to all multiboot modules, not just ramdisks. In particular, that means perhaps it ought to apply to device tree blobs too ?

tools/libxc/xc_dom_core.c int xc_dom_build_image(struct xc_dom_image *dom) · line 1025

Quoted 6 lines
tools/libxc/xc_dom_core.c +4 -2
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )

After this patch the resulting structure of the code is rather unfortunate, in that the order of the main processing steps depends on this ELFNOTE.

Wouldn't it be better to generalise xc_dom_alloc_segment ?

Ian.

#11 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

Quoted 9 lines · Ian Jackson

Juergen Gross writes ("[PATCH 3/5] libxc: create unmapped initrd in domain builder if supported"):

Quoted 3 lines

In case the kernel of a new pv-domU indicates it is supporting an unmapped initrd, don't waste precious virtual space for the initrd, but allocate only guest physical memory for it.

...

The name of this ELFNOTE suggests that it applies to all multiboot modules, not just ramdisks. In particular, that means perhaps it ought to apply to device tree blobs too ?

The device tree blobs is not a multiboot module but directly pass in a register to the kernel.

FWIW, we don't have any ELF support right now on ARM.

Quoted 10 lines

tools/libxc/xc_dom_core.c int xc_dom_build_image(struct xc_dom_image *dom) · line 1025

Quoted 6 lines
tools/libxc/xc_dom_core.c +4 -2
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )

After this patch the resulting structure of the code is rather unfortunate, in that the order of the main processing steps depends on this ELFNOTE.

Shouldn't we ought to have a common code ELF agnostic? I.e we may have other kernel image format where we have notes but not ELF notes.

Regards,

Signature · 1 line
Julien Grall
#12 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

Quoted 7 lines · Julien Grall
Quoted 6 lines · Ian Jackson

Juergen Gross writes ("[PATCH 3/5] libxc: create unmapped initrd in domain builder if supported"):

Quoted 3 lines

In case the kernel of a new pv-domU indicates it is supporting an unmapped initrd, don't waste precious virtual space for the initrd, but allocate only guest physical memory for it.

...

Quoted 8 lines
Quoted 3 lines

The name of this ELFNOTE suggests that it applies to all multiboot modules, not just ramdisks. In particular, that means perhaps it ought to apply to device tree blobs too ?

The device tree blobs is not a multiboot module but directly pass in a register to the kernel.

FWIW, we don't have any ELF support right now on ARM.

Okay, I thought so, but I wasn't sure.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
tools/libxc/xc_dom_core.c +4 -2
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )
Quoted 6 lines
Quoted 3 lines

After this patch the resulting structure of the code is rather unfortunate, in that the order of the main processing steps depends on this ELFNOTE.

Shouldn't we ought to have a common code ELF agnostic? I.e we may have other kernel image format where we have notes but not ELF notes.

dom->parms is the same for all architectures. I think it would have to be extended in that case.

Juergen

#13 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

Quoted 13 lines · Juergen Gross
Quoted 13 lines
Quoted 12 lines

tools/libxc/xc_dom_core.c int xc_dom_build_image(struct xc_dom_image *dom) · line 1025

Quoted 7 lines
tools/libxc/xc_dom_core.c +4 -3
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom
->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )

After this patch the resulting structure of the code is rather unfortunate, in that the order of the main processing steps depends on
this ELFNOTE.

Quoted 5 lines
Quoted 2 lines

Shouldn't we ought to have a common code ELF agnostic? I.e we may have other kernel image format where we have notes but not ELF notes.

dom->parms is the same for all architectures. I think it would have to be extended in that case.

dom->parms is a struct elf_dom_parms which unfortunately appears to conflate a bunch of generic stuff which can be parsed from a variety of image types (virt_start, features, etc) and some ELF specific stuff e.g. elf_notes.

Really this stuff ought to be split out, along those lines with dom->parms only containing the former.

This sort of happens now in an obscure way by virtue of the /* raw */ and /* parsed */ comments in the struct definition, libxc _only_ uses parsed information but you are now adding a use of elf_notes which is in the raw section. I agree with Julien that this should be avoided.

I think the easy answer would be for libelf to parse that note into an appropriate new field which is agnostic to ELF.

Ian.

#14 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

In reply to Ian Jackson
Quoted 9 lines · Ian Jackson

Juergen Gross writes ("[PATCH 3/5] libxc: create unmapped initrd in domain builder if supported"):

Quoted 3 lines

In case the kernel of a new pv-domU indicates it is supporting an unmapped initrd, don't waste precious virtual space for the initrd, but allocate only guest physical memory for it.

...

The name of this ELFNOTE suggests that it applies to all multiboot modules, not just ramdisks. In particular, that means perhaps it ought to apply to device tree blobs too ?

Hmm, in theory, yes.

AFAIK it is only used for initrd on x86. I think support for other modules can be added as needed.

Quoted 7 lines

tools/libxc/xc_dom_core.c int xc_dom_build_image(struct xc_dom_image *dom) · line 1025

Quoted 6 lines
tools/libxc/xc_dom_core.c +4 -2
-    /* load ramdisk */
-    if ( dom->ramdisk_blob )
+    /* Load ramdisk if initial mapping required. */
+    if ( dom->ramdisk_blob &&
+         (!dom->parms.elf_notes[XEN_ELFNOTE_MOD_START_PFN].data.num ||
+          dom->ramdisk_seg.vstart) )
Quoted 5 lines

After this patch the resulting structure of the code is rather unfortunate, in that the order of the main processing steps depends on this ELFNOTE.

Wouldn't it be better to generalise xc_dom_alloc_segment ?

How?

You have to create (and allocate space for) the page tables after all allocations which should be covered by those page tables. And you must not allocate the other stuff before that, as this would again waste virtual address space, which is 1:1 with guest physical memory.

The only solution would be to calculate the needed sizes of the single memory chunks first and then do the allocations either in the mapped or the unmapped region according to the ELFNOTEs. This would rip at least the initrd processing into two parts, as the needed memory size is calculated depending on the initrd being compressed or not.

I thought about building a table containing the sequence of the single processing steps dependant on the ELFNOTEs and processing this table in a generic loop afterwards. If you like this approach, I can give it a try. I just wanted to avoid a complete rework of the main building function.

Juergen

#15 lore raw

Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported

Juergen Gross writes ("Re: [PATCH 3/5] libxc: create unmapped initrd in domain builder if supported"):

Quoted 5 lines

I thought about building a table containing the sequence of the single processing steps dependant on the ELFNOTEs and processing this table in a generic loop afterwards. If you like this approach, I can give it a try. I just wanted to avoid a complete rework of the main building function.

Hrm, I see what you mean.

Especially if we can't reorganise the code so that it is always
- things which need to be mapped
- things which may be unmapped
so that you can switch from mapping to not mapping at one point. But perhaps even that would be more complicated.

Thanks for your explanation, anyway.

Ian.

#16 lore raw

PATCH 4/5 libxc: split p2m allocation in domain builder from other magic pages

In reply to Juergen Gross

Add an own function to allocate the p2m list in the domain builder in order to prepare allocating the p2m list outside of the initial kernel mapping. This will be needed to support loading domains with huge memory (>512 GB).

---
 tools/libxc/include/xc_dom.h |  1 +
 tools/libxc/xc_dom_core.c    |  3 +++
 tools/libxc/xc_dom_x86.c     | 11 ++++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)
tools/libxc/include/xc_dom.h +1 -0
index a4ca8a4..43b1eab 100644
@@ -199,6 +199,7 @@ void xc_dom_register_loader(struct xc_dom_loader *loader);
 struct xc_dom_arch {
     /* pagetable setup */
     int (*alloc_magic_pages) (struct xc_dom_image * dom);
+    int (*alloc_p2m_list) (struct xc_dom_image * dom);
     int (*count_pgtables) (struct xc_dom_image * dom);
     int (*setup_pgtables) (struct xc_dom_image * dom);
 
tools/libxc/xc_dom_core.c +3 -0
index bb668b1..81b642e 100644
@@ -1048,6 +1048,9 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     }
 
     /* allocate other pages */
+    if ( dom->arch_hooks->alloc_p2m_list &&
+         dom->arch_hooks->alloc_p2m_list(dom) != 0 )
+        goto err;
     if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
         goto err;
     if ( dom->arch_hooks->count_pgtables )
tools/libxc/xc_dom_x86.c +10 -1
index 3d40fa4..91d4e49 100644
@@ -438,7 +438,7 @@ pfn_error:
 
 /* ------------------------------------------------------------------------ */
 
-static int alloc_magic_pages(struct xc_dom_image *dom)
+static int alloc_p2m_list(struct xc_dom_image *dom)
 {
     size_t p2m_alloc_size = dom->p2m_size * dom->arch_hooks->sizeof_pfn;
 
@@ -450,6 +450,13 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
     if ( dom->p2m_guest == NULL )
         return -1;
 
+    return 0;
+}
+
+/* ------------------------------------------------------------------------ */
+
+static int alloc_magic_pages(struct xc_dom_image *dom)
+{
     /* allocate special pages */
     dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
     dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
@@ -676,6 +683,7 @@ static struct xc_dom_arch xc_dom_32_pae = {
     .page_shift = PAGE_SHIFT_X86,
     .sizeof_pfn = 4,
     .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
     .count_pgtables = count_pgtables_x86_32_pae,
     .setup_pgtables = setup_pgtables_x86_32_pae,
     .start_info = start_info_x86_32,
@@ -689,6 +697,7 @@ static struct xc_dom_arch xc_dom_64 = {
     .page_shift = PAGE_SHIFT_X86,
     .sizeof_pfn = 8,
     .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
     .count_pgtables = count_pgtables_x86_64,
     .setup_pgtables = setup_pgtables_x86_64,
     .start_info = start_info_x86_64,
Signature · 1 line
2.1.4
Acked-by on v1 4/5
#17 lore raw

Re: [PATCH 4/5] libxc: split p2m allocation in domain builder from other magic pages

Quoted 1 line · Juergen Gross

Add an own function to allocate the p2m list in the domain builder in

I'm not sure what you mean by "own" here. Perhaps "hook" or "callback"?

Quoted 5 lines

order to prepare allocating the p2m list outside of the initial kernel mapping. This will be needed to support loading domains with huge memory (>512 GB).

Other than the above it otherwise LGTM, so with that clarification:

Quoted 79 lines
---
 tools/libxc/include/xc_dom.h |  1 +
 tools/libxc/xc_dom_core.c    |  3 +++
 tools/libxc/xc_dom_x86.c     | 11 ++++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)
tools/libxc/include/xc_dom.h +1 -0
index a4ca8a4..43b1eab 100644
@@ -199,6 +199,7 @@ void xc_dom_register_loader(struct xc_dom_loader
 *loader);
 struct xc_dom_arch {
     /* pagetable setup */
     int (*alloc_magic_pages) (struct xc_dom_image * dom);
+    int (*alloc_p2m_list) (struct xc_dom_image * dom);
     int (*count_pgtables) (struct xc_dom_image * dom);
     int (*setup_pgtables) (struct xc_dom_image * dom);
tools/libxc/xc_dom_core.c +3 -0
index bb668b1..81b642e 100644
@@ -1048,6 +1048,9 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     }
 
     /* allocate other pages */
+    if ( dom->arch_hooks->alloc_p2m_list &&
+         dom->arch_hooks->alloc_p2m_list(dom) != 0 )
+        goto err;
     if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
         goto err;
     if ( dom->arch_hooks->count_pgtables )
tools/libxc/xc_dom_x86.c +10 -3
index 3d40fa4..91d4e49 100644
@@ -438,7 +438,7 @@ pfn_error:
 
 /* ---------------------------------------------------------------------
--- */
 
-static int alloc_magic_pages(struct xc_dom_image *dom)
+static int alloc_p2m_list(struct xc_dom_image *dom)
 {
     size_t p2m_alloc_size = dom->p2m_size * dom->arch_hooks->sizeof_pfn;
@@ -450,6 +450,13 @@ static int alloc_magic_pages(struct xc_dom_image
 *dom)
     if ( dom->p2m_guest == NULL )
         return -1;
 
+    return 0;
+}
+
+/* ---------------------------------------------------------------------
--- */
+
+static int alloc_magic_pages(struct xc_dom_image *dom)
+{
     /* allocate special pages */
     dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
     dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
@@ -676,6 +683,7 @@ static struct xc_dom_arch xc_dom_32_pae = {
     .page_shift = PAGE_SHIFT_X86,
     .sizeof_pfn = 4,
     .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
     .count_pgtables = count_pgtables_x86_32_pae,
     .setup_pgtables = setup_pgtables_x86_32_pae,
     .start_info = start_info_x86_32,
@@ -689,6 +697,7 @@ static struct xc_dom_arch xc_dom_64 = {
     .page_shift = PAGE_SHIFT_X86,
     .sizeof_pfn = 8,
     .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
     .count_pgtables = count_pgtables_x86_64,
     .setup_pgtables = setup_pgtables_x86_64,
     .start_info = start_info_x86_64,
#18 lore raw

Re: [PATCH 4/5] libxc: split p2m allocation in domain builder from other magic pages

Quoted 4 lines · Ian Campbell
Quoted 1 line · Juergen Gross

Add an own function to allocate the p2m list in the domain builder in

I'm not sure what you mean by "own" here. Perhaps "hook" or "callback"?

Before the p2m list allocation was done in the alloc_magic_pages hook. I'm just splitting this function.

Juergen

Quoted 91 lines
Quoted 6 lines

order to prepare allocating the p2m list outside of the initial kernel mapping. This will be needed to support loading domains with huge memory (>512 GB).

Other than the above it otherwise LGTM, so with that clarification:

Quoted 79 lines
---
  tools/libxc/include/xc_dom.h |  1 +
  tools/libxc/xc_dom_core.c    |  3 +++
  tools/libxc/xc_dom_x86.c     | 11 ++++++++++-
  3 files changed, 14 insertions(+), 1 deletion(-)
tools/libxc/include/xc_dom.h +1 -0
index a4ca8a4..43b1eab 100644
@@ -199,6 +199,7 @@ void xc_dom_register_loader(struct xc_dom_loader
 *loader);
  struct xc_dom_arch {
      /* pagetable setup */
      int (*alloc_magic_pages) (struct xc_dom_image * dom);
+    int (*alloc_p2m_list) (struct xc_dom_image * dom);
      int (*count_pgtables) (struct xc_dom_image * dom);
      int (*setup_pgtables) (struct xc_dom_image * dom);
tools/libxc/xc_dom_core.c +3 -0
index bb668b1..81b642e 100644
@@ -1048,6 +1048,9 @@ int xc_dom_build_image(struct xc_dom_image *dom)
      }
 
      /* allocate other pages */
+    if ( dom->arch_hooks->alloc_p2m_list &&
+         dom->arch_hooks->alloc_p2m_list(dom) != 0 )
+        goto err;
      if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
          goto err;
      if ( dom->arch_hooks->count_pgtables )
tools/libxc/xc_dom_x86.c +10 -3
index 3d40fa4..91d4e49 100644
@@ -438,7 +438,7 @@ pfn_error:
 
  /* ---------------------------------------------------------------------
--- */
 
-static int alloc_magic_pages(struct xc_dom_image *dom)
+static int alloc_p2m_list(struct xc_dom_image *dom)
  {
      size_t p2m_alloc_size = dom->p2m_size * dom->arch_hooks->sizeof_pfn;
@@ -450,6 +450,13 @@ static int alloc_magic_pages(struct xc_dom_image
 *dom)
      if ( dom->p2m_guest == NULL )
          return -1;
 
+    return 0;
+}
+
+/* ---------------------------------------------------------------------
--- */
+
+static int alloc_magic_pages(struct xc_dom_image *dom)
+{
      /* allocate special pages */
      dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
      dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
@@ -676,6 +683,7 @@ static struct xc_dom_arch xc_dom_32_pae = {
      .page_shift = PAGE_SHIFT_X86,
      .sizeof_pfn = 4,
      .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
      .count_pgtables = count_pgtables_x86_32_pae,
      .setup_pgtables = setup_pgtables_x86_32_pae,
      .start_info = start_info_x86_32,
@@ -689,6 +697,7 @@ static struct xc_dom_arch xc_dom_64 = {
      .page_shift = PAGE_SHIFT_X86,
      .sizeof_pfn = 8,
      .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
      .count_pgtables = count_pgtables_x86_64,
      .setup_pgtables = setup_pgtables_x86_64,
      .start_info = start_info_x86_64,
#19 lore raw

Re: [PATCH 4/5] libxc: split p2m allocation in domain builder from other magic pages

Quoted 8 lines · Juergen Gross
Quoted 4 lines · Ian Campbell
Quoted 1 line · Juergen Gross

Add an own function to allocate the p2m list in the domain builder in

I'm not sure what you mean by "own" here. Perhaps "hook" or "callback"?

Before the p2m list allocation was done in the alloc_magic_pages hook. I'm just splitting this function.

I get that, but "own" is not the right word for this.

Perhaps you meant "separate (hook|function)" or "specific (hook|function)" or something like that?

Perhaps something like:

Refactor allocation of the p2m list out of alloc_magic_pages into a new alloc_p2m_list hook.

?

Ian.

Quoted 102 lines

Juergen

Quoted 97 lines
Quoted 7 lines

order to prepare allocating the p2m list outside of the initial kernel
mapping. This will be needed to support loading domains with huge memory (>512 GB).

Other than the above it otherwise LGTM, so with that clarification:

Quoted 84 lines
---
  tools/libxc/include/xc_dom.h |  1 +
  tools/libxc/xc_dom_core.c    |  3 +++
  tools/libxc/xc_dom_x86.c     | 11 ++++++++++-
  3 files changed, 14 insertions(+), 1 deletion(-)
tools/libxc/include/xc_dom.h +1 -0
index a4ca8a4..43b1eab 100644
@@ -199,6 +199,7 @@ void xc_dom_register_loader(struct xc_dom_loader
 *loader);
  struct xc_dom_arch {
      /* pagetable setup */
      int (*alloc_magic_pages) (struct xc_dom_image * dom);
+    int (*alloc_p2m_list) (struct xc_dom_image * dom);
      int (*count_pgtables) (struct xc_dom_image * dom);
      int (*setup_pgtables) (struct xc_dom_image * dom);
tools/libxc/xc_dom_core.c +3 -0
index bb668b1..81b642e 100644
@@ -1048,6 +1048,9 @@ int xc_dom_build_image(struct xc_dom_image
 *dom)
      }
 
      /* allocate other pages */
+    if ( dom->arch_hooks->alloc_p2m_list &&
+         dom->arch_hooks->alloc_p2m_list(dom) != 0 )
+        goto err;
      if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
          goto err;
      if ( dom->arch_hooks->count_pgtables )
tools/libxc/xc_dom_x86.c +10 -6
index 3d40fa4..91d4e49 100644
@@ -438,7 +438,7 @@ pfn_error:
 
  /* ----------------------------------------------------------------
-----
--- */
 
-static int alloc_magic_pages(struct xc_dom_image *dom)
+static int alloc_p2m_list(struct xc_dom_image *dom)
  {
      size_t p2m_alloc_size = dom->p2m_size * dom->arch_hooks
->sizeof_pfn;
@@ -450,6 +450,13 @@ static int alloc_magic_pages(struct xc_dom_image
 *dom)
      if ( dom->p2m_guest == NULL )
          return -1;
 
+    return 0;
+}
+
+/* -----------------------------------------------------------------
----
--- */
+
+static int alloc_magic_pages(struct xc_dom_image *dom)
+{
      /* allocate special pages */
      dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
      dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
@@ -676,6 +683,7 @@ static struct xc_dom_arch xc_dom_32_pae = {
      .page_shift = PAGE_SHIFT_X86,
      .sizeof_pfn = 4,
      .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
      .count_pgtables = count_pgtables_x86_32_pae,
      .setup_pgtables = setup_pgtables_x86_32_pae,
      .start_info = start_info_x86_32,
@@ -689,6 +697,7 @@ static struct xc_dom_arch xc_dom_64 = {
      .page_shift = PAGE_SHIFT_X86,
      .sizeof_pfn = 8,
      .alloc_magic_pages = alloc_magic_pages,
+    .alloc_p2m_list = alloc_p2m_list,
      .count_pgtables = count_pgtables_x86_64,
      .setup_pgtables = setup_pgtables_x86_64,
      .start_info = start_info_x86_64,
#20 lore raw

Re: [PATCH 4/5] libxc: split p2m allocation in domain builder from other magic pages

Quoted 11 lines · Ian Campbell
Quoted 8 lines · Juergen Gross
Quoted 4 lines · Ian Campbell
Quoted 1 line · Juergen Gross

Add an own function to allocate the p2m list in the domain builder in

I'm not sure what you mean by "own" here. Perhaps "hook" or "callback"?

Before the p2m list allocation was done in the alloc_magic_pages hook. I'm just splitting this function.

I get that, but "own" is not the right word for this.

Obviously.

Quoted 7 lines

Perhaps you meant "separate (hook|function)" or "specific (hook|function)" or something like that?

Perhaps something like:

Refactor allocation of the p2m list out of alloc_magic_pages into a new alloc_p2m_list hook.

In v2 I've changed the wording in a similar way.

Juergen

#21 lore raw

Re: [PATCH 4/5] libxc: split p2m allocation in domain builder from other magic pages

Quoted 10 lines · Juergen Gross
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Juergen Gross
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Juergen Gross

Add an own function to allocate the p2m list in the domain builder in

I'm not sure what you mean by "own" here. Perhaps "hook" or "callback"?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Before the p2m list allocation was done in the alloc_magic_pages hook.
I'm just splitting this function.

I get that, but "own" is not the right word for this.

Obviously.

It occurred to me afterwards that "into its own function" would be one way to express this, so I see know how you got to that wording.

Quoted 11 lines
Quoted 9 lines

Perhaps you meant "separate (hook|function)" or "specific (hook|function)"
or something like that?

Perhaps something like:

Refactor allocation of the p2m list out of alloc_magic_pages into
a new
alloc_p2m_list hook.

In v2 I've changed the wording in a similar way.

I'll go have a look.

#22 lore raw

PATCH 5/5 libxc: create p2m list outside of kernel mapping if supported

In reply to Juergen Gross

In case the kernel of a new pv-domU indicates it is supporting a p2m list outside the initial kernel mapping by specifying INIT_P2M, let the domain builder allocate the memory for the p2m list from physical guest memory only and map it to the address the kernel is expecting.

This will enable loading pv-domUs larger than 512 GB.

---
 tools/libxc/include/xc_dom.h |   1 +
 tools/libxc/xc_dom_core.c    |  17 ++++++-
 tools/libxc/xc_dom_x86.c     | 109 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 126 insertions(+), 1 deletion(-)
tools/libxc/include/xc_dom.h +1 -0
index 43b1eab..6192fba 100644
@@ -212,6 +212,7 @@ struct xc_dom_arch {
     char *native_protocol;
     int page_shift;
     int sizeof_pfn;
+    int p2m_base_supported;
 
     struct xc_dom_arch *next;
 };
tools/libxc/xc_dom_core.c +16 -1
index 81b642e..1cf77d7 100644
@@ -734,6 +734,7 @@ struct xc_dom_image *xc_dom_allocate(xc_interface *xch,
     dom->parms.virt_hypercall = UNSET_ADDR;
     dom->parms.virt_hv_start_low = UNSET_ADDR;
     dom->parms.elf_paddr_offset = UNSET_ADDR;
+    dom->parms.p2m_base = UNSET_ADDR;
 
     dom->alloc_malloc += sizeof(*dom);
     return dom;
@@ -1048,7 +1049,11 @@ int xc_dom_build_image(struct xc_dom_image *dom)
     }
 
     /* allocate other pages */
-    if ( dom->arch_hooks->alloc_p2m_list &&
+    if ( !dom->arch_hooks->p2m_base_supported ||
+         dom->parms.p2m_base >= dom->parms.virt_base ||
+         (dom->parms.p2m_base & (XC_DOM_PAGE_SIZE(dom) - 1)) )
+        dom->parms.p2m_base = UNSET_ADDR;
+    if ( dom->arch_hooks->alloc_p2m_list && dom->parms.p2m_base == UNSET_ADDR &&
          dom->arch_hooks->alloc_p2m_list(dom) != 0 )
         goto err;
     if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
@@ -1086,6 +1091,16 @@ int xc_dom_build_image(struct xc_dom_image *dom)
         dom->ramdisk_seg.vend += dom->ramdisk_seg.vstart;
     }
 
+    /* Allocate p2m list if outside of initial kernel mapping. */
+    if ( dom->arch_hooks->alloc_p2m_list && dom->parms.p2m_base != UNSET_ADDR )
+    {
+        if ( dom->arch_hooks->alloc_p2m_list(dom) != 0 )
+            goto err;
+        dom->p2m_seg.vend = dom->p2m_seg.vend - dom->p2m_seg.vstart;
+        dom->p2m_seg.vstart = dom->parms.p2m_base;
+        dom->p2m_seg.vend += dom->p2m_seg.vstart;
+    }
+
     return 0;
 
  err:
tools/libxc/xc_dom_x86.c +109 -0

152 lines not on this page · raw message

Signature · 1 line
2.1.4
#23 lore raw
In reply to Juergen Gross
Quoted 28 lines · Juergen Gross

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic pages
libxc: create p2m list outside of kernel mapping if supported

Quoted 3 lines
 tools/libxc/include/xc_dom.h |   4 +-
 tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++--------------
 tools/libxc/xc_dom_x86.c     | 120 ++++++++++++++++++++++++++++++++++++++++-

How much is this going to conflict with Roger's "Introduce HVM without dm and new boot ABI" changes to HVM building?

Quoted 2 lines
 3 files changed, 204 insertions(+), 43 deletions(-)
#24 lore raw
Quoted 29 lines · Ian Campbell
Quoted 28 lines · Juergen Gross

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic pages
libxc: create p2m list outside of kernel mapping if supported

Quoted 6 lines
Quoted 3 lines
  tools/libxc/include/xc_dom.h |   4 +-
  tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++--------------
  tools/libxc/xc_dom_x86.c     | 120 ++++++++++++++++++++++++++++++++++++++++-

How much is this going to conflict with Roger's "Introduce HVM without dm and new boot ABI" changes to HVM building?

As it is touching the pv domain builder only, I don't think there will be a conflict. All rights of being wrong reserved. :-)

Juergen

#25 lore raw
Quoted 37 lines · Juergen Gross
Quoted 36 lines · Ian Campbell
Quoted 34 lines · Juergen Gross

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic
pages
libxc: create p2m list outside of kernel mapping if supported

  tools/libxc/include/xc_dom.h |   4 +-
  tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++---
-----------
  tools/libxc/xc_dom_x86.c     | 120

++++++++++++++++++++++++++++++++++++++++-

Quoted 6 lines
Quoted 3 lines

How much is this going to conflict with Roger's "Introduce HVM without dm
and new boot ABI" changes to HVM building?

As it is touching the pv domain builder only, I don't think there will be a conflict.

The reason I asked is that the first thing Roger's series does is cause HVM domains to be built using the PV domain builder...

Quoted 1 line

All rights of being wrong reserved. :-)

Warranty void to the limit of your statutory rights ;-)

Ian.

#26 lore raw
Quoted 42 lines · Ian Campbell
Quoted 41 lines · Juergen Gross
Quoted 39 lines · Ian Campbell
Quoted 29 lines · Juergen Gross

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic
pages
libxc: create p2m list outside of kernel mapping if supported

Quoted 5 lines
   tools/libxc/include/xc_dom.h |   4 +-
   tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++---
-----------
   tools/libxc/xc_dom_x86.c     | 120

++++++++++++++++++++++++++++++++++++++++-

How much is this going to conflict with Roger's "Introduce HVM without dm
and new boot ABI" changes to HVM building?

Quoted 5 lines
Quoted 2 lines

As it is touching the pv domain builder only, I don't think there will be a conflict.

The reason I asked is that the first thing Roger's series does is cause HVM domains to be built using the PV domain builder...

Aah, okay.

OTOH I'm doing nothing different than the hypervisor when loading dom0. As long as the ELFNOTEs in question (or the corresponding elements in dom->parms) are not set, the resulting domain image should be the same as today.

Quoted 3 lines
Quoted 1 line

All rights of being wrong reserved. :-)

Warranty void to the limit of your statutory rights ;-)

Ha, good intuition! The disclaimer wasn't a bad idea at the end. ;-)

Juergen

#27 lore raw
Quoted 9 lines · Juergen Gross
Quoted 2 lines

The reason I asked is that the first thing Roger's series does is cause HVM domains to be built using the PV domain builder...

Aah, okay.

OTOH I'm doing nothing different than the hypervisor when loading dom0. As long as the ELFNOTEs in question (or the corresponding elements in dom->parms) are not set, the resulting domain image should be the same as today.

As we all functionality wise my concern is that we are holding off on applying Roger's series, which is AIUI ready to go, to staging until 4.6 is released, despite staging being open for business because of how invasive it is and the impact therefore on any backports we might need to do for 4.6.

Given that it seems unfair to take other series to the same area which came afterwards if they are going to cause huge conflicts for Roger.

That said, I've looked at your #1 and #2 vs Roger's series and the conflict would appear to be a trivial context one (of the sort I would routinely fixup during commit any way). So I've applied those two.

I had a comment on #3. I'm afraid I didn't get to #4 or #5 yet.

Ian.

#28 lore raw
In reply to Juergen Gross

Hi tools maintainers,

Quoted 28 lines · Juergen Gross

The Xen hypervisor supports starting a dom0 with large memory (up to the TB range) by not including the initrd and p2m list in the initial kernel mapping. Especially the p2m list can grow larger than the available virtual space in the initial mapping.

The started kernel is indicating the support of each feature via elf notes.

This series enables the domain builder in libxc to do the same as the hypervisor. This enables starting of huge pv-domUs via xl.

Unmapped initrd is supported for 64 and 32 bit domains, omitting the p2m from initial kernel mapping is possible for 64 bit domains only.

Tested with:
- 32 bit domU (kernel not supporting unmapped initrd)
- 32 bit domU (kernel supporting unmapped initrd)
- 1 GB 64 bit domU (kernel supporting unmapped initrd, not p2m)
- 1 GB 64 bit domU (kernel supporting unmapped initrd and p2m)
- 900GB 64 bit domU (kernel supporting unmapped initrd and p2m)

Juergen Gross (5):
libxc: remove allocate member from struct xc_dom_image
libxc: do initrd processing of domain builder in own function
libxc: create unmapped initrd in domain builder if supported
libxc: split p2m allocation in domain builder from other magic pages
libxc: create p2m list outside of kernel mapping if supported

Quoted 5 lines
  tools/libxc/include/xc_dom.h |   4 +-
  tools/libxc/xc_dom_core.c    | 123 +++++++++++++++++++++++++++++--------------
  tools/libxc/xc_dom_x86.c     | 120 ++++++++++++++++++++++++++++++++++++++++-
  3 files changed, 204 insertions(+), 43 deletions(-)

Patches 1+2 got Acked-by IanJ, what about the other 3 patches?

Juergen