diff options
author | Paul Mackerras <paulus@samba.org> | 2015-03-27 23:21:07 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2015-04-21 09:21:32 -0400 |
commit | ccc07772c99befeda7a7a4b1d05a6f3b762518c2 (patch) | |
tree | c6f47a2039a097c82a0917b211c4e4d325a9ea64 /arch/powerpc | |
parent | 5d5b99cd6818bdbea287d23ef055bba1a8a9e648 (diff) |
KVM: PPC: Book3S HV: Don't wake thread with no vcpu on guest IPI
When running a multi-threaded guest and vcpu 0 in a virtual core
is not running in the guest (i.e. it is busy elsewhere in the host),
thread 0 of the physical core will switch the MMU to the guest and
then go to nap mode in the code at kvm_do_nap. If the guest sends
an IPI to thread 0 using the msgsndp instruction, that will wake
up thread 0 and cause all the threads in the guest to exit to the
host unnecessarily. To avoid the unnecessary exit, this arranges
for the PECEDP bit to be cleared in this situation. When napping
due to a H_CEDE from the guest, we still set PECEDP so that the
thread will wake up on an IPI sent using msgsndp.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 6716db3f1a2b..12d7e4c8dc54 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -191,6 +191,7 @@ kvmppc_primary_no_guest: | |||
191 | li r3, NAPPING_NOVCPU | 191 | li r3, NAPPING_NOVCPU |
192 | stb r3, HSTATE_NAPPING(r13) | 192 | stb r3, HSTATE_NAPPING(r13) |
193 | 193 | ||
194 | li r3, 0 /* Don't wake on privileged (OS) doorbell */ | ||
194 | b kvm_do_nap | 195 | b kvm_do_nap |
195 | 196 | ||
196 | kvm_novcpu_wakeup: | 197 | kvm_novcpu_wakeup: |
@@ -2129,10 +2130,13 @@ _GLOBAL(kvmppc_h_cede) /* r3 = vcpu pointer, r11 = msr, r13 = paca */ | |||
2129 | bl kvmhv_accumulate_time | 2130 | bl kvmhv_accumulate_time |
2130 | #endif | 2131 | #endif |
2131 | 2132 | ||
2133 | lis r3, LPCR_PECEDP@h /* Do wake on privileged doorbell */ | ||
2134 | |||
2132 | /* | 2135 | /* |
2133 | * Take a nap until a decrementer or external or doobell interrupt | 2136 | * Take a nap until a decrementer or external or doobell interrupt |
2134 | * occurs, with PECE1, PECE0 and PECEDP set in LPCR. Also clear the | 2137 | * occurs, with PECE1 and PECE0 set in LPCR. |
2135 | * runlatch bit before napping. | 2138 | * On POWER8, if we are ceding, also set PECEDP. |
2139 | * Also clear the runlatch bit before napping. | ||
2136 | */ | 2140 | */ |
2137 | kvm_do_nap: | 2141 | kvm_do_nap: |
2138 | mfspr r0, SPRN_CTRLF | 2142 | mfspr r0, SPRN_CTRLF |
@@ -2144,7 +2148,7 @@ kvm_do_nap: | |||
2144 | mfspr r5,SPRN_LPCR | 2148 | mfspr r5,SPRN_LPCR |
2145 | ori r5,r5,LPCR_PECE0 | LPCR_PECE1 | 2149 | ori r5,r5,LPCR_PECE0 | LPCR_PECE1 |
2146 | BEGIN_FTR_SECTION | 2150 | BEGIN_FTR_SECTION |
2147 | oris r5,r5,LPCR_PECEDP@h | 2151 | rlwimi r5, r3, 0, LPCR_PECEDP |
2148 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 2152 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
2149 | mtspr SPRN_LPCR,r5 | 2153 | mtspr SPRN_LPCR,r5 |
2150 | isync | 2154 | isync |