Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp205345imm; Thu, 26 Jul 2018 17:07:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcShSk4leOLpGAR7FkXxy3Nf3jq6oxgj0orFZsQnElww7GsAeYxWCohb0/68xrLSiWMzFR1 X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr3830484plb.189.1532650077043; Thu, 26 Jul 2018 17:07:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532650077; cv=none; d=google.com; s=arc-20160816; b=XSvea0vvtM+/pD1KmBZGIEYccWttrJ2t6r38Q3xanaIACCwGZVgZh2QkUT3rpByjOj w/GT+JPjs8NE39Fc9DEx/SRIF7owoptpK36DI+PWvIApodU8uLLWD9zXOKdbysRRwW7S VE4e34h1GPjaOZ2t9VzBYjBiP7CJX95YJiy4J6oIPv+Dw7HTCzE96OSU5R36bBB7nA3F mh7VKjNjwHOrqRvSRBoX3v/8v7Ax/1tDQ9RyoOambz563G8p4l6IpE3j00Q3rh+0FUQH 2y0MKP0NugyLmQaYH2xKrZMuoKlHIeP3v0UVMnwKHoZ8TN89dW1vNE1vf0b5AnZN3QSB IUfw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=mQZIl+IW/KfYKpgzg3JV1vE3X1840IMLI2hpcenjboc=; b=aJwz1ymXCTeLkVhmBp7vlQBU5UdzbI3t8wHDr6UsicA2gtuIEuK5sohkuX1SdOhKdD 2fdlbsRswG/x2viDgWFLwbHvFfEUAv9JM0Qd9BgApe3SeNX1MqzVxpW7CvRLKD65tPRz q7a7UNSt9K6jUD3umlJdALylMQYZf8TbOYYZLtr+le8EovpSrpWeF8TU+D9dH2623F6+ nLAoRsP3k3los1raGnVGYogNAqGt4cWY7ODCV4Tvf1CmTfMuB7dQudeZy1enUrT3EKzJ UnfojxEHNvQzlG242JA4/F5RJfHABsT3wxZW9zvslQC+NYnecbGgftByZCPlvOcpJDhW uKsw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si2347844ple.262.2018.07.26.17.07.39; Thu, 26 Jul 2018 17:07:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732071AbeG0BYt (ORCPT + 99 others); Thu, 26 Jul 2018 21:24:49 -0400 Received: from mga01.intel.com ([192.55.52.88]:53525 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731630AbeG0BYt (ORCPT ); Thu, 26 Jul 2018 21:24:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2018 17:05:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,407,1526367600"; d="scan'208";a="60168243" Received: from megha-z97x-ud7-th.sc.intel.com (HELO [143.183.85.162]) ([143.183.85.162]) by orsmga008.jf.intel.com with ESMTP; 26 Jul 2018 17:05:39 -0700 Message-ID: <1532651107.19157.24.camel@megha-Z97X-UD7-TH> Subject: Re: [RFC] crypto: Remove mcryptd From: Megha Dey To: Herbert Xu Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Date: Thu, 26 Jul 2018 17:25:07 -0700 In-Reply-To: <20180720035325.m5tzeuqsfej3y6wd@gondor.apana.org.au> References: <1526089453-6542-1-git-send-email-megha.dey@linux.intel.com> <20180720035325.m5tzeuqsfej3y6wd@gondor.apana.org.au> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-20 at 11:53 +0800, Herbert Xu wrote: > On Fri, May 11, 2018 at 06:44:13PM -0700, Megha Dey wrote: > > > > +static struct ahash_alg *simd_ahash_create_compat(const char *algname, > > + const char *drvname, > > + const char *basename) > > +{ > > + struct ahash_alg *alg; > > + struct ahash_alg *ialg; > > + int err; > > I think there has been a misunderstsanding. You're not actually > using the simd wrapper here. All you're doing is creating a function > with the word simd in its name. In all other respects this is just > exposing the underlying algorithm to users directly, which cannot > work because the underlying algorithm requires SIMD. Hi Herbert, Thanks for the feedback. I still have some questions though: 1. On the existing algorithms covered in aesni_intel-glue.c (eg: __cbc-aes-aesni), 3 algorithms are registered in /proc/crypto: __cbc(aes) cryptd(__cbc-aes-aesni)--> registered via cryptd_create_skcipher cbc(aes) cbc-aes-aesni --> registered via simd_skcipher_create_compat __cbc(aes) __cbc-aes-aesni --> registered as the internal algorithm I would want to know why do we need the cryptd(__cbc-aes-aesni) algorithm at all. I do not see any of the associated setkey, encrypt or decrypt functions getting called during the selftest or while running tcrypt. I just see the simd_(setkey, encrypt, decrypt) functions directly called the inner algorithms. However, if I remove the cryptd algorithm, none of the algorithms are registered. > > What you need to do is create an actual simd wrapper with cryptd This simd wrapper is already present for skcipher right(in simd.c)? Assuming we only have ciphers and no hash algorithms, are any changes required in these wrappers? Pseudo code: 1. Register inner algorithm (cbc-aes-aesni-mb) in aes_cbc_mb_mod_init() 2. Register outer algorithm with the mcryptd- prefix for the driver name using the simd_skcipher_create_compat(mcryptd-cbc-aes-aesni-mb) 3. tcrypt/testmanager calls the crypto_skcipher_encrypt->simd_skcipher_encrypt->mb_cbc_aes_encrypt 4. Shift helper functions which help flush outstanding jobs to glue layer. 5. Delete mcryptd.c 6. All similar simd wrapper for hash algorithms. > and all the functions that may do SIMD work needs to invoke cryptd > if may_use_simd() (and other conditions) is false. > > This wrapper should live in crypto/simd.c. > > Cheers,