Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4666114pxk; Wed, 30 Sep 2020 08:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmomW2adSI4qmaODLi/rgyYb3x8n9qQ6QadldBoAIQRQdZL/e78zL+ecqiorJUv21nDYO/ X-Received: by 2002:a17:906:2714:: with SMTP id z20mr3303060ejc.409.1601480348513; Wed, 30 Sep 2020 08:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601480348; cv=none; d=google.com; s=arc-20160816; b=AL0XSp7j0/GH4G+YwZFAyrzc7DgR/nsWizZT+rCrHdCiSrHjMr9l/wPTlmhylmr7Z5 eOe3X8CocdexM/zRWYyoz1jV/Sg8Mf+bWc/Q/xLiIoXlkF8vs7GAr/A0VanPLshhLJKs ffMZ0Of5p6qkk1Ro3EUWE0pqVgLsRtCDniTWaqUxMOTCtw9iBWkPaD2UmpB5tTTHnz85 4ixJlhZVNj+M3Bjv8kmkDUM+bqOWEDdyYCv02V1gJT8DtapuCtAqdN0KJCfiiSy7SII2 vJ2wd9hgpF/JF4ar+FagofiNkGY0B9/8/NvmmjCJDtOgZjBELuF0ZmIHA0iUfjOeQBtY cMvg== 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=Ke6qz/JBwiVN30Q5Ga33Om7udsmaHkiF+HvXUrXkShc=; b=HZKgjfRNQ5mckh48VxhAdCPkkUFJrZiuxJSB7n4xIeYFp8gG59oxVRw13naSvox2rE i2Z31GDPq1JuqDWiARI8icV/doHSBSRsm3jUpNEmpv98QqzSmAHtWrc5ejIu6w+cR4ik 2IbrT8zaPtApT7GXt8PJKv3saWVfg9MwnbuQGM4Q1Ntz6jzCHeV6t3FAg3C6wOcp7wrd TO2JukC8wZiclYJvDTbRl7eQOVE9lCZfuFbNd+nVlVIiquTwJrZgNWcBVD6X4SiUvxjw qD/pxkRgE3SU+vcqLcNoVqokcjG2lLHz3Gxj2pYyvh3IeWL4dbbtQF9J1SQxS6rHyZBz C+7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NlilXEA+; 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 a13si1324541edf.9.2020.09.30.08.38.45; Wed, 30 Sep 2020 08:39:08 -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=NlilXEA+; 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 S1731054AbgI3Pgw (ORCPT + 99 others); Wed, 30 Sep 2020 11:36:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34902 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731043AbgI3Pgw (ORCPT ); Wed, 30 Sep 2020 11:36:52 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601480210; 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=Ke6qz/JBwiVN30Q5Ga33Om7udsmaHkiF+HvXUrXkShc=; b=NlilXEA+y+RqRktGb7sMI5rxYixOIyfzoRsqlD/q8NpjhX3vSuZrKLten4+dmPjqAPsPEe Vh8oD1thbhfAP5GJmYRxGYOpKjwnj3D9fHJ0LTbx6qtc6Q6iCEx/JgCBgorZG122pXQs8K +9x9HpPtReFX0Xd3ho6Ckkf4a0JeC9g= 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-390-EWx8ciBvMki92aXVKIBPkw-1; Wed, 30 Sep 2020 11:36:44 -0400 X-MC-Unique: EWx8ciBvMki92aXVKIBPkw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3ED0D1074657; Wed, 30 Sep 2020 15:36:43 +0000 (UTC) Received: from starship (unknown [10.35.206.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2AD973678; Wed, 30 Sep 2020 15:36:39 +0000 (UTC) Message-ID: <521dd8fe55650eac720891e90084a7f7620c7f0f.camel@redhat.com> Subject: Re: [PATCH v6 0/4] KVM: nSVM: ondemand nested state allocation From: Maxim Levitsky To: kvm@vger.kernel.org Cc: "H. Peter Anvin" , Ingo Molnar , Borislav Petkov , Vitaly Kuznetsov , Sean Christopherson , Joerg Roedel , Paolo Bonzini , Wanpeng Li , Thomas Gleixner , linux-kernel@vger.kernel.org, Jim Mattson , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Date: Wed, 30 Sep 2020 18:36:38 +0300 In-Reply-To: <20200922211025.175547-1-mlevitsk@redhat.com> References: <20200922211025.175547-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-09-23 at 00:10 +0300, Maxim Levitsky wrote: > This is the next version of this patch series. > > In V5 I adopted Sean Christopherson's suggestion to make .set_efer return > a negative error (-ENOMEM in this case) which in most cases in kvm > propagates to the userspace. > > I noticed though that wrmsr emulation code doesn't do this and instead > it injects #GP to the guest on _any_ error. > > So I fixed the wrmsr code to behave in a similar way to the rest > of the kvm code. > (#GP only on a positive error value, and forward the negative error to > the userspace) > > I had to adjust one wrmsr handler (xen_hvm_config) to stop it from returning > negative values so that new WRMSR emulation behavior doesn't break it. > This patch was only compile tested. > > The memory allocation failure was tested by always returning -ENOMEM > from svm_allocate_nested. > > The nested allocation itself was tested by countless attempts to run > nested guests, do nested migration on both my AMD and Intel machines. > I wasn't able to break it. > > Changes from V5: addressed Sean Christopherson's review feedback. > > Best regards, > Maxim Levitsky > > Maxim Levitsky (4): > KVM: x86: xen_hvm_config: cleanup return values > KVM: x86: report negative values from wrmsr emulation to userspace > KVM: x86: allow kvm_x86_ops.set_efer to return an error value > KVM: nSVM: implement on demand allocation of the nested state > > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/emulate.c | 7 ++-- > arch/x86/kvm/svm/nested.c | 42 ++++++++++++++++++++++++ > arch/x86/kvm/svm/svm.c | 58 +++++++++++++++++++-------------- > arch/x86/kvm/svm/svm.h | 8 ++++- > arch/x86/kvm/vmx/vmx.c | 6 ++-- > arch/x86/kvm/x86.c | 37 ++++++++++++--------- > 7 files changed, 113 insertions(+), 47 deletions(-) > > -- > 2.26.2 > Very polite ping on this patch series. Best regards, Maxim Levitsky