Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2447788rdb; Thu, 21 Sep 2023 21:07:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpoVi0IxzSrwl5SNG8o3tVIYTrDdxLKL2GS1rekQxAZSM+O3borrB6JrHxbAwkkhXKncuB X-Received: by 2002:a9d:7507:0:b0:6b9:dc90:8a85 with SMTP id r7-20020a9d7507000000b006b9dc908a85mr7450106otk.24.1695355652964; Thu, 21 Sep 2023 21:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695355652; cv=none; d=google.com; s=arc-20160816; b=z7Y1Ej8Poh5XKf1rSitMfCf3uAot5o6Jis0u5rhM1dFIo+ycqrbFjpjT3ZMmN69jZb TFVNqY7zymOSETGzZRXVh1ZDk2vBjZRncHcnrq+snGcIJD89crr7MzFBRTBXXouShWY+ rpru5Isx/yQmnlXulcVp2KicT5m4OnT5l6jw1FPn+jOCeOW3mKbXQVPG9aEEYsuO8NVs ckGHwUHV34jCdOizFKbslcwdMKNuR7oG2XprtKn6ljKpLAe86GnocLD5nE3YMGC9Futi J7JQWM5PqjG+7ali2BrtFu+T3+56knLNIo15EPANc1wP6LANZbuVkFBk+/bFYta4ZFOF loJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dFcwkCsyNvb3+F2dBflUU/e2F/txYXL9uZkq7j4g1FI=; fh=qQFJ8fTcJaSbnscfPbGGzrcpGG07SO6kxzIV+PocoSE=; b=g/B6r6IymewSJfyKMWiq0fJmRDj72wFnL3te9D6KerpUZNG7E9VCE34EoGEJ6x4m5x Nuyj/2IK3xsPwHgICyoXkcrWpsKX1Wn+AWqFY953ZOVriCpEixMuTy6sk2iOmlkPYPHv 2mztlLdZn2MRFUrzJOSOQCXH7JaWufPc4EPiJjm4SQTZtLtnX0FZN9rPGTr/oVLAKtuN NEoJMUhIM8NkAQUZifP5DRkqWgrp8MtR0GCxz1J1sPShC1EhZGoTaFyCviEotYAoTM3D 7A5jgx0qvSS8o2cWKqGsfvVsg1NXAkQs86wciXpWtKhsPDK+n+gRbem/PHm2rQ9txWBH e+NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=wdF2OsQp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h14-20020a056a001a4e00b0069018a768cesi3030358pfv.405.2023.09.21.21.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 21:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=wdF2OsQp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A679080DB375; Thu, 21 Sep 2023 13:21:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbjIUUVT (ORCPT + 99 others); Thu, 21 Sep 2023 16:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbjIUUUv (ORCPT ); Thu, 21 Sep 2023 16:20:51 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C89E34F933 for ; Thu, 21 Sep 2023 10:15:18 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c008042211so20400621fa.2 for ; Thu, 21 Sep 2023 10:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695316516; x=1695921316; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dFcwkCsyNvb3+F2dBflUU/e2F/txYXL9uZkq7j4g1FI=; b=wdF2OsQpDO8CaaI+CjYLhKaPJgdE+ZAkmkgRCfRpUi3L/+/AHl16BBz9sOb72x91DW W8Yj2YDh9dacDQWDFTZTNHcCJZt9/CkgqH5/5+pfBdEWgtZ48mZO4rKpVsTbKG9NAGCX lNdr+ve1E1ZMvVIW1UW+z8GU6ZV+ru+o3YSJFq7s0/+LylyhWMaQwRl4+MS/ZS4bTIUj bL3LFWHWMctNbWIv+ML6irjYGOU3QFzcNC+yOov6HxygK73SCEeJZyFqybiR/cPy8uWZ PW6crdhOV1m/jgPRTsjebimVWy/0m/f1GyOj+qLbvFSYhmmfz9HMiouL6Q7rUERg1IjW Gyhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695316516; x=1695921316; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dFcwkCsyNvb3+F2dBflUU/e2F/txYXL9uZkq7j4g1FI=; b=pSMlcVJs8IIAwDxpC89FcdVDohP/RLsJXmOTZDRdo8pFQecCeYuLVZpA0w0X7eQDTT uSWvo0TXQPCOpQwpeXkXoXuCQO3uJFKTu429W5DkDIZrJ90MTVJ/OkaEzs32+m4U6jEH Qlj9DvcyIbdJuvrNd3kB9eg5VjzZwjBFxfi9ewl+HLmLHiMto0mpMDHnB23avKFzG57T 0elR28jAeoGfrafAqWZ0tjQ1ObBCI2vTDPGVS3eHGJTtuwfkuRNUmcXOhOCusj18dMk5 cFle9MDPPMLPUu/GtS+84wu1NIkzYAS13N3x+RphiNZE4+kgPafrbmIO+5fpjsTbEFWR Rf0Q== X-Gm-Message-State: AOJu0YxI4lgsdhcjlO+BiuvWsbZcIjnvlxsjKVgeHT7gRaOI3pLpqn1h uNsOmsJOS0GRaQpdLR1QK02zUkGr0ZE57KC2cX5nK2NUMcKhNlpx X-Received: by 2002:a2e:3306:0:b0:2bc:dfab:5dc8 with SMTP id d6-20020a2e3306000000b002bcdfab5dc8mr4897815ljc.37.1695314735888; Thu, 21 Sep 2023 09:45:35 -0700 (PDT) MIME-Version: 1.0 References: <20230920193801.3035093-1-evan@rivosinc.com> <20230920-98a392b40f88c69e852e2c88@fedora> In-Reply-To: From: Evan Green Date: Thu, 21 Sep 2023 09:44:59 -0700 Message-ID: Subject: Re: [PATCH v2] RISC-V: Probe misaligned access speed in parallel To: David Laight Cc: Atish Patra , Conor Dooley , Anup Patel , Albert Ou , Heiko Stuebner , Marc Zyngier , "linux-kernel@vger.kernel.org" , Palmer Dabbelt , Conor Dooley , Palmer Dabbelt , Jisheng Zhang , Paul Walmsley , Greentime Hu , "linux-riscv@lists.infradead.org" , Andrew Jones Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 13:21:23 -0700 (PDT) On Thu, Sep 21, 2023 at 3:22=E2=80=AFAM David Laight wrote: > > ... > > > For probing alignment speed, you just care about running it on that > > > cpu. Correct ? > > > > For this we care both about not migrating to other CPUs, and also > > secondarily minimizing disturbances while the test is being run. > > Usually I equate pre-emption with migration, but in this case I think > > the worker threads are bound to that CPU. So I'll keep the > > preempt_disable/enable where it is, since it's harmless for CPUs other > > than 0, but useful for 0. I also like it for readability as it > > highlights the critical section (as a reader, "is preemption disabled" > > would be one of my first questions when studying this). > > You need to disable pre-emption to get any kind of meaningful answer. > > But why do you need to run the test on more than the boot cpu? > If you've a heterogenous mix of cpu any code that looks at the answer > is going to behave incorrectly unless it has also disabled pre-emption > or is bound to a cpu. I don't think it's safe to assume misaligned access speed is the same across all cores. In a big.little combination I can easily imagine the big cores having fast misaligned access and the slow cores not having it (though hopefully the slow cores don't kick it to firmware). Since this info is presented to usermode per-cpu, I'd like it to be correct. > > One obvious use of the result is to setup some static branches. > But that assumes all cpu are the same. Right, this could be used to set up static branches, or in an ifunc selector. This is why we provide pre-computed answers for "all CPUs" in hwprobe. If the situation I describe above did happen, code asking on behalf of all CPUs would come back "unknown", which is true (though would probably default to the byte-copy version). More specific environments might choose to curate their scheduling a bit more, and this info per-core would be useful there. -Evan