# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 86cae321e70789a19c74722cfff866d7268f252c
# Parent c9696012fe05347ad6a0d503bc55b53b76783af3
Use explicit accessors to handle unusually-sized atomic operations in grant
table code.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c | 4 +--
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h | 2 +
linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h | 2 +
xen/common/grant_table.c | 12
+++++-----
xen/include/asm-ia64/grant_table.h | 5 ++++
xen/include/asm-x86/grant_table.h | 5 ++++
6 files changed, 22 insertions(+), 8 deletions(-)
diff -r c9696012fe05 -r 86cae321e707
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Fri Jun 30 10:07:38
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Fri Jun 30 10:10:39
2006 +0100
@@ -169,7 +169,7 @@ int gnttab_end_foreign_access_ref(grant_
printk(KERN_ALERT "WARNING: g.e. still in use!\n");
return 0;
}
- } while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) !=
+ } while ((nflags = synch_cmpxchg_subword(&shared[ref].flags, flags, 0))
!=
flags);
return 1;
@@ -224,7 +224,7 @@ unsigned long gnttab_end_foreign_transfe
* reference and return failure (== 0).
*/
while (!((flags = shared[ref].flags) & GTF_transfer_committed)) {
- if (synch_cmpxchg(&shared[ref].flags, flags, 0) == flags)
+ if (synch_cmpxchg_subword(&shared[ref].flags, flags, 0) ==
flags)
return 0;
cpu_relax();
}
diff -r c9696012fe05 -r 86cae321e707
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h Fri Jun
30 10:07:38 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h Fri Jun
30 10:10:39 2006 +0100
@@ -138,4 +138,6 @@ static __inline__ int synch_var_test_bit
synch_const_test_bit((nr),(addr)) : \
synch_var_test_bit((nr),(addr)))
+#define synch_cmpxchg_subword synch_cmpxchg
+
#endif /* __XEN_SYNCH_BITOPS_H__ */
diff -r c9696012fe05 -r 86cae321e707
linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h Fri Jun 30
10:07:38 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-ia64/synch_bitops.h Fri Jun 30
10:10:39 2006 +0100
@@ -58,4 +58,6 @@ static __inline__ int synch_var_test_bit
synch_const_test_bit((nr),(addr)) : \
synch_var_test_bit((nr),(addr)))
+#define synch_cmpxchg_subword synch_cmpxchg
+
#endif /* __XEN_SYNCH_BITOPS_H__ */
diff -r c9696012fe05 -r 86cae321e707 xen/common/grant_table.c
--- a/xen/common/grant_table.c Fri Jun 30 10:07:38 2006 +0100
+++ b/xen/common/grant_table.c Fri Jun 30 10:10:39 2006 +0100
@@ -287,10 +287,10 @@ __gnttab_map_grant_ref(
if ( !(op->flags & GNTMAP_readonly) &&
!(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) )
- clear_bit(_GTF_writing, &sha->flags);
+ gnttab_clear_flag(_GTF_writing, &sha->flags);
if ( !act->pin )
- clear_bit(_GTF_reading, &sha->flags);
+ gnttab_clear_flag(_GTF_reading, &sha->flags);
unlock_out:
spin_unlock(&rd->grant_table->lock);
@@ -425,10 +425,10 @@ __gnttab_unmap_grant_ref(
if ( ((act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0) &&
!(flags & GNTMAP_readonly) )
- clear_bit(_GTF_writing, &sha->flags);
+ gnttab_clear_flag(_GTF_writing, &sha->flags);
if ( act->pin == 0 )
- clear_bit(_GTF_reading, &sha->flags);
+ gnttab_clear_flag(_GTF_reading, &sha->flags);
unmap_out:
op->status = rc;
@@ -889,11 +889,11 @@ gnttab_release_mappings(
}
if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
- clear_bit(_GTF_writing, &sha->flags);
+ gnttab_clear_flag(_GTF_writing, &sha->flags);
}
if ( act->pin == 0 )
- clear_bit(_GTF_reading, &sha->flags);
+ gnttab_clear_flag(_GTF_reading, &sha->flags);
spin_unlock(&rd->grant_table->lock);
diff -r c9696012fe05 -r 86cae321e707 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h Fri Jun 30 10:07:38 2006 +0100
+++ b/xen/include/asm-ia64/grant_table.h Fri Jun 30 10:10:39 2006 +0100
@@ -55,4 +55,9 @@ void guest_physmap_add_page(struct domai
#define gnttab_log_dirty(d, f) ((void)0)
+static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+{
+ clear_bit(nr, addr);
+}
+
#endif /* __ASM_GRANT_TABLE_H__ */
diff -r c9696012fe05 -r 86cae321e707 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h Fri Jun 30 10:07:38 2006 +0100
+++ b/xen/include/asm-x86/grant_table.h Fri Jun 30 10:10:39 2006 +0100
@@ -33,4 +33,9 @@ int destroy_grant_host_mapping(
#define gnttab_log_dirty(d, f) mark_dirty((d), (f))
+static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
+{
+ clear_bit(nr, addr);
+}
+
#endif /* __ASM_GRANT_TABLE_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|