From patchwork Fri Apr 5 22:31:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Pan X-Patchwork-Id: 13619553 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 21D3717799D; Fri, 5 Apr 2024 22:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712356012; cv=none; b=HWTRAL80cUmV2gpAHybi5sWu/cAuyXDYsTXAT9mX35H1xDu/MJioSJqfegcHU7YQKqJbzO2W1Mjepgtmh6a2ZcPpnWUb340Q/hPuHq6BBEZxUr1lE7GpnQZJthfEIxjBXi24nqBYfoQZZ1yraEs9kX2yyO4jopM3BQQRVcUdoVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712356012; c=relaxed/simple; bh=aMX9sw5AlWfnuSsCSRnkGkG0cgUx+sH4S0oPTBTmTuo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hgT7YrcoypaPQGq9aIqoGTXq9gLx0XiflV+VAsLpH8Wll+42W5fansXaxyQfyPse/7HQuMFiZ7EE3sWBQVXvAtrtoUdJOfaykZSVMpZVAiR2PMXTsJYcOvaPzlhXy/+KbxGvcxoNrGhMIoF5XK7EhzJyHzizX4zPskqMsQ+HTwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YiO91EgE; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YiO91EgE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712356011; x=1743892011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aMX9sw5AlWfnuSsCSRnkGkG0cgUx+sH4S0oPTBTmTuo=; b=YiO91EgENp/mq0TUFgdy5gCVa2pDXiz9IZe5WZMrS2au+UAWT1eB6H+K AtY4aJmkZcA+LkQeSvEPx6svC+99l+ayVmFwztNLgdKOpGPfMe9U2SCrC JoysUApXB2MxdyouFGpP87xucQ+XlH0zZ/QlSLOQgiEFyeBmoCsTP4SY3 8vkZSdMcAiREgIkDglRDz4MATWFxz60N/3ii3xsDOz3z1P4PYZn0mtch1 yK8sQCCKAnmM7AzCw0D0aKw27GuVDGgi6H2M196im9P92Y9eIaUkPjHW2 mn858elRPPLtVlyOAS/NTXVFulYBnjeyuQTJURFg6QGVqJnC0ix8qqeEu A==; X-CSE-ConnectionGUID: mUtZWD4JQ5uqx6vWDcfugA== X-CSE-MsgGUID: TBEFnWwkRsGP1Wr+EqKOwg== X-IronPort-AV: E=McAfee;i="6600,9927,11035"; a="19062762" X-IronPort-AV: E=Sophos;i="6.07,182,1708416000"; d="scan'208";a="19062762" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 15:26:50 -0700 X-CSE-ConnectionGUID: un+Vo/c2SMSc7Y7UhwtFGg== X-CSE-MsgGUID: uqcZv7bYQ1qshj4GMGZmpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,182,1708416000"; d="scan'208";a="23928326" Received: from jacob-builder.jf.intel.com ([10.54.39.125]) by fmviesa004.fm.intel.com with ESMTP; 05 Apr 2024 15:26:48 -0700 From: Jacob Pan To: LKML , X86 Kernel , Peter Zijlstra , iommu@lists.linux.dev, Thomas Gleixner , "Lu Baolu" , kvm@vger.kernel.org, Dave Hansen , Joerg Roedel , "H. Peter Anvin" , "Borislav Petkov" , "Ingo Molnar" Cc: Paul Luse , Dan Williams , Jens Axboe , Raj Ashok , "Tian, Kevin" , maz@kernel.org, seanjc@google.com, "Robin Murphy" , jim.harris@samsung.com, a.manzanares@samsung.com, "Bjorn Helgaas" , guang.zeng@intel.com, robert.hoo.linux@gmail.com, Jacob Pan Subject: [PATCH v2 07/13] x86/irq: Factor out calling ISR from common_interrupt Date: Fri, 5 Apr 2024 15:31:04 -0700 Message-Id: <20240405223110.1609888-8-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240405223110.1609888-1-jacob.jun.pan@linux.intel.com> References: <20240405223110.1609888-1-jacob.jun.pan@linux.intel.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Prepare for calling external IRQ handlers directly from the posted MSI demultiplexing loop. Extract the common code with common interrupt to avoid code duplication. Signed-off-by: Jacob Pan --- arch/x86/kernel/irq.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index f39f6147104c..c54de9378943 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -242,18 +242,10 @@ static __always_inline void handle_irq(struct irq_desc *desc, __handle_irq(desc, regs); } -/* - * common_interrupt() handles all normal device IRQ's (the special SMP - * cross-CPU interrupts have their own entry points). - */ -DEFINE_IDTENTRY_IRQ(common_interrupt) +static __always_inline void call_irq_handler(int vector, struct pt_regs *regs) { - struct pt_regs *old_regs = set_irq_regs(regs); struct irq_desc *desc; - /* entry code tells RCU that we're not quiescent. Check it. */ - RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU"); - desc = __this_cpu_read(vector_irq[vector]); if (likely(!IS_ERR_OR_NULL(desc))) { handle_irq(desc, regs); @@ -268,7 +260,20 @@ DEFINE_IDTENTRY_IRQ(common_interrupt) __this_cpu_write(vector_irq[vector], VECTOR_UNUSED); } } +} + +/* + * common_interrupt() handles all normal device IRQ's (the special SMP + * cross-CPU interrupts have their own entry points). + */ +DEFINE_IDTENTRY_IRQ(common_interrupt) +{ + struct pt_regs *old_regs = set_irq_regs(regs); + + /* entry code tells RCU that we're not quiescent. Check it. */ + RCU_LOCKDEP_WARN(!rcu_is_watching(), "IRQ failed to wake up RCU"); + call_irq_handler(vector, regs); set_irq_regs(old_regs); }