WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] EPT: Flush running cpus, add mask to flush when sche

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] EPT: Flush running cpus, add mask to flush when scheduled in
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Mon, 21 Sep 2009 19:04:02 +0100
Cc: Xiaohui Xin <Xiaohui.xin@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, Paul Durrant <Paul.Durrant@xxxxxxxxxx>, Xin Li <xin.b.li@xxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>
Delivery-date: Mon, 21 Sep 2009 11:04:30 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=IZwGM8DthUOUhM4EOUUo1M6hhl7Ul+Jz6xdOPaU5lZ4=; b=tk56rCC6U/Gc/5HPWhKdzP70d6aO7OR2RGGGrZ/4FeJRdBahz1fTJcFke6jVWZXwxX 5WQLb70BxXIDrMg6u58iE3cWYSNMOgDcEPyA90t/apWW2SlJafZTdBUOL1G9gX9r1ySm SsUdv8m7KoiOcHzV/O5PfrVnIRlvxYQwuzKaM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; b=IZGzpDjgQbtr5vasmb2y623a0trCaZ2iWlXEXOPHTo2c6Dkg15ir/dTqHK3+l5YMaq XABtFJDtLN5uKzywL8++WnD5mk8WSkmdFtJfyP3ZN1oG27ErxVEEjWhI4yXx7aWoqoH2 a3AvWxGFGRs6e4YCBqexlKSm7PBYvW4oWAImg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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
The attached patch modifies ept_sync_domain() to make it more
efficient wrt flushing ept translations.

Specifically:
* It synchronously flushes only cpus on which the domain is currently
running (d->domain_dirty_cpumask)
* It introduces a new vmx-specific mask, "ept_needs_flush", set to the
complement of d->domain_dirty_cpumask
* In vmx_ctxt_switch_to(), if the cpu is set in ept_needs_flush, it
flushes ept before running.

Main change I'd like reviewed: in order to avoid a potential race
condition described below, I had to re-order the setting of
domain_dirty_cpumask and the calling of arch.ctxt_switch_to() in
__context_switch().

Potential race without the re-ordering:
p1: change ept
p2: check ept_needs_flush, finds it false, doesn't flush
p1: sets ept_needs_flush
p1: checks domain_dirty, finds p2 not in it
p2: sets domain_dirty

Thus the vcpu on p2 is scheduled without its ept translations being flushed.

I've tested this with a 2-vcpu VM doing a parallel compile and
ballooning, no problems.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel