From: Christian Borntraeger <borntraeger@de.ibm.com>
To: David Hildenbrand <david@redhat.com>, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>
Subject: Re: [PATCH kvm-unit-tests v3 11/11] s390x: add sieve test
Date: Tue, 13 Feb 2018 17:26:38 +0100 [thread overview]
Message-ID: <dbf24494-e148-5d4d-dfe0-76dfd1def141@de.ibm.com> (raw)
In-Reply-To: <20180213162321.20522-12-david@redhat.com>
On 02/13/2018 05:23 PM, David Hildenbrand wrote:
> Copied from x86/sieve.c. Modifications:
> - proper code formatting.
> - as setup_vm() is already called, temporarily disable DAT.
>
> The test takes fairly long, especially because we only have 128MB of ram
> and allocate 3 times in a row ~100mb of virtual memory.
Does it make sense to change the memory size in the unittests.cfg file? e.g. via extra_params?
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> s390x/Makefile | 1 +
> s390x/sieve.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> s390x/unittests.cfg | 6 ++++++
> 3 files changed, 66 insertions(+)
> create mode 100644 s390x/sieve.c
>
> diff --git a/s390x/Makefile b/s390x/Makefile
> index d9bef37..2d3336c 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -1,6 +1,7 @@
> tests = $(TEST_DIR)/selftest.elf
> tests += $(TEST_DIR)/intercept.elf
> tests += $(TEST_DIR)/emulator.elf
> +tests += $(TEST_DIR)/sieve.elf
>
> all: directories test_cases
>
> diff --git a/s390x/sieve.c b/s390x/sieve.c
> new file mode 100644
> index 0000000..28d4d1e
> --- /dev/null
> +++ b/s390x/sieve.c
> @@ -0,0 +1,59 @@
> +/*
> + * Copied from x86/sieve.c
> + */
> +
> +#include <libcflat.h>
> +#include <alloc.h>
> +#include <asm/pgtable.h>
> +
> +int sieve(char* data, int size)
> +{
> + int i, j, r = 0;
> +
> + for (i = 0; i < size; ++i)
> + data[i] = 1;
> +
> + data[0] = data[1] = 0;
> +
> + for (i = 2; i < size; ++i)
> + if (data[i]) {
> + ++r;
> + for (j = i * 2; j < size; j += i)
> + data[j] = 0;
> + }
> + return r;
> +}
> +
> +void test_sieve(const char *msg, char *data, int size)
> +{
> + int r;
> +
> + printf("%s:", msg);
> + r = sieve(data, size);
> + printf("%d out of %d\n", r, size);
> +}
> +
> +#define STATIC_SIZE 1000000
> +#define VSIZE 100000000
> +char static_data[STATIC_SIZE];
> +
> +int main()
> +{
> + void *v;
> + int i;
> +
> + printf("starting sieve\n");
> +
> + configure_dat(0);
> + test_sieve("static", static_data, STATIC_SIZE);
> + configure_dat(1);
> +
> + test_sieve("mapped", static_data, STATIC_SIZE);
> + for (i = 0; i < 3; ++i) {
> + v = malloc(VSIZE);
> + test_sieve("virtual", v, VSIZE);
> + free(v);
> + }
> +
> + return 0;
> +}
> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> index 1343a19..4a1e469 100644
> --- a/s390x/unittests.cfg
> +++ b/s390x/unittests.cfg
> @@ -28,3 +28,9 @@ file = intercept.elf
>
> [emulator]
> file = emulator.elf
> +
> +[sieve]
> +file = sieve.elf
> +groups = selftest
> +# can take fairly long even on KVM guests
> +timeout = 600
>
next prev parent reply other threads:[~2018-02-13 16:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 16:23 [PATCH kvm-unit-tests v3 00/11] s390x: vmalloc support David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 01/11] s390x: fix TEST BLOCK tests David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 02/11] s390x: use highest addresses for PGM_ADDRESSING errors David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 03/11] s390x: set initital stack pointer to stackptr, not stacktop David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 04/11] s390x: add missing sclp definitions from QEMU David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 05/11] s390x: rename sclp_setup() to sclp_ascii_setup() David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 06/11] s390x: detect installed memory David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 07/11] s390x: initialize the physical allocator David Hildenbrand
2018-02-14 12:05 ` Thomas Huth
2018-02-14 12:22 ` David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 08/11] s390x: add vmalloc support David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 09/11] s390x: enable DAT in PGM interrupt handler David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 10/11] s390x: add test for (v)malloc David Hildenbrand
2018-02-13 16:23 ` [PATCH kvm-unit-tests v3 11/11] s390x: add sieve test David Hildenbrand
2018-02-13 16:26 ` Christian Borntraeger [this message]
2018-02-13 16:44 ` Paolo Bonzini
2018-02-13 17:02 ` David Hildenbrand
2018-02-13 17:08 ` David Hildenbrand
2018-02-14 11:51 ` Paolo Bonzini
2018-02-14 12:56 ` David Hildenbrand
2018-02-14 13:15 ` David Hildenbrand
2018-02-13 17:09 ` David Hildenbrand
2018-02-14 11:52 ` [PATCH kvm-unit-tests v3 00/11] s390x: vmalloc support 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=dbf24494-e148-5d4d-dfe0-76dfd1def141@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@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