linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Thomas Huth" <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	linux-s390@vger.kernel.org, Nico Boehr <nrb@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org, David Hildenbrand <david@redhat.com>,
	linuxppc-dev@lists.ozlabs.org,
	Shaoqin Huang <shahuang@redhat.com>,
	Andrew Jones <andrew.jones@linux.dev>,
	Eric Auger <eric.auger@redhat.com>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>
Subject: Re: [kvm-unit-tests PATCH 7/7] common: add memory dirtying vs migration test
Date: Tue, 05 Mar 2024 12:50:18 +1000	[thread overview]
Message-ID: <CZLH3XUGU8Z8.2R73ILJ3ISWN8@wheely> (raw)
In-Reply-To: <e967e7a6-eb20-4b2b-ab7a-fc5052a3eb52@redhat.com>

On Mon Mar 4, 2024 at 4:22 PM AEST, Thomas Huth wrote:
> On 26/02/2024 10.38, Nicholas Piggin wrote:
> > This test stores to a bunch of pages and verifies previous stores,
> > while being continually migrated. This can fail due to a QEMU TCG
> > physical memory dirty bitmap bug.
>
> Good idea, but could we then please drop "continuous" test from 
> selftest-migration.c again? ... having two common tests to exercise the 
> continuous migration that take quite a bunch of seconds to finish sounds 
> like a waste of time in the long run to me.

Yeah if you like. I could shorten them up a bit. I did want to have
the selftests for just purely testing the harness with as little
"test" code as possible.

>
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >   common/memory-verify.c  | 48 +++++++++++++++++++++++++++++++++++++++++
> >   powerpc/Makefile.common |  1 +
> >   powerpc/memory-verify.c |  1 +
> >   powerpc/unittests.cfg   |  7 ++++++
> >   s390x/Makefile          |  1 +
> >   s390x/memory-verify.c   |  1 +
> >   s390x/unittests.cfg     |  6 ++++++
> >   7 files changed, 65 insertions(+)
> >   create mode 100644 common/memory-verify.c
> >   create mode 120000 powerpc/memory-verify.c
> >   create mode 120000 s390x/memory-verify.c
> > 
> > diff --git a/common/memory-verify.c b/common/memory-verify.c
> > new file mode 100644
> > index 000000000..7c4ec087b
> > --- /dev/null
> > +++ b/common/memory-verify.c
> > @@ -0,0 +1,48 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Simple memory verification test, used to exercise dirty memory migration.
> > + *
> > + */
> > +#include <libcflat.h>
> > +#include <migrate.h>
> > +#include <alloc.h>
> > +#include <asm/page.h>
> > +#include <asm/time.h>
> > +
> > +#define NR_PAGES 32
> > +
> > +int main(int argc, char **argv)
> > +{
> > +	void *mem = malloc(NR_PAGES*PAGE_SIZE);
> > +	bool success = true;
> > +	uint64_t ms;
> > +	long i;
> > +
> > +	report_prefix_push("memory");
> > +
> > +	memset(mem, 0, NR_PAGES*PAGE_SIZE);
> > +
> > +	migrate_begin_continuous();
> > +	ms = get_clock_ms();
> > +	i = 0;
> > +	do {
> > +		int j;
> > +
> > +		for (j = 0; j < NR_PAGES*PAGE_SIZE; j += PAGE_SIZE) {
> > +			if (*(volatile long *)(mem + j) != i) {
> > +				success = false;
> > +				goto out;
> > +			}
> > +			*(volatile long *)(mem + j) = i + 1;
> > +		}
> > +		i++;
> > +	} while (get_clock_ms() - ms < 5000);
>
> Maybe add a parameter so that the user can use different values for the 
> runtime than always doing 5 seconds?

Sure.

Thanks,
Nick

  reply	other threads:[~2024-03-05  2:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  9:38 [kvm-unit-tests PATCH 0/7] more migration enhancements and tests Nicholas Piggin
2024-02-26  9:38 ` [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open Nicholas Piggin
2024-03-01 13:32   ` Thomas Huth
2024-03-05  2:21     ` Nicholas Piggin
2024-02-26  9:38 ` [kvm-unit-tests PATCH 2/7] migration: Add a migrate_skip command Nicholas Piggin
2024-03-04  6:05   ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 3/7] (arm|s390): Use migrate_skip in test cases Nicholas Piggin
2024-03-01 13:49   ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 4/7] powerpc: add asm/time.h header with delay and get_clock_us/ms Nicholas Piggin
2024-03-01 14:05   ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 5/7] arch-run: Add a "continuous" migration option for tests Nicholas Piggin
2024-03-04  6:17   ` Thomas Huth
2024-03-04  9:19     ` Andrew Jones
2024-03-05  2:58       ` Nicholas Piggin
2024-03-05  2:47     ` Nicholas Piggin
2024-02-26  9:38 ` [kvm-unit-tests PATCH 6/7] gitlab-ci: Run migration selftest on s390x and powerpc Nicholas Piggin
2024-03-01 14:16   ` Thomas Huth
2024-03-05  2:38     ` Nicholas Piggin
2024-03-05  6:50       ` Thomas Huth
2024-02-26  9:38 ` [kvm-unit-tests PATCH 7/7] common: add memory dirtying vs migration test Nicholas Piggin
2024-03-04  6:22   ` Thomas Huth
2024-03-05  2:50     ` Nicholas Piggin [this message]
2024-03-05  6:52       ` Thomas Huth

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=CZLH3XUGU8Z8.2R73ILJ3ISWN8@wheely \
    --to=npiggin@gmail.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andrew.jones@linux.dev \
    --cc=david@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lvivier@redhat.com \
    --cc=mhartmay@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=shahuang@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).