crypto: aes-generic - fix aes-generic regression on powerpc
Subsystems (2)
PATCH v2 1/1 crypto: aes-generic - fix aes-generic regression on powerpc
My last bugfix added -Os on the command line, which unfortunately caused a build regression on powerpc in some configurations.
I've done some more analysis of the original problem and found slightly different workaround that avoids this regression and also results in better performance on gcc-7.0: -fcode-hoisting is an optimization step that got added in gcc-7 and that for all gcc-7 versions causes worse performance.
This disables -fcode-hoisting on all compilers that understand the option. For gcc-7.1 and 7.2 I found the same performance as my previous patch (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no change in performance from this patch. In theory, code hoisting should not be able make things better for the AES cipher, so leaving it disabled for gcc-8 only serves to simplify the Makefile change.
---
v2: fix a typo in the Makefile
--- crypto/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/Makefile +1 -1
@@ -99,7 +99,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 obj-$(CONFIG_CRYPTO_AES) += aes_generic.o -CFLAGS_aes_generic.o := $(call cc-ifversion, -ge, 0701, -Os) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 +CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
Signature · 1 line
2.9.0
Quoted 16 lines · Arnd Bergmann
My last bugfix added -Os on the command line, which unfortunately caused a build regression on powerpc in some configurations.
I've done some more analysis of the original problem and found slightly different workaround that avoids this regression and also results in better performance on gcc-7.0: -fcode-hoisting is an optimization step that got added in gcc-7 and that for all gcc-7 versions causes worse performance.
This disables -fcode-hoisting on all compilers that understand the option. For gcc-7.1 and 7.2 I found the same performance as my previous patch (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no change in performance from this patch. In theory, code hoisting should not be able make things better for the AES cipher, so leaving it disabled for gcc-8 only serves to simplify the
Makefilechange.
Quoted 6 lines
Reported-by kbuild test robot <[email protected]>Fixes 148b974deea9 ("crypto: aes-generic - build with -Os on gcc-7+")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 22 lines
---
v2: fix a typo in theMakefile--- crypto/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)crypto/Makefile +1
-2@@ -99,7 +99,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 obj-$(CONFIG_CRYPTO_AES) += aes_generic.o -CFLAGS_aes_generic.o := $(call cc-ifversion, -ge, 0701, -Os) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 +CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o --2.9.0
Herbert Xu
maintainerQuoted 16 lines · Arnd Bergmann
My last bugfix added -Os on the command line, which unfortunately caused a build regression on powerpc in some configurations.
I've done some more analysis of the original problem and found slightly different workaround that avoids this regression and also results in better performance on gcc-7.0: -fcode-hoisting is an optimization step that got added in gcc-7 and that for all gcc-7 versions causes worse performance.
This disables -fcode-hoisting on all compilers that understand the option. For gcc-7.1 and 7.2 I found the same performance as my previous patch (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no change in performance from this patch. In theory, code hoisting should not be able make things better for the AES cipher, so leaving it disabled for gcc-8 only serves to simplify the
Makefilechange.
Quoted 6 lines
Reported-by kbuild test robot <[email protected]>Fixes 148b974deea9 ("crypto: aes-generic - build with -Os on gcc-7+")Signed-off-by Arnd Bergmann <[email protected]>
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 17 lines · Herbert Xu
Quoted 16 lines · Arnd Bergmann
My last bugfix added -Os on the command line, which unfortunately caused a build regression on powerpc in some configurations.
I've done some more analysis of the original problem and found slightly different workaround that avoids this regression and also results in better performance on gcc-7.0: -fcode-hoisting is an optimization step that got added in gcc-7 and that for all gcc-7 versions causes worse performance.
This disables -fcode-hoisting on all compilers that understand the option. For gcc-7.1 and 7.2 I found the same performance as my previous patch (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no change in performance from this patch. In theory, code hoisting should not be able make things better for the AES cipher, so leaving it disabled for gcc-8 only serves to simplify the
Makefilechange.
Quoted 9 lines
Quoted 6 lines
Reported-by kbuild test robot <[email protected]>Fixes 148b974deea9 ("crypto: aes-generic - build with -Os on gcc-7+")Signed-off-by Arnd Bergmann <[email protected]>Patch applied. Thanks.
This fix ("commit 6e36719fbe90213fbba9f50093fa2d4d69b0e93c upstream") is needed also in 4.14.y stable tree, since it contains commit7cae67e31292 ("crypto: aes-generic - build with -Os on gcc-7+")
Compilation fails without it:crypto/aes_generic.o: In function `crypto_aes_set_key':crypto/aes_generic.c:1300: undefined reference to `_restgpr_31_x'
Thanks,
Horia
Greg Kroah-Hartman
maintainerQuoted 27 lines · Horia Geanta
Quoted 17 lines · Herbert Xu
Quoted 16 lines · Arnd Bergmann
My last bugfix added -Os on the command line, which unfortunately caused a build regression on powerpc in some configurations.
I've done some more analysis of the original problem and found slightly different workaround that avoids this regression and also results in better performance on gcc-7.0: -fcode-hoisting is an optimization step that got added in gcc-7 and that for all gcc-7 versions causes worse performance.
This disables -fcode-hoisting on all compilers that understand the option. For gcc-7.1 and 7.2 I found the same performance as my previous patch (using -Os), in gcc-7.0 it was even better. On gcc-8 I could see no change in performance from this patch. In theory, code hoisting should not be able make things better for the AES cipher, so leaving it disabled for gcc-8 only serves to simplify the
Makefilechange.Quoted 9 lines
Quoted 6 lines
Reported-by kbuild test robot <[email protected]>Fixes 148b974deea9 ("crypto: aes-generic - build with -Os on gcc-7+")Signed-off-by Arnd Bergmann <[email protected]>Patch applied. Thanks.
Quoted 7 lines
This fix ("commit
6e36719fbe90213fbba9f50093fa2d4d69b0e93cupstream") is needed also in 4.14.y stable tree, since it contains commit7cae67e31292("crypto: aes-generic - build with -Os on gcc-7+")Compilation fails without it:
crypto/aes_generic.o: In function `crypto_aes_set_key':crypto/aes_generic.c:1300: undefined reference to `_restgpr_31_x'
Thanks for letting me know, now queued up.
greg k-h