]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems
authorArd Biesheuvel <ardb@kernel.org>
Wed, 24 Nov 2021 13:08:11 +0000 (14:08 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 6 Dec 2021 11:49:17 +0000 (12:49 +0100)
commit70d164697fc01303616980dec21dc3b01e847f94
treee55a231cce8f02eea3be6e7b19627c58bccdee52
parent8313005524bd6e4d7b81e9bef2759fbf3b178294
ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems

On UP systems, only a single task can be 'current' at the same time,
which means we can use a global variable to track it. This means we can
also enable THREAD_INFO_IN_TASK for those systems, as in that case,
thread_info is accessed via current rather than the other way around,
removing the need to store thread_info at the base of the task stack.
This, in turn, permits us to enable IRQ stacks and vmap'ed stacks on UP
systems as well.

To partially mitigate the performance overhead of this arrangement, use
a ADD/ADD/LDR sequence with the appropriate PC-relative group
relocations to load the value of current when needed. This means that
accessing current will still only require a single load as before,
avoiding the need for a literal to carry the address of the global
variable in each function. However, accessing thread_info will now
require this load as well.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
12 files changed:
arch/arm/Kconfig
arch/arm/include/asm/assembler.h
arch/arm/include/asm/current.h
arch/arm/include/asm/switch_to.h
arch/arm/include/asm/thread_info.h
arch/arm/kernel/asm-offsets.c
arch/arm/kernel/entry-armv.S
arch/arm/kernel/entry-v7m.S
arch/arm/kernel/head-common.S
arch/arm/kernel/process.c
arch/arm/kernel/smp.c
arch/arm/kernel/traps.c