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 4BBA32D3228 for ; Fri, 23 Jan 2026 22:45:18 +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=1769208319; cv=none; b=GxR/3UvyvS2MLFBfcuQGsmxZE9oTJ8IEoQTB/bkycMpeqNsiXbWiefEwN+n1CIE9jZVrLVWe8oJ7ZoKJWIeca0bAtSOPhUAFiaqmDOAYqZLWeH/Cjs8LZIsmr76HaC3hJ05d+dx5WsHPiyE2rdxoTRAOAzyrEFzw7Sv6J/qUn4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769208319; c=relaxed/simple; bh=v/E1aIUaWVgBzmsteMHSbPl1m3HH9Sfm6pjuj4LnzQY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Et5N5V+KtREXVcJ5+QHfj32DhNZQZYRKuaTEyaMqQC+yDIo+McbkfbgKHGCCmzPI57L/vue2hr67CFlarEqtNi+wo2v1JhMB4L1QZL/pwKB38rLS31oShKNtLehwLkZ0V5TqibDIfVheNj2rSBIvGmQpQHum8T/nIun+KfQJVJg= 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=IoCQE/gH; 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="IoCQE/gH" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-34c5d6193daso5270959a91.1 for ; Fri, 23 Jan 2026 14:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769208317; x=1769813117; 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=VXA12E7mvF+SS7aKiDQN5dITsXHbb3FBTFXDK5xphl8=; b=IoCQE/gHBUGAGwcIPXG3qVpGNR2+RUMFbO4Elq6kVBuF+DZu33aNGkZwBVhVs9HgiY svkIQvLdaRbJu+uS12cS9NLnOv/YCbf6qfl+9Zi5g4vfGHLnvyN/z47TrRUzAFxMliMD 5QTnk0MgK8au03vjjjmNhpDfwBC/qCaBGWnQYXuUc6T2lEfddnLVzUDMr6qPbDODFtTA MAIcJ2j22lLLfdOeH/7VR4zdQ5B81gGAabUp4WXDShPaTYHvp8xfc23CrOha757o/lqb vCy4s5mthmqIeFJJzM6fO2yF35onzhyMw+5iRiFdfrS2WAoXw4YZvgv/X0YBfWL5bGUt ia+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769208317; x=1769813117; 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=VXA12E7mvF+SS7aKiDQN5dITsXHbb3FBTFXDK5xphl8=; b=dBOpCyQzR39S20wxYHhKf9PZYl4zkjxIhtLonrAZMyX9gs+dpvK7bPZcuNzV6NxL1e DzDP7CAuBMwaPYO3RgGVP4orl2JYTns5EA+z6eYc4KpyE0cF/TxqA7eLmB6U1k8OjmcS PNjfhhJYT5pXPrue4eY9DhFwFtabxG579UtZv1chk95klG4+2JwrMqdjEjJfGPUwg/8E dO16/6tpMaPuzIGNTaO6cQGfSp6AEgMRLDWID9BmvRkqiDeMI6MwvNngY7jHYG9pcZws dUZW7q03gxcupBmTn8h8+3gQni/hRLxVxBEOG3LoWx7Pxyhpq3wO+8MFkf0wCZHpciwu Q5EQ== X-Forwarded-Encrypted: i=1; AJvYcCVAOneY33pPvo8ApeSfNFfLx1BwccLgUuGg2IATRVmM/HUv085+BAjGZi+pC3LJtb/JQFn+jqNluhSg+2Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxVglaQm98eFKyFkUdJxcYfPWbhloME5VOGTp8KfAI0AIZUV2rv QDpQBiXDorz22PGNX0v0sQ6Dy6fh9T2IloI2Oy1/MY5nGaiZN0+mm3pBHhuvr3igatIVVRytxMe WZzw7IQ== X-Received: from pjbsf1.prod.google.com ([2002:a17:90b:51c1:b0:352:c761:3cf]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1b47:b0:352:c34a:342c with SMTP id 98e67ed59e1d1-35368b44660mr3641377a91.29.1769208317606; Fri, 23 Jan 2026 14:45:17 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 23 Jan 2026 14:45:10 -0800 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.52.0.457.g6b5491de43-goog Message-ID: <20260123224514.2509129-1-seanjc@google.com> Subject: [PATCH v2 0/4] KVM: SVM: Fix IRQ window inhibit handling From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Naveen N Rao Content-Type: text/plain; charset="UTF-8" Patch 1 fixes a bugs where KVM will keep AVIC inhibit for too long when running a nested guest and AVIC is inhibited to open an IRQ window. Patch 2 refcounts IRQ window inhibits so that "closing" an IRQ window on one vCPU doesn't clobber other vCPUs' windows when AVIC is enabled. Patch 3 optimizes IRQ window inhibits by avoiding contention on apicv_update_lock when KVM wants to inhibit AVIC to open an IRQ windows because AVIC is _already_ inhibited. Patch 4 further optimizes IRQ window inhibits by isolating the refcount and the lock in their own cacheline, e.g. to avoid false sharing and cache line contention with things like apicv_inhibit_reasons, which is read on every VM-Enter. v2: - Formalize the SoB chains (thanks Naveen!) - Explicitly isolate the write-mostly fields with ____cacheline_aligned. - Add Naveen's Tested-by tags. v1 / RFC: https://lore.kernel.org/all/cover.1752819570.git.naveen@kernel.org Original: https://lore.kernel.org/all/cover.1738595289.git.naveen@kernel.org Sean Christopherson (4): KVM: SVM: Fix clearing IRQ window inhibit with nested guests KVM: SVM: Fix IRQ window inhibit handling across multiple vCPUs KVM: SVM: Optimize IRQ window inhibit handling KVM: Isolate apicv_update_lock and apicv_nr_irq_window_req in a cacheline arch/x86/include/asm/kvm_host.h | 29 +++++++++++++++- arch/x86/kvm/svm/svm.c | 60 ++++++++++++++++++++------------- arch/x86/kvm/svm/svm.h | 1 + arch/x86/kvm/x86.c | 45 ++++++++++++++++++++++++- 4 files changed, 110 insertions(+), 25 deletions(-) base-commit: e81f7c908e1664233974b9f20beead78cde6343a -- 2.52.0.457.g6b5491de43-goog