Subject: linux-next: manual merge of the kselftest tree with the kvm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 18 Oct 2018 15:50:30 +1100

Hi Shuah,

Today's linux-next merge of the kselftest tree got a conflict in:

  tools/testing/selftests/kvm/dirty_log_test.c

between commit:

  fff8dcd7b4a2 ("kvm: selftests: port dirty_log_test to aarch64")

from the kvm tree and commit:

  cda94d9ffa0e ("selftests: kvm: Fix -Wformat warnings")

from the kselftest tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/kvm/dirty_log_test.c
index d59820cc2d39,a9c4b5e21d7e..000000000000
--- 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++) {