[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] rcu: Update all rcu_read_lock() users to implement a dummy RCU read lock.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1276189263 -3600 # Node ID f3c6fe3ddf8e72b5a50e7922e08ea871fdf1c9be # Parent 9db8fc1ca2ef8b02f5da0933063dccda3b18c5d0 rcu: Update all rcu_read_lock() users to implement a dummy RCU read lock. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/hvm/vmsi.c | 14 ++++++++------ xen/include/xen/rcupdate.h | 4 ++-- xen/include/xen/sched.h | 8 ++++---- xen/xsm/flask/avc.c | 24 +++++++++++++----------- 4 files changed, 27 insertions(+), 23 deletions(-) diff -r 9db8fc1ca2ef -r f3c6fe3ddf8e xen/arch/x86/hvm/vmsi.c --- a/xen/arch/x86/hvm/vmsi.c Thu Jun 10 17:30:23 2010 +0100 +++ b/xen/arch/x86/hvm/vmsi.c Thu Jun 10 18:01:03 2010 +0100 @@ -162,6 +162,8 @@ struct msixtbl_entry struct rcu_head rcu; }; +static DEFINE_RCU_READ_LOCK(msixtbl_rcu_lock); + static struct msixtbl_entry *msixtbl_find_entry( struct vcpu *v, unsigned long addr) { @@ -207,7 +209,7 @@ static int msixtbl_read( void *virt; int r = X86EMUL_UNHANDLEABLE; - rcu_read_lock(); + rcu_read_lock(&msixtbl_rcu_lock); if ( len != 4 ) goto out; @@ -225,7 +227,7 @@ static int msixtbl_read( r = X86EMUL_OKAY; out: - rcu_read_unlock(); + rcu_read_unlock(&msixtbl_rcu_lock); return r; } @@ -238,7 +240,7 @@ static int msixtbl_write(struct vcpu *v, int nr_entry; int r = X86EMUL_UNHANDLEABLE; - rcu_read_lock(); + rcu_read_lock(&msixtbl_rcu_lock); if ( len != 4 ) goto out; @@ -265,7 +267,7 @@ static int msixtbl_write(struct vcpu *v, r = X86EMUL_OKAY; out: - rcu_read_unlock(); + rcu_read_unlock(&msixtbl_rcu_lock); return r; } @@ -274,12 +276,12 @@ static int msixtbl_range(struct vcpu *v, struct msixtbl_entry *entry; void *virt; - rcu_read_lock(); + rcu_read_lock(&msixtbl_rcu_lock); entry = msixtbl_find_entry(v, addr); virt = msixtbl_addr_to_virt(entry, addr); - rcu_read_unlock(); + rcu_read_unlock(&msixtbl_rcu_lock); return !!virt; } diff -r 9db8fc1ca2ef -r f3c6fe3ddf8e xen/include/xen/rcupdate.h --- a/xen/include/xen/rcupdate.h Thu Jun 10 17:30:23 2010 +0100 +++ b/xen/include/xen/rcupdate.h Thu Jun 10 18:01:03 2010 +0100 @@ -145,14 +145,14 @@ typedef struct _rcu_read_lock rcu_read_l * * It is illegal to block while in an RCU read-side critical section. */ -#define rcu_read_lock(x) do { } while (0) +#define rcu_read_lock(x) ((void)(x)) /** * rcu_read_unlock - marks the end of an RCU read-side critical section. * * See rcu_read_lock() for more information. */ -#define rcu_read_unlock(x) do { } while (0) +#define rcu_read_unlock(x) ((void)(x)) /* * So where is rcu_write_lock()? It does not exist, as there is no diff -r 9db8fc1ca2ef -r f3c6fe3ddf8e xen/include/xen/sched.h --- a/xen/include/xen/sched.h Thu Jun 10 17:30:23 2010 +0100 +++ b/xen/include/xen/sched.h Thu Jun 10 18:01:03 2010 +0100 @@ -344,6 +344,10 @@ struct domain_setup_info unsigned long symtab_len; }; +/* Protect updates/reads (resp.) of domain_list and domain_hash. */ +extern spinlock_t domlist_update_lock; +extern rcu_read_lock_t domlist_read_lock; + extern struct vcpu *idle_vcpu[NR_CPUS]; #define IDLE_DOMAIN_ID (0x7FFFU) #define is_idle_domain(d) ((d)->domain_id == IDLE_DOMAIN_ID) @@ -533,10 +537,6 @@ unsigned long hypercall_create_continuat local_events_need_delivery() \ )) -/* Protect updates/reads (resp.) of domain_list and domain_hash. */ -extern spinlock_t domlist_update_lock; -extern rcu_read_lock_t domlist_read_lock; - extern struct domain *domain_list; /* Caller must hold the domlist_read_lock or domlist_update_lock. */ diff -r 9db8fc1ca2ef -r f3c6fe3ddf8e xen/xsm/flask/avc.c --- a/xen/xsm/flask/avc.c Thu Jun 10 17:30:23 2010 +0100 +++ b/xen/xsm/flask/avc.c Thu Jun 10 18:01:03 2010 +0100 @@ -124,6 +124,8 @@ static struct avc_cache avc_cache; static struct avc_cache avc_cache; static struct avc_callback_node *avc_callbacks; +static DEFINE_RCU_READ_LOCK(avc_rcu_lock); + static inline int avc_hash(u32 ssid, u32 tsid, u16 tclass) { return (ssid ^ (tsid<<2) ^ (tclass<<4)) & (AVC_CACHE_SLOTS - 1); @@ -255,7 +257,7 @@ int avc_get_hash_stats(char *buf, uint32 struct avc_node *node; struct hlist_head *head; - rcu_read_lock(); + rcu_read_lock(&avc_rcu_lock); slots_used = 0; max_chain_len = 0; @@ -275,7 +277,7 @@ int avc_get_hash_stats(char *buf, uint32 } } - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); return snprintf(buf, size, "entries: %d\nbuckets used: %d/%d\n" "longest chain: %d\n", @@ -328,7 +330,7 @@ static inline int avc_reclaim_node(void) lock = &avc_cache.slots_lock[hvalue]; spin_lock_irqsave(&avc_cache.slots_lock[hvalue], flags); - rcu_read_lock(); + rcu_read_lock(&avc_rcu_lock); hlist_for_each_entry(node, next, head, list) { avc_node_delete(node); @@ -336,12 +338,12 @@ static inline int avc_reclaim_node(void) ecx++; if ( ecx >= AVC_CACHE_RECLAIM ) { - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); spin_unlock_irqrestore(lock, flags); goto out; } } - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); spin_unlock_irqrestore(lock, flags); } out: @@ -727,10 +729,10 @@ int avc_ss_reset(u32 seqno) lock = &avc_cache.slots_lock[i]; spin_lock_irqsave(lock, flag); - rcu_read_lock(); + rcu_read_lock(&avc_rcu_lock); hlist_for_each_entry(node, next, head, list) avc_node_delete(node); - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); spin_unlock_irqrestore(lock, flag); } @@ -780,12 +782,12 @@ int avc_has_perm_noaudit(u32 ssid, u32 t BUG_ON(!requested); - rcu_read_lock(); + rcu_read_lock(&avc_rcu_lock); node = avc_lookup(ssid, tsid, tclass); if ( !node ) { - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); if ( in_avd ) avd = in_avd; @@ -795,7 +797,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 t rc = security_compute_av(ssid,tsid,tclass,requested,avd); if ( rc ) goto out; - rcu_read_lock(); + rcu_read_lock(&avc_rcu_lock); node = avc_insert(ssid,tsid,tclass,avd); } else { if ( in_avd ) @@ -814,7 +816,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 t rc = -EACCES; } - rcu_read_unlock(); + rcu_read_unlock(&avc_rcu_lock); out: return rc; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |