From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C79CEEB3 for ; Wed, 1 Jul 2026 00:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782865316; cv=none; b=tGRH5YuMoM6ZKi+G1zbSb+YmEpe/qY5aZfgx9SFjAxp4QaZRhQKfzaNE+tJ0yh75dLCUqvmlTJ98fuVQ1Cnz0pg8R6UwyDPE4Nd5Rvn5Yda/guRxYmg0N9dYf666/UuP1zWuqO7mheL1gSM6ab/PNXnBl1YN9CiLy8yGlSZ3oPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782865316; c=relaxed/simple; bh=nY4nP/LNNWix5Ga+7qYX03d8NeE9zsN35vsoXrHQhO4=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=uboIU3+VlmRpAWmzvolG5aEF1LGiufXzB2sBr+bAbu9Bwh1Y1k6HGlAv6d7klS8N5REPT6ktGAZRuoUcvhtLXuqGPWbmFQiECSiN33FjFLH09nCSK6BRHeZlnvjlmGZPTKLDB0nU34ypD2KcT79HFFcg1gPRbwm5kWYwwZoWrYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Y0SOsD+e; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Y0SOsD+e" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-8478947e047so109436b3a.3 for ; Tue, 30 Jun 2026 17:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782865314; x=1783470114; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=kdxYeaOepBJfLGS98H5NKF0v9QO2gGaR+8G73odSdzU=; b=Y0SOsD+eN1JMUth34J3IlTkvXs6wvme1NUBUoiKg4+9fAh5ztHMg1M7smSfnS8J9Xe Ak6Fyd6z5XczCZrGFop3OLPmGH0KuE2187U77LEPW2GwUmGe/aknQplv21kKb7jQMYfY sAYXiWc0L7IrrqL5wPAQEqV441ahm2J1vRpOEpGb7ro/2qk4m/K2ODkl7akqgR1No7LE 22jqoJHJC2cCt26RYSE/HG2eNrjFTWRrSAPyAzcrzOch7rhk+VGRc4KF+15gbeyK0xcy JLvOtRSPU08eua2cgwQFa9WNDyuEMYC0Tzq/0U2Yk5MKmBOIyGxcLZrqZiypeYRmpdLd dEUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782865314; x=1783470114; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kdxYeaOepBJfLGS98H5NKF0v9QO2gGaR+8G73odSdzU=; b=jSMNyEVSYyj3ShH8MGgd6Gts6677grj9adrIcY+84FOVl/ImsIpOG+ye32JXvkoBP+ 4No1ylO5AQ3ygPr/zNigpk7b9b8dcmhEF0mnp5ZsqipLyI8+hZ5GWSuv/9mvymGHQM6b 5Gs4r+ex77Tz7LlP4+BYRvXpM+KKSEonjT+juK+kHJ2Kkx7yb5RGmCP+PwfRgJTGFUKo 7eitkHefH+dc8PMpkLga/AHaaAV4YdAqRxIJnKMmnKZ1ZC2ahjHKyjvWr+EQHxyG4kRs sYJ5SPSln/rV3aDBWeHEYqDVHOttHvqNpee6we2wY2vgItGXkXzTnV/J7HpJKAa7mv/j GEpw== X-Forwarded-Encrypted: i=1; AFNElJ8cvksIDKaCNd7j3SRVtAdArKtU7tMPUeL4j+VkNrX/nrGrqJnneubFEL7js9cIfgw71nefModyxGrhaFA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxm6dHtXPPju81A5O/3fYlbU73RV3ftwegqlevIJ3J0QVZG+K2F z8ZDLwiOrCDhJiI1t2XiYdcfTADc1bzmD6fbTktrXvNs+vOisdXcbxuqalN3XpHffT+wJtLB7xR rWMCiew== X-Received: from pfoo8.prod.google.com ([2002:a05:6a00:1a08:b0:83e:8f89:ead1]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:23c6:b0:842:672e:7b5d with SMTP id d2e1a72fcca58-847add9a0bcmr2789336b3a.17.1782865314387; Tue, 30 Jun 2026 17:21:54 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 30 Jun 2026 17:21:51 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260701002152.546245-1-seanjc@google.com> Subject: [RFC PATCH] x86/irq: Drop redundant irq_{enter,exit}() calls from posted MSI handler From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, Sean Christopherson Content-Type: text/plain; charset="UTF-8" Drop the unnecessary irq_{enter,exit}() calls from the posted MSI handler, as the wrapper provided by DEFINE_IDTENTRY_SYSVEC() does all of the necessary bookkeeping (the x86 specific entry/exit code provides a superset of functionality). Note, in the series[1] that added DEFINE_IDTENTRY_SYSVEC(), the follow-up patches that actually use DEFINE_IDTENTRY_SYSVEC() drop all {entering,exiting}_irq() pairs (including entering_ack_irq()), where {entering,exiting}_irq() were little more than wrappers to irq_{enter,exit}(). TODO: Explain what, if anything, can go wrong? Link: https://lore.kernel.org/all/20200521200513.656533920@linutronix.de [1] Fixes: 1b03d82ba15e ("x86/irq: Install posted MSI notification handler") Signed-off-by: Sean Christopherson --- RFC purely because I have no idea what can go wrong, and I'd like to document any potential issues in the changelog. I'm confident in the change itself, or I've failed miserably at reading the code. :-) Found by inspection when looking at a bizarre code fetch from RIP=0 #PF that traces back to the irq_enter() (no reproducer for the #PF at this time). I don't know if the redundant bookkeeping contributed in any way, but the calls to irq_enter() and irq_exit() really stand out, because AFAICT, these are the *only* calls to those APIs in x86. arch/x86/kernel/irq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 30122f0b3af9..0ac63628a585 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -430,7 +430,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification) /* Mark the handler active for intel_ack_posted_msi_irq() */ __this_cpu_write(posted_msi_handler_active, true); inc_irq_stat(POSTED_MSI_NOTIFICATION); - irq_enter(); /* * Loop only MAX_POSTED_MSI_COALESCING_LOOP - 1 times here to take @@ -456,7 +455,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification) handle_pending_pir(pid->pir, regs); apic_eoi(); - irq_exit(); __this_cpu_write(posted_msi_handler_active, false); set_irq_regs(old_regs); } base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482 -- 2.55.0.rc0.799.gd6f94ed593-goog