[Intel-gfx] [PATCH 1/2] drm/i915/params: add i915 parameters to debugfs

Jani Nikula jani.nikula at intel.com
Wed Jan 8 15:07:56 UTC 2020


On Wed, 08 Jan 2020, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Quoting Jani Nikula (2019-12-05 15:43:40)
>> +static int i915_param_int_open(struct inode *inode, struct file *file)
>> +{
>> +       return single_open(file, i915_param_int_show, inode->i_private);
>
> What I've always wanted with this style of approach was a means that the
> parameter is only set while the debugfs remained open.
>
> 	fd = open("/debug/my_parameter", O_WRONLY | O_EXCL);
> 	write(fd, "1", 1);
>
> 	... run test ..
>
> System reverts to default on process termination, or explicit close(fd).
>
> I'd make the open implicitly O_EXCL, i.e. return -EBUSY if something
> else already holds the parameter set. Or, you can use the O_EXCL to
> select between the different modes of operation.
>
> Moving the parameters to debugfs is more than worth it imo if we can
> enable this mode of operation.

I understand the use case, and I'd like something like that. But
(obviously?) I think the regular use case of 'echo 1 >
/debug/my_parameter' needs to work as one would expect.

Reading open(2) man page, feels like using O_EXCL for this would be a
hack. Granted, it's debugfs to begin with, but still. Makes me a bit
hesitant about abusing O_EXCL for this. (Or am I missing something?)

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list