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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61EC3C3A5A0 for ; Mon, 20 Apr 2020 12:11:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 208C7206D6 for ; Mon, 20 Apr 2020 12:11:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ro0x8c1X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 208C7206D6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 923248E0006; Mon, 20 Apr 2020 08:11:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D3E48E0003; Mon, 20 Apr 2020 08:11:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E94C8E0006; Mon, 20 Apr 2020 08:11:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 644398E0003 for ; Mon, 20 Apr 2020 08:11:42 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2913B443F for ; Mon, 20 Apr 2020 12:11:42 +0000 (UTC) X-FDA: 76728119244.02.stone35_66266dd74f54f X-HE-Tag: stone35_66266dd74f54f X-Filterd-Recvd-Size: 4018 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Apr 2020 12:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hyyhVGnvFilfrdqHNEg1EViEFDU1g/FpAPCa//Vm+Ms=; b=Ro0x8c1X2BeWf7TvQCOYH/vp3B u8UbmQW+uedKRoJDHljAHvWQiYcHgwyhXDsYpGMGpRc80vsD3ENgjZpqt4uTgcirKDrKKeGgWYAyY ZdLOtoEXXnkEIIYIgtOd2v44QGGlsqtBytg1uHI4aUjAP+tySOzwCO0pMaNI4vnP8sO/U4uyY/AYw d38ygCc2ptooChKwRxRBjX+o9uNLnCDhAgfbMRqM/V6UxIBMCZfakSu78Qm33nl6LrUeHJ2hefPO1 vEJIvFQvXjsgirK1UOM25FkhTaoPeJvqbvqpKGNGES42UZvmNSpym3h0VhGh8VlZkE+EvNJc7cHTL DqHfGkfA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQVGL-0004t8-1H; Mon, 20 Apr 2020 12:10:57 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D050B3024EA; Mon, 20 Apr 2020 14:10:55 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C09EF2B8DAF8C; Mon, 20 Apr 2020 14:10:55 +0200 (CEST) Date: Mon, 20 Apr 2020 14:10:55 +0200 From: Peter Zijlstra To: Zhenyu Ye Cc: mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com, aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com, arnd@arndb.de, rostedt@goodmis.org, maz@kernel.org, suzuki.poulose@arm.com, tglx@linutronix.de, yuzhao@google.com, Dave.Martin@arm.com, steven.price@arm.com, broonie@kernel.org, guohanjun@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, arm@kernel.org, xiexiangyou@huawei.com, prime.zeng@hisilicon.com, zhangshaokun@hisilicon.com, kuhn.chenqun@huawei.com Subject: Re: [PATCH v1 6/6] arm64: tlb: Set the TTL field in flush_tlb_range Message-ID: <20200420121055.GF20696@hirez.programming.kicks-ass.net> References: <20200403090048.938-1-yezhenyu2@huawei.com> <20200403090048.938-7-yezhenyu2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200403090048.938-7-yezhenyu2@huawei.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 03, 2020 at 05:00:48PM +0800, Zhenyu Ye wrote: > This patch uses the cleared_* in struct mmu_gather to set the > TTL field in flush_tlb_range(). > > Signed-off-by: Zhenyu Ye > --- > arch/arm64/include/asm/tlb.h | 26 +++++++++++++++++++++++++- > arch/arm64/include/asm/tlbflush.h | 14 ++++++++------ > 2 files changed, 33 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > index b76df828e6b7..d5ab72eccff4 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -21,11 +21,34 @@ static void tlb_flush(struct mmu_gather *tlb); > > #include > > +/* > + * get the tlbi levels in arm64. Default value is 0 if more than one > + * of cleared_* is set or neither is set. > + * Arm64 doesn't support p4ds now. > + */ > +static inline int tlb_get_level(struct mmu_gather *tlb) > +{ > + int sum = tlb->cleared_ptes + tlb->cleared_pmds + > + tlb->cleared_puds + tlb->cleared_p4ds; > + > + if (sum != 1) > + return 0; > + else if (tlb->cleared_ptes) > + return 3; > + else if (tlb->cleared_pmds) > + return 2; > + else if (tlb->cleared_puds) > + return 1; > + > + return 0; > +} That's some mighty wonky code. Please look at the generated asm.