Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp925820imm; Wed, 26 Sep 2018 08:54:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60oCw9ezAwBi5fXXttM/vrIEpaCYLR3L1qjwOQkIv7QsN/ifTGUcXeerRhqqfTRUdg+tJlN X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr6706449plh.137.1537977242268; Wed, 26 Sep 2018 08:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537977242; cv=none; d=google.com; s=arc-20160816; b=fW3HRcDFmG7zFLN6MSE8EIB44suRMdVWP1D6xWHd19Zvs06rq6b6TLVvloar3gP47r 50SeciH0UIWc3qpgE032XhsdyrB/cG6gfUt7oYzJ6E0jZKP7Z4Dr5Np7nblOEdrumyVE FxrUr21LcRGh7C0XJ9d22XEAdGs6mBnU8+z9EDxszAsJ31PGi7kguU86UeokOSC8/4B5 LCDwX2U2dg4Zb8mgEY9qwgka1IkrUZPzh3A4L9QPCib8F1eXH992417z2wSdB49Yt10E tvH6VBsTfHreXydyeWXPZxPjUcxfFdIOgEMZjFR0yK2Fp7wUrKGVH6ZtAXBCtSqAwdfX GIvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=REapFClVPQCwjpagOgyUYYFTxI55F/Af604Uqd61+3w=; b=oqaD8cq9oYz0k6EapJJ3nH7DkeYFMQLmOcWIMGix4Lbx41qCsvCkLsnSEPkCThDJIy mO77OQN5dqjEZyOKbbmgA835WYWzvxiJOuZdgT9rlREntDQ88HvYu9DQlpcLLkgh14pu rD9w7OsfZGNdO5juH2baeynmzjYHOr06ncmJoArROwl3CfKNL4S+GCbCTxI83agI2rQ/ 32ziGFAV7QucYXkGAZp2eO/5G9u03PggADn8mj7XZIHxMGXhOhvtsavaBLVhFNSb9tM2 ebXxL0npktb3Ls9kxgbWUL59l2Zcza+aclPW6Wi4z8nVR5UCBBfGiwMTL2dpgdu01kXB UIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=btVsgQGr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10-v6si2678067plt.212.2018.09.26.08.53.46; Wed, 26 Sep 2018 08:54:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org header.s=google header.b=btVsgQGr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728251AbeIZWFf (ORCPT + 99 others); Wed, 26 Sep 2018 18:05:35 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:35724 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbeIZWFe (ORCPT ); Wed, 26 Sep 2018 18:05:34 -0400 Received: by mail-io1-f65.google.com with SMTP id w11-v6so23707569iob.2 for ; Wed, 26 Sep 2018 08:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=REapFClVPQCwjpagOgyUYYFTxI55F/Af604Uqd61+3w=; b=btVsgQGrF8TYVum4N/kmcCulxEFilggWw0m8IFrIiHeySt9JaMxbXmB5QkgYBEbTq1 W4WLsvXcVrOn4YBauIKr2zxUNUXUkEsbGzeCG/dXrTu2bUN/n18jPlPn6r5lj5wvDb9L DQXWYNyyiDbYUL9eI3FKebYxrzaXRTt3VeQtw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=REapFClVPQCwjpagOgyUYYFTxI55F/Af604Uqd61+3w=; b=Ccm7SVwdthFtIb2TJ1mYw9dPmNvY9ZohncXpy2x9v+Ukocg8t9j9wqXfSIOuVYFRfF vU8uxqkSnCqTKfsAH4agnhCTz5MtexwsHQlNqTwb5De9k1fZxgzgBU0fcqI/tgBtPvqt TrEpu1mCmjNxOryuYYC/OQ2XGmvTKoFi++EIqKIS8C/FzwSme0nBohV5qTXaR3G05/ck jAe6wi3vcjdnLh+oYn/d4VKpD83IGxH5ov/LlyO2IzQqxg3BVXTGj/uYubB5LJuMS1/u HEOmJWApqKbnY3VOtK+D9DI68Fp/jSN1g0f3jKfVWPy0k0d13C3rBV8E3/J7go/gdkva hZcg== X-Gm-Message-State: ABuFfojkjbGETkAIw8X8ePboyOQyiZl4WLrnR7M/EQN82eDbpWyn7EmO OLxkhCHKyX46Ly9OseHaAl8LzOWQqhtGkMlN9HNl8g== X-Received: by 2002:a6b:3787:: with SMTP id e129-v6mr5816710ioa.60.1537977119747; Wed, 26 Sep 2018 08:51:59 -0700 (PDT) MIME-Version: 1.0 References: <20180925145622.29959-1-Jason@zx2c4.com> <20180925145622.29959-8-Jason@zx2c4.com> In-Reply-To: From: Ard Biesheuvel Date: Wed, 26 Sep 2018 17:51:47 +0200 Message-ID: Subject: Re: [PATCH net-next v6 07/23] zinc: ChaCha20 ARM and ARM64 implementations To: "Jason A. Donenfeld" Cc: Herbert Xu , Thomas Gleixner , Linux Kernel Mailing List , "" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "David S. Miller" , Greg Kroah-Hartman , Samuel Neves , Andy Lutomirski , Jean-Philippe Aumasson , Russell King , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Sep 2018 at 17:50, Jason A. Donenfeld wrote: > > On Wed, Sep 26, 2018 at 5:45 PM Jason A. Donenfeld wrote: > > So what you have in mind is something like calling simd_relax() every > > 4096 bytes or so? > > That was actually pretty easy, putting together both of your suggestions: > > static inline bool chacha20_arch(struct chacha20_ctx *state, u8 *dst, > u8 *src, size_t len, > simd_context_t *simd_context) > { > while (len > PAGE_SIZE) { > chacha20_arch(state, dst, src, PAGE_SIZE, simd_context); > len -= PAGE_SIZE; > src += PAGE_SIZE; > dst += PAGE_SIZE; > simd_relax(simd_context); > } > if (IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && chacha20_use_neon && > len >= CHACHA20_BLOCK_SIZE * 3 && simd_use(simd_context)) > chacha20_neon(dst, src, len, state->key, state->counter); > else > chacha20_arm(dst, src, len, state->key, state->counter); > > state->counter[0] += (len + 63) / 64; > return true; > } Nice one :-) This works for me (but perhaps add a comment as well)