The driver crc32c-intel match CPUs supporting X86_FEATURE_XMM4_2.
On platforms with Zhaoxin CPUs supporting this X86 feature, when
crc32c-intel and crc32c-generic are both registered, system will
use crc32c-intel because its .cra_priority is greater than
crc32c-generic.

When doing lmbench3 Create and Delete file test on partitions with
ext4 enabling metadata checksum, found using crc32c-generic driver
could get about 20% performance gain than using the driver crc32c-intel
on some Zhaoxin CPUs. Lower-level testing result is that with the same
input value the generic C implementation takes fewer time than the crc32c
instruction implementation on these CPUs. This case expect to use
crc32c-generic driver for these CPUs to get performance gain.

The presence of crc32c is enumerated by CPUID.01:ECX[SSE4.2] = 1, and
these CPUs other SSE4.2 instructions is ok.

Add a synthetic flag to indicates low performance CRC32C instruction
implementation, set this flag in Zhaoxin CPUs specific init phase,
and exclude CPUs which setting this flag from the driver crc32c-intel.

https://lkml.org/lkml/2020/12/21/789

Tony W Wang-oc (3):
  x86/cpufeatures: Add low performance CRC32C instruction CPU feature
  x86/cpu: Set low performance CRC32C flag on some Zhaoxin CPUs
  crypto: x86/crc32c-intel Exclude low performance CRC32C instruction
    CPUs

 arch/x86/crypto/crc32c-intel_glue.c | 5 +++++
 arch/x86/include/asm/cpufeatures.h  | 1 +
 arch/x86/kernel/cpu/centaur.c       | 7 +++++++
 arch/x86/kernel/cpu/cpuid-deps.c    | 1 +
 arch/x86/kernel/cpu/zhaoxin.c       | 6 ++++++
 5 files changed, 20 insertions(+)

-- 
2.7.4

Reply via email to