powerpc64/ftrace: Disable ftrace during kvm entry/exit
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thu, 19 Apr 2018 07:04:05 +0000 (12:34 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 May 2018 12:32:27 +0000 (22:32 +1000)
commita4bc64d305af40446d0ac792bb8a9b2cd20af3d3
tree34306f10e9a45a9bee4f4d70b8d74e3b82065051
parent424ef0160f439feb2a1a6e796a281e2bfa7b6997
powerpc64/ftrace: Disable ftrace during kvm entry/exit

During guest entry/exit, we switch over to/from the guest MMU context
and we cannot take exceptions in the hypervisor code.

Since ftrace may be enabled and since it can result in us taking a trap,
disable ftrace by setting paca->ftrace_enabled to zero. There are two
paths through which we enter/exit a guest:
1. If we are the vcore runner, then we enter the guest via
__kvmppc_vcore_entry() and we disable ftrace around this. This is always
the case for Power9, and for the primary thread on Power8.
2. If we are a secondary thread in Power8, then we would be in nap due
to SMT being disabled. We are woken up by an IPI to enter the guest. In
this scenario, we enter the guest through kvm_start_guest(). We disable
ftrace at this point. In this scenario, ftrace would only get re-enabled
on the secondary thread when SMT is re-enabled (via start_secondary()).

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S