Hi Nick, On Mon, Jun 12, 2017 at 09:58:29AM +1000, Nicholas Piggin wrote: > Idle code now always runs at the 0xc... effective address whether > in real or virtual mode. This means rfid can be ditched, along > with a lot of SRR manipulations. > > In the wakeup path, carry SRR1 around in r12. Use mtmsrd to change > MSR states as required. > > This also balances the return prediction for the idle call, by > doing blr rather than rfid to return to the idle caller. > > On POWER9, 2-process context switch on different cores, with snooze > disabled, increases performance by 2%. > --- > arch/powerpc/kernel/exceptions-64s.S | 1 + > arch/powerpc/kernel/idle_book3s.S | 57 > +++++++++++++++------------------ > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 8 ++++- > 3 files changed, 33 insertions(+), 33 deletions(-) > > diff --git a/arch/powerpc/kernel/exceptions-64s.S > b/arch/powerpc/kernel/exceptions-64s.S > index fec7c933d095..c3d0aef089a7 100644 > --- a/arch/powerpc/kernel/idle_book3s.S > +++ b/arch/powerpc/kernel/idle_book3s.S > @@ -148,12 +147,8 @@ pnv_powersave_common: > * the MMU context to the guest. > */ > LOAD_REG_IMMEDIATE(r7, MSR_IDLE) > - li r6, MSR_RI > - andc r6, r9, r6 > - mtmsrd r6, 1 /* clear RI before setting SRR0/1 */ > - mtspr SPRN_SRR0, r4 > - mtspr SPRN_SRR1, r7 > - rfid > + mtmsrd r7,0 > + bctr
So at this point we need to transition from virtual to real mode as the comment in pnv_enter_arch207_idle_mode expects us to. Which is being performed by mtmsrd here. Then we jump to the function via bctr. So, in this patch we are using two instructions to modify the MSR and the PC, while earlier the rfid would update these atomically. Does forgoing atomicity have any risk? I am asking this because historically we have modified IR/DR bits in the MSR via rfid mechanism. -- Thanks and Regards gautham.