Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7074509imm; Tue, 28 Aug 2018 06:05:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbYkSmh11kxYP8GhCuSuaIP4pMhVvNCH+G3gEC42RSXvweot3pnpfzq1GAFxe2CU6p9lqPz X-Received: by 2002:a63:4757:: with SMTP id w23-v6mr1551920pgk.140.1535461523823; Tue, 28 Aug 2018 06:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535461523; cv=none; d=google.com; s=arc-20160816; b=pZuAKVQv1XvQjzOx70EnuTHH+scd2FO06dbiWuBmoOZ40UlU3UWE/Fs/uGcifnEDXX SWmeaZVt6u2+OHFch0yJDDO96WtzRx/jfTyMHz8gLabbE+u/5+RuGCXP90TDMoG7qTNZ ZScug0cruAz2ELIEBZ2T8HZHEwGnR9+blzrGgyLKL+qHfiXJqhlKkYdy4LXs3fPev2c/ qKfFs+TObeDol/tgUVvqwTJ8RpuNn29213B25pqxDGKlKMaqcVRjDBYCW3utiOfRKlTV +F2Jjgt/QM0hbJPSIRV2pH9wBXnS5kn4+sIPScXawYAwlbPOeJyxf8T+9rOviV1KHnqt gcBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ytmV6TMXcMnTQi9Zj/XqTuX/xVI+oD8EkJUJBwGP9fI=; b=Cm/8bQa4xaBcKtzOXea5NQ7hE2Pq2//nAuvNPFm1PzCAJ+kisZZ1BgK273U+6bpOBx MV6/Ndu3CA+mkxz7DCeo3Dc+XcaUpJQekbicE3JKcPI480KAqws5aloUgMsUy+UE6sKP 78BoIi0dp4aMEUwfr8FsGqjeQPAsrG9kJyAWu3bXAGMyJB4ZevN2OSyDINGwszq+G0Ra 8eaw7E/Nuz10NBwTuH5YGhe8a55fSfXR5nsuk1KsiUzlSeir4t2z4bmpq9+jnUnFAkwG BGgB8LdNlW26T+At+8/hZB8hYGjUTsuDoTqkcZ9PeNQTr+19wlRXW5VfICX9sw8Mj1tf KOaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y86-v6si985274pfi.195.2018.08.28.06.05.02; Tue, 28 Aug 2018 06:05:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbeH1Qyu (ORCPT + 99 others); Tue, 28 Aug 2018 12:54:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37424 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbeH1Qyu (ORCPT ); Tue, 28 Aug 2018 12:54:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB88C80D; Tue, 28 Aug 2018 06:03:15 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BC4F43F721; Tue, 28 Aug 2018 06:03:15 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 42FB21AE31F5; Tue, 28 Aug 2018 14:03:27 +0100 (BST) Date: Tue, 28 Aug 2018 14:03:27 +0100 From: Will Deacon To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, benh@au1.ibm.com, torvalds@linux-foundation.org, npiggin@gmail.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 02/11] arm64: tlb: Add DSB ISHST prior to TLBI in __flush_tlb_[kernel_]pgtable() Message-ID: <20180828130326.GB26727@arm.com> References: <1535125966-7666-1-git-send-email-will.deacon@arm.com> <1535125966-7666-3-git-send-email-will.deacon@arm.com> <20180824175609.GR24124@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180824175609.GR24124@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 24, 2018 at 07:56:09PM +0200, Peter Zijlstra wrote: > On Fri, Aug 24, 2018 at 04:52:37PM +0100, Will Deacon wrote: > > __flush_tlb_[kernel_]pgtable() rely on set_pXd() having a DSB after > > writing the new table entry and therefore avoid the barrier prior to the > > TLBI instruction. > > > > In preparation for delaying our walk-cache invalidation on the unmap() > > path, move the DSB into the TLB invalidation routines. > > > > Signed-off-by: Will Deacon > > --- > > arch/arm64/include/asm/tlbflush.h | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > > index 7e2a35424ca4..e257f8655b84 100644 > > --- a/arch/arm64/include/asm/tlbflush.h > > +++ b/arch/arm64/include/asm/tlbflush.h > > @@ -213,6 +213,7 @@ static inline void __flush_tlb_pgtable(struct mm_struct *mm, > > { > > unsigned long addr = __TLBI_VADDR(uaddr, ASID(mm)); > > > > + dsb(ishst); > > __tlbi(vae1is, addr); > > __tlbi_user(vae1is, addr); > > dsb(ish); > > @@ -222,6 +223,7 @@ static inline void __flush_tlb_kernel_pgtable(unsigned long kaddr) > > { > > unsigned long addr = __TLBI_VADDR(kaddr, 0); > > > > + dsb(ishst); > > __tlbi(vaae1is, addr); > > dsb(ish); > > } > > I would suggest these barrier -- like any other barriers, carry a > comment that explain the required ordering. > > I think this here reads like: > > STORE: unhook page > > DSB-ishst: wait for all stores to complete > TLBI: invalidate broadcast > DSB-ish: wait for TLBI to complete > > And the 'newly' placed DSB-ishst ensures the page is observed unlinked > before we issue the invalidate. Yeah, not a bad idea. We already have a big block comment in this file but it's desperately out of date, so lemme rewrite that and justify the barriers at the same time. Will