Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1553287imm; Thu, 19 Jul 2018 03:57:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgperD6Ksii4tDonHATpYlx58Aa2LJ2ckPKG+5oNCqxehiTMAky+PGm8l1vsuq/zOxSLbuY2i X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr9570163plb.198.1531997836471; Thu, 19 Jul 2018 03:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531997836; cv=none; d=google.com; s=arc-20160816; b=ShEEXUldqB8MaNjoxLYvc5QPLEb9IrgcXwpR8mC3ZFiMSjyga9dzGHyitML5dyoX0C BQPdcpNcF7zMV5wJtNH0bOxQgoa1xozBkNIoS2y0qkpSGXIC0zd6ujJDPg5bog93T6tm 3EaFXNSJwqHCxEoMCKiXrdBejQC5BNhO+G6f71s9tN/OM7QZe9ekWMxsxNIx/861m/f9 ZjeQzmRbaabsPcoTufgI1zaafdHxYec4n5OfuXz8TVLYJwjFHJDh8sjjP5jNNo6tdg13 O/4FZnc6ySA25sOMzVIVFTXMwTJy9rwW9XUG8d63cbJwQhhCA8fkEpDs+I4LInP8bjCj ZDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=d6aNREDyTm2ybR7YU3PhoS6VGtH/OfuhnZZfZ5XeOZQ=; b=gqggy5MCdj7snH9ier4Z9MOscntAfmbMGF3oqxWLjp18f65auYglvR+UaY55kHb802 m14PmoaWT3nRIQWGsP9ezTobqIMx+5j1a0ir72mQoeCpYFTmNvIlBlOeg/qqDaQ1DB/Q UCWQVbj24BMn1lWNnE9ELBwAQYfwWC+UcqcDFopdnPbI6b9+ccIEYjR3kY9VdtXaNuSV 7HBv2ayQV5hrBcdgFFuUAEDQ3CvSkZcQBh0w3mBrNLkbgawEsBL+SZmdIhSW9KAzzWb5 aJNwz1I7bgq511h+A1y8758TrajhJcOXXywsyHuR3xmgXmgwjcyZvn++0lDjWKX96P/k 7NGg== 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 n61-v6si5182586plb.256.2018.07.19.03.57.02; Thu, 19 Jul 2018 03:57:16 -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 S1731532AbeGSLiI (ORCPT + 99 others); Thu, 19 Jul 2018 07:38:08 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9655 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727489AbeGSLiI (ORCPT ); Thu, 19 Jul 2018 07:38:08 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 298BEFA72419A; Thu, 19 Jul 2018 18:55:17 +0800 (CST) Received: from [127.0.0.1] (10.184.52.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.382.0; Thu, 19 Jul 2018 18:55:11 +0800 Subject: Re: [PATCH 0/5] crypto: add IV generation templates To: Ard Biesheuvel , Arnd Bergmann CC: Alasdair Kergon , Mike Snitzer , Herbert Xu , , "Linux Kernel Mailing List" , Mark Brown , Jonathan Cameron References: <1531899055-29362-1-git-send-email-wangxiongfeng2@huawei.com> From: Xiongfeng Wang Message-ID: <5d0bb72c-862e-63be-3cc5-83ed02b9a575@huawei.com> Date: Thu, 19 Jul 2018 18:55:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.52.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2018/7/18 23:34, Ard Biesheuvel wrote: > On 18 July 2018 at 19:59, Arnd Bergmann wrote: >> On Wed, Jul 18, 2018 at 9:30 AM, Xiongfeng Wang >> wrote: >>> >>> I tested the performance of software implemented ciphers before and after >>> applying this patchset. The performance didn't change much except for >>> slight regression when writting. The detail information is as follows. >>> >>> The command I used: >>> cryptsetup -y -c aes-xts-plain -s 256 --hash sha256 luksFormat /dev/sdd1 >>> cryptsetup -y -c aes-cbc-essiv:sha256 -s 256 --hash sha256 luksFormat /dev/sdd1 >>> cryptsetup -y -c aes-cbc-benbi -s 256 --hash sha256 luksFormat /dev/sdd1 >>> >>> cryptsetup luksOpen /dev/sdd1 crypt_fun >>> time dd if=/dev/mapper/crypt_fun of=/dev/null bs=1M count=500 iflag=direct >>> time dd if=/dev/zero of=/dev/mapper/crypt_fun bs=1M count=500 oflag=direct >>> >>> Performance comparision: >>> -------------------------------------------------------- >>> algorithms | before applying | after applying >>> -------------------------------------------------------- >>> | read | write | read | write >>> -------------------------------------------------------- >>> aes-xts-plain | 145.34 | 145.09 | 145.89 | 144.2 >>> -------------------------------------------------------- >>> aes-cbc-essiv | 146.87 | 144.62 | 146.74 | 143.41 >>> -------------------------------------------------------- >>> aes-cbc-benbi | 146.03 | 144.74 | 146.77 | 144.46 >>> -------------------------------------------------------- >> >> Do you have any estimate of the expected gains for hardware >> implementations? >> >> Would it make sense to try out implementing aes-cbc-essiv >> on the ARMv8 crypto extensions? I see that Ard has done >> some prior work on aes-ccm in arch/arm64/crypto/aes-ce-ccm-* >> that (AFAICT) has a similar goal of avoiding overhead by >> combining the usual operations, so maybe the same can >> be done here. >> > > I am having trouble understanding what exactly this series aims to achieve. > > Calling into the crypto layer fewer times is a nice goal, but a disk > sector seems like a reasonable granularity for the dm layer to operate > on, and I don't think any hardware exists that operates on multi > sector sequences, where it would pay off to amortize the latency of > invoking the hardware over an entire bio. I don't know much about crypto hardware, but I think a crypto hardware can handle data more than one sector at one time. So I think passing the whole bio to the hardware at one time will decrease the overhead in passing each sector alternatively. Thanks, Xiongfeng > > So in summary, you need to explain to us why we need this. It is > really very easy to convince people if your changes make things go > faster. > > . >