[PATCH 1/3] drm/xe: Store pointer to struct xe_gt in gt/ debugfs directory

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Mar 25 17:01:55 UTC 2024


On Wed, Feb 14, 2024 at 12:57:54PM +0100, Michal Wajdeczko wrote:
> Attributes added under 'gt/' directories may wish to use that
> in case they can't obtain it from elsewhere.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_debugfs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> index c4b67cf09f8f..207b992f1240 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> @@ -225,6 +225,9 @@ void xe_gt_debugfs_register(struct xe_gt *gt)
>  		return;
>  	}
>  
> +	/* other attributes may use parent->d_inode->i_private */

what did you mean with this comment?
if others are using, what would be the risks?
is this a good thing? is this a bad thing?

> +	root->d_inode->i_private = gt;

At first I thought this was intrusive, but then the following
patches made me realize that we are already being intrusive
when disrespecting the data:

include/drm/drm_debugfs.h
struct drm_debugfs_info
/** @data: Driver-private data, should not be device-specific. */


So it looks that we do need something else.

Looking the i_private that you pointed out seems an alternative

include/linux/fs.h
struct inode {
void                    *i_private; /* fs or device private pointer */

it is a 'device' pointer rather then a 'driver', but I'm still confident
that it is the right one to use.

It looks like the debugfs_create_file functions would override that
anyway with the data. Also other places in the fs code where this is
used for other checks.

So, perhaps we need something more flexible at the drm_debugfs layer
that would allow us to have a sub-device pointer?

The other 2 patches are great and you can already use rv-b on them if
we agree that this i_private change here is good.

Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Oded Gabbay <ogabbay at kernel.org>
Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>

> +
>  	/*
>  	 * Allocate local copy as we need to pass in the GT to the debugfs
>  	 * entry and drm_debugfs_create_files just references the drm_info_list
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list