|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-devel
Re: [Xen-devel] Re: [PATCH 1/3] xen/event: Add reference counting	to eve
 
On Wed, 2011-10-26 at 17:51 +0100, Ian Campbell wrote:
> On Wed, 2011-10-26 at 16:47 +0100, Daniel De Graaf wrote:
> > @@ -939,6 +943,10 @@ static void unbind_from_irq(unsigned int irq)
> >  {
> >         struct evtchn_close close;
> >         int evtchn = evtchn_from_irq(irq);
> > +       struct irq_info *info = irq_get_handler_data(irq);
> > +
> > +       if (atomic_read(&info->refcnt) > 0 && 
> > !atomic_dec_and_test(&info->refcnt))
> > +               return;
> 
> This isn't all that atomic any more...
> 
> evtchn_make_refcounted() doesn't seem to have any locking which would
> save you...
> 
> Perhaps you could always manipulate this flag under the mapping lock
> (which perhaps is normally taken around about the sort of place you'd
> want to do this anyway) and make it non-atomic?
> 
> Or maybe you could build something with cmpxchg?
Or atomic_inc_unless_negative seems to be a primitive but there's no
atomic_dev_unless_negative so unref is still tricky.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |   
 
 | 
    | 
  
  
    |   | 
    |