This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [Patch 2/4] Refining Xsave/Xrestore support

To: Haitao Shan <maillists.shan@xxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [Patch 2/4] Refining Xsave/Xrestore support
From: Keir Fraser <keir@xxxxxxx>
Date: Thu, 28 Oct 2010 11:30:57 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Weidong Han <weidong.han@xxxxxxxxx>
Delivery-date: Thu, 28 Oct 2010 03:32:05 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:user-agent:date :subject:from:to:cc:message-id:thread-topic:thread-index:in-reply-to :mime-version:content-type:content-transfer-encoding; bh=5UFiKD5WeTFb0/g57pDC4aNwyH/TxtnYENQABq0mC5Q=; b=Po34aovsbwxs8FDLJQIkjAVR1O8bp8N8i4kQah5IqWp0s0p2m7NE0yCzeLlLbnNg8Q SqMCbkT2gmlzzy/dz+QSqeAbD59Q2SK/xXQBZpo70CGTWOay+1pgDHzXcRH+z/HJt4SF LC9JtgPHVfixyUkAOFMfNEKMm8kXvl3tx3LoA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=ETj/kxGiS8rS1YQjeh7j4zk4QTHMWLeJKWbgbXqmci6c7R+UUlkIyDuHVkGyb6818Q EL2rVIFJjNecswBvfdV08ODI0bBcccYXw8TgTUVfeAGyA6RAIlV+kGFD5a6QfA/k6+SO FSKpg6jRJvp0RjREudXujpDVDIw0bKZgPEpuE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AANLkTinNtX_DRr5NLxPtJz-Dtd4-wTF+LLMiiaLnd5C9@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Act2izTivBwxOwpBd0ClTf4ljWQqeg==
Thread-topic: [Xen-devel] [Patch 2/4] Refining Xsave/Xrestore support
User-agent: Microsoft-Entourage/
On 28/10/2010 08:52, "Haitao Shan" <maillists.shan@xxxxxxxxx> wrote:

> Then I would prefer to write XCR0 unconditionally. Otherwise, I can
> only refer to the approach for handling CR4 switches: reading CR4
> first and checking whether there is a need to write actually.
> But I don't think <a read to XCR0 plus a data comparison> can save any
> compared with one unconditional write to XCR0.
> Are you OK with this?

Note that read_cr4() actually returns a cached copy of cr4, as stashed by
write_cr4(). You should use the same trick for XCR0, and then do the
cached-read-and-compare on context switch, again just as we do for cr4.

 -- Keir

> Thanks for pointing out the memory leak when hvm_vcpu_initialize
> fails. I will update accordingly.
> Shan Haitao
> 2010/10/28 Jan Beulich <JBeulich@xxxxxxxxxx>:
>>>>> On 28.10.10 at 06:58, Haitao Shan <maillists.shan@xxxxxxxxx> wrote:
>>> This is the updated patch#2. Thanks.
>> Sorry, but this is worse than not checking at all: You didn't consider
>> the idle vCPU case here, and hence you may end up having more
>> features enabled in xcr0 for a guest than it should have.
>> Also I only now noticed that you're leaking the xsave_area allocation
>> in vcpu_initialize() if hvm_vcpu_initialise() fails.
>> Jan
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

Xen-devel mailing list