Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: S Sebinraj <s.sebinraj@intel.com>
Cc: igt-dev@lists.freedesktop.org, jeevaka.badrappan@intel.com,
	zbigniew.kempczynski@intel.com
Subject: Re: [PATCH i-g-t v4 1/1] tests/kms_concurrent: Add SYSVIPC support check
Date: Wed, 8 Oct 2025 15:26:33 +0300	[thread overview]
Message-ID: <aOZYebB0Q9hYC7UT@intel.com> (raw)
In-Reply-To: <20251008054812.545177-2-s.sebinraj@intel.com>

On Wed, Oct 08, 2025 at 11:18:12AM +0530, S Sebinraj wrote:
> Check for System V IPC support in kms_concurrent test to handle
> targets that don't have SYSVIPC enabled in their kernel. Without this
> check, the test would fail with assertion errors when trying to use
> message queues.
> 
> The implementation checks if the target supports IPC,
> if not found it skips the test.
> 
> Signed-off-by: S Sebinraj <s.sebinraj@intel.com>
> ---
>  lib/intel_allocator.c  | 25 ++++++++++++++++++++++++-
>  lib/intel_allocator.h  | 10 +++++++++-
>  tests/kms_concurrent.c |  4 +++-
>  3 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
> index d22c70f1f..fef286e35 100644
> --- a/lib/intel_allocator.c
> +++ b/lib/intel_allocator.c
> @@ -839,14 +839,21 @@ void __intel_allocator_multiprocess_start(void)
>   *
>   * Note. This destroys all previously created allocators and theirs content.
>   */
> -void intel_allocator_multiprocess_start(void)
> +bool intel_allocator_multiprocess_start(void)
>  {
>  	alloc_info("allocator multiprocess start\n");
>  
> +	if (!device_supports_sysvipc()) {
> +		igt_warn("Device does not support SYSVIPC, multiprocess not supported\n");
> +		return false;
> +	}
> +
>  	igt_assert_f(child_pid == -1,
>  		     "Allocator thread can be spawned only in main IGT process\n");
>  	__intel_allocator_multiprocess_prepare();
>  	__intel_allocator_multiprocess_start();
> +
> +	return true;
>  }
>  
>  /**
> @@ -879,6 +886,22 @@ void intel_allocator_multiprocess_stop(void)
>  	}
>  }
>  
> +/**
> + * Checks if the current device supports SYSVIPC by verifying the existence and accessibility
> + * of the /proc/sysvipc directory.
> + * Returns: true if accessible for read and write, false otherwise.
> + */
> +bool device_supports_sysvipc(void)

"device" makes me think of the drm device/gpu. "system" or something would
seem better. 

> +{
> +	char path[128] = {'\0'};
> +
> +	snprintf(path, sizeof(path), "/proc/sysvipc");

What? Just pass the string directly to access.

> +	if (access(path, R_OK | W_OK) == 0)
> +		return true;
> +
> +	return false;
> +}
> +
>  static void track_ahnd(int fd, uint64_t ahnd, uint32_t vm)
>  {
>  	struct ahnd_info *ainfo;
> diff --git a/lib/intel_allocator.h b/lib/intel_allocator.h
> index 4b6292f06..24ce6dbfa 100644
> --- a/lib/intel_allocator.h
> +++ b/lib/intel_allocator.h
> @@ -166,9 +166,17 @@ struct intel_allocator {
>  void intel_allocator_init(void);
>  void __intel_allocator_multiprocess_prepare(void);
>  void __intel_allocator_multiprocess_start(void);
> -void intel_allocator_multiprocess_start(void);
> +bool intel_allocator_multiprocess_start(void);
>  void intel_allocator_multiprocess_stop(void);
>  
> +/**
> + * device_supports_sysvipc:
> + *
> + * A function to check if the device supports IPC
> + * @return: true or false
> + * */
> +bool device_supports_sysvipc(void);
> +
>  uint64_t intel_allocator_open(int fd, uint32_t ctx, uint8_t allocator_type);
>  uint64_t intel_allocator_open_full(int fd, uint32_t ctx,
>  				   uint64_t start, uint64_t end,
> diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
> index 4f16f8b89..ab9ae29a8 100644
> --- a/tests/kms_concurrent.c
> +++ b/tests/kms_concurrent.c
> @@ -395,8 +395,10 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
>  		igt_display_require(&data.display, data.drm_fd);
>  		igt_require(data.display.is_atomic);
>  		igt_display_require_output(&data.display);
> +
>  		if (is_intel_device(data.drm_fd))
> -			intel_allocator_multiprocess_start();
> +			igt_require_f(!intel_allocator_multiprocess_start(),
> +							"Allocator failure, no SYSV IPC\n");
>  	}
>  
>  	run_tests_for_pipe(&data);
> -- 
> 2.43.0

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2025-10-08 12:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08  5:48 [PATCH i-g-t v4 0/1] tests/kms_concurrent: Check for SYSVIPC S Sebinraj
2025-10-08  5:48 ` [PATCH i-g-t v4 1/1] tests/kms_concurrent: Add SYSVIPC support check S Sebinraj
2025-10-08 11:48   ` Kamil Konieczny
2025-10-08 11:53   ` Kamil Konieczny
2025-10-08 12:26   ` Ville Syrjälä [this message]
2025-10-08  7:10 ` ✓ Xe.CI.BAT: success for tests/kms_concurrent: Check for SYSVIPC (rev3) Patchwork
2025-10-08  7:30 ` ✓ i915.CI.BAT: " Patchwork
2025-10-08  8:19 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-09  6:13   ` Sebinraj, S
2025-10-08 15:10 ` ✗ i915.CI.Full: " Patchwork
2025-10-09  6:18   ` Sebinraj, S

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=aOZYebB0Q9hYC7UT@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevaka.badrappan@intel.com \
    --cc=s.sebinraj@intel.com \
    --cc=zbigniew.kempczynski@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