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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3692C433EF for ; Wed, 23 Feb 2022 09:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239332AbiBWJjw (ORCPT ); Wed, 23 Feb 2022 04:39:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbiBWJju (ORCPT ); Wed, 23 Feb 2022 04:39:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5725A5AE; Wed, 23 Feb 2022 01:39:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 18568616CA; Wed, 23 Feb 2022 09:39:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B2C2C340E7; Wed, 23 Feb 2022 09:39:21 +0000 (UTC) Date: Wed, 23 Feb 2022 09:39:17 +0000 From: Catalin Marinas To: Liam Howlett Cc: Will Deacon , Stephen Rothwell , Linux Kernel Mailing List , Linux Next Mailing List Subject: Re: [PATCH] arm64: Change elfcore for_each_mte_vma() to use VMA iterator Message-ID: References: <20220218014642.lop2ohx4ov6fekyl@revolver> <20220218023650.672072-1-Liam.Howlett@oracle.com> <20220222142557.6oykxjz3j7fq4mrn@revolver> <20220222162016.GA16436@willie-the-truck> <20220222185401.jntcd4g62pamfxvr@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220222185401.jntcd4g62pamfxvr@revolver> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 22, 2022 at 06:54:38PM +0000, Liam Howlett wrote: > * Catalin Marinas [220222 12:26]: > > On Tue, Feb 22, 2022 at 04:20:16PM +0000, Will Deacon wrote: > > > On Tue, Feb 22, 2022 at 02:26:03PM +0000, Liam Howlett wrote: > > > > The vma iterator uses the maple tree, so this patch would resolve the > > > > conflict but both branches are needed. > > > > > > I'm not really sure what to do here, then. I think the conflict is nasty > > > enough that we should resolve it before the trees reach Linus, but there > > > doesn't seem to be a way forward other than one of us merging the other > > > branch. I'd like to avoid having MTE coredump support depend on the maple > > > tree work. > > > > > > Is there some way you could provide a branch which implements > > > for_each_vma() using the old vma list, and then the maple tree series > > > could switch that over to the maple tree without breaking things? > > > > Without a branch, we could apply something like below on top of Liam's > > patch and revert it once the maple tree is upstream: > > > > diff --git a/arch/arm64/kernel/elfcore.c b/arch/arm64/kernel/elfcore.c > > index 930a0bc4cac4..400ec7a902df 100644 > > --- a/arch/arm64/kernel/elfcore.c > > +++ b/arch/arm64/kernel/elfcore.c > > @@ -8,6 +8,13 @@ > > #include > > #include > > > > +#ifndef VMA_ITERATOR > > +#define VMA_ITERATOR(name, mm, addr) \ > > + struct mm_struct *name = mm > > +#define for_each_vma(vmi, vma) \ > > + for (vma = vmi->mmap; vma; vma = vma->vm_next) > > +#endif > > + > > #define for_each_mte_vma(vmi, vma) \ > > if (system_supports_mte()) \ > > for_each_vma(vmi, vma) \ > > Note that the current VMA_ITERATOR takes a new type and not the mm. Well, in you proposed fix, it does take current->mm. > Since I am removing the linked list (mm->mmap and vma->vm_next), then > the build will fail if this patch and the maple tree branch exist > together. The iterator may also not start at the start of the list (but > usually does) and may not run through the entire list; see > vma_for_each_range() in the patch set. My hack above is only temporary to allow building the arm64 tree on its own (no maple tree branch) and with your patch on top. In -next, when merged with the maple tree branch, the VMA_ITERATOR macro is already defined and the above hack skipped. We'll revert this hack around -rc1. Note that the hack above is only in the arm64 elfcore.c, not a generic API solution. -- Catalin