[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 15/37] spapr: Fix stale HTAB during live migration (TCG
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 15/37] spapr: Fix stale HTAB during live migration (TCG) |
Date: |
Wed, 7 Jan 2015 16:20:26 +0100 |
From: Samuel Mendoza-Jonas <address@hidden>
If a TCG guest reboots during a running migration HTAB entries are not
marked dirty, and the destination boots with an invalid HTAB.
When a reboot occurs, explicitly mark the current HTAB dirty after
clearing it.
Signed-off-by: Samuel Mendoza-Jonas <address@hidden>
Reviewed-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc/spapr.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 765a44c..720aab5 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -819,9 +819,16 @@ static void emulate_spapr_hypercall(PowerPCCPU *cpu)
}
}
+#define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2))
+#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VALID)
+#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) &
HPTE64_V_HPTE_DIRTY)
+#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=
tswap64(~HPTE64_V_HPTE_DIRTY))
+#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=
tswap64(HPTE64_V_HPTE_DIRTY))
+
static void spapr_reset_htab(sPAPREnvironment *spapr)
{
long shift;
+ int index;
/* allocate hash page table. For now we always make this 16mb,
* later we should probably make it scale to the size of guest
@@ -846,6 +853,10 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)
/* And clear it */
memset(spapr->htab, 0, HTAB_SIZE(spapr));
+
+ for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) {
+ DIRTY_HPTE(HPTE(spapr->htab, index));
+ }
}
/* Update the RMA size if necessary */
@@ -1013,11 +1024,6 @@ static const VMStateDescription vmstate_spapr = {
},
};
-#define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2))
-#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VALID)
-#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) &
HPTE64_V_HPTE_DIRTY)
-#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=
tswap64(~HPTE64_V_HPTE_DIRTY))
-
static int htab_save_setup(QEMUFile *f, void *opaque)
{
sPAPREnvironment *spapr = opaque;
--
1.8.1.4
- [Qemu-ppc] [PULL 33/37] hw/machine: added machine_usb wrapper, (continued)
- [Qemu-ppc] [PULL 33/37] hw/machine: added machine_usb wrapper, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 07/37] target-ppc: Fix Floating Point Move Instructions That Set CR1, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 16/37] device-tree: fix memory leak, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 11/37] target-ppc: Eliminate set_fprf Argument From helper_compute_fprf, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 25/37] target-ppc: Introduce tbegin, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 20/37] target-ppc: Introduce Instruction Type for Transactional Memory, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 21/37] target-ppc: Introduce Feature Flag for Transactional Memory, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 18/37] PPC: Fix crash on spapr_tce_table_finalize(), Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 32/37] hw/ppc: modified the condition for usb controllers to be created for some ppc machines, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 28/37] target-ppc: Introduce Privileged TM Noops, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 15/37] spapr: Fix stale HTAB during live migration (TCG),
Alexander Graf <=
- [Qemu-ppc] [PULL 26/37] target-ppc: Introduce TM Noops, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 24/37] target-ppc: Introduce TEXASRU Bit Fields, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 34/37] hw/usb: simplified usb_enabled, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 36/37] hw/ppc/spapr: simplify usb controller creation logic, Alexander Graf, 2015/01/07
- [Qemu-ppc] [PULL 19/37] pseries: Update SLOF firmware image to 20141202, Alexander Graf, 2015/01/07
- Re: [Qemu-ppc] [PULL 00/37] ppc patch queue 2015-01-07, Peter Maydell, 2015/01/10