Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1005439rwl; Wed, 12 Apr 2023 07:07:57 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxUPLlImvxecc3RKyJZ4Iq0qhj1LDY7jXpTKp6vEVteqnJbVQTTsxDcqrvfCKkZuE5cHEr X-Received: by 2002:a17:906:c019:b0:947:630b:35f9 with SMTP id e25-20020a170906c01900b00947630b35f9mr13216004ejz.74.1681308477044; Wed, 12 Apr 2023 07:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681308477; cv=none; d=google.com; s=arc-20160816; b=GO7p6DT89ugTefPMCeN6TBPqQRMSpzY8jfneolACDJmPqprEaQEeBd7M5BX6+XVf0p VHMbtSTKi2jqiC/7imvstoEoN4iRJVCfe/zOrPPwrsFmtOuR+mud+fDTt7R9atFqBpkQ OHZi4Zjn7veC1n9xy2k/vCWTAakZrrQMJ6lerMnVxXmiauIKMKZCfGFLDPSyaA0PC5/g BqNo1H7QJCBQOjf6uIXAPziN4nCYCJpyYjGbll5GPazDWpGOKhMa8bknQ6+1QbWJ+jNR Ap8RMTQWtmhKy0k0uRgqcC7ZbhtQAPfKukgleT1Iq6PAVZz5/xUnxxrnEIp2Q5U91eTh QHog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=OUhSLziqBRkxC1Eq4Nd5iJ8Zf9c7eJZm5Yq0tcJa5tY=; b=p1RnkAvNkjD3nRO1gwwc19Q1IZhMbo/KaHH/92rze/saG4SUD8aef8epODpJz8LpVY xNH3fdkQxJt9WXVGI9s5vZyzMhyV+3sDVnW+cnFChG5qOi8+IXKoRxgHQXdu1R2lv9qg cNovZvRIFecXy5001WRquNguG6tCXmIqopOrHRvPJ8BCumulWJuJnAGdwQa9W7/2+aMR GnxTJ4bL+KQGEqMMYkSAV71+p5tFxj/9Ru1LagK7cSgi7lv/BnEMSBBd7douSbQ+YUsT Zulv+P+YyQi5kqjg6OppNL5DWNCIFW3i3YwZGuvZ5HLD+ynYALnt5FM4dUcpJIXLBkpt y/QA== ARC-Authentication-Results: i=1; mx.google.com; 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 wy10-20020a170906fe0a00b0093b854a4922si7585228ejb.486.2023.04.12.07.07.28; Wed, 12 Apr 2023 07:07:57 -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; 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 S229490AbjDLN55 (ORCPT + 99 others); Wed, 12 Apr 2023 09:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjDLN54 (ORCPT ); Wed, 12 Apr 2023 09:57:56 -0400 X-Greylist: delayed 440 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 12 Apr 2023 06:57:55 PDT Received: from utopia.booyaka.com (utopia.booyaka.com [74.50.51.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C68173A for ; Wed, 12 Apr 2023 06:57:55 -0700 (PDT) Received: (qmail 18260 invoked by uid 526); 12 Apr 2023 13:50:32 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 12 Apr 2023 13:50:32 -0000 Date: Wed, 12 Apr 2023 13:50:32 +0000 (UTC) From: Paul Walmsley To: Evan Green cc: Palmer Dabbelt , heiko@sntech.de, linux-doc@vger.kernel.org, Andrew Bresticker , Atish Patra , Conor Dooley , Celeste Liu , Jisheng Zhang , linux-riscv@lists.infradead.org, Jonathan Corbet , Andrew Jones , Albert Ou , Ley Foon Tan , vineetg@rivosinc.com, Philipp Tomsich , Paul Walmsley , Heiko Stuebner , slewis@rivosinc.com, Samuel Holland , linux-kernel@vger.kernel.org, Conor Dooley , Palmer Dabbelt , Guo Ren Subject: Re: [PATCH v6 4/6] RISC-V: hwprobe: Support probing of misaligned access performance In-Reply-To: <20230407231103.2622178-5-evan@rivosinc.com> Message-ID: References: <20230407231103.2622178-1-evan@rivosinc.com> <20230407231103.2622178-5-evan@rivosinc.com> User-Agent: Alpine 2.21.999 (DEB 260 2018-02-26) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED 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 Fri, 7 Apr 2023, Evan Green wrote: > This allows userspace to select various routines to use based on the > performance of misaligned access on the target hardware. > > Rather than adding DT bindings, this change taps into the alternatives > mechanism used to probe CPU errata. Add a new function pointer alongside > the vendor-specific errata_patch_func() that probes for desirable errata > (otherwise known as "features"). Unlike the errata_patch_func(), this > function is called on each CPU as it comes up, so it can save > feature information per-CPU. > > The T-head C906 has fast unaligned access, both as defined by GCC [1], > and in performing a basic benchmark, which determined that byte copies > are >50% slower than a misaligned word copy of the same data size (source > for this test at [2]): > > bytecopy size f000 count 50000 offset 0 took 31664899 us > wordcopy size f000 count 50000 offset 0 took 5180919 us > wordcopy size f000 count 50000 offset 1 took 13416949 us > > [1] https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv.cc#L353 > [2] https://pastebin.com/EPXvDHSW > > Co-developed-by: Palmer Dabbelt > Signed-off-by: Palmer Dabbelt > Signed-off-by: Evan Green > Reviewed-by: Heiko Stuebner > Tested-by: Heiko Stuebner Reviewed-by: Paul Walmsley - Paul