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: spinlock requests (was RE: [Xen-devel] [Patch] don't spin with irq d

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxxxx>, Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx>
Subject: RE: spinlock requests (was RE: [Xen-devel] [Patch] don't spin with irq disabled)
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Thu, 2 Apr 2009 16:08:45 -0700 (PDT)
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 02 Apr 2009 16:10:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C5F2C775.537D%keir.fraser@xxxxxxxxxxxxx>
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
> Well the race is still impossible afaics. Unless your
> _raw_rw_is_write_locked() was checking for ==0 rather than 
> <=0.

Finally got a chance to go back and reproduce and figure
this one out.  The crash is still occurring.  My code
definitely checks for <=0.  BUT the declaration of
raw_rwlock_t declares the lock as "volatile UNSIGNED int",
so the compiler blithely generates a check for == 0.

Can I assume the fix is to change the declaration to
int instead of unsigned int, or will that cause problems
elsewhere?

Thanks,
Dan

> -----Original Message-----
> From: Keir Fraser [mailto:keir.fraser@xxxxxxxxxxxxx]
> Sent: Friday, March 27, 2009 12:12 PM
> To: Dan Magenheimer; Jan Beulich; Juergen Gross
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: spinlock requests (was RE: [Xen-devel] [Patch] don't spin
> with irq disabled)
> 
> 
> On 27/03/2009 18:00, "Dan Magenheimer" 
> <dan.magenheimer@xxxxxxxxxx> wrote:
> 
> >> What try_readlock would that be? There is no such function.
> > 
> > Oops, my memory was faulty.  It is read_lock() itself
> > that decrements the lock and then re-increments it.
> > This appeared to be causing the race.  When I added
> > debug code, the problem went away (which was what led
> > me to the "hack" working version).
> 
> Well the race is still impossible afaics. Unless your
> _raw_rw_is_write_locked() was checking for ==0 rather than 
> <=0. I think
> something fishy was going on in your actual original implementation if
> is_write_locked(). :-)
> 
>  -- Keir
> 
> 
>

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

<Prev in Thread] Current Thread [Next in Thread>