public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: VMX: Clean up IRQ/NMI handling
@ 2020-09-14 19:56 Sean Christopherson
  2020-09-14 19:56 ` [PATCH 2/2] KVM: VMX: Invoke NMI handler via indirect call instead of INTn Sean Christopherson
       [not found] ` <20200914195634.12881-2-sean.j.christopherson@intel.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Sean Christopherson @ 2020-09-14 19:56 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Josh Poimboeuf, Uros Bizjak,
	Andi Kleen

Minor (if there is such a thing for this code) cleanup of KVM's handling
of IRQ and NMI exits to move the invocation of the IRQ handler to a
standalone assembly routine, and to then consolidate the NMI handling to
use the same indirect call approach instead of using INTn.

The IRQ cleanup was suggested by Josh Poimboeuf in the context of a false
postive objtool warning[*].  I believe Josh intended to use UNWIND hints
instead of trickery to avoid objtool complaints.  I opted for trickery in
the form of a redundant, but explicit, restoration of RSP after the hidden
IRET.  AFAICT, there are no existing UNWIND hints that would let objtool
know that the stack is magically being restored, and adding a new hint to
save a single MOV <reg>, <reg> instruction seemed like overkill.

The NMI consolidation was loosely suggested by Andi Kleen.  Andi's actual
suggestion was to export and directly call the NMI handler, but that's a
more involved change (unless I'm misunderstanding the wants of the NMI
handler), whereas piggybacking the IRQ code is simple and seems like a
worthwhile intermediate step.

[*] https://lkml.kernel.org/r/20200908205947.arryy75c5cvldps7@treble

Sean Christopherson (2):
  KVM: VMX: Move IRQ invocation to assembly subroutine
  KVM: VMX: Invoke NMI handler via indirect call instead of INTn

 arch/x86/kvm/vmx/vmenter.S | 28 +++++++++++++++++
 arch/x86/kvm/vmx/vmx.c     | 61 +++++++++++---------------------------
 2 files changed, 45 insertions(+), 44 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-09-15  2:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-14 19:56 [PATCH 0/2] KVM: VMX: Clean up IRQ/NMI handling Sean Christopherson
2020-09-14 19:56 ` [PATCH 2/2] KVM: VMX: Invoke NMI handler via indirect call instead of INTn Sean Christopherson
     [not found] ` <20200914195634.12881-2-sean.j.christopherson@intel.com>
2020-09-14 20:37   ` [PATCH 1/2] KVM: VMX: Move IRQ invocation to assembly subroutine Uros Bizjak
2020-09-14 21:08     ` Sean Christopherson
2020-09-14 20:40   ` Josh Poimboeuf
     [not found]     ` <20200914210719.GB7084@sjchrist-ice>
2020-09-14 21:21       ` Uros Bizjak
2020-09-14 21:31         ` Uros Bizjak
2020-09-14 21:55           ` Sean Christopherson
2020-09-14 21:38       ` Josh Poimboeuf
2020-09-14 21:54         ` Sean Christopherson
2020-09-15  2:42       ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox