[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH -next v5 05/22] arm64: entry: Use preempt_count() and need_resched() helper
On Fri, Dec 06, 2024 at 06:17:27PM +0800, Jinjie Ruan wrote: > The generic entry code uses preempt_count() and need_resched() helpers to > check if it is time to resched. Currently, arm64 use its own check logic, > that is "READ_ONCE(current_thread_info()->preempt_count == 0", which is > equivalent to "preempt_count() == 0 && need_resched()". Hmm. The existing code relies upon preempt_fold_need_resched() to work correctly. If we want to move from: READ_ONCE(current_thread_info()->preempt_count) == 0 ... to: !preempt_count() && need_resched() ... then that change should be made *before* we change the preemption logic to preempt non-IRQ exceptions in patch 3. Otherwise, that logic is consuming stale data most of the time. Mark. > In preparation for moving arm64 over to the generic entry code, use > these helpers to replace arm64's own code and move it ahead. > > No functional changes. > > Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> > --- > arch/arm64/kernel/entry-common.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/arch/arm64/kernel/entry-common.c > b/arch/arm64/kernel/entry-common.c > index da68c089b74b..efd1a990d138 100644 > --- a/arch/arm64/kernel/entry-common.c > +++ b/arch/arm64/kernel/entry-common.c > @@ -88,14 +88,6 @@ static inline bool arm64_need_resched(void) > if (!need_irq_preemption()) > return false; > > - /* > - * Note: thread_info::preempt_count includes both thread_info::count > - * and thread_info::need_resched, and is not equivalent to > - * preempt_count(). > - */ > - if (READ_ONCE(current_thread_info()->preempt_count) != 0) > - return false; > - > /* > * DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC > * priority masking is used the GIC irqchip driver will clear DAIF.IF > @@ -141,8 +133,10 @@ static __always_inline void __exit_to_kernel_mode(struct > pt_regs *regs, > return; > } > > - if (arm64_need_resched()) > - preempt_schedule_irq(); > + if (!preempt_count() && need_resched()) { > + if (arm64_need_resched()) > + preempt_schedule_irq(); > + } > > trace_hardirqs_on(); > } else { > -- > 2.34.1 >
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |