Skip to contentSkip to conversation

hvm: handle PoD and grant pages in HVMOP_get_mem_type

PATCH Applied Olaf Hering 3 participants 6 messages Oct 19, 2012 – Oct 23, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvm: handle PoD and grant pages in HVMOP_get_mem_type

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1350655745 -7200
# Node ID 8ebe7b80f02900d5a83e023c2833de26b70f3ff1 # Parent 3fa2ab30bb05297f30d9a33b30f29db960900971
hvm: handle PoD and grant pages in HVMOP_get_mem_type

During kexec in a ballooned PVonHVM guest the new kernel needs to check each pfn if its backed by a mfn to find ballooned pages. Currently all PoD and grant pages will appear as HVMMEM_mmio_dm, so the new kernel has to assume they are ballooned. This is wrong: PoD pages may turn into real RAM at runtime, grant pages are also RAM.

xen/arch/x86/hvm/hvm.c +4 -0
diff -r 3fa2ab30bb05 -r 8ebe7b80f029 xen/arch/x86/hvm/hvm.c
@@ -4086,6 +4086,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
                 a.mem_type =  HVMMEM_ram_rw;
+            else if ( p2m_is_magic(t) )
+                a.mem_type =  HVMMEM_ram_rw;
+            else if ( p2m_is_grant(t) )
+                a.mem_type =  HVMMEM_ram_rw;
             else
                 a.mem_type =  HVMMEM_mmio_dm;
             rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0;
#1 lore raw
Quoted 1 line · Olaf Hering

+ else if ( p2m_is_grant(t) )

I'm not sure if p2m_is_grant() can be true in a HVM guest.

Olaf

Applied
#2 lore raw
In reply to Olaf Hering
Quoted 9 lines · Olaf Hering

hvm: handle PoD and grant pages in HVMOP_get_mem_type

During kexec in a ballooned PVonHVM guest the new kernel needs to check each pfn if its backed by a mfn to find ballooned pages. Currently all PoD and grant pages will appear as HVMMEM_mmio_dm, so the new kernel has to assume they are ballooned. This is wrong: PoD pages may turn into real RAM at runtime, grant pages are also RAM.

Applied, thanks.

Tim.

#3 lore raw
Quoted 9 lines · Tim Deegan
Quoted 8 lines · Olaf Hering

hvm: handle PoD and grant pages in HVMOP_get_mem_type

During kexec in a ballooned PVonHVM guest the new kernel needs to check each pfn if its backed by a mfn to find ballooned pages. Currently all PoD and grant pages will appear as HVMMEM_mmio_dm, so the new kernel has to assume they are ballooned. This is wrong: PoD pages may turn into real RAM at runtime, grant pages are also RAM.

Quoted 3 lines
Quoted 1 line

Applied, thanks.

Would you backport this to 4.2 and 4.1?
Without this change the guest will get a wrong picture. Too bad I did not consider this initially in 23298:26413986e6e0.

Olaf

#4 lore raw
Quoted 11 lines · Olaf Hering
Quoted 9 lines · Tim Deegan
Quoted 8 lines · Olaf Hering

hvm: handle PoD and grant pages in HVMOP_get_mem_type

During kexec in a ballooned PVonHVM guest the new kernel needs to check each pfn if its backed by a mfn to find ballooned pages. Currently all PoD and grant pages will appear as HVMMEM_mmio_dm, so the new kernel has to assume they are ballooned. This is wrong: PoD pages may turn into real RAM at runtime, grant pages are also RAM.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks.

Would you backport this to 4.2 and 4.1?

Actually, I don't handle backports. IIRC Jan owns 4.2-testing and Keir 4.1-testing; I've CC'd them both.

Cheers,

Tim.

Quoted 9 lines

Without this change the guest will get a wrong picture. Too bad I did not consider this initially in 23298:26413986e6e0.

Olaf

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

#5 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Tim Deegan
Quoted 11 lines · Olaf Hering
Quoted 9 lines · Tim Deegan
Quoted 8 lines · Olaf Hering

hvm: handle PoD and grant pages in HVMOP_get_mem_type

During kexec in a ballooned PVonHVM guest the new kernel needs to check each pfn if its backed by a mfn to find ballooned pages. Currently all PoD and grant pages will appear as HVMMEM_mmio_dm, so the new kernel has to assume they are ballooned. This is wrong: PoD pages may turn into real RAM at runtime, grant pages are also RAM.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks.

Would you backport this to 4.2 and 4.1?

Actually, I don't handle backports. IIRC Jan owns 4.2-testing and Keir 4.1-testing; I've CC'd them both.

Actually, I handle both and will take care of it within the next few days (hopefully before the end of the week).

Jan