From: Tim Chen <tim.c.chen@linux.intel.com> To: Herbert Xu <herbert@gondor.apana.org.au> Cc: "H. Peter Anvin" <hpa@zytor.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, ak <ak@linux.intel.com>, ACPI Devel Maling List <linux-acpi@vger.kernel.org> Subject: Re: [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency. Date: Fri, 19 Jul 2013 18:31:04 -0700 [thread overview] Message-ID: <1374283864.22432.393.camel@schen9-DESK> (raw) In-Reply-To: <1374277033.22432.384.camel@schen9-DESK> On Fri, 2013-07-19 at 16:37 -0700, Tim Chen wrote: > On Sat, 2013-07-20 at 09:24 +1000, Herbert Xu wrote: > > On Fri, Jul 19, 2013 at 04:21:09PM -0700, H. Peter Anvin wrote: > > > > > > The issue here seems to be the dynamic binding nature of the crypto > > > subsystem. When something needs crypto, it will request the appropriate > > > crypto module (e.g. crct10dif), which may race with detecting a specific > > > hardware accelerator based on CPUID or device information (e.g. > > > crct10dif_pclmul). > > > > > > RAID has effectively the same issue, and we just "solved" it by > > > compiling in all the accelerators into the top-level module. > > > > I think for crypto the simplest solution is to not do CPUID-based > > loading. Then crypto users will simply load the module alias which > > causes modprobe to load all modules providing that alias. > > > > Cheers, > > Herbert, > > I've tried the module alias approach (see my earlier mail with patch) > but it didn't seem to load things properly. Can you check to see if > there's anything I did incorrectly. > > Tim I fixed a missing request_module statement in crct10dif library. So now things work if I have the following config: CONFIG_CRYPTO_CRCT10DIF=m CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m CONFIG_CRC_T10DIF=m However, when I have the library and generic algorithm compiled in, I do not see the PCLMULQDQ version loaded. CONFIG_CRYPTO_CRCT10DIF=y CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m CONFIG_CRC_T10DIF=y Perhaps I am initiating the crct10dif library at a really early stage when things are compiled in, where the module is not in initramfs? In that case, perhaps we should only allow PCLMUL version to be compiled in and not exist as a module? Here's the patch I tried: Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> --- arch/x86/crypto/crct10dif-pclmul_glue.c | 8 +------- crypto/Makefile | 2 +- crypto/{crct10dif.c => crct10dif_generic.c} | 1 + lib/crc-t10dif.c | 1 + 4 files changed, 4 insertions(+), 8 deletions(-) rename crypto/{crct10dif.c => crct10dif_generic.c} (99%) diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c index 7845d7f..7ad5f09 100644 --- a/arch/x86/crypto/crct10dif-pclmul_glue.c +++ b/arch/x86/crypto/crct10dif-pclmul_glue.c @@ -121,15 +121,9 @@ static struct shash_alg alg = { } }; -static const struct x86_cpu_id crct10dif_cpu_id[] = { - X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ), - {} -}; -MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id); - static int __init crct10dif_intel_mod_init(void) { - if (!x86_match_cpu(crct10dif_cpu_id)) + if (!cpu_has_pclmulqdq) return -ENODEV; return crypto_register_shash(&alg); diff --git a/crypto/Makefile b/crypto/Makefile index 2d5ed08..3fd76fa 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -83,7 +83,7 @@ obj-$(CONFIG_CRYPTO_ZLIB) += zlib.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o obj-$(CONFIG_CRYPTO_CRC32) += crc32.o -obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif.o +obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o obj-$(CONFIG_CRYPTO_LZ4) += lz4.o diff --git a/crypto/crct10dif.c b/crypto/crct10dif_generic.c similarity index 99% rename from crypto/crct10dif.c rename to crypto/crct10dif_generic.c index 92aca96..c960a95 100644 --- a/crypto/crct10dif.c +++ b/crypto/crct10dif_generic.c @@ -176,3 +176,4 @@ module_exit(crct10dif_mod_fini); MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); MODULE_DESCRIPTION("T10 DIF CRC calculation."); MODULE_LICENSE("GPL"); +MODULE_ALIAS("crct10dif"); diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index fe3428c..d8cd353 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c @@ -38,6 +38,7 @@ EXPORT_SYMBOL(crc_t10dif); static int __init crc_t10dif_mod_init(void) { + request_module("crct10dif"); crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); return PTR_RET(crct10dif_tfm); } -- 1.7.11.7
WARNING: multiple messages have this Message-ID (diff)
From: Tim Chen <tim.c.chen@linux.intel.com> To: Herbert Xu <herbert@gondor.hengli.com.au> Cc: "H. Peter Anvin" <hpa@zytor.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, ak <ak@linux.intel.com>, ACPI Devel Maling List <linux-acpi@vger.kernel.org> Subject: Re: [PATCH 3.11-rc1] crypto: Fix boot failure due to module dependency. Date: Fri, 19 Jul 2013 18:31:04 -0700 [thread overview] Message-ID: <1374283864.22432.393.camel@schen9-DESK> (raw) In-Reply-To: <1374277033.22432.384.camel@schen9-DESK> On Fri, 2013-07-19 at 16:37 -0700, Tim Chen wrote: > On Sat, 2013-07-20 at 09:24 +1000, Herbert Xu wrote: > > On Fri, Jul 19, 2013 at 04:21:09PM -0700, H. Peter Anvin wrote: > > > > > > The issue here seems to be the dynamic binding nature of the crypto > > > subsystem. When something needs crypto, it will request the appropriate > > > crypto module (e.g. crct10dif), which may race with detecting a specific > > > hardware accelerator based on CPUID or device information (e.g. > > > crct10dif_pclmul). > > > > > > RAID has effectively the same issue, and we just "solved" it by > > > compiling in all the accelerators into the top-level module. > > > > I think for crypto the simplest solution is to not do CPUID-based > > loading. Then crypto users will simply load the module alias which > > causes modprobe to load all modules providing that alias. > > > > Cheers, > > Herbert, > > I've tried the module alias approach (see my earlier mail with patch) > but it didn't seem to load things properly. Can you check to see if > there's anything I did incorrectly. > > Tim I fixed a missing request_module statement in crct10dif library. So now things work if I have the following config: CONFIG_CRYPTO_CRCT10DIF=m CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m CONFIG_CRC_T10DIF=m However, when I have the library and generic algorithm compiled in, I do not see the PCLMULQDQ version loaded. CONFIG_CRYPTO_CRCT10DIF=y CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m CONFIG_CRC_T10DIF=y Perhaps I am initiating the crct10dif library at a really early stage when things are compiled in, where the module is not in initramfs? In that case, perhaps we should only allow PCLMUL version to be compiled in and not exist as a module? Here's the patch I tried: Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> --- arch/x86/crypto/crct10dif-pclmul_glue.c | 8 +------- crypto/Makefile | 2 +- crypto/{crct10dif.c => crct10dif_generic.c} | 1 + lib/crc-t10dif.c | 1 + 4 files changed, 4 insertions(+), 8 deletions(-) rename crypto/{crct10dif.c => crct10dif_generic.c} (99%) diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c index 7845d7f..7ad5f09 100644 --- a/arch/x86/crypto/crct10dif-pclmul_glue.c +++ b/arch/x86/crypto/crct10dif-pclmul_glue.c @@ -121,15 +121,9 @@ static struct shash_alg alg = { } }; -static const struct x86_cpu_id crct10dif_cpu_id[] = { - X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ), - {} -}; -MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id); - static int __init crct10dif_intel_mod_init(void) { - if (!x86_match_cpu(crct10dif_cpu_id)) + if (!cpu_has_pclmulqdq) return -ENODEV; return crypto_register_shash(&alg); diff --git a/crypto/Makefile b/crypto/Makefile index 2d5ed08..3fd76fa 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -83,7 +83,7 @@ obj-$(CONFIG_CRYPTO_ZLIB) += zlib.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o obj-$(CONFIG_CRYPTO_CRC32) += crc32.o -obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif.o +obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o obj-$(CONFIG_CRYPTO_LZ4) += lz4.o diff --git a/crypto/crct10dif.c b/crypto/crct10dif_generic.c similarity index 99% rename from crypto/crct10dif.c rename to crypto/crct10dif_generic.c index 92aca96..c960a95 100644 --- a/crypto/crct10dif.c +++ b/crypto/crct10dif_generic.c @@ -176,3 +176,4 @@ module_exit(crct10dif_mod_fini); MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>"); MODULE_DESCRIPTION("T10 DIF CRC calculation."); MODULE_LICENSE("GPL"); +MODULE_ALIAS("crct10dif"); diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index fe3428c..d8cd353 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c @@ -38,6 +38,7 @@ EXPORT_SYMBOL(crc_t10dif); static int __init crc_t10dif_mod_init(void) { + request_module("crct10dif"); crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); return PTR_RET(crct10dif_tfm); } -- 1.7.11.7
next prev parent reply other threads:[~2013-07-20 1:31 UTC|newest] Thread overview: 72+ 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-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 11:52 ` Tetsuo Handa 2013-07-17 16:46 ` Tim Chen 2013-07-17 16:46 ` Tim Chen 2013-07-17 20:50 ` [PATCH 3.11-rc1] crypto: Fix boot failure duetomoduledependency Tetsuo Handa 2013-07-17 20:50 ` Tetsuo Handa 2013-07-17 21:53 ` Tim Chen 2013-07-17 21:53 ` Tim Chen 2013-07-17 22:08 ` 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 3:47 ` Tetsuo Handa 2013-07-18 21:00 ` Tim Chen 2013-07-18 21:00 ` Tim Chen 2013-07-18 22:17 ` Rafael J. Wysocki 2013-07-18 22:17 ` Rafael J. Wysocki 2013-07-18 23:08 ` Tim Chen 2013-07-18 23:08 ` Tim Chen 2013-07-19 13:03 ` Rafael J. Wysocki 2013-07-19 13:03 ` Rafael J. Wysocki 2013-07-19 14:49 ` Rafael J. Wysocki 2013-07-19 14:49 ` Rafael J. Wysocki 2013-07-19 18:08 ` Tim Chen 2013-07-19 18:08 ` Tim Chen 2013-07-19 21:38 ` Rafael J. Wysocki 2013-07-19 21:38 ` Rafael J. Wysocki 2013-07-19 23:16 ` Greg Kroah-Hartman 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:24 ` Herbert Xu 2013-07-19 23:37 ` Tim Chen 2013-07-19 23:37 ` Tim Chen 2013-07-20 1:31 ` Tim Chen [this message] 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 2:19 ` 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:30 ` Herbert Xu 2013-07-20 5:56 ` [PATCH 3.11-rc1] crypto: Fix boot failure due to moduledependency Tetsuo Handa 2013-07-20 5:56 ` 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 5:28 ` Herbert Xu 2013-09-12 10:20 ` Tetsuo Handa 2013-09-12 10:20 ` Tetsuo Handa 2013-09-12 10:29 ` Herbert Xu 2013-09-12 10:29 ` Herbert Xu 2013-09-12 14:26 ` Waiman Long 2013-09-12 14:26 ` Waiman Long 2013-09-13 13:27 ` Tetsuo Handa 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 0:00 ` Rafael J. Wysocki 2013-07-20 3:06 ` Rafael J. Wysocki 2013-07-20 3:06 ` Rafael J. Wysocki 2013-07-20 9:51 ` Rafael J. Wysocki 2013-07-20 9:51 ` Rafael J. Wysocki 2013-07-20 11:01 ` 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=1374283864.22432.393.camel@schen9-DESK \ --to=tim.c.chen@linux.intel.com \ --cc=ak@linux.intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=herbert@gondor.apana.org.au \ --cc=hpa@zytor.com \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=penguin-kernel@i-love.sakura.ne.jp \ --cc=rafael.j.wysocki@intel.com \ --cc=rjw@rjwysocki.net \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.