Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1857931imm; Thu, 16 Aug 2018 03:58:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwg+rvcStAtcdN/EqfTHy/M+HKOLWYSX2vllOInyowlHERvy4pmca8SxZCPtc2SbNuE5GlN X-Received: by 2002:a63:ec43:: with SMTP id r3-v6mr27739394pgj.295.1534417119665; Thu, 16 Aug 2018 03:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534417119; cv=none; d=google.com; s=arc-20160816; b=BWAz/+QTJeiq9/1sCv2HTmoGBGQT+wHiaTLA/ArKQSYK2GkdGzKpz0FLXJ6o3XWBlq xrI65ac4BdplQuhE/rbojPukY1yTeExyk+UgMFFj1czp0v44xUKdXLlaHTfzCfIkRfJy G0CbwhBNv314p9EdrfmG8rcmD77fDhFzMw7o6R5SzPilEhPgmL+vlV1R36xBFN871C8V p6RcDW7DkbEfV52+HiivCH2CpP0bCrh8vvnRl8dQi9Xvnn1aqyg8lFR/msjCwN/OJZQQ 8916XN6Os5tOg+W0TJK2CsDuFkX2s4yDFkTWRtVHbEkMlFRNa20XUs33UrmG3XVmcN1i ij4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=W2MUTulmRcTO3yAF+KCCt1PaHXLDq+i1UwOt5vQci/k=; b=PU8/ymeBolgr38YvspaIQdvSIUr18ujAdIadVw+XQiv5r0xkA7LiTgzFZQxMV5gM9L n71JC2iGAjOd6bNRWw1pw9nIeBYvVAYnaOIW+R45gaKEkhLk/1obBzHO4L3vFVDuIQhZ pYSqxmQW0fb3ou8GEG/kcNhajR4wWOUoExz2b/c9b9iui+caSOu2KiroKMbQoyQMLAXQ VJUsuaIp36c3Rjxsiffm+JkohxRprlM4ew5GzlOjN2iQoUL59aEnUMOkF/py2z3QfwZe oMe2JXVRkrNit50sWT7uo+B2PZgRBlnv/Kki9cuem1V95lBEE2LuC6juwml3YAXOmCr1 kR3w== 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 d66-v6si26313563pfa.186.2018.08.16.03.57.55; Thu, 16 Aug 2018 03:58:39 -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 S2389084AbeHPJvp (ORCPT + 99 others); Thu, 16 Aug 2018 05:51:45 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:54862 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbeHPJvp (ORCPT ); Thu, 16 Aug 2018 05:51:45 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fqCBo-0000sk-Fd; Thu, 16 Aug 2018 14:55:24 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fqCBk-00008g-R9; Thu, 16 Aug 2018 14:55:20 +0800 Date: Thu, 16 Aug 2018 14:55:20 +0800 From: Herbert Xu To: Megha Dey Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [RFC] crypto: Remove mcryptd Message-ID: <20180816065520.pojqi7pplpnknlv5@gondor.apana.org.au> References: <1526089453-6542-1-git-send-email-megha.dey@linux.intel.com> <20180720035325.m5tzeuqsfej3y6wd@gondor.apana.org.au> <1532651107.19157.24.camel@megha-Z97X-UD7-TH> <20180808095621.h7ecacftx5ofe5ki@gondor.apana.org.au> <1533868833.19050.19.camel@megha-Z97X-UD7-TH> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1533868833.19050.19.camel@megha-Z97X-UD7-TH> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 09, 2018 at 07:40:33PM -0700, Megha Dey wrote: > > 1. > @@ -495,7 +534,10 @@ static void cryptd_skcipher_encrypt(struct > crypto_async_request *base, > skcipher_request_set_crypt(subreq, req->src, req->dst, > req->cryptlen, req->iv); > > - err = crypto_skcipher_encrypt(subreq); > + subreq->base.data = req->base.data; > + subreq->base.complete = rctx->complete; > + rctx->desc = *subreq; > + err = crypto_skcipher_encrypt(&rctx->desc); > skcipher_request_zero(subreq); > > This change is necessary because for the multibuffer algorithms, the > inner algorithm needs a pointer to the original request. In the slow > path, since we allocate a skcipher_request on the stack, there is no > easy way to retrieve the request. In the mcryptd_layer, we had extra > logic to store this pointer. Why do you need the original request? I think the fact that you need this at all indicates that you're not using cryptd correctly. cryptd should be completely transparent to the underlying algorithm. All it's doing is making sure that the underlying algorithm gets called in a context that allows SIMD use. > Lastly, for hashes, we have > struct cryptd_hash_request_ctx { > crypto_completion_t complete; > struct shash_desc desc; > }; > > If we were to use this(with the added fields for multibuffer), we should > update the shash_desc to ahash_request since we are an async algorithm > right? That's a good point. More importantly, you also need to extend cryptd to allow an ASYNC underlying algorithm, for skcipher as well as hashes. This is not as simple as just modifying the type/mask during algorithm creation. But you also need to modify the run-time (e.g., cryptd_skcipher_encrypt) to defer the completion in case of an async return value. The same change also needs to be made to crypto/simd.c, but at least there the run-time doesn't need any changes AFAICS. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt