[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 06/61] util: add util function buffer_zero_avx512()
From: |
Paolo Bonzini |
Subject: |
Re: [PULL 06/61] util: add util function buffer_zero_avx512() |
Date: |
Mon, 16 Mar 2020 23:02:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
This breaks if AVX2 and AVX512 are both disabled but SSE2 isn't, because
it calls buffer_is_zero_sse2 even with length < 64. Fix:
diff --git a/util/bufferiszero.c b/util/bufferiszero.c
index b6eab0c..6639035 100644
--- a/util/bufferiszero.c
+++ b/util/bufferiszero.c
@@ -247,23 +247,20 @@ buffer_zero_avx512(const void *buf, size_t len)
static unsigned cpuid_cache = INIT_CACHE;
static bool (*buffer_accel)(const void *, size_t) = INIT_ACCEL;
-static int length_to_accel;
+static int length_to_accel = 64;
static void init_accel(unsigned cache)
{
bool (*fn)(const void *, size_t) = buffer_zero_int;
if (cache & CACHE_SSE2) {
fn = buffer_zero_sse2;
- length_to_accel = 64;
}
#ifdef CONFIG_AVX2_OPT
if (cache & CACHE_SSE4) {
fn = buffer_zero_sse4;
- length_to_accel = 64;
}
if (cache & CACHE_AVX2) {
fn = buffer_zero_avx2;
- length_to_accel = 64;
}
#endif
#ifdef CONFIG_AVX512F_OPT
Paolo
- [PULL 00/61] Misc patches for soft freeze, Paolo Bonzini, 2020/03/16
- [PULL 02/61] optionrom/pvh: scan entire RSDP Area, Paolo Bonzini, 2020/03/16
- [PULL 01/61] scsi/qemu-pr-helper: Fix out-of-bounds access to trnptid_list[], Paolo Bonzini, 2020/03/16
- [PULL 04/61] misc: Replace zero-length arrays with flexible array member (manual), Paolo Bonzini, 2020/03/16
- [PULL 05/61] configure: add configure option avx512f_opt, Paolo Bonzini, 2020/03/16
- [PULL 08/61] WHPX: Use QEMU values for trapped CPUID, Paolo Bonzini, 2020/03/16
- [PULL 03/61] misc: Replace zero-length arrays with flexible array member (automatic), Paolo Bonzini, 2020/03/16
- [PULL 06/61] util: add util function buffer_zero_avx512(), Paolo Bonzini, 2020/03/16
- Re: [PULL 06/61] util: add util function buffer_zero_avx512(),
Paolo Bonzini <=
- [PULL 07/61] WHPX: TSC get and set should be dependent on VM state, Paolo Bonzini, 2020/03/16
- [PULL 10/61] hw/i386/intel_iommu: Fix out-of-bounds access on guest IRT, Paolo Bonzini, 2020/03/16
- [PULL 09/61] MAINTAINERS: Add entry for Guest X86 HAXM CPUs, Paolo Bonzini, 2020/03/16
[PULL 11/61] oslib-posix: initialize mutex and condition variable, Paolo Bonzini, 2020/03/16
[PULL 14/61] configure: Fix building with SASL on Windows, Paolo Bonzini, 2020/03/16