diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2016-12-02 13:16:02 +0100 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-12-07 07:22:41 +0100 |
commit | 307b3114eff6ba981c8eddbce327b4a82158bfe3 (patch) | |
tree | a167d837d59f4197575f8b6bf84decbd3d97aafa /arch/s390/include/asm/smp.h | |
parent | s390: Remove VLAIS in ptff() and clear_table() (diff) | |
download | linux-307b3114eff6ba981c8eddbce327b4a82158bfe3.tar.xz linux-307b3114eff6ba981c8eddbce327b4a82158bfe3.zip |
s390/numa: always use logical cpu and core ids
The toptree algorithm uses the physical core ids to create a mapping
between cores and nodes (to_node_id array within emu_cores structure).
The core ids are used as an index into an array which size depends on
CONFIG_NR_CPUS. If the physical core ids are larger, this will result
in out-of-bounds write accesses.
Generate logical core ids instead to avoid this.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/smp.h')
-rw-r--r-- | arch/s390/include/asm/smp.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index 0cc383b9be7f..8116b7b63af3 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h @@ -69,6 +69,12 @@ static inline void smp_stop_cpu(void) } } +/* Return thread 0 CPU number as base CPU */ +static inline int smp_get_base_cpu(int cpu) +{ + return cpu - (cpu % (smp_cpu_mtid + 1)); +} + #ifdef CONFIG_HOTPLUG_CPU extern int smp_rescan_cpus(void); extern void __noreturn cpu_die(void); |