Skip to contentSkip to conversation

target-ppc: Add @cpu_dt_id into migration stream

PATCH In review Alexey Kardashevskiy 4 participants 12 messages Mar 27, 2014 – Apr 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc: Add @cpu_dt_id into migration stream

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

---
 target-ppc/cpu-qom.h | 2 +-
 target-ppc/machine.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
target-ppc/cpu-qom.h +1 -1
index 5eb56ea..59d0d4a 100644
@@ -91,7 +91,7 @@ struct PowerPCCPU {
     /*< public >*/
 
     CPUPPCState env;
-    int cpu_dt_id;
+    uint32_t cpu_dt_id;
 };
 
 static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
target-ppc/machine.c +3 -1
index 834297e..92529ca 100644
@@ -500,7 +500,7 @@ static const VMStateInfo vmstate_pvr = {
 
 const VMStateDescription vmstate_ppc_cpu = {
     .name = "cpu",
-    .version_id = 5,
+    .version_id = 6,
     .minimum_version_id = 5,
     .minimum_version_id_old = 4,
     .load_state_old = cpu_load_old,
@@ -537,6 +537,8 @@ const VMStateDescription vmstate_ppc_cpu = {
         VMSTATE_UINT64_EQUAL(env.insns_flags, PowerPCCPU),
         VMSTATE_UINT64_EQUAL(env.insns_flags2, PowerPCCPU),
         VMSTATE_UINT32_EQUAL(env.nb_BATs, PowerPCCPU),
+        VMSTATE_UINT32_EQUAL(cpu_dt_id, PowerPCCPU),
+
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection []) {
Signature · 1 line
1.8.4.rc4
#1 lore raw

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 6 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine because interrupt server properties (gserver?) in the device tree are different and no reconfiguration happens (no such mechanism as I know) the whole XICS behaves different.

The patch just prevents migration from succeeding which seems better.

Signature · 1 line
Alexey
#3 lore raw
Quoted 5 lines · Alexey Kardashevskiy
Quoted 4 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Quoted 7 lines
Quoted 2 lines

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

     don't do (1)

It would probably be nice if we did detect config mismatches, but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

thanks
-- PMM

#4 lore raw
Quoted 14 lines · Peter Maydell
Quoted 5 lines · Alexey Kardashevskiy
Quoted 4 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Quoted 7 lines
Quoted 2 lines

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Quoted 7 lines

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

     don't do (1)

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

This is lot bigger that the issue I am trying to solve by this patch... Still nack?

Signature · 1 line
Alexey
#5 lore raw
Quoted 21 lines · Alexey Kardashevskiy
Quoted 20 lines · Peter Maydell
Quoted 5 lines · Alexey Kardashevskiy
Quoted 4 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Quoted 7 lines
Quoted 2 lines

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

     don't do (1)
Quoted 8 lines
Quoted 1 line

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

Ok. So. Let's assume I want to implement migration of "-smp" parameters. What would be the correct way of doing this in terms of the current QOM principles? Thanks.

Quoted 3 lines

This is lot bigger that the issue I am trying to solve by this patch... Still nack?

Signature · 1 line
Alexey
#6 lore raw
Quoted 23 lines · Alexey Kardashevskiy
Quoted 22 lines · Alexey Kardashevskiy
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Alexey Kardashevskiy
Quoted 5 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Quoted 7 lines

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

      don't do (1)

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

Ok. So. Let's assume I want to implement migration of "-smp" parameters. What would be the correct way of doing this in terms of the current QOM principles? Thanks.

You don't. The migration protocol doesn't migrate configuration. If you want to start to transfer VM configuration (which I'd be all in for), do it properly and transfer _all_ configuration.

Alex

#7 lore raw
Quoted 29 lines · Alexander Graf
Quoted 27 lines · Alexey Kardashevskiy
Quoted 25 lines · Alexey Kardashevskiy
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Alexey Kardashevskiy
Quoted 5 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Quoted 7 lines

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

      don't do (1)

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

Quoted 7 lines
Quoted 3 lines

Ok. So. Let's assume I want to implement migration of "-smp" parameters. What would be the correct way of doing this in terms of the current QOM principles? Thanks.

You don't. The migration protocol doesn't migrate configuration. If you want to start to transfer VM configuration (which I'd be all in for), do it properly and transfer _all_ configuration.

Then what is the purpose of many, many VMSTATE_.*_EQUAL?

And I do not want to send configuration by the proposed patch, I want to make sure that the new guest is able to continue. Why exactly is this bad?

Signature · 1 line
Alexey
#8 lore raw
Quoted 34 lines · Alexey Kardashevskiy
Quoted 33 lines · Alexander Graf
Quoted 30 lines · Alexey Kardashevskiy
Quoted 18 lines · Alexey Kardashevskiy
Quoted 17 lines · Peter Maydell
Quoted 10 lines · Alexey Kardashevskiy
Quoted 5 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

     don't do (1)
Quoted 7 lines
Quoted 1 line

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

Ok. So. Let's assume I want to implement migration of "-smp" parameters. What would be the correct way of doing this in terms of the current QOM principles? Thanks.

Quoted 6 lines
Quoted 3 lines

You don't. The migration protocol doesn't migrate configuration. If you want to start to transfer VM configuration (which I'd be all in for), do it properly and transfer _all_ configuration.

Then what is the purpose of many, many VMSTATE_.*_EQUAL?

Probably legacy from old vmstate layouts.

Quoted 2 lines

And I do not want to send configuration by the proposed patch, I want to make sure that the new guest is able to continue. Why exactly is this bad?

It's not bad, but we should solve this properly, not one field at a time.

Alex

#9 lore raw
Quoted 37 lines · Alexander Graf
Quoted 34 lines · Alexey Kardashevskiy
Quoted 33 lines · Alexander Graf
Quoted 30 lines · Alexey Kardashevskiy
Quoted 18 lines · Alexey Kardashevskiy
Quoted 17 lines · Peter Maydell
Quoted 10 lines · Alexey Kardashevskiy
Quoted 5 lines · Andreas Färber

Am 27.03.2014 03:41, schrieb Alexey Kardashevskiy:

Quoted 2 lines

This should prevent the destination guest from misbehaving when the threads number is different in "-smp" command.

Sorry, I don't understand. When migrating, surely -smp needs to be the same on source and destination, so how can they differ?

The idea is that "-smp" does not migrate and if we run source and destination guests with different numbers in -smp, we end up with weird machine

Yes, so don't do that. As I understand it:
(1) if you don't run QEMU with the exact same command line and config at both ends then migration won't work
(2) we don't guarantee to detect and cleanly fail if you

     don't do (1)
Quoted 7 lines
Quoted 1 line

It would probably be nice if we did detect config mismatches,

Yep, we do not send the device tree (as libvirt does). Pure command line matching won't work.

Quoted 3 lines

but that seems to me like a problem we should be addressing more globally than just for one particular config item for one particular target...

Ok. So. Let's assume I want to implement migration of "-smp" parameters. What would be the correct way of doing this in terms of the current QOM principles? Thanks.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

You don't. The migration protocol doesn't migrate configuration. If you want to start to transfer VM configuration (which I'd be all in for), do it properly and transfer _all_ configuration.

Then what is the purpose of many, many VMSTATE_.*_EQUAL?

Probably legacy from old vmstate layouts.

So this should not be used from now on?

Quoted 4 lines
Quoted 2 lines

And I do not want to send configuration by the proposed patch, I want to make sure that the new guest is able to continue. Why exactly is this bad?

It's not bad, but we should solve this properly, not one field at a time.

Signature · 1 line
Alexey
#10 lore raw
In reply to Alexey Kardashevskiy
Quoted 1 line · Alexey Kardashevskiy

Then what is the purpose of many, many VMSTATE_.*_EQUAL?

Often it's backwards compatibility with a previous vmstate or save/load function set which incorrectly sent data it didn't need to.

Quoted 2 lines

And I do not want to send configuration by the proposed patch, I want to make sure that the new guest is able to continue. Why exactly is this bad?

It's not bad, but as several people have now pointed out to you, you're trying to fix a tiny tiny corner of the real, larger problem, in a way which isn't going to generalise to actually fixing the larger problem. So if we took your change then
(a) we still wouldn't be able to support detection of migration between two systems with mismatched configuration, so it doesn't really achieve anything
(b) if we ever did manage to fix that we'd have to remove your change (because that bit of config checking would now be handled via whatever generic mechanism we implemented), except we probably couldn't remove it since that would break migration version compatibility, so we'd end up with a wart we have to carry around forever

thanks
-- PMM

#11 lore raw
Quoted 10 lines · Peter Maydell
Quoted 1 line · Alexey Kardashevskiy

Then what is the purpose of many, many VMSTATE_.*_EQUAL?

Often it's backwards compatibility with a previous vmstate or save/load function set which incorrectly sent data it didn't need to.

Quoted 2 lines

And I do not want to send configuration by the proposed patch, I want to make sure that the new guest is able to continue. Why exactly is this bad?

Quoted 13 lines

It's not bad, but as several people have now pointed out to you, you're trying to fix a tiny tiny corner of the real, larger problem, in a way which isn't going to generalise to actually fixing the larger problem. So if we took your change then
(a) we still wouldn't be able to support detection of migration between two systems with mismatched configuration, so it doesn't really achieve anything
(b) if we ever did manage to fix that we'd have to remove your change (because that bit of config checking would now be handled via whatever generic mechanism we implemented), except we probably couldn't remove it since that would break migration version compatibility, so we'd end up with a wart we have to carry around forever

Ok, understood. Thanks.

ps. yeah, I do not often see the bigger picture, I know :(

Signature · 1 line
Alexey