From: Alexander Graf Subject: Re: [PATCH 1/8] KVM: PPC: Book3S PR: Load up SPRG3 register with guest value on guest entry Date: Thu, 25 Jul 2013 15:40:19 +0200 Message-ID: <1A5EA98A-A597-480F-ADE7-3550BF7020FC@suse.de> References: <20130711114839.GB21353@iris.ozlabs.ibm.com> <20130711114943.GC21353@iris.ozlabs.ibm.com> Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Paul Mackerras Return-path: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 25.07.2013, at 15:38, Alexander Graf wrote: > > On 11.07.2013, at 13:49, Paul Mackerras wrote: > >> Unlike the other general-purpose SPRs, SPRG3 can be read by usermode >> code, and is used in recent kernels to store the CPU and NUMA node >> numbers so that they can be read by VDSO functions. Thus we need to >> load the guest's SPRG3 value into the real SPRG3 register when entering >> the guest, and restore the host's value when exiting the guest. We don't >> need to save the guest SPRG3 value when exiting the guest as usermode >> code can't modify SPRG3. > > This loads SPRG3 on every guest exit, which can happen a lot with instruction emulation. Since the kernel doesn't rely on the contents of SPRG3 we only have to care about it when not in KVM code, right? > > So could we move this to kvmppc_core_vcpu_load/put instead? but then again if all the shadow copy code is negligible performance wise, so is this probably. Applied to kvm-ppc-queue. Alex