From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BC20C4321E for ; Tue, 8 Feb 2022 13:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376349AbiBHNWB (ORCPT ); Tue, 8 Feb 2022 08:22:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241781AbiBHMPs (ORCPT ); Tue, 8 Feb 2022 07:15:48 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AB9FCC03FEC0 for ; Tue, 8 Feb 2022 04:15:47 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6DB36ED1; Tue, 8 Feb 2022 04:15:47 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.89.190]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C99F93F70D; Tue, 8 Feb 2022 04:15:44 -0800 (PST) Date: Tue, 8 Feb 2022 12:15:37 +0000 From: Mark Rutland To: Frederic Weisbecker 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 Message-ID: References: <20220204150557.434610-1-mark.rutland@arm.com> <20220204150557.434610-6-mark.rutland@arm.com> <20220207115708.GA514319@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220207115708.GA514319@lothringen> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. | : | bti c | nop // <-------- `b ` when enabled | mov w0, #0x0 | ret | mrs x0, sp_el0 | ldr x0, [x0, #8] | cbnz x0, 9d8 | paciasp | stp x29, x30, [sp, #-16]! | mov x29, sp | bl 900 | mov w0, #0x1 | ldp x29, x30, [sp], #16 | autiasp | ret Thanks, Mark.