From mboxrd@z Thu Jan 1 00:00:00 1970 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=-4.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 569DCC4727E for ; Wed, 30 Sep 2020 15:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 095952071E for ; Wed, 30 Sep 2020 15:36:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NlilXEA+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731058AbgI3Pgw (ORCPT ); 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