treewide: Rename rcu_dereference_raw_notrace to _check
Subsystems (6)
PATCH 1/1 treewide: Rename rcu_dereference_raw_notrace to _check
The rcu_dereference_raw_notrace() API name is confusing. It is equivalent to rcu_dereference_raw() except that it also does sparse pointer checking.
There are only a few users of rcu_dereference_raw_notrace(). This patches renames all of them to be rcu_dereference_raw_check with the "check" indicating sparse checking.
---
Previous discussion is here:
https://lore.kernel.org/linuxppc-dev/[email protected]/T/
Documentation/RCU/Design/Requirements/Requirements.html | 2 +- arch/powerpc/include/asm/kvm_book3s_64.h | 2 +- include/linux/rculist.h | 4 ++-- include/linux/rcupdate.h | 2 +- kernel/trace/ftrace_internal.h | 8 ++++---- kernel/trace/trace.c | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-)
Documentation/RCU/Design/Requirements/Requirements.html +1 -1
@@ -2514,7 +2514,7 @@ disabled across the entire RCU read-side critical section. <p> It is possible to use tracing on RCU code, but tracing itself uses RCU. -For this reason, <tt>rcu_dereference_raw_notrace()</tt> +For this reason, <tt>rcu_dereference_raw_check()</tt> is provided for use by tracing, which avoids the destructive recursion that could otherwise ensue. This API is also used by virtualization in some architectures,
arch/powerpc/include/asm/kvm_book3s_64.h +1 -1
@@ -546,7 +546,7 @@ static inline void note_hpte_modification(struct kvm *kvm,*/ static inline struct kvm_memslots *kvm_memslots_raw (struct kvm *kvm) { -return rcu_dereference_raw_notrace (kvm->memslots[0 ]); +return rcu_dereference_raw_check (kvm->memslots[0 ]); }extern void kvmppc_mmu_debugfs_init (struct kvm *kvm);
include/linux/rculist.h +2 -2
@@ -642,10 +642,10 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,* not do any RCU debugging or tracing. */ #define hlist_for_each_entry_rcu_notrace (pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw_notrace(hlist_first_rcu(head)),\ + for (pos = hlist_entry_safe (rcu_dereference_raw_check(hlist_first_rcu(head)),\ typeof(*(pos)), member); \ pos; \ - pos = hlist_entry_safe(rcu_dereference_raw_notrace(hlist_next_rcu(\ + pos = hlist_entry_safe(rcu_dereference_raw_check(hlist_next_rcu(\ &(pos)->member)), typeof(*(pos)), member))/**
include/linux/rcupdate.h +1 -1
@@ -478,7 +478,7 @@ do { \* The no-tracing version of rcu_dereference_raw() must not call * rcu_read_lock_held(). */ -#define rcu_dereference_raw_notrace (p) __rcu_dereference_check((p), 1, __rcu) +#define rcu_dereference_raw_check (p) __rcu_dereference_check((p), 1, __rcu)/** * rcu_dereference_protected() - fetch RCU pointer when updates prevented
kernel/trace/ftrace_internal.h +4 -4
@@ -6,22 +6,22 @@/* * Traverse the ftrace_global_list, invoking all entries. The reason that we -* can use rcu_dereference_raw_notrace() is that elements removed from this list +* can use rcu_dereference_raw_check() is that elements removed from this list * are simply leaked, so there is no need to interact with a grace-period -* mechanism. The rcu_dereference_raw_notrace() calls are needed to handle +* mechanism. The rcu_dereference_raw_check() calls are needed to handle * concurrent insertions into the ftrace_global_list. * * Silly Alpha and silly pointer-speculation compiler optimizations! */ #define do_for_each_ftrace_op (op, list) \ - op = rcu_dereference_raw_notrace(list); \ + op = rcu_dereference_raw_check(list); \ do/* * Optimized for just a single item in the list (as that is the normal case). */ #define while_for_each_ftrace_op (op) \ - while (likely(op = rcu_dereference_raw_notrace((op)->next)) && \ + while (likely(op = rcu_dereference_raw_check((op)->next)) && \ unlikely((op) != &ftrace_list_end))extern struct ftrace_ops __rcu *ftrace_ops_list;
kernel/trace/trace.c +2 -2
@@ -2642,10 +2642,10 @@ static void ftrace_exports(struct ring_buffer_event *event)preempt_disable_notrace (); - export =rcu_dereference_raw_notrace (ftrace_exports_list); + export =rcu_dereference_raw_check (ftrace_exports_list);while (export) {trace_process_export (export, event); - export =rcu_dereference_raw_notrace (export->next); + export =rcu_dereference_raw_check (export->next); }preempt_enable_notrace ();
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
Quoted 10 lines · Joel Fernandes (Google)
The
rcu_dereference_raw_notrace()API name is confusing. It is equivalent torcu_dereference_raw()except that it also does sparse pointer checking.There are only a few users of
rcu_dereference_raw_notrace(). This patches renames all of them to bercu_dereference_raw_checkwith the "check" indicating sparse checking.Signed-off-by Joel Fernandes (Google) <[email protected]>
There also these _notrace things but I am Ok with leaving them alone for now:hash_for_each_possible_rcu_notrace hlist_for_each_entry_rcu_notrace
- Joel
Quoted 9 lines · Joel Fernandes (Google)
The
rcu_dereference_raw_notrace()API name is confusing. It is equivalent torcu_dereference_raw()except that it also does sparse pointer checking.There are only a few users of
rcu_dereference_raw_notrace(). This patches renames all of them to bercu_dereference_raw_checkwith the "check" indicating sparse checking.Signed-off-by Joel Fernandes (Google) <[email protected]>
I queued this, but reworked the commit log and fixed a couple of irritating checkpatch issues that were in the original code. Does this work for you?
Thanx, Paul
------------------------------------------------------------------------
commit bd5c0fea6016c90cf7a9eb0435cd0c373dfdac2f
Author: Joel Fernandes (Google) <[email protected]> Date: Thu Jul 11 16:45:41 2019 -0400
treewide: Rename rcu_dereference_raw_notrace() to _check()
The rcu_dereference_raw_notrace() API name is confusing. It is equivalent to rcu_dereference_raw() except that it also does sparse pointer checking.
There are only a few users of rcu_dereference_raw_notrace(). This patches renames all of them to be rcu_dereference_raw_check() with the "_check()" indicating sparse checking.
Documentation/RCU/Design/Requirements/Requirements.html +1 -1
@@ -2514,7 +2514,7 @@ disabled across the entire RCU read-side critical section. <p> It is possible to use tracing on RCU code, but tracing itself uses RCU. -For this reason, <tt>rcu_dereference_raw_notrace()</tt> +For this reason, <tt>rcu_dereference_raw_check()</tt> is provided for use by tracing, which avoids the destructive recursion that could otherwise ensue. This API is also used by virtualization in some architectures,
arch/powerpc/include/asm/kvm_book3s_64.h +1 -1
@@ -546,7 +546,7 @@ static inline void note_hpte_modification(struct kvm *kvm,*/ static inline struct kvm_memslots *kvm_memslots_raw (struct kvm *kvm) { -return rcu_dereference_raw_notrace (kvm->memslots[0 ]); +return rcu_dereference_raw_check (kvm->memslots[0 ]); }extern void kvmppc_mmu_debugfs_init (struct kvm *kvm);
include/linux/rculist.h +3 -3
@@ -622,7 +622,7 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,* as long as the traversal is guarded by rcu_read_lock(). */ #define hlist_for_each_entry_rcu (pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ + for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\ typeof(*(pos)), member); \ pos; \ pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
@@ -642,10 +642,10 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,* not do any RCU debugging or tracing. */ #define hlist_for_each_entry_rcu_notrace (pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw_notrace(hlist_first_rcu(head)),\ + for (pos = hlist_entry_safe(rcu_dereference_raw_check(hlist_first_rcu(head)),\ typeof(*(pos)), member); \ pos; \ - pos = hlist_entry_safe(rcu_dereference_raw_notrace(hlist_next_rcu(\ + pos = hlist_entry_safe(rcu_dereference_raw_check(hlist_next_rcu(\ &(pos)->member)), typeof(*(pos)), member))/**
include/linux/rcupdate.h +1 -1
@@ -478,7 +478,7 @@ do { \* The no-tracing version of rcu_dereference_raw() must not call * rcu_read_lock_held(). */ -#define rcu_dereference_raw_notrace (p) __rcu_dereference_check((p), 1, __rcu) +#define rcu_dereference_raw_check (p) __rcu_dereference_check((p), 1, __rcu)/** * rcu_dereference_protected() - fetch RCU pointer when updates prevented
kernel/trace/ftrace_internal.h +4 -4
@@ -6,22 +6,22 @@/* * Traverse the ftrace_global_list, invoking all entries. The reason that we -* can use rcu_dereference_raw_notrace() is that elements removed from this list +* can use rcu_dereference_raw_check() is that elements removed from this list * are simply leaked, so there is no need to interact with a grace-period -* mechanism. The rcu_dereference_raw_notrace() calls are needed to handle +* mechanism. The rcu_dereference_raw_check() calls are needed to handle * concurrent insertions into the ftrace_global_list. * * Silly Alpha and silly pointer-speculation compiler optimizations! */ #define do_for_each_ftrace_op (op, list) \ - op = rcu_dereference_raw_notrace(list); \ + op = rcu_dereference_raw_check(list); \ do/* * Optimized for just a single item in the list (as that is the normal case). */ #define while_for_each_ftrace_op (op) \ - while (likely(op = rcu_dereference_raw_notrace((op)->next)) && \ + while (likely(op = rcu_dereference_raw_check((op)->next)) && \ unlikely((op) != &ftrace_list_end))extern struct ftrace_ops __rcu *ftrace_ops_list;
kernel/trace/trace.c +2 -2
@@ -2642,10 +2642,10 @@ static void ftrace_exports(struct ring_buffer_event *event)preempt_disable_notrace (); - export =rcu_dereference_raw_notrace (ftrace_exports_list); + export =rcu_dereference_raw_check (ftrace_exports_list);while (export) {trace_process_export (export, event); - export =rcu_dereference_raw_notrace (export->next); + export =rcu_dereference_raw_check (export->next); }preempt_enable_notrace ();
Quoted 9 lines · Paul E. McKenney
Quoted 8 lines · Joel Fernandes (Google)
The
rcu_dereference_raw_notrace()API name is confusing. It is equivalent torcu_dereference_raw()except that it also does sparse pointer checking.There are only a few users of
rcu_dereference_raw_notrace(). This patches renames all of them to bercu_dereference_raw_checkwith the "check" indicating sparse checking.
Quoted 5 lines
Quoted 1 line
Signed-off-by Joel Fernandes (Google) <[email protected]>I queued this, but reworked the commit log and fixed a couple of irritating checkpatch issues that were in the original code. Does this work for you?
Thanks, yes it looks good to me.
thanks,
- Joel
Quoted 135 lines
Thanx, Paul
------------------------------------------------------------------------
commit
bd5c0fea6016c90cf7a9eb0435cd0c373dfdac2fAuthor: Joel Fernandes (Google) <[email protected]> Date: Thu Jul 11 16:45:41 2019 -0400treewide: Rename
rcu_dereference_raw_notrace()to_check()The
rcu_dereference_raw_notrace()API name is confusing. It is equivalent torcu_dereference_raw()except that it also does sparse pointer checking.There are only a few users of
rcu_dereference_raw_notrace(). This patches renames all of them to bercu_dereference_raw_check()with the "_check()" indicating sparse checking.Signed-off-by Joel Fernandes (Google) <[email protected]>[ paulmck: Fix checkpatch warnings about parentheses. ]Signed-off-by Paul E. McKenney <[email protected]>Documentation/RCU/Design/Requirements/Requirements.html +1
-1@@ -2514,7 +2514,7 @@ disabled across the entire RCU read-side critical section. <p> It is possible to use tracing on RCU code, but tracing itself uses RCU. -For this reason, <tt>rcu_dereference_raw_notrace()</tt> +For this reason, <tt>rcu_dereference_raw_check()</tt> is provided for use by tracing, which avoids the destructive recursion that could otherwise ensue. This API is also used by virtualization in some architectures,arch/powerpc/include/asm/kvm_book3s_64.h +1
-1@@ -546,7 +546,7 @@ static inline void note_hpte_modification(struct kvm *kvm,*/ static inline struct kvm_memslots *kvm_memslots_raw (struct kvm *kvm) { -return rcu_dereference_raw_notrace (kvm->memslots[0 ]); +return rcu_dereference_raw_check (kvm->memslots[0 ]); }extern void kvmppc_mmu_debugfs_init (struct kvm *kvm);include/linux/rculist.h +3
-3@@ -622,7 +622,7 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,* as long as the traversal is guarded by rcu_read_lock(). */ #define hlist_for_each_entry_rcu (pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ + for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\ typeof(*(pos)), member); \ pos; \ pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\@@ -642,10 +642,10 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,* not do any RCU debugging or tracing. */ #define hlist_for_each_entry_rcu_notrace (pos, head, member) \ - for (pos = hlist_entry_safe (rcu_dereference_raw_notrace(hlist_first_rcu(head)),\ + for (pos = hlist_entry_safe(rcu_dereference_raw_check(hlist_first_rcu(head)),\ typeof(*(pos)), member); \ pos; \ - pos = hlist_entry_safe(rcu_dereference_raw_notrace(hlist_next_rcu(\ + pos = hlist_entry_safe(rcu_dereference_raw_check(hlist_next_rcu(\ &(pos)->member)), typeof(*(pos)), member))/** include/linux/rcupdate.h +1
-1@@ -478,7 +478,7 @@ do { \* The no-tracing version of rcu_dereference_raw() must not call * rcu_read_lock_held(). */ -#define rcu_dereference_raw_notrace (p) __rcu_dereference_check((p), 1, __rcu) +#define rcu_dereference_raw_check (p) __rcu_dereference_check((p), 1, __rcu)/** * rcu_dereference_protected() - fetch RCU pointer when updates prevented kernel/trace/ftrace_internal.h +4
-4@@ -6,22 +6,22 @@/* * Traverse the ftrace_global_list, invoking all entries. The reason that we -* can use rcu_dereference_raw_notrace() is that elements removed from this list +* can use rcu_dereference_raw_check() is that elements removed from this list * are simply leaked, so there is no need to interact with a grace-period -* mechanism. The rcu_dereference_raw_notrace() calls are needed to handle +* mechanism. The rcu_dereference_raw_check() calls are needed to handle * concurrent insertions into the ftrace_global_list. * * Silly Alpha and silly pointer-speculation compiler optimizations! */ #define do_for_each_ftrace_op (op, list) \ - op = rcu_dereference_raw_notrace(list); \ + op = rcu_dereference_raw_check(list); \ do/* * Optimized for just a single item in the list (as that is the normal case). */ #define while_for_each_ftrace_op (op) \ - while (likely(op = rcu_dereference_raw_notrace((op)->next)) && \ + while (likely(op = rcu_dereference_raw_check((op)->next)) && \ unlikely((op) != &ftrace_list_end))extern struct ftrace_ops __rcu *ftrace_ops_list;kernel/trace/trace.c +2
-2@@ -2642,10 +2642,10 @@ static void ftrace_exports(struct ring_buffer_event *event)preempt_disable_notrace (); - export =rcu_dereference_raw_notrace (ftrace_exports_list); + export =rcu_dereference_raw_check (ftrace_exports_list);while (export) {trace_process_export (export, event); - export =rcu_dereference_raw_notrace (export->next); + export =rcu_dereference_raw_check (export->next); }preempt_enable_notrace ();