b4-sent.feeds.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes
@ 2024-03-30  9:57 Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 01/10] sparc64: Fix prototype warning for init_vdso_image Sam Ravnborg
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg,
	Atish Patra, stable, Bob Picco, Vijay Kumar

Nick Bowler reported that sparc64 failed to bring all his CPU's online,
and that turned out to be an easy fix.

The sparc64 build was rather noisy with a lot of warnings which had
irritated me enough to go ahead and fix them.
With this set of patches my arch/sparc/ is almost warning free for
all{no,yes,mod}config + defconfig builds.

There is one warning about "clone3 not implemented", which I have ignored.

The warning fixes hides the fact that sparc64 is not yet y2038 prepared,
and it would be preferable if someone knowledgeable would fix this
poperly.

All fixes looks like 6.9 material to me.

	Sam 

---
Sam Ravnborg (10):
      sparc64: Fix prototype warning for init_vdso_image
      sparc64: Fix prototype warnings in traps_64.c
      sparc64: Fix prototype warning for vmemmap_free
      sparc64: Fix prototype warning for alloc_irqstack_bootmem
      sparc64: Fix prototype warning for uprobe_trap
      sparc64: Fix prototype warning for dma_4v_iotsb_bind
      sparc64: Fix prototype warnings in adi_64.c
      sparc64: Fix prototype warning for sched_clock
      sparc64: Fix number of online CPUs
      sparc64: Fix prototype warnings for vdso

 arch/sparc/include/asm/smp_64.h  |  2 --
 arch/sparc/include/asm/vdso.h    | 10 ++++++++++
 arch/sparc/kernel/adi_64.c       | 14 +++++++-------
 arch/sparc/kernel/kernel.h       |  4 ++++
 arch/sparc/kernel/pci_sun4v.c    |  6 +++---
 arch/sparc/kernel/prom_64.c      |  4 +++-
 arch/sparc/kernel/setup_64.c     |  3 +--
 arch/sparc/kernel/smp_64.c       | 14 --------------
 arch/sparc/kernel/time_64.c      |  1 +
 arch/sparc/kernel/traps_64.c     | 10 +++++-----
 arch/sparc/kernel/uprobes.c      |  2 ++
 arch/sparc/mm/init_64.c          |  5 -----
 arch/sparc/vdso/vclock_gettime.c |  1 +
 arch/sparc/vdso/vma.c            |  5 +++--
 14 files changed, 40 insertions(+), 41 deletions(-)
---
base-commit: 84b76d05828a1909e20d0f66553b876b801f98c8
change-id: 20240329-sparc64-warnings-668cc90ef53b

Best regards,
-- 
Sam Ravnborg <sam@ravnborg.org>


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

* [PATCH 01/10] sparc64: Fix prototype warning for init_vdso_image
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 02/10] sparc64: Fix prototype warnings in traps_64.c Sam Ravnborg
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
arch/sparc/vdso/vma.c:246:12: warning: no previous prototype for ‘init_vdso_image’

init_vdso_image has no users outside vma.c, make it static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/vdso/vma.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/vdso/vma.c b/arch/sparc/vdso/vma.c
index 1bbf4335de45..bab7a59575e8 100644
--- a/arch/sparc/vdso/vma.c
+++ b/arch/sparc/vdso/vma.c
@@ -243,8 +243,9 @@ static int stick_patch(const struct vdso_image *image, struct vdso_elfinfo *e, b
  * Allocate pages for the vdso and vvar, and copy in the vdso text from the
  * kernel image.
  */
-int __init init_vdso_image(const struct vdso_image *image,
-			   struct vm_special_mapping *vdso_mapping, bool elf64)
+static int __init init_vdso_image(const struct vdso_image *image,
+				  struct vm_special_mapping *vdso_mapping,
+				  bool elf64)
 {
 	int cnpages = (image->size) / PAGE_SIZE;
 	struct page *dp, **dpp = NULL;

-- 
2.34.1


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

* [PATCH 02/10] sparc64: Fix prototype warnings in traps_64.c
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 01/10] sparc64: Fix prototype warning for init_vdso_image Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 03/10] sparc64: Fix prototype warning for vmemmap_free Sam Ravnborg
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warnings:
arch/sparc/kernel/traps_64.c:253:6: warning: no previous prototype for ‘is_no_fault_exception’
arch/sparc/kernel/traps_64.c:2035:6: warning: no previous prototype for ‘do_mcd_err’
rch/sparc/kernel/traps_64.c:2153:6: warning: no previous prototype for ‘sun4v_nonresum_error_user_handled’

