Re: [PATCH v3 05/20] arm64: entry: move preempt logic to C
From: Will Deacon <will@kernel.org>
Date: 2021-06-04 15:44:58
On Tue, May 25, 2021 at 07:32:47PM +0100, Mark Rutland wrote:
quoted hunk ↗ jump to hunk
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@arm.com> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@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:
quoted hunk ↗ jump to hunk
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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel