Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1010308ybp; Fri, 4 Oct 2019 08:17:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzga5lYjtSyxsyLKgpnyyfTX4tUt7V/0cyHsmkHrbi0I2YTdYG/rwmlRZsal61ruXiENXXi X-Received: by 2002:a50:ab49:: with SMTP id t9mr15636102edc.301.1570202240493; Fri, 04 Oct 2019 08:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570202240; cv=none; d=google.com; s=arc-20160816; b=MOPKvH7LZ0OtMX6gJ9bqLF2V5vSGiFQ8aqSQJfQZMD3TvBJasVNir6QS0TTTXMGaz1 StIaANpgaNedGlJy0EEbeQxO+P64saJxo1dxUSQdljbTq7McTcC0Ra/AtkEeJMGZPPRA yMNy979FvcM/YMrtSD1KNJ4VTSp7vv4lb/hB+isqrq5Cq93V8w/IS8CL/rCGhTlgfVmC aKujSwbrHdtgz0o0djbe6flaykiwXB1hh+39VCVFbxLM6utOYmxi0bxfwK3+NlI53C0c pM4wROBtSirQ0mVPw8q8ljP6UtcKONO0NYh1fZmbOl30fGUnQ/XR/be0s4/1XgtALWoB tNdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-disposition:mime-version:user-agent:in-reply-to:references :subject:cc:to:from:message-id:date:dkim-signature:dkim-filter; bh=jsst+PI2pMp+1JvEIFpsF7jonkZjytFXzl3OPPTnof0=; b=kfeSEJ6UPhFY/U8RCeeUqCuu0qyQaDegzAHKYTHQvMkr1M8MWPqZGoTVjQCuZltl5S EIzM5FkE2osDMy5CHNQWMwUspiEdcIJO43lj7NAN8MwICbJhBsTFhqp5S2pXrtxJnk8r giWfljd3od8+yBHlXsgGMn1j+ip7KM99CLD+hMp/Ifeu+P6RoQXebXj8MFsKZt6lImkX cuB7PGykAncaw3W2leLlg2Ada+wzpMHGbzuuIeKOk7FXE1wbwI6hRGqXM8GmQG/+TE/D JXEVApG/08il1MEMB+cvMfnZ34STTisu9Vat0cQ+mXyz36ahvpzl3mAoH8VQEKUgADCJ 1A4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vdorst.com header.s=default header.b=lcxwTBTP; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=vdorst.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si4131791edi.442.2019.10.04.08.16.51; Fri, 04 Oct 2019 08:17:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@vdorst.com header.s=default header.b=lcxwTBTP; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=vdorst.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389554AbfJDPP1 (ORCPT + 99 others); Fri, 4 Oct 2019 11:15:27 -0400 Received: from mx.0dd.nl ([5.2.79.48]:46496 "EHLO mx.0dd.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388802AbfJDPP1 (ORCPT ); Fri, 4 Oct 2019 11:15:27 -0400 Received: from mail.vdorst.com (mail.vdorst.com [IPv6:fd01::250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.0dd.nl (Postfix) with ESMTPS id E3C665FB12; Fri, 4 Oct 2019 17:15:24 +0200 (CEST) Authentication-Results: mx.0dd.nl; dkim=pass (2048-bit key; secure) header.d=vdorst.com header.i=@vdorst.com header.b="lcxwTBTP"; dkim-atps=neutral Received: from www (www.vdorst.com [192.168.2.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.vdorst.com (Postfix) with ESMTPSA id 9C6A73878C; Fri, 4 Oct 2019 17:15:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.vdorst.com 9C6A73878C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vdorst.com; s=default; t=1570202124; bh=jsst+PI2pMp+1JvEIFpsF7jonkZjytFXzl3OPPTnof0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lcxwTBTPUbVwFvro3HJGj+olfvfFTLi8T++OpqJ92V8lE/AdoIoAvEWyRNlzk3LEn e7Bqy05FWIO+Vyfd1FkrreD/Ia+vj7UexaKoU1yv6k2TNAdWaeTREf8D3pvdp++2O1 OLHFgaEgSdxa7zqs177xm1KApwcqfZHEbtU6Y+VJPZcc5WAuO7uqHZHYsLc/S8BC5Z wwLky+/gaRdes8U5ZhvPL931PBWfzmY4fHvGekZgDgSD0wDSWlao+vbLPqlB0NyKGl zK9PheCclMue1aFiktD8dZX7mbfNd8q2tn1L5EXhQjMdJacyHASvSbVn9TWDGQ84oa i+tCKQhkRrN1w== Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by www.vdorst.com (Horde Framework) with HTTPS; Fri, 04 Oct 2019 15:15:24 +0000 Date: Fri, 04 Oct 2019 15:15:24 +0000 Message-ID: <20191004151524.Horde.zXUzQP5eBQt7Ybx5I75Ig5X@www.vdorst.com> From: =?utf-8?b?UmVuw6k=?= van Dorst To: "Jason A. Donenfeld" Cc: Ard Biesheuvel , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Herbert Xu , David Miller , Greg KH , Linus Torvalds , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Will Deacon , Marc Zyngier , Catalin Marinas , Martin Willi , Peter Zijlstra , Josh Poimboeuf Subject: Re: [PATCH v2 05/20] crypto: mips/chacha - import accelerated 32r2 code from Zinc References: <20191002141713.31189-1-ard.biesheuvel@linaro.org> <20191002141713.31189-6-ard.biesheuvel@linaro.org> <20191004134644.GE112631@zx2c4.com> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Jason, Quoting "Jason A. Donenfeld" : > On Fri, Oct 4, 2019 at 4:44 PM Ard Biesheuvel > wrote: >> The round count is passed via the fifth function parameter, so it is >> already on the stack. Reloading it for every block doesn't sound like >> a huge deal to me. > > Please benchmark it to indicate that, if it really isn't a big deal. I > recall finding that memory accesses on common mips32r2 commodity > router hardware was extremely inefficient. The whole thing is designed > to minimize memory accesses, which are the primary bottleneck on that > platform. I also think it isn't a big deal, but I shall benchmark it this weekend. If I am correct a memory write will first put in cache. So if you read it again and it is in cache it is very fast. 1 or 2 clockcycles. Also the value isn't used directly after it is read. So cpu don't have to stall on this read. Greats, René > > Seems like this thing might be best deferred for after this all lands. > IOW, let's get this in with the 20 round original now, and later you > can submit a change for the 12 round and René and I can spend time > dusting off our test rigs and seeing which strategy works best. I very > nearly tossed out a bunch of old router hardware last night when > cleaning up. Glad I saved it!