Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2084155pxp; Thu, 10 Mar 2022 19:30:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLR0hVUd5enM0LeMvYHt5ekol6gKD2gE9K7/7nvcDSVD5BmdViD09E/X4F7Gr8LEI+48N6 X-Received: by 2002:a62:1787:0:b0:4f6:c5d2:1da7 with SMTP id 129-20020a621787000000b004f6c5d21da7mr8332786pfx.71.1646969419963; Thu, 10 Mar 2022 19:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646969419; cv=none; d=google.com; s=arc-20160816; b=qnat5NsVN3mHxsghTU+hmLsxUtZ2QJK+GNWv+MG4stSROul2uO8Omd8t8AnU6WwhYY 4zsk+mj1RNDOv9BvX2mvwiLg3Cif295MFM15k84qh6bPP50psqscIdvL8dZhUqTV57T+ 0nmW3C/LLQSG35/1LS363nWs2/f4ohGT06gi3RAV82TnkS2N8F7WWEgB+6m+fRejhwNV FAToV2bZ+oXNdgUFxGTnDbe4w+CFMAlSnO1iybaPLEALkBSdXg5+YBes1b9MtTDWsBfE OSWkgbwlz0DqSd02o6gQ498m7tYAvLv75XYJn90JiXZejQVukeil/IDJLtPCiVWL7ns7 OWfw== 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=C4LqRc6060PQj2SmC1a0rj2465Y2zge/sBhKgKNpG8A=; b=WI2tGNUbCxe3F6B0JY8KXjmES0O2GbWxXCWD2geB+07Ke3SxH2QF4fz5U9Q5T9wzet u51KXm30bGSDkokc42lSq8S8tNKHKfDfL18Ukdgo8Mc2rM6JaPkDMj6F63Nb0n6bgxVl K+PSFQNJF92O1X7GiHXgaCfvcUVQBQ58/uZti6GUlOv7vob7kG5fnd7xCpvTBWEHnqEY tbyukT28xDlI+dWOK1acC2ygbkPt0zmOWoWxD4zyQ1+HZ7v5fPVqs5rDsYCa5vpxZEEK 5oRDuFcmo1TZiNm201Wuno6LseBM7sxv5JAcHbMzrmY8uyproAEtFSIqTEUzhkcRMqgW nXfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZKnUboXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a170902789400b0014f2b9c6351si6198664pll.460.2022.03.10.19.30.00; Thu, 10 Mar 2022 19:30:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZKnUboXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244953AbiCJRW7 (ORCPT + 99 others); Thu, 10 Mar 2022 12:22:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244637AbiCJRW0 (ORCPT ); Thu, 10 Mar 2022 12:22:26 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B15C199E2C for ; Thu, 10 Mar 2022 09:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646932880; x=1678468880; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qwhD7MYd+5vjkJjSbQ7ZP+K6ASyttkvB2aN1EyDG9yc=; b=ZKnUboXumX6zRoBcCD/RdACHP9SQbk5t/287AzYMKdl2gnasPG1HS4/D 6z3MoieGOzX3TqKVnIgpJZoifz7jRUabopaT5IYVTpcqiEMR9jaby1xdU pUCfvgWWYxOD8ER5FDuAliv7ziVcmFnbcq40ZgKCSHMSYEk5Jr8MzPUF7 HMtB+T1SZwj2/uwdLKLrgBKbcnhUuAj7KIDPgDjLYhKSzMRv24RbGFkp1 cNxwKUJdrKdTbb6ep+Ravh5uCSaFR8ZR/mdjgVSCh0jdGiHlWzVX1sLJn hxUHg3W+1uvaoyjjPsHneY3Vo+4qXfRxyxzFX3Ib8+loz6yFYDSlfTtBc w==; X-IronPort-AV: E=McAfee;i="6200,9189,10282"; a="318536495" X-IronPort-AV: E=Sophos;i="5.90,171,1643702400"; d="scan'208";a="318536495" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2022 09:21:19 -0800 X-IronPort-AV: E=Sophos;i="5.90,171,1643702400"; d="scan'208";a="548091166" Received: from gdavids1-mobl.amr.corp.intel.com (HELO localhost) ([10.212.65.108]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2022 09:21:18 -0800 From: ira.weiny@intel.com To: Dave Hansen , "H. Peter Anvin" , Dan Williams Cc: Ira Weiny , Fenghua Yu , Rick Edgecombe , "Shankar, Ravi V" , linux-kernel@vger.kernel.org Subject: [PATCH V9 24/45] entry: Split up irqentry_exit_cond_resched() Date: Thu, 10 Mar 2022 09:19:58 -0800 Message-Id: <20220310172019.850939-25-ira.weiny@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220310172019.850939-1-ira.weiny@intel.com> References: <20220310172019.850939-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ira Weiny Auxiliary pt_regs space needs to be manipulated by the generic entry/exit code. Normally irqentry_exit() would take care of handling any auxiliary pt_regs on exit. Unfortunately, the call to irqentry_exit_cond_resched() from xen_pv_evtchn_do_upcall() bypasses the normal irqentry_exit() call. Because of this bypass irqentry_exit_cond_resched() will be required to handle any auxiliary pt_regs exit handling. However, this prevents irqentry_exit() from being able to call irqentry_exit_cond_resched() and while maintaining control of the auxiliary pt_regs. Separate out the common functionality of irqentry_exit_cond_resched() so that functionality can be used by irqentry_exit(). Add a pt_regs parameter in anticipation of having irqentry_exit_cond_resched() handle the auxiliary pt_regs separately from irqentry_exit(). Signed-off-by: Ira Weiny --- Changes for V9 Update commit message Changes for V8 New Patch --- arch/x86/entry/common.c | 2 +- include/linux/entry-common.h | 3 ++- kernel/entry/common.c | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 6c2826417b33..f1ba770d035d 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -309,7 +309,7 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs) inhcall = get_and_clear_inhcall(); if (inhcall && !WARN_ON_ONCE(state.exit_rcu)) { - irqentry_exit_cond_resched(); + irqentry_exit_cond_resched(regs); instrumentation_end(); restore_inhcall(inhcall); } else { diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index ddaffc983e62..14fd329847e7 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -451,10 +451,11 @@ irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs); /** * irqentry_exit_cond_resched - Conditionally reschedule on return from interrupt + * @regs: Pointer to pt_regs of interrupted context * * Conditional reschedule with additional sanity checks. */ -void irqentry_exit_cond_resched(void); +void irqentry_exit_cond_resched(struct pt_regs *regs); void __irqentry_exit_cond_resched(void); #ifdef CONFIG_PREEMPT_DYNAMIC diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 490442a48332..f4210a7fc84d 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -395,7 +395,7 @@ void __irqentry_exit_cond_resched(void) DEFINE_STATIC_CALL(__irqentry_exit_cond_resched, __irqentry_exit_cond_resched); #endif -void irqentry_exit_cond_resched(void) +static void exit_cond_resched(void) { if (IS_ENABLED(CONFIG_PREEMPTION)) { #ifdef CONFIG_PREEMPT_DYNAMIC @@ -406,6 +406,11 @@ void irqentry_exit_cond_resched(void) } } +void irqentry_exit_cond_resched(struct pt_regs *regs) +{ + exit_cond_resched(); +} + noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state) { lockdep_assert_irqs_disabled(); @@ -431,7 +436,7 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state) } instrumentation_begin(); - irqentry_exit_cond_resched(); + exit_cond_resched(); /* Covers both tracing and lockdep */ trace_hardirqs_on(); instrumentation_end(); -- 2.35.1