HVM save/restore issue
latest HVM save/restore break again:(
i use the memsize(the number in the xmexample.hvm) deduced from 'memory_static_min' to calculate some HVM PFNs when restore.
but now, 'memory_static_min' becomes 0 since r14425 and memsize is not recorded in the saved configuration(memory_static/dynamic_min/max...) any more.
do we have any reason to change the guest configuration so frequently? do you have any other suggestion to get the memsize from configuration?
thanks,
Signature · 2 lines
best rgds, edwin
Quoted 4 lines · Edwin
latest HVM save/restore break again:(
i use the memsize(the number in the xmexample.hvm) deduced from '
memory_static_min' to calculate some HVM PFNs when restore.
Out of interest: why would you do this? I glanced upon the code you are referring to in xc_hvm_restore.c yesterday, and it struck me as particularly gross. All three PFNs (ioreq, bufioreq, xenstore) could be saved in the store after building the domain and then saved/restored as part of the Python-saved data. The situation is easier than for a PV guest because PFNs do not change across save/restore.
The more assumptions about memory layout we bake into xc_hvm_{save,restore} now, the more we have to unbake when the HVM memory map becomes more dynamic (balloon driver support, in particular). Making these assumptions to some extent for now is okay, but we should avoid it where possible.
-- Keir
Quoted 6 lines
but now, '
memory_static_min' becomes 0 since r14425 and memsize is not recorded
in the savedconfiguration(memory_static/dynamic_min/max...)any more.do we have any reason to change the guest configuration so frequently? do you have any other suggestion to get the memsize from configuration?
Quoted 4 lines · Keir Fraser
Quoted 2 lines · Edwin
latest HVM save/restore break again:(
Quoted 8 lines
Quoted 2 lines
i use the memsize(the number in the xmexample.hvm) deduced from '
memory_static_min' to calculate some HVM PFNs when restore.Out of interest: why would you do this? I glanced upon the code you are referring to in
xc_hvm_restore.cyesterday, and it struck me as particularly gross. All three PFNs (ioreq, bufioreq, xenstore) could be saved in the store after building the domain and then saved/restored as part of the Python-saved data. The situation is easier than for a PV guest because PFNs
save all PFNs directly is good idea. i have this code to keep create and restore process similar.
i'd like directly save/restore all pfns in xc_hvm_{save,restore}. is this your want?
Quoted 9 lines
do not change across save/restore.
The more assumptions about memory layout we bake into xc_hvm_{save,restore} now, the more we have to unbake when the HVM memory map becomes more dynamic (balloon driver support, in particular). Making these assumptions to some extent for now is okay, but we should avoid it where possible.
-- Keir
Signature · 2 lines
best rgds, edwin
Quoted 5 lines · Edwin
save all PFNs directly is good idea. i have this code to keep create and restore
process similar.
i'd like directly save/restore all pfns in xc_hvm_{save,restore}. is this your want?
Actually yes, that would be fine now I think about it. Probably less code than plumbing it into Python.
-- Keir
Quoted 11 lines · Edwin
Quoted 5 lines
Out of interest: why would you do this? I glanced upon the code you are referring to in
xc_hvm_restore.cyesterday, and it struck me as particularly gross. All three PFNs (ioreq, bufioreq, xenstore) could be saved in the store after building the domain and then saved/restored as part of the Python-saved data. The situation is easier than for a PV guest because PFNssave all PFNs directly is good idea. i have this code to keep create and restore
process similar.
i'd like directly save/restore all pfns in xc_hvm_{save,restore}. is this your want?
Other thoughts on xc_hvm_restore as it is right now, and its use/abuse of 'store_mfn' parameter to pass in memory_static_min. I think this can be reasonably got rid of:
1. Do the setmaxmem hypercall in Python. There's no reason to be doing it
in xc_hvm_save().
2. Instead of preallocating the HVM memory, populate the physmap on demand
as we do now in xc_linux_restore. I'd do this by having an 'allocated bitmap', indexed by guest pfn, where a '1' means that page is already populated. Alternatively we might choose to avoid needing the bitmap by always doing populate_physmap() whenever we see a pfn, and have Xen guarantee that to be a no-op if RAM is already allocated at that pfn.
If we go the bitmap route I'd just make it big enough for a 4GB guest up front (only 128kB required) and then realloc() it to be twice as big whenever we go off the end of the current bitmap.
-- Keir
Quoted 7 lines · Keir Fraser
Quoted 4 lines · Edwin
latest HVM save/restore break again:(
i use the memsize(the number in the xmexample.hvm) deduced from '
memory_static_min' to calculate some HVM PFNs when restore.
Quoted 6 lines
Out of interest: why would you do this? I glanced upon the code you are referring to in
xc_hvm_restore.cyesterday, and it struck me as particularly gross. All three PFNs (ioreq, bufioreq, xenstore) could be saved in the store after building the domain and then saved/restored as part of the Python-saved data. The situation is easier than for a PV guest because PFNs do not change across save/restore.
It's probably safe just to remove the special handling for those PFNs -- I expanded it a bit when I was fixing up the case where ioreqs were in flight during the save, but that shouldn't be necessary (and they will have been set to the same magic values by the hvm domain builder on restore.)
Cheers,
Tim.
Signature · 2 lines
Tim Deegan <[email protected]>, XenSource UK Limited Registered office c/o EC2Y 5EB, UK; company number 05334508
Quoted 14 lines · Keir Fraser
Quoted 11 lines · Edwin
Quoted 5 lines
Out of interest: why would you do this? I glanced upon the code you are referring to in
xc_hvm_restore.cyesterday, and it struck me as particularly gross. All three PFNs (ioreq, bufioreq, xenstore) could be saved in the store after building the domain and then saved/restored as part of the Python-saved data. The situation is easier than for a PV guest because PFNssave all PFNs directly is good idea. i have this code to keep create and restore
process similar.
i'd like directly save/restore all pfns in xc_hvm_{save,restore}. is this your want?
Quoted 5 lines
Other thoughts on
xc_hvm_restoreas it is right now, and its use/abuse of 'store_mfn' parameter to pass inmemory_static_min. I think this can be reasonably got rid of:
1. Do the setmaxmem hypercall in Python. There's no reason to be doing it
inxc_hvm_save().
1.xc_linux_save also has setmaxmem
2.even do it in Python, we still need the memsize for setmaxmem
Quoted 6 lines
2. Instead of preallocating the HVM memory, populate the physmap on demand
as we do now inxc_linux_restore. I'd do this by having an 'allocated bitmap', indexed by guest pfn, where a '1' means that page is already populated. Alternatively we might choose to avoid needing the bitmap by always doingpopulate_physmap()whenever we see a pfn, and have Xen guarantee that to be a no-op if RAM is already allocated at that pfn.
current hvm restore just try to create the mem layout (same as when create)firstly then shape it gradually, so need memsize when creating guest.
seems you want another method: save the mem layout in xc_hvm_save and populate the same one when restore, right?
it's okay for me. BTW, i prefer bitmap way if we can make it efficient.
Quoted 7 lines
If we go the bitmap route I'd just make it big enough for a 4GB guest up front (only 128kB required) and then
realloc()it to be twice as big whenever we go off the end of the current bitmap.-- Keir
Signature · 2 lines
best rgds, edwin