Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1346487rwd; Wed, 31 May 2023 12:34:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iwguZtDAQOViT0BrHeLJYRQ/0pwtd/EXCKF6d8GqYS4zWlnCFxXAeqGnZAzckxg2OeaoW X-Received: by 2002:a05:6a20:2d27:b0:10c:ff51:99bb with SMTP id g39-20020a056a202d2700b0010cff5199bbmr8169680pzl.20.1685561641111; Wed, 31 May 2023 12:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685561641; cv=none; d=google.com; s=arc-20160816; b=RjM7huv+zYGebtwDK5Qz1FGaIv8gHBpgmOqW8+ijFP4JPWUwtWfSPCxa5Dj50PlsOV wyMz0YzuzzPNIen+7tEb+ToFCvxCffF9jKmiznL5NRByPQ1CaPzFlQ7opxBRLXBd9EtL 8NmBQPAxq8bR6mpQi51OXuMlcT8hlZDfVIFDB1dElrxqnf5z43bxi+F9T5Z3Wr5Kfl0W LAGAldTnl3+BkgED/FPjjt9y/pY7AiaK78yyB9I7sOo5yZ557DWeEodWATFenxap0z8o 01Ts1YtoxW4jkJ9fi/sJMZmFpBiijYZJAtGHCA593JJahdyVo9w2jlQE5/E4n4s+i4Il gHZw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=fExwE02o2n9ir13h12C6sJUjb5CZIzSGV94ltztSeYU=; b=grTq1O/wAt84zVML/OWpWhTM1ld1vD9A+2CtdeW0MS6HBFSxB00OWoDaypMVue4HOI YqGfPHTxvz95GjdZGLX5sleyL66k723zNzDCWMta1461WvOb9YjtT+x7phnp1q2fm6st ygyNTYd6r4C0YMH26rS64+Uu9lXnJWXS2+tufmRI5birslv5EgfDegc6ukEu/PamGH/n y5qxzmlmci2vgDFmeEcB+zbmc/Qowd5vD4UQkYah/C50j/DimcjyNQN3X1C1SrsrmDSj P/noKWwQYfx8KUl3k42tNtxyHnI4ltfvJW/CFf+/7lkJWXFeWWJFw6myZ3N+x8v85pR8 xyvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j6oi+jpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a185-20020a624dc2000000b0063b8f0a6f51si228826pfb.117.2023.05.31.12.33.46; Wed, 31 May 2023 12:34:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=j6oi+jpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbjEaT2d (ORCPT + 99 others); Wed, 31 May 2023 15:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjEaT2c (ORCPT ); Wed, 31 May 2023 15:28:32 -0400 Received: from out-11.mta1.migadu.com (out-11.mta1.migadu.com [IPv6:2001:41d0:203:375::b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F210125 for ; Wed, 31 May 2023 12:28:30 -0700 (PDT) Date: Wed, 31 May 2023 19:28:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1685561308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fExwE02o2n9ir13h12C6sJUjb5CZIzSGV94ltztSeYU=; b=j6oi+jpW4qEEAfeTqR1gVmlOIouoNE2cZuCQ9g4gmWt/4cyclojreEVXHu8btfeiGiVcDJ x4P5UZRMb0dW2T4B2o8jFedTmwMjh8UL0366wjygZebZR43zxO9qUMsie4B5b5unRoLQTv JJJh2wVtTtDIseRjA+dHi+WATyCzmmE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Yu Zhao Cc: Andrew Morton , Paolo Bonzini , Alistair Popple , Anup Patel , Ben Gardon , Borislav Petkov , Catalin Marinas , Chao Peng , Christophe Leroy , Dave Hansen , Fabiano Rosas , Gaosheng Cui , Gavin Shan , "H. Peter Anvin" , Ingo Molnar , James Morse , "Jason A. Donenfeld" , Jason Gunthorpe , Jonathan Corbet , Marc Zyngier , Masami Hiramatsu , Michael Ellerman , Michael Larabel , Mike Rapoport , Nicholas Piggin , Paul Mackerras , Peter Xu , Sean Christopherson , Steven Rostedt , Suzuki K Poulose , Thomas Gleixner , Thomas Huth , Will Deacon , Zenghui Yu , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, linux-mm@google.com Subject: Re: [PATCH mm-unstable v2 04/10] kvm/arm64: make stage2 page tables RCU safe Message-ID: References: <20230526234435.662652-1-yuzhao@google.com> <20230526234435.662652-5-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 30, 2023 at 02:06:55PM -0600, Yu Zhao wrote: > On Tue, May 30, 2023 at 1:37 PM Oliver Upton wrote: > > > > Hi Yu, > > > > On Sat, May 27, 2023 at 02:13:07PM -0600, Yu Zhao wrote: > > > On Sat, May 27, 2023 at 12:08 PM Oliver Upton wrote: > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > > > index 3d61bd3e591d..bfbebdcb4ef0 100644 > > > > --- a/arch/arm64/kvm/hyp/pgtable.c > > > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > > > @@ -1019,7 +1019,7 @@ static int stage2_unmap_walker(const struct kvm_pgtable_visit_ctx *ctx, > > > > kvm_granule_size(ctx->level)); > > > > > > > > if (childp) > > > > - mm_ops->put_page(childp); > > > > + mm_ops->free_removed_table(childp, ctx->level); > > > > > > Thanks, Oliver. > > > > > > A couple of things I haven't had the chance to verify -- I'm hoping > > > you could help clarify: > > > 1. For unmapping, with free_removed_table(), wouldn't we have to look > > > into the table we know it's empty unnecessarily? > > > > As it is currently implemented, yes. But, there's potential to fast-path > > the implementation by checking page_count() before starting the walk. > > Do you mind posting another patch? I'd be happy to ack it, as well as > the one you suggested above. I'd rather not take such a patch independent of the test_clear_young series if you're OK with that. Do you mind implementing something similar to the above patch w/ the proposed optimization if you need it? -- Thanks, Oliver