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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2712C433F5 for ; Tue, 8 Feb 2022 12:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UkIlEKMsyS3bA9JAuMo0XAfTjXWOdQLIFfJZ3qKK5Ls=; b=fkGx7IDw8+JWQo rqYIOmBsOKS5bODchQOePMyUW0sHSmPIcqx5/+g9pNg5JZv8PusTGH1hWt7JMdV5QHpBKTuLXsa3R 7yutmM7qxBklwa0zxPGR3L6Nrb6WxUju7yNRd5oU1zs9R2SezIMXLKRbuo0+0lAVfaXFVaz/KzWje f/YcBvvR7TWmH0Rg6sdKg8gRyRceR5TWQa52kPQgxW+bH8R/UjR/Y0/MjQs0R75S3y5qqjNXUtOb6 BjdVWZP8xL6Q/1oXPu0f9z0FQCZd00vvJQg+UhJV8U9Vfll78HEilwq/d4uGeBoV1LUqm1oh/SKo1 P1bzXB/89Kz3MNtMyCEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHPPV-00DjAC-UV; Tue, 08 Feb 2022 12:15:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHPPS-00Dj9c-6f for linux-arm-kernel@lists.infradead.org; Tue, 08 Feb 2022 12:15:51 +0000 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-Disposition: inline In-Reply-To: <20220207115708.GA514319@lothringen> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220208_041550_333284_FA29B715 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel