[igt-dev] [PATCH i-g-t 2/4] xe/xe_sysfs: Modified code to work for non priv user
Dandamudi, Priyanka
priyanka.dandamudi at intel.com
Wed Aug 2 09:56:15 UTC 2023
> -----Original Message-----
> From: Upadhyay, Tejas <tejas.upadhyay at intel.com>
> Sent: 02 August 2023 03:13 PM
> To: Dandamudi, Priyanka <priyanka.dandamudi at intel.com>; Kumar, Janga
> Rahul <janga.rahul.kumar at intel.com>; igt-dev at lists.freedesktop.org
> Subject: RE: [PATCH i-g-t 2/4] xe/xe_sysfs: Modified code to work for non priv
> user
>
>
>
> > -----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?
>
I just added permission to engine folder as well along with property. So, I have written in a high level that "updated code to make it work for non-privileged user" in commit description.
Regards,
Priyanka
> 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