Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp923913imm; Wed, 26 Sep 2018 08:52:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60seS31EQNEn1wmI9YWIIxaDPBKTfd2rcbz++Mv57x8U5aqAvoTevTvF1ljA2kF/SgQEvjv X-Received: by 2002:a62:9894:: with SMTP id d20-v6mr6968177pfk.186.1537977122492; Wed, 26 Sep 2018 08:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537977122; cv=none; d=google.com; s=arc-20160816; b=Xiw6hOT9WVdIevRrqdJCLnu/DV7WFFAtO/IK+a69C7Yl8W2hhdqIZcML0FQ9+IhO5I Ink7xXB/+Tg6tTkF9XsGShvxk5gY5AMQeXPk9B6Zq7bgT5M7zchgv1YzXKjwLumvkTqT O2Ca/Aw5tbL3lHb2Tc6HugxFBX7sFq6tklJzEEvgi1mYKyDB+CrHqF5UTNyRxomihwC1 Et7P4Attl2tQZdm42MWa/Tt/phKm5iRvsEq47brbAEEkT6mjngo16E560GZIMlAJl7Tv 1AROwcEAjBP4SIWdjl5j1ygpCUXKUtRBJUSJRuqnsFp2zGjLiI/o0g0gzlsppCtwhdjK rkVw== 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=dRcaJq6WRBO1YwGq25NZOuIj3+V7f8pO1IITZ7DpHHs=; b=IGAanER7uK3dY1VlZO+BISTa5FMQwn6OSlZa6hiBOm2kXlMKSLKMXv4yM9/SWi5wUS 9NEg7v2ck3TWuTs3t96tC2qzaXtpoB5c/y/jpdEk1J16Ghrdq6ihrIqNpOCUfuFhS73i 9PcSXweJrYs0ZJXQRIOnxQstC1SXpxVxCQdUD2rVDzTi5GrED1NQbMj0+c9Se8+z9bVR ceUJDAUTBabwFgX8G2UBQHjyIXVwSIPm2ZDhgZgLFuAt8ytqzC/n40au6un1xmllDMD7 /xaQ7KYnGMrDX0JB31JYE4ovLP2YDS/FUjnDTzFCvC8J2Mlja5Y039ccWYKR8WMz4kq8 csjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=JJnAgbOY; 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=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21-v6si648906plq.242.2018.09.26.08.51.46; Wed, 26 Sep 2018 08:52: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=@zx2c4.com header.s=mail header.b=JJnAgbOY; 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=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728521AbeIZWDn (ORCPT + 99 others); Wed, 26 Sep 2018 18:03:43 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:35511 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727136AbeIZWDn (ORCPT ); Wed, 26 Sep 2018 18:03:43 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id fdcb482a; Wed, 26 Sep 2018 15:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=mime-version :references:in-reply-to:from:date:message-id:subject:to:cc :content-type; s=mail; bh=MkP6Pc8roKurV8NXLQ4pCZBYq+c=; b=JJnAgb OY1NLmB69TKed84sVqfFHS1ADE67KGd20IqiFTxPrWNUrKN7T/t+d2rTUwK7vCGo xzezRBL1+hcRqU4imupqVQChiUL0KWBaASeSZMxs3zc8ygi7wx/hea1wPJ7+MjT7 pZ0aXKnZST5mmYVEamrqDy1iLLCK8Fo33g+7Q+1fKEKfOCDZntijUzhOnotNS27q CZslmag/tPusmvGtZv0J1l48X/24hcjfsgndtZxMQw9hykhLdSFNmZes/YX6NAe5 KVz1JHge+whxyCYwYFVaRNlAHNn1UoMRG65OvKKjQgjCsfu4d9dpohFpGbL9v0Ew WlznDJ2QGK4aik9w== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 5b66f19a (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO); Wed, 26 Sep 2018 15:31:33 +0000 (UTC) Received: by mail-ot1-f48.google.com with SMTP id c13-v6so10880416otf.12; Wed, 26 Sep 2018 08:50:07 -0700 (PDT) X-Gm-Message-State: ABuFfoigqPsHXoFkyexMRDbgKxn5Hag+6hfeohdYib92r05SotC3CRUB PP282T09rH7HX5JyhEzdpNSTYZNRdTVRND9xHuY= X-Received: by 2002:a9d:522d:: with SMTP id e45-v6mr4395062oth.250.1537977006136; Wed, 26 Sep 2018 08:50:06 -0700 (PDT) MIME-Version: 1.0 References: <20180925145622.29959-1-Jason@zx2c4.com> <20180925145622.29959-8-Jason@zx2c4.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Wed, 26 Sep 2018 17:49:55 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next v6 07/23] zinc: ChaCha20 ARM and ARM64 implementations To: Ard Biesheuvel Cc: Herbert Xu , Thomas Gleixner , LKML , Netdev , Linux Crypto Mailing List , David Miller , Greg Kroah-Hartman , Samuel Neves , Andrew Lutomirski , Jean-Philippe Aumasson , Russell King - ARM Linux , linux-arm-kernel@lists.infradead.org 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, 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; }