From: Bandan Das <bsd@redhat.com>
To: Jim Mattson <jmattson@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm list <kvm@vger.kernel.org>, "Huang2\,
Wei" <wei.huang2@amd.com>, "Moger\, Babu" <babu.moger@amd.com>
Subject: Re: [PATCH 0/3] AMD invpcid exception fix
Date: Fri, 12 Feb 2021 15:09:53 -0500 [thread overview]
Message-ID: <jpglfbtyrn2.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: <CALMp9eTC2YmG04WVVav-bgzq=6oZbu_5kd-6Dfog3SjkBJcHmg@mail.gmail.com> (Jim Mattson's message of "Fri, 12 Feb 2021 11:40:35 -0800")
Jim Mattson <jmattson@google.com> writes:
...
> On>> >> > I know I was the one to complain about the #GP, but...
>> >> >
>> >> > As a general rule, kvm cannot always guarantee a #UD for an
>> >> > instruction that is hidden from the guest. Consider, for example,
>> >> > popcnt, aesenc, vzeroall, movbe, addcx, clwb, ...
>> >> > I'm pretty sure that Paolo has brought this up in the past when I've
>> >> > made similar complaints.
>> >>
>> >> Ofcourse, even for vm instructions failures, the fixup table always jumps
>> >> to a ud2. I was just trying to address the concern because it is possible
>> >> to inject the correct exception via decoding the instruction.
>> >
>> > But kvm doesn't intercept #GP, except when enable_vmware_backdoor is
>> > set, does it? I don't think it's worth intercepting #GP just to get
>> > this #UD right.
>>
>> I prefer following the spec wherever we can.
>
> One has to wonder why userspace is even trying to execute a privileged
> instruction not enumerated by CPUID, unless it's just trying to expose
> virtualization inconsistencies. Perhaps this could be controlled by a
> new module parameter: "pedantic."
>
Yeah, fair point.
>> Otoh, if kvm can't guarantee injecting the right exception,
>> we should change kvm-unit-tests to just check for exceptions and not a specific
>> exception that adheres to the spec. This one's fine though, as long as we don't add
>> a CPL > 0 invpcid test, the other patch that was posted fixes it.
>
> KVM *can* guarantee the correct exception, but it requires
> intercepting all #GPs. That's probably not a big deal, but it is a
> non-zero cost. Is it the right tradeoff to make?
Not all, we intercept GPs only under a specific condition - just as we
do for vmware_backdoor and for the recent amd errata. IMO, I think it's the right
tradeoff to make to get guest exceptions right.
Bandan
next prev parent reply other threads:[~2021-02-12 20:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 21:22 [PATCH 0/3] AMD invpcid exception fix Bandan Das
2021-02-11 21:22 ` [PATCH 1/3] KVM: Add a stub for invpcid in the emulator table Bandan Das
2021-02-11 21:22 ` [PATCH 2/3] KVM: SVM: Handle invpcid during gp interception Bandan Das
2021-02-11 21:22 ` [PATCH 3/3] KVM: SVM: check if we need to track GP intercept for invpcid Bandan Das
2021-02-12 10:51 ` [PATCH 0/3] AMD invpcid exception fix Paolo Bonzini
2021-02-12 14:49 ` Bandan Das
2021-02-12 17:43 ` Jim Mattson
2021-02-12 17:55 ` Bandan Das
2021-02-12 18:20 ` Jim Mattson
2021-02-12 18:35 ` Bandan Das
2021-02-12 19:40 ` Jim Mattson
2021-02-12 20:09 ` Bandan Das [this message]
2021-02-12 20:56 ` Jim Mattson
2021-02-12 21:42 ` Paolo Bonzini
2021-02-12 21:49 ` Bandan Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jpglfbtyrn2.fsf@linux.bootlegged.copy \
--to=bsd@redhat.com \
--cc=babu.moger@amd.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=wei.huang2@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.