mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: herbert@gondor.hengli.com.au, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH 3.11-rc1] crypto: Fix boot failure due tomoduledependency.
Date: Wed, 17 Jul 2013 09:46:37 -0700	[thread overview]
Message-ID: <1374079597.22432.314.camel@schen9-DESK> (raw)
In-Reply-To: <201307172052.EJE32506.OFMSFJQOFHtVOL@I-love.SAKURA.ne.jp>

On Wed, 2013-07-17 at 20:52 +0900, Tetsuo Handa wrote:
> Tim Chen wrote:
> > Herbert, seems like modules.dep generator wants explicit
> > 
> > - 	select CRYPTO_CRCT10DIF
> > +	depends on CRYPTO_CRCT10DIF
> > 
> > But it seems to me like it should have known CRC_T10DIF needs
> > CRYPTO_CRCT10DIF when we do 
> > 	select CRYPTO_CRCT10DIF
> > 
> > Your thoughts?
> 
> "select" cannot tell /sbin/depmod that there is dependency, for /sbin/depmod
> calculates dependency by enumerating symbols in each module rather than by
> parsing Kconfig files which depends on "kernel-source_files_installed = y".
> 
> Therefore, I think possible solutions are either
> 
>   (a) built-in the dependent modules
> 
>       # grep crc /lib/modules/3.11.0-rc1+/modules.dep
>       kernel/drivers/scsi/sd_mod.ko: kernel/lib/crc-t10dif.ko
>       kernel/lib/crc-t10dif.ko:

This approach will increase kernel size for those who are not using
t10dif so some people may object.  
BTW, The PCLMULQDQ version does not need to be build in.

> 
> or
> 
>   (b) embed explicit reference to the dependent module's symbols
> 
>       # grep crc /lib/modules/3.11.0-rc1+/modules.dep
>       kernel/arch/x86/crypto/crct10dif-pclmul.ko: kernel/crypto/crct10dif.ko
>       kernel/crypto/crct10dif.ko:
>       kernel/drivers/scsi/sd_mod.ko: kernel/lib/crc-t10dif.ko kernel/arch/x86/crypto/crct10dif-pclmul.ko kernel/crypto/crct10dif.ko
>       kernel/lib/crc-t10dif.ko: kernel/arch/x86/crypto/crct10dif-pclmul.ko kernel/crypto/crct10dif.ko
> 

Your approach is quite complicated.  I think something simpler like the
following will work:

Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
---
diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index fe3428c..27d6be3 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -15,7 +15,8 @@
 #include <linux/init.h>
 #include <crypto/hash.h>
 
-static struct crypto_shash *crct10dif_tfm;
+__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
+static struct crypto_shash *crct10dif_tfm = crc_t10dif_generic;
 
 __u16 crc_t10dif(const unsigned char *buffer, size_t len)
 {



> .
> 
> Two patches ((a) and (b) respectively) follow, but I think patch (b) will not
> work unless additional change
> 
>   static int __init crct10dif_intel_mod_init(void)
>   {
>           if (x86_match_cpu(crct10dif_cpu_id))
>                   return crypto_register_shash(&alg);
>           return 0;
>   }
> 
>   static void __exit crct10dif_intel_mod_fini(void)
>   {
>           if (x86_match_cpu(crct10dif_cpu_id))
>                   crypto_unregister_shash(&alg);
>   }
> 
> is made, for currently crct10dif-pclmul.ko cannot be loaded on
> !X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ) systems.

crct10dif-pclmul.ko should not be loaded if 
X86_FEATURE_PCLMULQDQ is not supported.
The module needs the cpu to have support for PCLMULQDQ.

