Re: [PATCH v2 10/30] Add x86-specific parity functions

From: Borislav Petkov
Date: Thu Apr 07 2016 - 05:43:40 EST


On Thu, Apr 07, 2016 at 08:31:09AM +0200, Dmitry Vyukov wrote:
> Hweight custom calling convention caused crashes with KCOV coverage.
> We had to disable instrumentation of the file.

I guess we can do something like this:

if (likely(static_cpu_has(X86_FEATURE_POPCNT)))
asm volatile(POPCNT32
: "="REG_OUT (res)
: REG_IN (w));
else
res = __sw_hweight32(w);

and get rid of the custom calling convention.

Along with some numbers showing that the change doesn't cause any
noticeable slowdown...

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--