Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp292441pxa; Tue, 4 Aug 2020 05:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBFwXQECx9mRgoe8flfJh3hav56a2xJVBpz5HOXZnHhbTDE8IIkNK4DBIoB0AuPf/V/UmH X-Received: by 2002:aa7:c606:: with SMTP id h6mr7831603edq.288.1596545806700; Tue, 04 Aug 2020 05:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596545806; cv=none; d=google.com; s=arc-20160816; b=YydkneGrExbQR4M3UKrCksFd/qFRqVmoAIH/SUdhY7r3dOBolSt6E2IYqO/0cDzSxe vEsoXtUkKebxLZIO9tY3enrM1qFma/16J4o3aMGPGSE2ieIqrv/F7V5GBVXdnsdSs5cS nSKd0LcakV886KRdVdKpfGcffiJQvoRrKG5CH092yM7aoWspgbqUTwcGjI2kPdPH3vE9 xAdaCDcZWyX7PacUe/8xJ1L803Bo+2IHohUqudnhRJpz0J3oXP3vxeN111ISPYnsGFFW xuJ7Dh9vJ2h/0CtREPcZ3atnpY89/zVXXjCmtepOsQi8LHc6KfB2vogdK4BVJVEooBu2 /KKw== 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=wRoicua47vE370qzw8Ok/B+N40ETw2xbYXuqWngz2vs=; b=By9f1znt9ITaPX5u4qqk4WpPvs1M6mpRc7IqgFlZSro+L2oLyGc1GaGAizcbnbFy2r BFMUQJpwHOxnupjiGBN3lUYccKsKPeatfj6dUxUepyA7sW/AYvTRuBc67xCcjY2VNjJQ QCqeeIGwDoP6DK8DyzfPmaS8tb5pt175dZky116uw4VycZRQFC4F2LAEyPL6i2MfhkcE 2Cgd8jl7rMW+JlnNmZmRkQrMksZogaBCnOKiLaYMdkCqkkhoCtpH2qjzTw8F4FPIInq7 VzYrJAidP4OofKvT2KnR0uIzUrpGvpTkfSNnwTE0nDu1/m5y0aRSG2y0CN4ZuaIyTdHE 6uUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K1hrneUX; 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 s24si12607531ejd.575.2020.08.04.05.56.14; Tue, 04 Aug 2020 05:56:46 -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=K1hrneUX; 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 S1725932AbgHDMz4 (ORCPT + 99 others); Tue, 4 Aug 2020 08:55:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:32872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbgHDMz4 (ORCPT ); Tue, 4 Aug 2020 08:55:56 -0400 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 A00332075A for ; Tue, 4 Aug 2020 12:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596545755; bh=EF4RlOtgvcxjYIJRsn7Hy5UR9CqnOuZ56+H7OfqBQFs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=K1hrneUXyroXB9FT17cl4URSjZb0sNb1zfDwXjQcL61+oM5CkbA7GdvnsPZ9ZT7ic 0CrD6LmQ4WKw4HWx3borhHgJC3hAnENqMgEtH0muik6QXF7Math6LGeqZsDtNCphgX nKBRVu8nmUEskKrGFI42SqXIz0iNdfhVkANuWTus= Received: by mail-ot1-f43.google.com with SMTP id x24so6340922otp.3 for ; Tue, 04 Aug 2020 05:55:55 -0700 (PDT) X-Gm-Message-State: AOAM531ywHyQEM0MqCbc/j/o7KIbhQapQ0vr7Xv0k9kty1iFO8gxZy2u FUqmiHL7poBazeVMW8OLtVEAY3qxg8FBvlfTfsU= X-Received: by 2002:a9d:6251:: with SMTP id i17mr7667844otk.90.1596545754967; Tue, 04 Aug 2020 05:55:54 -0700 (PDT) MIME-Version: 1.0 References: <20200802090616.1328-1-ardb@kernel.org> <25776a56-4c6a-3976-f4bc-fa53ba4a1550@candelatech.com> In-Reply-To: <25776a56-4c6a-3976-f4bc-fa53ba4a1550@candelatech.com> From: Ard Biesheuvel Date: Tue, 4 Aug 2020 14:55:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] crypto: x86/aesni - implement accelerated CBCMAC, CMAC and XCBC shashes To: Ben Greear Cc: Linux Crypto Mailing List , Herbert Xu , 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 Mon, 3 Aug 2020 at 21:11, Ben Greear wrote: > > Hello, > > This helps a bit...now download sw-crypt performance is about 150Mbps, > but still not as good as with my patch on 5.4 kernel, and fpu is still > high in perf top: > > 13.89% libc-2.29.so [.] __memset_sse2_unaligned_erms > 6.62% [kernel] [k] kernel_fpu_begin > 4.14% [kernel] [k] _aesni_enc1 > 2.06% [kernel] [k] __crypto_xor > 1.95% [kernel] [k] copy_user_generic_string > 1.93% libjvm.so [.] SpinPause > 1.01% [kernel] [k] aesni_encrypt > 0.98% [kernel] [k] crypto_ctr_crypt > 0.93% [kernel] [k] udp_sendmsg > 0.78% [kernel] [k] crypto_inc > 0.74% [kernel] [k] __ip_append_data.isra.53 > 0.65% [kernel] [k] aesni_cbc_enc > 0.64% [kernel] [k] __dev_queue_xmit > 0.62% [kernel] [k] ipt_do_table > 0.62% [kernel] [k] igb_xmit_frame_ring > 0.59% [kernel] [k] ip_route_output_key_hash_rcu > 0.57% [kernel] [k] memcpy > 0.57% libjvm.so [.] InstanceKlass::oop_follow_contents > 0.56% [kernel] [k] irq_fpu_usable > 0.56% [kernel] [k] mac_do_update > > If you'd like help setting up a test rig and have an ath10k pcie NIC or ath9k pcie NIC, > then I can help. Possibly hwsim would also be a good test case, but I have not tried > that. > I don't think this is likely to be reproducible on other micro-architectures, so setting up a test rig is unlikely to help. I'll send out a v2 which implements a ahash instead of a shash (and implements some other tweaks) so that kernel_fpu_begin() is only called twice for each packet on the cbcmac path. Do you have any numbers for the old kernel without your patch? This pathological FPU preserve/restore behavior could be caused be the optimizations, or by other changes that landed in the meantime, so I would like to know if kernel_fpu_begin() is as prominent in those traces as well.