Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp537014pxb; Fri, 28 Jan 2022 04:53:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1BVZeL/RF+v7b1pozXvor8+RsDqe780hd0TRbPLwWQN5kqBgGAbsBinXPo1ZQFYCFjglH X-Received: by 2002:a17:906:99c5:: with SMTP id s5mr6322704ejn.373.1643374423616; Fri, 28 Jan 2022 04:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643374423; cv=none; d=google.com; s=arc-20160816; b=bqtJqyWQzemyBZ1pAd6uOGiIhQBI+mXhI0kJl20PslpZC5ogFNQJlscLoRU+JvusMe MlVRU9qqEVig0rPDi4JuzD0ldYvD1zXPOD9HzuVGW7yz8NLtdFzzcYOkeN/DTKBJ2Z3X uxHnAdJ+eLQaOYVLsiU5ezrf9wQaQQb6WE6zfLCHXsZm3pyiS91CN05xHn8STw2QhQd5 LgSVPev21JEi/8SERTjAFnQvQp1ys6MtC/6sXsvEVbhKERB6efUTF/wDdH5bg34cqmJQ WXO5hA+Ca4HFXQOgeU/fu4cdkw4ja8PCrT8o0owrv4JvJ0NP+PhHKTXY29RxvikjhqCu +yng== 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=2lfGtemNYz4yHA/KZ7cS6rhuZslUotEvb1zcTB1C1qc=; b=Qw8zTs9Zfj1w0gacaX9NWjxy9gYAsz05VqQ7o20eJ7JRWSWbOqywAE/EmlZC0kTGYT b6lPqZosd1LdYxG11nZ8PYaROSNkqUKcHgNBRUF5qUcg9w7rWctVqOg/tyKL3C1dBwoy t/IfAHd9KI742sZZpKgizh2DYxeHiGtBbhXZpDc3UruyBja426s6JlbP2iRFG2nWNVbz xckN4PSo4WW6RFE91G3x4q8poonZ/DfgwQUryX8GZVznEfmRGk9N4mEbsm1IV0OJnNzP IUx6MtXE95DLEReXZADKeY6tYpU+02JFK4yXVGmilF9cmapHBXDwbAm+lBvQV/w0rNrX GEMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=edFXZ851; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 25si2535342ejg.376.2022.01.28.04.53.18; Fri, 28 Jan 2022 04:53:43 -0800 (PST) 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=@intel.com header.s=Intel header.b=edFXZ851; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244929AbiA0R4A (ORCPT + 99 others); Thu, 27 Jan 2022 12:56:00 -0500 Received: from mga02.intel.com ([134.134.136.20]:19418 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244829AbiA0RzY (ORCPT ); Thu, 27 Jan 2022 12:55:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643306124; x=1674842124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XJw9MAUdxudZN0wWW0EtiDX6K6ENUNzmSElBKkroX8w=; b=edFXZ851E/Z2PnHTgY26jZjl2Yn27toUhBSBkoT0zEgOIqOts1+CAE7R guMbzLUBFqUccbjuHf/hqlGYX4T4+rLB3xrrmIXLEdojNEPmcgUnaNsp4 A2Jw1rD7U75+PXdkVY4jOSVm+QF49F/GoE8GXSHFJF4ipf1I5eLYuCVxe LR2B34PaVrmK7tCal0bfMPiE7uY9QEpH/C9bceTSyNSjK8AcrsJZZI3Jc tqQu0Bpv9Gb22B7qb4neI+idS0OVP0Gi9AWFK0Jx/55rM+Uum9ctgUI7/ wn3l+EYOEaIKvXNE0nzgMjVmiOPDI8MHGL6cDVb8bgu9G2OtWlAi5xsYs g==; X-IronPort-AV: E=McAfee;i="6200,9189,10239"; a="234302435" X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="234302435" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 09:55:10 -0800 X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="674796124" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 09:55:10 -0800 From: ira.weiny@intel.com To: Dave Hansen , "H. Peter Anvin" , Dan Williams Cc: Ira Weiny , Fenghua Yu , Rick Edgecombe , linux-kernel@vger.kernel.org Subject: [PATCH V8 22/44] entry: Pass pt_regs to irqentry_exit_cond_resched() Date: Thu, 27 Jan 2022 09:54:43 -0800 Message-Id: <20220127175505.851391-23-ira.weiny@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220127175505.851391-1-ira.weiny@intel.com> References: <20220127175505.851391-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Unfortunately, the call to irqentry_exit_cond_resched() from xen_pv_evtchn_do_upcall() bypasses the 'normal' irqentry_exit() call. Normally the irqentry_exit() would take care of handling any auxiliary pt_regs but because of this bypass irqentry_exit_cond_resched() is required to handle it. Add pt_regs to irqentry_exit_cond_resched() so that any auxiliary pt_regs data can be handled. Create an internal exit_cond_resched() call for irqentry_exit() to avoid passing pt_regs because irqentry_exit() will directly handle any auxiliary pt_regs data. Signed-off-by: Ira Weiny --- 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.31.1