Re: [RFC PATCH 00/86] Make the kernel preemptible

From: Mark Rutland
Date: Wed Nov 08 2023 - 11:33:55 EST


On Tue, Nov 07, 2023 at 01:56:46PM -0800, Ankur Arora wrote:
> What's broken:
> - ARCH_NO_PREEMPT (See patch-45 "preempt: ARCH_NO_PREEMPT only preempts
> lazily")
> - Non-x86 architectures. It's trivial to support other archs (only need
> to add TIF_NEED_RESCHED_LAZY) but wanted to hold off until I got some
> comments on the series.
> (From some testing on arm64, didn't find any surprises.)

When you say "testing on arm64, didn't find any surprises", I assume you mean
with an additional patch adding TIF_NEED_RESCHED_LAZY?

Applying this series as-is atop v6.6-rc7 and building defconfig (with GCC
13.2.0) blows up with:

| In file included from ./arch/arm64/include/asm/preempt.h:5,
| from ./include/linux/preempt.h:79,
| from ./include/linux/spinlock.h:56,
| from ./include/linux/mmzone.h:8,
| from ./include/linux/gfp.h:7,
| from ./include/linux/slab.h:16,
| from ./include/linux/resource_ext.h:11,
| from ./include/linux/acpi.h:13,
| from ./include/acpi/apei.h:9,
| from ./include/acpi/ghes.h:5,
| from ./include/linux/arm_sdei.h:8,
| from arch/arm64/kernel/asm-offsets.c:10:
| ./include/linux/thread_info.h:63:2: error: #error "Arch needs to define TIF_NEED_RESCHED_LAZY"
| 63 | #error "Arch needs to define TIF_NEED_RESCHED_LAZY"
| | ^~~~~
| ./include/linux/thread_info.h:66:42: error: 'TIF_NEED_RESCHED_LAZY' undeclared here (not in a function); did you mean 'TIF_NEED_RESCHED'?
| 66 | #define TIF_NEED_RESCHED_LAZY_OFFSET (TIF_NEED_RESCHED_LAZY - TIF_NEED_RESCHED)
| | ^~~~~~~~~~~~~~~~~~~~~
| ./include/linux/thread_info.h:70:24: note: in expansion of macro 'TIF_NEED_RESCHED_LAZY_OFFSET'
| 70 | RESCHED_lazy = TIF_NEED_RESCHED_LAZY_OFFSET,
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| make[2]: *** [scripts/Makefile.build:116: arch/arm64/kernel/asm-offsets.s] Error 1
| make[1]: *** [/home/mark/src/linux/Makefile:1202: prepare0] Error 2
| make: *** [Makefile:234: __sub-make] Error 2

Note that since arm64 doesn't use the generic entry code, that also requires
changes to arm64_preempt_schedule_irq() in arch/arm64/kernel/entry-common.c, to
handle TIF_NEED_RESCHED_LAZY.

> - ftrace support for need-resched-lazy is incomplete

What exactly do we need for ftrace here?

Thanks,
Mark.