Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3973949pxk; Tue, 29 Sep 2020 10:44:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvB6xqAsrO65C/dGYyrNfUtgATrEdR2QWafvT6A8CuUJLQ+zVq77MVkeyjlg7ywHSFpMeF X-Received: by 2002:a05:6402:1219:: with SMTP id c25mr4646795edw.220.1601401462450; Tue, 29 Sep 2020 10:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601401462; cv=none; d=google.com; s=arc-20160816; b=kllgRmqYaZsSCvucDxDsRoxdljxw1LoWJDZgM/LppnsJEQDhMx6MB9JZIyfaTXyPG8 ZYWBzcq6jyyRyLk0+cUQjyX/Ppniad6KWJATXh9ti0SUmngX/kfdVUC6/Y2IDuBDJLsH 6avR2icVUpEVDDiL7ALTF78mOlF5o8KENKl3f8MNjerm5UPoO8Rij40fB6y6KWIIKooC KuQ75tKX9fFpLLU4mplDBHgZh+ev+pRA1RT7F0vFmI6mXx/+H451/haMQe4RTqSgiQcY jgccfzO9eiw2NsiIT/Ebmc7lv32wC2KY0Gyr1qaICEG/MHLwdwsuSMnFTkLXG8AwFw9T TO5Q== 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=P5s72Hf6M5ClxTjTHmlWEDSkkJVMo+6Qf2SmpOue9JI=; b=wSUZ+WXgZfNSvp2KmGYOZNLzfXXBz9+FuNp8sDCxa0BzTL+l68A3v8UCoxEbGQssj4 pj073a6VFcZ4njuIxTr12fRc8p80ks6upYAtQTWqPDLbN2LaInj0Ug2tBW3N6YtL2Yyn O1sSsygntqdCngXbbHOPONP6DtIfwNL/b+EYGTbEZrJbcj1cm6e44oVYSKJiyt5+Si4W dQKG9oomH3CXyD3RY6GTVWj04SWpjO+7vm0vXXvM1WwQDDAw+sVBZKklUFSzfV7qGYoz lwkg9HuNNcoFCCrSCSupJ4lgcWI26g+1Gq+FiPIORpUY/owLp0GEjeMNuMfRcapziZ4m CgKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Hx/cfu9P"; 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 j15si3229220ejs.51.2020.09.29.10.43.59; Tue, 29 Sep 2020 10:44:22 -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="Hx/cfu9P"; 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 S1729353AbgI2Rkr (ORCPT + 99 others); Tue, 29 Sep 2020 13:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgI2Rkq (ORCPT ); Tue, 29 Sep 2020 13:40:46 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A86E2C061755 for ; Tue, 29 Sep 2020 10:40:46 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id e5so2837182ils.10 for ; Tue, 29 Sep 2020 10:40:46 -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=P5s72Hf6M5ClxTjTHmlWEDSkkJVMo+6Qf2SmpOue9JI=; b=Hx/cfu9Pj+cJsYmTc7JTnOpYFycF/dUkbQgiRmC6UKdqPmZ3zXU5bY8i3a7X7SMwVj HM4ay3MfQoyrPOHVLEWMeQtEUGsGl0ROtJsmndmRzTyLq85EBk7rRP5OEq6+VwK66F4x 4BbvvIvz5cNOqbWnAFfVb43BngQij3Wxs2hAeKgBAJDsykg496GbeBkl476LxDW6oaly lhVX92hui2oBXjs+ZcZt4mp7oGHokej4qWuZbGsxvVK/PG1ykW/rC2bK0QQO+5+762Fd RzjjIoX7bJo2dXtojH+p4dD35fI/UdV9Uc2K6Uj37jbWi1+qkTI3Eiskb63QFl+RJhl0 9RzA== 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=P5s72Hf6M5ClxTjTHmlWEDSkkJVMo+6Qf2SmpOue9JI=; b=dUOG1GKFTQLjzHy9qkuo4zRHosrnrElUNdfuyp0UX/hvbmuRgarEVQZueOnwbXde6f V7vxeEYp8GSggBlF9x5ISZz1ICDiRUmcr4jTNJ4Kc2lEBa0yWnk+b13r4m4kBXABbUCf k2D6s9nDqKR4smDdYA8wdwR8Ggar38R5BWUHMbL6U7vLLMeL6KGQAfbWcwG/wychX6Da FxSF7klJhKpt513JWR0mCNGJuodMHr96tpve40RY7G6YtT3lmgcSnooP3pn0lE0ajSeq qg3NqjFp5jkzHBEVVJJJMbvkX8zqOdL5tjjeTH7tHlEcr+TI3NKaq0kG9ZOFCDDySGbe gMhg== X-Gm-Message-State: AOAM532jCY/tQeQj6XlhWJi72wk5KYZsDt7WbEpbW+uZR7khS/JI4Wa2 WHzhbvqrbSrJ42BA/HSYfK7gM2wEqBYnKsmsWvo/ag== X-Received: by 2002:a92:9a82:: with SMTP id c2mr3929435ill.285.1601401245834; Tue, 29 Sep 2020 10:40:45 -0700 (PDT) MIME-Version: 1.0 References: <20200925212302.3979661-1-bgardon@google.com> <425b098c-dbe0-d614-8e62-1f50b2f63272@redhat.com> In-Reply-To: <425b098c-dbe0-d614-8e62-1f50b2f63272@redhat.com> From: Ben Gardon Date: Tue, 29 Sep 2020 10:40:34 -0700 Message-ID: Subject: Re: [PATCH 00/22] Introduce the TDP MMU To: Paolo Bonzini Cc: LKML , kvm , Cannon Matthews , Peter Xu , Sean Christopherson , Peter Shier , Peter Feiner , Junaid Shahid , Jim Mattson , Yulei Zhang , Wanpeng Li , Vitaly Kuznetsov , Xiao Guangrong Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 10:31 AM Paolo Bonzini wrote: > > On 25/09/20 23:22, Ben Gardon wrote: > > This series is the first of two. In this series we add a basic > > implementation of the TDP MMU. In the next series we will improve the > > performance of the TDP MMU and allow it to execute MMU operations > > in parallel. > > I have finished rebasing and adding a few cleanups on top, but I don't > have time to test it today. I think the changes shouldn't get too much > in the way of the second series, but I've also pushed your v1 unmodified > to kvm/tdp-mmu for future convenience. I'll await for your feedback in > the meanwhile! Awesome, thank you for the reviews and positive response! I'll get to work responding to your comments and preparing a v2. > > One feature that I noticed is missing is the shrinker. What are your > plans (or opinions) around it? I assume by the shrinker you mean the page table quota that controls how many pages the MMU can use at a time to back guest memory? I think the shrinker is less important for the TDP MMU as there is an implicit limit on how much memory it will use to back guest memory. You could set the limit smaller than the number of pages required to fully map the guest's memory, but I'm not really sure why you would want to in a practical scenario. I understand the quota's importance for x86 shadow paging and nested TDP scenarios where the guest could cause KVM to allocate an unbounded amount of memory for page tables, but the guest does not have this power in the non-nested TDP scenario. Really, I didn't include it in this series because we haven't needed it at Google and so I never implemented the quota enforcement. It shouldn't be difficult to implement if you think it's worth having, and it'll be needed to support nested on the TDP MMU (without using the shadow MMU) anyway. If you're okay with leaving it out of the initial patch set though, I'm inclined to do that. > > Also, the code generally assume a 64-bit CPU (i.e. that writes to 64-bit > PTEs are atomic). That is not a big issue, it just needs a small change > on top to make the TDP MMU conditional on CONFIG_X86_64. Ah, that didn't occur to me. Thank you for pointing that out. I'll fix that oversight in v2. > > Thanks, > > Paolo >