Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp132059rwp; Wed, 12 Jul 2023 10:45:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEj3gAIzQVoEWwlBFzI4QG2NCatdzMej4BqMSrAOAOdoAHxxCzpmVQuE0iMyYxH6Uu2lwb4 X-Received: by 2002:a05:6a21:329a:b0:132:d03b:4133 with SMTP id yt26-20020a056a21329a00b00132d03b4133mr2821070pzb.62.1689183902138; Wed, 12 Jul 2023 10:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689183902; cv=none; d=google.com; s=arc-20160816; b=oKNLonfCw9Pj6fTvXK+UuISgUgRx/2aaudhv+T16hQSdFbzbaEcM7GLxBkvngwQruF AvnAs+KujxCIl/7FGlPXWVQ6aiG8mOwndeT3D9nxKSoHoFPlXjetJgRiNYFw6qXJZCeV yFuP5qNE1XGunmfUVKAyKZkkmXP8O+7yPHW531uk075oSzd9rnrpr5MirpwxgKt4Qrfb FguWw22tY5Ax/9pE3EoH4oOnYFaYQvb55fd5XDRXIsLTHizxud8eTfY3Q/jVBwktI/Im 53rX3h+NBIDf8U/gxLgK98KtVUOU8iweuqX7GdftjssNA9UP/R9Kkvk8gQSIUxTE21TI k43Q== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=9tQ2ZbbyLLdcDDhvAxA5qEVgxy8o1H8UkklbLpk31ig=; fh=x5XsZ2ApshnZtNTMnM3JeTRj0sLuijFTz4QwDHkz/is=; b=uoq7B0fEnCXXpt2z+DRbZmL7aQiQulmKj7QbnamfXnuXv+nqxGR+wg8sJuSe8hAu+d zDZltuYBJ/807s9svzILJY1yt6i7neL0P3amV/eae4QvnxxJy4ZaGKkdDSkxhfeR2bJQ paenP6WbKNIOqNWHS1pes+p1YvJDZduz/C5m0JyWtNpHFKebPFy46kXXTFNRgUW4onus s7u2eFe/M9Tv/TAjMr+2cvihNO0gadpTJ01CLwYkyrzTdpSmQ1Yzp3POSxO2oaEUsgyp ajhB0PQ3d3D0xRaf4Fb4vP8dUzih37bbEiTyyevcECldL3KcTFmKBbqlfvujDaHBfOFQ hi9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=hZjwQME8; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a634e56000000b0054fa5f25cfasi3491872pgl.568.2023.07.12.10.44.49; Wed, 12 Jul 2023 10:45:02 -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=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=hZjwQME8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233071AbjGLRX7 (ORCPT + 99 others); Wed, 12 Jul 2023 13:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231924AbjGLRX6 (ORCPT ); Wed, 12 Jul 2023 13:23:58 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463071BD for ; Wed, 12 Jul 2023 10:23:56 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-668704a5b5bso6466909b3a.0 for ; Wed, 12 Jul 2023 10:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1689182636; x=1691774636; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=9tQ2ZbbyLLdcDDhvAxA5qEVgxy8o1H8UkklbLpk31ig=; b=hZjwQME8K62afCa/lKxAV5oDAQbtGEBFMc9MArh/PEz7oE9G6vUVAfOnb/9R4vBGxK 1p1NcH+qnX13Ru4H4jouGvPcdhK1h6k+qCLXI8YVgtZPBu4W+jMhiqB+u/ZVxaEw0Hp6 ihr02PgYKEWNMlwcQfr2/i7L4yiGRocd/mcHeDedHPSxJpwwaeiIvvgp1H7KSoPD7f+8 o0jddnMArxfV1MgrK7mGxmRLv6ix4n+Nl1ki4KAFn1VZOXE1Fc/kMqnaq33dhWTBTKYY g2APClzhteWp3vYwyHS6lDvUJbrZdjwu2siZMPrkDOwHRcHeAF+ln9H611Ur9MnJmfCJ lZFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689182636; x=1691774636; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9tQ2ZbbyLLdcDDhvAxA5qEVgxy8o1H8UkklbLpk31ig=; b=DuDZU2WMTIT0yRrcpCjKpYHJF4lrwK8DplVrzw/GzN9OaGUt9C/RTsNdSNKzAIuHH+ QvM/0d5v0a/M5BBTDp05geP4903scPbjaYsPtUf0v2PYpqIi2cqY1o3DPBVTD9jLnE28 al61XKCvlLhG3hlw+CrrE+14HHK5a5VJsTgJXRIiN5mvweQcuA/Wjyho/t5vWwxjtB20 gWnbAHkXwPHMHpMMNsSU5ju9NwG3QxjfEfuQ5dgzHZdAf6KdjZeZ6Bee/J+uFEgacrWq clPUGjgZuh91mlyrPEmVjdaSwsQBuxYauhFuWnhcrxxSoQ9v9NDNzh6gOtpeVi+umfVz G0yg== X-Gm-Message-State: ABy/qLYfw7TjF1uUC0qU9LoHks6GM8VI4UHZAtlKb23F57iDTQ5BUzz1 dG14HddohrQXLzlcqNzl20TxJA== X-Received: by 2002:a05:6a00:84d:b0:682:54b9:1093 with SMTP id q13-20020a056a00084d00b0068254b91093mr25574401pfk.15.1689182635685; Wed, 12 Jul 2023 10:23:55 -0700 (PDT) Received: from localhost ([50.38.6.230]) by smtp.gmail.com with ESMTPSA id ey24-20020a056a0038d800b00666add7f047sm3821151pfb.207.2023.07.12.10.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 10:23:55 -0700 (PDT) Date: Wed, 12 Jul 2023 10:23:55 -0700 (PDT) X-Google-Original-Date: Wed, 12 Jul 2023 10:23:08 PDT (-0700) Subject: Re: [PATCH 0/4] riscv: tlb flush improvements In-Reply-To: <20230712-frying-unaired-e3acb5150e8b@spud> CC: alex@ghiti.fr, Conor Dooley , alexghiti@rivosinc.com, Will Deacon , aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com, peterz@infradead.org, mchitale@ventanamicro.com, vincent.chen@sifive.com, Paul Walmsley , aou@eecs.berkeley.edu, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: Conor Dooley Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Wed, 12 Jul 2023 10:19:47 PDT (-0700), Conor Dooley wrote: > On Wed, Jul 12, 2023 at 05:18:00PM +0200, Alexandre Ghiti wrote: >> On 12/07/2023 09:08, Conor Dooley wrote: >> > On Tue, Jul 11, 2023 at 09:54:30AM +0200, Alexandre Ghiti wrote: >> > > This series optimizes the tlb flushes on riscv which used to simply >> > > flush the whole tlb whatever the size of the range to flush or the size >> > > of the stride. >> > > >> > > Patch 3 introduces a threshold that is microarchitecture specific and >> > > will very likely be modified by vendors, not sure though which mechanism >> > > we'll use to do that (dt? alternatives? vendor initialization code?). >> >> >> @Conor any idea how to achieve this? > > It's in my queue of things to look at, just been prioritising the > extension related stuff the last few days. Hopefully I'll have a chance > to think about this tomorrow.. Famous last words probably. > >> > > Next steps would be to implement: >> > > - svinval extension as Mayuresh did here [1] >> > > - BATCHED_UNMAP_TLB_FLUSH (I'll wait for arm64 patchset to land) >> > > - MMU_GATHER_RCU_TABLE_FREE >> > > - MMU_GATHER_MERGE_VMAS >> > > >> > > Any other idea welcome. >> > > >> > > [1] https://lore.kernel.org/linux-riscv/20230623123849.1425805-1-mchitale@ventanamicro.com/ >> > > >> > > Alexandre Ghiti (4): >> > > riscv: Improve flush_tlb() >> > > riscv: Improve flush_tlb_range() for hugetlb pages >> > > riscv: Make __flush_tlb_range() loop over pte instead of flushing the >> > > whole tlb >> > The whole series does not build on nommu & this one adds a build warning >> > for regular builds: >> > + 1 ../arch/riscv/mm/tlbflush.c:32:15: warning: symbol 'tlb_flush_all_threshold' was not declared. Should it be static? >> > >> > Cheers, >> > Conor. >> >> >> I'll fix the nommu build, sorry about that. Weird I missed this warning, >> that's an LLVM build right? That variable will need to overwritten by the >> vendors, so that should not be static (but it will depend on what solution >> we implement). > > Just make it static until we actually have a vendor implementation of > this stuff please, since we don't know what that will look like yet. It's just a performance issue, right? IIRC the SiFive errata wasn't actually based on how many TLB flushes happen, they're just broken in general so it was a probability thing. If that's the case I agree we can just start with something arbitrary to start and then figure out how to set the tunable later. It's probably going to be workload-specific too, so we'll probably end up with both a firmware default and a userspace override (maybe a sys entry or whatever).