Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3142644pxk; Mon, 21 Sep 2020 06:23:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/89KbwoxswFyBJgp63uaHsxYqVg71UDJum+zoHPe4fFDMxtEyXSEgu756pWabMpzZzCdI X-Received: by 2002:a17:906:cf9b:: with SMTP id um27mr50049792ejb.66.1600694584079; Mon, 21 Sep 2020 06:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600694584; cv=none; d=google.com; s=arc-20160816; b=qj5j17aTdcDo1Yc/OiNm86UaI6CQUZQkKjLjYS+q5h1JPKynlKGv1/KB+lrfrPzOC5 9Ta+d7VmgE2/NWScoE3uNH0XG4IYXb230UQV1rGG65y3bVv3zfEIBkXF7dWqyDFWlx7R U+VmkbIH46mzTV9O92/I4BejLa8yf3ixlnEYjc/i0TPV0mYdar/SiiINUqcmKxR5wHIW RqZaELcRStMx8N/y59WWWr/wzS1OGxCSCWiltl3DtdueOuf6BKr8aHdyMPYQPdZt/IiX /1oi9rld1T48f2FcUA1SY7K26IGODgSFvaTmmoCB0M4kkO0Dcsf0x6ucFp2ramAV+j7e MMqg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=2li71nHKDdeIHk4pBYNK/fNmoEg3vB9ERzI+dLskZvo=; b=PR3xo6sqvUYlIeOGst6prBAmilwN0MCQvx8Ot5cSfm1CZtDcc2SvpJ+sCuP1V7D7sK 3OaivwY565vuN/ooTEhZOKi9rRrw3cwGSvTbBEljr2zcjtO07H9q8oaewieihyr0BQEy CidhrkZOG/O+BN0Do3Uztn6MnS7slCx6+hYUSLWrkdbKl6G0/RbhjUj3gzPUTZ4jiEZe lF1zCgfkpFB03WvMoutiqVuRXW6c2zrA8/qqDc3vA21XbxgyjLEJ4JA5540A0C/N39YX d2D7IB/av9cyHdiWHmzZjELmHf70Vr2k+SEita5PzLLFN+SFXRXe38jRgsTCeKS9ChYW Y43A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bPct19gy; 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 x11si8095512edr.460.2020.09.21.06.22.39; Mon, 21 Sep 2020 06:23:04 -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=bPct19gy; 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 S1727059AbgIUNTg (ORCPT + 99 others); Mon, 21 Sep 2020 09:19:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52785 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbgIUNTf (ORCPT ); Mon, 21 Sep 2020 09:19:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600694374; 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; bh=2li71nHKDdeIHk4pBYNK/fNmoEg3vB9ERzI+dLskZvo=; b=bPct19gyY+B6+dw+al61BDgFX6fTfSongPZczHIxyTdPdkfPaKY0cQwlso8qkU7JZX7bzT 8YryzdWBBKep9nDCg/6FA77TFor3HK1mcvg5KGcfXCIa0CgOHSroLHyrBg0GxCpsz0j1+r urFJCEHkx5tD/ctcG7Q9Zg9LOqm8l8c= 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-332-_ZZloquDNz6-Zlg1Un68nQ-1; Mon, 21 Sep 2020 09:19:32 -0400 X-MC-Unique: _ZZloquDNz6-Zlg1Un68nQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A19F018C89C1; Mon, 21 Sep 2020 13:19:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBD133782; Mon, 21 Sep 2020 13:19:25 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Vitaly Kuznetsov , "H. Peter Anvin" , Joerg Roedel , Ingo Molnar , Sean Christopherson , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Wanpeng Li , Borislav Petkov , Jim Mattson , linux-kernel@vger.kernel.org, Paolo Bonzini , Thomas Gleixner , Maxim Levitsky Subject: [PATCH v5 0/4] KVM: nSVM: ondemand nested state allocation Date: Mon, 21 Sep 2020 16:19:19 +0300 Message-Id: <20200921131923.120833-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is yet another version of ondemand nested state allocation.=0D =0D In this version I adoped the suggestion of Sean Christopherson=0D to return make EFER write return a negative error which then should=0D propogate to the userspace.=0D =0D So I fixed the WRMSR code to actually obey this (#GP on positive=0D return value, exit to userspace when negative error value,=0D and success on 0 error value, and fixed one user (xen)=0D that returned negative error code on failures.=0D =0D The XEN patch is only compile tested. The rest were tested=0D by always returning -ENOMEM from svm_allocate_nested.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (4):=0D KVM: x86: xen_hvm_config cleanup return values=0D KVM: x86: report negative values from wrmsr to userspace=0D KVM: x86: allow kvm_x86_ops.set_efer to return a value=0D KVM: nSVM: implement ondemand allocation of the nested state=0D =0D arch/x86/include/asm/kvm_host.h | 2 +-=0D arch/x86/kvm/emulate.c | 7 ++--=0D arch/x86/kvm/svm/nested.c | 42 ++++++++++++++++++++++++=0D arch/x86/kvm/svm/svm.c | 58 +++++++++++++++++++--------------=0D arch/x86/kvm/svm/svm.h | 8 ++++-=0D arch/x86/kvm/vmx/vmx.c | 9 +++--=0D arch/x86/kvm/x86.c | 36 ++++++++++----------=0D 7 files changed, 113 insertions(+), 49 deletions(-)=0D =0D -- =0D 2.26.2=0D =0D