From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 B08AB18B484 for ; Sat, 15 Mar 2025 03:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742007996; cv=none; b=cCWoGs2LOXPNjbkEB7/R5PZlaAoIO7cp8uQKnYwxnsoAoFTJbfS2T4wvAJOOxf+zirJhpbANgwW09XESzvnN8tZ9WOeqt8W3dwgBPBIjmYKW0x6l++zOwTrhk1GFZ0eardDNzncWN0cPfKHZzvGHdwhhtikzh463cxhSeLAvYws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742007996; c=relaxed/simple; bh=ORxMRxanum7dJ4QhbbOoW6MS6dV40SegF61qcn5cQK8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YWyUurtlCfZT2BoWRVolhoodbNSibC5lEIn366zqFPDwYzMntxo4aM9ldV8pLOk1B3MEyRtMZ/7Zpf4/ixpJCR4LOZrpT28+7eAOonxGVkwSFoDt/AzvEHuFNZQbnqiVlWlPLdxinehNxyg85ewav1fhjVq1WXaTfxgi8xZXdIA= 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=UAMT/Ldj; arc=none smtp.client-ip=209.85.216.73 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="UAMT/Ldj" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2ff854a2541so494224a91.0 for ; Fri, 14 Mar 2025 20:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1742007994; x=1742612794; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=A+D7/CZc6x+lcAi6xbF5IFcWIU9h8go1MiK4EHRJXP4=; b=UAMT/LdjeX0edyYremYgTvkrkszCPGCpjVyAYX62V4ktJUi/Z/M1s/Qewwj03Gvphb 2H4ZickLHWjxa5xLDisv8t4jq7XBY5DL0zFG28iyXQduvGGaiYRSUJz8PCPav5XOQZqW YEBYZMlqBkAzLI4SQPS4b7QYouAKWh+8laX7hFkwSCjyp+f2XgR8dTuHLeGztbx9r7zo OMfHDtzBE+fj4iYBAdd/PvUeILJy+kD/YFbt4YNzL5LuHQMJjA+TcnOzFIGuX5iL8Un5 6HbE1FnABlkL9nZ8+uURlYasmbds3ssIkqV+0UF+xpdNZFZev7Bi17V9BkDo+kK54cw9 e1iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742007994; x=1742612794; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A+D7/CZc6x+lcAi6xbF5IFcWIU9h8go1MiK4EHRJXP4=; b=iquvMETaao9lu7QBKy7EzbM9Z3tyb2gulNTO1iT/C7bXHKGEQEPlOngx65hNLKMrWf 0fx1KAm1Ak+8CURX4JYK72lJVhORdjXmgMoEIEWXoXLSsCmbMqZQ5BSrjwpciz64m8zs LS4tN4thCxImn574r768L2Vp2ucmh1ZulwbgBDVFq09K5wdGLf7fFX7HTi2XAxnqVwY7 C8kQaug+TVHGW0bzi/qwxAqeABdkIln46td0Cc4RncPzNNleGzu1ARwzZGuDabmtb+13 cQShjJkfidloefUmDlfVVLiMNZ7wqs5OaUsd8ZaMoPkb8PPb+tnvIP8zt7Ofk3hV3klU mQLw== X-Gm-Message-State: AOJu0YxC3t2/nXbvEIF1KRxtCby+J4AiYmKR7Qiv4bYEJyGFYVQ+V2AF nUcWAoG7CzLZcXHs1WGi54W5h5IAsbd7lXscQ2LVt+j34Z4eZ6vrIVJejq90UQUDpuVa++kutL4 NsA== X-Google-Smtp-Source: AGHT+IH3X+L+I/21qttxgDTkKxHuhAtYSP/nASSYaa/gcSlKKoQ0V6Lk918oh7tBqn4FZDeDooNPZD4EXAU= X-Received: from pjl6.prod.google.com ([2002:a17:90b:2f86:b0:2ee:3128:390f]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:fc4c:b0:2f4:4500:bb4d with SMTP id 98e67ed59e1d1-30151cc8c11mr5807708a91.20.1742007993991; Fri, 14 Mar 2025 20:06:33 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 14 Mar 2025 20:06:22 -0700 In-Reply-To: <20250315030630.2371712-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250315030630.2371712-1-seanjc@google.com> X-Mailer: git-send-email 2.49.0.rc1.451.g8f38331e32-goog Message-ID: <20250315030630.2371712-2-seanjc@google.com> Subject: [PATCH 1/8] x86/irq: Ensure initial PIR loads are performed exactly once From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Sean Christopherson , Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jacob Pan , Jim Mattson Content-Type: text/plain; charset="UTF-8" Ensure the PIR is read exactly once at the start of handle_pending_pir(), to guarantee that checking for an outstanding posted interrupt in a given chuck doesn't reload the chunk from the "real" PIR. Functionally, a reload is benign, but it would defeat the purpose of pre-loading into a copy. Fixes: 1b03d82ba15e ("x86/irq: Install posted MSI notification handler") Cc: Jacob Pan Signed-off-by: Sean Christopherson --- arch/x86/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 385e3a5fc304..9e5263887ff6 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -412,7 +412,7 @@ static __always_inline bool handle_pending_pir(u64 *pir, struct pt_regs *regs) bool handled = false; for (i = 0; i < 4; i++) - pir_copy[i] = pir[i]; + pir_copy[i] = READ_ONCE(pir[i]); for (i = 0; i < 4; i++) { if (!pir_copy[i]) -- 2.49.0.rc1.451.g8f38331e32-goog