Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1052619pxa; Thu, 20 Aug 2020 00:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycwBmdc0Mz+wFyRoXA1qXCX5N1lOKNSBvHDWTiX77xmwLpfjqLaRiLI1pwhFiCch5CwCqg X-Received: by 2002:a05:6402:17a4:: with SMTP id j4mr1813298edy.52.1597909878543; Thu, 20 Aug 2020 00:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597909878; cv=none; d=google.com; s=arc-20160816; b=jVBzTrE3VuIdPbttripvYvl7GeEnAYsV60hH1R5uYh1T3ElqoxEWFeY4XtZhIkS++S 2rBMqgRtiQ1YLNDUGTAFffyTmcUFXWRAMYcws8HxbqG2IYSjt+VZXnpBDBh396a0f5FM kQC+V0HR99gZbP6lV/5q4qoxpVykEaKxU1cZZC42wR0GaVR8tAWVQTVIU6VS5uSZGrqr Bb0L23yaSlv4Is/Wt4Hbz3onhvs94KOyC1XC38jGTIpRhHM77liliIuKnCwtx95TvbsD URJnNhpbEwAl01SWQJ+z5m1dKX4Czlb1358Mw6RWPdpQsqClRsg3IEFqC9DKCpohwF+z mmyA== 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=A0df3RBaUO8Zj+0OS3pHHk3R4LI3SIQau+UpDVpRiCs=; b=0f0ecW2octR9D9uWF8zeCJqspoOdZr7ZTDOD1kx4/tMSl5ciQmUeYlovMzfwWTHJDm xCTNuFTGHnaQadkEzpjVn/kR2jovd9TyaH71M039L84gquPJJiAabN/cXU4ncTbhtrBz SEo8VXx28/SOpRA5Se2TM6lEcKRj6rOtjAKSMyxBFH+D5g312ISwzkVwENmOn6Vk8gfZ rHMM5vdSGj30fVSavjwiOkf1l2HM4PcPzIRFjoiENLTROfxOs3tXJjzKTzFK0z0+Q55R NyuhDKv6wmUEkLliDS5bOjDhI/JytwliUgGmrSnbJbNEi1hiZll10hXlgPJhqTnnZm2M HEsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="c6Q/acTi"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si862842edr.513.2020.08.20.00.50.53; Thu, 20 Aug 2020 00:51:18 -0700 (PDT) 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=@kernel.org header.s=default header.b="c6Q/acTi"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726325AbgHTHsX (ORCPT + 99 others); Thu, 20 Aug 2020 03:48:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:57672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbgHTHsP (ORCPT ); Thu, 20 Aug 2020 03:48:15 -0400 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4080D21775 for ; Thu, 20 Aug 2020 07:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597909694; bh=A0df3RBaUO8Zj+0OS3pHHk3R4LI3SIQau+UpDVpRiCs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c6Q/acTi7Z+SxuPuIiSRHw4R89sDtK5RGWknQd7ROUcJ3eJaaBHv2NfS5CnGVeJsM Snr1W4cxJvxAKIM7RBUPcUc/I8AR7iE9Zh2SuyRF3xn4894CA22X0aSbxbNDO7DC/3 X8rIgN2ioi4yc8nkPoIs+B75xMHJAZM2JXMScCSQ= Received: by mail-ot1-f54.google.com with SMTP id q9so735453oth.5 for ; Thu, 20 Aug 2020 00:48:14 -0700 (PDT) X-Gm-Message-State: AOAM5320GPw4CjFbDGAopT91XVrAdNLFYnH5/V8PaxSH0aWxgXUuht8q zMsgySrBQwxjWzXYzZ67CwyaPUT9W7UeUhvVVUY= X-Received: by 2002:a05:6830:1d8c:: with SMTP id y12mr1356962oti.77.1597909693547; Thu, 20 Aug 2020 00:48:13 -0700 (PDT) MIME-Version: 1.0 References: <20200818223359.GA27712@gondor.apana.org.au> <8b248ef3-d4c7-43fd-6ae4-1c3381597579@candelatech.com> <20200820070142.GA21343@gondor.apana.org.au> <20200820070645.GA21395@gondor.apana.org.au> <20200820072910.GA21631@gondor.apana.org.au> <20200820074414.GA21848@gondor.apana.org.au> In-Reply-To: <20200820074414.GA21848@gondor.apana.org.au> From: Ard Biesheuvel Date: Thu, 20 Aug 2020 09:48:02 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/5] crypto: Implement cmac based on cbc skcipher To: Herbert Xu Cc: Ben Greear , Linux Crypto Mailing List , Eric Biggers Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, 20 Aug 2020 at 09:44, Herbert Xu wrote: > > On Thu, Aug 20, 2020 at 09:33:21AM +0200, Ard Biesheuvel wrote: > > > > > On my machine the performance difference on a 1472-byte request > > > between SIMD and generic is 2161 vs. 7558 (cycles). > > > > Sure. But your machine does not have the pathological FPU > > preserve/restore performance. > > Why does that matter? These are numbers for cbc-aesni which means > just a single preserve/restore for the whole request. > No, that is the whole problem. The CCM template has a CBCMAC implementation that wraps the bare cipher, which means it invokes crypto_cipher_encrypt_one() for each 16 bytes of input, and each of those calls involves a FPU preserve/restore. > Or are you saying on Ben's machine cbc-aesni would have worse > performance vs. aes-generic? > Yes, given the pathological overhead of FPU preserve/restore for every block of 16 bytes processed by the cbcmac wrapper. > > The mac80211 CCMP code uses a synchronous ccm aead, which gets backed > > by a skcipher+ahash combo by the ccm template. So a synchronous ahash > > is fine for this particular case. > > OK I was just grepping for cmac so didn't see this. > > For this case, I think it's even more important that it be converted > over to async because its sending path is also in user context just > like IPsec. > Indeed. cmac() is not really relevant for performance, afaict. Only cbcmac() is used for bulk data. > So simply by sending wireless packets you can hog the CPU while > doing SIMD in kernel context which would then kill the receive > path if you're using the generic fallback. > > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt