Thread (8 messages) flat view 8 messages, 3 authors, 2021-03-16

Re: [PATCH] powerpc: Fix missing prototype problems for "arch/powerpc/kernel/setup_64.c"

From: Christophe Leroy <hidden>
Date: 2021-03-15 13:02:04


Le 15/03/2021 à 13:57, Cédric Le Goater a écrit :
On 3/15/21 1:48 PM, heying (H) wrote:
quoted
在 2021/3/15 20:17, Christophe Leroy 写道:
quoted
You subject doesn't match the content of the patch.
OK. I'll adapt that.
quoted
Le 15/03/2021 à 13:04, He Ying a écrit :
quoted
The variables 'uaccess_fulsh' and 'entry_flush' are not referenced
outside the file. So define them as static to avoid the warnings.

And add a prototype for the function 'panic_smp_self_stop' for the
same purpose.

Sparse also warns that 'rfi_flush' should be static. However, it's
referenced outside the file.
To clear that warning, you have to include asm/security_features.h, rfi_flush is declared there.
Do you mean that I should include this header in arch/powerpc/kernel/setup_64.c?
yes.
quoted
quoted
quoted
The warnings about the file reported by sparse are as follows:
arch/powerpc/kernel/setup_64.c:422:6: warning: symbol 'panic_smp_self_stop' was not declared. Should it be static?
arch/powerpc/kernel/setup_64.c:951:6: warning: symbol 'rfi_flush' was not declared. Should it be static?
arch/powerpc/kernel/setup_64.c:952:6: warning: symbol 'entry_flush' was not declared. Should it be static?
arch/powerpc/kernel/setup_64.c:953:6: warning: symbol 'uaccess_flush' was not declared. Should it be static?

Reported-by: Hulk Robot <redacted>
Signed-off-by: He Ying <redacted>
---
   arch/powerpc/kernel/setup_64.c | 6 ++++--
   1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 560ed8b975e7..603aacd8527b 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -71,6 +71,8 @@
     #include "setup.h"
   +extern void panic_smp_self_stop(void);
+
For function prototypes 'extern' is unneeded and deprecated.

And function prototypes should go in an header file.

panic_smp_self_stop() is called from kernel/panic.c , it should be declared in one of the generic linux header files I think.
Yes, you're right. But I have no idea which header it should be declared in. May I have your suggestions?
arch/powerpc/include/asm/bug.h looks like a good place.
Why declaring it in a powerpc header ?

It's a weak function defined in core part of kernel (kernel/panic.c).

I think it should go in a common header, just like for instance arch_thaw_secondary_cpus_begin()
C.
quoted
quoted
quoted
   int spinning_secondaries;
   u64 ppc64_pft_size;
   @@ -949,8 +951,8 @@ static bool no_rfi_flush;
   static bool no_entry_flush;
   static bool no_uaccess_flush;
   bool rfi_flush;
-bool entry_flush;
-bool uaccess_flush;
+static bool entry_flush;
+static bool uaccess_flush;
   DEFINE_STATIC_KEY_FALSE(uaccess_flush_key);
   EXPORT_SYMBOL(uaccess_flush_key);
.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help