In all cases make the function static as there were no users outside
traps_64.c

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/traps_64.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index dd048023bff5..28cb0d66ab40 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -250,7 +250,7 @@ void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, u
 	sun4v_insn_access_exception(regs, addr, type_ctx);
 }
 
-bool is_no_fault_exception(struct pt_regs *regs)
+static bool is_no_fault_exception(struct pt_regs *regs)
 {
 	unsigned char asi;
 	u32 insn;
@@ -2032,7 +2032,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
 /* Handle memory corruption detected error which is vectored in
  * through resumable error trap.
  */
-void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
+static void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
 {
 	if (notify_die(DIE_TRAP, "MCD error", regs, 0, 0x34,
 		       SIGSEGV) == NOTIFY_STOP)
@@ -2150,9 +2150,9 @@ static unsigned long sun4v_get_vaddr(struct pt_regs *regs)
 /* Attempt to handle non-resumable errors generated from userspace.
  * Returns true if the signal was handled, false otherwise.
  */
-bool sun4v_nonresum_error_user_handled(struct pt_regs *regs,
-				  struct sun4v_error_entry *ent) {
-
+static bool sun4v_nonresum_error_user_handled(struct pt_regs *regs,
+					      struct sun4v_error_entry *ent)
+{
 	unsigned int attrs = ent->err_attrs;
 
 	if (attrs & SUN4V_ERR_ATTRS_MEMORY) {

-- 
2.34.1


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

* [PATCH 03/10] sparc64: Fix prototype warning for vmemmap_free
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 01/10] sparc64: Fix prototype warning for init_vdso_image Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 02/10] sparc64: Fix prototype warnings in traps_64.c Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 04/10] sparc64: Fix prototype warning for alloc_irqstack_bootmem Sam Ravnborg
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
arch/sparc/mm/init_64.c:2644:6: warning: no previous prototype for ‘vmemmap_free’

The function vmemmap_free() is only used for systems with
CONFIG_MEMORY_HOTPLUG defined - and sparc64 do not support this.
Drop the empty function as it has no users.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/mm/init_64.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index f83017992eaa..5444b515815a 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2640,11 +2640,6 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
 
 	return 0;
 }
-
-void vmemmap_free(unsigned long start, unsigned long end,
-		struct vmem_altmap *altmap)
-{
-}
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
 /* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */

-- 
2.34.1


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

* [PATCH 04/10] sparc64: Fix prototype warning for alloc_irqstack_bootmem
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (2 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 03/10] sparc64: Fix prototype warning for vmemmap_free Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 05/10] sparc64: Fix prototype warning for uprobe_trap Sam Ravnborg
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
arch/sparc/kernel/setup_64.c:602:13: warning: no previous prototype for ‘alloc_irqstack_bootmem’

The function alloc_irqstack_bootmem had no users outside setup_64.c so
declare it static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/setup_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 6a4797dec34b..1d519f18d2b2 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -599,7 +599,7 @@ static void __init init_sparc64_elf_hwcap(void)
 		pause_patch();
 }
 
