From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yDW1t2pY6zDqv8 for ; Sat, 14 Oct 2017 14:54:58 +1100 (AEDT) Received: by mail-pg0-x241.google.com with SMTP id m18so2654603pgd.13 for ; Fri, 13 Oct 2017 20:54:57 -0700 (PDT) Date: Sat, 14 Oct 2017 13:54:44 +1000 From: Nicholas Piggin To: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org Subject: Re: [PATCH v2 7/9] powerpc/64s: do not allocate lppaca if we are not virtualized Message-ID: <20171014135444.45a8405f@roar.ozlabs.ibm.com> In-Reply-To: <20171013224759.GA26120@fergus.ozlabs.ibm.com> References: <20170812113416.15978-1-npiggin@gmail.com> <20170813013346.14002-7-npiggin@gmail.com> <20171013224759.GA26120@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, 14 Oct 2017 09:47:59 +1100 Paul Mackerras wrote: > On Sun, Aug 13, 2017 at 11:33:44AM +1000, Nicholas Piggin wrote: > > The "lppaca" is a structure registered with the hypervisor. This > > is unnecessary when running on non-virtualised platforms. One field > > from the lppaca (pmcregs_in_use) is also used by the host, so move > > the host part out into the paca (lppaca field is still updated in > > guest mode). > > There is an error in the patch, see below... > > > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > > index c52184a8efdf..b838348e3a2b 100644 > > --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S > > +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > > @@ -99,8 +99,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) > > mtspr SPRN_SPRG_VDSO_WRITE,r3 > > > > /* Reload the host's PMU registers */ > > - ld r3, PACALPPACAPTR(r13) /* is the host using the PMU? */ > > - lbz r4, LPPACA_PMCINUSE(r3) > > + lbz r4, PACA_PMCINUSE(r13) /* is the host using the PMU? */ > > cmpwi r4, 0 > > beq 23f /* skip if not */ > > BEGIN_FTR_SECTION > > @@ -1671,7 +1670,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) > > mtspr SPRN_MMCRA, r7 > > isync > > beq 21f /* if no VPA, save PMU stuff anyway */ > > - lbz r7, LPPACA_PMCINUSE(r8) > > + lbz r7, PACA_PMCINUSE(r13) > > We really do need to check the guest's flag not the host's here, since > we're deciding whether to save the PMU state to the vcpu struct. Okay I'll fix that up. Thanks, Nick