Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2931248pxy; Mon, 3 May 2021 11:08:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcXc0TlFipEf5F0DU/WiQqnAShH7Zklt3F39I4kZAXPfQguxltqr7fnJAQYaK7vg3wpxMy X-Received: by 2002:a65:6705:: with SMTP id u5mr13378249pgf.418.1620065329022; Mon, 03 May 2021 11:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065329; cv=none; d=google.com; s=arc-20160816; b=RP7Vr/RnzUbZtwosWdfO88MB/WSoxLRzFGE3GsQOjtL77wV62+GUoG3UpEWUkaMMPG ScUes7TH+g7dYNoEEz7GtG1VmMmwALx/XQ63oAI14W9cIilnTuhN12AE7oRA2nozbkft gUeNqWfnSTuLE8+GDV9v5CsNJkHiFFgsAqy1j3DLHOA8tvKNcyCfmX5U8ZedNXF1czzP ykJw47zdBFVlKQA/9kFuiIDUh3PO+Ilvg11yGNwfNq1rVEjBOBxIeeLyuGCBodnT5JB4 IsxfddXiaWJxtCo9kQBpkyOFW2Z3E7Ej2F5yuQfVtOF6lRs0aRmaBfML7LrTGa4Oe4LN YAJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=6dspLzh/pMWW3XSTEBBhGvhFVlVkfRpL/2O1QA930Zk=; b=sBC1v4qOzwGhkfMr6V5zkUSbMShpZXKW+ys+rpWrNzBC4XtIHqEbhdGLIHp4h7n+7X 6uoknEpGa2fTIM8qiImKdyPYLO6ig0N6YVujS7OdD7vux1xVUx76ZxpKBvhhLwBSKwD6 kgbKM4UsZIG5CqFrSWqtMuqiaKSMII2nlBshO+UBkwaNYfhu+Ufc6r27m+sMKzQy/5T3 ymYS/h9tGCoKrM4IJSm2eIpI7hFNGMMmhXNH3U7/Ycr6KrnwKvx33jusW1qatTDmQyGr TpdbGlNR5gtj+mu/6cvyEcY+xbusuxnCzYlsBzmL/juNSpLFEG0QISKnq8LnkIt81Nhw wm1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BOIOQsx5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si407887pgd.314.2021.05.03.11.08.34; Mon, 03 May 2021 11:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BOIOQsx5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbhECO14 (ORCPT + 99 others); Mon, 3 May 2021 10:27:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52941 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhECO1z (ORCPT ); Mon, 3 May 2021 10:27:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620052022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6dspLzh/pMWW3XSTEBBhGvhFVlVkfRpL/2O1QA930Zk=; b=BOIOQsx58rzjiUZ3D21y26cnCjMq3DuYBktzqPAsANiBOQLAe+DKuPNbeRbPXYAWcj9V2F alSzCoFfqMFjbzfgVrqkYudOJuuaSG8Ks1mIzyHjz3XG6AMewzduf16TFqjt88AqEjUUYP yt4iwjdWUA+rUto6VT6yUlCMjgCiyOI= 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-465-1Z7EDIFkPCaf2cszL0zlXg-1; Mon, 03 May 2021 10:26:57 -0400 X-MC-Unique: 1Z7EDIFkPCaf2cszL0zlXg-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 E9F1C107ACE6; Mon, 3 May 2021 14:26:55 +0000 (UTC) Received: from starship (unknown [10.40.193.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A82219D7C; Mon, 3 May 2021 14:26:51 +0000 (UTC) Message-ID: <4f0bef0224a947a4ac3862175b4bce21eb0c0701.camel@redhat.com> Subject: Re: [PATCH 5/5] KVM: nSVM: set a dummy exit reason in L1 vmcb when loading the nested state From: Maxim Levitsky To: Paolo Bonzini , kvm@vger.kernel.org Cc: Wanpeng Li , Thomas Gleixner , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Jim Mattson , Vitaly Kuznetsov , "H. Peter Anvin" , Borislav Petkov , Joerg Roedel , Ingo Molnar , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Sean Christopherson , Cathy Avery Date: Mon, 03 May 2021 17:26:50 +0300 In-Reply-To: References: <20210503125446.1353307-1-mlevitsk@redhat.com> <20210503125446.1353307-6-mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-05-03 at 16:02 +0200, Paolo Bonzini wrote: > On 03/05/21 14:54, Maxim Levitsky wrote: > > Since the nested migration is a result of a VMRUN, this makes it > > possible to keep a warning that L1 vmcb should always have > > VMRUN exit reason when switching back to it, which > > otherwise triggers incorrectly. > > > > Signed-off-by: Maxim Levitsky > > Does this fix "KVM: nSVM: If VMRUN is single-stepped, queue the #DB > intercept in nested_svm_vmexit()"? I don't like this, and also vmcb12 > is not initialized here (nested_load_control_from_vmcb12 is using the > state passed in from userspace instead). > > I think you should just remove the WARN instead. All right, I'll do this! Best regards, Maxim Levitsky > > Paolo > > > --- > > arch/x86/kvm/svm/nested.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c > > index 12a12ae940fa..146be4b5084b 100644 > > --- a/arch/x86/kvm/svm/nested.c > > +++ b/arch/x86/kvm/svm/nested.c > > @@ -1338,6 +1338,12 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, > > svm->vmcb01.ptr->save.rip = save->rip; > > svm->vmcb01.ptr->save.cpl = 0; > > > > + /* > > + * For consistency sake, restore the L1 exit reason > > + * (that happened prior to the migration) to SVM_EXIT_VMRUN. > > + */ > > + svm->vmcb->control.exit_code = SVM_EXIT_VMRUN; > > + > > nested_load_control_from_vmcb12(svm, ctl); > > > > svm_switch_vmcb(svm, &svm->nested.vmcb02); > >