Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp105336lqp; Mon, 10 Jun 2024 20:47:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDGx4FSul63Hl/EZl1kjKReX3LS66IsI2l5KtcvqdTYcxxLki/aSE+tthHqSHh5MPHpp9sHTsB/hMZAXjhD8mlY36U8oD0oNIyKLMY5w== X-Google-Smtp-Source: AGHT+IF846V0tRMCNIc8r5yCC0ogUJHJ/uzRy6/sjvpCktTSDa+BhixcGehxD9m8re9vWOxEhTXy X-Received: by 2002:a05:6808:1316:b0:3d2:1740:c811 with SMTP id 5614622812f47-3d21740d522mr13705421b6e.35.1718077670391; Mon, 10 Jun 2024 20:47:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718077670; cv=pass; d=google.com; s=arc-20160816; b=lwButgery416MRDWHRxvERT5LjrX9w9SoOwP9FWWQSaEKr5KHeqVo0nvNO5761ZUuK +euCFY4nTSMgDFMSlyuZrJcP2Gd7O8yDdwiAZwNBz/jO4Vu23M2iapcd1JZ4/SUXAhq8 9k+2ikcdlwMSAEPvqX78wMl5RJuTqVfMBSgxP5txtmfRVp4mxuNT+eTEGgY2p7RDm/y/ 35pwOdbaXHkqx31wpLJVM3tqUhmFTIiOFjyKrErYa16VotZD2Z1KHF1S+4GZxeOYAPxl GoEvJmFwSo0TS03mKNaReyldRt5CgJjirdByuFjK4G8lnv8hMwjitCs8jxtYRk1hJ684 JChg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Gl/RVYtUWAmdJmYhx3bWwluPkKF6eTc3z6iPlXxf8LE=; fh=FVpzMb8QF8ZNTkTwP9z6+7gaf+X3cl3aZ4YbvCVj4Iw=; b=A/j3oYWgjgsY7ptLPYaimt4g2vQ3oN0Oi4rPqVXJZBALrr+59Pn8v4RTy59JIFZMED CcqSlRLYxIvFJSrKPQxFvtiGz/cEk6cvC+TzKnrT9LyoZ78mIPlAcI3e5hCaRaz6EH2W 9EBPnxckaZvgx37V7KyRekgVHb5gqScS4cpFULPT70SZIMuznvCk8b1xCzOLT7HsBlny 3f0ldUlMbr/BbAUmGhpVy5TYwLoy7LP+zFZQ48afvQOa/oYJ7ahLPdsNMLB0va6OqW8t Xwlc4CxKXvg1kUPuPCutCGmFSp4tSYW+pBnjHRXm7XQPE06N5WPuFWMxYH9ZbPThIsPs 9Leg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PnVtCIp4; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-209227-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e4edbd94dasi5038841a12.348.2024.06.10.20.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 20:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209227-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PnVtCIp4; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-209227-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CE109285012 for ; Tue, 11 Jun 2024 03:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CB4A16F91B; Tue, 11 Jun 2024 03:47:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PnVtCIp4" Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 41DEA2AE8C for ; Tue, 11 Jun 2024 03:47:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718077660; cv=none; b=Di7Nj/IWgNnmC+JM0MHDkRndcFLcJRTO7efIG3/D8fyEuggg6vWkKsyHB6QHBxWbsGDdUbS7C1JpE/S0BlmhEYZpe8YOnl9ACZ2BM5GXmzZ2JCW45HA+iIkD0sg/6zuPQ8lPHVeXefiLiZoUBVUlOlHndBDeGOS34M+iU5XoR3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718077660; c=relaxed/simple; bh=ImC9OdLsLq5zNZ6vdjGWmQM6DDhoKVkf/yl46Ae7Og8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TdgS0WnJ+bfhGioqXSa2SYp1PPdr36E1dCiII5nurjpNkwIWH9Jf0lVogzN/xrX+/VIej7uBRMdJqdN5iu/WH5OjdvMoWn5zU1QKRpaoUP/P6bH06X/x5YfWEMW3D2+sOMtnBxupioDUzo78hmac7LfIzqIZSfPDucX8Ud3QjUk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PnVtCIp4; arc=none smtp.client-ip=209.85.208.41 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=google.com Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57c5ec83886so5580a12.1 for ; Mon, 10 Jun 2024 20:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718077657; x=1718682457; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Gl/RVYtUWAmdJmYhx3bWwluPkKF6eTc3z6iPlXxf8LE=; b=PnVtCIp4on/k1VCDLATSzAf8Pi1yHfxD3sgK9nJ9Ttt9I+hGWN0u+OR5GhpcngKuBM mbVjoo182IPxj3/AFLt/C44x5XKeC+IjZlJQYfameC9AsKT2codr2GAfEgjfpCqPUgXp a1KnuUPXypcs8eVV9gQhEI/IRZjI2TAPMDlFs/lFFcBi1rgDdhUBmHPDMieV/S+z/oun G8gwUFvGK1F44WnplhT2I4yZ9O9/gb9oE4epK9amAW/KPCeo1H9m+DREZqxFBCWuFHIi lUQbMmnyLlJ8pZqOl95jKomVshiTRFbHzdDtdxoxkRH00CSlhhtHEL0Tpni1S/XWEcWq gAww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718077657; x=1718682457; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gl/RVYtUWAmdJmYhx3bWwluPkKF6eTc3z6iPlXxf8LE=; b=lq0zvqsFKJiqhMX+QPpYFqt5UCQb0Q/u6tSkuFtlbKrCu8T4CkQZfiePRl4+HKPcJ+ bgjwCm2EyyF6E9VZOBAHHVwf8PdFgykOrlR0/UVwArOUpFAy3kLmW8G836HP16TEc6Ix Hh2xlOsVJeFlguY8qtrjEok5V1Fy0K49icT3Iz0RizTmeKFHKZ+lg52km7H8jX65PYGL sVxGWHghfLXGuEUDY2qTQy2iYPX+3AhxBcj6ZaHh0bDSGWXYC1S57oNHaUl+0Gh8GaSa 8SgEjg4bGpLQGOVWCt+cLZ/kJnd9gY/VUjv9TsbjJfuNcpLdqxW6iVEXdM+T7h6n4X1L xdbA== X-Forwarded-Encrypted: i=1; AJvYcCWq6/HNUY2hFYfkiA+22OW1ucvevosUlCw2a2guz9sveJmMXKI0qW2ZbC2SX776Y+d4VMV5Q92lxLapFs1iYujFT/GsLh0CLvAqCTgw X-Gm-Message-State: AOJu0Yz3rrlUUUaFqSLMAgYIWRgqng45r8jxEZls1zY+yGfZN+WqdfZh ZcXBlx2cUFj6J4q4927E1ve6bxd1tmtlqcO2JXpBM7IzFCliWH8/tM8R0obfSTkawargb7QHRYS F5kPv3BkPswhQSkwwRP9LUbTIWmyD/omCyT6e X-Received: by 2002:a05:6402:b74:b0:572:988f:2f38 with SMTP id 4fb4d7f45d1cf-57c92510457mr152515a12.6.1718077657109; Mon, 10 Jun 2024 20:47:37 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240611014845.82795-1-seanjc@google.com> In-Reply-To: <20240611014845.82795-1-seanjc@google.com> From: Jim Mattson Date: Mon, 10 Jun 2024 20:47:21 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86: Always sync PIR to IRR prior to scanning I/O APIC routes To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Adamos Ttofari , Raghavendra Rao Ananta Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 10, 2024 at 6:48=E2=80=AFPM Sean Christopherson wrote: > > Sync pending posted interrupts to the IRR prior to re-scanning I/O APIC > routes, irrespective of whether the I/O APIC is emulated by userspace or > by KVM. If a level-triggered interrupt routed through the I/O APIC is > pending or in-service for a vCPU, KVM needs to intercept EOIs on said > vCPU even if the vCPU isn't the destination for the new routing, e.g. if > servicing an interrupt using the old routing races with I/O APIC > reconfiguration. > > Commit fceb3a36c29a ("KVM: x86: ioapic: Fix level-triggered EOI and > userspace I/OAPIC reconfigure race") fixed the common cases, but > kvm_apic_pending_eoi() only checks if an interrupt is in the local > APIC's IRR or ISR, i.e. misses the uncommon case where an interrupt is > pending in the PIR. > > Failure to intercept EOI can manifest as guest hangs with Windows 11 if > the guest uses the RTC as its timekeeping source, e.g. if the VMM doesn't > expose a more modern form of time to the guest. > > Cc: stable@vger.kernel.org > Cc: Adamos Ttofari > Cc: Raghavendra Rao Ananta > Cc: Jim Mattson > Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson