Re: [RFC][PATCH] qemu-kvm: x86: Refactor persistent CPU state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Kiszka wrote:
This patch reworks the KVM-related layout and encoding of the CPU state
to be saved to disk or migrated. The goal is to define a format, version
9, that is also acceptable for upstream and can later be merged into
QEMU. Besides unconditionally writing KVM states, this format compresses
interrupt_bitmap into a single number as there can be no more than one
pending IRQ at a time.

- if (kvm_enabled()) {
-        for (i = 0; i < sizeof(env->interrupt_bitmap)/8 ; i++) {
-            qemu_put_be64s(f, &env->interrupt_bitmap[i]);
+    /* KVM-related states */
+
+    /* There can only be one pending IRQ set in the bitmap at a time, so try
+       to find it and save its number instead (-1 for none). */
+    pending_irq = -1;
+    for (i = 0; i < sizeof(env->interrupt_bitmap)/2; i++) {
+        bit = ffs(((uint16_t *)env->interrupt_bitmap)[i]);
+        if (bit) {
+            pending_irq = i * 16 + bit;

bit - 1

+            break;
         }

Why are you using uint64_t? It would be more natural to use ffsll and the natural type of the bitmap vector.

+        } else {
+            kvm_load_registers(env);
+            kvm_load_tsc(env);
             kvm_load_mpstate(env);
         }
     }

Don't you need to load the pending interrupt?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux