KVM: Document KVM_NMI
Subsystems (2)
PATCH 1/1 KVM: Document KVM_NMI
--- Documentation/virtual/kvm/api.txt | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
Documentation/virtual/kvm/api.txt +25 -0
@@ -1450,6 +1450,31 @@ is supported; 2 if the processor requires all virtual machines to have an RMA, or 1 if the processor can use an RMA but doesn't require it, because it supports the Virtual RMA (VRMA) facility. +4.64 KVM_NMI + +Capability: KVM_CAP_USER_NMI +Architectures: x86 +Type: vcpu ioctl +Parameters: none +Returns: 0 on success, -1 on error + +Queues an NMI on the thread's vcpu. Note this is well defined only +when KVM_CREATE_IRQCHIP has not been called, since this is an interface +between the virtual cpu core and virtual local APIC. After KVM_CREATE_IRQCHIP +has been called, this interface is completely emulated within the kernel. + +To use this to emulate the LINT1 input with KVM_CREATE_IRQCHIP, use the +following algorithm: + + - pause the vpcu + - read the local APIC's state (KVM_GET_LAPIC) + - check whether changing LINT1 will queue an NMI (see the LVT entry for LINT1) + - if so, issue KVM_NMI + - resume the vcpu + +Some guests configure the LINT1 NMI input to cause a panic, aiding in +debugging. + 5. The kvm_run structure Application code obtains a pointer to the kvm_run structure by
Signature · 1 line
1.7.7.1
Quoted 20 lines · Avi Kivity
Signed-off-by Avi Kivity <[email protected]>--- Documentation/virtual/kvm/api.txt | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)Documentation/virtual/kvm/api.txt +7
-0@@ -1450,6 +1450,31 @@ is supported; 2 if the processor requires all virtual machines to have an RMA, or 1 if the processor can use an RMA but doesn't require it, because it supports the Virtual RMA (VRMA) facility. +4.64 KVM_NMI + +Capability: KVM_CAP_USER_NMI +Architectures: x86 +Type: vcpu ioctl +Parameters: none +Returns: 0 on success, -1 on error
Documentation/virtual/kvm/api.txt is supported; 2 if the processor requires all virtual machines to have · line 1469
Quoted 10 lines
Documentation/virtual/kvm/api.txt +10
-0+ +Queues an NMI on the thread's vcpu. Note this is well defined only +when KVM_CREATE_IRQCHIP has not been called, since this is an interface +between the virtual cpu core and virtual local APIC. After KVM_CREATE_IRQCHIP +has been called, this interface is completely emulated within the kernel. + +To use this to emulate the LINT1 input with KVM_CREATE_IRQCHIP, use the +following algorithm: + + - pause the vpcu
I don't see the QEMU patch doing a stop before grabbing LAPIC state. Or does it happen somewhere before?
Signature · 1 line
Sasha.
Quoted 2 lines · Sasha Levin
I don't see the QEMU patch doing a stop before grabbing LAPIC state. Or does it happen somewhere before?
It got dropped on the floor; it's now in next.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Sasha Levin
I don't see the QEMU patch doing a stop before grabbing LAPIC state. Or does it happen somewhere before?
It got dropped on the floor; it's now in next.
I was talking about that patch you merged. I don't see where the vcpu is being paused before getting the LAPIC state.
Signature · 1 line
Sasha.
Quoted 10 lines · Sasha Levin
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Sasha Levin
I don't see the QEMU patch doing a stop before grabbing LAPIC state. Or does it happen somewhere before?
It got dropped on the floor; it's now in next.
I was talking about that patch you merged. I don't see where the vcpu is being paused before getting the LAPIC state.
Oh, sorry. Well, once you exit from KVM_RUN, the vcpu is paused.
It's really implied by the fact that vcpu ioctls must be issued from the same thread.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 8 lines · Avi Kivity
Quoted 7 lines · Sasha Levin
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Sasha Levin
I don't see the QEMU patch doing a stop before grabbing LAPIC state. Or does it happen somewhere before?
It got dropped on the floor; it's now in next.
Quoted 8 lines
Quoted 3 lines
I was talking about that patch you merged. I don't see where the vcpu is being paused before getting the LAPIC state.
Oh, sorry. Well, once you exit from
KVM_RUN, the vcpu is paused.It's really implied by the fact that vcpu ioctls must be issued from the same thread.
Oh, I totally forgot about that (here, and in my 'kvm nmi' patch).
Thanks!
Signature · 1 line
Sasha.
Quoted 5 lines · Sasha Levin
Quoted 3 lines
It's really implied by the fact that vcpu ioctls must be issued from the same thread.
Oh, I totally forgot about that (here, and in my 'kvm nmi' patch).
It keeps biting people. We should make the kernel warn about it.
The reason it's important is because we might some day want to move to a syscall based API, rather than ioctl based. In this model a vcpu is bound to the thread that calls kvm_create_vcpu(2), and all vcpu syscalls derive the vcpu from the thread.
This model is more natural than the ioctl model, however it is a lot of work and doesn't solve any real life problems; it only creates a larger compatibility burden. But it's still the right thing.
Signature · 1 line
error compiling committee.c: too many arguments to function
Marcelo Tosatti
AppliedQuoted 4 lines · Avi Kivity
Signed-off-by Avi Kivity <[email protected]>--- Documentation/virtual/kvm/api.txt | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
Applied, thanks.