Snapshots not bound to an architecture?
Hi,
While testing the savevm/loadvm functions, I noticed that it's possible to attempt to load a snapshot made for entirely different architecture. There are a lot of warnings, of course.
Could we prevent this somehow? Or is there a use case for this, for example loading a snapshot made on i386 to an x86_64 emulator?
Quoted 9 lines · Blue Swirl
Hi,
While testing the savevm/loadvm functions, I noticed that it's possible to attempt to load a snapshot made for entirely different architecture. There are a lot of warnings, of course.
Could we prevent this somehow? Or is there a use case for this, for example loading a snapshot made on i386 to an
x86_64emulator?
I think we should introduce a machine section for save/restore that included that information. It should also be versioned in such a way that it could be incremented whenever a new piece of hardware is added to the default machine type.
Regards,
Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Blue Swirl
Hi,
While testing the savevm/loadvm functions, I noticed that it's possible to attempt to load a snapshot made for entirely different architecture. There are a lot of warnings, of course.
Quoted 7 lines
Quoted 2 lines
Could we prevent this somehow? Or is there a use case for this, for example loading a snapshot made on i386 to an
x86_64emulator?I think we should introduce a machine section for save/restore that included that information. It should also be versioned in such a way that it could be incremented whenever a new piece of hardware is added to the default machine type.
Using a single version number to determine the "base" machine is IMHO a bad idea. The base peripherals should be identified (and mismatches detected) that same way as any other peripherals.
The simplest way to avoid loading the wrong type of machine is to give the cpus different names (e.g. cpu_i386/cpu_amd64) instead of just calling them "cpu".
Paul
Quoted 13 lines · Paul Brook
Quoted 11 lines · Anthony Liguori
Quoted 9 lines · Blue Swirl
Hi,
While testing the savevm/loadvm functions, I noticed that it's possible to attempt to load a snapshot made for entirely different architecture. There are a lot of warnings, of course.
Could we prevent this somehow? Or is there a use case for this, for example loading a snapshot made on i386 to an
x86_64emulator?
Quoted 7 lines
Quoted 5 lines
I think we should introduce a machine section for save/restore that included that information. It should also be versioned in such a way that it could be incremented whenever a new piece of hardware is added to the default machine type.
Using a single version number to determine the "base" machine is IMHO a bad idea.
I should have said, that I expected this to be an intermediate step.
Quoted 3 lines
The base peripherals should be identified (and mismatches detected)
that same way as any other peripherals.
Yes. This is particularly important in the context of hot plug because the bus/dev/fn of the plugged device may be different than if the device were just added directly.
Quoted 2 lines
The simplest way to avoid loading the wrong type of machine is to give the cpus different names (e.g. cpu_i386/cpu_amd64) instead of just calling them "cpu".
Yes, that works too, but it breaks backwards compatibility in a way that's hard to reconcile. Bumping the version of "cpu" and including a machine type identifier would also work and would be easier to do in a backwards compatible way.
Regards,
Anthony Liguori
Quoted 2 lines
Paul
Quoted 48 lines · Anthony Liguori
Quoted 16 lines · Paul Brook
Quoted 13 lines · Anthony Liguori
Quoted 10 lines · Blue Swirl
Hi,
While testing the savevm/loadvm functions, I noticed that it's possible to attempt to load a snapshot made for entirely different architecture. There are a lot of warnings, of course.
Could we prevent this somehow? Or is there a use case for this, for example loading a snapshot made on i386 to an
x86_64emulator?Quoted 8 lines
Quoted 6 lines
I think we should introduce a machine section for save/restore that included that information. It should also be versioned in such a way that it could be incremented whenever a new piece of hardware is added to the default machine type.
Using a single version number to determine the "base" machine is IMHO a
bad idea.
Quoted 1 line
I should have said, that I expected this to be an intermediate step.
Quoted 1 line
The base peripherals should be identified (and mismatches detected) that
same way as any other peripherals.
Quoted 2 lines
Yes. This is particularly important in the context of hot plug because the
bus/dev/fn of the plugged device may be different than if the device were just added directly.Quoted 1 line
The simplest way to avoid loading the wrong type of machine is to give the
cpus different names (e.g. cpu_i386/cpu_amd64) instead of just calling them "cpu".
Quoted 2 lines
Quoted 4 lines
Yes, that works too, but it breaks backwards compatibility in a way that's
hard to reconcile. Bumping the version of "cpu" and including a machine type identifier would also work and would be easier to do in a backwards compatible way.
There could be a compatibility check in the loadvm code just for "cpu" and "cpu_common". The check would be removed when no target wants to handle those versions anymore.