ioat/verify: ensure 8-byte alignment for FILL requests

We're usually lucky and either the buffer is physically-contiguous,
or the address is already 8-bit aligned, but intermittent failures
were still happening. Not anymore.

Change-Id: Iec226b42f66c7c273f181cda764b92164e24b0e3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/416658
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-06-24 21:50:10 +02:00 committed by Ben Walker
parent d4b876045b
commit de7a37a8d8

View File

@ -134,10 +134,15 @@ static void prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_tas
fill_pattern = rand_r(&seed); fill_pattern = rand_r(&seed);
fill_pattern = fill_pattern << 32 | rand_r(&seed); fill_pattern = fill_pattern << 32 | rand_r(&seed);
/* ensure that the length of memset block is 8 Bytes aligned */ /* Ensure that the length of memset block is 8 Bytes aligned.
len = 8 + ((rand_r(&seed) % (SRC_BUFFER_SIZE - 8)) & ~0x7); * In case the buffer crosses hugepage boundary and must be split,
dst_offset = rand_r(&seed) % (SRC_BUFFER_SIZE - len); * we also need to ensure 8 byte address alignment. We do it
* unconditionally to keep things simple.
*/
len = 8 + ((rand_r(&seed) % (SRC_BUFFER_SIZE - 16)) & ~0x7);
dst_offset = 8 + rand_r(&seed) % (SRC_BUFFER_SIZE - 8 - len);
ioat_task->fill_pattern = fill_pattern; ioat_task->fill_pattern = fill_pattern;
ioat_task->dst = (void *)(((uintptr_t)ioat_task->buffer + dst_offset) & ~0x7);
} else { } else {
src_offset = rand_r(&seed) % SRC_BUFFER_SIZE; src_offset = rand_r(&seed) % SRC_BUFFER_SIZE;
len = rand_r(&seed) % (SRC_BUFFER_SIZE - src_offset); len = rand_r(&seed) % (SRC_BUFFER_SIZE - src_offset);
@ -145,9 +150,9 @@ static void prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_tas
memset(ioat_task->buffer, 0, SRC_BUFFER_SIZE); memset(ioat_task->buffer, 0, SRC_BUFFER_SIZE);
ioat_task->src = (void *)((uintptr_t)g_src + src_offset); ioat_task->src = (void *)((uintptr_t)g_src + src_offset);
ioat_task->dst = (void *)((uintptr_t)ioat_task->buffer + dst_offset);
} }
ioat_task->len = len; ioat_task->len = len;
ioat_task->dst = (void *)((uintptr_t)ioat_task->buffer + dst_offset);
ioat_task->thread_entry = thread_entry; ioat_task->thread_entry = thread_entry;
} }