ia64/xen-unstable

changeset 6361:96f1f6c71089

Update gnttab_free_callback_list locking.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 09:24:46 2005 +0000 (2005-08-23)
parents af9e3ae3a9b1
children 4956ea5b1e34
files linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Tue Aug 23 08:45:13 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c	Tue Aug 23 09:24:46 2005 +0000
     1.3 @@ -68,13 +68,11 @@ get_free_entry(
     1.4      return fh;
     1.5  }
     1.6  
     1.7 -static void do_free_callbacks(void)
     1.8 +static void do_free_callbacks(unsigned long flags)
     1.9  {
    1.10 -    struct gnttab_free_callback *callback, *next;
    1.11 -    spin_lock_irq(&gnttab_free_callback_list_lock);
    1.12 -    callback = gnttab_free_callback_list;
    1.13 +    struct gnttab_free_callback *callback = gnttab_free_callback_list, *next;
    1.14      gnttab_free_callback_list = NULL;
    1.15 -    spin_unlock_irq(&gnttab_free_callback_list_lock);
    1.16 +    spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
    1.17      while (callback) {
    1.18  	next = callback->next;
    1.19  	callback->next = NULL;
    1.20 @@ -88,12 +86,14 @@ put_free_entry(
    1.21      grant_ref_t ref)
    1.22  {
    1.23      grant_ref_t fh, nfh = gnttab_free_head;
    1.24 +    unsigned long flags;
    1.25      do { gnttab_free_list[ref] = fh = nfh; wmb(); }
    1.26      while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, ref)) != fh) );
    1.27 -    spin_lock_irq(&gnttab_free_callback_list_lock);
    1.28 +    spin_lock_irqsave(&gnttab_free_callback_list_lock, flags);
    1.29      if ( unlikely(gnttab_free_callback_list) )
    1.30 -	do_free_callbacks();
    1.31 -    spin_unlock_irq(&gnttab_free_callback_list_lock);
    1.32 +	do_free_callbacks(flags);
    1.33 +    else
    1.34 +	spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
    1.35  }
    1.36  
    1.37  /*
    1.38 @@ -276,14 +276,15 @@ void
    1.39  gnttab_request_free_callback(struct gnttab_free_callback *callback,
    1.40  			     void (*fn)(void *), void *arg)
    1.41  {
    1.42 +    unsigned long flags;
    1.43      if (callback->next)
    1.44  	return;
    1.45      callback->fn = fn;
    1.46      callback->arg = arg;
    1.47 -    spin_lock_irq(&gnttab_free_callback_list_lock);
    1.48 +    spin_lock_irqsave(&gnttab_free_callback_list_lock, flags);
    1.49      callback->next = gnttab_free_callback_list;
    1.50      gnttab_free_callback_list = callback;
    1.51 -    spin_unlock_irq(&gnttab_free_callback_list_lock);
    1.52 +    spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
    1.53  }
    1.54  
    1.55  /*