diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 12:23:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 12:23:07 -0400 |
commit | 3a3527b6461b1298cc53ce72f336346739297ac8 (patch) | |
tree | 30bea5dd7163f13d6c962888feaf53f50ead4cce /include | |
parent | cc77b4db0017dab014ad7ea3d297e10f5b5bf028 (diff) | |
parent | a53f4b61a76a7e95139b8e8abba02e9bfe87a58a (diff) |
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
Revert "net: Make accesses to ->br_port safe for sparse RCU"
mce: convert to rcu_dereference_index_check()
net: Make accesses to ->br_port safe for sparse RCU
vfs: add fs.h to define struct file
lockdep: Add an in_workqueue_context() lockdep-based test function
rcu: add __rcu API for later sparse checking
rcu: add an rcu_dereference_index_check()
tree/tiny rcu: Add debug RCU head objects
mm: remove all rcu head initializations
fs: remove all rcu head initializations, except on_stack initializations
powerpc: remove all rcu head initializations
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/compiler.h | 2 | ||||
-rw-r--r-- | include/linux/fdtable.h | 1 | ||||
-rw-r--r-- | include/linux/rcupdate.h | 82 | ||||
-rw-r--r-- | include/linux/workqueue.h | 4 |
4 files changed, 89 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index a5a472b10746..c1a62c56a660 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -16,6 +16,7 @@ | |||
16 | # define __release(x) __context__(x,-1) | 16 | # define __release(x) __context__(x,-1) |
17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) | 17 | # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) |
18 | # define __percpu __attribute__((noderef, address_space(3))) | 18 | # define __percpu __attribute__((noderef, address_space(3))) |
19 | # define __rcu | ||
19 | extern void __chk_user_ptr(const volatile void __user *); | 20 | extern void __chk_user_ptr(const volatile void __user *); |
20 | extern void __chk_io_ptr(const volatile void __iomem *); | 21 | extern void __chk_io_ptr(const volatile void __iomem *); |
21 | #else | 22 | #else |
@@ -34,6 +35,7 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
34 | # define __release(x) (void)0 | 35 | # define __release(x) (void)0 |
35 | # define __cond_lock(x,c) (c) | 36 | # define __cond_lock(x,c) (c) |
36 | # define __percpu | 37 | # define __percpu |
38 | # define __rcu | ||
37 | #endif | 39 | #endif |
38 | 40 | ||
39 | #ifdef __KERNEL__ | 41 | #ifdef __KERNEL__ |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index d147461bc271..f59ed297b661 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/rcupdate.h> | 11 | #include <linux/rcupdate.h> |
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/fs.h> | ||
14 | 15 | ||
15 | #include <asm/atomic.h> | 16 | #include <asm/atomic.h> |
16 | 17 | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index b653b4aaa8a6..9fbc54a2585d 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/seqlock.h> | 40 | #include <linux/seqlock.h> |
41 | #include <linux/lockdep.h> | 41 | #include <linux/lockdep.h> |
42 | #include <linux/completion.h> | 42 | #include <linux/completion.h> |
43 | #include <linux/debugobjects.h> | ||
43 | 44 | ||
44 | #ifdef CONFIG_RCU_TORTURE_TEST | 45 | #ifdef CONFIG_RCU_TORTURE_TEST |
45 | extern int rcutorture_runnable; /* for sysctl */ | 46 | extern int rcutorture_runnable; /* for sysctl */ |
@@ -79,6 +80,16 @@ extern void rcu_init(void); | |||
79 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 80 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
80 | } while (0) | 81 | } while (0) |
81 | 82 | ||
83 | /* | ||
84 | * init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic | ||
85 | * initialization and destruction of rcu_head on the stack. rcu_head structures | ||
86 | * allocated dynamically in the heap or defined statically don't need any | ||
87 | * initialization. | ||
88 | */ | ||
89 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD | ||
90 | extern void init_rcu_head_on_stack(struct rcu_head *head); | ||
91 | extern void destroy_rcu_head_on_stack(struct rcu_head *head); | ||
92 | #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
82 | static inline void init_rcu_head_on_stack(struct rcu_head *head) | 93 | static inline void init_rcu_head_on_stack(struct rcu_head *head) |
83 | { | 94 | { |
84 | } | 95 | } |
@@ -86,6 +97,7 @@ static inline void init_rcu_head_on_stack(struct rcu_head *head) | |||
86 | static inline void destroy_rcu_head_on_stack(struct rcu_head *head) | 97 | static inline void destroy_rcu_head_on_stack(struct rcu_head *head) |
87 | { | 98 | { |
88 | } | 99 | } |
100 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
89 | 101 | ||
90 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 102 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
91 | 103 | ||
@@ -517,4 +529,74 @@ extern void call_rcu(struct rcu_head *head, | |||
517 | extern void call_rcu_bh(struct rcu_head *head, | 529 | extern void call_rcu_bh(struct rcu_head *head, |
518 | void (*func)(struct rcu_head *head)); | 530 | void (*func)(struct rcu_head *head)); |
519 | 531 | ||
532 | /* | ||
533 | * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally | ||
534 | * by call_rcu() and rcu callback execution, and are therefore not part of the | ||
535 | * RCU API. Leaving in rcupdate.h because they are used by all RCU flavors. | ||
536 | */ | ||
537 | |||
538 | #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD | ||
539 | # define STATE_RCU_HEAD_READY 0 | ||
540 | # define STATE_RCU_HEAD_QUEUED 1 | ||
541 | |||
542 | extern struct debug_obj_descr rcuhead_debug_descr; | ||
543 | |||
544 | static inline void debug_rcu_head_queue(struct rcu_head *head) | ||
545 | { | ||
546 | debug_object_activate(head, &rcuhead_debug_descr); | ||
547 | debug_object_active_state(head, &rcuhead_debug_descr, | ||
548 | STATE_RCU_HEAD_READY, | ||
549 | STATE_RCU_HEAD_QUEUED); | ||
550 | } | ||
551 | |||
552 | static inline void debug_rcu_head_unqueue(struct rcu_head *head) | ||
553 | { | ||
554 | debug_object_active_state(head, &rcuhead_debug_descr, | ||
555 | STATE_RCU_HEAD_QUEUED, | ||
556 | STATE_RCU_HEAD_READY); | ||
557 | debug_object_deactivate(head, &rcuhead_debug_descr); | ||
558 | } | ||
559 | #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
560 | static inline void debug_rcu_head_queue(struct rcu_head *head) | ||
561 | { | ||
562 | } | ||
563 | |||
564 | static inline void debug_rcu_head_unqueue(struct rcu_head *head) | ||
565 | { | ||
566 | } | ||
567 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | ||
568 | |||
569 | #ifndef CONFIG_PROVE_RCU | ||
570 | #define __do_rcu_dereference_check(c) do { } while (0) | ||
571 | #endif /* #ifdef CONFIG_PROVE_RCU */ | ||
572 | |||
573 | #define __rcu_dereference_index_check(p, c) \ | ||
574 | ({ \ | ||
575 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | ||
576 | __do_rcu_dereference_check(c); \ | ||
577 | smp_read_barrier_depends(); \ | ||
578 | (_________p1); \ | ||
579 | }) | ||
580 | |||
581 | /** | ||
582 | * rcu_dereference_index_check() - rcu_dereference for indices with debug checking | ||
583 | * @p: The pointer to read, prior to dereferencing | ||
584 | * @c: The conditions under which the dereference will take place | ||
585 | * | ||
586 | * Similar to rcu_dereference_check(), but omits the sparse checking. | ||
587 | * This allows rcu_dereference_index_check() to be used on integers, | ||
588 | * which can then be used as array indices. Attempting to use | ||
589 | * rcu_dereference_check() on an integer will give compiler warnings | ||
590 | * because the sparse address-space mechanism relies on dereferencing | ||
591 | * the RCU-protected pointer. Dereferencing integers is not something | ||
592 | * that even gcc will put up with. | ||
593 | * | ||
594 | * Note that this function does not implicitly check for RCU read-side | ||
595 | * critical sections. If this function gains lots of uses, it might | ||
596 | * make sense to provide versions for each flavor of RCU, but it does | ||
597 | * not make sense as of early 2010. | ||
598 | */ | ||
599 | #define rcu_dereference_index_check(p, c) \ | ||
600 | __rcu_dereference_index_check((p), (c)) | ||
601 | |||
520 | #endif /* __LINUX_RCUPDATE_H */ | 602 | #endif /* __LINUX_RCUPDATE_H */ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 9466e860d8c2..d0f7c8178498 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -297,4 +297,8 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | |||
297 | #else | 297 | #else |
298 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); | 298 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); |
299 | #endif /* CONFIG_SMP */ | 299 | #endif /* CONFIG_SMP */ |
300 | |||
301 | #ifdef CONFIG_LOCKDEP | ||
302 | int in_workqueue_context(struct workqueue_struct *wq); | ||
303 | #endif | ||
300 | #endif | 304 | #endif |