[PATCH v3 05/20] arm64: entry: move preempt logic to C
Will Deacon
will at kernel.org
Fri Jun 4 08:43:10 PDT 2021
On Tue, May 25, 2021 at 07:32:47PM +0100, Mark Rutland wrote:
> Currently portions of our preempt logic are written in C while other
> parts are written in assembly. There's no reason any of this needs to
> live in assembly, so let's move the rest of the lgoic to C. At the same
> time, let's make the comment a bit clearer.
>
> Other than the increased lockdep coverage there should be no functional
> change as a result of this patch.
>
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Reviewed-by: Joey Gouly <joey.gouly at arm.com>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: James Morse <james.morse at arm.com>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Will Deacon <will at kernel.org>
> ---
> arch/arm64/kernel/entry-common.c | 12 ++++++++++++
> arch/arm64/kernel/entry.S | 13 -------------
> 2 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index 1fe60578e556..dbe0bb09fe86 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -121,6 +121,18 @@ asmlinkage void __sched arm64_preempt_schedule_irq(void)
> {
> lockdep_assert_irqs_disabled();
>
> + if (preempt_count() != 0)
> + return;
Careful, I don't think this is quite the same: preempt_count() just looks at
the 32-bit count portion of the preempt-structure, whereas the old code only
bothers calling into the scheduler if we actually need to reschedule:
> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> index 656f3129bfef..8c7ddd651756 100644
> --- a/arch/arm64/kernel/entry.S
> +++ b/arch/arm64/kernel/entry.S
> @@ -561,20 +561,7 @@ tsk .req x28 // current thread_info
> irq_handler \handler
>
> #ifdef CONFIG_PREEMPTION
> - ldr x24, [tsk, #TSK_TI_PREEMPT] // get preempt count
It would be nice if we could keep this check on the fast path.
Will
More information about the linux-arm-kernel
mailing list