From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: [PATCH 0/9] KVM: PPC: Reduce races, fix code Date: Fri, 8 Jan 2010 02:58:00 +0100 Message-ID: <1262915889-11526-1-git-send-email-agraf@suse.de> Cc: kvm-ppc , Benjamin Herrenschmidt To: kvm@vger.kernel.org Return-path: Received: from cantor.suse.de ([195.135.220.2]:42394 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752952Ab0AHB6L (ORCPT ); Thu, 7 Jan 2010 20:58:11 -0500 Sender: kvm-owner@vger.kernel.org List-ID: We've been a bit lax with how we use fields in the PACA so far. Most of the time we just overwrote random fields that another interrupt handler would have used as well. That is racy. We also jumped over to real mode from IR=1 using RFI. Unfortunately, we need 3 operations to do that transitions which need to be fully atomic, as any interrupt coming in between those instructions can possibly break us. That is racy too. So let's get rid of all the racy code and clean up some pieces along the way. Alexander Graf (9): KVM: PPC: Use accessor functions for GPR access KVM: PPC: Add helpers for CR, XER KVM: PPC: Use PACA backed shadow vcpu KVM: PPC: Implement 'skip instruction' mode KVM: PPC: Get rid of unnecessary RFI KVM: PPC: Call SLB patching code in interrupt safe manner KVM: PPC: Emulate trap SRR1 flags properly KVM: PPC: Fix HID5 setting code KVM: PPC: Pass program interrupt flags to the guest arch/powerpc/include/asm/kvm_asm.h | 6 + arch/powerpc/include/asm/kvm_book3s.h | 4 + arch/powerpc/include/asm/kvm_book3s_64_asm.h | 18 ++ arch/powerpc/include/asm/kvm_host.h | 6 +- arch/powerpc/include/asm/kvm_ppc.h | 76 ++++++++- arch/powerpc/include/asm/paca.h | 5 + arch/powerpc/include/asm/reg.h | 4 + arch/powerpc/kernel/asm-offsets.c | 34 ++++- arch/powerpc/kvm/44x_emulate.c | 25 ++-- arch/powerpc/kvm/44x_tlb.c | 20 ++- arch/powerpc/kvm/book3s.c | 35 +++-- arch/powerpc/kvm/book3s_64_emulate.c | 77 +++++---- arch/powerpc/kvm/book3s_64_exports.c | 1 + arch/powerpc/kvm/book3s_64_interrupts.S | 242 +++++++++----------------- arch/powerpc/kvm/book3s_64_rmhandlers.S | 85 +++++++--- arch/powerpc/kvm/book3s_64_slb.S | 158 +++++++++++------- arch/powerpc/kvm/booke.c | 27 ++-- arch/powerpc/kvm/booke_emulate.c | 107 ++++++------ arch/powerpc/kvm/e500_emulate.c | 95 ++++++----- arch/powerpc/kvm/e500_tlb.c | 4 +- arch/powerpc/kvm/emulate.c | 112 +++++++------ arch/powerpc/kvm/powerpc.c | 21 ++- 22 files changed, 672 insertions(+), 490 deletions(-) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Fri, 08 Jan 2010 01:58:00 +0000 Subject: [PATCH 0/9] KVM: PPC: Reduce races, fix code Message-Id: <1262915889-11526-1-git-send-email-agraf@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Cc: kvm-ppc , Benjamin Herrenschmidt We've been a bit lax with how we use fields in the PACA so far. Most of the time we just overwrote random fields that another interrupt handler would have used as well. That is racy. We also jumped over to real mode from IR=1 using RFI. Unfortunately, we need 3 operations to do that transitions which need to be fully atomic, as any interrupt coming in between those instructions can possibly break us. That is racy too. So let's get rid of all the racy code and clean up some pieces along the way. Alexander Graf (9): KVM: PPC: Use accessor functions for GPR access KVM: PPC: Add helpers for CR, XER KVM: PPC: Use PACA backed shadow vcpu KVM: PPC: Implement 'skip instruction' mode KVM: PPC: Get rid of unnecessary RFI KVM: PPC: Call SLB patching code in interrupt safe manner KVM: PPC: Emulate trap SRR1 flags properly KVM: PPC: Fix HID5 setting code KVM: PPC: Pass program interrupt flags to the guest arch/powerpc/include/asm/kvm_asm.h | 6 + arch/powerpc/include/asm/kvm_book3s.h | 4 + arch/powerpc/include/asm/kvm_book3s_64_asm.h | 18 ++ arch/powerpc/include/asm/kvm_host.h | 6 +- arch/powerpc/include/asm/kvm_ppc.h | 76 ++++++++- arch/powerpc/include/asm/paca.h | 5 + arch/powerpc/include/asm/reg.h | 4 + arch/powerpc/kernel/asm-offsets.c | 34 ++++- arch/powerpc/kvm/44x_emulate.c | 25 ++-- arch/powerpc/kvm/44x_tlb.c | 20 ++- arch/powerpc/kvm/book3s.c | 35 +++-- arch/powerpc/kvm/book3s_64_emulate.c | 77 +++++---- arch/powerpc/kvm/book3s_64_exports.c | 1 + arch/powerpc/kvm/book3s_64_interrupts.S | 242 +++++++++----------------- arch/powerpc/kvm/book3s_64_rmhandlers.S | 85 +++++++--- arch/powerpc/kvm/book3s_64_slb.S | 158 +++++++++++------- arch/powerpc/kvm/booke.c | 27 ++-- arch/powerpc/kvm/booke_emulate.c | 107 ++++++------ arch/powerpc/kvm/e500_emulate.c | 95 ++++++----- arch/powerpc/kvm/e500_tlb.c | 4 +- arch/powerpc/kvm/emulate.c | 112 +++++++------ arch/powerpc/kvm/powerpc.c | 21 ++- 22 files changed, 672 insertions(+), 490 deletions(-)