Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp194058pxb; Thu, 21 Apr 2022 21:17:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhuSCiRH1mebXG96TJG4hIk0F/o+qL0Mn+QNxfKZ9XDe5RmOWKM6xHel0K43h0oHsLGB8o X-Received: by 2002:a17:906:5d07:b0:6ef:f147:caee with SMTP id g7-20020a1709065d0700b006eff147caeemr2457437ejt.292.1650601074891; Thu, 21 Apr 2022 21:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650601074; cv=none; d=google.com; s=arc-20160816; b=YbGnMNVFl9znd4yGpW9SDO0gMln/LKWPUMlElf7jVO3vx/9P5P038XlfNpjh6WYjBS FIoy2xyUull443g1yypB5mom5qNo1gdS7tFaEQMpXcGhyLgBaAQVk5VSrTxaX0VIOCa3 mK1dQFJfuLHPUtBUCoTOFNGSjSx2GAzxUZ+ii6nrRAcULmuOxUa1QlSHCLM2CMgEwbS1 X4jZfb8Z9MfOUCmmCL2lCItM2OJEnFa3hGexwhnWdY+HsbtMu0PPQBepuTTq06q0lhiJ VwUOoYwgad0PRtkI8eOhrbRe3mwGPgxLKgB/LoD8h7k9yJeuC6zd0HACn/dSaC0F0AUH OGlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=5wKvqWgAr0T7MmAVkJL8u6/Q8aN+r6vo7SpFPe4QXhk=; b=WZ42aSa1ZrNqaTcUhGyjif/PHuNLDVjtShiAB04eCvk8cvxaLjIs8x0Tw6hdMK9Q5n ZwAvofq1klE5J57VE6MlQQFC0NZeI7XBheXuxeE313yvrKDOSSNZi8KMuDe6AmYQQVJH AraPAD7B80xmSPJUMPkFknrhWfv4TDO0TgYzrzU6yDfFcVVAFXimlel+C2z9cDLzmUVa yZSgwamWYsg7jlzDhfGBdnvAVX6HhC6ClAfvS+WLz/03iTdSXR15xceSJc8pFbp4T3vY zm5SHMAVglO0gZD2ToBvPqYu1ygxRWkENe+PqVcBe2ZSWd0wtanECA/f2iodmHmoKE0b mC7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a170906539500b006df93b0aef7si5308042ejo.462.2022.04.21.21.17.31; Thu, 21 Apr 2022 21:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241054AbiDTPJB (ORCPT + 99 others); Wed, 20 Apr 2022 11:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236171AbiDTPI6 (ORCPT ); Wed, 20 Apr 2022 11:08:58 -0400 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670D237AB7; Wed, 20 Apr 2022 08:06:10 -0700 (PDT) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nhBtr-0000AB-0t; Wed, 20 Apr 2022 17:05:47 +0200 Message-ID: <98fca5c8-ca8e-be1f-857d-3d04041b66d7@maciej.szmigiero.name> Date: Wed, 20 Apr 2022 17:05:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 1/8] KVM: nSVM: Sync next_rip field from vmcb12 to vmcb02 Content-Language: en-US To: Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson References: <20220402010903.727604-1-seanjc@google.com> <20220402010903.727604-2-seanjc@google.com> <112c2108-7548-f5bd-493d-19b944701f1b@maciej.szmigiero.name> <4505b43d-5c33-4199-1259-6d4e8ebac1ec@redhat.com> From: "Maciej S. Szmigiero" In-Reply-To: <4505b43d-5c33-4199-1259-6d4e8ebac1ec@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.04.2022 17:00, Paolo Bonzini wrote: > On 4/4/22 19:21, Sean Christopherson wrote: >> On Mon, Apr 04, 2022, Maciej S. Szmigiero wrote: >>>> @@ -1606,7 +1622,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, >>>>        nested_copy_vmcb_control_to_cache(svm, ctl); >>>>        svm_switch_vmcb(svm, &svm->nested.vmcb02); >>>> -    nested_vmcb02_prepare_control(svm); >>>> +    nested_vmcb02_prepare_control(svm, save->rip); >>> >>>                        ^ >>> I guess this should be "svm->vmcb->save.rip", since >>> KVM_{GET,SET}_NESTED_STATE "save" field contains vmcb01 data, >>> not vmcb{0,1}2 (in contrast to the "control" field). >> >> Argh, yes.  Is userspace required to set L2 guest state prior to KVM_SET_NESTED_STATE? >> If not, this will result in garbage being loaded into vmcb02. >> > > Let's just require X86_FEATURE_NRIPS, either in general or just to > enable nested virtualiazation ???? > > If I looked it up correctly it was introduced around 2010-2011. A quick Internet search showed that the first CPUs with NextRIP were the second-generation Family 10h CPUs (Phenom II, Athlon II, etc.). They started being released in early 2009. > Paolo Thanks, Maciej