ia64/xen-unstable

changeset 10614:86cae321e707

Use explicit accessors to handle unusually-sized atomic operations in grant table code.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 30 10:10:39 2006 +0100 (2006-06-30)
parents c9696012fe05
children 784961057338
files linux-2.6-xen-sparse/drivers/xen/core/gnttab.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h xen/common/grant_table.c xen/include/asm-ia64/grant_table.h xen/include/asm-x86/grant_table.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Jun 30 10:07:38 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri Jun 30 10:10:39 2006 +0100
     1.3 @@ -169,7 +169,7 @@ int gnttab_end_foreign_access_ref(grant_
     1.4  			printk(KERN_ALERT "WARNING: g.e. still in use!\n");
     1.5  			return 0;
     1.6  		}
     1.7 -	} while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) !=
     1.8 +	} while ((nflags = synch_cmpxchg_subword(&shared[ref].flags, flags, 0)) !=
     1.9  		 flags);
    1.10  
    1.11  	return 1;
    1.12 @@ -224,7 +224,7 @@ unsigned long gnttab_end_foreign_transfe
    1.13  	 * reference and return failure (== 0).
    1.14  	 */
    1.15  	while (!((flags = shared[ref].flags) & GTF_transfer_committed)) {
    1.16 -		if (synch_cmpxchg(&shared[ref].flags, flags, 0) == flags)
    1.17 +		if (synch_cmpxchg_subword(&shared[ref].flags, flags, 0) == flags)
    1.18  			return 0;
    1.19  		cpu_relax();
    1.20  	}
     2.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h	Fri Jun 30 10:07:38 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h	Fri Jun 30 10:10:39 2006 +0100
     2.3 @@ -138,4 +138,6 @@ static __inline__ int synch_var_test_bit
     2.4   synch_const_test_bit((nr),(addr)) : \
     2.5   synch_var_test_bit((nr),(addr)))
     2.6  
     2.7 +#define synch_cmpxchg_subword synch_cmpxchg
     2.8 +
     2.9  #endif /* __XEN_SYNCH_BITOPS_H__ */
     3.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h	Fri Jun 30 10:07:38 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h	Fri Jun 30 10:10:39 2006 +0100
     3.3 @@ -58,4 +58,6 @@ static __inline__ int synch_var_test_bit
     3.4   synch_const_test_bit((nr),(addr)) : \
     3.5   synch_var_test_bit((nr),(addr)))
     3.6  
     3.7 +#define synch_cmpxchg_subword synch_cmpxchg
     3.8 +
     3.9  #endif /* __XEN_SYNCH_BITOPS_H__ */
     4.1 --- a/xen/common/grant_table.c	Fri Jun 30 10:07:38 2006 +0100
     4.2 +++ b/xen/common/grant_table.c	Fri Jun 30 10:10:39 2006 +0100
     4.3 @@ -287,10 +287,10 @@ static void
     4.4  
     4.5      if ( !(op->flags & GNTMAP_readonly) &&
     4.6           !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
     4.7 -        clear_bit(_GTF_writing, &sha->flags);
     4.8 +        gnttab_clear_flag(_GTF_writing, &sha->flags);
     4.9  
    4.10      if ( !act->pin )
    4.11 -        clear_bit(_GTF_reading, &sha->flags);
    4.12 +        gnttab_clear_flag(_GTF_reading, &sha->flags);
    4.13  
    4.14   unlock_out:
    4.15      spin_unlock(&rd->grant_table->lock);
    4.16 @@ -425,10 +425,10 @@ static void
    4.17  
    4.18      if ( ((act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0) &&
    4.19           !(flags & GNTMAP_readonly) )
    4.20 -        clear_bit(_GTF_writing, &sha->flags);
    4.21 +        gnttab_clear_flag(_GTF_writing, &sha->flags);
    4.22  
    4.23      if ( act->pin == 0 )
    4.24 -        clear_bit(_GTF_reading, &sha->flags);
    4.25 +        gnttab_clear_flag(_GTF_reading, &sha->flags);
    4.26  
    4.27   unmap_out:
    4.28      op->status = rc;
    4.29 @@ -889,11 +889,11 @@ gnttab_release_mappings(
    4.30              }
    4.31  
    4.32              if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
    4.33 -                clear_bit(_GTF_writing, &sha->flags);
    4.34 +                gnttab_clear_flag(_GTF_writing, &sha->flags);
    4.35          }
    4.36  
    4.37          if ( act->pin == 0 )
    4.38 -            clear_bit(_GTF_reading, &sha->flags);
    4.39 +            gnttab_clear_flag(_GTF_reading, &sha->flags);
    4.40  
    4.41          spin_unlock(&rd->grant_table->lock);
    4.42  
     5.1 --- a/xen/include/asm-ia64/grant_table.h	Fri Jun 30 10:07:38 2006 +0100
     5.2 +++ b/xen/include/asm-ia64/grant_table.h	Fri Jun 30 10:10:39 2006 +0100
     5.3 @@ -55,4 +55,9 @@ void guest_physmap_add_page(struct domai
     5.4  
     5.5  #define gnttab_log_dirty(d, f) ((void)0)
     5.6  
     5.7 +static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
     5.8 +{
     5.9 +	clear_bit(nr, addr);
    5.10 +}
    5.11 +
    5.12  #endif /* __ASM_GRANT_TABLE_H__ */
     6.1 --- a/xen/include/asm-x86/grant_table.h	Fri Jun 30 10:07:38 2006 +0100
     6.2 +++ b/xen/include/asm-x86/grant_table.h	Fri Jun 30 10:10:39 2006 +0100
     6.3 @@ -33,4 +33,9 @@ int destroy_grant_host_mapping(
     6.4  
     6.5  #define gnttab_log_dirty(d, f) mark_dirty((d), (f))
     6.6  
     6.7 +static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
     6.8 +{
     6.9 +	clear_bit(nr, addr);
    6.10 +}
    6.11 +
    6.12  #endif /* __ASM_GRANT_TABLE_H__ */