All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, ardb@kernel.org,
	bp@alien8.de, catalin.marinas@arm.com,
	dave.hansen@linux.intel.com, james.morse@arm.com,
	joey.gouly@arm.com, juri.lelli@redhat.com,
	linux-kernel@vger.kernel.org, luto@kernel.org, mingo@redhat.com,
	peterz@infradead.org, tglx@linutronix.de,
	valentin.schneider@arm.com, will@kernel.org
Subject: Re: [PATCH v2 5/7] sched/preempt: add PREEMPT_DYNAMIC using static keys
Date: Tue, 8 Feb 2022 12:15:37 +0000	[thread overview]
Message-ID: <YgJe6aij3iwvgRAS@FVFF77S0Q05N> (raw)
In-Reply-To: <20220207115708.GA514319@lothringen>

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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, ardb@kernel.org,
	bp@alien8.de, catalin.marinas@arm.com,
	dave.hansen@linux.intel.com, james.morse@arm.com,
	joey.gouly@arm.com, juri.lelli@redhat.com,
	linux-kernel@vger.kernel.org, luto@kernel.org, mingo@redhat.com,
	peterz@infradead.org, tglx@linutronix.de,
	valentin.schneider@arm.com, will@kernel.org
Subject: Re: [PATCH v2 5/7] sched/preempt: add PREEMPT_DYNAMIC using static keys
Date: Tue, 8 Feb 2022 12:15:37 +0000	[thread overview]
Message-ID: <YgJe6aij3iwvgRAS@FVFF77S0Q05N> (raw)
In-Reply-To: <20220207115708.GA514319@lothringen>

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.

  reply	other threads:[~2022-02-08 12:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 15:05 [PATCH v2 0/7] arm64 / sched/preempt: support PREEMPT_DYNAMIC with static keys Mark Rutland
2022-02-04 15:05 ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 1/7] sched/preempt: move PREEMPT_DYNAMIC logic later Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 2/7] sched/preempt: refactor sched_dynamic_update() Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 3/7] sched/preempt: simplify irqentry_exit_cond_resched() callers Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 4/7] sched/preempt: decouple HAVE_PREEMPT_DYNAMIC from GENERIC_ENTRY Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 5/7] sched/preempt: add PREEMPT_DYNAMIC using static keys Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-07 11:57   ` Frederic Weisbecker
2022-02-07 11:57     ` Frederic Weisbecker
2022-02-08 12:15     ` Mark Rutland [this message]
2022-02-08 12:15       ` Mark Rutland
2022-02-04 15:05 ` [PATCH v2 6/7] arm64: entry: centralize premeption decision Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 18:46   ` Catalin Marinas
2022-02-04 18:46     ` Catalin Marinas
2022-02-04 15:05 ` [PATCH v2 7/7] arm64: support PREEMPT_DYNAMIC Mark Rutland
2022-02-04 15:05   ` Mark Rutland
2022-02-04 18:48   ` Catalin Marinas
2022-02-04 18:48     ` Catalin Marinas
2022-02-04 20:41   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgJe6aij3iwvgRAS@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=frederic@kernel.org \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=valentin.schneider@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.