Received: by 10.213.65.68 with SMTP id h4csp442451imn; Fri, 16 Mar 2018 07:55:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELsjUaEG0ls4SHK8+XkIUoxMXOret/v3dR35IJUIoPp35pzkCNfkXSMf/Pa796hXqGmOqrGy X-Received: by 2002:a17:902:9898:: with SMTP id s24-v6mr2473974plp.382.1521212153822; Fri, 16 Mar 2018 07:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521212153; cv=none; d=google.com; s=arc-20160816; b=GqI6ktACAAB1smJxhTKqHUhmit8Hvtoij0lb5s6br5gMSlx/MxW5ve6P36gClEkpsE wvhwJYD9cS899QwDiCp2Q8dFqKiatXkmeK3855B0Fglh9TZ3IsrxZVYzN5MCXamwuapU DDcwNY2kpg26YVaWPl8gAOHJ1RpOWBb50iDVctJK0JpGEZTR95ujdIwacz3mBhrf2SCy eyLFjpNA+tkL/PqbF3UQjl/hj6MImtePeJVjvpLcg57Y3Y1yV9eY8aFlgl1Ju9T+Jqi6 666WT6fb4AvBFk2i7pcgYKea4006PPIYTQaSlNp3UpU3lgwgyqalQ/QWqGpAc7rdnvyH DH4A== 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=JzhBR6/bUeJD9OAqxsFm/LuZy4zqHJHZRzOfP+JTx40=; b=gog3LFgHsUi/wGTu4kMv+hig9wQsj+04M8wcIaMch4qzs3vJIus/fQj4tdYiamEV6d K3nCu1gnOTIY40JBDSWOlmb25ldpNPWeV+s0mEFG7R9CDJAc+UivhFgV26C1IG7IJul+ W3s8TTFHEsoP6J0yJ0bHSL2+csaBUT4/dfvCWxuQMKbmLIWd4kMk8xhLXAo8cCBBS0cW sYpEOQTpdgwHs88zaB0HwA6xmErbUOahjXhhRQ8HwshPmaWv1qKk4w2YAp/IGc488i/E sNLWVnmoowArvkYDH1Gyo7Ddi3DtZfZirm2Pg4+GEWvnK9NLbbWlwHb8t13WudRA3ZMV eSQA== 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 t10-v6si6272342ply.86.2018.03.16.07.55.39; Fri, 16 Mar 2018 07:55:53 -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 S1753683AbeCPOyo (ORCPT + 99 others); Fri, 16 Mar 2018 10:54:44 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:59188 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753723AbeCPOyG (ORCPT ); Fri, 16 Mar 2018 10:54:06 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.84_2 #2 (Debian)) id 1ewqk5-0001Nh-FF; Fri, 16 Mar 2018 22:54:01 +0800 Received: from herbert by gondobar with local (Exim 4.84_2) (envelope-from ) id 1ewqjv-0001eh-ER; Fri, 16 Mar 2018 22:53:51 +0800 Date: Fri, 16 Mar 2018 22:53:51 +0800 From: Herbert Xu To: Megha Dey Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, davem@davemloft.net Subject: Re: [PATCH V8 1/5] crypto: Multi-buffer encryption infrastructure support Message-ID: <20180316145351.GA6231@gondor.apana.org.au> References: <1515542948-24041-1-git-send-email-megha.dey@linux.intel.com> <1515542948-24041-2-git-send-email-megha.dey@linux.intel.com> <20180118113905.GA19904@gondor.apana.org.au> <1516322661.2526.3.camel@megha-Z97X-UD7-TH> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516322661.2526.3.camel@megha-Z97X-UD7-TH> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 18, 2018 at 04:44:21PM -0800, Megha Dey wrote: > > > So the mcryptd template is in fact completely superfluous. You > > can remove it and just have all the main encrypt/decrypt functions > > invoke the underlying encrypt/decrypt function directly and achieve > > the same result. > > > > Am I missing something? > > Hi Herbert, > > After discussing with Tim, it seems like the mcryptd is responsible for > queuing up the encrypt requests and dispatching them to the actual > multi-buffer raw algorithm. It also flushes the queue > if we wait too long without new requests coming in to force dispatch of > the requests in queue. > > Its function is analogous to cryptd but it has its own multi-lane twists > so we haven't reused the cryptd interface. I have taken a deeper look and I'm even more convinced now that mcryptd is simply not needed in your current model. The only reason you would need mcryptd is if you need to limit the rate of requests going into the underlying mb algorithm. However, it doesn't do that all. Even though it seems to have a batch size of 10, but because it immediately reschedules itself after the batch runs out, it's essentially just dumping all requests at the underlying algorithm as fast as they're coming in. The underlying algorithm doesn't have need throttling anyway because it'll do the work when the queue is full synchronously. So why not just get rid of mcryptd completely and expose the underlying algorithm as a proper async skcipher/hash? Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt