From: Linus Torvalds Date: Sun, 28 Oct 2018 19:58:42 +0000 (-0700) Subject: Merge tag 'linux-kselftest-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel... X-Git-Tag: microblaze-v5.0-rc1~94 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=f8cab69be0a8a756a7409f6d2bd1e6e96ce46482;p=linux-2.6-microblaze.git Merge tag 'linux-kselftest-4.20-rc1' of git://git./linux/kernel/git/shuah/linux-kselftest Pull kselftest updates from Shuah Khan: "This Kselftest update for Linux 4.20-rc1 consists of: - Improvements to ftrace test suite from Masami Hiramatsu. - Color coded ftrace PASS / FAIL results from Steven Rostedt (VMware) to improve readability of reports. - watchdog Fixes and enhancement to add gettimeout and get|set pretimeout options from Jerry Hoemann. - Several fixes to warnings and spelling etc" * tag 'linux-kselftest-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (40 commits) selftests/ftrace: Strip escape sequences for log file selftests/ftrace: Use colored output when available selftests: fix warning: "_GNU_SOURCE" redefined selftests: kvm: Fix -Wformat warnings selftests/ftrace: Add color to the PASS / FAIL results kvm: selftests: fix spelling mistake "Insufficent" -> "Insufficient" selftests: gpio: Fix OUTPUT directory in Makefile selftests: gpio: restructure Makefile selftests: watchdog: Fix ioctl SET* error paths to take oneshot exit path selftests: watchdog: Add gettimeout and get|set pretimeout selftests: watchdog: Fix error message. selftests: watchdog: fix message when /dev/watchdog open fails selftests/ftrace: Add ftrace cpumask testcase selftests/ftrace: Add wakeup_rt tracer testcase selftests/ftrace: Add wakeup tracer testcase selftests/ftrace: Add stacktrace ftrace filter command testcase selftests/ftrace: Add trace_pipe testcase selftests/ftrace: Add function filter on module testcase selftests/ftrace: Add max stack tracer testcase selftests/ftrace: Add function profiling stat testcase ... --- f8cab69be0a8a756a7409f6d2bd1e6e96ce46482 diff --cc tools/testing/selftests/kvm/dirty_log_test.c index d59820cc2d39,a9c4b5e21d7e..aeff95a91b15 --- a/tools/testing/selftests/kvm/dirty_log_test.c +++ b/tools/testing/selftests/kvm/dirty_log_test.c @@@ -17,52 -15,46 +17,52 @@@ #include "test_util.h" #include "kvm_util.h" +#include "processor.h" + +#define DEBUG printf -#define DEBUG printf +#define VCPU_ID 1 -#define VCPU_ID 1 /* The memory slot index to track dirty pages */ -#define TEST_MEM_SLOT_INDEX 1 -/* - * GPA offset of the testing memory slot. Must be bigger than the - * default vm mem slot, which is DEFAULT_GUEST_PHY_PAGES. - */ -#define TEST_MEM_OFFSET (1ULL << 30) /* 1G */ -/* Size of the testing memory slot */ -#define TEST_MEM_PAGES (1ULL << 18) /* 1G for 4K pages */ +#define TEST_MEM_SLOT_INDEX 1 + +/* Default guest test memory offset, 1G */ +#define DEFAULT_GUEST_TEST_MEM 0x40000000 + /* How many pages to dirty for each guest loop */ -#define TEST_PAGES_PER_LOOP 1024 +#define TEST_PAGES_PER_LOOP 1024 + /* How many host loops to run (one KVM_GET_DIRTY_LOG for each loop) */ - #define TEST_HOST_LOOP_N 32 -#define TEST_HOST_LOOP_N 32UL ++#define TEST_HOST_LOOP_N 32UL + /* Interval for each host loop (ms) */ - #define TEST_HOST_LOOP_INTERVAL 10 -#define TEST_HOST_LOOP_INTERVAL 10UL ++#define TEST_HOST_LOOP_INTERVAL 10UL + +/* + * Guest/Host shared variables. Ensure addr_gva2hva() and/or + * sync_global_to/from_guest() are used when accessing from + * the host. READ/WRITE_ONCE() should also be used with anything + * that may change. + */ +static uint64_t host_page_size; +static uint64_t guest_page_size; +static uint64_t guest_num_pages; +static uint64_t random_array[TEST_PAGES_PER_LOOP]; +static uint64_t iteration; /* - * Guest variables. We use these variables to share data between host - * and guest. There are two copies of the variables, one in host memory - * (which is unused) and one in guest memory. When the host wants to - * access these variables, it needs to call addr_gva2hva() to access the - * guest copy. + * GPA offset of the testing memory slot. Must be bigger than + * DEFAULT_GUEST_PHY_PAGES. */ -uint64_t guest_random_array[TEST_PAGES_PER_LOOP]; -uint64_t guest_iteration; -uint64_t guest_page_size; +static uint64_t guest_test_mem = DEFAULT_GUEST_TEST_MEM; /* - * Writes to the first byte of a random page within the testing memory - * region continuously. + * Continuously write to the first 8 bytes of a random pages within + * the testing memory region. */ -void guest_code(void) +static void guest_code(void) { - int i = 0; - uint64_t volatile *array = guest_random_array; - uint64_t volatile *guest_addr; + int i; while (true) { for (i = 0; i < TEST_PAGES_PER_LOOP; i++) { diff --cc tools/testing/selftests/kvm/lib/kvm_util.c index 8c06da4f03db,a56ef6b187bb..1b41e71283d5 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@@ -127,8 -121,9 +127,8 @@@ struct kvm_vm *vm_create(enum vm_guest_ struct kvm_vm *vm; int kvm_fd; - /* Allocate memory. */ vm = calloc(1, sizeof(*vm)); - TEST_ASSERT(vm != NULL, "Insufficent Memory"); + TEST_ASSERT(vm != NULL, "Insufficient Memory"); vm->mode = mode; vm_open(vm, perm);