Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4878392pxu; Thu, 10 Dec 2020 07:36:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJo8QdaTL+2pmwIe/Q4+A2mpr+LV32CD56CGMnXrlx9n3QhXOLp5NM/BiB/rrGgcg2CUUG X-Received: by 2002:aa7:c44b:: with SMTP id n11mr7200507edr.216.1607614571529; Thu, 10 Dec 2020 07:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607614571; cv=none; d=google.com; s=arc-20160816; b=C07h25J5zWvSVX003WMM1WDeFQYGP0+w35HzzqrNCOxR3WVUsfhms4C7mVQBWbFWHg xRdM+k2t4Ed18fuJzQPoIW/NhWXeAz3O8BdjyPqVpANYWxOfDjm2CAq4Gfi7IIJXtBnX yxHuoedPyrAcv/dNL0kqBhTQlbuwH2fIcm/Gf5co+sK/x4OY4bQbpcw4NWxp+TLviv7J qFm06NmH98RRM/7e/s4hPI3HwlLImHoBHC2u3HM2TiZfOY6kgH+U/RiB28D/j2v7U24J 4BVFed9GAwhuHxoNXAAb4kO84zyQd/I5PsMpqVbMTr8CHk29H5oG8U+8JeoJK4owIKAk cYcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature:dkim-filter; bh=HSeEuvL41TgBxvNWrRm/+Ay2v/QetJh0yfHyDcv8rO8=; b=ch3tCpUJ897MZgHC/m7JFeqinlOziO8SB6i1fU/S6DfI8YWJ/72l10nGhbGHx9QCkx ImEA35M3mvS/vYXaXzi+YCWqaEHquataqjoREIMrobWF1nmoPSh7sx4coX42rc7c8Bwb 3KaW8aiRPXd5q1ASZ0Hzu1dpL2tUcxUp4jIoTWfIRmBxr4yI02QQnOU/59Yj1WbE+MfP KDM8YSE8VHg1Zo0QYCklgnsC3I/Scr2rZ4oO2zA6Mw+c0wymBSQTeXDpcxNkryrh/f/a jGVNCSXvP/2evpS+iPCybTkxec+0e7W5oU7xpGCx0VKam3l3c5len0vprD/AjNY59ERp Lgpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=SyILDUkV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b2si2823854ejh.264.2020.12.10.07.35.41; Thu, 10 Dec 2020 07:36:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=SyILDUkV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391396AbgLJOla (ORCPT + 99 others); Thu, 10 Dec 2020 09:41:30 -0500 Received: from mail2.candelatech.com ([208.74.158.173]:54826 "EHLO mail3.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391383AbgLJOlU (ORCPT ); Thu, 10 Dec 2020 09:41:20 -0500 Received: from [192.168.254.6] (unknown [50.46.158.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id 1EA1713C2B0; Thu, 10 Dec 2020 06:40:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 1EA1713C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1607611236; bh=BQf+7BLSD1IsdZHZHY1hN/owhK98UPm6lYRWn98BGLg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=SyILDUkVi4X8AL/8yDcnCkcOrlS7NiKl4Cb4p3KcpGfgaHOVizpPPoml9f+psqAHM QaozbrP4vrjIGnJuxOc41gwJZIAskz6fVKur/SW9hgmcKbPL0yL82+4QPXxd2uEv5P KJ5oDPkhweam9bdAa0qV2su1YQxVyQYCgMLDBx2Q= Subject: Re: [PATCH v2] crypto: aesni - add ccm(aes) algorithm implementation To: Ard Biesheuvel Cc: Herbert Xu , Linux Crypto Mailing List , Steve deRosier References: <20201201194556.5220-1-ardb@kernel.org> <20201201215722.GA31941@gondor.apana.org.au> <20201201220431.GA32072@gondor.apana.org.au> <20201201221628.GA32130@gondor.apana.org.au> <20201201231158.GA32274@gondor.apana.org.au> <20201210024342.GA26428@gondor.apana.org.au> From: Ben Greear Organization: Candela Technologies Message-ID: <737f75a8-0709-c0ac-c98c-ccbe1b3e5ece@candelatech.com> Date: Thu, 10 Dec 2020 06:40:35 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 12/9/20 11:30 PM, Ard Biesheuvel wrote: > On Thu, 10 Dec 2020 at 04:01, Ben Greear wrote: >> >> On 12/9/20 6:43 PM, Herbert Xu wrote: >>> On Thu, Dec 10, 2020 at 01:18:12AM +0100, Ard Biesheuvel wrote: >>>> >>>> One thing I realized just now is that in the current situation, all >>>> the synchronous skciphers already degrade like this. >>>> >>>> I.e., in Ben's case, without the special ccm implementation, ccm(aes) >>>> will resolve to ccm(ctr(aesni),cbcmac(aesni)), which is instantiated >>>> as a sync skcipher using the ctr and ccm/cbcmac templates built on top >>>> of the AES-NI cipher (not skcipher). This cipher will also fall back >>>> to suboptimal scalar code if the SIMD is in use in process context. >>> >>> Sure, your patch is not making it any worse. But I don't think >>> the extra code is worth it considering that you're still going to >>> be running into that slow fallback path all the time. >> >> How can we test this assumption? I see 3x performance gain, so it is not hitting >> the fallback path much in my case. What traffic pattern and protocol do you think >> will cause the slow fallback path to happen often enough to make this patch not >> helpful? >> > > Is there a way to verify Herbert's assertion that TX and RX tend to be > handled by the same core? I am not a networking guy, but that seems > dubious to me. > > You could add a pr_warn_ratelimited() inside the fallback path and see > if it ever gets called at all under various loads. Even if it does sometimes use the same core, if performance is better and CPU usage is lower, why would it even matter? Anyway, looks like Herbert is dead set against this code in hopes that he can force other subsystems to re-write their code. If you come up with some other variant that Herbert will accept, let me know and I'll test it. Otherwise, I will just add your patch to my kernel and carry on. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com