Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp684669pxf; Wed, 7 Apr 2021 09:08:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzec7ypdAng8bs52Tfib/fw7xgIDH6HYzhWVR+hz76z1YO7x5sJDBMFOiOq1mGXWFG9jR9I X-Received: by 2002:a17:906:148a:: with SMTP id x10mr4666141ejc.92.1617811701659; Wed, 07 Apr 2021 09:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617811701; cv=none; d=google.com; s=arc-20160816; b=MdLcaUGu6/ROulLHHKEiy0gle9FuMNDn9CYYaugIJVnAAsz2v7GFMgxxyB3h7IPNIU DUAX8sSSwa6OsIu/ize/FLsu5rJRQ98/HA+7up4Uet7CvA73aUz+mxDMCYN3yhf8/3kI 6gyGZ5VABUq7RjkNf/TXTJD8S8cYQrfzGqk/0j730Rb0CUwzQydN2F6gYhowwEZLNcAl BJh8c4FK6u/6Q/jLZuuOim+bm4K2LGJrbkEtAAmi8cZ6Y+W25TdaLz6vVu4jlI1OOac6 l1Qqqapj4qDwaCYFM3OL91bqpYk6bpSs1+npOK9MskZUdWe3wXGmxNqVgEK5TKMprIK1 AHOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xKeokKE1kz1HEO0UnYt1mqZsLpF9x5qqu5MSWBkuwBA=; b=X/QxilYspzqDuII4khPPjVWlPMcfO6QcSgwJaGzMGNm6zMKQo2XlZxE6iEwwAL5urP IQ+QCMtgjR8EUhDsVXp6yEhwfW/ZeF/syg6MuAH3e4WVynewle0yrsaaDI+joPueynnL 6blIcCGFypjECFgxhDeSZVbC3+zUBuebELNIp0XL5p6E0ecHQE3kRwApzgNz4LeFnL3E AvwAdAXhuaOZ5cTAYIYhDEL8M2p60CRRlG7icJS1Y1HaEP2fIYKM/WfibGaJJ7ymlCLR /8Z42v3HwC+VxWsBxSSvAINLkt21Kq/8esKrEzBkTLWjVVrSI+cJg8607wYPP5ZBj1Fa AF4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=E6pWWfAN; 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 b17si20390486edd.117.2021.04.07.09.07.53; Wed, 07 Apr 2021 09:08:21 -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=E6pWWfAN; 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 S234213AbhDFXkr (ORCPT + 99 others); Tue, 6 Apr 2021 19:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242860AbhDFXix (ORCPT ); Tue, 6 Apr 2021 19:38:53 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E6BC061756 for ; Tue, 6 Apr 2021 16:38:44 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d8so8388090plh.11 for ; Tue, 06 Apr 2021 16:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xKeokKE1kz1HEO0UnYt1mqZsLpF9x5qqu5MSWBkuwBA=; b=E6pWWfAN7lEHcTqU/cKkCPAQd2WXfKOq8bwVWhym88UzIeALEz8Yf3Y7Oj7iKZx8cz mdCwjxbwWwweuu3aqUkLU2XDnIUZlQ6BKYJeVF1c7P59fFrl/eN1tfQVceFi86iQFgyS 2w9ylfPVhEblzLJRcuevzasIbUjpCXQVe/wKCLxhWuZPkjGsMkgcYHwIlW6xudV0i+jO BpCqZcuDOtNHydp+LWKF8N6olLadL/gHYjkMrvOz++ZKNJw83BU9/bno1ZMHUSx44RP3 OREMWWcAMuKaw87Yf9OziLQ3MhXlQP+iErZEALQ+KuMc9IjYy2e38Kz3aakjZj0/CO88 aAUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xKeokKE1kz1HEO0UnYt1mqZsLpF9x5qqu5MSWBkuwBA=; b=oBpB4WLksZlgVwa97SD66C8+iEM5HEGQxQDM2NyE5RmH/AVu9r/3w3dGYPMlsTfyA7 bunwd9OqV43wfQrwiV9za4Ntl8qqBtcYDXYYCP56P65/YRCp6Xq+gMeu2EoZ2LkkVrsa vd4rzu17WeOzaCGcx1el1XX6J9Yfldgw0OidC3qonYDmhaGmAwqLGznh0P6I+1XfGufc OR23wbqJLtAWE5Ts54rP2CfPu0Efcb1HCKt8oX26lT8/JnHKdLBuEPvcsP4z4qbOf1xB Y1ORr6SPVax5mPbAUUwk4sCVc+oGYc79zVAte8/tf/muWo7TbSLHyZ/W7fCec1tgQnym 6VUA== X-Gm-Message-State: AOAM531mKTMm0KpP4xSBhMotBaUhqmABwuC4+1S4Vnv5ey5s+4SHZDxs 6hy1dBPLxivLJPGoYGF9JnDsJg== X-Received: by 2002:a17:902:ea10:b029:e8:e2e9:d9a5 with SMTP id s16-20020a170902ea10b02900e8e2e9d9a5mr487503plg.22.1617752324049; Tue, 06 Apr 2021 16:38:44 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id g3sm18664540pfk.186.2021.04.06.16.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 16:38:43 -0700 (PDT) Date: Tue, 6 Apr 2021 23:38:39 +0000 From: Sean Christopherson To: Keqian Zhu Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Ben Gardon Subject: Re: [PATCH] KVM: MMU: protect TDP MMU pages only down to required level Message-ID: References: <20210402121704.3424115-1-pbonzini@redhat.com> <8d9b028b-1e3a-b4eb-5d44-604ddab6560e@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d9b028b-1e3a-b4eb-5d44-604ddab6560e@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021, Keqian Zhu wrote: > Hi Paolo, > > I'm just going to fix this issue, and found that you have done this ;-) Ha, and meanwhile I'm having a serious case of deja vu[1]. It even received a variant of the magic "Queued, thanks"[2]. Doesn't appear in either of the 5.12 pull requests though, must have gotten lost along the way. [1] https://lkml.kernel.org/r/20210213005015.1651772-3-seanjc@google.com [2] https://lkml.kernel.org/r/b5ab72f2-970f-64bd-891c-48f1c303548d@redhat.com > Please feel free to add: > > Reviewed-by: Keqian Zhu > > Thanks, > Keqian > > On 2021/4/2 20:17, Paolo Bonzini wrote: > > When using manual protection of dirty pages, it is not necessary > > to protect nested page tables down to the 4K level; instead KVM > > can protect only hugepages in order to split them lazily, and > > delay write protection at 4K-granularity until KVM_CLEAR_DIRTY_LOG. > > This was overlooked in the TDP MMU, so do it there as well. > > > > Fixes: a6a0b05da9f37 ("kvm: x86/mmu: Support dirty logging for the TDP MMU") > > Cc: Ben Gardon > > Signed-off-by: Paolo Bonzini > > --- > > arch/x86/kvm/mmu/mmu.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index efb41f31e80a..0d92a269c5fa 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -5538,7 +5538,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, > > flush = slot_handle_level(kvm, memslot, slot_rmap_write_protect, > > start_level, KVM_MAX_HUGEPAGE_LEVEL, false); > > if (is_tdp_mmu_enabled(kvm)) > > - flush |= kvm_tdp_mmu_wrprot_slot(kvm, memslot, PG_LEVEL_4K); > > + flush |= kvm_tdp_mmu_wrprot_slot(kvm, memslot, start_level); > > write_unlock(&kvm->mmu_lock); > > > > /* > >