[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YgJe6aij3iwvgRAS@FVFF77S0Q05N>
Date: Tue, 8 Feb 2022 12:15:37 +0000
From: Mark Rutland <mark.rutland@....com>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org, ardb@...nel.org,
bp@...en8.de, catalin.marinas@....com, dave.hansen@...ux.intel.com,
james.morse@....com, joey.gouly@....com, juri.lelli@...hat.com,
linux-kernel@...r.kernel.org, luto@...nel.org, mingo@...hat.com,
peterz@...radead.org, tglx@...utronix.de,
valentin.schneider@....com, will@...nel.org
Subject: Re: [PATCH v2 5/7] sched/preempt: add PREEMPT_DYNAMIC using static
keys
On Mon, Feb 07, 2022 at 12:57:08PM +0100, Frederic Weisbecker wrote:
> On Fri, Feb 04, 2022 at 03:05:55PM +0000, Mark Rutland wrote:
> > diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
> > index dfd84c59b144..141952f4fee8 100644
> > --- a/include/linux/entry-common.h
> > +++ b/include/linux/entry-common.h
> > @@ -456,13 +456,19 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
> > */
> > void raw_irqentry_exit_cond_resched(void);
> > #ifdef CONFIG_PREEMPT_DYNAMIC
> > +#if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
> > #define irqentry_exit_cond_resched_dynamic_enabled raw_irqentry_exit_cond_resched
> > #define irqentry_exit_cond_resched_dynamic_disabled NULL
> > DECLARE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched);
> > #define irqentry_exit_cond_resched() static_call(irqentry_exit_cond_resched)()
> > -#else
> > -#define irqentry_exit_cond_resched() raw_irqentry_exit_cond_resched()
> > +#elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
> > +DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched);
>
> If CONFIG_PREEMPT && CONFIG_PREEMPT_DYNAMIC and no "preempt=" parameter is
> passed, nothing is overriden on boot. So you need to either have cond_resched
> and might_resched initially disabled (STATIC_KEY_FALSE?) or call
> sched_dynamic_update() from preempt_dynamic_init() also when CONFIG_PREEMPT=y.
Ah; good spot. I'd missed that those were initialized to RET0.
I've changed those two to DECLARE_STATIC_KEY_FALSE(), which defaults those to
disabled, e.g.
| <dynamic_cond_resched>:
| bti c
| nop // <-------- `b <dynamic_cond_resched+0x10>` when enabled
| mov w0, #0x0
| ret
| mrs x0, sp_el0
| ldr x0, [x0, #8]
| cbnz x0, 9d8 <dynamic_cond_resched+0x8>
| paciasp
| stp x29, x30, [sp, #-16]!
| mov x29, sp
| bl 900 <preempt_schedule_common>
| mov w0, #0x1
| ldp x29, x30, [sp], #16
| autiasp
| ret
Thanks,
Mark.
Powered by blists - more mailing lists