From patchwork Thu Jun 22 14:42:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 111708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5129567vqr; Thu, 22 Jun 2023 07:59:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6a/V3i1H0u1JZcSpS6KsMsy6DLLvNzn5U2+bb9dl7lmeclriu+gepCmElJsw6E9UknRI/J X-Received: by 2002:a92:4b02:0:b0:33d:ab70:3447 with SMTP id m2-20020a924b02000000b0033dab703447mr17854095ilg.19.1687445962085; Thu, 22 Jun 2023 07:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687445962; cv=none; d=google.com; s=arc-20160816; b=syWEmUJ7dhLwHlXp9r0+TMwaUlY5OsDtopHcB3ax4nt9JQIvpFftA/YH0wKJVmir91 +urYhHB4hHayZA9YgqFik8HQ1XhuNsvJ9GVPszLQZHN2iX77UtjW34RqhFonPkCT6/Eq livcx4xa8DjVIsNU4B4ue2mrI1ZFvTvfwOnZVqP92+BkLLSo+WBTAGOTI2tzxug7qOtu 06fAIleFHDrz7mgT/obbM+pCLYw0kdkxpdF6sGhRNEHzgF5Tt+fEV9fGCg6I7rc2JfDN rHgWKlkKbRrCJheoT6qoeLbNt1I/iThyPjlyFsLzyNZhj0QN5HwzFenNLfwkN+624/Lw DiYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WAztuwwCVy8qP9L2dunxZQePeRG4wFUsOFlwxBwE1/E=; b=w0I8PPa2wCiHw2Bj6UOMnOdk0WnLMTjPTuaEeJ47ihBJ8UQgX9kp8SAQ0XEiZfEcIP sdL+TFoSYl05vqJOj2d5Thaoo0b9MwFIga3u2/VLEeoTX+xColSukHlmTyqkSoV/GWvl a9be/bjXqZqUCo+wYEMSrpvNFrrjPnQ9xqbCNkHnTpMLA4/TrZqkHenMxRLsQCRoPnnO FTXvq4C3HA6w5qIxIJJwtd7ZHZ+RdYcm0RXNciQvIGQCCBn8+224yQGx1w3nUJT4sk0i MxffmMhFCwlleF/h2O4NC0vfOU68vtFTJ3oa6ZztqlO9wsOs6hFnD1wk12ckoNBHdzCh b15A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 14-20020a63010e000000b0054033bf35f4si6379054pgb.773.2023.06.22.07.59.09; Thu, 22 Jun 2023 07:59:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbjFVOnf (ORCPT + 99 others); Thu, 22 Jun 2023 10:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbjFVOnS (ORCPT ); Thu, 22 Jun 2023 10:43:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B24F726AE for ; Thu, 22 Jun 2023 07:42:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4843F113E; Thu, 22 Jun 2023 07:43:40 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B85DE3F663; Thu, 22 Jun 2023 07:42:53 -0700 (PDT) From: Ryan Roberts To: Catalin Marinas , Will Deacon , 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 Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 10/14] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Thu, 22 Jun 2023 15:42:05 +0100 Message-Id: <20230622144210.2623299-11-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622144210.2623299-1-ryan.roberts@arm.com> References: <20230622144210.2623299-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769415337034285367?= X-GMAIL-MSGID: =?utf-8?q?1769415337034285367?= 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 412a3b9a3c25..de1f5d9a546e 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -278,7 +278,7 @@ static inline void flush_tlb_page(struct vm_area_struct *vma, */ #define MAX_TLBI_OPS PTRS_PER_PTE -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) @@ -357,6 +357,15 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, } scale++; } +} + +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); }