Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp132519pxb; Mon, 25 Oct 2021 05:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzicR3cJbJLtNYwAhyYnOl4CUY+nkXNHNJ5iqkiToFBmqcBVz2NfUP3YVrftUk71tcfWwJq X-Received: by 2002:a63:b958:: with SMTP id v24mr5486337pgo.114.1635164594344; Mon, 25 Oct 2021 05:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635164594; cv=none; d=google.com; s=arc-20160816; b=I6hIp2uiL1aQqSWKHlBWCSQsPZ7QLNdYVvTrFhiYFSZ+xKaQMO1qdIXTy+EmpuygFf x3CRO6+vZEU/D9fqJnjOpOQb7oLn+soVMKflD44oyGs5+cUUtS3diHZLILm84lmli2xp Rn9LxEb8SH+yUh7Wpr6XJtNIiIcHvwyc4Lx/w58/1SrAiRBwU7UtRLGVtVEDGE8uCw3P DWBFodB8xAlMAHowBkZVK6D82YrpPBCqJWln+nQIc825h00Eu02m2nebnKhMWIQ2sY3E Y4CVJ834/vmcS+xYuYcdSA0jmAwiGkZz0spGtGe3oJfWviCqOZTws3xnvsrrqAp76H/J xEdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ha3LRT456156VeKs8YeiVDBYYcMBVKB8dvdB9myw6mo=; b=ri8ceM3+UiQl2+IKatSeAlzr5l4GawX4uDjVblRraXsDNi8UrGFWdJJHKrXCpXwV5Z yRZIwWhW6QR7ipm2XIaYuNwYjIesSKYLyZwdNYY9V50XQ6Va15xc7+ap/IFcj6MP+pwb uxFc0I+7mvszXZweyE8u6qmn8muqVbUzTT+tBpn2kYCxkseruzhu5tz9FItE7fl8lee8 ctzXAeNE2UtUF2B+ttLmVjn+XgyHaeS2Y5UMVWqYcu0Ph5Z0HzrmIK9zgmV+B4ALRdfA oesCEAHahFMFwDSvAuecZeSIP9njnKJj/UHAY3P1/1wz2FqIOj3WfGAmNKUo45RHmeB2 rjKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nEkVei+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si11787423pjq.89.2021.10.25.05.22.51; Mon, 25 Oct 2021 05:23:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nEkVei+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbhJYMXj (ORCPT + 99 others); Mon, 25 Oct 2021 08:23:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:59128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233134AbhJYMXh (ORCPT ); Mon, 25 Oct 2021 08:23:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C877F61073; Mon, 25 Oct 2021 12:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635164475; bh=9F6yfN673eZlS130Eq+XEqL3Qzcqky6qGtY+tRCN/J8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEkVei+vNR4SzIB2PA/furFYxZELh4t1tMuC4bBLxEEMi3AIDP0iJsIQyQVh88o+h ji8OVPeYDTEFEhoXQe4hKjhXVjrIHsKD2AkI86+HNo90V0xIxOoOiENQDi/k/tYlNF 79Q/B2Zd7LgqI6nB3iQ59+Fu8LfpBPYAhoBe12eNdrkHJxWaIvUGGVJtiU8xbxAFaF a9GKo1FLa22COdWadOBkUecnJAuPbSnPBhMuulNMljv7e7WBwUDg7Bccp8XyhTKLoA OIoUWnaqUA8zMK8QXjmRM/GsuXHGbfMg5749kzQY+vuLyuPqwQB3puoFU3nYa4Bqtv Uo3PWygGkmw/g== From: Frederic Weisbecker To: Peter Zijlstra , Ard Biesheuvel Cc: LKML , Frederic Weisbecker , James Morse , David Laight , Quentin Perret , Catalin Marinas , Will Deacon , Mark Rutland Subject: [PATCH 3/4] arm64: Implement IRQ exit preemption static call for dynamic preemption Date: Mon, 25 Oct 2021 14:21:01 +0200 Message-Id: <20211025122102.46089-4-frederic@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211025122102.46089-1-frederic@kernel.org> References: <20211025122102.46089-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arm64 doesn't support generic entry yet, so the architecture's own IRQ exit preemption path needs to be exposed through the relevant static call. Signed-off-by: Frederic Weisbecker Cc: Mark Rutland Cc: Quentin Perret Cc: Peter Zijlstra Cc: Catalin Marinas Cc: James Morse Cc: Will Deacon Cc: Ard Biesheuvel Cc: David Laight --- arch/arm64/include/asm/preempt.h | 7 +++++++ arch/arm64/kernel/entry-common.c | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h index e83f0982b99c..4fbbe644532f 100644 --- a/arch/arm64/include/asm/preempt.h +++ b/arch/arm64/include/asm/preempt.h @@ -3,6 +3,7 @@ #define __ASM_PREEMPT_H #include +#include #define PREEMPT_NEED_RESCHED BIT(32) #define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED) @@ -86,4 +87,10 @@ void preempt_schedule_notrace(void); #define __preempt_schedule_notrace() preempt_schedule_notrace() #endif /* CONFIG_PREEMPTION */ +#ifdef CONFIG_PREEMPT_DYNAMIC +void arm64_preempt_schedule_irq(void); +#define __irqentry_exit_cond_resched_func arm64_preempt_schedule_irq +DECLARE_STATIC_CALL(irqentry_exit_cond_resched, __irqentry_exit_cond_resched_func); +#endif /* CONFIG_PREEMPT_DYNAMIC */ + #endif /* __ASM_PREEMPT_H */ diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 32f9796c4ffe..f1c739dd874d 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -235,7 +236,7 @@ static void noinstr exit_el1_irq_or_nmi(struct pt_regs *regs) exit_to_kernel_mode(regs); } -static void __sched arm64_preempt_schedule_irq(void) +void __sched arm64_preempt_schedule_irq(void) { lockdep_assert_irqs_disabled(); @@ -259,6 +260,9 @@ static void __sched arm64_preempt_schedule_irq(void) if (system_capabilities_finalized()) preempt_schedule_irq(); } +#ifdef CONFIG_PREEMPT_DYNAMIC +DEFINE_STATIC_CALL(irqentry_exit_cond_resched, arm64_preempt_schedule_irq); +#endif static void do_interrupt_handler(struct pt_regs *regs, void (*handler)(struct pt_regs *)) @@ -446,8 +450,13 @@ static void noinstr el1_interrupt(struct pt_regs *regs, * preempt_count(). */ if (IS_ENABLED(CONFIG_PREEMPTION) && - READ_ONCE(current_thread_info()->preempt_count) == 0) - arm64_preempt_schedule_irq(); + READ_ONCE(current_thread_info()->preempt_count) == 0) { +#ifdef CONFIG_PREEMPT_DYNAMIC + static_call(irqentry_exit_cond_resched)(); +#else + arm64_preempt_schedule_irq(); +#endif + } exit_el1_irq_or_nmi(regs); } -- 2.25.1