From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796433077; b=4ybQuZP7Uag1YYG3u3vT3TkAJ6alwbHLoGKe1Uuz8f8yFR1oxQ0PUA5idC1/ctvkpAiv /P8FoA4V5WDGwhF11gRrGA7ON8xO70fZI2zf02wSMaaIMFn+Mq52qTm0DMQ0hn6ehZ6IO h+UNHpA22dRAs79S99GczM5WoLn67kTrkOg0nldVcpRnVVie2E+sKwJ5WQxZnbeikQsCp zASe+Y54di9iykQa4qGPbP3+9FjmFwli32vJgniybAY016E2N7CMoDUj5Cjtf2d0CVq+B VCmPYV59ZCkZ5psCrY1nPZxUqTPwqQG0qhgHEQa8PDFduQGfQtC5N/ZA9gKVqtaB6hQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796433077; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=4ttQsY21SOax5Ieh6wCWcoLX7ixLLbIEj7AVhiMQna0=; b=fBqwwqjE74cnMpJUK0OtuvlyQkaNAa7tqcD1+UwVMnlB1QhSrFKmTQqMhBzHNFZoCwrx udYUVCpf2NR/xEPQOwnE5OKvK6qiXpVnidxdeC4hUFGpYoDlQtPnwrrby3qNpbo3N4vDR W0ECFDX3broxc/IYviINwUPBxGydYRvSqqd30C0ngvquioWiVJZRM25QcXHFNyvZocu3s Y4NeNPC+iBxUoy4NxXyNdZLdwsKLXI27NOTI9cB+p9QY7SQNvqNY4YuJJZ8hM8gHV9MCq Aih1Vwjoh4N70oi727va11eiiz43GtT1xak7KURmXayfHV5QdA12U73TMjTkMZVlz4Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=j04zJnLm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7826E606A680; Sat, 5 Dec 2026 01:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=j04zJnLm Received: by smtp.kernel.org (Postfix) with ESMTPSA id E76D51F0092B; Sat, 5 Dec 2026 01:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796433077; bh=4ttQsY21SOax5Ieh6wCWcoLX7ixLLbIEj7AVhiMQna0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j04zJnLmH105VKcY/CNNcXRt+jy1OyrZuA+E4tH6sNhHIcJfAqy0x34LJoX/eupeT GQWO1NCoZ/2M6U83R/j7rJiHP2hU6LJmeTkHaNtBvPFnpyM6qxWwC1MEMPfZxuoMHT iocVjoedlFyvbnCNpyHEpSGEDoNC0zUpksBufdaEFplPQO8AwJ+WnvcEwmmgzEst6+ PIrKqGJIKL/38osc1idhbe4G+PYPvqYBzCh5XtdSWOQvFhDvne9c5VBjkLGvu8R185 BZz+zWmNcU4KD00MXHuaUl2e74obyilk6poPAX695OyzRJ93iYP9b7HEFyhfAU+wOd LuiFsbche+STw== From: Yosry Ahmed To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed Subject: [PATCH 2/3] KVM: nSVM: Call svm_update_lbrv() outside nested_vmcb02_prepare_save() Date: Sat, 5 Dec 2026 01:11:06 +0000 Message-ID: <20261205011107.2050815-3-yosry@kernel.org> X-Mailer: git-send-email 2.56.1.987.g2ec0ab4260-goog In-Reply-To: <20261205011107.2050815-1-yosry@kernel.org> References: <20261205011107.2050815-1-yosry@kernel.org> X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit svm_update_lbrv() must be called after both the save and control areas of vmcb02 are set up as it uses fields from both areas. In the nested VMRUN path, it is called at the end of nested_vmcb02_prepare_save(). Move it to its only caller, enter_svm_guest_mode(), to make it more obvious and consistent with svm_set_nested_state(). No functional change intended. Signed-off-by: Yosry Ahmed --- arch/x86/kvm/svm/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index c5a572b58be07..44afa4068e05b 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -821,7 +821,6 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm) svm_copy_lbrs(&vmcb02->save, &vmcb01->save); } vmcb_mark_dirty(vmcb02, VMCB_LBR); - svm_update_lbrv(&svm->vcpu); } static inline bool is_evtinj_soft(u32 evtinj) @@ -1070,6 +1069,7 @@ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, bool from_vmrun) svm_switch_vmcb(svm, &svm->nested.vmcb02); nested_vmcb02_prepare_control(svm); nested_vmcb02_prepare_save(svm); + svm_update_lbrv(vcpu); ret = nested_svm_load_cr3(&svm->vcpu, svm->nested.save.cr3, nested_npt_enabled(svm), from_vmrun); -- 2.56.1.987.g2ec0ab4260-goog