Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp12609pxk; Mon, 5 Oct 2020 16:03:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUxGjDV1CmSSuqT8VMbFX37+Inpe33D7Ktt3bSkIzDjwuPsYVBNtepF6UVm5uGio6NjXk5 X-Received: by 2002:a17:906:4dc3:: with SMTP id f3mr2238347ejw.50.1601939029226; Mon, 05 Oct 2020 16:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601939029; cv=none; d=google.com; s=arc-20160816; b=yvTiBST78fWQZQPRr+nG4VDOkuzdS9XAFrh7V4QkFS5HieCXkfld5DuGSnIZo798K3 n8IDYKaNNHtI2/lsujrryfc/g9bUlaRuVj2cIwoy3OfszwYBEIA6DHx+jcFnptoriX+5 2NbAFZWthTESaVJUjJxK3+j0p5sHoVxY7Y4XZlWRcKxyJ3cIxVuT/eY0U/qvFk/TY5HI L2EL5dIF+38ACSW+EuZMOu3modSV4SO/Hskr5aQmWxfhpz1czhBZOi8AG591kV+6+QJr hE/1dSedfFU79DRRSjrpTDLSTB9o+Bur2oCnADZaPufUMnmEaMyVmpw+zD1Ezo5gj9/d YtvQ== 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=sX6Hxo8zbSqrVxxKpSXQc3U5v59mG8RdH/i1tZ3jiPA=; b=t89InY+D1ZGUU2g3mBzulNCb2LmZS+lQThHLAlOQwpD4q/Neywr9sM2S99bqJUc2Q7 4M2pt1O3NBO67+wK506hR353C+IlzT8hcQ3E7ouExqDVMY64ntbVU/ulFnEymRcXlU9m 9EVBklzdmI7QQVC/SPBfu1sx7MgL4Xalw+409uN+y1b9DONc1+Pc8UBfZQw4p7b5FLuS a4BHLftOwuvRqwUtGEwB5NHMROAvePJrd7nOvsV8DLe/pvlI3gl/Rl/0BwVRQOMdTAD5 Y9qr+OkSCkqh+7OVe9fVl9tZZJC/sWCMYqorN74KDh9pdq/wInnH+pRjwhgxgJCo0rdE QRTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YD+hAZWE; 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 y2si969933edw.497.2020.10.05.16.03.26; Mon, 05 Oct 2020 16:03:49 -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=YD+hAZWE; 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 S1726761AbgJEWsW (ORCPT + 99 others); Mon, 5 Oct 2020 18:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgJEWsV (ORCPT ); Mon, 5 Oct 2020 18:48:21 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99D85C0613CE for ; Mon, 5 Oct 2020 15:48:21 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id t12so9338280ilh.3 for ; Mon, 05 Oct 2020 15:48:21 -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=sX6Hxo8zbSqrVxxKpSXQc3U5v59mG8RdH/i1tZ3jiPA=; b=YD+hAZWEqY/HCKuyHzyLhCb1kabb4sMChClpf33g3/NWLr6tQcnHqkUV7THOpeihTK U6MdF0vXiO+KnuyYOpzEBUg/cVnzjWz+ZH1+5H8TZLYWc1wBGbDQbYifbVS62UtlrFM8 oz0hCRA+bh74SKhLdyCLc2KBHPaQCRJxpxVJrlBibmWUuGFYf1C3sHhPJcHlCdMuH0lw yygrWmiBU0BONM2QMa6BesEBrh5xcnJHGNMao8YrH4TLzuNwOQssF3EuYiaLApGnREp/ o1/eK5eFd/MAHeKKSzDygLg7/taxtAP4/gGhbYLwCRwQq/ULEFVdUU46PZi9SbVHnbCT 1qng== 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=sX6Hxo8zbSqrVxxKpSXQc3U5v59mG8RdH/i1tZ3jiPA=; b=mii7urPojlDMZxyetsQcdCShsFkfWFQgTMfQQCRfDBE+06PzApBCLp6t/9QWSkQYhM IBwKYXCTxawv3aOzuWYUGaZjUw/CoDXFlojl2kUuVQ2/t3opNNpSlV5mqSMfb14rj91k a+qHDjhhZZnKIJmm7PTgJwe51D7sukJyvBQh11Dlf2vBILseGNL3t9t2F5KKDAWI216Y J1xGzrCLkP7Iqq5jrlnudV/Kley8ScAruZZ8n8eBEwunxzJ4yhQMnwNqj9XrOs1ujdht wNxOrUN2fi0A4I6fEYeU2lOYME16OR+f/KkIJZa7W+vOf4mYgaZQ27k4SoOtvsty8MCr GiYw== X-Gm-Message-State: AOAM533TkBkGdIC6PUHi0wERxsWvZ+PjprvoOJgZNY1saFmsEkPdEkEW PZzYvNDhouCO8kE+PJcE1lF8eSuHYYxuij4h7OaVNw== X-Received: by 2002:a92:1e07:: with SMTP id e7mr1212827ile.154.1601938100745; Mon, 05 Oct 2020 15:48:20 -0700 (PDT) MIME-Version: 1.0 References: <20200925212302.3979661-1-bgardon@google.com> <20200925212302.3979661-23-bgardon@google.com> In-Reply-To: From: Ben Gardon Date: Mon, 5 Oct 2020 15:48:09 -0700 Message-ID: Subject: Re: [PATCH 22/22] kvm: mmu: Don't clear write flooding count for direct roots 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 Fri, Sep 25, 2020 at 6:25 PM Paolo Bonzini wrote: > > On 25/09/20 23:23, Ben Gardon wrote: > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > > index 42dde27decd75..c07831b0c73e1 100644 > > --- a/arch/x86/kvm/mmu/tdp_mmu.c > > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > > @@ -124,6 +124,18 @@ static struct kvm_mmu_page *find_tdp_mmu_root_with_role( > > return NULL; > > } > > > > +hpa_t kvm_tdp_mmu_root_hpa_for_role(struct kvm *kvm, > > + union kvm_mmu_page_role role) > > +{ > > + struct kvm_mmu_page *root; > > + > > + root = find_tdp_mmu_root_with_role(kvm, role); > > + if (root) > > + return __pa(root->spt); > > + > > + return INVALID_PAGE; > > +} > > + > > static union kvm_mmu_page_role page_role_for_level(struct kvm_vcpu *vcpu, > > int level) > > { > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.h b/arch/x86/kvm/mmu/tdp_mmu.h > > index cc0b7241975aa..2395ffa71bb05 100644 > > --- a/arch/x86/kvm/mmu/tdp_mmu.h > > +++ b/arch/x86/kvm/mmu/tdp_mmu.h > > @@ -9,6 +9,8 @@ void kvm_mmu_init_tdp_mmu(struct kvm *kvm); > > void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm); > > > > bool is_tdp_mmu_root(struct kvm *kvm, hpa_t root); > > +hpa_t kvm_tdp_mmu_root_hpa_for_role(struct kvm *kvm, > > + union kvm_mmu_page_role role); > > hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu); > > void kvm_tdp_mmu_put_root_hpa(struct kvm *kvm, hpa_t root_hpa); > > > > Probably missing a piece since this code is not used and neither is the > new argument to is_root_usable. > > I'm a bit confused by is_root_usable since there should be only one PGD > for the TDP MMU (the one for the root_mmu). *facepalm* sorry about that. This commit used to be titled "Implement fast CR3 switching for the TDP MMU" but several refactors later most of it was not useful. The only change that should be part of this patch is the one to avoid clearing the write flooding counts. I must have failed to revert the other changes. > > Paolo >