-void __init alloc_irqstack_bootmem(void)
+static void __init alloc_irqstack_bootmem(void)
 {
 	unsigned int i, node;
 

-- 
2.34.1


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

* [PATCH 05/10] sparc64: Fix prototype warning for uprobe_trap
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (3 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 04/10] sparc64: Fix prototype warning for alloc_irqstack_bootmem Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 06/10] sparc64: Fix prototype warning for dma_4v_iotsb_bind Sam Ravnborg
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
arch/sparc/kernel/uprobes.c:237:17: warning: no previous prototype for ‘uprobe_trap’

Add a prototype to kernel/kernel.h to silence the warning.
This is a fix already used for other trap handlers.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/kernel.h  | 4 ++++
 arch/sparc/kernel/uprobes.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index a8fb7c0bf053..8328a3b78a44 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -40,6 +40,10 @@ int handle_popc(u32 insn, struct pt_regs *regs);
 void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
 void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
 
+/* uprobes.c */
+asmlinkage void uprobe_trap(struct pt_regs *regs,
+			    unsigned long trap_level);
+
 /* smp_64.c */
 void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs);
 void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs);
diff --git a/arch/sparc/kernel/uprobes.c b/arch/sparc/kernel/uprobes.c
index 1a0600206bf5..305017bec164 100644
--- a/arch/sparc/kernel/uprobes.c
+++ b/arch/sparc/kernel/uprobes.c
@@ -18,6 +18,8 @@
 
 #include <asm/cacheflush.h>
 
