Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1244673pxa; Thu, 20 Aug 2020 06:37:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkdWvU0UtwHPdsdOT6pXRVxoTSTI65P0I7NDCWhr3WnjBGkHyn2iACciH6xecve/kn6iuw X-Received: by 2002:a17:906:3e4f:: with SMTP id t15mr3512837eji.368.1597930640838; Thu, 20 Aug 2020 06:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930640; cv=none; d=google.com; s=arc-20160816; b=pzoCSj1cEiuCkMNj/VN8UoVaPdHhay0DU6qEYe2BMyAU6x7MmJ1Ky6q0u2OuVehjOY qGs76+nD131aRKdVlmaYOJekWlB6PL9UtsxLqzXADH653TENf5EX9bX++GrZvAST1oe8 86VE4++utLvdQll3woKfj5idTCGKraVCWohJ04K3m1XOA8LIAHalHWq73d4DXSjw4zyy naP5lWI9loPfU3B+2o/sRKYlG2T8cxQpjk0cAES+uZV6lHFPXzexwc5NZggwzEMAbruH c4Qf8Fjurg7usBjkUkgxMC6d/tXdH6P7qrU+JYZ3lanTFJy5C1/msXyWrh7yxTAgdvw3 vwTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=X2fJCEf/hhnmDqCnQtY5hjOcNe8YUPEVscVUU8eAkMY=; b=Wc1mIjaHHO/0qi60arLh9FO4F2BQIUwZq8GfsegGQlVLj3Vqqg/2GGGnV66pffXQ03 cj8aa9yUZPFnCVzJ9UxTaCKYYVofWqklZRphUo++hKFDOMUrQBjbzg7ZyBdPOZgYbXuy yS0k1zy9vdE4SiQT3jwq1aY2aoi7r8DnZDyzHrcvJXHjjW8ob0G+g1VgvJkpDYVcenaD paDCcjyS39XLQXy+wXm8ExLa1j430PhR81QZqw+FZCV8ffdFDY7iclQT7IpD3QmED0J3 MEOpKUaoHCCRtJNXczN+qxO9Vdo8PKeOHI/RVsMLjS++rsMtBPPHXAUk3x4+l05Jdo+3 Ww0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PCeB5h9t; 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 e11si1221909ejk.250.2020.08.20.06.36.55; Thu, 20 Aug 2020 06:37:20 -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=PCeB5h9t; 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 S1729637AbgHTNdy (ORCPT + 99 others); Thu, 20 Aug 2020 09:33:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28710 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729475AbgHTNdt (ORCPT ); Thu, 20 Aug 2020 09:33:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597930428; 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; bh=X2fJCEf/hhnmDqCnQtY5hjOcNe8YUPEVscVUU8eAkMY=; b=PCeB5h9t4arJmC7gNny9BR5ixdPvS4aReiuGdKagFlgRp6KFFhxgOOWsYCJAnhtCTzft/7 kCPDpLERZoNFA4tI8vaLNDrMSYuGq9dodpF+N4sNM8VzxdLsDthBAdo/Hw6c3W+01i3jJw STrZDp0kklISUTvMmd+ye85yfE3SDgM= 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-196-vDgPCg3fNbqGSmAdSCx5vQ-1; Thu, 20 Aug 2020 09:33:46 -0400 X-MC-Unique: vDgPCg3fNbqGSmAdSCx5vQ-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 B2A52AE641; Thu, 20 Aug 2020 13:33:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35F7219D6C; Thu, 20 Aug 2020 13:33:40 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Jim Mattson , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H. Peter Anvin" , Sean Christopherson , Joerg Roedel , Wanpeng Li , Borislav Petkov , Vitaly Kuznetsov , Paolo Bonzini , Maxim Levitsky Subject: [PATCH v2 0/7] KVM: nSVM: ondemand nested state allocation + smm fixes Date: Thu, 20 Aug 2020 16:33:32 +0300 Message-Id: <20200820133339.372823-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi!=0D =0D This patch series does some refactoring and implements on demand nested sta= te area=0D This way at least guests that don't use nesting won't waste memory=0D on nested state.=0D =0D Patches 1,2,3 are refactoring=0D =0D Patches 4,5 are new from V1 and implement more strict SMM save state area c= hecking=0D on resume from SMM to avoid guest tampering with this area.=0D =0D This was done to avoid crashing if the guest enabled 'guest was interrupted= '=0D flag there and we don't have nested state allocated.=0D =0D Patches 6,7 are for ondemand nested state.=0D =0D The series was tested with various nested guests, in one case even with=0D L3 running, but note that due to unrelated issue, migration with nested=0D guest running didn't work for me with or without this series.=0D I am investigating this currently.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (7):=0D KVM: SVM: rename a variable in the svm_create_vcpu=0D KVM: nSVM: rename nested 'vmcb' to vmcb12_gpa in few places=0D KVM: SVM: refactor msr permission bitmap allocation=0D KVM: x86: allow kvm_x86_ops.set_efer to return a value=0D KVM: nSVM: more strict smm checks=0D KVM: emulator: more strict rsm checks.=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 | 22 ++++--=0D arch/x86/kvm/svm/nested.c | 53 +++++++++++--=0D arch/x86/kvm/svm/svm.c | 130 ++++++++++++++++++--------------=0D arch/x86/kvm/svm/svm.h | 10 ++-=0D arch/x86/kvm/vmx/vmx.c | 5 +-=0D arch/x86/kvm/x86.c | 3 +-=0D 7 files changed, 151 insertions(+), 74 deletions(-)=0D =0D -- =0D 2.26.2=0D =0D