Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Maslak <jan.maslak@intel.com>
To: <nakshtra.goyal@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, <ramadevi.gandi@intel.com>,
	<dwarakanath.ramadeva@intel.com>
Subject: Re: [PATCH] tests/intel/xe_mmap: Adding igt exercise for RO page
Date: Mon, 12 May 2025 10:21:02 +0000	[thread overview]
Message-ID: <aCHLjrlrPjyVYNQa@ART-DEV-395> (raw)
In-Reply-To: <20250414083627.3264121-1-nakshtra.goyal@intel.com>

On Mon, Apr 14, 2025 at 02:06:27PM +0530, nakshtra.goyal@intel.com wrote:
> From: Nakshtra Goyal <nakshtra.goyal@intel.com>
> 
> Map a memory then make it read-only and verify kernel out for read-only
> memory
> 
> Signed-off-by: Nakshtra Goyal <nakshtra.goyal@intel.com>
> ---
>  tests/intel/xe_mmap.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/tests/intel/xe_mmap.c b/tests/intel/xe_mmap.c
> index 5fd641075..649a11544 100644
> --- a/tests/intel/xe_mmap.c
> +++ b/tests/intel/xe_mmap.c
> @@ -338,6 +338,24 @@ static void test_small_bar(int fd)
>  	gem_close(fd, bo);
>  }
>  
> +static int
> +__xe_query(int fd, struct drm_xe_device_query *q)
> +{
> +	if (igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, q))
> +		return -errno;
> +	return 0;
> +}
> +
> +static int
> +__xe_query_items(int fd, uint32_t *items, uint32_t n_items)
> +{
> +	struct drm_xe_device_query q = {
> +		.size = n_items,
> +		.data = to_user_pointer(items),
> +	};
> +	return __xe_query(fd, &q);
> +}
> +
>  static void assert_caching(int fd, uint64_t placement, uint32_t flags,
>  			   uint16_t cpu_caching, bool fail)
>  {
> @@ -357,7 +375,16 @@ static void assert_caching(int fd, uint64_t placement, uint32_t flags,
>  	map = mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, mmo);
>  	igt_assert(map != MAP_FAILED);
>  	map[0] = 0xdeadbeaf;
> +	munmap(map, size);
>  	gem_close(fd, handle);
> +
> +	/* Adding a Read-Only page check exercise */
> +	map = mmap(0, size, PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
> +	igt_assert(map != MAP_FAILED);
> +	igt_assert_eq(0, mprotect(map, size, PROT_READ));
> +	igt_assert_lt(__xe_query_items(fd, map, 1), 0);
> +	munmap(map, size);
> +
Unnecessary empty line.
Other than that, LGTM.
Reviewed-by: Jan Maslak <jan.maslak@intel.com>
>  }
>  
>  /**
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2025-05-12 10:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14  8:36 [PATCH] tests/intel/xe_mmap: Adding igt exercise for RO page nakshtra.goyal
2025-04-14 15:41 ` ✓ i915.CI.BAT: success for tests/intel/xe_mmap: Adding igt exercise for RO page (rev2) Patchwork
2025-04-14 15:49 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-14 19:04 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-14 21:33 ` ✗ Xe.CI.Full: " Patchwork
2025-05-12 10:21 ` Jan Maslak [this message]
2025-05-14  6:28 ` [PATCH] tests/intel/xe_mmap: Adding igt exercise for RO page Dandamudi, Priyanka
  -- strict thread matches above, loose matches on Subject: below --
2025-04-14  7:45 nakshtra.goyal
2025-04-14  8:32 ` Dandamudi, Priyanka
2025-05-12 10:11 ` Jan Maslak

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=aCHLjrlrPjyVYNQa@ART-DEV-395 \
    --to=jan.maslak@intel.com \
    --cc=dwarakanath.ramadeva@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=nakshtra.goyal@intel.com \
    --cc=ramadevi.gandi@intel.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