[PATCH 2/2] drm/amdkfd: Change unique_id to print hex format

Russell, Kent Kent.Russell at amd.com
Wed Oct 28 16:21:17 UTC 2020


[AMD Public Use]

amdgpu actually prints it as hex:
return snprintf(buf, PAGE_SIZE, "%016llx\n", adev->unique_id);

But either way, we can address it in rocminfo if anyone complains. Thanks for the review!

 Kent

> -----Original Message-----
> From: Kuehling, Felix <Felix.Kuehling at amd.com>
> Sent: Wednesday, October 28, 2020 12:11 PM
> To: Russell, Kent <Kent.Russell at amd.com>; amd-gfx at lists.freedesktop.org
> Subject: Re: [PATCH 2/2] drm/amdkfd: Change unique_id to print hex format
> 
> So rocm-smi reads the decimal and converts it to hex? Then changing KFD
> will break rocm-smi. If you want to fix rocminfo, you'll need to fix it
> in the rocminfo code to do the conversion to hex.
> 
> Regards,
>   Felix
> 
> Am 2020-10-28 um 12:02 p.m. schrieb Russell, Kent:
> > [AMD Public Use]
> >
> > rocminfo uses it, but that's all that I am aware of. I can drop this though and stick with
> patch1, I just didn't know if we'd end up getting complaints of:
> > "Well, rocm-smi (amdgpu) says that the unique_id is F, while rocminfo (amdkfd) says that
> the unique_id is 16" . Probably too late to try to change it now though, as you pointed out.
> >
> >  Kent
> >
> >> -----Original Message-----
> >> From: Kuehling, Felix <Felix.Kuehling at amd.com>
> >> Sent: Wednesday, October 28, 2020 11:55 AM
> >> To: amd-gfx at lists.freedesktop.org; Russell, Kent <Kent.Russell at amd.com>
> >> Subject: Re: [PATCH 2/2] drm/amdkfd: Change unique_id to print hex format
> >>
> >> This is an ABI-breaking change. Is any user mode code using this already?
> >>
> >> Regards,
> >>   Felix
> >>
> >> Am 2020-10-28 um 11:22 a.m. schrieb Kent Russell:
> >>> amdgpu's unique_id prints in hex format, so change topology's printout
> >>> to hex by adding a new sysfs_print macro specifically for hex output,
> >>> and use it for unique_id
> >>>
> >>> Signed-off-by: Kent Russell <kent.russell at amd.com>
> >>> ---
> >>>  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 +++-
> >>>  1 file changed, 3 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> >> b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> >>> index a3fc23873819..d13c68c52bbc 100644
> >>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> >>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
> >>> @@ -217,6 +217,8 @@ struct kfd_topology_device *kfd_create_topology_device(
> >>>  		sysfs_show_gen_prop(buffer, offs, "%s %u\n", name, value)
> >>>  #define sysfs_show_64bit_prop(buffer, offs, name, value) \
> >>>  		sysfs_show_gen_prop(buffer, offs, "%s %llu\n", name, value)
> >>> +#define sysfs_show_64bit_prop_hex(buffer, offs, name, value) \
> >>> +		sysfs_show_gen_prop(buffer, offs, "%s %llx\n", name, value)
> >>>  #define sysfs_show_32bit_val(buffer, offs, value) \
> >>>  		sysfs_show_gen_prop(buffer, offs, "%u\n", value)
> >>>  #define sysfs_show_str_val(buffer, offs, value) \
> >>> @@ -497,7 +499,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute
> >> *attr,
> >>>  			      dev->node_props.num_sdma_queues_per_engine);
> >>>  	sysfs_show_32bit_prop(buffer, offs, "num_cp_queues",
> >>>  			      dev->node_props.num_cp_queues);
> >>> -	sysfs_show_64bit_prop(buffer, offs, "unique_id",
> >>> +	sysfs_show_64bit_prop_hex(buffer, offs, "unique_id",
> >>>  			      dev->node_props.unique_id);
> >>>
> >>>  	if (dev->gpu) {


More information about the amd-gfx mailing list