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

Re: [SPAM] Re: [Xen-devel] A patch to xen/arch/x86/hvm/pmtimer.c for bot

To: Song Xiang <classicxsong@xxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [SPAM] Re: [Xen-devel] A patch to xen/arch/x86/hvm/pmtimer.c for both Xen 4.0.0 and Xen 4.0.1 to improve HVM scalability
From: Keir Fraser <keir@xxxxxxx>
Date: Tue, 16 Nov 2010 07:48:40 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Haibo Chen <oldseawave@xxxxxxxxx>
Delivery-date: Mon, 15 Nov 2010 23:49:26 -0800
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 :x-priority:mime-version:content-type:content-transfer-encoding; bh=Z1PNGxVRgMgs40StzGURqWsuUa1flBAFczu/wi1w/g4=; b=GrDHPEl+aS3cZ4Xhq0b+f/TVBYP+J7k713V8hPS/LdDJMY4NRq0mTU+OpQ9SqCmZ+K ICNx7vTZD5FrvsjJjYxnLLwwZ8NGuExq4CxSPBonx+jm3HbvWDQdKMyIV2lJWUjV1gP5 ybcyW0Unlk/6KUf4srync4pTpq0pJ463nUIs0=
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:x-priority:mime-version:content-type :content-transfer-encoding; b=FG/fdV8mYe+KKo3Wg7IxsB33atpwzGiUoHxBFGkvikgjunX6Ixz9u9YGckteFS//wU yyV9OdnGSW9QK69xSm5oRUAPLZsoACDHKXnqSpkiFrjJd4s1d742LZ7VbwtRxEvJokhF U8DvIwG/01or7dvmc+cH0GJ7WHYTRoK3pRtxo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <22C8C9FD-3B4A-45C2-A901-15A25648482A@xxxxxxxxx>
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: AcuFYq8HP2d0+S9n6E2w/J/+Qy/AKw==
Thread-topic: [SPAM] Re: [Xen-devel] A patch to xen/arch/x86/hvm/pmtimer.c for both Xen 4.0.0 and Xen 4.0.1 to improve HVM scalability
User-agent: Microsoft-Entourage/12.27.0.100910
On 16/11/2010 14:51, "Song Xiang" <classicxsong@xxxxxxxxx> wrote:

> +        /*
> +         * if acquired the PMTState lock then update the time
> +         * else other vcpu is updating it ,it should be up to date.
> +         */
> +        tmp = atomic_read(&s-> ownership);
> +        if (spin_trylock(&s->lock)) {
> +            pmt_update_time(s);
> +            *val = s->pm.tmr_val;
> +            spin_unlock(&s->lock);
> +            atomic_inc(&s-> ownership);
> +        }
> +        else {
> +            while (tmp == atomic_read(&s-> ownership));

You've kind of implemented a spin_barrier(). What you implemented could be
better and equivalently done as something like:

if (spin_trylock(&s->lock)) {
  ...
} else {
  spin_barrier(&s->lock);
}

No need for your new field at all! It initially seems weird that this
performs much better than the original code, but I guess it might: if all
VCPUs are piling in here at the same time, rather than having to execute one
by one, we'll have one go first and then the others will all execute
simultaneously read-only in convoy...

Anyway, please modify your patch as I suggest above, and then also confirm
what speedups you get with the revised patch. I want to know what the wins
are before applying optimisation hacks. I don't particularly have an issue
with them as long as they work! :-)

 -- Keir



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