From: Nicholas Piggin Date: Thu, 16 May 2019 04:43:58 +0000 Subject: Re: [PATCH v10 2/2] powerpc/64s: KVM update for reimplement book3s idle code in C Message-Id: <1557981765.4aikls5u00.astroid@bobo.none> List-Id: References: <20190428114515.32683-1-npiggin@gmail.com> <20190428114515.32683-3-npiggin@gmail.com> <20190513064207.GA11679@blackberry> In-Reply-To: <20190513064207.GA11679@blackberry> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Paul Mackerras Cc: "Gautham R . Shenoy" , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org Paul Mackerras's on May 13, 2019 4:42 pm: > On Sun, Apr 28, 2019 at 09:45:15PM +1000, Nicholas Piggin wrote: >> This is the KVM update to the new idle code. A few improvements: >> >> - Idle sleepers now always return to caller rather than branch out >> to KVM first. >> - This allows optimisations like very fast return to caller when no >> state has been lost. >> - KVM no longer requires nap_state_lost because it controls NVGPR >> save/restore itself on the way in and out. >> - The heavy idle wakeup KVM request check can be moved out of the >> normal host idle code and into the not-performance-critical offline >> code. >> - KVM nap code now returns from where it is called, which makes the >> flow a bit easier to follow. > > One question below... > >> diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S >> index 58d0f1ba845d..f66191d8f841 100644 >> --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S >> +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S > ... >> @@ -2656,6 +2662,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) >> >> lis r3, LPCR_PECEDP@h /* Do wake on privileged doorbell */ >> >> + /* Go back to host stack */ >> + ld r1, HSTATE_HOST_R1(r13) > > At this point we are in kvmppc_h_cede, which we branched to from > hcall_try_real_mode, which came from the guest exit path, where we > have already loaded r1 from HSTATE_HOST_R1(r13). So if there is a > path to get here with r1 not already set to HSTATE_HOST_R1(r13), then > I missed it - please point it out to me. Otherwise this statement > seems superfluous. I'm not sure why I put that there. I think you're right it could be removed. Thanks, Nick