From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32106C433B4 for ; Tue, 6 Apr 2021 23:40:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECC3D613B7 for ; Tue, 6 Apr 2021 23:40:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235905AbhDFXkt (ORCPT ); Tue, 6 Apr 2021 19:40:49 -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-Google-Smtp-Source: ABdhPJyv6iDzPjqW36UJoRENw1GDU+MFhkdND3HAlMFiNu7p5+XFnIQ1JzH767P4R342Bei5MQnsBg== 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); > > > > /* > >