[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba78d142-6a97-99dd-9d00-465f7d6aa712@redhat.com>
Date: Tue, 14 Dec 2021 07:18:57 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: "Wang, Wei W" <wei.w.wang@...el.com>,
"Zhong, Yang" <yang.zhong@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
Cc: "seanjc@...gle.com" <seanjc@...gle.com>,
"Nakajima, Jun" <jun.nakajima@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
"jing2.liu@...ux.intel.com" <jing2.liu@...ux.intel.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Zeng, Guang" <guang.zeng@...el.com>
Subject: Re: [PATCH 16/19] kvm: x86: Introduce KVM_{G|S}ET_XSAVE2 ioctl
On 12/14/21 07:06, Wang, Wei W wrote:
> On Monday, December 13, 2021 5:24 PM, Paolo Bonzini wrote:
>> There is no need for struct kvm_xsave2, because there is no need for a "size"
>> argument.
>>
>> - KVM_GET_XSAVE2 *is* needed, and it can expect a buffer as big as the return
>> value of KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2)
>
> Why would KVM_GET_XSAVE2 still be needed in this case?
>
> I'm thinking it would also be possible to reuse KVM_GET_XSAVE:
>
> - If userspace calls to KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2),
> then KVM knows that the userspace is a new version and it works with larger xsave buffer using the "size" that it returns via KVM_CAP_XSAVE2.
> So we can add a flag "kvm->xsave2_enabled", which gets set upon userspace checks KVM_CAP_XSAVE2.
You can use KVM_ENABLE_CAP(KVM_CAP_XSAVE2) for that, yes. In that case
you don't need KVM_GET_XSAVE2.
Paolo
> - On KVM_GET_XSAVE, if "kvm->xsave2_enabled" is set,
> then KVM allocates buffer to load xstates and copies the loaded xstates data to the userspace buffer
> using the "size" that was returned to userspace on KVM_CAP_XSAVE2.
> If "kvm->xsave2_enabled" isn't set, using the legacy "4KB" size.
>
> Thanks,
> Wei
>
Powered by blists - more mailing lists