lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/3] KVM: X86: Save&restore the triple fault request
On Tue, Apr 05, 2022, Sean Christopherson wrote:
> On Fri, Mar 18, 2022, Chenyi Qiang wrote:
> > @@ -4903,7 +4906,8 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
> > | KVM_VCPUEVENT_VALID_SIPI_VECTOR
> > | KVM_VCPUEVENT_VALID_SHADOW
> > | KVM_VCPUEVENT_VALID_SMM
> > - | KVM_VCPUEVENT_VALID_PAYLOAD))
> > + | KVM_VCPUEVENT_VALID_PAYLOAD
> > + | KVM_VCPUEVENT_TRIPLE_FAULT))
> > return -EINVAL;
> >
> > if (events->flags & KVM_VCPUEVENT_VALID_PAYLOAD) {
> > @@ -4976,6 +4980,9 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
> > }
> > }
> >
> > + if (events->flags & KVM_VCPUEVENT_TRIPLE_FAULT)
> > + kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
> > +
> > kvm_make_request(KVM_REQ_EVENT, vcpu);
>
> Looks correct, but this really needs a selftest, at least for the SET path since
> the intent is to use that for the NOTIFY handling. Doesn't need to be super fancy,
> e.g. do port I/O from L2, inject a triple fault, and verify L1 sees the appropriate
> exit.

It finally dawned on me why all the other events use two "flags", i.e. an actual
flags entry of KVM_VCPUEVENT_VALID_* and then the value itself. Userspace needs
to be able to _clear_ the request, not just set the request. So this needs to
follow the existing pattern of adding a VALID flag and then yet another field to
specify whether or not a triple fault is pending.

\
 
 \ /
  Last update: 2022-04-07 17:28    [W:0.087 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site