Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2278284imm; Thu, 27 Sep 2018 10:07:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV61BnhHhgEM59VS3sKl8JkfjV+ZkNQIMQdJaVT6q5/CPHRytYmjyTQT7cIEF+I15t9o2Lo/8 X-Received: by 2002:a63:be4a:: with SMTP id g10-v6mr11304475pgo.378.1538068057512; Thu, 27 Sep 2018 10:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538068057; cv=none; d=google.com; s=arc-20160816; b=YQzoyTF68FkrrNZf3GPxrWtVkAipWfeIsc3zlWV1dF2sO1BK8hZrIoB/Su6OUchk11 7U51Qp/syEx37LkgBqViaGBa0mkf2XfFmqG0e26LJoqiNcrmUb1X13FWjZfLOg5nLiXz Vp6EAjCxkpYC7Za5Oh8olo5rCVZESXoutMbfWWMVm7hLEdCSgJFoaSvcVHGmKcCxkupt T9hCCMJre+rHA+5vTwtS1zFe2w5VPTBE8QPMqPXHabe6wmC/1tvuIauVOqIaJO0rtlMh w922LfoNbpkn90VyyOdztiNXqxszyqNJifRanvUyC33tigxPX1BAdOfSyQq51ctl3C85 YOjA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=co+WR8YTSJo4w0Ty92azVE8VtdfLTx+q0+0FpdWuQvM=; b=GEf3q0AZLYgn0yYRDsyv5Vl1cwVTdR3cRD/7uGXUHfUWXXx8FfRv8l9u56y8MWXAmV 2+jRKOW2dX+9ReiC8BYXO3FjYIV9HE9RkU9Z3Xm/bDTXJNdPNsnmtf07r9FyJX3Db33n wjU2OBcrmr0tJIwCAuwrjWOcks8fei/qnJdoFxvqKZxs5UBSR0qjpqk06UFSZhvssSEo xqDRes9HvIo81bzmA7jzs01tHMFdpg5EaeCazIF7yvoEH3QfiTU17ej13i53DNO7S8Ec LrL0a3G84HchGhSj8g6ax8Ua+3HgcT4JGgDDrjUHMgp775tqxYzR2Ia2+Muh3hPmuwLY pKAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=KFcoWr5z; 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 f8-v6si2848956pln.512.2018.09.27.10.07.21; Thu, 27 Sep 2018 10:07:37 -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=KFcoWr5z; 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 S1728567AbeI0X0T (ORCPT + 99 others); Thu, 27 Sep 2018 19:26:19 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:44257 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727335AbeI0X0T (ORCPT ); Thu, 27 Sep 2018 19:26:19 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id ebcf9317; Thu, 27 Sep 2018 16:48:22 +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:content-transfer-encoding; s=mail; bh=ShRe34BhklmL O1KHTDlei/vS7iU=; b=KFcoWr5z/Np+2GfXx+6XGkU21g/hNCabSLI1bEC+lU/2 2yU7NAkNZHlr6xKKRkt2GDSXvAWeWT+P3EBA8KGkODR6KlnkMD1sQpHWLxdDwyCt kMpYgJnd6Zd/PWxslxL6HlB9c4JmHOB136xDHe/FIfjVSI1z+OzrSmGZg4R6nNpt e095iX/Nd0aM9UYzPdVWLXYXguZJR48VSd3dtMws3iF0YxivDia94YfTWswTQJKO /f5tsucJZyc8JPAIxik5FQtJ0aXGe8OMT6Q132qZtl0VyVRg8HHiAal8B3BX2u4m 0uKStlv3pNL7YWNgZiCf9zW+8MM0wUrNOIcfIjOOfA== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d195dd04 (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO); Thu, 27 Sep 2018 16:48:22 +0000 (UTC) Received: by mail-oi1-f169.google.com with SMTP id j68-v6so2809332oib.7; Thu, 27 Sep 2018 10:07:03 -0700 (PDT) X-Gm-Message-State: ABuFfohyMuiJx7J2ARpCYIRyvMME83zr+pPtPv5E/QTuUYtHfqAWxE0C 1cRm9N4kzGHUfJSBWiAPI94p5TC+ezW2snlmkJc= X-Received: by 2002:aca:ce4c:: with SMTP id e73-v6mr3480575oig.225.1538068022255; Thu, 27 Sep 2018 10:07:02 -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: Thu, 27 Sep 2018 19:06:50 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next v6 07/23] zinc: ChaCha20 ARM and ARM64 implementations To: Andy Lutomirski Cc: Thomas Gleixner , Peter Zijlstra , Ard Biesheuvel , 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" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 6:27 PM Andy Lutomirski wrote= : > I would add another consideration: if you can get better latency with neg= ligible overhead (0.1%? 0.05%), then that might make sense too. For example= , it seems plausible that checking need_resched() every few blocks adds bas= ically no overhead, and the SIMD helpers could do this themselves or perhap= s only ever do a block at a time. > > need_resched() costs a cacheline access, but it=E2=80=99s usually a hot c= acheline, and the actual check is just whether a certain bit in memory is s= et. Yes you're right, I do plan to check quite often, rather than seldom, for this reason. I've been toying with the idea of instead processing 65k (maximum size of a UDP packet) at a time before checking need_resched(), but armed with the 20=C2=B5s figure, this isn't remotely possible on most hardware. So I'll stick with the original conservative plan of checking very often, and not making things different from the aspects worked out by the present crypto API in this regard.