Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4008167pxj; Mon, 21 Jun 2021 11:18:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycl9dHuOif37wue9hJ/V5BKFmleKuqLsGric+VYFdd8hRIQgFD63MQ0GKDrM2XkCh03NCI X-Received: by 2002:a5d:9f11:: with SMTP id q17mr19907223iot.62.1624299537254; Mon, 21 Jun 2021 11:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624299537; cv=none; d=google.com; s=arc-20160816; b=ZsiP3HQ5teUbbGfH7PclhzHbBPd7YaEo3oibau0fuXMaEbIDFWfND0nfReuu4PHQzc dPIFuVzQaW2pMw1RUTumv4XqYS8XJeVdnKsii25q/tyASJ4g9Pac0MiQ2bKiNMQBa/g0 ADfdyn+H0zx7oRw6AwtjzJn7FTIfxgluo3eAYXHs+rmWu4AGfpTEMACafWj1bu4WbLv8 07HjrMx6AyPK8axuwQi1vU+pxPY8/TdHho7ZopfQ+UHWecUiEr06Wu9plbSlHmnLVtcz LqfN8Q1J3p3XjG/tT5DWR3YJJBCueT8g5vH107vg1viwQ2oWIswsPfPVCpvVpbYOjCNC AoYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UobgsoS85WbWilqD+j03Ck0yLeFapzsQgkkT7VS2Rdc=; b=q8xKNe2KkDSKspQoIYpiHhgagspqhdURNWOpaQHBlcNOuQiafp5YGulemzyz2QO/5i Pcby/3gxfDiRwNuZbEkI8wIl2PYvINbbAHE6L4/LCBTKCBf9PfZb5t/KoEN3o8JqTZD7 01hTqKB8tvrxi2tLanLTWFaete9hCzI6YPtoalp1BcKpff6AHmiboacgYfecKhCbBLPX 5Nm/yYf6XMcvtRTSkKaNbB+PUidnuiyM2eWNUBd8D3t/vNTtuEwUpt5PiOTsmugz1rr9 LX5shWQnBp15ANwRe7V8w6QnbPgrcy5opcOjD1Yq7sWN/LqfQdQrcrw3FR7a89ISa1UD 0rXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YPaQooXY; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si18493287jag.82.2021.06.21.11.18.45; Mon, 21 Jun 2021 11:18:57 -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=@google.com header.s=20161025 header.b=YPaQooXY; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232215AbhFUSUZ (ORCPT + 99 others); Mon, 21 Jun 2021 14:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbhFUSUV (ORCPT ); Mon, 21 Jun 2021 14:20:21 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B571C0610FD for ; Mon, 21 Jun 2021 11:01:51 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id h24-20020a9d64180000b029036edcf8f9a6so18631203otl.3 for ; Mon, 21 Jun 2021 11:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UobgsoS85WbWilqD+j03Ck0yLeFapzsQgkkT7VS2Rdc=; b=YPaQooXYhSoY7J2jKyGUCtzuq9ZJDp70SgZvpS0PDADnDfaXhdD6lR0K4CEqrLRUh5 z71QZsDfa3pIQk4ICLiVuEK6tC6II3ALggNoz5HXI75aWHWUwbBNlhIe9e3pQ/ahiay5 m9mJh16PNaazUo8Vv+eNgrqrkyLBgM5NQtjqz8pvx8S/FZAemy7C5kanvDGC3C7lilvm z4aoBGAC+syzybDCPQ7OOfC/HIeFPy/uACn2GSOUetnBQ6E32rxW/W7BucEu3lDSZxvk 3teVGXEJbQwir7zZfLj/txB3kql6cFcAujLSkTFHIk0VGw8EAtN2MiRm9iwJMtU9zARA Np7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UobgsoS85WbWilqD+j03Ck0yLeFapzsQgkkT7VS2Rdc=; b=ew6DzGiDSwA9ypHkCSqbWmPjI2qRJFPf9BPwFbwZY2vCytmuyeKot+Xb18apztdsDd iUHAgMXcRG0TybkNiD8S87HuSo7co9JQL1vhYrZitAvvk1mQfkuFyjvPz1PyBkKvRtxm WMpOTMQciryiHAycH6vtq3a91sEDOdpWpvIwD7X4le7FAlHB/mnsWY+RRzFEOeGBdss8 33B7UNk7iKfO08+/3/p+bFVTGZ5VUIqHudKUva09isQwni5L+n78K0ZeX+Nu4GCDGa2I L0/6kGQadh1WP32CZNismWBM8dY5peEjBipobu/zhjsBpUghxyZvgmv48jVPwB4xof2G sXtw== X-Gm-Message-State: AOAM530v+TwVLRl73+u3GL7IoI95N2sCsGrKYQLOWRWmcfkIdR/3x7gA 0PypS8vgcO6Gj2omcHfI5Rf8TJKMMw5Q9dMaIBZxDw== X-Received: by 2002:a9d:6855:: with SMTP id c21mr1679873oto.56.1624298510779; Mon, 21 Jun 2021 11:01:50 -0700 (PDT) MIME-Version: 1.0 References: <20200903141122.72908-1-mgamal@redhat.com> <11bb013a6beb7ccb3a5f5d5112fbccbf3eb64705.camel@redhat.com> In-Reply-To: <11bb013a6beb7ccb3a5f5d5112fbccbf3eb64705.camel@redhat.com> From: Jim Mattson Date: Mon, 21 Jun 2021 11:01:39 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86: VMX: Make smaller physical guest address space support user-configurable To: Mohammed Gamal Cc: Paolo Bonzini , kvm list , LKML , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Aaron Lewis , Sean Christopherson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 2:22 AM Mohammed Gamal wrote: > > On Fri, 2021-01-15 at 16:08 -0800, Jim Mattson wrote: > > On Thu, Sep 3, 2020 at 7:12 AM Mohammed Gamal > > wrote: > > > > > > This patch exposes allow_smaller_maxphyaddr to the user as a module > > > parameter. > > > > > > Since smaller physical address spaces are only supported on VMX, > > > the parameter > > > is only exposed in the kvm_intel module. > > > Modifications to VMX page fault and EPT violation handling will > > > depend on whether > > > that parameter is enabled. > > > > > > Also disable support by default, and let the user decide if they > > > want to enable > > > it. > > > > > > Signed-off-by: Mohammed Gamal > > > --- > > > arch/x86/kvm/vmx/vmx.c | 15 ++++++--------- > > > arch/x86/kvm/vmx/vmx.h | 3 +++ > > > arch/x86/kvm/x86.c | 2 +- > > > 3 files changed, 10 insertions(+), 10 deletions(-) > > > > > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > > > index 819c185adf09..dc778c7b5a06 100644 > > > --- a/arch/x86/kvm/vmx/vmx.c > > > +++ b/arch/x86/kvm/vmx/vmx.c > > > @@ -129,6 +129,9 @@ static bool __read_mostly > > > enable_preemption_timer = 1; > > > module_param_named(preemption_timer, enable_preemption_timer, > > > bool, S_IRUGO); > > > #endif > > > > > > +extern bool __read_mostly allow_smaller_maxphyaddr; > > > > Since this variable is in the kvm module rather than the kvm_intel > > module, its current setting is preserved across "rmmod kvm_intel; > > modprobe kvm_intel." That is, if set to true, it doesn't revert to > > false after "rmmod kvm_intel." Is that the intended behavior? > > > > IIRC, this is because this setting was indeed not intended to be just > VMX-specific, but since AMD has an issue with PTE accessed-bits being > set by hardware and thus we can't yet enable this feature on it, it > might make sense to move the variable to the kvm_intel module for now. Um... We do allow it for SVM, if NPT is not enabled. In fact, we set it unconditionally in that case. See commit 3edd68399dc15 ("KVM: x86: Add a capability for GUEST_MAXPHYADDR < HOST_MAXPHYADDR support"). Perhaps it should be a module parameter for SVM as well? And, in any case, it would be nice if the parameter reverted to false when the kvm_intel module is unloaded. > Paolo, what do you think? > >