[igt-dev] [PATCH i-g-t 2/4] xe/xe_sysfs: Modified code to work for non priv user

Upadhyay, Tejas tejas.upadhyay at intel.com
Wed Aug 2 09:42:48 UTC 2023



> -----Original Message-----
> From: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> Sent: Wednesday, August 2, 2023 2:09 PM
> To: Kumar, Janga Rahul <janga.rahul.kumar at intel.com>; igt-
> dev at lists.freedesktop.org; Upadhyay, Tejas <tejas.upadhyay at intel.com>;
> Dandamudi, Priyanka <priyanka.dandamudi at intel.com>
> Subject: [PATCH i-g-t 2/4] xe/xe_sysfs: Modified code to work for non priv
> user
> 
> From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> 
> Updated code to work non privileged user.
> Modified documentation.
> 
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Cc: Tejas Upadhyay <tejas.upadhyay at intel.com>
> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> ---
>  tests/xe/xe_sysfs_defaults.c  |  6 +++---  tests/xe/xe_sysfs_scheduler.c | 19
> +++++++++++++++----
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/xe/xe_sysfs_defaults.c b/tests/xe/xe_sysfs_defaults.c index
> ff958161b..0fc2918b6 100644
> --- a/tests/xe/xe_sysfs_defaults.c
> +++ b/tests/xe/xe_sysfs_defaults.c
> @@ -6,10 +6,10 @@
>  /**
>   * TEST: xe sysfs defaults
>   * Category: Infrastructure
> - * Functionality: driver handler
> + * Functionality: sysman defaults
>   * Run type: FULL
> - * Sub-category: xe
> - * Test category: SysMan
> + * Sub-category: sysman
> + * Test category: functionality test
>   * SUBTEST: engine-defaults
>   */
> 
> diff --git a/tests/xe/xe_sysfs_scheduler.c b/tests/xe/xe_sysfs_scheduler.c
> index f199d6be8..6dbbd1760 100644
> --- a/tests/xe/xe_sysfs_scheduler.c
> +++ b/tests/xe/xe_sysfs_scheduler.c
> @@ -5,6 +5,9 @@
> 
>  /**
>   * TEST: xe sysfs scheduler
> + * Sub-category: sysman
> + * Functionality: scheduler control interface
> + * Test category: functionality test
>   * Run type: FULL
>   *
>   * SUBTEST: %s-invalid
> @@ -107,14 +110,21 @@ static void test_min_max(int xe, int engine, const
> char **property)
> 
>  static void test_param_nonpriv(int xe, int engine, const char **property)  {
> +	struct stat st_engine, st_property;
>  	unsigned int default_max, max;
>  	unsigned int default_min, min;
>  	unsigned int set;
> -	struct stat st;
>  	int defaults;
> +	int property_fd;
> 
> -	fstat(engine, &st);
> -	fchmod(engine, (st.st_mode | S_IROTH | S_IWOTH));
> +	property_fd = openat(engine, property[0], O_RDWR);
> +	igt_require(property_fd != -1);
> +
> +	fstat(engine, &st_engine);
> +	fchmod(engine, (st_engine.st_mode | S_IRWXO | S_IRWXG |
> S_IRWXU));
> +
> +	fstat(property_fd, &st_property);
> +	fchmod(property_fd, (st_property.st_mode | S_IRWXO | S_IRWXG |
> +S_IRWXU));

Description of commit is not really talking about why this change is made. Can you please describe or reply here what are we trying to do here?

Tejas
> 
>  	defaults = openat(engine, ".defaults", O_DIRECTORY);
>  	igt_require(defaults != -1);
> @@ -150,7 +160,8 @@ static void test_param_nonpriv(int xe, int engine,
> const char **property)
>  	}
>  	igt_waitchildren();
> 
> -	fchmod(engine, st.st_mode);
> +	fchmod(engine, st_engine.st_mode);
> +	fchmod(property_fd, st_property.st_mode);
> 
>  	/* Reset max, min to original values */
>  	igt_sysfs_printf(engine, property[1], "%d", default_min);
> --
> 2.25.1



More information about the igt-dev mailing list