powerpc/pseries: avoid harmless preempt warning
Nicholas Piggin
reviewerPATCH 1/1 powerpc/pseries: avoid harmless preempt warning
--- arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/lpar.c +9 -1
@@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {static int __init vcpudispatch_stats_procfs_init (void ) { -if (!lppaca_shared_proc (get_lppaca ())) +/* +* Avoid smp_processor_id while preemptible. All CPUs should have +* the same value for lppaca_shared_proc. +*/ +preempt_disable (); +if (!lppaca_shared_proc (get_lppaca ())) { +preempt_enable ();return 0 ; + } +preempt_enable ();if (!proc_create ("powerpc/vcpudispatch_stats" ,0600 ,NULL , &vcpudispatch_stats_proc_ops))
Signature · 1 line
2.23.0
Le 20/03/2020 à 16:24, Nicholas Piggin a écrit :
Quoted 14 lines
Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/powerpc/platforms/pseries/lpar.c +0
-1@@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {static int __init vcpudispatch_stats_procfs_init (void ) { -if (!lppaca_shared_proc (get_lppaca ()))
arch/powerpc/platforms/pseries/lpar.c static const struct proc_ops vcpudispatch_stats_freq_proc_ops = { · line 648
Quoted 10 lines
arch/powerpc/platforms/pseries/lpar.c +9
-0+/* +* Avoid smp_processor_id while preemptible. All CPUs should have +* the same value for lppaca_shared_proc. +*/ +preempt_disable (); +if (!lppaca_shared_proc (get_lppaca ())) { +preempt_enable ();return 0 ; + } +preempt_enable ();
Can we avoid the double preempt_enable() with something like:
preempt_disable(); is_shared = lppaca_shared_proc(get_lppaca()); preempt_enable(); if (!is_shared) return 0;
arch/powerpc/platforms/pseries/lpar.c static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
Quoted 4 lines
arch/powerpc/platforms/pseries/lpar.c +0
-0if (!proc_create ("powerpc/vcpudispatch_stats" ,0600 ,NULL , &vcpudispatch_stats_proc_ops))
Christophe
Nicholas Piggin
reviewerChristophe Leroy's on March 21, 2020 1:33 am:
Quoted 30 lines
Le 20/03/2020 à 16:24, Nicholas Piggin a écrit :
Quoted 14 lines
Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/powerpc/platforms/pseries/lpar.c +0
-1@@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {static int __init vcpudispatch_stats_procfs_init (void ) { -if (!lppaca_shared_proc (get_lppaca ()))arch/powerpc/platforms/pseries/lpar.c static const struct proc_ops vcpudispatch_stats_freq_proc_ops = { · line 648
Quoted 10 lines
arch/powerpc/platforms/pseries/lpar.c +9
-0+/* +* Avoid smp_processor_id while preemptible. All CPUs should have +* the same value for lppaca_shared_proc. +*/ +preempt_disable (); +if (!lppaca_shared_proc (get_lppaca ())) { +preempt_enable ();return 0 ; + } +preempt_enable ();Can we avoid the double
preempt_enable()with something like:
Quoted 5 lines
preempt_disable(); is_shared = lppaca_shared_proc(get_lppaca()); preempt_enable(); if (!is_shared) return 0;
I don't mind too much. Same number of lines.
Thanks,
Nick
Michael Ellerman
AppliedQuoted 1 line · Nicholas Piggin
Signed-off-by Nicholas Piggin <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/adde8715cf0571878d37fcb20595aad57b923bab
cheers