All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: khandual@linux.vnet.ibm.com
Subject: Re: [PATCH] selftests/powerpc: Skip the subpage_prot tests if the syscall is disabled
Date: Mon, 26 Feb 2018 10:03:20 +0530	[thread overview]
Message-ID: <87d10sz7xr.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180226042510.13373-1-mpe@ellerman.id.au>

Michael Ellerman <mpe@ellerman.id.au> writes:

> The subpage_prot syscall is only functional when the system is using
> the Hash MMU. Since commit 5b2b80714796 ("powerpc/mm: Invalidate
> subpage_prot() system call on radix platforms") it returns ENOENT when
> the Radix MMU is active. Currently this just makes the test fail.
>
> Instead check explicitly for ENOENT and skip if we see that.
>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> Fixes: 5b2b80714796 ("powerpc/mm: Invalidate subpage_prot() system call on radix platforms")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  tools/testing/selftests/powerpc/mm/subpage_prot.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/tools/testing/selftests/powerpc/mm/subpage_prot.c b/tools/testing/selftests/powerpc/mm/subpage_prot.c
> index 35ade7406dcd..81570680e7ea 100644
> --- a/tools/testing/selftests/powerpc/mm/subpage_prot.c
> +++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c
> @@ -135,6 +135,15 @@ static int run_test(void *addr, unsigned long size)
>  	return 0;
>  }
>
> +static int syscall_available(void)
> +{
> +	int rc;
> +
> +	errno = 0;
> +	rc = syscall(__NR_subpage_prot, 0, 0, 0);
> +	return rc == 0 || errno != ENOENT;
> +}
> +
>  int test_anon(void)
>  {
>  	unsigned long align;
> @@ -145,6 +154,8 @@ int test_anon(void)
>  	void *mallocblock;
>  	unsigned long mallocsize;
>
> +	SKIP_IF(!syscall_available());
> +
>  	if (getpagesize() != 0x10000) {
>  		fprintf(stderr, "Kernel page size must be 64K!\n");
>  		return 1;
> @@ -180,6 +191,8 @@ int test_file(void)
>  	off_t filesize;
>  	int fd;
>
> +	SKIP_IF(!syscall_available());
> +
>  	fd = open(file_name, O_RDWR);
>  	if (fd == -1) {
>  		perror("failed to open file");
> -- 
> 2.14.1

      reply	other threads:[~2018-02-26  4:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  4:25 [PATCH] selftests/powerpc: Skip the subpage_prot tests if the syscall is disabled Michael Ellerman
2018-02-26  4:33 ` Aneesh Kumar K.V [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=87d10sz7xr.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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.