Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2478350pxj; Sun, 6 Jun 2021 03:42:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE1XdPjgVVdAdfDyiFIYVBTMevT1t1L1y5oRibpmHqa2BoKWpCVtuMfQeu2IjEF2l1eBO/ X-Received: by 2002:a17:906:3395:: with SMTP id v21mr12791913eja.102.1622976169651; Sun, 06 Jun 2021 03:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622976169; cv=none; d=google.com; s=arc-20160816; b=l4QCKLioVjO89C4ThMfHdxFft8kZb5E2cVM6zrA0FRCNGm8LRmPlvUQMoRl2TuPz7+ 2BPC1o98eA5WskkVtqdJGHRIWkOWXQx0F87bcwWC7piWGoqs5sNSsQPKfAlBjjGIvcdY he0qhavdvypXYDIpf4kHFfSTv1JAdWZpx5CzldP+pTNQhBJMLWuExRhxQl5ioLLsWTis BVcP8a88+P/Dg1nLhxnSzrDMPfAj22wIuSpPITUWWwSddNmfKTyMQV3NtS2XwROn7/k6 N5ItmDbUk4PzSLBfFNBRWt+w66y6wC75R+SC8VA58uOA5LtTiRO01TUKQ7gszQNSd5H6 8UJQ== 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:from:references :cc:to:subject:dkim-signature; bh=7+MDpZbhCCON3M2CQK9ooFKS0Z3A4ieFQqrLiLPPz+Q=; b=otei5dGasxBQOmsjibwVQ5M587o6UnX/uiEW+8CuyJB18TNAF4gtbaPPfZFwOdHB6i iWicmnjAv8UCumOkava9LHXafW/a8wH2KCL/Yjd+RxXie4IXEXTzfGEvGVMCVO2m47S1 yBqqHNqSEmVw4DEtV9YxiXTmRGwc5/k8uknVf9Va+Rdpnl5jvBkLD3ZMZ9xgT8P0B0eV DEBMMR6jOiULQbmwDfxEfnF8JzJkRSuMo08mSbuE8UFeuwaRDaBme3cZiHJJwgAbMVYe hb33zpi246gnCrhIKc5Z++dnkpkWxcXDSK6g41B9+iDofD3Z3mH1oKUD3zICMnCp9r8b 31rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mRkbRnWU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si9094610edi.208.2021.06.06.03.42.01; Sun, 06 Jun 2021 03:42:49 -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=@gmail.com header.s=20161025 header.b=mRkbRnWU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbhFFKJE (ORCPT + 99 others); Sun, 6 Jun 2021 06:09:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhFFKJE (ORCPT ); Sun, 6 Jun 2021 06:09:04 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5040C061766 for ; Sun, 6 Jun 2021 03:07:14 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id g20so21654122ejt.0 for ; Sun, 06 Jun 2021 03:07:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7+MDpZbhCCON3M2CQK9ooFKS0Z3A4ieFQqrLiLPPz+Q=; b=mRkbRnWUjCiSy/JOpWtNHNU0BESuBgkzh4vP4QFfAHLJof+aGBgsp2WMvQF3ltE97U MF0graLXOXZ79jZ0kFONdENClRleoDurmpjAHL9sfWvGASRXC2hBgBAmsPDBjZYqg7IZ JK+no9rMqkWqo4mFqdYGXNm124F3B3ptJU1PWGUKaZdC/WeYPXcV0bDcfsN/26F2Gj7V Yc7L35MDjcfhojXosTaQAi7kDqsDt8FXoRNTc4kJzgtBxwn5cxlrarckLffRKgqxeKkI v2Y4GLoBdHHB5Fei16GPMmSmQp18Gy+Ts3QBiXefMzlKgMcK4rbmf2RF7wSwzb4j1ysj 9QDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7+MDpZbhCCON3M2CQK9ooFKS0Z3A4ieFQqrLiLPPz+Q=; b=i5QTE7wMIch2m08YrSvKx/HsZsbsQd3QIHlxHcJ37Ilr0K1dHJvkTEGMc7O+CHKGgs +tktqNfjnDWwWXO8/Coy8EHw435mPLC4YQ+WQjRc6SlNWswCVRj9GTxyFe5NjMFqwJFh ZCE7DWP+mOTbow3gxF//ta2+aaabMHhU3hie20lvFarfQVXGE7za6/tzjN9ca37wLwjb V/x+B8lI5RM6f7kZ7nzSTQ5X+Ku0G5CmIbPg5fqGKnNYGB9YcRsOVEjlpDXD2ZlzNdHk rtN4U6dtOkGAd3sjm5IXUwWNE6Flm4Hj9RcXF2FV1xvOEAc5Uzil0cBJMK8U0aX5nPUm 92BQ== X-Gm-Message-State: AOAM5337G+2D0jjVFQb8bhNCFYeCQJSxmHkxndx98dS1ycuJQp5jRqCA CTEgrmJmVnq9SZSPj/EnFj8OrNPLF7E= X-Received: by 2002:a17:906:a0d3:: with SMTP id bh19mr13320244ejb.205.1622974033247; Sun, 06 Jun 2021 03:07:13 -0700 (PDT) Received: from debian64.daheim (p200300d5ff12ab00d63d7efffebde96e.dip0.t-ipconnect.de. [2003:d5:ff12:ab00:d63d:7eff:febd:e96e]) by smtp.gmail.com with ESMTPSA id g4sm6182700edw.8.2021.06.06.03.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 03:07:12 -0700 (PDT) Received: from localhost.daheim ([127.0.0.1]) by debian64.daheim with esmtp (Exim 4.94.2) (envelope-from ) id 1lpnoL-0004sy-CG; Sun, 06 Jun 2021 12:07:10 +0200 Subject: Re: Qualcomm Crypto Engine performance numbers on mainline kernel To: Ard Biesheuvel , Thara Gopinath , Eric Biggers Cc: Linux Crypto Mailing List References: From: Christian Lamparter Message-ID: <0bd651ea-a062-3883-77ee-6ac275d66741@gmail.com> Date: Sun, 6 Jun 2021 12:07:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 05/06/2021 17:32, Ard Biesheuvel wrote: > Hello Thara, > > On Fri, 4 Jun 2021 at 18:49, Thara Gopinath wrote: >> >> >> Hi All, >> >> Below are the performance numbers from running "crypsetup benchmark" on >> CE algorithms in the mainline kernel. All numbers are in MiB/s. The >> platform used is RB3 for sdm845 and MTPs for rest of them. >> >> >> SDM845 SM8150 SM8250 SM8350 >> AES-CBC (128) >> Encrypt / Decrypt 114/106 36/48 120/188 133/197 >> >> AES-XTS (256) >> Encrypt / Decrypt 100/102 49/48 186/187 n/a >> > > The CPU instruction based ones are apparently an order of magnitude > faster, and are synchronous so their latency should be lower. > > So, as Eric already pointed out IIRC, there doesn't seem to be much > value in enabling this IP in Linux - it should not be the default > choice/highest priority, and it is not obvious to me whether/when you > would prefer this implementation over the CPU based one. Do you have > any idea how many queues it has, or how much data it can process in > parallel? Are there other features that stand out? While I can't say much for the qce-crypto. I do know that "cryptsetup benchmark" isn't the greatest for pitting the hardware accelerated crypto against the CPU in some instances. In my case (crypto4xx / CPU is a PowerPC 464 800MHz - Hardware is a Western Digital My Book Live - NAS) the "benchmark" results look exceptionally poor: # Algorithm | Key | Encryption | Decryption aes-cbc 128b 8.0 MiB/s 8.7 MiB/s aes-cbc 256b 8.7 MiB/s 8.7 MiB/s aes-xts 256b 5.3 MiB/s 7.9 MiB/s aes-xts 512b 7.9 MiB/s 7.9 MiB/s (Hardware doesn't have cts/xts, but aes-cbc, aes-ctr and aes-gcm) (for comparison, these are numbers that are produced by only the 800 MHz PowerPC CPU) aes-cbc 128b 15.8 MiB/s 16.3 MiB/s aes-cbc 256b 12.3 MiB/s 12.8 MiB/s aes-xts 256b 12.5 MiB/s 15.1 MiB/s aes-xts 512b 11.9 MiB/s 12.0 MiB/s and (openssl speed -evp aes-128-cbc --elapsed -seconds 3) software manages similar numbers: type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes aes-128-cbc 12646.42k 16806.66k 18349.31k 18762.07k 18896.21k 18879.83k However, when I format a partition on the NAS HDD with cryptsetup + crypto4xx and use hdparm -i / dd # hdparm -t /dev/mapper/aes-cbc-hw-test /dev/mapper/aes-cbc-hw-test: Timing buffered disk reads: 96 MB in 3.05 seconds = 31.46 MB/sec # dd if=/dev/mapper/aes-cbc-hw-test of=/dev/null bs=8M status=progress 5318377472 bytes (5.3 GB, 5.0 GiB) copied, 143 s, 37.2 MB/s^C 639+0 records in 638+0 records out 5351931904 bytes (5.4 GB, 5.0 GiB) copied, 144.246 s, 37.1 MB/s whereas without crypto4xx: # hdparm -t /dev/mapper/aes-cbc-hw-test /dev/mapper/aes-cbc-hw-test: Timing buffered disk reads: 34 MB in 3.14 seconds = 10.82 MB/sec # dd if=/dev/mapper/aes-cbc-hw-test of=/dev/null bs=8M status=progress 46+0 records in 45+0 records out 377487360 bytes (377 MB, 360 MiB) copied, 33.1952 s, 11.4 MB/s This is 2-3 times the throughput that the CPU alone could do. @Thara, Do you have a usb-3.0 + fast 3.0 usb-stick? If so, try to format a partition on it for cryptsetup and try it there. Cheers, Christian