Skip to contentSkip to conversation

drm/amdkfd: Align unique_id format to match amdgpu

PATCH In review Kent Russell 2 participants 3 messages Sep 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Align unique_id format to match amdgpu

unique_id is printed as %016llx in amdgpu, but %llu in KFD. Call the sysfs_show_gen_prop function directly and use the %016llx format, to align with amdgpu. Don't need to add a new macro since this is a one-off.

---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -1
index c8c75ff7cea8..4dac29cdab20 100644
@@ -538,7 +538,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
 				      dev->node_props.debug_prop);
 		sysfs_show_32bit_prop(buffer, offs, "sdma_fw_version",
 				      dev->gpu->kfd->sdma_fw_version);
-		sysfs_show_64bit_prop(buffer, offs, "unique_id",
+		sysfs_show_gen_prop(buffer, offs, "%s %016llx\n", "unique_id",
 				      dev->gpu->adev->unique_id);
 		sysfs_show_32bit_prop(buffer, offs, "num_xcc",
 				      NUM_XCC(dev->gpu->xcc_mask));
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 3 lines · Kent Russell

unique_id is printed as %016llx in amdgpu, but %llu in KFD. Call the sysfs_show_gen_prop function directly and use the %016llx format, to align with amdgpu. Don't need to add a new macro since this is a one-off.

Doesn't this break the ABI? Any tool currently reading the unique ID would expect it to be decimal.

Regards,
  Felix

Quoted 19 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -1
index c8c75ff7cea8..4dac29cdab20 100644
@@ -538,7 +538,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
  				      dev->node_props.debug_prop);
  		sysfs_show_32bit_prop(buffer, offs, "sdma_fw_version",
  				      dev->gpu->kfd->sdma_fw_version);
-		sysfs_show_64bit_prop(buffer, offs, "unique_id",
+		sysfs_show_gen_prop(buffer, offs, "%s %016llx\n", "unique_id",
  				      dev->gpu->adev->unique_id);
  		sysfs_show_32bit_prop(buffer, offs, "num_xcc",
  				      NUM_XCC(dev->gpu->xcc_mask));
#2 lore raw

[AMD Official Use Only - General]

Quoted 7 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Thursday, September 14, 2023 1:25 PM
To: Russell, Kent <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdkfd: Align unique_id format to match amdgpu

Quoted 7 lines
Quoted 3 lines · Kent Russell

unique_id is printed as %016llx in amdgpu, but %llu in KFD. Call the sysfs_show_gen_prop function directly and use the %016llx format, to align with amdgpu. Don't need to add a new macro since this is a one-off.

Doesn't this break the ABI? Any tool currently reading the unique ID would expect it to be decimal.

A fair point, and was something I was on the fence on. The inquiry came from rocm-smi, noting that the unique_ids didn't align. One would assume that reading a sysfs file would be done as a string and then converted, but you're right. We can't risk breaking other tools just because we want to fix one of ours and make assumptions about how tools consume the information. I'll talk to the SMI guys about trying to convert to hex in SMI to align instead.

Kent

Quoted 26 lines

Regards,
Felix

Review

Quoted 7 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c

drivers/gpu/drm/amd/amdkfd/kfd_topology.c static ssize_t node_show(struct kobject *kobj, struct

Quoted 4 lines

index c8c75ff7cea8..4dac29cdab20 100644

drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -0
@@ -538,7 +538,7 @@ static ssize_t node_show(struct kobject *kobj, struct

attribute *attr,

Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 -1
                                  dev->node_props.debug_prop);
            sysfs_show_32bit_prop(buffer, offs, "sdma_fw_version",
                                  dev->gpu->kfd->sdma_fw_version);
-           sysfs_show_64bit_prop(buffer, offs, "unique_id",
+           sysfs_show_gen_prop(buffer, offs, "%s %016llx\n", "unique_id",
                                  dev->gpu->adev->unique_id);
            sysfs_show_32bit_prop(buffer, offs, "num_xcc",
                                  NUM_XCC(dev->gpu->xcc_mask));