Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5741092ybp; Tue, 15 Oct 2019 04:27:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXal8VQBRlJk+9MGi9EH6E0HIBrgqWsFONZ/d7mhoHfW7KPaG8e1Cj4qcSyQJytxT6sYkK X-Received: by 2002:a17:906:d971:: with SMTP id rp17mr34390980ejb.42.1571138853434; Tue, 15 Oct 2019 04:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571138853; cv=none; d=google.com; s=arc-20160816; b=fIbLMZM6HCK5DkvzLVJNxDt1uzXRGu6wDNRl75RazJtePD6YaF9LD+P2waTge7YcU+ obScK1V6LfYGZnLuw3YK6MF2eh1XmvHnz4Dl/qeoaCA9lLDKI6IWKfhpbZv5bL1ECwiY fTtZyhr38TvAKBE9R6ka9UckI2FLQOFjR3LePqdlA94veJn9rfRWqsomu4fQgXNhphSl nIKBEMc73ng2DUFsT8tXfC/9ijdo6iFUTvi1aHW5fSsbsLBQtqjEP4vWi1RAoDSMVDzV jC5QgKCTF/BF7BICAgJBAEfFBGcJXXxFZeXvykkQJw5/2UM6RnlkkouYLIv7KjsuY7Pm CNJw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=Zct9869IwD1dL7Fiq3UKBEov1SEMRvymeSAQslvVfsE=; b=KTlnMiMmhBIejnmb2z+PeVzRIvE/Ar42JaQYAIigHdIruBNnMz11pZZYzCf8UW+md5 1ccfOHS7a0NkUPx6IliqjzyrWnI0QmUHdb/U85FTffHGtX2Dm/FpulqWR9aDJQJLqem7 jxByCnkQq7wM61Fpy1xTI0VVL5fcWiu7WC3llM/HK3e97d53Jgk+tn105uDOCgY7QhlB QVqsZBf/l4EoMB4GsqTNfQozqfEuSAWxrHZD8+IFh/wHk4/1xEaJnDHm2+B4dFj+YBn/ GR6hdqKv/tMPvBGfIHUFEgtOSm9s0NC2buECcH93sL0I42azTr+/pBEVCqVlBj6no1Fp pRgg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i33si14771608eda.205.2019.10.15.04.27.07; Tue, 15 Oct 2019 04:27:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730083AbfJOKIS (ORCPT + 99 others); Tue, 15 Oct 2019 06:08:18 -0400 Received: from sitav-80046.hsr.ch ([152.96.80.46]:50816 "EHLO mail.strongswan.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfJOKIR (ORCPT ); Tue, 15 Oct 2019 06:08:17 -0400 X-Greylist: delayed 446 seconds by postgrey-1.27 at vger.kernel.org; Tue, 15 Oct 2019 06:08:17 EDT Received: from book (unknown [IPv6:2a01:2a8:8100:2001:c78:a6a8:6f3f:a6b3]) by mail.strongswan.org (Postfix) with ESMTPSA id BE1994001D; Tue, 15 Oct 2019 12:00:49 +0200 (CEST) Message-ID: <8021f3ad396dead64fca36cef018c914f9a3a55d.camel@strongswan.org> Subject: Re: [PATCH v3 02/29] crypto: x86/chacha - depend on generic chacha library instead of crypto driver From: Martin Willi To: Ard Biesheuvel , linux-crypto@vger.kernel.org Cc: Herbert Xu , David Miller , "Jason A . Donenfeld" , Samuel Neves , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Rene van Dorst Date: Tue, 15 Oct 2019 12:00:49 +0200 In-Reply-To: <20191007164610.6881-3-ard.biesheuvel@linaro.org> References: <20191007164610.6881-1-ard.biesheuvel@linaro.org> <20191007164610.6881-3-ard.biesheuvel@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Ard, > Since turning the FPU on and off is cheap these days, simplify the > SIMD routine by dropping the per-page yield, which makes for a > cleaner switch to the library API as well. In my measurements that lazy FPU restore works as intended, and I could not identify any slowdown by this change. > +++ b/arch/x86/crypto/chacha_glue.c > @@ -127,32 +127,32 @@ static int chacha_simd_stream_xor [...] > > + do_simd = (walk->total > CHACHA_BLOCK_SIZE) && crypto_simd_usable(); Given that most users (including chacha20poly1305) likely involve multiple operations under the same (real) FPU save/restore cycle, those length checks both in chacha and in poly1305 hardly make sense anymore. Obviously under tcrypt we get better results when engaging SIMD for any length, but also for real users this seems beneficial. But of course we may defer that to a later optimization patch. Thanks, Martin