From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B93C2D0E2 for ; Tue, 22 Sep 2020 10:32:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1CCCE208A9 for ; Tue, 22 Sep 2020 10:32:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PrJqv4yN"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="BbaUIqdy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CCCE208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BliIvoP3pzr/37/5+ASP0ouM3DHMXAHzAbIikuUKxIY=; b=PrJqv4yNsLnyJD6cf/yyAubgt 3hOQf/7wy7+1KDxfRz4vKzF47IEROmzLJ8AKwsLX0i/6dR5TOPpAKyUMPvXBnzGMuUYb8/V8n1NLE VU/zHfNAEeSmJxntsm1W4UArN015qKIRj149LFEAp1Y9zMSCK5zLGCHHaDtiZ3Bf/qUgh68PpFG4g GctWYmgOiDa9F426Y/DZLkSBBH68tHVn15P8+PeP06vdpftU1AMMH8uJGByLEVbXK0shCranHfmS0 hFlBxJAKlonWGlfpJH/MLOIayTwQxtR8CFab0HIpwt3zzuENPw6nIBRJvZUT6tckh9edhrBlH68dN epnq56Pxw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfZa-00045e-DT; Tue, 22 Sep 2020 10:30:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKfZY-00045D-Hn for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 10:30:57 +0000 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D3832399A for ; Tue, 22 Sep 2020 10:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600770654; bh=2ac03d4BXzs1X3AYPJCuz5ExNkZUTf6oOD/aA3BHgH4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BbaUIqdy9UvDS/fEa0atMg7wfx0Af65EH5xLBe6kUCygWHGXGKp/iSmmVZ+dZW5lQ gGlghh17C4ugcD8oXkZPreLZBcNjeDSkEHGCJlciiKJisb+AgPA6J8SoxqFhs6EHGm u6cNFIYLgaiVzswuEuJryNcBopVEX37B/DRXVtlE= Received: by mail-oi1-f174.google.com with SMTP id v20so20498994oiv.3 for ; Tue, 22 Sep 2020 03:30:54 -0700 (PDT) X-Gm-Message-State: AOAM530K8bhMA5nsniITFy+2R2tRpXbRtAJsDgsv2hioI+2L4Lqdag67 pgkHdKHr9MlKqoDyaf3IM3UelybfpxkIgCLThGQ= X-Google-Smtp-Source: ABdhPJy5koXapG5/lzMLd71HJP/MZCjH9OUE7reHhjnCIvIH5UqvfIF7ed9zY0zap7q+aeXU/4hQ1CY2G++93kHEr1o= X-Received: by 2002:aca:d845:: with SMTP id p66mr2048119oig.47.1600770653616; Tue, 22 Sep 2020 03:30:53 -0700 (PDT) MIME-Version: 1.0 References: <20200921172603.1.Id9450c1d3deef17718bd5368580a3c44895209ee@changeid> In-Reply-To: From: Ard Biesheuvel Date: Tue, 22 Sep 2020 12:30:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arm64: crypto: Add an option to assume NEON XOR is the fastest To: David Laight X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_063056_689546_DEDD62A8 X-CRM114-Status: GOOD ( 21.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , Catalin Marinas , Jackie Liu , Douglas Anderson , "linux-kernel@vger.kernel.org" , Will Deacon , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 22 Sep 2020 at 10:26, David Laight wrote: > > From: Douglas Anderson > > Sent: 22 September 2020 01:26 > > > > On every boot time we see messages like this: > > > > [ 0.025360] calling calibrate_xor_blocks+0x0/0x134 @ 1 > > [ 0.025363] xor: measuring software checksum speed > > [ 0.035351] 8regs : 3952.000 MB/sec > > [ 0.045384] 32regs : 4860.000 MB/sec > > [ 0.055418] arm64_neon: 5900.000 MB/sec > > [ 0.055423] xor: using function: arm64_neon (5900.000 MB/sec) > > [ 0.055433] initcall calibrate_xor_blocks+0x0/0x134 returned 0 after 29296 usecs > > > > As you can see, we spend 30 ms on every boot re-confirming that, yet > > again, the arm64_neon implementation is the fastest way to do XOR. > > ...and the above is on a system with HZ=1000. Due to the way the > > testing happens, if we have HZ defined to something slower it'll take > > much longer. HZ=100 means we spend 300 ms on every boot re-confirming > > a fact that will be the same for every bootup. > > Can't the code use a TSC (or similar high-res counter) to > see how long it takes to process a short 'hot cache' block? > That wouldn't take long at all. > This is generic code that runs from an core_initcall() so I am not sure we can easily implement this in a portable way. Doug: would it help if we deferred this until late_initcall()? We could take an arbitrary pick from the list at core_initcall() time to serve early users, and update to the fastest one at a later time. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel