From patchwork Thu Jan 7 09:38:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 12003363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90F9DC433E9 for ; Thu, 7 Jan 2021 09:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CDBB2333D for ; Thu, 7 Jan 2021 09:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbhAGJkx (ORCPT ); Thu, 7 Jan 2021 04:40:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41604 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbhAGJkw (ORCPT ); Thu, 7 Jan 2021 04:40:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610012366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/rUDn4iUvZuPv1RG4V69vuqnelYUdquiGujPqeCfAnA=; b=YE4wXhDitRzgVI7IN80dJzghK65AZ2Scem55IwuCJ0+Mfj0gxmUYmYiRxz3C+z6zooLFN4 /FC//A8fX5hxNNmKSHq87hdGOgPTjKHv6idJB15pqWi2OeHsW64Xsarf0VKbXGu/Wi6C8z N1LXv0N0BbJ7mLHexE2Ldo+TLJ6IWug= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-m098VikkMHCG-6o0mpOXiA-1; Thu, 07 Jan 2021 04:39:24 -0500 X-MC-Unique: m098VikkMHCG-6o0mpOXiA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1BDA10054FF; Thu, 7 Jan 2021 09:39:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2375E19D7D; Thu, 7 Jan 2021 09:39:18 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Vitaly Kuznetsov , "H. Peter Anvin" , Sean Christopherson , Borislav Petkov , Paolo Bonzini , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Ingo Molnar , Wanpeng Li , Joerg Roedel , Jim Mattson , Maxim Levitsky Subject: [PATCH v2 4/4] KVM: nSVM: mark vmcb as dirty when forcingly leaving the guest mode Date: Thu, 7 Jan 2021 11:38:54 +0200 Message-Id: <20210107093854.882483-5-mlevitsk@redhat.com> In-Reply-To: <20210107093854.882483-1-mlevitsk@redhat.com> References: <20210107093854.882483-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We overwrite most of vmcb fields while doing so, so we must mark it as dirty. Signed-off-by: Maxim Levitsky --- arch/x86/kvm/svm/nested.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index e91d40c8d8c91..c340fbad88566 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -760,6 +760,7 @@ void svm_leave_nested(struct vcpu_svm *svm) leave_guest_mode(&svm->vcpu); copy_vmcb_control_area(&vmcb->control, &hsave->control); nested_svm_uninit_mmu_context(&svm->vcpu); + vmcb_mark_all_dirty(svm->vmcb); } kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, &svm->vcpu);