Skip to contentSkip to conversation

libxc: fix the types used in xc_dom_image to build HVM guests

PATCH In review Roger Pau Monne 3 participants 8 messages Oct 15, 2015 – Oct 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libxc: fix the types used in xc_dom_image to build HVM guests

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>

---
I don't have a 32bit Dom0 at hand, so if someone can try to create a HVM guests using a 32bit toolstack with more than 4GB of RAM it would be helpful.
---
Changes since v1:
- Use xen_paddr_t for all the physical address related fields.
- Use xen_pfn_t for target_pages.

---
 tools/libxc/include/xc_dom.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxc/include/xc_dom.h +4 -4
index e52b023..7cb6b0c 100644
@@ -187,10 +187,10 @@ struct xc_dom_image {
 
     /* HVM specific fields. */
     xen_pfn_t target_pages;
-    xen_pfn_t mmio_start;
-    xen_pfn_t mmio_size;
-    xen_pfn_t lowmem_end;
-    xen_pfn_t highmem_end;
+    xen_paddr_t mmio_start;
+    xen_paddr_t mmio_size;
+    xen_paddr_t lowmem_end;
+    xen_paddr_t highmem_end;
 
     /* Extra ACPI tables passed to HVMLOADER */
     struct xc_hvm_firmware_module acpi_module;
Signature · 7 lines
1.9.5 (Apple Git-50.3)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · Roger Pau Monne

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which
is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Quoted 4 lines

---
I don't have a 32bit Dom0 at hand, so if someone can try to create a HVM guests using a 32bit toolstack with more than 4GB of RAM it would be helpful.

I am happy after eyeballing that this is at least an improvement and am content to let osstest answer this question.

I'm still having some trouble accessing the machines where I typically do all my semi-automated pre-push build tests but given that these issues have been blocking the push gate for a while now I am going to push this change without the full, i.e. just a quick local adhoc build which I am doing now.

Ian.

Quoted 17 lines

---
Changes since v1:
- Use xen_paddr_t for all the physical address related fields.
- Use xen_pfn_t for target_pages.

---
 tools/libxc/include/xc_dom.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxc/include/xc_dom.h +0 -1
index e52b023..7cb6b0c 100644
@@ -187,10 +187,10 @@ struct xc_dom_image {
 
     /* HVM specific fields. */
     xen_pfn_t target_pages;
-    xen_pfn_t mmio_start;

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 196

Quoted 10 lines
tools/libxc/include/xc_dom.h +4 -3
-    xen_pfn_t mmio_size;
-    xen_pfn_t lowmem_end;
-    xen_pfn_t highmem_end;
+    xen_paddr_t mmio_start;
+    xen_paddr_t mmio_size;
+    xen_paddr_t lowmem_end;
+    xen_paddr_t highmem_end;
 
     /* Extra ACPI tables passed to HVMLOADER */
     struct xc_hvm_firmware_module acpi_module;

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

Acked-by
#2 lore raw
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which
is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Quoted 6 lines
Quoted 4 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Quoted 9 lines
Quoted 5 lines

---
I don't have a 32bit Dom0 at hand, so if someone can try to create a HVM guests using a 32bit toolstack with more than 4GB of RAM it would be helpful.

I am happy after eyeballing that this is at least an improvement and am content to let osstest answer this question.

Agreed.

Quoted 34 lines

I'm still having some trouble accessing the machines where I typically do all my semi-automated pre-push build tests but given that these issues have been blocking the push gate for a while now I am going to push this change without the full, i.e. just a quick local adhoc build which I am doing now.

Ian.

Quoted 27 lines

---
Changes since v1:
- Use xen_paddr_t for all the physical address related fields.
- Use xen_pfn_t for target_pages.

---
 tools/libxc/include/xc_dom.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxc/include/xc_dom.h +4 -4
index e52b023..7cb6b0c 100644
@@ -187,10 +187,10 @@ struct xc_dom_image {
 
     /* HVM specific fields. */
     xen_pfn_t target_pages;
-    xen_pfn_t mmio_start;
-    xen_pfn_t mmio_size;
-    xen_pfn_t lowmem_end;
-    xen_pfn_t highmem_end;
+    xen_paddr_t mmio_start;
+    xen_paddr_t mmio_size;
+    xen_paddr_t lowmem_end;
+    xen_paddr_t highmem_end;
 
     /* Extra ACPI tables passed to HVMLOADER */
     struct xc_hvm_firmware_module acpi_module;
#3 lore raw
Quoted 9 lines · Wei Liu
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Roger Pau Monne

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which
is wrong because a 32bit value cannot hold a 64bit memory address that
crosses the 4GB boundary.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>

Thanks.

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

---
I don't have a 32bit Dom0 at hand, so if someone can try to create a HVM
guests using a 32bit toolstack with more than 4GB of RAM it would be helpful.

I am happy after eyeballing that this is at least an improvement and am content to let osstest answer this question.

Agreed.

Done.

Quoted 4 lines
Quoted 4 lines

I'm still having some trouble accessing the machines where I typically do all my semi-automated pre-push build tests but given that these issues have been blocking the push gate for a while now I am going to push this change without the full, i.e. just a quick local adhoc build which I am doing now.

Roger, please keep an eye out for build issues in the smoke test etc.

Ian.

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

#4 lore raw
In reply to Roger Pau Monne
Quoted 4 lines · Roger Pau Monne

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Just for my own interest, I suppose this was a latent issue even before the dom builder rework, but what was the change which exposed it now?

Ian.

Quoted 26 lines
Cc Ian Jackson <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>

---
I don't have a 32bit Dom0 at hand, so if someone can try to create a HVM guests using a 32bit toolstack with more than 4GB of RAM it would be helpful.
---
Changes since v1:
- Use xen_paddr_t for all the physical address related fields.
- Use xen_pfn_t for target_pages.

---
 tools/libxc/include/xc_dom.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/libxc/include/xc_dom.h +0 -1
index e52b023..7cb6b0c 100644
@@ -187,10 +187,10 @@ struct xc_dom_image {
 
     /* HVM specific fields. */
     xen_pfn_t target_pages;
-    xen_pfn_t mmio_start;

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 196

Quoted 10 lines
tools/libxc/include/xc_dom.h +4 -3
-    xen_pfn_t mmio_size;
-    xen_pfn_t lowmem_end;
-    xen_pfn_t highmem_end;
+    xen_paddr_t mmio_start;
+    xen_paddr_t mmio_size;
+    xen_paddr_t lowmem_end;
+    xen_paddr_t highmem_end;
 
     /* Extra ACPI tables passed to HVMLOADER */
     struct xc_hvm_firmware_module acpi_module;

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

#5 lore raw
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Roger Pau Monne

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Just for my own interest, I suppose this was a latent issue even before the dom builder rework, but what was the change which exposed it now?

I don't think this is a latent issue.

During the refactoring a bunch of types were changed to unsigned long. The original types used were uint64_t, which is of the same width on 32 bit and 64 bit.

Wei.

#6 lore raw

El 16/10/15 a les 11.00, Wei Liu ha escrit:

Quoted 11 lines · Ian Campbell
Quoted 9 lines · Roger Pau Monne
Quoted 4 lines

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which is wrong because a 32bit value cannot hold a 64bit memory address that crosses the 4GB boundary.

Just for my own interest, I suppose this was a latent issue even before the dom builder rework, but what was the change which exposed it now?

Quoted 5 lines

I don't think this is a latent issue.

During the refactoring a bunch of types were changed to unsigned long. The original types used were uint64_t, which is of the same width on 32 bit and 64 bit.

Yes, those fields were in xc_hvm_build_args as uint64_t, and during the rework of the HVM builder I had changed them to xen_pfn_t, so it's completely my fault, previous code should be fine.

I will keep an eye on the smoke OSSTest tests.

Roger.

#7 lore raw
Quoted 17 lines · Roger Pau Monné

El 16/10/15 a les 11.00, Wei Liu ha escrit:

Quoted 16 lines · Ian Campbell
Quoted 8 lines · Roger Pau Monne
Quoted 6 lines

Fix the types used to store the memory parameters of an HVM guest, previously they defaulted to unsigned long on 32bit toolstack builds, which
is wrong because a 32bit value cannot hold a 64bit memory address that
crosses the 4GB boundary.

Quoted 4 lines

Just for my own interest, I suppose this was a latent issue even before the
dom builder rework, but what was the change which exposed it now?

I don't think this is a latent issue.

Quoted 7 lines
Quoted 3 lines

During the refactoring a bunch of types were changed to unsigned long. The original types used were uint64_t, which is of the same width on 32 bit and 64 bit.

Yes, those fields were in xc_hvm_build_args as uint64_t, and during the rework of the HVM builder I had changed them to xen_pfn_t, so it's completely my fault, previous code should be fine.

Ah ok, thanks.

Quoted 1 line

I will keep an eye on the smoke OSSTest tests.

Thank you.

Ian.

Quoted 3 lines

Roger.

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