Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2403465rdb; Thu, 21 Sep 2023 18:56:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrmy7CD1i3aC0onDSn2MzPSNWF8lSl4jw9oLgv4qmv7MfSsbxSOx4Q9/ows0MUb5NQY4tP X-Received: by 2002:a05:6808:256:b0:3ad:f86a:878e with SMTP id m22-20020a056808025600b003adf86a878emr5340267oie.13.1695347768760; Thu, 21 Sep 2023 18:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695347768; cv=none; d=google.com; s=arc-20160816; b=uNpO1JUM2kT/8coiOMRMIvhYAXRacQxiw9JCi7UAqLqe76sy/Msu9+7KzZjaExSqYI En6gcx5tvmP96lmMz7XijglIFptXSsYdfIUT1n2IDlkP6PVBvGSCeJlKLjfF0pcOQUDC Osq4JytCcPB5UYph9F0Su5lcf55IvP9I1/zxYXObp7TbCvRA1isAGgaugGymfTfbPp8D UfoBGS7OOxuI+6RVyoEjVonSVplWfq4vzswMOWUpwRdONfYRT1GqTMpjx2kHB6eRQvyT cfVn12/cPh2QOUZBlExWXb+ozV+6EJQZxJdBMtaZYKemlvqN9hL4dDivEdgNin46ZLHc G3LA== 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=I4XnljMvhHSvDOl2lNXQmHCmuwyYv06P2O8ypwL5cCw=; fh=qQFJ8fTcJaSbnscfPbGGzrcpGG07SO6kxzIV+PocoSE=; b=f3kijodbJJYd+Cwk1KKy+s4mDzKZXX0cl8nf554o8hKu+l8Yy376YID6BBdBCqMomk fHQPYTdWOX9wD6Yxmpf+dVNOazpo3AkSwh5JIquZiVWU2n5DoTvfoBogdC9OYye1nRHc CHowaBALK9JRtzhIF2iUbMhpPBIYm3gB9upY+MSlz8yu660dYcqHrHFQUopoAlVt0siz DrZOXMgi03+ZNbwmCf9Ex6IXsdWnfxb6zM5F6G7jY3ZdJ6bRKqrmDDxxTUOFbWEjIctI eU9lCpNsgseeu1HROskkIbU+uAKsQbbVKt8kYyLUnPSmN7P2ctb5p4o17SaTgemEyKfe riNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=LUZzA1an; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id k124-20020a636f82000000b0056b0b30d05csi2527694pgc.245.2023.09.21.18.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 18:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=LUZzA1an; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 9612880BEF3B; Thu, 21 Sep 2023 10:01:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbjIURAa (ORCPT + 99 others); Thu, 21 Sep 2023 13:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjIURAZ (ORCPT ); Thu, 21 Sep 2023 13:00:25 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C4C1724 for ; Thu, 21 Sep 2023 09:57:55 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c131ddfeb8so11144151fa.3 for ; Thu, 21 Sep 2023 09:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695315467; x=1695920267; 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=I4XnljMvhHSvDOl2lNXQmHCmuwyYv06P2O8ypwL5cCw=; b=LUZzA1an5zfwE6Ay164zBrHEB+IeK/jXit7eCnO2HJdZ2F9Idm9QbmV731+nIStTxg qWPoVLXS/r61MsvJXDHJkdgEWhhq2vSk9homV+wd4LtbEQfDHNDKOfWurSUTSAf6Q4Cf SioAr0LFOBZQiwdawUNrUBa6dmUuywe6yqr1iROrMdcCLUD7JAFPTWqtOc3OYxqV4FMo 0nMHnzywTUHmswVPAOMf+Or7ByC9T5NYW6nbP6yQ4CMCiCW2bNVxumMKrrtep83U+V1r vPOdKQLXJEPFUFkM7hUEpfDdc2sgjmmQ30FXD3nTyf85z+BVp2oMPKU6dllvo1u/PUKp tcCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695315467; x=1695920267; 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=I4XnljMvhHSvDOl2lNXQmHCmuwyYv06P2O8ypwL5cCw=; b=ENmCSGGyR14BPvwYzuyTgYieGjrZCS9hQW2O+ML+1gd4xdgE7L/zKlhbJImN26hB93 3fIdC1Iyd8obyqsbbXyhgeDyIQluGd9+GaUI6+WlK/KdTKic5OwRXmWK3o7xyCrIfJGx ONYYPwMGSDS6lEToC78ALfQ1BnFx4EKQ03O3pQbRNH+aIIU+nWaqy8wvj4cpah/oPi29 UL21yWTTPShw7FRkYEvn7LnrMT8dDaDtREXgALRIwzTKXjMgvzvLeJmtmGf/P1p3T9Ky Nqnd3E1lAm+O9k4pcTNo+HQlKBRFOnB4rtC1yzRflK8HZbSzdP0UKG9EneW+5k8ohd99 N1gg== X-Gm-Message-State: AOJu0YwBDj1xakAJhomFOKS6Bx4QzAAncdBkDL5RJdy3sd9H1x7y+aAl 0CRPtzbAaDS1wRDtveoS7pEwEgmZFz2pf2rEiULvkOUMJLpft1Sa X-Received: by 2002:a05:651c:90:b0:2bc:e882:f717 with SMTP id 16-20020a05651c009000b002bce882f717mr5133603ljq.53.1695314978101; Thu, 21 Sep 2023 09:49:38 -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:49:02 -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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 10:01:52 -0700 (PDT) On Thu, Sep 21, 2023 at 9:44=E2=80=AFAM Evan Green wrot= e: > > 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 othe= r > > > 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 Correction: Not exactly precomputed answers, but cached vDSO data capable of quickly answering usermode queries for systems with homogeneous CPUs.