From nobody Mon Nov 25 19:39:03 2024 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65269205136 for ; Fri, 25 Oct 2024 10:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729850939; cv=none; b=HJmZLzAmJmZGzQpdpio89N7eWD2iZFZNiplM0dioWA0LyLYXctXLo+n/eCYHvorJy97aJN9DRXA5vh+V4/Rz7EpBphg/D+TsuTAQmJmi2UfrB6UJ86VUGMSHbkDp+UVVQdJ1WSAPKh0BvGyZuC9ifHJT8MCeW2Lsyvod56dYywA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729850939; c=relaxed/simple; bh=V4ntC7CeTbEvPdpuCYbztDTs54KnUno16SgF0R0lU78=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aBs2saDO0WYJuZj3UEWEDIxK94fBAXNhv09sPQ+zbGJOdomD+yIkzz+aQo2wwNXr+I4eGG4Xbbt8amkuxauf6v31cgjCzLMOJXVlTPbfdddqDivg1QrQZYCwN9Wt2OCOkqxvbprJHA3rRao1i6WHpjEt25MaSFynl0i1lq1XHjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4XZdkJ0VWlzyTRq; Fri, 25 Oct 2024 18:07:20 +0800 (CST) Received: from kwepemg200008.china.huawei.com (unknown [7.202.181.35]) by mail.maildlp.com (Postfix) with ESMTPS id AB3BF18010F; Fri, 25 Oct 2024 18:08:53 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemg200008.china.huawei.com (7.202.181.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 25 Oct 2024 18:08:52 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH -next v4 15/19] entry: Add arch irqentry_exit_need_resched() for arm64 Date: Fri, 25 Oct 2024 18:06:56 +0800 Message-ID: <20241025100700.3714552-16-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025100700.3714552-1-ruanjinjie@huawei.com> References: <20241025100700.3714552-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemg200008.china.huawei.com (7.202.181.35) Content-Type: text/plain; charset="utf-8" As the front patch 6 ~ 13 did, the arm64_preempt_schedule_irq() is same with the irq preempt schedule code of generic entry besides those architecture-related logic called arm64_irqentry_exit_need_resched(). So add arch irqentry_exit_need_resched() to support architecture-related need_resched() check logic, which do not affect existing architectures that use generic entry, but support arm64 to use generic irq entry. Suggested-by: Mark Rutland Suggested-by: Kevin Brodsky Suggested-by: Thomas Gleixner Signed-off-by: Jinjie Ruan --- kernel/entry/common.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 2ad132c7be05..0cc117b658b8 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -143,6 +143,20 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs= *regs) return ret; } =20 +/** + * arch_irqentry_exit_need_resched - Architecture specific need resched fu= nction + * + * Invoked from raw_irqentry_exit_cond_resched() to check if need resched. + * Defaults return true. + * + * The main purpose is to permit arch to skip preempt a task from an IRQ. + */ +static inline bool arch_irqentry_exit_need_resched(void); + +#ifndef arch_irqentry_exit_need_resched +static inline bool arch_irqentry_exit_need_resched(void) { return true; } +#endif + void raw_irqentry_exit_cond_resched(void) { if (!preempt_count()) { @@ -150,7 +164,7 @@ void raw_irqentry_exit_cond_resched(void) rcu_irq_exit_check_preempt(); if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) WARN_ON_ONCE(!on_thread_stack()); - if (need_resched()) + if (need_resched() && arch_irqentry_exit_need_resched()) preempt_schedule_irq(); } } --=20 2.34.1