+#include "kernel.h"
+
 /* Compute the address of the breakpoint instruction and return it.
  *
  * Note that uprobe_get_swbp_addr is defined as a weak symbol in

-- 
2.34.1


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

* [PATCH 06/10] sparc64: Fix prototype warning for dma_4v_iotsb_bind
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (4 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 05/10] sparc64: Fix prototype warning for uprobe_trap Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 07/10] sparc64: Fix prototype warnings in adi_64.c Sam Ravnborg
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
sparc/kernel/pci_sun4v.c:259:15: warning: no previous prototype for ‘dma_4v_iotsb_bind’

The function dma_4v_iotsb_bind is not used outside the file, so declare
it static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/pci_sun4v.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 083e5f05a7f0..b720b21ccfbd 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -256,9 +256,9 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-unsigned long dma_4v_iotsb_bind(unsigned long devhandle,
-				unsigned long iotsb_num,
-				struct pci_bus *bus_dev)
+static unsigned long dma_4v_iotsb_bind(unsigned long devhandle,
+				       unsigned long iotsb_num,
+				       struct pci_bus *bus_dev)
 {
 	struct pci_dev *pdev;
 	unsigned long err;

-- 
2.34.1


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

* [PATCH 07/10] sparc64: Fix prototype warnings in adi_64.c
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (5 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 06/10] sparc64: Fix prototype warning for dma_4v_iotsb_bind Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 08/10] sparc64: Fix prototype warning for sched_clock Sam Ravnborg
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warnings:
arch/sparc/kernel/adi_64.c:124:21: warning: no previous prototype for ‘find_tag_store’
arch/sparc/kernel/adi_64.c:156:21: warning: no previous prototype for ‘alloc_tag_store’
arch/sparc/kernel/adi_64.c:299:6: warning: no previous prototype for ‘del_tag_store’

None of the functions were used outside the file, so declare them static.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/adi_64.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/sparc/kernel/adi_64.c b/arch/sparc/kernel/adi_64.c
index ce332942de2d..e0e4fc527b24 100644
--- a/arch/sparc/kernel/adi_64.c
+++ b/arch/sparc/kernel/adi_64.c
@@ -121,9 +121,9 @@ void __init mdesc_adi_init(void)
 		mdesc_release(hp);
 }
 
-tag_storage_desc_t *find_tag_store(struct mm_struct *mm,
-				   struct vm_area_struct *vma,
-				   unsigned long addr)
+static tag_storage_desc_t *find_tag_store(struct mm_struct *mm,
+					  struct vm_area_struct *vma,
+					  unsigned long addr)
 {
 	tag_storage_desc_t *tag_desc = NULL;
 	unsigned long i, max_desc, flags;
@@ -153,9 +153,9 @@ tag_storage_desc_t *find_tag_store(struct mm_struct *mm,
 	return tag_desc;
 }
 
-tag_storage_desc_t *alloc_tag_store(struct mm_struct *mm,
-				    struct vm_area_struct *vma,
-				    unsigned long addr)
+static tag_storage_desc_t *alloc_tag_store(struct mm_struct *mm,
+					   struct vm_area_struct *vma,
+					   unsigned long addr)
 {
 	unsigned char *tags;
 	unsigned long i, size, max_desc, flags;
@@ -296,7 +296,7 @@ tag_storage_desc_t *alloc_tag_store(struct mm_struct *mm,
 	return tag_desc;
 }
 
-void del_tag_store(tag_storage_desc_t *tag_desc, struct mm_struct *mm)
+static void del_tag_store(tag_storage_desc_t *tag_desc, struct mm_struct *mm)
 {
 	unsigned long flags;
 	unsigned char *tags = NULL;

-- 
2.34.1


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

* [PATCH 08/10] sparc64: Fix prototype warning for sched_clock
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (6 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 07/10] sparc64: Fix prototype warnings in adi_64.c Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 09/10] sparc64: Fix number of online CPUs Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 10/10] sparc64: Fix prototype warnings for vdso Sam Ravnborg
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warning:
arch/sparc/kernel/time_64.c:880:20: warning: no previous prototype for ‘sched_clock’

Add the missing include to pick up the prototype.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/kernel/time_64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 89fb05f90609..60f1c8cc5363 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -33,6 +33,7 @@
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
 #include <linux/platform_device.h>
+#include <linux/sched/clock.h>
 #include <linux/ftrace.h>
 
 #include <asm/oplib.h>

-- 
2.34.1


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

* [PATCH 09/10] sparc64: Fix number of online CPUs
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (7 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 08/10] sparc64: Fix prototype warning for sched_clock Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  2024-03-30  9:57 ` [PATCH 10/10] sparc64: Fix prototype warnings for vdso Sam Ravnborg
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Atish Patra,
	Sam Ravnborg, stable, Bob Picco, Vijay Kumar

Nick Bowler reported:
    When using newer kernels on my Ultra 60 with dual 450MHz UltraSPARC-II
    CPUs, I noticed that only CPU 0 comes up, while older kernels (including
    4.7) are working fine with both CPUs.

      I bisected the failure to this commit:

      9b2f753ec23710aa32c0d837d2499db92fe9115b is the first bad commit
      commit 9b2f753ec23710aa32c0d837d2499db92fe9115b
      Author: Atish Patra <atish.patra@oracle.com>
      Date:   Thu Sep 15 14:54:40 2016 -0600

      sparc64: Fix cpu_possible_mask if nr_cpus is set

    This is a small change that reverts very easily on top of 5.18: there is
    just one trivial conflict.  Once reverted, both CPUs work again.

    Maybe this is related to the fact that the CPUs on this system are
    numbered CPU0 and CPU2 (there is no CPU1)?

The current code that adjust cpu_possible based on nr_cpu_ids do not
take into account that CPU's may not come one after each other.
Move the chech to the function that setup the cpu_possible mask
so there is no need to adjust it later.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Fixes: 9b2f753ec237 ("sparc64: Fix cpu_possible_mask if nr_cpus is set")
Reported-by: Nick Bowler <nbowler@draconx.ca>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Link: https://lore.kernel.org/sparclinux/20201009161924.c8f031c079dd852941307870@gmx.de/
Link: https://lore.kernel.org/all/CADyTPEwt=ZNams+1bpMB1F9w_vUdPsGCt92DBQxxq_VtaLoTdw@mail.gmail.com/
Cc: <stable@vger.kernel.org> # v4.8+
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Atish Patra <atish.patra@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
Cc: Vijay Kumar <vijay.ac.kumar@oracle.com>
Cc: David S. Miller <davem@davemloft.net>
---
 arch/sparc/include/asm/smp_64.h |  2 --
 arch/sparc/kernel/prom_64.c     |  4 +++-
 arch/sparc/kernel/setup_64.c    |  1 -
 arch/sparc/kernel/smp_64.c      | 14 --------------
 4 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 505b6700805d..0964fede0b2c 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -47,7 +47,6 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask);
 int hard_smp_processor_id(void);
 #define raw_smp_processor_id() (current_thread_info()->cpu)
 
-void smp_fill_in_cpu_possible_map(void);
 void smp_fill_in_sib_core_maps(void);
 void __noreturn cpu_play_dead(void);
 
@@ -77,7 +76,6 @@ void __cpu_die(unsigned int cpu);
 #define smp_fill_in_sib_core_maps() do { } while (0)
 #define smp_fetch_global_regs() do { } while (0)
 #define smp_fetch_global_pmu() do { } while (0)
-#define smp_fill_in_cpu_possible_map() do { } while (0)
 #define smp_init_cpu_poke() do { } while (0)
 #define scheduler_poke() do { } while (0)
 
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 998aa693d491..ba82884cb92a 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -483,7 +483,9 @@ static void *record_one_cpu(struct device_node *dp, int cpuid, int arg)
 	ncpus_probed++;
 #ifdef CONFIG_SMP
 	set_cpu_present(cpuid, true);
-	set_cpu_possible(cpuid, true);
+
+	if (num_possible_cpus() < nr_cpu_ids)
+		set_cpu_possible(cpuid, true);
 #endif
 	return NULL;
 }
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 1d519f18d2b2..63615f5c99b4 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -671,7 +671,6 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 	init_sparc64_elf_hwcap();
-	smp_fill_in_cpu_possible_map();
 	/*
 	 * Once the OF device tree and MDESC have been setup and nr_cpus has
 	 * been parsed, we know the list of possible cpus.  Therefore we can
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index f3969a3600db..e50c38eba2b8 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1220,20 +1220,6 @@ void __init smp_setup_processor_id(void)
 		xcall_deliver_impl = hypervisor_xcall_deliver;
 }
 
-void __init smp_fill_in_cpu_possible_map(void)
-{
-	int possible_cpus = num_possible_cpus();
-	int i;
-
-	if (possible_cpus > nr_cpu_ids)
-		possible_cpus = nr_cpu_ids;
-
-	for (i = 0; i < possible_cpus; i++)
-		set_cpu_possible(i, true);
-	for (; i < NR_CPUS; i++)
-		set_cpu_possible(i, false);
-}
-
 void smp_fill_in_sib_core_maps(void)
 {
 	unsigned int i;

-- 
2.34.1


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

* [PATCH 10/10] sparc64: Fix prototype warnings for vdso
  2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
                   ` (8 preceding siblings ...)
  2024-03-30  9:57 ` [PATCH 09/10] sparc64: Fix number of online CPUs Sam Ravnborg
@ 2024-03-30  9:57 ` Sam Ravnborg
  9 siblings, 0 replies; 11+ messages in thread
From: Sam Ravnborg @ 2024-03-30  9:57 UTC (permalink / raw
  To: Andreas Larsson, David S. Miller, sparclinux
  Cc: Nick Bowler, linux-kernel, Arnd Bergmann, Sam Ravnborg

Fix the following warnings:
arch/sparc/vdso/vclock_gettime.c:254:1: error: no previous prototype for ‘__vdso_clock_gettime’
arch/sparc/vdso/vclock_gettime.c:282:1: error: no previous prototype for ‘__vdso_clock_gettime_stick’
arch/sparc/vdso/vclock_gettime.c:307:1: error: no previous prototype for ‘__vdso_gettimeofday’
arch/sparc/vdso/vclock_gettime.c:343:1: error: no previous prototype for ‘__vdso_gettimeofday_stick’
arch/sparc/vdso/vdso32/../vclock_gettime.c:254:1: error: no previous prototype for ‘__vdso_clock_gettime’
arch/sparc/vdso/vdso32/../vclock_gettime.c:282:1: error: no previous prototype for ‘__vdso_clock_gettime_stick’
arch/sparc/vdso/vdso32/../vclock_gettime.c:307:1: error: no previous prototype for ‘__vdso_gettimeofday’
arch/sparc/vdso/vdso32/../vclock_gettime.c:343:1: error: no previous prototype for ‘__vdso_gettimeofday_stick’

The warnings were fixed by adding the proper prototypes to asm/vdso.h.
The better fix would be to convert sparc to be y2038 compliant so the
generic variant of vdso.h could be used.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 arch/sparc/include/asm/vdso.h    | 10 ++++++++++
 arch/sparc/vdso/vclock_gettime.c |  1 +
 2 files changed, 11 insertions(+)

diff --git a/arch/sparc/include/asm/vdso.h b/arch/sparc/include/asm/vdso.h
index 59e79d35cd73..af630cad185c 100644
--- a/arch/sparc/include/asm/vdso.h
+++ b/arch/sparc/include/asm/vdso.h
@@ -5,6 +5,16 @@
 #ifndef _ASM_SPARC_VDSO_H
 #define _ASM_SPARC_VDSO_H
 
+#include <linux/linkage.h>
+#include <linux/time.h>
+#include <linux/time_types.h>
+#include <linux/types.h>
+
+notrace int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts);
+notrace int __vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts);
+notrace int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
+notrace int __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz);
+
 struct vdso_image {
 	void *data;
 	unsigned long size;   /* Always a multiple of PAGE_SIZE */
