Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sundaresan, Sujaritha" <sujaritha.sundaresan@intel.com>
To: "Upadhyay, Tejas" <tejas.upadhyay@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [v3 1/2] drm/xe: Add a new memory directory under tile
Date: Fri, 8 Dec 2023 13:58:17 +0530	[thread overview]
Message-ID: <692a9b93-dfba-43b9-a838-9e4cd20fa093@intel.com> (raw)
In-Reply-To: <SJ1PR11MB6204399019B23285D88A04B1818AA@SJ1PR11MB6204.namprd11.prod.outlook.com>


On 12/8/2023 10:33 AM, Upadhyay, Tejas wrote:
>
>> -----Original Message-----
>> From: Sundaresan, Sujaritha <sujaritha.sundaresan@intel.com>
>> Sent: Thursday, December 7, 2023 8:48 PM
>> To: intel-xe@lists.freedesktop.org
>> Cc: Upadhyay, Tejas <tejas.upadhyay@intel.com>; Tauro, Riana
>> <riana.tauro@intel.com>; Gupta, Anshuman <anshuman.gupta@intel.com>;
>> Sundaresan, Sujaritha <sujaritha.sundaresan@intel.com>
>> Subject: [v3 1/2] drm/xe: Add a new memory directory under tile
>>
>> Add a new memory directory under /device/tile<n> and move
>> physical_vram_size attribute to the new directory.
>>
>> New hierarchy:
>>
>> /device/tile<n>/memory/physical_vram_size_bytes
>>
>> v2: Fix heading typo (Riana)
>>      Fix cleanup error on unload/reload cycle
>>
>> v3: Fix reload error with kobject_put in place
>>      of kobject_del (Tejas)
>>
>> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_tile_sysfs.c | 19 ++++++++++++++-----
>>   1 file changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_tile_sysfs.c
>> b/drivers/gpu/drm/xe/xe_tile_sysfs.c
>> index 16376607c68f..64be1f3a38a9 100644
>> --- a/drivers/gpu/drm/xe/xe_tile_sysfs.c
>> +++ b/drivers/gpu/drm/xe/xe_tile_sysfs.c
>> @@ -24,7 +24,8 @@ static ssize_t
>>   physical_vram_size_bytes_show(struct device *kdev, struct device_attribute
>> *attr,
>>   			      char *buf)
>>   {
>> -	struct xe_tile *tile = kobj_to_tile(&kdev->kobj);
>> +	struct kobject *kobj = &kdev->kobj;
>> +	struct xe_tile *tile = kobj_to_tile(kobj->parent);
> As Christmas is approaching, you might want to adjust this in Christmas tree order.
>
>>   	return sysfs_emit(buf, "%llu\n", tile->mem.vram.actual_physical_size);
>>   }
>> @@ -36,8 +37,10 @@ static const struct attribute *physical_memsize_attr =
>>
>>   static void tile_sysfs_fini(struct drm_device *drm, void *arg)  {
>> -	struct xe_tile *tile = arg;
>> +	struct kobject *kobj = arg;
>> +	struct xe_tile *tile = kobj_to_tile(kobj->parent);
> Ditto
>
>> +	kobject_put(kobj);
>>   	kobject_put(tile->sysfs);
>>   }
>>
>> @@ -46,6 +49,7 @@ void xe_tile_sysfs_init(struct xe_tile *tile)
>>   	struct xe_device *xe = tile_to_xe(tile);
>>   	struct device *dev = xe->drm.dev;
>>   	struct kobj_tile *kt;
>> +	struct kobject *kobj;
>>   	int err;
>>
>>   	kt = kzalloc(sizeof(*kt), GFP_KERNEL); @@ -64,12 +68,17 @@ void
>> xe_tile_sysfs_init(struct xe_tile *tile)
>>
>>   	tile->sysfs = &kt->base;
>>
>> -	if (IS_DGFX(xe) && xe->info.platform != XE_DG1 &&
>> -	    sysfs_create_file(tile->sysfs, physical_memsize_attr))
>> +	kobj = kobject_create_and_add("memory", tile->sysfs);
>> +	if (!kobj) {
>> +		drm_warn(&xe->drm, "%s failed, err: %d\n", __func__, -
>> ENOMEM);
>> +	}
> { } is not required here.
>
> Tejas

Will fix all of the above.

Thanks,

Suja

>> +
>> +	if (kobj && IS_DGFX(xe) && xe->info.platform != XE_DG1 &&
>> +	    sysfs_create_file(kobj, physical_memsize_attr))
>>   		drm_warn(&xe->drm,
>>   			 "Sysfs creation to read addr_range per tile failed\n");
>>
>> -	err = drmm_add_action_or_reset(&xe->drm, tile_sysfs_fini, tile);
>> +	err = drmm_add_action_or_reset(&xe->drm, tile_sysfs_fini, kobj);
>>   	if (err) {
>>   		drm_warn(&xe->drm, "%s: drmm_add_action_or_reset
>> failed, err: %d\n",
>>   			 __func__, err);
>> --
>> 2.25.1

  reply	other threads:[~2023-12-08  8:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 15:17 [v3 0/2] Add memory sysfs directory and attributes Sujaritha Sundaresan
2023-12-07 15:17 ` [v3 1/2] drm/xe: Add a new memory directory under tile Sujaritha Sundaresan
2023-12-08  5:03   ` Upadhyay, Tejas
2023-12-08  8:28     ` Sundaresan, Sujaritha [this message]
2023-12-11  9:53       ` Riana Tauro
2023-12-11 10:14         ` Sundaresan, Sujaritha
2023-12-11 11:01           ` Upadhyay, Tejas
2023-12-11 11:07             ` Riana Tauro
2023-12-11 11:13               ` Riana Tauro
2023-12-11 11:41                 ` Sundaresan, Sujaritha
2023-12-07 15:17 ` [v3 2/2] drm/xe: Add vram frequency sysfs attributes Sujaritha Sundaresan
2023-12-07 23:11 ` ✓ CI.Patch_applied: success for Add memory sysfs directory and attributes (rev3) Patchwork
2023-12-07 23:11 ` ✗ CI.checkpatch: warning " Patchwork
2023-12-07 23:12 ` ✓ CI.KUnit: success " Patchwork
2023-12-07 23:20 ` ✓ CI.Build: " Patchwork
2023-12-07 23:20 ` ✓ CI.Hooks: " Patchwork
2023-12-07 23:21 ` ✓ CI.checksparse: " Patchwork
2023-12-07 23:57 ` ✓ CI.BAT: " Patchwork
2023-12-11 22:41 ` [v3 0/2] Add memory sysfs directory and attributes Matt Roper
2023-12-11 22:57   ` Rodrigo Vivi
2023-12-11 23:08     ` Matt Roper
2023-12-12  0:12       ` Vivi, Rodrigo
2023-12-12  3:58   ` Upadhyay, Tejas

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=692a9b93-dfba-43b9-a838-9e4cd20fa093@intel.com \
    --to=sujaritha.sundaresan@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=tejas.upadhyay@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