mbox series

[v2,0/2] Add missing trace points in emulator path

Message ID cover.1661930557.git.houwenlong.hwl@antgroup.com (mailing list archive)
Headers show
Series Add missing trace points in emulator path | expand

Message

Hou Wenlong Sept. 2, 2022, 2:46 a.m. UTC
Some existed trace points are missing in emulator path, e.g.,
RDMSR/WRMSR emulation and CR read/write emulation. However,
if add those trace points in emulator common interfaces in
arch/x86/kvm/x86.c, other instruction emulation may use those
interfaces too and cause too much trace records. But add those
trace points in em_* functions in arch/x86/kvm/emulate.c seems
to be ugly. Luckily, RDMSR/WRMSR emulation uses a sepreate
interface, so add trace points for RDMSR/WRMSR in emulator
path is acceptable like normal path.

Changed from v1:
- As Sean suggested, use X86EMUL_PROPAGATE_FAULT instead of
  X86EMUL_UNHANDLEABLE for error path.
- As Sean suggested, move "r < 0" handling into the set helper,
  and add "r < 0" check in the get helper.

v1: https://lore.kernel.org/kvm/cover.1658913543.git.houwenlong.hwl@antgroup.com

Hou Wenlong (2):
  KVM: x86: Return emulator error if RDMSR/WRMSR emulation failed
  KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path

 arch/x86/kvm/emulate.c | 20 ++++++++------------
 arch/x86/kvm/x86.c     | 32 ++++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 22 deletions(-)

--
2.31.1

Comments

Sean Christopherson Sept. 20, 2022, 10:12 p.m. UTC | #1
On Fri, Sep 02, 2022, Hou Wenlong wrote:
> Some existed trace points are missing in emulator path, e.g.,
> RDMSR/WRMSR emulation and CR read/write emulation. However,
> if add those trace points in emulator common interfaces in
> arch/x86/kvm/x86.c, other instruction emulation may use those
> interfaces too and cause too much trace records. But add those
> trace points in em_* functions in arch/x86/kvm/emulate.c seems
> to be ugly. Luckily, RDMSR/WRMSR emulation uses a sepreate
> interface, so add trace points for RDMSR/WRMSR in emulator
> path is acceptable like normal path.
> 
> Changed from v1:
> - As Sean suggested, use X86EMUL_PROPAGATE_FAULT instead of
>   X86EMUL_UNHANDLEABLE for error path.
> - As Sean suggested, move "r < 0" handling into the set helper,
>   and add "r < 0" check in the get helper.
> 
> v1: https://lore.kernel.org/kvm/cover.1658913543.git.houwenlong.hwl@antgroup.com
> 
> Hou Wenlong (2):
>   KVM: x86: Return emulator error if RDMSR/WRMSR emulation failed
>   KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path

Pushed to branch `for_paolo/6.1` at:

    https://github.com/sean-jc/linux.git

Unless you hear otherwise, it will make its way to kvm/queue "soon".