Skip to contentSkip to conversation

kvmapic: fixing loading vmstate

RFC PATCH Pavel Dovgalyuk 2 participants 4 messages Jul 31, 2014 – Aug 25, 2014

lore
Share & tools
lore
#0 lore raw

Pre load is necessary, because we switched off resetting VM while loading in the replay mode. Calling reset handlers generates irqs, that make loading process non-deterministic.

Sent from mobile device

-------- Исходное сообщение --------
От: Paolo Bonzini <[email protected]>
Дата:31.07.2014 17:01 (GMT+04:00)
Кому: Pavel Dovgalyuk <[email protected]>,[email protected]
Копия: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] Тема: Re: [RFC PATCH v3 07/49] kvmapic: fixing loading vmstate

Il 31/07/2014 14:54, Pavel Dovgalyuk ha scritto:

Review

Quoted 7 lines
(quoted diff) +7 -0
+static int apic_pre_load(void *opaque)
+{
+    APICCommonState *s = APIC_COMMON(opaque);
+    s->sipi_vector = 0;
+    s->wait_for_sipi = 0;
+    s->vapic_paddr = 0;
+    return 0;

Is this necessary?  Or does reset already do that?

Quoted 42 lines
(quoted diff) +2 -0
+}
+

  static void apic_dispatch_pre_save(void *opaque) {
      APICCommonState *s = APIC_COMMON(opaque);

(quoted diff) +0 -0
@@ -345,12 +354,46 @@ static int apic_dispatch_post_load(void *opaque, int version_id)
       return 0;
   }

(quoted diff) +33 -0
+static bool apic_common_sipi_needed(void *opaque)
+{
+    APICCommonState *s = APIC_COMMON(opaque);
+    return s->wait_for_sipi != 0;
+}
+
+static const VMStateDescription vmstate_apic_common_sipi = {
+    .name = "apic_sipi",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_INT32(sipi_vector, APICCommonState),
+        VMSTATE_INT32(wait_for_sipi, APICCommonState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static bool apic_common_vapic_paddr_needed(void *opaque)
+{
+    APICCommonState *s = APIC_COMMON(opaque);
+    return s->vapic_paddr != 0;
+}
+
+static const VMStateDescription vmstate_apic_common_vapic_paddr = {
+    .name = "apic_vapic_paddr",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT64(vapic_paddr, APICCommonState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
Quoted 4 lines

  static const VMStateDescription vmstate_apic_common = { .name = "apic",
-    .version_id = 3,
+    .version_id = 4,

You know what I'm going to say. :)

Paolo

#1 lore raw

Il 31/07/2014 17:21, Pavel Dovgalyuk ha scritto:

Quoted 2 lines

Pre load is necessary, because we switched off resetting VM while loading in the replay mode.

Then you should not add it now, but rather when you add replay. Treat this part of the series as merely fixing migration bugs. In fact, I suggest that you start by progressively refining these patches. You can also post the other patches that I mentioned were good to go in my review of v1. Then pass to the next steps (in the meanwhile, Fred's icount reverse-exec patches might get merged too).

Related to this: do _not_ assume that people review the entire series. It's normal to notice that the initial part should stand on its own legs, and then review it as if the remaining patches do not exist! It's up to _you_, in the commit messages, to annotate things that you do now for the sake of future patches.

Quoted 2 lines

Calling reset handlers generates irqs, that
make loading process non-deterministic.

What irqs are these, and why do they make the loading process non-deterministic? Is it important that they not be generated, as long as the final state is deterministic?

Have you audited all subsections and add a pre-load function there? Where do you do this in the series? These non-mechanical, sweeping changes suggest to me that you find a way to keep resets during load. Compare for example the patches at

http://lists.gnu.org/archive/html/qemu-devel/2013-09/msg00477.html

with the series at

http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg02652.html
http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03934.html

The former adds 230 lines of code and adds code to 40-odd files.

The latter includes a preparatory part that is complicated but only touches 4 files, handling of the odd cases that touches about 10 files, and the final sweeping change that is mechanical and hardly requires review. Overall it adds ~20 lines of code, and adds actual functionality in addition to fixing the same bug as the first!

Paolo

#2 lore raw
Quoted 11 lines

From: Paolo Bonzini [mailto:[email protected]]
Il 31/07/2014 17:21, Pavel Dovgalyuk ha scritto:

Quoted 2 lines

Pre load is necessary, because we switched off resetting VM while loading in the replay mode.

Then you should not add it now, but rather when you add replay. Treat this part of the series as merely fixing migration bugs. In fact, I suggest that you start by progressively refining these patches. You can also post the other patches that I mentioned were good to go in my review of v1. Then pass to the next steps (in the meanwhile, Fred's icount reverse-exec patches might get merged too).

Do you mean, that I should separate the migration patches from
the replay ones and submit them in another series?

Pavel Dovgalyuk

#3 lore raw

Il 25/08/2014 13:40, Pavel Dovgaluk ha scritto:

Quoted 2 lines

Do you mean, that I should separate the migration patches from
the replay ones and submit them in another series?

Yes, that will help getting the less controversial pieces in first.

Paolo