Skip to content

Commit 9893770

Browse files
sravnborgandreas-gaisler
authored andcommitted
sparc64: Fix number of online CPUs
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: 9b2f753 is the first bad commit commit 9b2f753 Author: Atish Patra <[email protected]> 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 <[email protected]> Fixes: 9b2f753 ("sparc64: Fix cpu_possible_mask if nr_cpus is set") Reported-by: Nick Bowler <[email protected]> Tested-by: Nick Bowler <[email protected]> Link: https://lore.kernel.org/sparclinux/[email protected]/ Link: https://lore.kernel.org/all/CADyTPEwt=ZNams+1bpMB1F9w_vUdPsGCt92DBQxxq_VtaLoTdw@mail.gmail.com/ Cc: [email protected] # v4.8+ Cc: Andreas Larsson <[email protected]> Cc: David S. Miller <[email protected]> Cc: Atish Patra <[email protected]> Cc: Bob Picco <[email protected]> Cc: Vijay Kumar <[email protected]> Cc: David S. Miller <[email protected]> Reviewed-by: Andreas Larsson <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andreas Larsson <[email protected]>
1 parent 95706e7 commit 9893770

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

arch/sparc/include/asm/smp_64.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask);
4747
int hard_smp_processor_id(void);
4848
#define raw_smp_processor_id() (current_thread_info()->cpu)
4949

50-
void smp_fill_in_cpu_possible_map(void);
5150
void smp_fill_in_sib_core_maps(void);
5251
void __noreturn cpu_play_dead(void);
5352

@@ -77,7 +76,6 @@ void __cpu_die(unsigned int cpu);
7776
#define smp_fill_in_sib_core_maps() do { } while (0)
7877
#define smp_fetch_global_regs() do { } while (0)
7978
#define smp_fetch_global_pmu() do { } while (0)
80-
#define smp_fill_in_cpu_possible_map() do { } while (0)
8179
#define smp_init_cpu_poke() do { } while (0)
8280
#define scheduler_poke() do { } while (0)
8381

arch/sparc/kernel/prom_64.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ static void *record_one_cpu(struct device_node *dp, int cpuid, int arg)
483483
ncpus_probed++;
484484
#ifdef CONFIG_SMP
485485
set_cpu_present(cpuid, true);
486-
set_cpu_possible(cpuid, true);
486+
487+
if (num_possible_cpus() < nr_cpu_ids)
488+
set_cpu_possible(cpuid, true);
487489
#endif
488490
return NULL;
489491
}

arch/sparc/kernel/setup_64.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ void __init setup_arch(char **cmdline_p)
671671

672672
paging_init();
673673
init_sparc64_elf_hwcap();
674-
smp_fill_in_cpu_possible_map();
675674
/*
676675
* Once the OF device tree and MDESC have been setup and nr_cpus has
677676
* been parsed, we know the list of possible cpus. Therefore we can

arch/sparc/kernel/smp_64.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,20 +1216,6 @@ void __init smp_setup_processor_id(void)
12161216
xcall_deliver_impl = hypervisor_xcall_deliver;
12171217
}
12181218

1219-
void __init smp_fill_in_cpu_possible_map(void)
1220-
{
1221-
int possible_cpus = num_possible_cpus();
1222-
int i;
1223-
1224-
if (possible_cpus > nr_cpu_ids)
1225-
possible_cpus = nr_cpu_ids;
1226-
1227-
for (i = 0; i < possible_cpus; i++)
1228-
set_cpu_possible(i, true);
1229-
for (; i < NR_CPUS; i++)
1230-
set_cpu_possible(i, false);
1231-
}
1232-
12331219
void smp_fill_in_sib_core_maps(void)
12341220
{
12351221
unsigned int i;

0 commit comments

Comments
 (0)