Skip to content

Commit 810996a

Browse files
committed
Merge tag 'powerpc-6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix crashes on 85xx with some configs since the recent hugepd rework. - Fix boot warning with hugepages and CONFIG_DEBUG_VIRTUAL on some platforms. - Don't enable offline cores when changing SMT modes, to match existing userspace behaviour. Thanks to Christophe Leroy, Dr. David Alan Gilbert, Guenter Roeck, Nysal Jan K.A, Shrikanth Hegde, Thomas Gleixner, and Tyrel Datwyler. * tag 'powerpc-6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/topology: Check if a core is online cpu/SMT: Enable SMT only if a core is online powerpc/mm: Fix boot warning with hugepages and CONFIG_DEBUG_VIRTUAL powerpc/mm: Fix size of allocated PGDIR soc: fsl: qbman: remove unused struct 'cgr_comp'
2 parents e0fac5f + 227bbaa commit 810996a

File tree

7 files changed

+29
-11
lines changed

7 files changed

+29
-11
lines changed

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ Description: Control Symmetric Multi Threading (SMT)
562562
================ =========================================
563563

564564
If control status is "forceoff" or "notsupported" writes
565-
are rejected.
565+
are rejected. Note that enabling SMT on PowerPC skips
566+
offline cores.
566567

567568
What: /sys/devices/system/cpu/cpuX/power/energy_perf_bias
568569
Date: March 2019

arch/powerpc/include/asm/topology.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static inline int cpu_to_coregroup_id(int cpu)
145145

146146
#ifdef CONFIG_HOTPLUG_SMT
147147
#include <linux/cpu_smt.h>
148+
#include <linux/cpumask.h>
148149
#include <asm/cputhreads.h>
149150

150151
static inline bool topology_is_primary_thread(unsigned int cpu)
@@ -156,6 +157,18 @@ static inline bool topology_smt_thread_allowed(unsigned int cpu)
156157
{
157158
return cpu_thread_in_core(cpu) < cpu_smt_num_threads;
158159
}
160+
161+
#define topology_is_core_online topology_is_core_online
162+
static inline bool topology_is_core_online(unsigned int cpu)
163+
{
164+
int i, first_cpu = cpu_first_thread_sibling(cpu);
165+
166+
for (i = first_cpu; i < first_cpu + threads_per_core; ++i) {
167+
if (cpu_online(i))
168+
return true;
169+
}
170+
return false;
171+
}
159172
#endif
160173

161174
#endif /* __KERNEL__ */

arch/powerpc/kernel/setup-common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ void __init setup_arch(char **cmdline_p)
959959
mem_topology_setup();
960960
/* Set max_mapnr before paging_init() */
961961
set_max_mapnr(max_pfn);
962+
high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
962963

963964
/*
964965
* Release secondary cpus out of their spinloops at 0x60 now that

arch/powerpc/mm/init-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void setup_kup(void)
7373

7474
#define CTOR(shift) static void ctor_##shift(void *addr) \
7575
{ \
76-
memset(addr, 0, sizeof(void *) << (shift)); \
76+
memset(addr, 0, sizeof(pgd_t) << (shift)); \
7777
}
7878

7979
CTOR(0); CTOR(1); CTOR(2); CTOR(3); CTOR(4); CTOR(5); CTOR(6); CTOR(7);
@@ -117,7 +117,7 @@ EXPORT_SYMBOL_GPL(pgtable_cache); /* used by kvm_hv module */
117117
void pgtable_cache_add(unsigned int shift)
118118
{
119119
char *name;
120-
unsigned long table_size = sizeof(void *) << shift;
120+
unsigned long table_size = sizeof(pgd_t) << shift;
121121
unsigned long align = table_size;
122122

123123
/* When batching pgtable pointers for RCU freeing, we store

arch/powerpc/mm/mem.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ void __init mem_init(void)
290290
swiotlb_init(ppc_swiotlb_enable, ppc_swiotlb_flags);
291291
#endif
292292

293-
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
294-
295293
kasan_late_init();
296294

297295
memblock_free_all();

drivers/soc/fsl/qbman/qman.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,11 +2546,6 @@ int qman_delete_cgr(struct qman_cgr *cgr)
25462546
}
25472547
EXPORT_SYMBOL(qman_delete_cgr);
25482548

2549-
struct cgr_comp {
2550-
struct qman_cgr *cgr;
2551-
struct completion completion;
2552-
};
2553-
25542549
static void qman_delete_cgr_smp_call(void *p)
25552550
{
25562551
qman_delete_cgr((struct qman_cgr *)p);

kernel/cpu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,16 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
26892689
return ret;
26902690
}
26912691

2692+
/**
2693+
* Check if the core a CPU belongs to is online
2694+
*/
2695+
#if !defined(topology_is_core_online)
2696+
static inline bool topology_is_core_online(unsigned int cpu)
2697+
{
2698+
return true;
2699+
}
2700+
#endif
2701+
26922702
int cpuhp_smt_enable(void)
26932703
{
26942704
int cpu, ret = 0;
@@ -2699,7 +2709,7 @@ int cpuhp_smt_enable(void)
26992709
/* Skip online CPUs and CPUs on offline nodes */
27002710
if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
27012711
continue;
2702-
if (!cpu_smt_thread_allowed(cpu))
2712+
if (!cpu_smt_thread_allowed(cpu) || !topology_is_core_online(cpu))
27032713
continue;
27042714
ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
27052715
if (ret)

0 commit comments

Comments
 (0)