From: Paolo Bonzini <pbonzini@redhat.com>
To: Leonardo Bras Soares Passos <leobras@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] x86/kvm/fpu: Mask guest fpstate->xfeatures with guest_supported_xcr0
Date: Mon, 7 Feb 2022 22:00:14 +0100 [thread overview]
Message-ID: <8bf8ba96-94a8-663a-ccbf-ffeab087c370@redhat.com> (raw)
In-Reply-To: <CAJ6HWG7DV-AeWyXxGwMMV61BejcCdpTc=U+4U6eY4gx4hfhP-g@mail.gmail.com>
On 2/7/22 21:24, Leonardo Bras Soares Passos wrote:
>> With this patch,
>> we have to reason about the effect of calling KVM_SET_CPUID2 twice calls
>> back to back. I think an "&=" would be wrong in that case.
>
> So, you suggest something like this ?
>
> vcpu->arch.guest_fpu.fpstate->xfeatures =
> fpu_user_cfg.default_features & vcpu->arch.guest_supported_xcr0;
>
Yes, but you need to change user_xfeatures instead of xfeatures.
KVM_GET_XSAVE and KVM_SET_XSAVE will take it into account automatically:
- KVM_GET_XSAVE: fpu_copy_guest_fpstate_to_uabi -> __copy_xstate_to_uabi_buf
- KVM_SET_XSAVE: fpu_copy_uabi_to_guest_fpstate ->
copy_uabi_from_kernel_to_xstate -> copy_uabi_to_xstate ->
validate_user_xstate_buffer
Paolo
next prev parent reply other threads:[~2022-02-07 21:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-05 8:16 [PATCH v1 0/2] x86/kvm/fpu: Fix guest migration bugs that can crash guest Leonardo Bras
2022-02-05 8:16 ` [PATCH v1 1/2] x86/kvm/fpu: Mask guest fpstate->xfeatures with guest_supported_xcr0 Leonardo Bras
2022-02-07 13:30 ` Paolo Bonzini
2022-02-07 20:24 ` Leonardo Bras Soares Passos
2022-02-07 21:00 ` Paolo Bonzini [this message]
2022-02-07 22:45 ` Leonardo Bras Soares Passos
2022-02-07 22:59 ` Paolo Bonzini
2022-02-08 2:14 ` Leonardo Bras Soares Passos
2022-02-05 8:16 ` [PATCH v1 2/2] x86/kvm/fpu: Limit setting guest fpu features based on guest_supported_xcr0 Leonardo Bras
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=8bf8ba96-94a8-663a-ccbf-ffeab087c370@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=leobras@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®