Message ID | 1374283864.22432.393.camel@schen9-DESK (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Tim Chen wrote: > On Fri, 2013-07-19 at 16:37 -0700, Tim Chen wrote: > > 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? I think that use of request_module("crct10dif") does not help loading crct10dif-pclmul.ko when CONFIG_CRC_T10DIF=y CONFIG_CRYPTO_CRCT10DIF_PCLMUL=m , for there is no / directory (note that the initramfs is not yet mounted as / for loading modules which are not in vmlinux) when any module_init() functions which are in vmlinux are called. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jul 19, 2013 at 06:31:04PM -0700, Tim Chen wrote: > > 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 That is completely expected. I don't really think we need to do anything about this case. After all, if the admin wants to use the optimised version for CRC_T10DIF then they could simply compile that in as well. Cheers,
Herbert Xu wrote: > On Fri, Jul 19, 2013 at 06:31:04PM -0700, Tim Chen wrote: > > > > 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 > > That is completely expected. I don't really think we need to > do anything about this case. After all, if the admin wants to > use the optimised version for CRC_T10DIF then they could simply > compile that in as well. > Wow! ;-) But I'd expect something like static int __init crc_t10dif_mod_init(void) { +#if !defined(CONFIG_CRC_T10DIF_MODULE) && defined(CONFIG_CRYPTO_CRCT10DIF_PCLMUL_MODULE) + printk(KERN_WARNING "Consider CONFIG_CRYPTO_CRCT10DIF_PCLMUL=y for better performance\n"); +#endif crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0); return PTR_RET(crct10dif_tfm); } because the admin might not be aware of this implication. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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); }