From nobody Fri Apr 3 09:28:59 2026 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 E667A33A9E2 for ; Wed, 18 Feb 2026 23:10:14 +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=1771456216; cv=none; b=DvzmxGKNSat0r6jJIACvk1voEBLniE0eB11g0W2b5bWYSDUB2o3xbD111cjIAoN28RD3WXlOMcJeat1raOMeq6lqgnDTqY8FzA26ck8I25+Po6cxeCS7pP1RkPXDUMXg/tcnN3WLuziIeqPX6uxoQGR3iIWcLuRCHfKq1LjBefk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771456216; c=relaxed/simple; bh=lp/uTjjtBQSfze7HySN85sutooSpbSENQzv6kea1z28=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rJcSWUHNpbDPW2cItw3pTdTmrryHTPnlV3aoKa3hVYmfjNoaUVQ9qI4oEeXbltFgDt1UjCuUFeD0EJosdauoq4b1dKeAxT2Sp7hIrGg0ijHUKZ11RVhk2abWaUxJtGkSHMS0b3FhTjVF/KXDSx/7HQY4uqtN3SYlHS9T9QGp6fw= 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=vPlccHqg; 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="vPlccHqg" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-354c65f69edso338096a91.0 for ; Wed, 18 Feb 2026 15:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771456214; x=1772061014; 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=BtN/pTdYbIU/D5c0aBEqj7mrLMqBg1yrQ95ctx4mzdo=; b=vPlccHqgV+uAv5z+ClHvDGyIKsjKoiJ2zQdtGv6bBWNLFKDNBdECko1E6hh8xSiz/m Pgb+g0rNEGhy1OpRViSkd70LZ2O1s7yjhWcsFYc+aUfR98sqb5z5ryoJc9gPhsn0JzuS iT0BEf7ei2xoErYcCrRThmqWdCMx77Ohq2t1O8RCqobzafbz3VflRKeYQQo1drueEnuM LTO1pL3yegXIp8Gw5kXY+4rMqeJDTsdJhvekbr8JOws97VhNRISJzSxa/SYPiRUXVyte 31LjjtAcdNHib4SS30mbLBmicv518uzArvs+9qri1hZnUsF3UznoN9oEf/PM04IcYhQI HO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771456214; x=1772061014; 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=BtN/pTdYbIU/D5c0aBEqj7mrLMqBg1yrQ95ctx4mzdo=; b=Mt0kQVJz/204L4nAtod1Y5zpxAzLBrryVK6IM2i6a9LGpbTD4jm2jCmlR3oIirzyLj STI9pmL2hHvTE1hVF6k/4J95XUCGyfaTR20kX2yLVwZwDsFmCK/12RL7bFeaz7i5mf67 W36fRnTdqRZiUL8Ef/NfC3XHfibyD2IEkyn5z90vjMTDQsmycmWzSaHRHygk6Up5qdTd wuZgQzH/b63PYMpR083vPyxeJCbYyWmhJ51DM71NGeulJpDZup2NCJxwWgPHcJb04fJx tZwDMgdU37KTPyn2YQV7FG8uIVNzNxrhjB7c/RuKu1bZCTyUZB6X5rBHaoaU26UvAa8u QowQ== X-Forwarded-Encrypted: i=1; AJvYcCVpxxHHTWovBozgkgeD8i6ayvjhcZtN4gtTC9xNOiwkuNx3aOHLoWT54LlNJDRyHhWnKr8ky+4w1CRmJIQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzZtVxDn6URBVwu9dAa907tfvTluxtAR2EhrXaKDJ5R6pZrTH76 OsI4UMqmNOUjdN1pFEa4f4VjLQswvOuSUfHHwIIRtHH8fHS0RhFIBgE+7wIm7w4UAkIQXUxE4Ef tGsZypw== X-Received: from pjyl12.prod.google.com ([2002:a17:90a:ec0c:b0:34c:2f02:7f5d]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4b0e:b0:356:5cf2:eb77 with SMTP id 98e67ed59e1d1-3588902c42bmr2574011a91.2.1771456214190; Wed, 18 Feb 2026 15:10:14 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 18 Feb 2026 15:09:57 -0800 In-Reply-To: <20260218230958.2877682-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: <20260218230958.2877682-1-seanjc@google.com> X-Mailer: git-send-email 2.53.0.345.g96ddfc5eaa-goog Message-ID: <20260218230958.2877682-8-seanjc@google.com> Subject: [PATCH v2 7/8] KVM: nSVM: Move vmcb_ctrl_area_cached.bus_lock_rip to svm_nested_state From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move "bus_lock_rip" from "vmcb_ctrl_area_cached" to "svm_nested_state" as "last_bus_lock_rip" to more accurately reflect what it tracks, and because it is NOT a cached vmcb12 control field. The misplaced field isn't all that apparent in the current code base, as KVM uses "svm->nested.ctl" broadly, but the bad placement becomes glaringly obvious if "svm->nested.ctl" is captured as a local "vmcb12_ctrl" variable. No functional change intended. Signed-off-by: Sean Christopherson Reviewed-by: Yosry Ahmed --- arch/x86/kvm/svm/nested.c | 8 ++++---- arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/svm/svm.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index bbb8dfc9979b..bcd6304f3c0c 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -806,7 +806,7 @@ static void nested_vmcb02_prepare_control(struct vcpu_s= vm *svm, * L1 re-enters L2, the same instruction will trigger a VM-Exit and the * entire cycle start over. */ - if (vmcb02->save.rip && (svm->nested.ctl.bus_lock_rip =3D=3D vmcb02->save= .rip)) + if (vmcb02->save.rip && (svm->nested.last_bus_lock_rip =3D=3D vmcb02->sav= e.rip)) vmcb02->control.bus_lock_counter =3D 1; else vmcb02->control.bus_lock_counter =3D 0; @@ -1191,11 +1191,11 @@ int nested_svm_vmexit(struct vcpu_svm *svm) } =20 /* - * Invalidate bus_lock_rip unless KVM is still waiting for the guest - * to make forward progress before re-enabling bus lock detection. + * Invalidate last_bus_lock_rip unless KVM is still waiting for the + * guest to make forward progress before re-enabling bus lock detection. */ if (!vmcb02->control.bus_lock_counter) - svm->nested.ctl.bus_lock_rip =3D INVALID_GPA; + svm->nested.last_bus_lock_rip =3D INVALID_GPA; =20 nested_svm_copy_common_state(svm->nested.vmcb02.ptr, svm->vmcb01.ptr); =20 diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 9e76bf1671da..7c832a0decc2 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3223,7 +3223,7 @@ static int bus_lock_exit(struct kvm_vcpu *vcpu) vcpu->arch.complete_userspace_io =3D complete_userspace_buslock; =20 if (is_guest_mode(vcpu)) - svm->nested.ctl.bus_lock_rip =3D vcpu->arch.cui_linear_rip; + svm->nested.last_bus_lock_rip =3D vcpu->arch.cui_linear_rip; =20 return 0; } diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 92a1691dc7be..c4ed1be38ceb 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -173,7 +173,6 @@ struct vmcb_ctrl_area_cached { u64 nested_cr3; u64 virt_ext; u32 clean; - u64 bus_lock_rip; union { #if IS_ENABLED(CONFIG_HYPERV) || IS_ENABLED(CONFIG_KVM_HYPERV) struct hv_vmcb_enlightenments hv_enlightenments; @@ -188,6 +187,7 @@ struct svm_nested_state { u64 vm_cr_msr; u64 vmcb12_gpa; u64 last_vmcb12_gpa; + u64 last_bus_lock_rip; =20 /* * The MSR permissions map used for vmcb02, which is the merge result --=20 2.53.0.345.g96ddfc5eaa-goog