Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp714034ybt; Wed, 24 Jun 2020 09:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZb/NgALIm2QXutFecfJzuWk+rO8MLBET5/TriLmynqwbHseGSqocxnH4cNhI81oNKZbI8 X-Received: by 2002:a17:906:455:: with SMTP id e21mr15092852eja.550.1593015896248; Wed, 24 Jun 2020 09:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593015896; cv=none; d=google.com; s=arc-20160816; b=nZ1sXs844qqG5ARlR1BQ31Di8MppTMTO10/kr17gUMEdeErLeLPS1p3dsCewIpLyCP 7v1qihaUeYi61uW7XAmVNXHXsvW0EvSO69miKz2DloJz7bhJAy2JBa6lXHLoI0E3ayhi v2wtyUygdnEDeXnBKP/3xlpX0/Wx8hj8TzlgYCASWCjkdUZdo6Iadr5PG649HnU7HHYI l+hrpRNUIId7QL/rJXc1E2Bbax8tJoJd+k61fJUu5mmFo/371shYaOrXUASOp4VK6Cuu HFrruLjD8Jw0DuT6Ex4G5K7wfVl58CxQ6qho+ExduVno6yQr0OIQbdPQqhapLJEEUE31 /VFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JUHgI9jgVJ7Pk9zSupGTDPTofuqh9PIPGb/hOWNppW8=; b=E8jK2D/sH1KKaBAxcQkYmVL4+jIxFpjvUm3cS8GKHkflRy99J53gxXUiHRTZhEPSpC 8Pw3rR3mTUYVuMCVhuRiEx7tcII1Vx9ejzr3vD5RPJZVHvDVL0L7qI2Bf/afkS80BruJ jw0lwA3Sm/tgYzOxwlR1N4j+523+/VqetFpqVA/t8K0ARySnGBvM2uSr0aAEsOFDiTFb habzFVhvQDgkyyS0rSSOsGT8NpHwQsOZZNDAehX4TsQyf5UCQQLqLqQ4nnE2gHs82we/ ro2Lo2PJj64NEl1UG0O+rnoVOvMpz0ZmtlFOYOAeP3GNGY9Z3pjHJ7vfl0ZNU6+2zWhW ktPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DLrXpIVU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 u29si4629345edi.469.2020.06.24.09.24.32; Wed, 24 Jun 2020 09:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=DLrXpIVU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S2404733AbgFXQYJ (ORCPT + 99 others); Wed, 24 Jun 2020 12:24:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:43384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404468AbgFXQYJ (ORCPT ); Wed, 24 Jun 2020 12:24:09 -0400 Received: from gmail.com (unknown [104.132.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE7D520823; Wed, 24 Jun 2020 16:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593015849; bh=hC/tMOp7XJE7LWrTe6wekS6ygzz+JEMjzao1qQnF1v4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DLrXpIVURABHgMMI8XW4SBezPTaxd8k6qBHCtcS7hBctySTX09+7Vc+1dT5Nvj89J H/YiN+pARpsz4bBJFTithpf2P7gjj2+NoODPyF0Ps3mEUPFFvUZnSKyYtMrwUldTPU nL7qH2fiqF3wY6dZYQvYDRaoB6UEGz5EM7cCPFkU= Date: Wed, 24 Jun 2020 09:24:07 -0700 From: Eric Biggers To: Ignat Korchagin Cc: agk@redhat.com, Mike Snitzer , dm-devel@redhat.com, dm-crypt@saout.de, linux-kernel , kernel-team Subject: Re: [dm-crypt] [RFC PATCH 1/1] Add DM_CRYPT_FORCE_INLINE flag to dm-crypt target Message-ID: <20200624162407.GB200774@gmail.com> References: <20200619164132.1648-1-ignat@cloudflare.com> <20200619164132.1648-2-ignat@cloudflare.com> <20200624050452.GB844@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 09:24:07AM +0100, Ignat Korchagin wrote: > On Wed, Jun 24, 2020 at 6:04 AM Eric Biggers wrote: > > > > On Fri, Jun 19, 2020 at 05:41:32PM +0100, Ignat Korchagin wrote: > > > Sometimes extra thread offloading imposed by dm-crypt hurts IO latency. This is > > > especially visible on busy systems with many processes/threads. Moreover, most > > > Crypto API implementaions are async, that is they offload crypto operations on > > > their own, so this dm-crypt offloading is excessive. > > > > This really should say "some Crypto API implementations are async" instead of > > "most Crypto API implementations are async". > > The most accurate would probably be: most hardware-accelerated Crypto > API implementations are async > > > Notably, the AES-NI implementation of AES-XTS is synchronous if you call it in a > > context where SIMD instructions are usable. It's only asynchronous when SIMD is > > not usable. (This seems to have been missed in your blog post.) > > No, it was not. This is exactly why we made xts-proxy Crypto API > module as a second patch. But it seems now it does not make a big > difference if a used Crypto API implementation is synchronous as well > (based on some benchmarks outlined in the cover letter to this patch). > I think the v2 of this patch will not require a synchronous Crypto > API. This is probably a right thing to do, as the "inline" flag should > control the way how dm-crypt itself handles requests, not how Crypto > API handles requests. If a user wants to ensure a particular > synchronous Crypto API implementation, they can already reconfigure > dm-crypt and specify the implementation with a "capi:" prefix in the > the dm table description. I think you're missing the point. Although xts-aes-aesni has the CRYPTO_ALG_ASYNC bit set, the actual implementation processes the request synchronously if SIMD instructions are currently usable. That's always the case in dm-crypt, as far as I can tell. This algorithm has the ASYNC flag only because it's not synchronous when called in hardIRQ context. That's why your "xts-proxy" doesn't make a difference, and why it's misleading to suggest that the crypto API is doing its own queueing when you're primarily talking about xts-aes-aesni. The crypto API definitely can do its own queueing, mainly with hardware drivers. But it doesn't in this common and relevant case. - Eric