srcu: Fix a misspelling in note
Subsystems (2)
PATCH 1/2 srcu: Fix a misspelling in note
--- include/linux/srcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/srcutree.h +1 -1
@@ -48,7 +48,7 @@ struct srcu_data {struct srcu_node {spinlock_t __private lock;unsigned long srcu_have_cbs[4 ];/* GP seq for children having CBs, but only */ -/* if greater than ->srcu_gq_seq. */ +/* if greater than ->srcu_gp_seq. */ unsigned long srcu_data_have_cbs[4 ];/* Which srcu_data structs have CBs for given GP? */ unsigned long srcu_gp_seq_needed_exp;/* Furthest future exp GP. */ struct srcu_node *srcu_parent;/* Next up in tree. */
Signature · 1 line
2.31.1
PATCH 2/2 srcu: Fix the comparision in srcu_invl_snp_seq()
A seq contains two fields: counter and state.
SRCU_SNP_INIT_SEQ is used as invalid initial value for srcu_node GP sequence numbers. Hence srcu_invl_snp_seq() should compare both fields of a seq.
--- kernel/rcu/srcutree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/srcutree.c +1 -1
@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ; }/*
Signature · 1 line
2.31.1
Re: [PATCH 2/2] srcu: Fix the comparision in srcu_invl_snp_seq()
Quoted 23 lines · Pingfan Liu
A seq contains two fields: counter and state.
SRCU_SNP_INIT_SEQis used as invalid initial value forsrcu_nodeGP sequence numbers. Hencesrcu_invl_snp_seq()should compare both fields of a seq.Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>--- kernel/rcu/srcutree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/rcu/srcutree.c +0
-0
kernel/rcu/srcutree.c static void init_srcu_struct_data(struct srcu_struct *ssp) · line 157
Quoted 5 lines
kernel/rcu/srcutree.c +1
-1@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ;
Doesn't hurt and makes it less confusing as it doesn't suggest anymore there _might_ be a gp number behind.
Quoted 6 lines
kernel/rcu/srcutree.c +0
-0}/* Signature · 1 line
2.31.1
Re: [PATCH 2/2] srcu: Fix the comparision in srcu_invl_snp_seq()
Quoted 33 lines · Frederic Weisbecker
Quoted 23 lines · Pingfan Liu
A seq contains two fields: counter and state.
SRCU_SNP_INIT_SEQis used as invalid initial value forsrcu_nodeGP sequence numbers. Hencesrcu_invl_snp_seq()should compare both fields of a seq.Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>--- kernel/rcu/srcutree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/rcu/srcutree.c +0
-0kernel/rcu/srcutree.c static void init_srcu_struct_data(struct srcu_struct *ssp) · line 157
Quoted 5 lines
kernel/rcu/srcutree.c +1
-1@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ;Doesn't hurt and makes it less confusing as it doesn't suggest anymore there _might_ be a gp number behind.
Quoted 1 line
Reviewed-by Frederic Weisbecker <[email protected]>
Good catch, thank you both!
My first reaction was that this patch was wrong, so I recorded the results of my investigation in the commit log. Please check below in case I messed something up.
Thanx, Paul
------------------------------------------------------------------------
commit 08d9c4f609afaf5c3032320d50f2bae4acdca314
Author: Pingfan Liu <[email protected]> Date: Wed Nov 16 09:52:44 2022 +0800
srcu: Fix the comparision in srcu_invl_snp_seq()
A grace-period sequence number contains two fields: counter and state. SRCU_SNP_INIT_SEQ provides a guaranteed invalid value for grace-period sequence numbers in newly allocated srcu_node structures' ->srcu_have_cbs[] and ->srcu_gp_seq_needed_exp fields. The point of the comparison in srcu_invl_snp_seq() is not to detect invalid grace-period sequence numbers in general, but rather to detect a newly allocated srcu_node structure whose ->srcu_have_cbs[] and ->srcu_gp_seq_needed_exp fields need to be brought into line with the srcu_struct structure's ->srcu_gp_seq field.
This commit therefore causes srcu_invl_snp_seq() to compare both fields of the specified grace-period sequence number.
kernel/rcu/srcutree.c +1 -1
@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ; }/*
Re: [PATCH 2/2] srcu: Fix the comparision in srcu_invl_snp_seq()
Quoted 35 lines · Paul E. McKenney
Quoted 33 lines · Frederic Weisbecker
Quoted 23 lines · Pingfan Liu
A seq contains two fields: counter and state.
SRCU_SNP_INIT_SEQis used as invalid initial value forsrcu_nodeGP sequence numbers. Hencesrcu_invl_snp_seq()should compare both fields of a seq.Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>--- kernel/rcu/srcutree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/rcu/srcutree.c +0
-0kernel/rcu/srcutree.c static void init_srcu_struct_data(struct srcu_struct *ssp) · line 157
Quoted 5 lines
kernel/rcu/srcutree.c +1
-1@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ;Doesn't hurt and makes it less confusing as it doesn't suggest anymore there _might_ be a gp number behind.
Quoted 8 lines
Quoted 1 line
Reviewed-by Frederic Weisbecker <[email protected]>Good catch, thank you both!
My first reaction was that this patch was wrong, so I recorded the results of my investigation in the commit log. Please check below in case I messed something up.
It looks more clear now. Thanks for improving the log.
Thanks,
Pingfan
Quoted 46 lines
Thanx, Paul
------------------------------------------------------------------------
commit
08d9c4f609afaf5c3032320d50f2bae4acdca314Author: Pingfan Liu <[email protected]> Date: Wed Nov 16 09:52:44 2022 +0800srcu: Fix the comparision in
srcu_invl_snp_seq()A grace-period sequence number contains two fields: counter and state.
SRCU_SNP_INIT_SEQprovides a guaranteed invalid value for grace-period sequence numbers in newly allocatedsrcu_nodestructures' ->srcu_have_cbs[] and ->srcu_gp_seq_needed_exp fields. The point of the comparison insrcu_invl_snp_seq()is not to detect invalid grace-period sequence numbers in general, but rather to detect a newly allocatedsrcu_nodestructure whose ->srcu_have_cbs[] and ->srcu_gp_seq_needed_exp fields need to be brought into line with thesrcu_structstructure's ->srcu_gp_seq field.This commit therefore causes
srcu_invl_snp_seq()to compare both fields of the specified grace-period sequence number.Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc <[email protected]>Reviewed-by Frederic Weisbecker <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>kernel/rcu/srcutree.c +1
-1@@ -154,7 +154,7 @@ static void init_srcu_struct_data(struct srcu_struct *ssp)*/ static inline bool srcu_invl_snp_seq (unsigned long s) { -return rcu_seq_state (s) ==SRCU_SNP_INIT_SEQ ; +return s ==SRCU_SNP_INIT_SEQ ; }/*
Hi,
Quoted 8 lines · Pingfan Liu
Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>
LGTM.
-Mukesh
Quoted 17 lines
--- include/linux/srcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/srcutree.h +1
-1@@ -48,7 +48,7 @@ struct srcu_data {struct srcu_node {spinlock_t __private lock;unsigned long srcu_have_cbs[4 ];/* GP seq for children having CBs, but only */ -/* if greater than ->srcu_gq_seq. */ +/* if greater than ->srcu_gp_seq. */ unsigned long srcu_data_have_cbs[4 ];/* Which srcu_data structs have CBs for given GP? */ unsigned long srcu_gp_seq_needed_exp;/* Furthest future exp GP. */ struct srcu_node *srcu_parent;/* Next up in tree. */
Quoted 17 lines · Pingfan Liu
Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>--- include/linux/srcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/srcutree.h +0
-0
include/linux/srcutree.h struct srcu_data { · line 51
Quoted 5 lines
include/linux/srcutree.h +1
-1@@ -48,7 +48,7 @@ struct srcu_data {struct srcu_node {spinlock_t __private lock;unsigned long srcu_have_cbs[4 ];/* GP seq for children having CBs, but only */ -/* if greater than ->srcu_gq_seq. */ +/* if greater than ->srcu_gp_seq. */
Sharp eye ;-)
Quoted 6 lines
include/linux/srcutree.h +0
-0unsigned long srcu_data_have_cbs[4 ];/* Which srcu_data structs have CBs for given GP? */ unsigned long srcu_gp_seq_needed_exp;/* Furthest future exp GP. */ struct srcu_node *srcu_parent;/* Next up in tree. */ Signature · 1 line
2.31.1
Paul E. McKenney
maintainerQuoted 26 lines · Frederic Weisbecker
Quoted 17 lines · Pingfan Liu
Signed-off-by Pingfan Liu <[email protected]>Cc Lai Jiangshan <[email protected]>Cc "Paul E. McKenney" <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Josh Triplett <[email protected]>Cc Steven Rostedt <[email protected]>Cc Mathieu Desnoyers <[email protected]>--- include/linux/srcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/srcutree.h +0
-0include/linux/srcutree.h struct srcu_data { · line 51
Quoted 5 lines
include/linux/srcutree.h +1
-1@@ -48,7 +48,7 @@ struct srcu_data {struct srcu_node {spinlock_t __private lock;unsigned long srcu_have_cbs[4 ];/* GP seq for children having CBs, but only */ -/* if greater than ->srcu_gq_seq. */ +/* if greater than ->srcu_gp_seq. */ Sharp eye ;-)
Quoted 1 line
Reviewed-by Frederic Weisbecker <[email protected]>
Applied with both Reviewed-by tags, thank you all!
Thanx, Paul
Quoted 6 lines
Quoted 6 lines
include/linux/srcutree.h +0
-0unsigned long srcu_data_have_cbs[4 ];/* Which srcu_data structs have CBs for given GP? */ unsigned long srcu_gp_seq_needed_exp;/* Furthest future exp GP. */ struct srcu_node *srcu_parent;/* Next up in tree. */ Signature · 1 line
2.31.1