diff --git a/arch/sparc/vdso/vclock_gettime.c b/arch/sparc/vdso/vclock_gettime.c
index e794edde6755..a3f85d9cea52 100644
--- a/arch/sparc/vdso/vclock_gettime.c
+++ b/arch/sparc/vdso/vclock_gettime.c
@@ -19,6 +19,7 @@
 #include <asm/unistd.h>
 #include <asm/timex.h>
 #include <asm/clocksource.h>
+#include <asm/vdso.h>
 #include <asm/vvar.h>
 
 #ifdef	CONFIG_SPARC64

-- 
2.34.1


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

end of thread, other threads:[~2024-03-30  9:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-30  9:57 [PATCH 00/10] sparc64: Fix CPU online bug and warning fixes Sam Ravnborg
2024-03-30  9:57 ` [PATCH 01/10] sparc64: Fix prototype warning for init_vdso_image Sam Ravnborg
2024-03-30  9:57 ` [PATCH 02/10] sparc64: Fix prototype warnings in traps_64.c Sam Ravnborg
2024-03-30  9:57 ` [PATCH 03/10] sparc64: Fix prototype warning for vmemmap_free Sam Ravnborg
2024-03-30  9:57 ` [PATCH 04/10] sparc64: Fix prototype warning for alloc_irqstack_bootmem Sam Ravnborg
2024-03-30  9:57 ` [PATCH 05/10] sparc64: Fix prototype warning for uprobe_trap Sam Ravnborg
2024-03-30  9:57 ` [PATCH 06/10] sparc64: Fix prototype warning for dma_4v_iotsb_bind Sam Ravnborg
2024-03-30  9:57 ` [PATCH 07/10] sparc64: Fix prototype warnings in adi_64.c Sam Ravnborg
2024-03-30  9:57 ` [PATCH 08/10] sparc64: Fix prototype warning for sched_clock Sam Ravnborg
2024-03-30  9:57 ` [PATCH 09/10] sparc64: Fix number of online CPUs Sam Ravnborg
2024-03-30  9:57 ` [PATCH 10/10] sparc64: Fix prototype warnings for vdso Sam Ravnborg

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 read-only IMAP folder(s) and NNTP newsgroup(s).