Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4572172rdb; Tue, 12 Dec 2023 03:35:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9Z0CIoFz8XWZgqpwMTCbMOrhAqSaSMmdawybaZiuT7R3uwwA0HSThJy5+mJ+620UKPmFt X-Received: by 2002:a17:902:ab06:b0:1d3:40e7:c1b7 with SMTP id ik6-20020a170902ab0600b001d340e7c1b7mr168221plb.27.1702380935445; Tue, 12 Dec 2023 03:35:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702380935; cv=none; d=google.com; s=arc-20160816; b=nyMdnYAREWWY+KGUYbUXtvCUr161sCjcUP4OPM38KMvh9V9duVfAgvxfUerRlOpPSk KlucKH+bVPXWjFpGTVMsPsnLPwZfSxiNPQ3fw/8UM20t+aAWALuroMs4qUgxq8R8zIKW mqanu/nrUt/eOMQ3pRz1xvzXlMffZNaleY7d6jiqTA0XWRoF3ixSa/pT85wltU7CiY0l HD18f1xesm+310dBbexqBMF67z1VyOQD/VkiXp9Sb329AOtztTY1vUhxyPKv0ysp1kQe ItEuDVRrwXh6L2MZpVVMJp4v2s3xa4R24d/KagU3ubllCyQtOozqI6gFvu7vvljkeQ96 Zeog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=XciqLYteG1fyGjcnqqvzNjlkpFKxgvF/vnSeGZb3gew=; fh=rylnzn+s4EcMvbKGGluhnSFYmZ2IvM+1WbBU+laO47s=; b=gQNFiP3TJPSoGWEcg9zAHZqs413UBO0yem0SgyL0C3A9ZbxQK7o4yc9VWdyp5X3KYn 5cGduwwuJJKk/L9iup4LVi/VWA6bEgy5s5eYIeE5nSpUqrgIaqowfMb6wBqStjwFSZuT ByYYOJ4niiYn9nsGwKbD3FiUUCee2xx4EOsnyIuOV2DtjKyimgIpQf9fHCRDu+KKiI6H vpL6roj0obXfVDumaW07bUHe8PWlqlCBh2jF8mVWQBRHP58UfC88pt1VwvOl7XHuRBHU iE2KhySlBoAPCAsxEUGyfJnGDScY5IhHF7N/oqZpESYo4tC+myATSvUc85Ar2HaIgjiS MDtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ChlUuItj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n2-20020a170902d2c200b001d0c3e70d3asi7701071plc.490.2023.12.12.03.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:35:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ChlUuItj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C20898070656; Tue, 12 Dec 2023 03:35:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232278AbjLLLfY (ORCPT + 99 others); Tue, 12 Dec 2023 06:35:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231961AbjLLLfU (ORCPT ); Tue, 12 Dec 2023 06:35:20 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B353BCD for ; Tue, 12 Dec 2023 03:35:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A08C433C7; Tue, 12 Dec 2023 11:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702380926; bh=Pob5Ge2gFIJG7Q0aQ/vTG1K/p3ucC0PSIOzsvYWOUOo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ChlUuItjd2gyTeqVgCQDk6fs8gtd16Kn8Oa3hq1KQzsfcuMRdXOO94YGbS6d5rrtZ BIHf3nUh3dH7CNtKK8gAKoXCsANL6oDpEQ2BhHM6yakdd320Tcejtf3TfUzKQM3gfA 18OY+N62lKSXe+hmmqQCRvVphdJzXtnDQ8n8izElVjsmny2rNvVd/+ei6Wnkuz6US5 GTNZvoLtx7xOdkB15mZ1bbde96IYyYuwN/mNJiVxSsw7KC6kAZ5WLZ0eHhrOzRa2X9 /9RE21fot+BNmpRpDI8ZajgjLklP0liEfU2d8VJ2EEywo6wLZ23gCYIcrY3hy08OMP BDjmon0SElTXQ== Date: Tue, 12 Dec 2023 11:35:17 +0000 From: Will Deacon To: Ryan Roberts Cc: Catalin Marinas , Ard Biesheuvel , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , Anshuman Khandual , Matthew Wilcox , Yu Zhao , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/15] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Message-ID: <20231212113517.GA28857@willie-the-truck> References: <20231204105440.61448-1-ryan.roberts@arm.com> <20231204105440.61448-13-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231204105440.61448-13-ryan.roberts@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 03:35:33 -0800 (PST) On Mon, Dec 04, 2023 at 10:54:37AM +0000, Ryan Roberts wrote: > Split __flush_tlb_range() into __flush_tlb_range_nosync() + > __flush_tlb_range(), in the same way as the existing flush_tlb_page() > arrangement. This allows calling __flush_tlb_range_nosync() to elide the > trailing DSB. Forthcoming "contpte" code will take advantage of this > when clearing the young bit from a contiguous range of ptes. > > Signed-off-by: Ryan Roberts > --- > arch/arm64/include/asm/tlbflush.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index bb2c2833a987..925ef3bdf9ed 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -399,7 +399,7 @@ do { \ > #define __flush_s2_tlb_range_op(op, start, pages, stride, tlb_level) \ > __flush_tlb_range_op(op, start, pages, stride, 0, tlb_level, false) > > -static inline void __flush_tlb_range(struct vm_area_struct *vma, > +static inline void __flush_tlb_range_nosync(struct vm_area_struct *vma, > unsigned long start, unsigned long end, > unsigned long stride, bool last_level, > int tlb_level) > @@ -431,10 +431,19 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, > else > __flush_tlb_range_op(vae1is, start, pages, stride, asid, tlb_level, true); > > - dsb(ish); > mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, start, end); > } > > +static inline void __flush_tlb_range(struct vm_area_struct *vma, > + unsigned long start, unsigned long end, > + unsigned long stride, bool last_level, > + int tlb_level) > +{ > + __flush_tlb_range_nosync(vma, start, end, stride, > + last_level, tlb_level); > + dsb(ish); > +} Hmm, are you sure it's safe to defer the DSB until after the secondary TLB invalidation? It will have a subtle effect on e.g. an SMMU participating in broadcast TLB maintenance, because now the ATC will be invalidated before completion of the TLB invalidation and it's not obviously safe to me. Will