]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/powernv: Don't reprogram SLW image on every KVM guest entry/exit
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 12 Feb 2019 00:58:29 +0000 (11:58 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Feb 2019 13:10:15 +0000 (00:10 +1100)
commit5ee8bb5e9beaacb02f62c6c2bcf1c8848ba3029e
tree52adebee535e837cf86b0a0cef190f4ed365e5cc
parentb5bd282d23688d19a4294b84b808a606e6424d54
powerpc/powernv: Don't reprogram SLW image on every KVM guest entry/exit

Commit e1d422714856 ("powerpc/powernv: Clear PECE1 in LPCR via stop-api
only on Hotplug", 2017-07-21) added two calls to opal_slw_set_reg()
inside pnv_cpu_offline(), with the aim of changing the LPCR value in
the SLW image to disable wakeups from the decrementer while a CPU is
offline.  However, pnv_cpu_offline() gets called each time a secondary
CPU thread is woken up to participate in running a KVM guest, that is,
not just when a CPU is offlined.

Since opal_slw_set_reg() is a very slow operation (with observed
execution times around 20 milliseconds), this means that an offline
secondary CPU can often be busy doing the opal_slw_set_reg() call
when the primary CPU wants to grab all the secondary threads so that
it can run a KVM guest.  This leads to messages like "KVM: couldn't
grab CPU n" being printed and guest execution failing.

There is no need to reprogram the SLW image on every KVM guest entry
and exit.  So that we do it only when a CPU is really transitioning
between online and offline, this moves the calls to
pnv_program_cpu_hotplug_lpcr() into pnv_smp_cpu_kill_self().

Fixes: e1d422714856 ("powerpc/powernv: Clear PECE1 in LPCR via stop-api only on Hotplug")
Cc: stable@vger.kernel.org # v4.14+
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/powernv.h
arch/powerpc/platforms/powernv/idle.c
arch/powerpc/platforms/powernv/smp.c