From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.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 E512C26FA60 for ; Fri, 9 Jan 2026 03:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767930336; cv=none; b=Df3BCUFN45QB8LLlM/S1kAJusVCC0LzE8ZC5nB5F94oXO5n2hNfJSv+Hwhfsv/R+RPGzS7yRl8UVJHFfrkCK0EYPXiUx++QTfRH5n0hylw6VtMsKdYLImdg3+mHi2sZbHzj2kOumqvFxV/Ck1eCNzUI0Dl397yTI8x3/BARjGFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767930336; c=relaxed/simple; bh=44NLMQg7b0qPekFfq0rXAqzfW6KbwOTNoHdMKnldv+w=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=qIsTy+JjG5ylQ6tjSCk4kIA1FXVGM+lPPl4ItmGQeInhwiRcwIO+3o0ZQCrYAtzS3qZ09nhu9/Zq3w8k0OYJHPUGZRjbJvmxXn89fzQCCnIiTDFm+04pZv0dZ0l1clc9Rj99RG5GZ+2W9VL83vg3DECPjJUf7sagMOFbrAy+b9E= 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=4vQNAg0O; arc=none smtp.client-ip=209.85.214.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="4vQNAg0O" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2a0d59f0198so42130325ad.1 for ; Thu, 08 Jan 2026 19:45:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767930334; x=1768535134; 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=Usyyv3vbn9Zs1dHefvSjaFrxGu3puMMI3CZOd1kdzpo=; b=4vQNAg0OIJyWITVZpi1/I/8qYVteot8e4zR3+3EGWqJI2IR1+B9TfOWkKYcvWXoOAl DTd5b8e4BON5Yjleoyt+cwF/djInxkLTa6lKYp4A8hiYx4HSt2xkej4UFMHJ01HDDsYf GR3pZKncbW6PeUqQwcz3x9NXx44RVRQFWCAVu1IegnIa5EARqqTpocw/RjveOCNMBtNG pvinT4B9AKFJli+ZcTPEPseqUGgfG93y9jz32EBrSFBnQpgqsWSVOdwHz35/Zov9hkqU phi4BL0Nu08+sS9JWxz5leed1M7RX9KzETBOQR1AUUry9xL8nqwuRtRqeKRQuuZ6LV08 h7NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767930334; x=1768535134; 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=Usyyv3vbn9Zs1dHefvSjaFrxGu3puMMI3CZOd1kdzpo=; b=pIDb4E+7IOORDbPAWZmI9Fn+VUp1nHwY0fLTMT+3wqqbBfBxnUTp9wECj5Vsz4X3Im 1N27yOfh+Nv8IZ9oqVu7BwmemKUSI1s9dfhZcuC8E91LfD2g7zpaPJbIfy1Rdu9BzKr1 nsO4iAU+OtAC44LIYXtxeqCiij9sGogfNIkxq/U4z6f5yGxVHeBUyLkZl7mnp9bLstGU mHeGse9JNrLWd1eOSc7jgAbmN4p1ERSNgWLFHy4B59QUK7Hh0RUJy/bOVckNMtko5K+R Z1Hsbkz56+gZUdmGO2hkC7o6J1izMsKcBTRue8hthekuNmc1Z/lHCQ5wL+KzBdiRT07e 5y+w== X-Forwarded-Encrypted: i=1; AJvYcCVusSuo2ibgubXNYWKE2NVv0K6ubo5X2UsjSRjVtLpeYHVYcJ4j7p3fRtRgFFmZ3XN7PPd2ZrOT1V5LQbs=@vger.kernel.org X-Gm-Message-State: AOJu0YyTLDvMDVD88Wpfz8uMK91aEjVYULXorB2jfL/SaC6jWv5CVRT+ zcxc4NvNQV1Tx4VCl+KeWUKR8oe0Yud+NyIN547Y2fcORBrbOSrdBPFvZlP+W2fgYGizTDL/D6+ 7gAMo0A== X-Google-Smtp-Source: AGHT+IFfD/dUdsnoh7snkCHevc54ELReyloloUGxnk/RwpEyG/V7WAfylfRUmjo47S/SD8YVDoXIuxgoETs= X-Received: from plma18.prod.google.com ([2002:a17:902:7d92:b0:2a0:9ab8:a28d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:b84:b0:29e:c283:39fb with SMTP id d9443c01a7336-2a3ee4d9e3dmr77961705ad.52.1767930334263; Thu, 08 Jan 2026 19:45:34 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 8 Jan 2026 19:45:24 -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: <20260109034532.1012993-1-seanjc@google.com> Subject: [PATCH v4 0/8] KVM: VMX: Rip out "deferred nested VM-Exit updates" From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Gao Content-Type: text/plain; charset="UTF-8" v4 of what was "KVM: VMX: Fix APICv activation bugs", but the two bug fixes were already merged and so that name doesn't fit. Rip out the "defer updates until nested VM-Exit" that contributed to the APICv bugs and made them harder to fix. v4: - Collect reviews. [Chao] - Use the existing vmcall() in the selftest. [Chao] - Use GUEST_FAIL() instead of TEST_FAIL() in the guest. [Chao] - Correct the number of args passed to the guest in the test. [Chao] - Remove the redundant hwapic_isr_update() call in kvm_lapic_reset() - Use the local "vmx" variable in vmx_set_virtual_apic_mode(). [Chao] - Relocate the "update SVI" comment from __kvm_vcpu_update_apicv() to kvm_apic_update_apicv(). v3: - https://lore.kernel.org/all/20251205231913.441872-1-seanjc@google.com - Add a selftest. - Rip out the deferred updates stuff. - Collect Chao's review. - Add Dongli's fix for bug #2. [Chao] v2: - https://lore.kernel.org/all/20251110063212.34902-1-dongli.zhang@oracle.com - Add support for guest mode (suggested by Chao Gao). - Add comments in the code (suggested by Chao Gao). - Remove WARN_ON_ONCE from vmx_hwapic_isr_update(). - Edit commit message "AMD SVM APICv" to "AMD SVM AVIC" (suggested by Alejandro Jimenez). Sean Christopherson (8): KVM: selftests: Add a test to verify APICv updates (while L2 is active) KVM: nVMX: Switch to vmcs01 to update PML controls on-demand if L2 is active KVM: nVMX: Switch to vmcs01 to update TPR threshold on-demand if L2 is active KVM: nVMX: Switch to vmcs01 to update SVI on-demand if L2 is active KVM: nVMX: Switch to vmcs01 to refresh APICv controls on-demand if L2 is active KVM: nVMX: Switch to vmcs01 to update APIC page on-demand if L2 is active KVM: nVMX: Switch to vmcs01 to set virtual APICv mode on-demand if L2 is active KVM: x86: Update APICv ISR (a.k.a. SVI) as part of kvm_apic_update_apicv() arch/x86/kvm/lapic.c | 31 ++-- arch/x86/kvm/lapic.h | 1 - arch/x86/kvm/vmx/nested.c | 29 ---- arch/x86/kvm/vmx/vmx.c | 95 +++++++---- arch/x86/kvm/vmx/vmx.h | 9 - arch/x86/kvm/x86.c | 7 - tools/testing/selftests/kvm/Makefile.kvm | 1 + .../testing/selftests/kvm/include/x86/apic.h | 4 + .../kvm/x86/vmx_apicv_updates_test.c | 155 ++++++++++++++++++ 9 files changed, 232 insertions(+), 100 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86/vmx_apicv_updates_test.c base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578 -- 2.52.0.457.g6b5491de43-goog