x86/raid6: correctly check for assembler capabilities
PATCH 1/1 x86/raid6: correctly check for assembler capabilities
Just like for AVX2 (which simply needs an #if -> #ifdef conversion), SSSE3 assembler support should be checked for before using it.
--- arch/x86/Makefile | 1 + lib/raid6/algos.c | 2 +- lib/raid6/recov_avx2.c | 2 +- lib/raid6/recov_ssse3.c | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-)
arch/x86/Makefile +1 -0
@@ -148,6 +148,7 @@ cfi-sections := $(call as-instr,.cfi_sec # does binutils support specific instructions? asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) +asinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1) asinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1) avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)
lib/raid6/algos.c +1 -1
@@ -89,10 +89,10 @@ void (*raid6_datap_recov)(int, size_t, iEXPORT_SYMBOL_GPL (raid6_datap_recov);const struct raid6_recov_calls *const raid6_recov_algos[] = { -#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) #ifdef CONFIG_AS_AVX2 &raid6_recov_avx2, #endif +#ifdef CONFIG_AS_SSSE3 &raid6_recov_ssse3, #endif &raid6_recov_intx1,
lib/raid6/recov_avx2.c +1 -1
@@ -8,7 +8,7 @@* of the License. */ -#if CONFIG_AS_AVX2 +#ifdef CONFIG_AS_AVX2 #include <linux/raid/pq.h> #include "x86.h"
lib/raid6/recov_ssse3.c +6 -0
@@ -7,6 +7,8 @@* of the License. */ +#ifdef CONFIG_AS_SSSE3 +#include <linux/raid/pq.h> #include "x86.h"
@@ -330,3 +332,7 @@ const struct raid6_recov_calls raid6_rec#endif .priority = 1, }; + +#else +#warning "your version of binutils lacks SSSE3 support" +#endif
Quoted 8 lines · Jan Beulich
Just like for AVX2 (which simply needs an #if -> #ifdef conversion), SSSE3 assembler support should be checked for before using it.
Signed-off-by Jan Beulich <[email protected]>Cc Jim Kukunas <[email protected]>Cc Neil Brown <[email protected]>--- arch/x86/Makefile | 1 +
For the x86 part:
This should go through the raid tree.
Quoted 11 lines · On Fri, 23 Jan 2015 17:16:59 +0100 (CET) Thomas Gleixner <[email protected]>…
Quoted 8 lines · Jan Beulich
Just like for AVX2 (which simply needs an #if -> #ifdef conversion), SSSE3 assembler support should be checked for before using it.
Signed-off-by Jan Beulich <[email protected]>Cc Jim Kukunas <[email protected]>Cc Neil Brown <[email protected]>--- arch/x86/Makefile | 1 +
Quoted 5 lines
For the x86 part:
Acked-by Thomas Gleixner <[email protected]>This should go through the raid tree.
Thanks. Applied to the raid tree.
NeilBrown
Quoted 6 lines · Jan Beulich
Just like for AVX2 (which simply needs an #if -> #ifdef conversion), SSSE3 assembler support should be checked for before using it.
Signed-off-by Jan Beulich <[email protected]>Cc Jim Kukunas <[email protected]>Cc Neil Brown <[email protected]>
This patch became commit be46ac86a81b ("x86/raid6: correctly check for assembler capabilities") in today's linux-next (ie, next-20150203). I noticed because a script I use to check linux-next spotted a potential problem with it.
Quoted 10 lines
--- arch/x86/Makefile | 1 + lib/raid6/algos.c | 2 +- lib/raid6/recov_avx2.c | 2 +- lib/raid6/recov_ssse3.c | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-)
arch/x86/Makefile cfi-sections := $(call as-instr,.cfi_sec · line 151
Quoted 4 lines
arch/x86/Makefile +1
-0@@ -148,6 +148,7 @@ cfi-sections := $(call as-instr,.cfi_sec # does binutils support specific instructions? asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) +asinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1)
This Makefile defines a preprocessor macro with a CONFIG_ prefix. Almost all macros with that prefix are defined through the kconfig system. A handful, like CONFIG_AS_SSSE3 and a few other macros defined in this Makefile, are not. Apparently this is a pet peeve I share with few people, but would any other prefix than CONFIG_ work for you too?
arch/x86/Makefile cfi-sections := $(call as-instr,.cfi_sec · line 154
Quoted 3 lines
arch/x86/Makefile +0
-0asinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1) avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)
Paul Bolle
Quoted 24 lines · On Tue, 03 Feb 2015 21:31:30 +0100 Paul Bolle <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Just like for AVX2 (which simply needs an #if -> #ifdef conversion), SSSE3 assembler support should be checked for before using it.
Signed-off-by Jan Beulich <[email protected]>Cc Jim Kukunas <[email protected]>Cc Neil Brown <[email protected]>This patch became commit
be46ac86a81b("x86/raid6: correctly check for assembler capabilities") in today's linux-next (ie, next-20150203). I noticed because a script I use to check linux-next spotted a potential problem with it.Quoted 11 lines
--- arch/x86/Makefile | 1 + lib/raid6/algos.c | 2 +- lib/raid6/recov_avx2.c | 2 +- lib/raid6/recov_ssse3.c | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-)arch/x86/Makefile +0
-0@@ -148,6 +148,7 @@ cfi-sections := $(call as-instr,.cfi_sec
Quoted 9 lines
arch/x86/Makefile cfi-sections := $(call as-instr,.cfi_sec · line 151
Quoted 3 lines
arch/x86/Makefile +1
-0# does binutils support specific instructions? asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) +asinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1)This
Makefiledefines a preprocessor macro with aCONFIG_prefix. Almost all macros with that prefix are defined through the kconfig system. A handful, likeCONFIG_AS_SSSE3and a few other macros defined in thisMakefile, are not. Apparently this is a pet peeve I share with few people, but would any other prefix thanCONFIG_work for you too?
Actually the prefix of this macro is "CONFIG_AS_", not "CONFIG_" :-) CONFIG_AS_ is reserved for assembly magic, and is never used by the the kconfig system.
(Well..... I might have made bits of that up, but "git grep 'config AS_'" doesn't find anything).
NeilBrown
Quoted 7 lines
arch/x86/Makefile cfi-sections := $(call as-instr,.cfi_sec · line 154
Quoted 4 lines
arch/x86/Makefile +0
-0asinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1) avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)Paul Bolle
Quoted 6 lines · NeilBrown
Actually the prefix of this macro is "
CONFIG_AS_", not "CONFIG_" :-)CONFIG_AS_is reserved for assembly magic, and is never used by the the kconfig system.(Well..... I might have made bits of that up, but "git grep 'config
AS_'" doesn't find anything).
That's correct, there are no Kconfig symbols starting with AS_. But still, I would like to hear whether there's a reasonable chance I might convince other people to adopt my peeve.
The thinking behind that peeve is, basically, that where people encounter a CONFIG_* macro they should only have to check the .config file to see how that macro was evaluated in the build that was used.
Thanks,
Paul Bolle
Quoted 8 lines · On Tue, 03 Feb 2015 22:03:35 +0100 Paul Bolle <[email protected]> wrote:
Quoted 6 lines · NeilBrown
Actually the prefix of this macro is "
CONFIG_AS_", not "CONFIG_" :-)CONFIG_AS_is reserved for assembly magic, and is never used by the the kconfig system.(Well..... I might have made bits of that up, but "git grep 'config
AS_'" doesn't find anything).
Quoted 8 lines
That's correct, there are no
Kconfigsymbols starting withAS_. But still, I would like to hear whether there's a reasonable chance I might convince other people to adopt my peeve.The thinking behind that peeve is, basically, that where people encounter a CONFIG_* macro they should only have to check the .config file to see how that macro was evaluated in the build that was used.
Personally, I don't care.
But I find that developers in general are more responsive to code than to peeves.
So if you post a patch which makes the change that you want, then you are more likely to get a useful response than if you just post a peeve. It may not be the response you want of course....
NeilBrown
Quoted 14 lines · NeilBrown
Quoted 12 lines · On Tue, 03 Feb 2015 22:03:35 +0100 Paul Bolle <[email protected]> wrote:
Quoted 6 lines · NeilBrown
Actually the prefix of this macro is "
CONFIG_AS_", not "CONFIG_" :-)CONFIG_AS_is reserved for assembly magic, and is never used by the the kconfig system.(Well..... I might have made bits of that up, but "git grep 'config
AS_'" doesn't find anything).That's correct, there are no
Kconfigsymbols starting withAS_. But still, I would like to hear whether there's a reasonable chance I might convince other people to adopt my peeve.
Quoted 6 lines
Quoted 4 lines
The thinking behind that peeve is, basically, that where people encounter a CONFIG_* macro they should only have to check the .config file to see how that macro was evaluated in the build that was used.
Personally, I don't care.
A problem with those identifiers is that the CONFIG_ prefix is reserved for Kconfig features in Make and CPP syntax. The _MODULE suffix for CPP alone. Sadly, this convention is only documented in the Kconfig C code itself. Nonetheless, such cases give hard times to static analysis tools that then have to deal with such false positives.
Kind regards,
Valentin
Quoted 8 lines
But I find that developers in general are more responsive to code than to peeves.
So if you post a patch which makes the change that you want, then you are more likely to get a useful response than if you just post a peeve. It may not be the response you want of course....
NeilBrown
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 03.02.15 at 22:03, <[email protected]> wrote:
Quoted 6 lines · NeilBrown
Actually the prefix of this macro is "
CONFIG_AS_", not "CONFIG_" :-)CONFIG_AS_is reserved for assembly magic, and is never used by the the kconfig system.(Well..... I might have made bits of that up, but "git grep 'config
AS_'" doesn't find anything).
Quoted 7 lines
That's correct, there are no
Kconfigsymbols starting withAS_. But still, I would like to hear whether there's a reasonable chance I might convince other people to adopt my peeve.The thinking behind that peeve is, basically, that where people encounter a CONFIG_* macro they should only have to check the .config file to see how that macro was evaluated in the build that was used.
I too found it curious that CONFIG_* is being used here instead of e.g. HAVE_*, but with the patch at hand I simply followed suit (as that normally is the route involving less discussions in order to get a necessary/desirable fix accepted). In the end I guess you'd need to convince the x86 maintainers.
Jan
H. Peter Anvin
reviewerQuoted 8 lines · Paul Bolle
Quoted 6 lines · NeilBrown
Actually the prefix of this macro is "
CONFIG_AS_", not "CONFIG_" :-)CONFIG_AS_is reserved for assembly magic, and is never used by the the kconfig system.(Well..... I might have made bits of that up, but "git grep 'config
AS_'" doesn't find anything).
Quoted 8 lines
That's correct, there are no
Kconfigsymbols starting withAS_. But still, I would like to hear whether there's a reasonable chance I might convince other people to adopt my peeve.The thinking behind that peeve is, basically, that where people encounter a CONFIG_* macro they should only have to check the .config file to see how that macro was evaluated in the build that was used.
There is a hope/intent that eventually the config system will be able to incorporate toolchain dependencies for a bunch of reasons.
-hpa
Quoted 2 lines · H. Peter Anvin
There is a hope/intent that eventually the config system will be able to incorporate toolchain dependencies for a bunch of reasons.
This restarts a four months old thread with a one sentence remark. So could you please elaborate, because now you've left me and, perhaps, the other people reading this wondering what "toolchain dependencies" actually means and what those "bunch of reasons" are.
Thanks,
Paul Bolle
H. Peter Anvin
reviewerQuoted 9 lines · Paul Bolle
Quoted 2 lines · H. Peter Anvin
There is a hope/intent that eventually the config system will be able to incorporate toolchain dependencies for a bunch of reasons.
This restarts a four months old thread with a one sentence remark. So could you please elaborate, because now you've left me and, perhaps, the other people reading this wondering what "toolchain dependencies" actually means and what those "bunch of reasons" are.
Sorry, missed the date on this in my inbox for some reason.
So this related to the CONFIG_AS_ symbols for assembly. We really would like to do things like actually adding dependencies on assembler or compiler support into Kconfig proper, rather than having two independent mechanisms. That way we could do, for example:
config RAID6_AVX2
depends on X86 && AS_AVX2
Quoted 7 lines · H. Peter Anvin
So this related to the
CONFIG_AS_symbols for assembly. We really would like to do things like actually adding dependencies on assembler or compiler support intoKconfigproper, rather than having two independent mechanisms. That way we could do, for example:config
RAID6_AVX2depends on X86 && AS_AVX2
I have no idea what AS_AVX2 means, sorry. So what would it mean if someone has a .config with
CONFIG_AS_AVX2=foo
Ie, what would happen if someone using a toolchain for which that would not be possible tries to build a kernel with that symbol set? That person's .config would end up containing
# CONFIG_AS_AVX2 is not set
or similar, right?
Paul Bolle
H. Peter Anvin
reviewerQuoted 5 lines · Paul Bolle
I have no idea what
AS_AVX2means, sorry. So what would it mean if someone has a .config with
CONFIG_AS_AVX2=foo
Quoted 7 lines
Ie, what would happen if someone using a toolchain for which that would not be possible tries to build a kernel with that symbol set? That person's .config would end up containing
#CONFIG_AS_AVX2is not setor similar, right?
Yes, these would be generated, not user input.
-hpa
Quoted 1 line · H. Peter Anvin
Yes, these would be generated, not user input.
I think someone (Jiri Kosina?) proposed shelling out to set Kconfig values. I don't think any patches were ever submitted. But I guess something along those lines would be needed to adopt the .config to the toolchain at hand. As long as we don't do anything funny once we've generated the .config file that might just work.
Yes, I know, the devil hides in the details.
Thanks,
Paul Bolle