Commit f94181da authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'core-fixes-for-linus' of...

Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  rcu: fix rcutorture bug
  rcu: eliminate synchronize_rcu_xxx macro
  rcu: make treercu safe for suspend and resume
  rcu: fix rcutree grace-period-latency bug on small systems
  futex: catch certain assymetric (get|put)_futex_key calls
  futex: make futex_(get|put)_key() calls symmetric
  locking, percpu counters: introduce separate lock classes
  swiotlb: clean up EXPORT_SYMBOL usage
  swiotlb: remove unnecessary declaration
  swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h
  swiotlb: add support for systems with highmem
  swiotlb: store phys address in io_tlb_orig_addr array
  swiotlb: add hwdev to swiotlb_phys_to_bus() / swiotlb_sg_to_bus()
parents 932adbed fdbc0450
...@@ -2,44 +2,7 @@ ...@@ -2,44 +2,7 @@
#define ASM_IA64__SWIOTLB_H #define ASM_IA64__SWIOTLB_H
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/swiotlb.h>
/* SWIOTLB interface */
extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
size_t size, int dir);
extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags);
extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_for_device(struct device *hwdev,
dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
dma_addr_t dev_addr,
unsigned long offset,
size_t size, int dir);
extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
dma_addr_t dev_addr,
unsigned long offset,
size_t size, int dir);
extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
struct scatterlist *sg, int nelems,
int dir);
extern void swiotlb_sync_sg_for_device(struct device *hwdev,
struct scatterlist *sg, int nelems,
int dir);
extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
int nents, int direction);
extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
int nents, int direction);
extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
void *vaddr, dma_addr_t dma_handle);
extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
extern void swiotlb_init(void);
extern int swiotlb_force; extern int swiotlb_force;
......
#ifndef _ASM_X86_SWIOTLB_H #ifndef _ASM_X86_SWIOTLB_H
#define _ASM_X86_SWIOTLB_H #define _ASM_X86_SWIOTLB_H
#include <asm/dma-mapping.h> #include <linux/swiotlb.h>
/* SWIOTLB interface */ /* SWIOTLB interface */
extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
size_t size, int dir);
extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags);
extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_for_device(struct device *hwdev,
dma_addr_t dev_addr,
size_t size, int dir);
extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
dma_addr_t dev_addr,
unsigned long offset,
size_t size, int dir);
extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
dma_addr_t dev_addr,
unsigned long offset,
size_t size, int dir);
extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
struct scatterlist *sg, int nelems,
int dir);
extern void swiotlb_sync_sg_for_device(struct device *hwdev,
struct scatterlist *sg, int nelems,
int dir);
extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
int nents, int direction);
extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
int nents, int direction);
extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
void *vaddr, dma_addr_t dma_handle);
extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
extern void swiotlb_init(void);
extern int swiotlb_force; extern int swiotlb_force;
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
......
...@@ -23,7 +23,7 @@ void *swiotlb_alloc(unsigned order, unsigned long nslabs) ...@@ -23,7 +23,7 @@ void *swiotlb_alloc(unsigned order, unsigned long nslabs)
return (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, order); return (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, order);
} }
dma_addr_t swiotlb_phys_to_bus(phys_addr_t paddr) dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
{ {
return paddr; return paddr;
} }
......
...@@ -26,8 +26,16 @@ struct percpu_counter { ...@@ -26,8 +26,16 @@ struct percpu_counter {
extern int percpu_counter_batch; extern int percpu_counter_batch;
int percpu_counter_init(struct percpu_counter *fbc, s64 amount); int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount); struct lock_class_key *key);
#define percpu_counter_init(fbc, value) \
({ \
static struct lock_class_key __key; \
\
__percpu_counter_init(fbc, value, &__key); \
})
void percpu_counter_destroy(struct percpu_counter *fbc); void percpu_counter_destroy(struct percpu_counter *fbc);
void percpu_counter_set(struct percpu_counter *fbc, s64 amount); void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
...@@ -81,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) ...@@ -81,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
return 0; return 0;
} }
#define percpu_counter_init_irq percpu_counter_init
static inline void percpu_counter_destroy(struct percpu_counter *fbc) static inline void percpu_counter_destroy(struct percpu_counter *fbc)
{ {
} }
......
...@@ -204,18 +204,6 @@ struct rcu_synchronize { ...@@ -204,18 +204,6 @@ struct rcu_synchronize {
extern void wakeme_after_rcu(struct rcu_head *head); extern void wakeme_after_rcu(struct rcu_head *head);
#define synchronize_rcu_xxx(name, func) \
void name(void) \
{ \
struct rcu_synchronize rcu; \
\
init_completion(&rcu.completion); \
/* Will wake me after RCU finished. */ \
func(&rcu.head, wakeme_after_rcu); \
/* Wait for it. */ \
wait_for_completion(&rcu.completion); \
}
/** /**
* synchronize_sched - block until all CPUs have exited any non-preemptive * synchronize_sched - block until all CPUs have exited any non-preemptive
* kernel code sequences. * kernel code sequences.
......
...@@ -27,7 +27,8 @@ swiotlb_init(void); ...@@ -27,7 +27,8 @@ swiotlb_init(void);
extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs); extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
extern void *swiotlb_alloc(unsigned order, unsigned long nslabs); extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
extern dma_addr_t swiotlb_phys_to_bus(phys_addr_t address); extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
phys_addr_t address);
extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size); extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size);
......
...@@ -170,8 +170,11 @@ static void get_futex_key_refs(union futex_key *key) ...@@ -170,8 +170,11 @@ static void get_futex_key_refs(union futex_key *key)
*/ */
static void drop_futex_key_refs(union futex_key *key) static void drop_futex_key_refs(union futex_key *key)
{ {
if (!key->both.ptr) if (!key->both.ptr) {
/* If we're here then we tried to put a key we failed to get */
WARN_ON_ONCE(1);
return; return;
}
switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
case FUT_OFF_INODE: case FUT_OFF_INODE:
...@@ -730,8 +733,8 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset) ...@@ -730,8 +733,8 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)
} }
spin_unlock(&hb->lock); spin_unlock(&hb->lock);
out:
put_futex_key(fshared, &key); put_futex_key(fshared, &key);
out:
return ret; return ret;
} }
...@@ -755,7 +758,7 @@ retryfull: ...@@ -755,7 +758,7 @@ retryfull:
goto out; goto out;
ret = get_futex_key(uaddr2, fshared, &key2); ret = get_futex_key(uaddr2, fshared, &key2);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out_put_key1;
hb1 = hash_futex(&key1); hb1 = hash_futex(&key1);
hb2 = hash_futex(&key2); hb2 = hash_futex(&key2);
...@@ -777,12 +780,12 @@ retry: ...@@ -777,12 +780,12 @@ retry:
* but we might get them from range checking * but we might get them from range checking
*/ */
ret = op_ret; ret = op_ret;
goto out; goto out_put_keys;
#endif #endif
if (unlikely(op_ret != -EFAULT)) { if (unlikely(op_ret != -EFAULT)) {
ret = op_ret; ret = op_ret;
goto out; goto out_put_keys;
} }
/* /*
...@@ -796,7 +799,7 @@ retry: ...@@ -796,7 +799,7 @@ retry:
ret = futex_handle_fault((unsigned long)uaddr2, ret = futex_handle_fault((unsigned long)uaddr2,
attempt); attempt);
if (ret) if (ret)
goto out; goto out_put_keys;
goto retry; goto retry;
} }
...@@ -834,10 +837,11 @@ retry: ...@@ -834,10 +837,11 @@ retry:
spin_unlock(&hb1->lock); spin_unlock(&hb1->lock);
if (hb1 != hb2) if (hb1 != hb2)
spin_unlock(&hb2->lock); spin_unlock(&hb2->lock);
out: out_put_keys:
put_futex_key(fshared, &key2); put_futex_key(fshared, &key2);
out_put_key1:
put_futex_key(fshared, &key1); put_futex_key(fshared, &key1);
out:
return ret; return ret;
} }
...@@ -854,13 +858,13 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2, ...@@ -854,13 +858,13 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
struct futex_q *this, *next; struct futex_q *this, *next;
int ret, drop_count = 0; int ret, drop_count = 0;
retry: retry:
ret = get_futex_key(uaddr1, fshared, &key1); ret = get_futex_key(uaddr1, fshared, &key1);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out;
ret = get_futex_key(uaddr2, fshared, &key2); ret = get_futex_key(uaddr2, fshared, &key2);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out_put_key1;
hb1 = hash_futex(&key1); hb1 = hash_futex(&key1);
hb2 = hash_futex(&key2); hb2 = hash_futex(&key2);
...@@ -882,7 +886,7 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2, ...@@ -882,7 +886,7 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
if (!ret) if (!ret)
goto retry; goto retry;
return ret; goto out_put_keys;
} }
if (curval != *cmpval) { if (curval != *cmpval) {
ret = -EAGAIN; ret = -EAGAIN;
...@@ -927,9 +931,11 @@ out_unlock: ...@@ -927,9 +931,11 @@ out_unlock:
while (--drop_count >= 0) while (--drop_count >= 0)
drop_futex_key_refs(&key1); drop_futex_key_refs(&key1);
out: out_put_keys:
put_futex_key(fshared, &key2); put_futex_key(fshared, &key2);
out_put_key1:
put_futex_key(fshared, &key1); put_futex_key(fshared, &key1);
out:
return ret; return ret;
} }
...@@ -990,7 +996,7 @@ static int unqueue_me(struct futex_q *q) ...@@ -990,7 +996,7 @@ static int unqueue_me(struct futex_q *q)
int ret = 0; int ret = 0;
/* In the common case we don't take the spinlock, which is nice. */ /* In the common case we don't take the spinlock, which is nice. */
retry: retry:
lock_ptr = q->lock_ptr; lock_ptr = q->lock_ptr;
barrier(); barrier();
if (lock_ptr != NULL) { if (lock_ptr != NULL) {
...@@ -1172,11 +1178,11 @@ static int futex_wait(u32 __user *uaddr, int fshared, ...@@ -1172,11 +1178,11 @@ static int futex_wait(u32 __user *uaddr, int fshared,
q.pi_state = NULL; q.pi_state = NULL;
q.bitset = bitset; q.bitset = bitset;
retry: retry:
q.key = FUTEX_KEY_INIT; q.key = FUTEX_KEY_INIT;
ret = get_futex_key(uaddr, fshared, &q.key); ret = get_futex_key(uaddr, fshared, &q.key);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_release_sem; goto out;
hb = queue_lock(&q); hb = queue_lock(&q);
...@@ -1204,6 +1210,7 @@ static int futex_wait(u32 __user *uaddr, int fshared, ...@@ -1204,6 +1210,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
if (unlikely(ret)) { if (unlikely(ret)) {
queue_unlock(&q, hb); queue_unlock(&q, hb);
put_futex_key(fshared, &q.key);
ret = get_user(uval, uaddr); ret = get_user(uval, uaddr);
...@@ -1213,7 +1220,7 @@ static int futex_wait(u32 __user *uaddr, int fshared, ...@@ -1213,7 +1220,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
} }
ret = -EWOULDBLOCK; ret = -EWOULDBLOCK;
if (uval != val) if (uval != val)
goto out_unlock_release_sem; goto out_unlock_put_key;
/* Only actually queue if *uaddr contained val. */ /* Only actually queue if *uaddr contained val. */
queue_me(&q, hb); queue_me(&q, hb);
...@@ -1305,11 +1312,11 @@ static int futex_wait(u32 __user *uaddr, int fshared, ...@@ -1305,11 +1312,11 @@ static int futex_wait(u32 __user *uaddr, int fshared,
return -ERESTART_RESTARTBLOCK; return -ERESTART_RESTARTBLOCK;
} }
out_unlock_release_sem: out_unlock_put_key:
queue_unlock(&q, hb); queue_unlock(&q, hb);
out_release_sem:
put_futex_key(fshared, &q.key); put_futex_key(fshared, &q.key);
out:
return ret; return ret;
} }
...@@ -1358,16 +1365,16 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1358,16 +1365,16 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
} }
q.pi_state = NULL; q.pi_state = NULL;
retry: retry:
q.key = FUTEX_KEY_INIT; q.key = FUTEX_KEY_INIT;
ret = get_futex_key(uaddr, fshared, &q.key); ret = get_futex_key(uaddr, fshared, &q.key);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_release_sem; goto out;
retry_unlocked: retry_unlocked:
hb = queue_lock(&q); hb = queue_lock(&q);
retry_locked: retry_locked:
ret = lock_taken = 0; ret = lock_taken = 0;
/* /*
...@@ -1388,14 +1395,14 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1388,14 +1395,14 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
*/ */
if (unlikely((curval & FUTEX_TID_MASK) == task_pid_vnr(current))) { if (unlikely((curval & FUTEX_TID_MASK) == task_pid_vnr(current))) {
ret = -EDEADLK; ret = -EDEADLK;
goto out_unlock_release_sem; goto out_unlock_put_key;
} }
/* /*
* Surprise - we got the lock. Just return to userspace: * Surprise - we got the lock. Just return to userspace:
*/ */
if (unlikely(!curval)) if (unlikely(!curval))
goto out_unlock_release_sem; goto out_unlock_put_key;
uval = curval; uval = curval;
...@@ -1431,7 +1438,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1431,7 +1438,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
* We took the lock due to owner died take over. * We took the lock due to owner died take over.
*/ */
if (unlikely(lock_taken)) if (unlikely(lock_taken))
goto out_unlock_release_sem; goto out_unlock_put_key;
/* /*
* We dont have the lock. Look up the PI state (or create it if * We dont have the lock. Look up the PI state (or create it if
...@@ -1470,7 +1477,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1470,7 +1477,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
goto retry_locked; goto retry_locked;
} }
default: default:
goto out_unlock_release_sem; goto out_unlock_put_key;
} }
} }
...@@ -1561,16 +1568,17 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1561,16 +1568,17 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
destroy_hrtimer_on_stack(&to->timer); destroy_hrtimer_on_stack(&to->timer);
return ret != -EINTR ? ret : -ERESTARTNOINTR; return ret != -EINTR ? ret : -ERESTARTNOINTR;
out_unlock_release_sem: out_unlock_put_key:
queue_unlock(&q, hb); queue_unlock(&q, hb);
out_release_sem: out_put_key:
put_futex_key(fshared, &q.key); put_futex_key(fshared, &q.key);
out:
if (to) if (to)
destroy_hrtimer_on_stack(&to->timer); destroy_hrtimer_on_stack(&to->timer);
return ret; return ret;
uaddr_faulted: uaddr_faulted:
/* /*
* We have to r/w *(int __user *)uaddr, and we have to modify it * We have to r/w *(int __user *)uaddr, and we have to modify it
* atomically. Therefore, if we continue to fault after get_user() * atomically. Therefore, if we continue to fault after get_user()
...@@ -1583,7 +1591,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, ...@@ -1583,7 +1591,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
if (attempt++) { if (attempt++) {
ret = futex_handle_fault((unsigned long)uaddr, attempt); ret = futex_handle_fault((unsigned long)uaddr, attempt);
if (ret) if (ret)
goto out_release_sem; goto out_put_key;
goto retry_unlocked; goto retry_unlocked;
} }
...@@ -1675,9 +1683,9 @@ retry_unlocked: ...@@ -1675,9 +1683,9 @@ retry_unlocked:
out_unlock: out_unlock:
spin_unlock(&hb->lock); spin_unlock(&hb->lock);
out:
put_futex_key(fshared, &key); put_futex_key(fshared, &key);
out:
return ret; return ret;
pi_faulted: pi_faulted:
......
...@@ -77,8 +77,15 @@ void wakeme_after_rcu(struct rcu_head *head) ...@@ -77,8 +77,15 @@ void wakeme_after_rcu(struct rcu_head *head)
* sections are delimited by rcu_read_lock() and rcu_read_unlock(), * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
* and may be nested. * and may be nested.
*/ */
void synchronize_rcu(void); /* Makes kernel-doc tools happy */ void synchronize_rcu(void)
synchronize_rcu_xxx(synchronize_rcu, call_rcu) {
struct rcu_synchronize rcu;
init_completion(&rcu.completion);
/* Will wake me after RCU finished. */
call_rcu(&rcu.head, wakeme_after_rcu);
/* Wait for it. */
wait_for_completion(&rcu.completion);
}
EXPORT_SYMBOL_GPL(synchronize_rcu); EXPORT_SYMBOL_GPL(synchronize_rcu);
static void rcu_barrier_callback(struct rcu_head *notused) static void rcu_barrier_callback(struct rcu_head *notused)
......
...@@ -1177,7 +1177,16 @@ EXPORT_SYMBOL_GPL(call_rcu_sched); ...@@ -1177,7 +1177,16 @@ EXPORT_SYMBOL_GPL(call_rcu_sched);
* in -rt this does -not- necessarily result in all currently executing * in -rt this does -not- necessarily result in all currently executing
* interrupt -handlers- having completed. * interrupt -handlers- having completed.
*/ */
synchronize_rcu_xxx(__synchronize_sched, call_rcu_sched) void __synchronize_sched(void)
{
struct rcu_synchronize rcu;
init_completion(&rcu.completion);
/* Will wake me after RCU finished. */
call_rcu_sched(&rcu.head, wakeme_after_rcu);
/* Wait for it. */
wait_for_completion(&rcu.completion);
}
EXPORT_SYMBOL_GPL(__synchronize_sched); EXPORT_SYMBOL_GPL(__synchronize_sched);
/* /*
......
...@@ -136,7 +136,7 @@ static int stutter_pause_test = 0; ...@@ -136,7 +136,7 @@ static int stutter_pause_test = 0;
#endif #endif
int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT; int rcutorture_runnable = RCUTORTURE_RUNNABLE_INIT;
#define FULLSTOP_SIGNALED 1 /* Bail due to signal. */ #define FULLSTOP_SHUTDOWN 1 /* Bail due to system shutdown/panic. */
#define FULLSTOP_CLEANUP 2 /* Orderly shutdown. */ #define FULLSTOP_CLEANUP 2 /* Orderly shutdown. */
static int fullstop; /* stop generating callbacks at test end. */ static int fullstop; /* stop generating callbacks at test end. */
DEFINE_MUTEX(fullstop_mutex); /* protect fullstop transitions and */ DEFINE_MUTEX(fullstop_mutex); /* protect fullstop transitions and */
...@@ -151,12 +151,10 @@ rcutorture_shutdown_notify(struct notifier_block *unused1, ...@@ -151,12 +151,10 @@ rcutorture_shutdown_notify(struct notifier_block *unused1,
{ {
if (fullstop) if (fullstop)
return NOTIFY_DONE; return NOTIFY_DONE;
if (signal_pending(current)) {
mutex_lock(&fullstop_mutex); mutex_lock(&fullstop_mutex);
if (!ACCESS_ONCE(fullstop)) if (!fullstop)
fullstop = FULLSTOP_SIGNALED; fullstop = FULLSTOP_SHUTDOWN;
mutex_unlock(&fullstop_mutex); mutex_unlock(&fullstop_mutex);
}
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -624,7 +622,7 @@ rcu_torture_writer(void *arg) ...@@ -624,7 +622,7 @@ rcu_torture_writer(void *arg)
rcu_stutter_wait(); rcu_stutter_wait();
} while (!kthread_should_stop() && !fullstop); } while (!kthread_should_stop() && !fullstop);
VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping"); VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping");
while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
return 0; return 0;
} }
...@@ -649,7 +647,7 @@ rcu_torture_fakewriter(void *arg) ...@@ -649,7 +647,7 @@ rcu_torture_fakewriter(void *arg)
} while (!kthread_should_stop() && !fullstop); } while (!kthread_should_stop() && !fullstop);
VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task stopping"); VERBOSE_PRINTK_STRING("rcu_torture_fakewriter task stopping");
while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
return 0; return 0;
} }
...@@ -759,7 +757,7 @@ rcu_torture_reader(void *arg) ...@@ -759,7 +757,7 @@ rcu_torture_reader(void *arg)
VERBOSE_PRINTK_STRING("rcu_torture_reader task stopping"); VERBOSE_PRINTK_STRING("rcu_torture_reader task stopping");
if (irqreader && cur_ops->irqcapable) if (irqreader && cur_ops->irqcapable)
del_timer_sync(&t); del_timer_sync(&t);
while (!kthread_should_stop() && fullstop != FULLSTOP_SIGNALED) while (!kthread_should_stop() && fullstop != FULLSTOP_SHUTDOWN)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
return 0; return 0;
} }
......
...@@ -79,7 +79,10 @@ struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); ...@@ -79,7 +79,10 @@ struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state);
DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
#ifdef CONFIG_NO_HZ #ifdef CONFIG_NO_HZ
DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks); DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
.dynticks_nesting = 1,
.dynticks = 1,
};
#endif /* #ifdef CONFIG_NO_HZ */ #endif /* #ifdef CONFIG_NO_HZ */
static int blimit = 10; /* Maximum callbacks per softirq. */ static int blimit = 10; /* Maximum callbacks per softirq. */
...@@ -572,6 +575,7 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) ...@@ -572,6 +575,7 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
/* Special-case the common single-level case. */ /* Special-case the common single-level case. */
if (NUM_RCU_NODES == 1) { if (NUM_RCU_NODES == 1) {
rnp->qsmask = rnp->qsmaskinit; rnp->qsmask = rnp->qsmaskinit;
rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */
spin_unlock_irqrestore(&rnp->lock, flags); spin_unlock_irqrestore(&rnp->lock, flags);
return; return;
} }
...@@ -1379,13 +1383,6 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp) ...@@ -1379,13 +1383,6 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp)
static void __cpuinit rcu_online_cpu(int cpu) static void __cpuinit rcu_online_cpu(int cpu)
{ {
#ifdef CONFIG_NO_HZ
struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu);
rdtp->dynticks_nesting = 1;
rdtp->dynticks |= 1; /* need consecutive #s even for hotplug. */
rdtp->dynticks_nmi = (rdtp->dynticks_nmi + 1) & ~0x1;
#endif /* #ifdef CONFIG_NO_HZ */
rcu_init_percpu_data(cpu, &rcu_state); rcu_init_percpu_data(cpu, &rcu_state);
rcu_init_percpu_data(cpu, &rcu_bh_state); rcu_init_percpu_data(cpu, &rcu_bh_state);
open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
......
...@@ -66,11 +66,11 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc) ...@@ -66,11 +66,11 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc)
} }
EXPORT_SYMBOL(__percpu_counter_sum); EXPORT_SYMBOL(__percpu_counter_sum);
static struct lock_class_key percpu_counter_irqsafe; int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
struct lock_class_key *key)
int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
{ {
spin_lock_init(&fbc->lock); spin_lock_init(&fbc->lock);
lockdep_set_class(&fbc->lock, key);
fbc->count = amount; fbc->count = amount;
fbc->counters = alloc_percpu(s32); fbc->counters = alloc_percpu(s32);
if (!fbc->counters) if (!fbc->counters)
...@@ -82,17 +82,7 @@ int percpu_counter_init(struct percpu_counter *fbc, s64 amount) ...@@ -82,17 +82,7 @@ int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
#endif #endif
return 0; return 0;
} }
EXPORT_SYMBOL(percpu_counter_init); EXPORT_SYMBOL(__percpu_counter_init);
int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount)
{
int err;
err = percpu_counter_init(fbc, amount);
if (!err)
lockdep_set_class(&fbc->lock, &percpu_counter_irqsafe);
return err;
}
void percpu_counter_destroy(struct percpu_counter *fbc) void percpu_counter_destroy(struct percpu_counter *fbc)
{ {
......
...@@ -83,11 +83,11 @@ int prop_descriptor_init(struct prop_descriptor *pd, int shift) ...@@ -83,11 +83,11 @@ int prop_descriptor_init(struct prop_descriptor *pd, int shift)
pd->index = 0; pd->index = 0;
pd->pg[0].shift = shift; pd->pg[0].shift = shift;
mutex_init(&pd->mutex); mutex_init(&pd->mutex);
err = percpu_counter_init_irq(&pd->pg[0].events, 0); err = percpu_counter_init(&pd->pg[0].events, 0);
if (err) if (err)
goto out; goto out;
err = percpu_counter_init_irq(&pd->pg[1].events, 0); err = percpu_counter_init(&pd->pg[1].events, 0);
if (err) if (err)
percpu_counter_destroy(&pd->pg[0].events); percpu_counter_destroy(&pd->pg[0].events);
...@@ -193,7 +193,7 @@ int prop_local_init_percpu(struct prop_local_percpu *pl) ...@@ -193,7 +193,7 @@ int prop_local_init_percpu(struct prop_local_percpu *pl)
spin_lock_init(&pl->lock); spin_lock_init(&pl->lock);
pl->shift = 0; pl->shift = 0;
pl->period = 0; pl->period = 0;
return percpu_counter_init_irq(&pl->events, 0); return percpu_counter_init(&pl->events, 0);
} }
void prop_local_destroy_percpu(struct prop_local_percpu *pl) void prop_local_destroy_percpu(struct prop_local_percpu *pl)
......
This diff is collapsed.
...@@ -223,7 +223,7 @@ int bdi_init(struct backing_dev_info *bdi) ...@@ -223,7 +223,7 @@ int bdi_init(struct backing_dev_info *bdi)
bdi->max_prop_frac = PROP_FRAC_BASE; bdi->max_prop_frac = PROP_FRAC_BASE;
for (i = 0; i < NR_BDI_STAT_ITEMS; i++) { for (i = 0; i < NR_BDI_STAT_ITEMS; i++) {
err = percpu_counter_init_irq(&bdi->bdi_stat[i], 0); err = percpu_counter_init(&bdi->bdi_stat[i], 0);
if (err) if (err)
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment