cleanups
Subsystems (7)
cover cleanups
Jules Irenge (5):
rcu/rcutorture: replace 0 with false
rcu: replace 1 with true
rcu: replace + with |
x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and
ftrace_arch_code_modify_post_process()
sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf()
arch/x86/kernel/ftrace.c | 2 ++ drivers/net/ethernet/sfc/ef10.c | 1 + kernel/rcu/rcutorture.c | 2 +- kernel/rcu/tree_plugin.h | 22 +++++++++++----------- kernel/rcu/update.c | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-)
Signature · 1 line
2.18.2
PATCH 1/5 rcu/rcutorture: replace 0 with false
Coccinelle reports a warning
WARNING: Assignment of 0/1 to bool variable
The root cause is the variable lastphase is of bool type is initialised with integer 0 Replacing 0 with false fixes the issue.
--- kernel/rcu/rcutorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
@@ -2065,7 +2065,7 @@ static void rcu_torture_barrier1cb(void *rcu_void)static int rcu_torture_barrier_cbs (void *arg) {long myid = (long )arg; -bool lastphase =0 ; +bool lastphase = false;bool newphase;struct rcu_head rcu;
Signature · 1 line
2.18.2
PATCH 2/5 rcu: replace 1 with true
In reply to Jules IrengeCoccinelle reports a warning
WARNING: Assignment of 0/1 to bool variable
The root cause is the variable rcu_boot_ended of bool type is initialised with integer 1 Replacing 1 with true fixes the issue.
--- kernel/rcu/update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/update.c +1 -1
@@ -193,7 +193,7 @@ void rcu_end_inkernel_boot(void)rcu_unexpedite_gp ();if (rcu_normal_after_boot)WRITE_ONCE (rcu_normal,1 ); - rcu_boot_ended =1 ; + rcu_boot_ended = true; }/*
Signature · 1 line
2.18.2
PATCH 3/5 rcu: replace + with |
In reply to Jules IrengeCoccinelle reports warnings at rcu_preempt_ctxt_queue()
WARNING: sum of probable bitmasks, consider |
The root cause is the use of addition operator + for bitmask defined macros variables Replacing + with | fixes the issue.
--- kernel/rcu/tree_plugin.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
kernel/rcu/tree_plugin.h +11 -11
@@ -153,9 +153,9 @@ static void rcu_preempt_ctxt_queue(struct rcu_node *rnp, struct rcu_data *rdp)switch (blkd_state) {case 0 :case RCU_EXP_TASKS : -case RCU_EXP_TASKS +RCU_GP_BLKD : +case RCU_EXP_TASKS |RCU_GP_BLKD :case RCU_GP_TASKS : -case RCU_GP_TASKS +RCU_EXP_TASKS : +case RCU_GP_TASKS |RCU_EXP_TASKS :/* * Blocking neither GP, or first task blocking the normal
@@ -168,10 +168,10 @@ static void rcu_preempt_ctxt_queue(struct rcu_node *rnp, struct rcu_data *rdp)case RCU_EXP_BLKD :case RCU_GP_BLKD : -case RCU_GP_BLKD +RCU_EXP_BLKD : -case RCU_GP_TASKS +RCU_EXP_BLKD : -case RCU_GP_TASKS +RCU_GP_BLKD +RCU_EXP_BLKD : -case RCU_GP_TASKS +RCU_EXP_TASKS +RCU_GP_BLKD +RCU_EXP_BLKD : +case RCU_GP_BLKD |RCU_EXP_BLKD : +case RCU_GP_TASKS |RCU_EXP_BLKD : +case RCU_GP_TASKS |RCU_GP_BLKD |RCU_EXP_BLKD : +case RCU_GP_TASKS |RCU_EXP_TASKS |RCU_GP_BLKD |RCU_EXP_BLKD :/* * First task arriving that blocks either GP, or first task
@@ -184,9 +184,9 @@ static void rcu_preempt_ctxt_queue(struct rcu_node *rnp, struct rcu_data *rdp)list_add_tail (&t->rcu_node_entry, &rnp->blkd_tasks);break ; -case RCU_EXP_TASKS +RCU_EXP_BLKD : -case RCU_EXP_TASKS +RCU_GP_BLKD +RCU_EXP_BLKD : -case RCU_GP_TASKS +RCU_EXP_TASKS +RCU_EXP_BLKD : +case RCU_EXP_TASKS |RCU_EXP_BLKD : +case RCU_EXP_TASKS |RCU_GP_BLKD |RCU_EXP_BLKD : +case RCU_GP_TASKS |RCU_EXP_TASKS |RCU_EXP_BLKD :/* * Second or subsequent task blocking the expedited GP.
@@ -197,8 +197,8 @@ static void rcu_preempt_ctxt_queue(struct rcu_node *rnp, struct rcu_data *rdp)list_add (&t->rcu_node_entry, rnp->exp_tasks);break ; -case RCU_GP_TASKS +RCU_GP_BLKD : -case RCU_GP_TASKS +RCU_EXP_TASKS +RCU_GP_BLKD : +case RCU_GP_TASKS |RCU_GP_BLKD : +case RCU_GP_TASKS |RCU_EXP_TASKS |RCU_GP_BLKD :/* * Second or subsequent task blocking the normal GP.
Signature · 1 line
2.18.2
PATCH 4/5 x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
In reply to Jules IrengeSparse reports warnings
warning: context imbalance in ftrace_arch_code_modify_prepare()
- wrong count at exit
warning: context imbalance in ftrace_arch_code_modify_post_process()
- wrong count at exit
The root cause is that even if
the annotations on the function are correct,
mutex do not support annotation
This makes Sparse to complain.
To fix this,__acquire(&text_mutex) and
__release(&text_mutex) annotations are added
inside ftrace_arch_code_modify_prepare()
and ftrace_arch_code_modify_post_process()
respectively.
--- arch/x86/kernel/ftrace.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/ftrace.c +2 -0
@@ -46,6 +46,7 @@ int ftrace_arch_code_modify_prepare(void)* ftrace has it set to "read/write". */ mutex_lock (&text_mutex); +__acquire (&text_mutex); ftrace_poke_late =1 ;return 0 ; }
@@ -61,6 +62,7 @@ int ftrace_arch_code_modify_post_process(void)text_poke_finish (); ftrace_poke_late =0 ;mutex_unlock (&text_mutex); +__release (&text_mutex);return 0 ; }
Signature · 1 line
2.18.2
Re: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
Quoted 7 lines · On Mon, 1 Jun 2020 19:45:51 +0100 Jules Irenge <[email protected]> wrote:
Sparse reports warnings
warning: context imbalance in
ftrace_arch_code_modify_prepare()
- wrong count at exit
warning: context imbalance inftrace_arch_code_modify_post_process()
- wrong count at exit
Quoted 10 lines
The root cause is that even if
the annotations on the function are correct,
mutex do not support annotation
This makes Sparse to complain.
To fix this,__acquire(&text_mutex)and
__release(&text_mutex)annotations are added
insideftrace_arch_code_modify_prepare()
andftrace_arch_code_modify_post_process()
respectively.
Wait what? This looks like either a bug in sparse, or we just remove the annotations. This just makes the code ugly, and looks silly.
Nack!
-- Steve
Quoted 26 lines
Signed-off-by Jules Irenge <[email protected]>--- arch/x86/kernel/ftrace.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kernel/ftrace.c +2
-0@@ -46,6 +46,7 @@ int ftrace_arch_code_modify_prepare(void)* ftrace has it set to "read/write". */ mutex_lock (&text_mutex); +__acquire (&text_mutex); ftrace_poke_late =1 ;return 0 ; }@@ -61,6 +62,7 @@ int ftrace_arch_code_modify_post_process(void)text_poke_finish (); ftrace_poke_late =0 ;mutex_unlock (&text_mutex); +__release (&text_mutex);return 0 ; }
Re: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
Quoted 21 lines · Steven Rostedt
Quoted 7 lines · On Mon, 1 Jun 2020 19:45:51 +0100 Jules Irenge <[email protected]> wrote:
Sparse reports warnings
warning: context imbalance in
ftrace_arch_code_modify_prepare()
- wrong count at exit
warning: context imbalance inftrace_arch_code_modify_post_process()
- wrong count at exitQuoted 10 lines
The root cause is that even if
the annotations on the function are correct,
mutex do not support annotation
This makes Sparse to complain.
To fix this,__acquire(&text_mutex)and
__release(&text_mutex)annotations are added
insideftrace_arch_code_modify_prepare()
andftrace_arch_code_modify_post_process()
respectively.
Quoted 9 lines
Wait what? This looks like either a bug in sparse, or we just remove the annotations. This just makes the code ugly, and looks silly.
Nack!
-- Steve
Thanks for the feedback, I take good note.
Jules
Re: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
In reply to Steven RostedtQuoted 5 lines · Steven Rostedt
Quoted 2 lines · On Mon, 1 Jun 2020 19:45:51 +0100 Jules Irenge <[email protected]> wrote:
Sparse reports warnings
Quoted 8 lines
Quoted 8 lines
warning: context imbalance in
ftrace_arch_code_modify_prepare()
- wrong count at exit
warning: context imbalance inftrace_arch_code_modify_post_process()
- wrong count at exitThe root cause is that even if
the annotations on the function are correct,
mutex do not support annotation
Yes.
Quoted 2 lines
Wait what? This looks like either a bug in sparse, or we just remove the annotations. This just makes the code ugly, and looks silly.
The annotations added by commit
074376ac0e1d ("ftrace/x86: Anotate text_mutex split between ...
are indeed wrong (because they don't match what the functions are really doing / mutex operations have never been annotated). The're also pointless since their prototypes are un-annotated.
-- Luc
Re: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
Quoted 17 lines · Luc Van Oostenryck
Quoted 5 lines · Steven Rostedt
Quoted 2 lines · On Mon, 1 Jun 2020 19:45:51 +0100 Jules Irenge <[email protected]> wrote:
Sparse reports warnings
Quoted 8 lines
Quoted 8 lines
warning: context imbalance in
ftrace_arch_code_modify_prepare()
- wrong count at exit
warning: context imbalance inftrace_arch_code_modify_post_process()
- wrong count at exitThe root cause is that even if
the annotations on the function are correct,
mutex do not support annotationYes.
Quoted 8 lines
Quoted 2 lines
Wait what? This looks like either a bug in sparse, or we just remove the annotations. This just makes the code ugly, and looks silly.
The annotations added by commit
074376ac0e1d("ftrace/x86: Anotatetext_mutexsplit between ...
are indeed wrong (because they don't match what the functions are really doing / mutex operations have never been annotated). The're also pointless since their prototypes are un-annotated.
Interesting, I would think the best way would then be to remove the annotations. There are quite a number of them.
I will have to investigate more on mutex and annotation before moving forward.
Thanks for feedback.
Jules
PATCH 5/5 sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf()
In reply to Jules IrengeSparse reports a warning at efx_ef10_try_update_nic_stats_vf()
warning: context imbalance in efx_ef10_try_update_nic_stats_vf()
- unexpected unlock
The root cause is the missing annotation at efx_ef10_try_update_nic_stats_vf()
Add the missing _must_hold(&efx->stats_lock) annotation
--- drivers/net/ethernet/sfc/ef10.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/sfc/ef10.c +1 -0
@@ -1820,6 +1820,7 @@ static size_t efx_ef10_update_stats_pf(struct efx_nic *efx, u64 *full_stats, }static int efx_ef10_try_update_nic_stats_vf (struct efx_nic *efx) + __must_hold(&efx->stats_lock) {MCDI_DECLARE_BUF (inbuf,MC_CMD_MAC_STATS_IN_LEN );struct efx_ef10_nic_data *nic_data = efx->nic_data;
Signature · 1 line
2.18.2
Re: [PATCH 5/5] sfc: add missing annotation for efx_ef10_try_update_nic_stats_vf()
From: Jules Irenge <[email protected]>
Date: Mon, 1 Jun 2020 19:45:52 +0100
Quoted 8 lines
Sparse reports a warning at
efx_ef10_try_update_nic_stats_vf()
warning: context imbalance inefx_ef10_try_update_nic_stats_vf()
- unexpected unlock
The root cause is the missing annotation atefx_ef10_try_update_nic_stats_vf()
Add the missing_must_hold(&efx->stats_lock)annotationSigned-off-by Jules Irenge <[email protected]>
Applied.
Quoted 4 lines · Jules Irenge
Jules Irenge (5):
rcu/rcutorture: replace 0 with false
rcu: replace 1 with true
I queued these two, thank you!
Quoted 1 line
rcu: replace + with |
This one I am not all that excited about, so I am leaving it off.
Thanx, Paul
Quoted 14 lines
x86/ftrace: Add annotations for
ftrace_arch_code_modify_prepare()and
ftrace_arch_code_modify_post_process()
sfc: add missing annotation forefx_ef10_try_update_nic_stats_vf()arch/x86/kernel/ftrace.c | 2 ++ drivers/net/ethernet/sfc/ef10.c | 1 + kernel/rcu/rcutorture.c | 2 +- kernel/rcu/tree_plugin.h | 22 +++++++++++----------- kernel/rcu/update.c | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-)Signature · 1 line
2.18.2
Quoted 6 lines · Paul E. McKenney
Quoted 4 lines · Jules Irenge
Jules Irenge (5):
rcu/rcutorture: replace 0 with false
rcu: replace 1 with true
Quoted 7 lines
I queued these two, thank you!
Quoted 1 line
rcu: replace + with |
This one I am not all that excited about, so I am leaving it off.
Thanx, Paul
Thanks for the feedback.
Jules