Skip to contentSkip to conversation

spapr: Fix stale HTAB during live migration

PATCH Superseded Samuel Mendoza-Jonas 1 participant 1 message Aug 18, 2014

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spapr: Fix stale HTAB during live migration

If a guest reboots during a running migration, changes to the hash page table are not necessarily updated on the destination. Opening a new file descriptor to the HTAB forces the migration handler to resend the entire table.

---
Changes in v2: Forgot check on kvmppc_get_htab_fd return value

 hw/ppc/spapr.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/ppc/spapr.c +10 -0
index 3a6d26d..94670db 100644
@@ -997,6 +997,16 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)
         /* Kernel handles htab, we don't need to allocate one */
         spapr->htab_shift = shift;
         kvmppc_kern_htab = true;
+
+        /* Make sure readers are aware of the reset */
+        if (spapr->htab_fd > 0) {
+            close(spapr->htab_fd);
+            spapr->htab_fd = kvmppc_get_htab_fd(false);
+            if (spapr->htab_fd < 0) {
+                fprintf(stderr, "Unable to open fd for reading hash table from KVM: %s\n",
+                        strerror(errno));
+            }
+        }
     } else {
         if (!spapr->htab) {
             /* Allocate an htab if we don't yet have one */
Signature · 1 line
1.9.3