> 
> ------------------------------------------------------------
> 
> >From d8d9b7c3e5be9c5a6198dac6fe7279ca904343a8 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Wed, 17 Jul 2013 19:45:19 +0900
> Subject: [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency.
> 
> Commit 2d31e518 "crypto: crct10dif - Wrap crc_t10dif function all to use crypto
> transform framework" was added without telling that "crc-t10dif.ko depends on
> crct10dif.ko". This resulted in boot failure because "sd_mod.ko depends on
> crc-t10dif.ko" but "crct10dif.ko is not loaded automatically".
> 
> Fix this by changing crct10dif.ko and crct10dif-pclmul.ko from "tristate" to
> "bool" so that suitable version is chosen.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
>  crypto/Kconfig |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index 69ce573..dd3b79e 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -377,7 +377,7 @@ config CRYPTO_CRC32_PCLMUL
>  	  and gain better performance as compared with the table implementation.
>  
>  config CRYPTO_CRCT10DIF
> -	tristate "CRCT10DIF algorithm"
> +	bool "CRCT10DIF algorithm"
>  	select CRYPTO_HASH
>  	help
>  	  CRC T10 Data Integrity Field computation is being cast as
> @@ -385,7 +385,7 @@ config CRYPTO_CRCT10DIF
>  	  transforms to be used if they are available.
>  
>  config CRYPTO_CRCT10DIF_PCLMUL
> -	tristate "CRCT10DIF PCLMULQDQ hardware acceleration"
> +	bool "CRCT10DIF PCLMULQDQ hardware acceleration"

This is not necessary.  Keep it as tristate.

>  	depends on X86 && 64BIT && CRC_T10DIF
>  	select CRYPTO_HASH
>  	help
> -- 
> 1.7.1
> 
> ------------------------------------------------------------
> 
> >From 153e209fc9a7e1df42555829c396ee9ed53e83d0 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Wed, 17 Jul 2013 20:23:15 +0900
> Subject: [PATCH] [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency.
> 
> Commit 2d31e518 "crypto: crct10dif - Wrap crc_t10dif function all to use crypto
> transform framework" was added without telling that "crc-t10dif.ko depends on
> crct10dif.ko". This resulted in boot failure because "sd_mod.ko depends on
> crc-t10dif.ko" but "crct10dif.ko is not loaded automatically".
> 
> Fix this by describing "crc-t10dif.ko depends on crct10dif.ko".
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
>  arch/x86/crypto/crct10dif-pclmul_glue.c |    6 ++++++
>  lib/crc-t10dif.c                        |    7 +++++++
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c
> index 7845d7f..2964608 100644
> --- a/arch/x86/crypto/crct10dif-pclmul_glue.c
> +++ b/arch/x86/crypto/crct10dif-pclmul_glue.c
> @@ -149,3 +149,9 @@ MODULE_LICENSE("GPL");
>  
>  MODULE_ALIAS("crct10dif");
>  MODULE_ALIAS("crct10dif-pclmul");
> +
> +/* Dummy for describing module dependency. */
> +#if defined(CONFIG_CRYPTO_CRCT10DIF_PCLMUL_MODULE)
> +const char crct10dif_pclmul;
> +EXPORT_SYMBOL(crct10dif_pclmul);
> +#endif
> diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
> index fe3428c..376f795 100644
> --- a/lib/crc-t10dif.c
> +++ b/lib/crc-t10dif.c
> @@ -38,6 +38,13 @@ EXPORT_SYMBOL(crc_t10dif);
>  
>  static int __init crc_t10dif_mod_init(void)
>  {
> +	/* Dummy for describing module dependency. */
> +#if defined(CONFIG_CRYPTO_CRCT10DIF_PCLMUL_MODULE)
> +	extern const char crct10dif_pclmul;
> +	crc_t10dif_generic(crct10dif_pclmul, NULL, 0);
> +#elif defined(CONFIG_CRYPTO_CRCT10DIF_MODULE)
> +	crc_t10dif_generic(0, NULL, 0);
> +#endif
>  	crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0);
>  	return PTR_RET(crct10dif_tfm);
>  }




  reply	other threads:[~2013-07-17 16:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 11:53 [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency Tetsuo Handa
2013-07-16 11:55 ` Herbert Xu
2013-07-16 13:49   ` [PATCH 3.11-rc1] crypto: Fix boot failure due to moduledependency Tetsuo Handa
2013-07-16 16:23     ` Tim Chen
2013-07-17 11:52       ` [PATCH 3.11-rc1] crypto: Fix boot failure due tomoduledependency Tetsuo Handa
2013-07-17 16:46         ` Tim Chen [this message]
2013-07-17 20:50           ` [PATCH 3.11-rc1] crypto: Fix boot failure duetomoduledependency Tetsuo Handa
2013-07-17 21:53             ` Tim Chen
2013-07-17 22:08             ` Tim Chen
2013-07-18  3:47               ` [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency Tetsuo Handa
2013-07-18 21:00                 ` Tim Chen
2013-07-18 22:17                   ` Rafael J. Wysocki
2013-07-18 23:08                     ` Tim Chen
2013-07-19 13:03                       ` Rafael J. Wysocki
2013-07-19 14:49                         ` Rafael J. Wysocki
2013-07-19 18:08                           ` Tim Chen
2013-07-19 21:38                             ` Rafael J. Wysocki
2013-07-19 23:16                               ` Greg Kroah-Hartman
2013-07-19 23:21                                 ` H. Peter Anvin
2013-07-19 23:24                                   ` Herbert Xu
2013-07-19 23:37                                     ` Tim Chen
2013-07-20  1:31                                       ` Tim Chen
2013-07-20  2:19                                         ` [PATCH 3.11-rc1] crypto: Fix boot failure due to moduledependency Tetsuo Handa
2013-07-20  5:30                                         ` [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency Herbert Xu
2013-07-20  5:56                                           ` [PATCH 3.11-rc1] crypto: Fix boot failure due to moduledependency Tetsuo Handa
2013-09-11 11:43                                             ` [3.12-rc1] Dependency on module-init-tools >= 3.11 ? Tetsuo Handa
2013-09-12  4:26                                               ` Herbert Xu
2013-09-12  5:03                                                 ` Tetsuo Handa
2013-09-12  5:28                                                   ` Herbert Xu
2013-09-12 10:20                                                     ` Tetsuo Handa
2013-09-12 10:29                                                       ` Herbert Xu
2013-09-12 14:26                                                         ` Waiman Long
2013-09-13 13:27                                                           ` Tetsuo Handa
2013-09-12 11:12                                                 ` Arthur Marsh
2013-07-19 23:26                                   ` [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency Greg Kroah-Hartman
2013-07-19 23:28                                     ` H. Peter Anvin
2013-07-20  0:00                                 ` Rafael J. Wysocki
2013-07-20  3:06                                   ` Rafael J. Wysocki
2013-07-20  9:51                                     ` Rafael J. Wysocki
2013-07-20 11:01                                       ` Rafael J. Wysocki
2013-07-18 23:44                     ` H. Peter Anvin
2013-07-19 12:57                       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374079597.22432.314.camel@schen9-DESK \
    --to=tim.c.chen@linux.intel.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®