linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: akpm@linux-foundation.org,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] selftest/vm: Add test case for mmap across 128TB boundary.
Date: Thu, 23 Nov 2017 13:14:23 +0300	[thread overview]
Message-ID: <20171123101422.6fu7ehvjuw2v5jjh@node.shutemov.name> (raw)
In-Reply-To: <20171123030313.6418-1-aneesh.kumar@linux.vnet.ibm.com>

On Thu, Nov 23, 2017 at 08:33:13AM +0530, Aneesh Kumar K.V wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> 
> This patch add a self-test that covers a few corner cases of the interface.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> 
> Changes from V1:
> * Add the test to run_vmtests script
> 
>  tools/testing/selftests/vm/Makefile         |   1 +
>  tools/testing/selftests/vm/run_vmtests      |  11 ++
>  tools/testing/selftests/vm/va_128TBswitch.c | 297 ++++++++++++++++++++++++++++
>  3 files changed, 309 insertions(+)
>  create mode 100644 tools/testing/selftests/vm/va_128TBswitch.c

Patch with my selftest is already in -tip tree. I think this selftest
should replace it, not add another one.

> diff --git a/tools/testing/selftests/vm/va_128TBswitch.c b/tools/testing/selftests/vm/va_128TBswitch.c
> new file mode 100644
> index 000000000000..2fdb84ab94b1
> --- /dev/null
> +++ b/tools/testing/selftests/vm/va_128TBswitch.c
> @@ -0,0 +1,297 @@
> +/*
> + *
> + * Authors: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> + * Authors: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of version 2.1 of the GNU Lesser General Public License
> + * as published by the Free Software Foundation.

LGPL? Why?

> + *
> + * This program is distributed in the hope that it would be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + *
> + */
> +
> +static int run_test(struct testcase *test, int count)
> +{
> +	void *p;
> +	int i, ret = 0;
> +
> +	for (i = 0; i < count; i++) {
> +		struct testcase *t = test + i;
> +
> +		p = mmap(t->addr, t->size, PROT_READ | PROT_WRITE, t->flags, -1, 0);
> +
> +		printf("%s: %p - ", t->msg, p);
> +
> +		if (p == MAP_FAILED) {
> +			printf("FAILED\n");
> +			ret = 1;
> +			continue;
> +		}
> +
> +		if (t->low_addr_required && p >= (void *)(1UL << 47)) {
> +			printf("FAILED\n");
> +			ret = 1;
> +		} else {
> +			/*
> +			 * Do a dereference of the address returned so that we catch
> +			 * bugs in page fault handling
> +			 */
> +			*(int *)p = 10;

If we are going to touch memory, maybe not just first page, but whole
range? memset()?

> +			printf("OK\n");
> +		}
> +		if (!t->keep_mapped)
> +			munmap(p, t->size);
> +	}
> +
> +	return ret;
> +}

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2017-11-23 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23  3:03 Aneesh Kumar K.V
2017-11-23  3:42 ` Anshuman Khandual
2017-11-23 10:14 ` Kirill A. Shutemov [this message]

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=20171123101422.6fu7ehvjuw2v5jjh@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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