Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1369732rwb; Fri, 28 Jul 2023 08:28:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEsrCQm8lmjWqFF7inK0NyGqMI7fAHZHeEywJJG37D2HG2gRHQAvauUWNfrJLHnz0o3qmN8 X-Received: by 2002:a05:6a20:729b:b0:125:4d74:cd6a with SMTP id o27-20020a056a20729b00b001254d74cd6amr2967961pzk.3.1690558087475; Fri, 28 Jul 2023 08:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690558087; cv=none; d=google.com; s=arc-20160816; b=E5LpfUGQqBU9G/fSNjk1yeUkbepOG+pEgHWv+5rqg1qjSUPomMHf4J5Tha/x8NgImC PEM7TPStWl0ImzhwC42UsGfRnpqK5lNArc1rx5qhYKrrDO7RbOr+kHavFKz24zEMIFir SPg89/cJQQJTsibY5WNwXZ4llCfuH3kTYXDfx81zzeucGW4usdKuoatK8f/NVmHPwxqX ubrDAt0reUASvezD2GGSgbxlZH93V4rpxeGALyJVQbf2qC8R4ceH6SZZ/YkI7WMWq/C5 YJcvwk7Rg8Zl90xcC2q7LzmRjxVzYcX0nxFprSyQcCc2QlaHh1FZgA6ok4oYFX7suo3+ 8m3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=C+qgGG8kK8apCYAL7jHt46TTa6xBPAiksqn/Pj732rQ=; fh=oAxqgy24eG7yK9zQDuSWcx5vPNqCo+o+hye0reWxJY4=; b=dYCOcmTnjeUauCTNWptTPAY87S8FL8l1cFgsQSSxq64bXjbdCd4RqISEeWAExrOLVj 62Yp1CHQyuLG0IyuP9LQqbLzj9SQCjxc/z+ZfrpRQX5YpOp8cx/77Z4/fiIn/ah3XAzC G6j2FSbzffh8uoSWvMkmovbOAaV7j6zXiGhbnxX+0cLh022YkIM7yOj5hJDsfAZxlft9 MOlpBLBlhNdP9CVHhtu3j1f22njMcueTzgzHq96tR0IGk0XKHbxPRA+MRatNMw39fp55 oHgjrL+SjBny5J+buMNvqU9fY0VXMCTkXn/+zaEP+7JA0YRsrfWKK3Lb6E9sKLCpeI/d J0+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=oXEvYuGx; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c66-20020a633545000000b00563fc307786si3233427pga.398.2023.07.28.08.27.55; Fri, 28 Jul 2023 08:28:07 -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; dkim=pass header.i=@microchip.com header.s=mchp header.b=oXEvYuGx; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234631AbjG1Nvb (ORCPT + 99 others); Fri, 28 Jul 2023 09:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233761AbjG1Nva (ORCPT ); Fri, 28 Jul 2023 09:51:30 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 414A52D47; Fri, 28 Jul 2023 06:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1690552289; x=1722088289; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=u4UOOMLzhEg7Hb9YLlX0MpaOBGLEhWTvCIPPPEtSP78=; b=oXEvYuGxCY1dv5TiWF8Mt9rTunAk/s+oaBznXcGpWm7EUhvIaiAFFre9 RXiFfiOuEDPgBcFd1FfRpN1lvefWWcfGfgSpL1lEbfZJfnGz0o6EZzmOG /0Rmqm1UUqJLRxTyj6TNyp49S2bxxhnD8rxZ0b8Ao6mayQt8kQI9yQtKr RS5gb3LgbcsSj8Sgt1gg4IIdTAUG7bRV4nmGlHl6TIVNRYd6Z8JzBmQdE zhWM91Au4aRQFgJDjzM+HpjMgqx1jNKSoNK3PIyZgQZiqLxVn+5hDlxmA mNOAvImwoU/uXOpsnwKdp8zijiRldCF/YIAltO97IzlN4FXom3TVYvaKF Q==; X-IronPort-AV: E=Sophos;i="6.01,237,1684825200"; d="asc'?scan'208";a="238439247" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Jul 2023 06:51:28 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 28 Jul 2023 06:51:27 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 28 Jul 2023 06:51:25 -0700 Date: Fri, 28 Jul 2023 14:50:50 +0100 From: Conor Dooley To: Alexandre Ghiti CC: Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Mayuresh Chitale , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , , , , Subject: Re: [PATCH v2 3/4] riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb Message-ID: <20230728-fragrant-slogan-c0d5fe419148@wendy> References: <20230727185553.980262-1-alexghiti@rivosinc.com> <20230727185553.980262-4-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jGn+lVFirgFk2Kkr" Content-Disposition: inline In-Reply-To: <20230727185553.980262-4-alexghiti@rivosinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --jGn+lVFirgFk2Kkr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 27, 2023 at 08:55:52PM +0200, Alexandre Ghiti wrote: > Currently, when the range to flush covers more than one page (a 4K page or > a hugepage), __flush_tlb_range() flushes the whole tlb. Flushing the whole > tlb comes with a greater cost than flushing a single entry so we should > flush single entries up to a certain threshold so that: > threshold * cost of flushing a single entry < cost of flushing the whole > tlb. >=20 > This threshold is microarchitecture dependent and can/should be > overwritten by vendors. Please remove the latter part of this, as there is no infrastructure for this at present, nor likely in the immediate future. > Co-developed-by: Mayuresh Chitale > Signed-off-by: Mayuresh Chitale > Signed-off-by: Alexandre Ghiti > --- > arch/riscv/mm/tlbflush.c | 41 ++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 39 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c > index 3e4acef1f6bc..8017d2130e27 100644 > --- a/arch/riscv/mm/tlbflush.c > +++ b/arch/riscv/mm/tlbflush.c > @@ -24,13 +24,48 @@ static inline void local_flush_tlb_page_asid(unsigned= long addr, > : "memory"); > } > =20 > +/* > + * Flush entire TLB if number of entries to be flushed is greater > + * than the threshold below. > Platforms may override the threshold > + * value based on marchid, mvendorid, and mimpid. And this too, as there is no infrastructure for this the comment is misleading. This kind of thing should only be added when there is actually a mechanism for doing so. I did say I would think about how to do this, but I have not come up with something. I dislike using the marchid/mvendorid/mimpid stuff if we can avoid it, as there's no control over what actually gets put in there, especially if people are going to use the open souce cores. Do we even, unless under extreme duress, want to allow setting custom values here via firmware? Sounds like a recipe for 1200 different alternatives or a big LUT... --jGn+lVFirgFk2Kkr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZMPHugAKCRB4tDGHoIJi 0i7gAQD99swFs11GEt+GGumHiBo4DwfAPprUIG6NJwlipUEtTwD8C0Cvcof0M2Cb j9Yi7Bv2Lc/s1+bLZK+A2sqPkSyzRQ0= =Z50k -----END PGP SIGNATURE----- --jGn+lVFirgFk2Kkr--