All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Tian, Kevin" <kevin.tian@intel.com>, "Christopherson,,
	Sean" <seanjc@google.com>, Like Xu <like.xu.linux@gmail.com>
Cc: "Liu, Jing2" <jing2.liu@intel.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Joerg Roedel <joro@8bytes.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Zhong, Yang" <yang.zhong@intel.com>
Subject: Re: [PATCH] KVM: x86/cpuid: Exclude unpermitted xfeatures for vcpu->arch.guest_supported_xcr0
Date: Tue, 25 Jan 2022 09:27:47 +0100	[thread overview]
Message-ID: <f00d0e56-e5d3-4ac6-1519-fa843fb4d734@redhat.com> (raw)
In-Reply-To: <BN9PR11MB5276170712A9EF842B36ACE48C5F9@BN9PR11MB5276.namprd11.prod.outlook.com>

On 1/25/22 02:54, Tian, Kevin wrote:
>> The extra complication is that arch_prctl(ARCH_REQ_XCOMP_GUEST_PERM)
>> changes what host userspace can/can't do.  It would be easier if we
>> could just say that KVM_GET_SUPPORTED_CPUID returns "the most" that
>> userspace can do, but we already have the contract that userspace can
>> take KVM_GET_SUPPORTED_CPUID and pass it straight to KVM_SET_CPUID2.
>>
>> Therefore,  KVM_GET_SUPPORTED_CPUID must limit its returned values to
>> what has already been enabled.
>>
>> While reviewing the QEMU part of AMX support (this morning), I also
>> noticed that there is no equivalent for guest permissions of
>> ARCH_GET_XCOMP_SUPP.  This needs to know KVM's supported_xcr0, so it's
>> probably best realized as a new KVM_CHECK_EXTENSION rather than as an
>> arch_prctl.
>>
> Would that lead to a weird situation where although KVM says no support
> of guest permissions while the user can still request them via prctl()?

This is already the case for the current implementation of 
KVM_GET_SUPPORTED_CPUID.

Paolo

> I wonder whether it's cleaner to do it still via prctl() if we really want to
> enhance this part. But as you said then it needs a mechanism to know
> KVM's supported_xcr0 (and if KVM is not loaded then no guest permission
> support at all)...


  reply	other threads:[~2022-01-25  8:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  5:50 [PATCH] KVM: x86/cpuid: Exclude unpermitted xfeatures for vcpu->arch.guest_supported_xcr0 Like Xu
2022-01-24  7:06 ` Tian, Kevin
2022-01-24  7:17   ` Like Xu
2022-01-24 16:23     ` Sean Christopherson
2022-01-24 16:29       ` Paolo Bonzini
2022-01-25  1:54         ` Tian, Kevin
2022-01-25  8:27           ` Paolo Bonzini [this message]
2022-01-26  1:23             ` Tian, Kevin

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=f00d0e56-e5d3-4ac6-1519-fa843fb4d734@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jing2.liu@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=yang.zhong@intel.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.