From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b685L-0006w9-2d for qemu-devel@nongnu.org; Thu, 26 May 2016 23:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b685C-0003MO-Hs for qemu-devel@nongnu.org; Thu, 26 May 2016 23:05:13 -0400 From: David Gibson Date: Fri, 27 May 2016 13:04:46 +1000 Message-Id: <1464318298-2456-2-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1464318298-2456-1-git-send-email-david@gibson.dropbear.id.au> References: <1464318298-2456-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 01/13] target-ppc: Correct KVM synchronization for ppc_hash64_set_external_hpt() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson ppc_hash64_set_external_hpt() was added in e5c0d3c "target-ppc: Add helpers for updating a CPU's SDR1 and external HPT". This helper contains a cpu_synchronize_state() since it may need to push state back to KVM afterwards. This turns out to break things when it is used in the reset path, which is the only current user. It appears that kvm_vcpu_dirty is not being set early in the reset path, so the cpu_synchronize_state() is clobbering state set up by the early part of the cpu reset path with stale state from KVM. This may require some changes to the generic cpu reset path to fix properly, but as a short term fix we can just remove the cpu_synchronize_state() from ppc_hash64_set_external_hpt(), and require any non-reset path callers to do that manually. Reported-by: Laurent Vivier Signed-off-by: David Gibson --- target-ppc/mmu-hash64.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c index 04e6932..17e2480 100644 --- a/target-ppc/mmu-hash64.c +++ b/target-ppc/mmu-hash64.c @@ -284,8 +284,6 @@ void ppc_hash64_set_external_hpt(PowerPCCPU *cpu, void *hpt, int shift, CPUPPCState *env = &cpu->env; Error *local_err = NULL; - cpu_synchronize_state(CPU(cpu)); - if (hpt) { env->external_htab = hpt; } else { -- 2.5.5