Re: [PATCH v2 2/3] powerpc/kvm/book3s_hv: Enable CPUs to run guest after waking up from fast-sleep
flat view
From: Preeti U Murthy <hidden>
Date: 2014-10-09 10:03:36
Also in:
lkml
On 10/07/2014 10:41 AM, Benjamin Herrenschmidt wrote:
On Wed, 2014-10-01 at 13:15 +0530, Shreyas B. Prabhu wrote:quoted
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 050f79a..c64f3cc0 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S@@ -100,25 +100,8 @@ system_reset_pSeries: SET_SCRATCH0(r13) #ifdef CONFIG_PPC_P7_NAP BEGIN_FTR_SECTION - /* Running native on arch 2.06 or later, check if we are - * waking up from nap. We only handle no state loss and - * supervisor state loss. We do -not- handle hypervisor - * state loss at this time. - */ - mfspr r13,SPRN_SRR1 - rlwinm. r13,r13,47-31,30,31 - beq 9f - /* waking up from powersave (nap) state */ - cmpwi cr1,r13,2 - /* Total loss of HV state is fatal, we could try to use the - * PIR to locate a PACA, then use an emergency stack etc... - * OPAL v3 based powernv platforms have new idle states - * which fall in this catagory. - */ - bgt cr1,8f GET_PACA(r13) - #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE li r0,KVM_HWTHREAD_IN_KERNEL stb r0,HSTATE_HWTHREAD_STATE(r13)@@ -131,13 +114,27 @@ BEGIN_FTR_SECTION 1: #endifSo you moved the state loss check to after the KVM check ? Was this reviewed by Paul ? Is that ok ? (Does this match what we have in PowerKVM ?). Is it possible that we end up calling kvm_start_guest after a HV state loss or do we know for sure that this won't happen for a reason or another ? If that's the case, then that reason needs to be clearly documented here in a comment.
This wont happen because the first thread in the core which comes out of an idle state which has a state loss will not enter into KVM since the HSTATE_HWTHREAD_STATE is not yet set. It continues on to restore the lost state. This thread sets the HSTATE_HWTHREAD_STATE and wakes up the remaining threads in the core. These sibling threads enter kvm directly not requiring to restore lost state since the first thread has restored it anyway. So we are safe. We will certainly add a comment there. Thanks Regards Preeti U Murthy