linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Add an asm-generic cpuinfo_op declaration
@ 2022-08-21 11:35 Conor Dooley
  2022-08-21 11:35 ` [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code Conor Dooley
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

RISC-V is missing a prototype for cpuinfo_op. Rather than adding yet
another `extern const struct seq_operations cpuinfo_op;` to an arch
specific header file, create an asm-generic variant and migrate the
existing arch variants there too. Obv. there are other archs that use
cpuinfo_op but don't declare it and surely also have the same warning?
I went for the minimum change here, but would be perfectly happy to
extend the change to all archs if this change is worthwhile. Or just
make a header in arch/riscv, any of the three work for me!

If this isn't the approach I should've gone for, any direction would
be great :) I tried pushing this last weekend to get LKP to test it but
I got neither a build success nor a build failure email from it, so
I figured I may as well just send the patches..

I wasn't too sure if this could be a single patch, so I split it out
into a patch fixing the issue on RISC-V & copy-paste patches for each
arch that I moved.

Thanks,
Conor.

Conor Dooley (6):
  asm-generic: add a cpuinfo_ops definition in shared code
  microblaze: use the asm-generic version of cpuinfo_op
  s390: use the asm-generic version of cpuinfo_op
  sh: use the asm-generic version of cpuinfo_op
  sparc: use the asm-generic version of cpuinfo_op
  x86: use the asm-generic version of cpuinfo_op

 arch/microblaze/include/asm/processor.h | 2 +-
 arch/riscv/include/asm/processor.h      | 1 +
 arch/s390/include/asm/processor.h       | 2 +-
 arch/sh/include/asm/processor.h         | 2 +-
 arch/sparc/include/asm/cpudata.h        | 3 +--
 arch/x86/include/asm/processor.h        | 2 +-
 include/asm-generic/processor.h         | 7 +++++++
 7 files changed, 13 insertions(+), 6 deletions(-)
 create mode 100644 include/asm-generic/processor.h

-- 
2.37.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-21 11:44   ` Conor.Dooley
  2022-08-21 11:35 ` [PATCH 2/6] microblaze: use the asm-generic version of cpuinfo_op Conor Dooley
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

On RISC-V sparse complains that:
arch/riscv/kernel/cpu.c:204:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?

Sure, it could be dumped into asm/processor.h like other archs have
done, but putting it in an asm-generic header seems to be a saner
strategy.

Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/riscv/include/asm/processor.h | 1 +
 include/asm-generic/processor.h    | 7 +++++++
 2 files changed, 8 insertions(+)
 create mode 100644 include/asm-generic/processor.h

diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h
index 19eedd4af4cd..dd2c9a382192 100644
--- a/arch/riscv/include/asm/processor.h
+++ b/arch/riscv/include/asm/processor.h
@@ -9,6 +9,7 @@
 #include <linux/const.h>
 
 #include <vdso/processor.h>
+#include <asm-generic/processor.h>
 
 #include <asm/ptrace.h>
 
diff --git a/include/asm-generic/processor.h b/include/asm-generic/processor.h
new file mode 100644
index 000000000000..2ec9af562e9b
--- /dev/null
+++ b/include/asm-generic/processor.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_PROCESSOR_H
+#define __ASM_PROCESSOR_H
+
+extern const struct seq_operations cpuinfo_op;
+
+#endif /* __ASM_PROCESSOR_H */
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] microblaze: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
  2022-08-21 11:35 ` [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-21 11:35 ` [PATCH 3/6] s390: " Conor Dooley
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/microblaze/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index 7e9e92670df3..45a86692e90f 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -13,10 +13,10 @@
 #include <asm/registers.h>
 #include <asm/entry.h>
 #include <asm/current.h>
+#include <asm-generic/processor.h>
 
 # ifndef __ASSEMBLY__
 /* from kernel/cpu/mb.c */
-extern const struct seq_operations cpuinfo_op;
 
 # define cpu_relax()		barrier()
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] s390: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
  2022-08-21 11:35 ` [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code Conor Dooley
  2022-08-21 11:35 ` [PATCH 2/6] microblaze: use the asm-generic version of cpuinfo_op Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-21 11:35 ` [PATCH 4/6] sh: " Conor Dooley
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/s390/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index bd66f8e34949..48d2332a5899 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -41,6 +41,7 @@
 #include <asm/fpu/types.h>
 #include <asm/fpu/internal.h>
 #include <asm/irqflags.h>
+#include <asm-generic/processor.h>
 
 typedef long (*sys_call_ptr_t)(struct pt_regs *regs);
 
@@ -80,7 +81,6 @@ void s390_adjust_jiffies(void);
 void s390_update_cpu_mhz(void);
 void cpu_detect_mhz_feature(void);
 
-extern const struct seq_operations cpuinfo_op;
 extern void execve_tail(void);
 extern void __bpon(void);
 unsigned long vdso_size(void);
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] sh: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
                   ` (2 preceding siblings ...)
  2022-08-21 11:35 ` [PATCH 3/6] s390: " Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-21 11:35 ` [PATCH 5/6] sparc: " Conor Dooley
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/sh/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 85a6c1c3c16e..4125494515c9 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -4,6 +4,7 @@
 
 #include <asm/cpu-features.h>
 #include <asm/cache.h>
+#include <asm-generic/processor.h>
 
 #ifndef __ASSEMBLY__
 /*
@@ -123,7 +124,6 @@ extern unsigned int mem_init_done;
 
 /* arch/sh/kernel/setup.c */
 const char *get_cpu_subtype(struct sh_cpuinfo *c);
-extern const struct seq_operations cpuinfo_op;
 
 /* thread_struct flags */
 #define SH_THREAD_UAC_NOPRINT	(1 << 0)
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
                   ` (3 preceding siblings ...)
  2022-08-21 11:35 ` [PATCH 4/6] sh: " Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-26 14:47   ` Sam Ravnborg
  2022-08-21 11:35 ` [PATCH 6/6] x86: " Conor Dooley
  2022-08-22  9:36 ` [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Geert Uytterhoeven
  6 siblings, 1 reply; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/sparc/include/asm/cpudata.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index d213165ee713..af6ef3c028a9 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -6,8 +6,7 @@
 
 #include <linux/threads.h>
 #include <linux/percpu.h>
-
-extern const struct seq_operations cpuinfo_op;
+#include <asm-generic/processor.h>
 
 #endif /* !(__ASSEMBLY__) */
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] x86: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
                   ` (4 preceding siblings ...)
  2022-08-21 11:35 ` [PATCH 5/6] sparc: " Conor Dooley
@ 2022-08-21 11:35 ` Conor Dooley
  2022-08-22  9:36 ` [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Geert Uytterhoeven
  6 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2022-08-21 11:35 UTC (permalink / raw)
  To: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann
  Cc: Geert Uytterhoeven, Conor Dooley, Kees Cook, Peter Zijlstra,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

From: Conor Dooley <conor.dooley@microchip.com>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
 arch/x86/include/asm/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 356308c73951..175b0e750675 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -27,6 +27,7 @@ struct vm86;
 #include <asm/unwind_hints.h>
 #include <asm/vmxfeatures.h>
 #include <asm/vdso/processor.h>
+#include <asm-generic/processor.h>
 
 #include <linux/personality.h>
 #include <linux/cache.h>
@@ -188,7 +189,6 @@ DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
 #define cpu_data(cpu)		boot_cpu_data
 #endif
 
-extern const struct seq_operations cpuinfo_op;
 
 #define cache_line_size()	(boot_cpu_data.x86_cache_alignment)
 
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code
  2022-08-21 11:35 ` [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code Conor Dooley
@ 2022-08-21 11:44   ` Conor.Dooley
  0 siblings, 0 replies; 14+ messages in thread
From: Conor.Dooley @ 2022-08-21 11:44 UTC (permalink / raw)
  To: mail, monstr, paul.walmsley, palmer, aou, hca, gor, agordeev,
	borntraeger, svens, ysato, dalias, davem, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd
  Cc: geert, keescook, peterz, linux-kernel, linux-riscv, linux-s390,
	linux-sh, sparclinux, linux-arch

On 21/08/2022 12:35, Conor Dooley wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> asm-generic: add a cpuinfo_ops definition in shared code

Meh, bad subject..
Obviously not going to respin right away for that.

> 
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> On RISC-V sparse complains that:
> arch/riscv/kernel/cpu.c:204:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?
> 
> Sure, it could be dumped into asm/processor.h like other archs have
> done, but putting it in an asm-generic header seems to be a saner
> strategy.
> 
> Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>  arch/riscv/include/asm/processor.h | 1 +
>  include/asm-generic/processor.h    | 7 +++++++
>  2 files changed, 8 insertions(+)
>  create mode 100644 include/asm-generic/processor.h
> 
> diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h
> index 19eedd4af4cd..dd2c9a382192 100644
> --- a/arch/riscv/include/asm/processor.h
> +++ b/arch/riscv/include/asm/processor.h
> @@ -9,6 +9,7 @@
>  #include <linux/const.h>
> 
>  #include <vdso/processor.h>
> +#include <asm-generic/processor.h>
> 
>  #include <asm/ptrace.h>
> 
> diff --git a/include/asm-generic/processor.h b/include/asm-generic/processor.h
> new file mode 100644
> index 000000000000..2ec9af562e9b
> --- /dev/null
> +++ b/include/asm-generic/processor.h
> @@ -0,0 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __ASM_PROCESSOR_H
> +#define __ASM_PROCESSOR_H
> +
> +extern const struct seq_operations cpuinfo_op;
> +
> +#endif /* __ASM_PROCESSOR_H */
> --
> 2.37.1
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add an asm-generic cpuinfo_op declaration
  2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
                   ` (5 preceding siblings ...)
  2022-08-21 11:35 ` [PATCH 6/6] x86: " Conor Dooley
@ 2022-08-22  9:36 ` Geert Uytterhoeven
  2022-08-22 10:05   ` Conor.Dooley
  6 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2022-08-22  9:36 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, the arch/x86 maintainers,
	H . Peter Anvin, Arnd Bergmann, Conor Dooley, Kees Cook,
	Peter Zijlstra, Linux Kernel Mailing List, linux-riscv,
	linux-s390, Linux-sh list, sparclinux, Linux-Arch

Hi Conor,

On Sun, Aug 21, 2022 at 1:36 PM Conor Dooley <mail@conchuod.ie> wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> RISC-V is missing a prototype for cpuinfo_op. Rather than adding yet
> another `extern const struct seq_operations cpuinfo_op;` to an arch
> specific header file, create an asm-generic variant and migrate the
> existing arch variants there too. Obv. there are other archs that use
> cpuinfo_op but don't declare it and surely also have the same warning?
> I went for the minimum change here, but would be perfectly happy to
> extend the change to all archs if this change is worthwhile. Or just
> make a header in arch/riscv, any of the three work for me!
>
> If this isn't the approach I should've gone for, any direction would
> be great :) I tried pushing this last weekend to get LKP to test it but
> I got neither a build success nor a build failure email from it, so
> I figured I may as well just send the patches..
>
> I wasn't too sure if this could be a single patch, so I split it out
> into a patch fixing the issue on RISC-V & copy-paste patches for each
> arch that I moved.

Thanks for your series!

> Conor Dooley (6):
>   asm-generic: add a cpuinfo_ops definition in shared code
>   microblaze: use the asm-generic version of cpuinfo_op
>   s390: use the asm-generic version of cpuinfo_op
>   sh: use the asm-generic version of cpuinfo_op
>   sparc: use the asm-generic version of cpuinfo_op
>   x86: use the asm-generic version of cpuinfo_op
>
>  arch/microblaze/include/asm/processor.h | 2 +-
>  arch/riscv/include/asm/processor.h      | 1 +
>  arch/s390/include/asm/processor.h       | 2 +-
>  arch/sh/include/asm/processor.h         | 2 +-
>  arch/sparc/include/asm/cpudata.h        | 3 +--
>  arch/x86/include/asm/processor.h        | 2 +-
>  include/asm-generic/processor.h         | 7 +++++++
>  7 files changed, 13 insertions(+), 6 deletions(-)
>  create mode 100644 include/asm-generic/processor.h

I was a bit surprised not to find fs/proc/cpuinfo.c in the diffstat
above. That file already has an external declaration for cpuinfo_op,
and uses it rather unconditionally (that is, if CONFIG_PROC_FS=y)
on all architectures.

So I think you can just move that to include/linux/processor.h, include
the latter everywhere, and drop all architecture-specific copies.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add an asm-generic cpuinfo_op declaration
  2022-08-22  9:36 ` [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Geert Uytterhoeven
@ 2022-08-22 10:05   ` Conor.Dooley
  2022-08-22 10:45     ` Geert Uytterhoeven
  0 siblings, 1 reply; 14+ messages in thread
From: Conor.Dooley @ 2022-08-22 10:05 UTC (permalink / raw)
  To: geert, mail
  Cc: monstr, paul.walmsley, palmer, aou, hca, gor, agordeev,
	borntraeger, svens, ysato, dalias, davem, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, keescook, peterz, linux-kernel,
	linux-riscv, linux-s390, linux-sh, sparclinux, linux-arch

On 22/08/2022 10:36, Geert Uytterhoeven wrote:
> On Sun, Aug 21, 2022 at 1:36 PM Conor Dooley <mail@conchuod.ie> wrote:
>>   arch/microblaze/include/asm/processor.h | 2 +-
>>   arch/riscv/include/asm/processor.h      | 1 +
>>   arch/s390/include/asm/processor.h       | 2 +-
>>   arch/sh/include/asm/processor.h         | 2 +-
>>   arch/sparc/include/asm/cpudata.h        | 3 +--
>>   arch/x86/include/asm/processor.h        | 2 +-
>>   include/asm-generic/processor.h         | 7 +++++++
>>   7 files changed, 13 insertions(+), 6 deletions(-)
>>   create mode 100644 include/asm-generic/processor.h
> 
> I was a bit surprised not to find fs/proc/cpuinfo.c in the diffstat
> above. That file already has an external declaration for cpuinfo_op,
> and uses it rather unconditionally (that is, if CONFIG_PROC_FS=y)
> on all architectures.
> 
> So I think you can just move that to include/linux/processor.h, include
> the latter everywhere, and drop all architecture-specific copies.

Hey Geert,
This is the sort of thing I was really hoping to hear, so fine by
me.. When you say "everywhere", I assume you mean in every arch
and not just the ones listed here that already have it in an arch
specific header?

Thanks,
Conor.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Add an asm-generic cpuinfo_op declaration
  2022-08-22 10:05   ` Conor.Dooley
@ 2022-08-22 10:45     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2022-08-22 10:45 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Conor Dooley, Michal Simek, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, the arch/x86 maintainers,
	H. Peter Anvin, Arnd Bergmann, Kees Cook, Peter Zijlstra,
	Linux Kernel Mailing List, linux-riscv, linux-s390,
	Linux-sh list, sparclinux, Linux-Arch

Hi Conor,

On Mon, Aug 22, 2022 at 12:05 PM <Conor.Dooley@microchip.com> wrote:
> On 22/08/2022 10:36, Geert Uytterhoeven wrote:
> > On Sun, Aug 21, 2022 at 1:36 PM Conor Dooley <mail@conchuod.ie> wrote:
> >>   arch/microblaze/include/asm/processor.h | 2 +-
> >>   arch/riscv/include/asm/processor.h      | 1 +
> >>   arch/s390/include/asm/processor.h       | 2 +-
> >>   arch/sh/include/asm/processor.h         | 2 +-
> >>   arch/sparc/include/asm/cpudata.h        | 3 +--
> >>   arch/x86/include/asm/processor.h        | 2 +-
> >>   include/asm-generic/processor.h         | 7 +++++++
> >>   7 files changed, 13 insertions(+), 6 deletions(-)
> >>   create mode 100644 include/asm-generic/processor.h
> >
> > I was a bit surprised not to find fs/proc/cpuinfo.c in the diffstat
> > above. That file already has an external declaration for cpuinfo_op,
> > and uses it rather unconditionally (that is, if CONFIG_PROC_FS=y)
> > on all architectures.
> >
> > So I think you can just move that to include/linux/processor.h, include
> > the latter everywhere, and drop all architecture-specific copies.
>
> This is the sort of thing I was really hoping to hear, so fine by
> me.. When you say "everywhere", I assume you mean in every arch
> and not just the ones listed here that already have it in an arch
> specific header?

Yes, above every user, to silence the sparse "foo was not
declared. Should it be static?" warnings.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op
  2022-08-21 11:35 ` [PATCH 5/6] sparc: " Conor Dooley
@ 2022-08-26 14:47   ` Sam Ravnborg
  2022-08-26 15:37     ` Conor.Dooley
  0 siblings, 1 reply; 14+ messages in thread
From: Sam Ravnborg @ 2022-08-26 14:47 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Michal Simek, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Yoshinori Sato,
	Rich Felker, David S . Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
	Arnd Bergmann, Geert Uytterhoeven, Conor Dooley, Kees Cook,
	Peter Zijlstra, linux-kernel, linux-riscv, linux-s390, linux-sh,
	sparclinux, linux-arch

Hi Conor.

Thanks for this nice simplification, but I think you can make it even
better.

On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> There's little point in duplicating the declaration of cpuinfo_op now
> that there's a shared version of it, so drop it & include the generic
> header.
> 
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>  arch/sparc/include/asm/cpudata.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> index d213165ee713..af6ef3c028a9 100644
> --- a/arch/sparc/include/asm/cpudata.h
> +++ b/arch/sparc/include/asm/cpudata.h
> @@ -6,8 +6,7 @@
>  
>  #include <linux/threads.h>
>  #include <linux/percpu.h>
> -
> -extern const struct seq_operations cpuinfo_op;
> +#include <asm-generic/processor.h>

Since the header file did not need <asm-generic/processor.h> then it
should not need it now after deleting stuff.
The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
where we have the user of it.

A header file should include what it needs, and no more.

I looked only at this patch, this comment may also be relevant for the
other patches.

	Sam

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op
  2022-08-26 14:47   ` Sam Ravnborg
@ 2022-08-26 15:37     ` Conor.Dooley
  2022-08-26 17:41       ` Sam Ravnborg
  0 siblings, 1 reply; 14+ messages in thread
From: Conor.Dooley @ 2022-08-26 15:37 UTC (permalink / raw)
  To: sam, mail
  Cc: monstr, paul.walmsley, palmer, aou, hca, gor, agordeev,
	borntraeger, svens, ysato, dalias, davem, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, geert, keescook, peterz,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

On 26/08/2022 15:47, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Conor.
> 
> Thanks for this nice simplification, but I think you can make it even
> better.
> 
> On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
>> From: Conor Dooley <conor.dooley@microchip.com>
>>
>> There's little point in duplicating the declaration of cpuinfo_op now
>> that there's a shared version of it, so drop it & include the generic
>> header.
>>
>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>> ---
>>  arch/sparc/include/asm/cpudata.h | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
>> index d213165ee713..af6ef3c028a9 100644
>> --- a/arch/sparc/include/asm/cpudata.h
>> +++ b/arch/sparc/include/asm/cpudata.h
>> @@ -6,8 +6,7 @@
>>
>>  #include <linux/threads.h>
>>  #include <linux/percpu.h>
>> -
>> -extern const struct seq_operations cpuinfo_op;
>> +#include <asm-generic/processor.h>
> 
> Since the header file did not need <asm-generic/processor.h> then it
> should not need it now after deleting stuff.
> The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
> where we have the user of it.
> 
> A header file should include what it needs, and no more.
> 
> I looked only at this patch, this comment may also be relevant for the
> other patches.

Hey Sam, thanks for your feedback.
As per Geert's suggestion, submitted a v2:
https://lore.kernel.org/linux-riscv/20220825205942.1713914-1-mail@conchuod.ie/T/#u

In v2, I included linux/processor.h instead of an asm-generic header.
The diff for sparc became:

diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index d213165ee713..f7e690a7860b 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -7,8 +7,6 @@
 #include <linux/threads.h>
 #include <linux/percpu.h>
 
-extern const struct seq_operations cpuinfo_op;
-
 #endif /* !(__ASSEMBLY__) */
 
 #if defined(__sparc__) && defined(__arch64__)
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 79cd6ccfeac0..ffdc7a825b80 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -12,6 +12,7 @@
 #include <linux/smp.h>
 #include <linux/threads.h>
 #include <linux/pgtable.h>
+#include <linux/processor.h>
 
 #include <asm/spitfire.h>
 #include <asm/oplib.h>

Hopefully that is more appealing to you!
Thanks,
Conor.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op
  2022-08-26 15:37     ` Conor.Dooley
@ 2022-08-26 17:41       ` Sam Ravnborg
  0 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2022-08-26 17:41 UTC (permalink / raw)
  To: Conor.Dooley
  Cc: mail, monstr, paul.walmsley, palmer, aou, hca, gor, agordeev,
	borntraeger, svens, ysato, dalias, davem, tglx, mingo, bp,
	dave.hansen, x86, hpa, arnd, geert, keescook, peterz,
	linux-kernel, linux-riscv, linux-s390, linux-sh, sparclinux,
	linux-arch

On Fri, Aug 26, 2022 at 03:37:40PM +0000, Conor.Dooley@microchip.com wrote:
> On 26/08/2022 15:47, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Conor.
> > 
> > Thanks for this nice simplification, but I think you can make it even
> > better.
> > 
> > On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
> >> From: Conor Dooley <conor.dooley@microchip.com>
> >>
> >> There's little point in duplicating the declaration of cpuinfo_op now
> >> that there's a shared version of it, so drop it & include the generic
> >> header.
> >>
> >> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> >> ---
> >>  arch/sparc/include/asm/cpudata.h | 3 +--
> >>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> >> index d213165ee713..af6ef3c028a9 100644
> >> --- a/arch/sparc/include/asm/cpudata.h
> >> +++ b/arch/sparc/include/asm/cpudata.h
> >> @@ -6,8 +6,7 @@
> >>
> >>  #include <linux/threads.h>
> >>  #include <linux/percpu.h>
> >> -
> >> -extern const struct seq_operations cpuinfo_op;
> >> +#include <asm-generic/processor.h>
> > 
> > Since the header file did not need <asm-generic/processor.h> then it
> > should not need it now after deleting stuff.
> > The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
> > where we have the user of it.
> > 
> > A header file should include what it needs, and no more.
> > 
> > I looked only at this patch, this comment may also be relevant for the
> > other patches.
> 
> Hey Sam, thanks for your feedback.
> As per Geert's suggestion, submitted a v2:
> https://lore.kernel.org/linux-riscv/20220825205942.1713914-1-mail@conchuod.ie/T/#u
> 
> In v2, I included linux/processor.h instead of an asm-generic header.
> The diff for sparc became:
> 
> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> index d213165ee713..f7e690a7860b 100644
> --- a/arch/sparc/include/asm/cpudata.h
> +++ b/arch/sparc/include/asm/cpudata.h
> @@ -7,8 +7,6 @@
>  #include <linux/threads.h>
>  #include <linux/percpu.h>
>  
> -extern const struct seq_operations cpuinfo_op;
> -
>  #endif /* !(__ASSEMBLY__) */
>  
>  #if defined(__sparc__) && defined(__arch64__)
> diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
> index 79cd6ccfeac0..ffdc7a825b80 100644
> --- a/arch/sparc/kernel/cpu.c
> +++ b/arch/sparc/kernel/cpu.c
> @@ -12,6 +12,7 @@
>  #include <linux/smp.h>
>  #include <linux/threads.h>
>  #include <linux/pgtable.h>
> +#include <linux/processor.h>
>  
>  #include <asm/spitfire.h>
>  #include <asm/oplib.h>
> 
> Hopefully that is more appealing to you!
> Thanks,
> Conor.

Hi Conor - much better. Thanks.

	Sam

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-08-26 17:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-21 11:35 [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Conor Dooley
2022-08-21 11:35 ` [PATCH 1/6] asm-generic: add a cpuinfo_ops definition in shared code Conor Dooley
2022-08-21 11:44   ` Conor.Dooley
2022-08-21 11:35 ` [PATCH 2/6] microblaze: use the asm-generic version of cpuinfo_op Conor Dooley
2022-08-21 11:35 ` [PATCH 3/6] s390: " Conor Dooley
2022-08-21 11:35 ` [PATCH 4/6] sh: " Conor Dooley
2022-08-21 11:35 ` [PATCH 5/6] sparc: " Conor Dooley
2022-08-26 14:47   ` Sam Ravnborg
2022-08-26 15:37     ` Conor.Dooley
2022-08-26 17:41       ` Sam Ravnborg
2022-08-21 11:35 ` [PATCH 6/6] x86: " Conor Dooley
2022-08-22  9:36 ` [PATCH 0/6] Add an asm-generic cpuinfo_op declaration Geert Uytterhoeven
2022-08-22 10:05   ` Conor.Dooley
2022-08-22 10:45     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).