Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp815657imm; Mon, 1 Oct 2018 20:20:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV62rHtt/Jcva7mGjxHaJD7X6TC8fTA73uLXeXFAPkR24VWvfKBBWF8lgLXCzXCBFMrH/FaoC X-Received: by 2002:a62:1e83:: with SMTP id e125-v6mr14417742pfe.231.1538450424239; Mon, 01 Oct 2018 20:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538450424; cv=none; d=google.com; s=arc-20160816; b=zWjP8mjA01+8Pec6dVC3jxSXDOVJrt9A/KUIvCDMJaApz7JLuZMd+juT2QENDnIRnn lim5mZMRT7fNPhqAzRR9Y3gHBdx7BsILdoXo44/R8mGkT5qaaS1dQoLVnSv59NKj37LN 6Huc+slNfCf61onnX2w+ylhykKOr/A0Qh0PimMB1YysJAuOQz2nAHajHVZSKxSGiMz6w 47dgY6Kdxt0pJb/pcGcXU2OplhWT13JpWBiwnbRfdUJnW5oH2MyYyxmq3C9pfClXKtB6 tiP+EiMitdJG7RdH6v7r0AY+yGOnYyJxpsbHePSKH5a2KWBs/4v6xZscMqjC0XvNNsjv D5Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date; bh=q/fHnPbKlY0S6B07+nVdb27C4B5EFIOyJEClE0S2Pxg=; b=EjRHFu6Gy4ubIXmwW9yMSdg9qpGzMdRQNZq9Ee1H3WjY6T4hROprTyfmbMYhAQuzNj zkDMDSW5iDhZ8AFlLk8IbUcIYBsRUPxXmNBkgyAWJRc0fChuxFbHwfbT1/A8BM4OXszc T1U1dfHkEWdEDmjWSHFKrdq2en/ZrbikDla2EpYphYVhMO8huYdnVmKzkTFYgRBiORIj RD9yZHc0BTWqjLBpFY8upSI3fk+xdW9j3+ji8T/zCYrcRNqXFkJAjjV939e3QMr2Q8U5 tzMVf31gxb/hzIs1/Hs12N/RqnrvUEq7f3PJ4opsVuePA2/l2MigfJSpW5pIloXUrAi8 LDEg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si7746052plk.350.2018.10.01.20.20.09; Mon, 01 Oct 2018 20:20:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbeJBJ7v (ORCPT + 99 others); Tue, 2 Oct 2018 05:59:51 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:49728 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbeJBJ7v (ORCPT ); Tue, 2 Oct 2018 05:59:51 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1g7BD0-0004xy-Py; Tue, 02 Oct 2018 11:18:50 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1g7BCy-0002Hl-QJ; Tue, 02 Oct 2018 11:18:48 +0800 Date: Tue, 2 Oct 2018 11:18:48 +0800 From: Herbert Xu To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-crypto@vger.kernel.org, davem@davemloft.net, gregkh@linuxfoundation.org, Jason@zx2c4.com, sneves@dei.uc.pt, luto@kernel.org, jeanphilippe.aumasson@gmail.com, appro@openssl.org, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org Subject: Re: [PATCH net-next v6 04/23] zinc: ChaCha20 x86_64 implementation Message-ID: <20181002031848.lyxrergyyxyc5cwi@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925145622.29959-5-Jason@zx2c4.com> X-Newsgroups: apana.lists.os.linux.cryptoapi,apana.lists.os.linux.kernel,apana.lists.os.linux.netdev Organization: Core User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jason A. Donenfeld wrote: > This provides SSSE3, AVX-2, AVX-512F, and AVX-512VL implementations for > ChaCha20. The AVX-512F implementation is disabled on Skylake, due to > throttling, and the VL ymm implementation is used instead. These come > from Andy Polyakov's implementation, with the following modifications > from Samuel Neves: > > - Some cosmetic changes, like renaming labels to .Lname, constants, > and other Linux conventions. > > - CPU feature checking is done in C by the glue code, so that has been > removed from the assembly. > > - Eliminate translating certain instructions, such as pshufb, palignr, > vprotd, etc, to .byte directives. This is meant for compatibility > with ancient toolchains, but presumably it is unnecessary here, > since the build system already does checks on what GNU as can > assemble. > > - When aligning the stack, the original code was saving %rsp to %r9. > To keep objtool happy, we use instead the DRAP idiom to save %rsp > to %r10: > > leaq 8(%rsp),%r10 > ... code here ... > leaq -8(%r10),%rsp > > - The original code assumes the stack comes aligned to 16 bytes. This > is not necessarily the case, and to avoid crashes, > `andq $-alignment, %rsp` was added in the prolog of a few functions. > > - The original hardcodes returns as .byte 0xf3,0xc3, aka "rep ret". > We replace this by "ret". "rep ret" was meant to help with AMD K8 > chips, cf. http://repzret.org/p/repzret. It makes no sense to > continue to use this kludge for code that won't even run on ancient > AMD chips. > > While this is CRYPTOGAMS code, the originating code for this happens to > be the same as OpenSSL's commit cded951378069a478391843f5f8653c1eb5128da > > Cycle counts on a Core i7 6700HQ using the AVX-2 codepath: > > size old new > ---- ---- ---- > 0 62 52 What is the old column? Is it the existing x86-64 implementation in the kernel or something else? This needs to be made clear in the patch description. The same comment from the previous patch also stands here. Please ensure that we only have one copy of chacha x86-64 code in the kernel. Either replace the existing one right here or in a follow-up patch in the same series. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt