All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-s390@vger.kernel.org,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Shuah Khan" <shuah@kernel.org>, "Peter Xu" <peterx@redhat.com>
Subject: Re: [PATCH 2/2] KVM: selftests: Enable dirty_log_test on s390x
Date: Wed, 31 Jul 2019 10:44:05 +0200	[thread overview]
Message-ID: <20190731084405.tn3x6nmt2svkjkiq@kamzik.brq.redhat.com> (raw)
In-Reply-To: <a9824265-daf8-db36-86b8-ad890dc73f14@redhat.com>

On Wed, Jul 31, 2019 at 10:19:57AM +0200, Thomas Huth wrote:
> On 30/07/2019 12.57, Andrew Jones wrote:
> > On Tue, Jul 30, 2019 at 12:01:12PM +0200, Thomas Huth wrote:
> >> To run the dirty_log_test on s390x, we have to make sure that we
> >> access the dirty log bitmap with little endian byte ordering and
> >> we have to properly align the memslot of the guest.
> >> Also all dirty bits of a segment are set once on s390x when one
> >> of the pages of a segment are written to for the first time, so
> >> we have to make sure that we touch all pages during the first
> >> iteration to keep the test in sync here.
> >>
> >> Signed-off-by: Thomas Huth <thuth@redhat.com>
> >> ---
> [...]
> >> diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c
> >> index ceb52b952637..7a1223ad0ff3 100644
> >> --- a/tools/testing/selftests/kvm/dirty_log_test.c
> >> +++ b/tools/testing/selftests/kvm/dirty_log_test.c
> >> @@ -26,9 +26,22 @@
> >>  /* The memory slot index to track dirty pages */
> >>  #define TEST_MEM_SLOT_INDEX		1
> >>  
> >> +#ifdef __s390x__
> >> +
> >> +/*
> >> + * On s390x, the ELF program is sometimes linked at 0x80000000, so we can
> >> + * not use 0x40000000 here without overlapping into that region. Thus let's
> >> + * use 0xc0000000 as base address there instead.
> >> + */
> >> +#define DEFAULT_GUEST_TEST_MEM		0xc0000000
> > 
> > I think both x86 and aarch64 should be ok with this offset. If testing
> > proves it does, then we can just change it for all architecture.
> 
> Ok. It seems to work on x86 - could you please check aarch64, since I
> don't have such a system available right now?

Tested it. It works on aarch64 too.

> 
> >> +/* Dirty bitmaps are always little endian, so we need to swap on big endian */
> >> +#if defined(__s390x__)
> >> +# define BITOP_LE_SWIZZLE	((BITS_PER_LONG-1) & ~0x7)
> >> +# define test_bit_le(nr, addr) \
> >> +	test_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
> >> +# define set_bit_le(nr, addr) \
> >> +	set_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
> >> +# define clear_bit_le(nr, addr) \
> >> +	clear_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
> >> +# define test_and_set_bit_le(nr, addr) \
> >> +	test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
> >> +# define test_and_clear_bit_le(nr, addr) \
> >> +	test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
> >> +#else
> >> +# define test_bit_le	test_bit
> >> +# define set_bit_le	set_bit
> >> +# define clear_bit_le	clear_bit
> >> +# define test_and_set_bit_le	test_and_set_bit
> >> +# define test_and_clear_bit_le	test_and_clear_bit
> >> +#endif
> > 
> > nit: does the formatting above look right after applying the patch?
> 
> It looked ok to me, but I can add some more tabs to even make it nicer :)
> 
> >> @@ -293,6 +341,10 @@ static void run_test(enum vm_guest_mode mode, unsigned long iterations,
> >>  	 * case where the size is not aligned to 64 pages.
> >>  	 */
> >>  	guest_num_pages = (1ul << (30 - guest_page_shift)) + 16;
> >> +#ifdef __s390x__
> >> +	/* Round up to multiple of 1M (segment size) */
> >> +	guest_num_pages = (guest_num_pages + 0xff) & ~0xffUL;
> > 
> > We could maybe do this for all architectures as well.
> 
> It's really only needed on s390x, so I think we should keep the #ifdef here.
>

OK

Thanks,
drew 

  reply	other threads:[~2019-07-31  8:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 10:01 [PATCH 0/2] KVM: selftests: Enable ucall and dirty_log_test on s390x Thomas Huth
2019-07-30 10:01 ` [PATCH 1/2] KVM: selftests: Implement ucall() for s390x Thomas Huth
2019-07-30 10:48   ` Andrew Jones
2019-07-31  9:43     ` Thomas Huth
2019-07-31 10:28       ` Andrew Jones
2019-07-31 11:16         ` Thomas Huth
2019-07-31 12:57           ` Paolo Bonzini
2019-07-31 13:05             ` Andrew Jones
2019-07-30 10:01 ` [PATCH 2/2] KVM: selftests: Enable dirty_log_test on s390x Thomas Huth
2019-07-30 10:57   ` Andrew Jones
2019-07-31  8:19     ` Thomas Huth
2019-07-31  8:44       ` Andrew Jones [this message]
2019-07-31 12:58       ` Paolo Bonzini
2019-07-30 11:35   ` Paolo Bonzini
2019-07-30 14:57   ` Christian Borntraeger
2019-07-30 17:11     ` Thomas Huth
2019-07-30 18:04       ` Christian Borntraeger
2019-07-31 11:06         ` David Hildenbrand
2019-07-30 19:06     ` Paolo Bonzini
2019-07-31  7:16       ` Christian Borntraeger
2019-07-30 11:36 ` [PATCH 0/2] KVM: selftests: Enable ucall and " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190731084405.tn3x6nmt2svkjkiq@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=shuah@kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.