Re: [PATCH] x86/raid6: correctly check for assembler capabilities

Paul Bolle
2015-02-03T20:31:33Z

On Fri, 2015-01-23 at 08:29 +0000, Jan Beulich wrote:
> 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 <jbeulich@suse.com>
> Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>
> Cc: Neil Brown <neilb@suse.de>

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.

> ---
> 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(-)
>
> --- 3.19-rc5/arch/x86/Makefile
> +++ 3.19-rc5-raid6-SSSE3/arch/x86/Makefile
> @@ -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?

> 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)

Paul Bolle