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] RE: [PATCH] workaround for bug#197: second try

To: "Ryan Harper" <ryanh@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] RE: [PATCH] workaround for bug#197: second try
From: "Puthiyaparambil, Aravindh" <aravindh.puthiyaparambil@xxxxxxxxxx>
Date: Tue, 13 Sep 2005 14:29:07 -0400
Cc: Dan Smith <danms@xxxxxxxxxx>
Delivery-date: Tue, 13 Sep 2005 18:27:55 +0000
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcW4kBno0NVboA+QSXmneVrBfrOhawAANkfg
Thread-topic: [PATCH] workaround for bug#197: second try
Ryan,

This patch has fixed the race condition that I was seeing.

Thanks
Aravindh

> -----Original Message-----
> From: Ryan Harper [mailto:ryanh@xxxxxxxxxx]
> Sent: Tuesday, September 13, 2005 2:22 PM
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Cc: Puthiyaparambil, Aravindh; Dan Smith
> Subject: [PATCH] workaround for bug#197: second try
> 
> 
> Thanks for trying out the last patch.  While the previous workaround
> worked for
> me, it did not for others.  Looking into domain_pause(), we can see
that
> vcpu_sleep_sync() is called on each vcpu:
> 
>     /*
>      * We can be sure that the VCPU is finally descheduled after the
> running
>      * flag is cleared and the scheduler lock is released.
>      */
>     while ( test_bit(_VCPUF_running, &v->vcpu_flags)
>             && !domain_runnable(v)
>             &&
spin_is_locked(&schedule_data[v->processor].schedule_lock)
> )
>        cpu_relax();
> 
> If we are to believe the comment, (which makes sense), then the while
loop
> code
> is broken.  That is, this function will spin until *any* of the three
> tests
> returns false rather than waiting until *all* tests are false. This
patch
> switches the &&s to ||s and inverts the domain_runnable() check.  I
> believe we
> want to spin while 1) vcpu_running flag is up 2) the domain is
runnable
> and 3)
> the scheduler lock is held.
> 
> 
> --
> Ryan Harper
> Software Engineer; Linux Technology Center
> IBM Corp., Austin, Tx
> (512) 838-9253   T/L: 678-9253
> ryanh@xxxxxxxxxx
> 
> 
> diffstat output:
>  schedule.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> ---
> #
> # fix logic to match comments.  ie. we want to spin until
> # 1) the running flag is down,
> # 2) the domain isnt runnable (pausecnt > 0)
> # 3) the scheduler lock isnt held
> #
> # Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
> #
> diff -r 413c911e5780 xen/common/schedule.c
> --- a/xen/common/schedule.c   Mon Sep 12 12:48:33 2005
> +++ b/xen/common/schedule.c   Tue Sep 13 09:46:36 2005
> @@ -214,8 +214,8 @@
>       * flag is cleared and the scheduler lock is released.
>       */
>      while ( test_bit(_VCPUF_running, &v->vcpu_flags)
> -            && !domain_runnable(v)
> -            &&
spin_is_locked(&schedule_data[v->processor].schedule_lock)
> )
> +            || domain_runnable(v)
> +            ||
spin_is_locked(&schedule_data[v->processor].schedule_lock)
> )
>          cpu_relax();
> 
>      sync_vcpu_execstate(v);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] RE: [PATCH] workaround for bug#197: second try, Puthiyaparambil, Aravindh <=