[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Getting the XSAVE size from userspace


  • To: Jan Beulich <JBeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Andrei LUTAS <vlutas@xxxxxxxxxxxxxxx>
  • Date: Thu, 5 Nov 2015 13:35:04 +0200
  • Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Thu, 05 Nov 2015 11:35:10 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=xzkexwBdOZW6ampqb248uU2N7i0evl7XBbzTK7igWpsyD5voQdjsgqmEpLAq6rO7cMe0Juir5HbQVNGGOumEv3KCtdLnqMyyzCvpH56UlfIb0tPcYYNoRYjLoDkbuFtqCknIWLJxlEAVWdk2+WggiPb+jb3lh3Q0OB9cjpOLUNM+3oR0ucmAnV8l1M6KKUeqB0164cK6DkpFDd7e4otFLRnOP8Fwbvau6E37jRigUZrUaZWRXRG8w4wX3TOOmQH8xakYV2VIvrbTDyF9vIIDidIWpW8ru3LrNP1+0pK3V+QGeey/c/KoBYCo7MKgWMFdgJxCmzQcM/uXqJ61wo0LIw==; h=Received:Received:Received:Received:Received:Subject:To:References:Cc:From:Message-ID:Date:User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-BitDefender-Scanner:X-BitDefender-Spam:X-BitDefender-SpamStamp:X-BitDefender-CF-Stamp;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On 11/5/2015 12:51 PM, Jan Beulich wrote:
On 05.11.15 at 11:49, <andrew.cooper3@xxxxxxxxxx> wrote:
On 05/11/15 10:42, Jan Beulich wrote:
On 05.11.15 at 10:52, <rcojocaru@xxxxxxxxxxxxxxx> wrote:
I need to get the XSAVE size from userspace. The easiest way seems to be
to use the XEN_DOMCTL_getvcpuextstate hypercall, but that hypercall is
not public / there's no xenctrl.h wrapper for it.
Before going into any detail of the rest of your mail - any reason you
can't just consult CPUID output?
It depends on precisely what you want.

CPUID.0xD[0].ecx gives you the maximum xsave area on this processor
CPUID.0xD[0].ebx gives you the current size for the value in xcr0, but
that is not very useful from userspace.
Why would the maximum size not be sufficient for most (all?) user
mode purposes?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

Hello,

The use-case is the following: whenever an EPT violation is triggered inside a monitored VM, the introspection logic needs to know how many bytes were accessed (read/written). This is done by inspecting the faulting instruction and directly inferring the size, which is not straight-forward for XSAVE/XRSTOR family. Using the maximum possible size is wrong, as in any given moment the OS may or may not desire to XSAVE/XRSTOR the entire state (and thinking that the instruction tries to access more than it actually does may yield undesired effects). Therefore, the size needed for the currently enabled features of the monitored guest is required instead. Normally, it could be done by running CPUID with eax = 0xD and ecx = i, where i >= 2 and XCR0[i] is 1 (XCR0 belongs to the monitored guest), but I am unsure if using CPUID this way would be safe/desired: will Xen expose the same CPUID features, for XSAVE related functionality, on all VMs? (using XCPUID with eax = 0xD and ecx = 0 would give us the needed size for the SVA, and like I said, using the maximum size would not be safe, even if it's the same across all VMs on a given host). Also, I'm unsure how this would get along with migration...

Thanks,
Andrei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.