Received: by 2002:a05:7412:4e10:b0:e2:908c:2ebd with SMTP id gb16csp72219rdb; Tue, 7 Nov 2023 00:38:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKFbLMHiCOyPvBZrRQ9dt4Ir7ZoavsoIIYwwoPHQYS9iVZi2cNdKAT3zJVDktnMDdLRlGB X-Received: by 2002:a05:6358:7248:b0:16b:7751:37a8 with SMTP id i8-20020a056358724800b0016b775137a8mr1628864rwa.9.1699346309373; Tue, 07 Nov 2023 00:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699346309; cv=none; d=google.com; s=arc-20160816; b=tStgq5oqWBwF4WM/TQLS4R9ezINafp4n/xin4rO3SH2/0EpiUt8fx6K9mc62jng323 HAIpv5Xe4ctF3orU60jZPcaH5DJnWXXbAgngjVZNLb5v6vcN5K0jQnDKOQMcwMKTL+8i HySnQuaNG+z39RQKcsbdABMGjDar+1SqjKONoJEVRRZATk+e0ybFyloqns0NKmS9Q3Cg 327xjx3y0PhRJzAqU8vYf79q9OjAdXA/hGuy2OKvB4PbpRfxfbYeTpgWrIna+zF/96Ak qTzeTZZpcWyXYiHxnBkwEq5C/L9s6L1BDK2W+U65pa+Qv0BO8n9XdQLQ8eqVKh/1vFhF H1YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=y6dvthR2+uXXaKtZhfu19I8uRaF5Ucp/hKjGsFNZse0=; fh=T11bc0seQ+0M1DARN4I84wAejfc7JW+YwPZcQz6c+2I=; b=yroU1tNiptqpJbl+68ZKfxRGdALFM61vg8X3ceE9Mym43bL+X+rGFuAcig0i7hJz93 DiBaVeITFk0pOb3Lsz3xkMWw7Ni/ATVNryrv5ChkTVLnK26qzH9gBEkSABQmBQ5HRrG+ qgTIJ/SMivx7A66aPXE+ciXOMnhRssSw+Pq/3wtiaz3xUiHZvbHYCEomqg5XaU7u/ISF BnnNThdKyUv/2717l5ahaUZ2PorlYfFegBlQpRd0gKkz0xxUq0KQtU330xRg39F1W9Oh e4ryqLHWu1bq2cG1Sys93RNWWlJxXB3iCdQ/HQXcPlEYJhu7CnPmS7WSSeLM7BcJjEi2 FNpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZVEDJbxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bv125-20020a632e83000000b005859b2d8d7asi1640718pgb.4.2023.11.07.00.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 00:38:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZVEDJbxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EC8C7811F93F; Tue, 7 Nov 2023 00:38:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbjKGIiZ (ORCPT + 99 others); Tue, 7 Nov 2023 03:38:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231303AbjKGIiY (ORCPT ); Tue, 7 Nov 2023 03:38:24 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EFB5113; Tue, 7 Nov 2023 00:38:21 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-542d654d03cso8893319a12.1; Tue, 07 Nov 2023 00:38:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699346300; x=1699951100; darn=vger.kernel.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=y6dvthR2+uXXaKtZhfu19I8uRaF5Ucp/hKjGsFNZse0=; b=ZVEDJbxoG1cS+KXLakjHKi1Wvnew4GghZa5ENLiGXYwhNB0917zW3Isid4c5aWvHgt JXxZV3jpqfKgU5tKRUYe8MVcTUxjekvuq5N0l0w+8wNeUqCP0SZKFk4lNN+IUeDa28pj KUVoREzkMHad7reegxHZcl4nQVhg/Tb2YmF7kYNOdmg6PppDg/VyeZ4hcCG6GeaVnZx2 LZ8nOc/fXnbxfDK1kxTVnef1XXFyU2nd1CQFhdao0CBvzTVyKpx0K6ErXfh/Js8Jrzq+ 0C44p7phCvskaWM+7VOo9JljK9t4tnxEXiWZ1B+lpF/9YPh6+W2NwnfwZXw+C2QI1SFQ Z6Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699346300; x=1699951100; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y6dvthR2+uXXaKtZhfu19I8uRaF5Ucp/hKjGsFNZse0=; b=cBKMdk/ga3x2dKHlulTTpYWAlJgrKYrgBTFBU9MBo5zxNxPReU0qL0Ze8IcN9dgS8p YjN3wEujtG8fdeRMliZI7ne6IJ48rEvc4bcaonIq4sm7q0f19BxvABSyT0QqFfV6NGzK CrFKN1t4/hEd5oIJaaZIv2TzV6V8vZCFogMR7hwdMwZGWqvb6adiA4gTzOd2WjgmIr7/ fzE8rMt27omf21hZgiiCcYKo9acTchiz9TgS+d3CiRbS4MsnyW0e9/uMsGCoHxDTq9XB WPfMLMP3C+FwiTeZ6LENGTWKK6nS+ccJIET+Dc9XhzB+VD/oJkbrKr30hhYeBSYYi3DT GWLQ== X-Gm-Message-State: AOJu0YyTfM9kDRv9UbJ2htdm6CshGjgfPS9ABRGh4+4tA1w4GoN8yfPS 9u7YOucfmT20ugna/vFEHGA= X-Received: by 2002:a05:6402:28b3:b0:540:118:e8f with SMTP id eg51-20020a05640228b300b0054001180e8fmr25487702edb.24.1699346299233; Tue, 07 Nov 2023 00:38:19 -0800 (PST) Received: from smtpclient.apple ([132.69.236.77]) by smtp.gmail.com with ESMTPSA id r15-20020aa7cfcf000000b0053e469f6505sm5095738edy.26.2023.11.07.00.38.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2023 00:38:17 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.200.91.1.1\)) Subject: Re: [PATCH v6 0/4] riscv: tlb flush improvements From: Nadav Amit In-Reply-To: Date: Tue, 7 Nov 2023 10:38:01 +0200 Cc: Alexandre Ghiti , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Mayuresh Chitale , Vincent Chen , Paul Walmsley , Albert Ou , linux-arch@vger.kernel.org, linux-mm , linux-riscv@lists.infradead.org, Linux Kernel Mailing List , Samuel Holland , Lad Prabhakar Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Palmer Dabbelt X-Mailer: Apple Mail (2.3774.200.91.1.1) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 07 Nov 2023 00:38:28 -0800 (PST) > On Nov 7, 2023, at 9:00=E2=80=AFAM, Palmer Dabbelt = wrote: >=20 > On Mon, 30 Oct 2023 07:01:48 PDT (-0700), nadav.amit@gmail.com wrote: >>=20 >>> On Oct 30, 2023, at 3:30 PM, Alexandre Ghiti = wrote: >>> + on_each_cpu_mask(cmask, >>> + __ipi_flush_tlb_range_asid, >>> + &ftd, 1); >>=20 >> Unrelated, but having fed >=20 > Do you mean `ftd`? >=20 > If so I'm not all that convinced that's a problem: sure it's 4x`long`, = so we pass it on the stack instead of registers, but otherwise we'd need = another `on_each_cpu_mask()` callback to shim stuff through via = registers. I have no idea why you need to move stuff through the registers. >> Actually, it is best not to put it on the stack, if possible to = reduce >> cache traffic. >=20 > Sorry if I'm just missing something, but I'm not convinced this is a = measurable performance problem. I am not going to try to convince you (I ran the numbers on x86 a long time ago). There is a cost of bouncing cache-lines (because multiple cores access the stack), TLB-miss on remote cores (which is mostly avoidable if ftd is global). Having said that, the optimizations you added now and intend to add in the next steps are definitely more important for performance.