amdkfd: remove pasid under kfd sysfs folders
Subsystems (3)
PATCH 1/1 amdkfd: remove pasid under kfd sysfs folders
This commit removes pasid under kfd sysfs folders because pasid should only be used in kernel internally, should not be exposed to user space, and current pasid under kfd sysfs is buggy hard-coded 0.
--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 7 ------- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 +------- 2 files changed, 1 insertion(+), 14 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0 -7
@@ -983,7 +983,6 @@ struct kfd_process {/* Kobj for our procfs */ struct kobject *kobj;struct kobject *kobj_queues; -struct attribute attr_pasid;/* Keep track cwsr init */ bool has_cwsr;
@@ -1100,12 +1099,6 @@ void kfd_process_device_remove_obj_handle(struct kfd_process_device *pdd, int handle);struct kfd_process *kfd_lookup_process_by_pid (struct pid *pid); -/* PASIDs */ -int kfd_pasid_init (void ); -void kfd_pasid_exit (void ); -u32 kfd_pasid_alloc (void ); -void kfd_pasid_free (u32 pasid); -/* Doorbells */ size_t kfd_doorbell_process_slice (struct kfd_dev *kfd);int kfd_doorbell_init (struct kfd_dev *kfd);
drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 -7
@@ -328,9 +328,7 @@ static int kfd_get_cu_occupancy(struct attribute *attr, char *buffer)static ssize_t kfd_procfs_show (struct kobject *kobj,struct attribute *attr,char *buffer) { -if (strcmp (attr->name,"pasid" ) ==0 ) -return snprintf (buffer,PAGE_SIZE ,"%d\n" ,0 ); -else if (strncmp (attr->name,"vram_" ,5 ) ==0 ) { +if (strncmp (attr->name,"vram_" ,5 ) ==0 ) { struct kfd_process_device *pdd = container_of(attr, struct kfd_process_device, attr_vram);return snprintf (buffer,PAGE_SIZE ,"%llu\n" ,atomic64_read (&pdd->vram_usage));
@@ -888,9 +886,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) goto out; } -kfd_sysfs_create_file (process->kobj, &process->attr_pasid, -"pasid" ); - process->kobj_queues =kobject_create_and_add ("queues" , process->kobj);if (!process->kobj_queues)
@@ -1104,7 +1099,6 @@ static void kfd_process_remove_sysfs(struct kfd_process *p)if (!p->kobj)return ; -sysfs_remove_file (p->kobj, &p->attr_pasid);kobject_del (p->kobj_queues);kobject_put (p->kobj_queues); p->kobj_queues =NULL ;
Signature · 1 line
2.51.0
Kuehling, Felix
maintainerQuoted 4 lines · Zhu Lingshan
This commit removes pasid under kfd sysfs folders because pasid should only be used in kernel internally, should not be exposed to user space, and current pasid under kfd sysfs is buggy hard-coded 0.
NAK. We left this file with a dummy value deliberately, to prevent breaking existing ROCm SMI versions. We can never remove this as long as such versions of ROCm SMI may be in circulation.
Regards,
Felix
Quoted 65 lines
Signed-off-by Zhu Lingshan <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 7 ------- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 +------- 2 files changed, 1 insertion(+), 14 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-7@@ -983,7 +983,6 @@ struct kfd_process {/* Kobj for our procfs */ struct kobject *kobj;struct kobject *kobj_queues; -struct attribute attr_pasid;/* Keep track cwsr init */ bool has_cwsr;@@ -1100,12 +1099,6 @@ void kfd_process_device_remove_obj_handle(struct kfd_process_device *pdd, int handle);struct kfd_process *kfd_lookup_process_by_pid (struct pid *pid); -/* PASIDs */ -int kfd_pasid_init (void ); -void kfd_pasid_exit (void ); -u32 kfd_pasid_alloc (void ); -void kfd_pasid_free (u32 pasid); -/* Doorbells */ size_t kfd_doorbell_process_slice (struct kfd_dev *kfd);int kfd_doorbell_init (struct kfd_dev *kfd);drivers/gpu/drm/amd/amdkfd/kfd_process.c +1
-7@@ -328,9 +328,7 @@ static int kfd_get_cu_occupancy(struct attribute *attr, char *buffer)static ssize_t kfd_procfs_show (struct kobject *kobj,struct attribute *attr,char *buffer) { -if (strcmp (attr->name,"pasid" ) ==0 ) -return snprintf (buffer,PAGE_SIZE ,"%d\n" ,0 ); -else if (strncmp (attr->name,"vram_" ,5 ) ==0 ) { +if (strncmp (attr->name,"vram_" ,5 ) ==0 ) { struct kfd_process_device *pdd = container_of(attr, struct kfd_process_device, attr_vram);return snprintf (buffer,PAGE_SIZE ,"%llu\n" ,atomic64_read (&pdd->vram_usage));@@ -888,9 +886,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) goto out; } -kfd_sysfs_create_file (process->kobj, &process->attr_pasid, -"pasid" ); - process->kobj_queues =kobject_create_and_add ("queues" , process->kobj);if (!process->kobj_queues)@@ -1104,7 +1099,6 @@ static void kfd_process_remove_sysfs(struct kfd_process *p)if (!p->kobj)return ; -sysfs_remove_file (p->kobj, &p->attr_pasid);kobject_del (p->kobj_queues);kobject_put (p->kobj_queues); p->kobj_queues =NULL ;
Quoted 9 lines · Felix
Quoted 4 lines · Zhu Lingshan
This commit removes pasid under kfd sysfs folders because pasid should only be used in kernel internally, should not be exposed to user space, and current pasid under kfd sysfs is buggy hard-coded 0.
NAK. We left this file with a dummy value deliberately, to prevent breaking existing ROCm SMI versions. We can never remove this as long as such versions of ROCm SMI may be in circulation.
I am not sure 0 is a good dummy value, because 0 is meaningful, usually stands for "the first one" or "success". ROCm SMI may treat pasid == 0 as a dummy, but there can be other user space tools, even non-opensource customer tools may see this 0 as the first pasid.
pasid ==0 is misleading here, so I suggest we show pasid == -1 which is opposite to the concept of pasid.
Thanks
Lingshan
Quoted 76 lines
Regards,
FelixQuoted 70 lines
Signed-off-by Zhu Lingshan <[email protected]>---
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 7 -------drivers/gpu/drm/amd/amdkfd/kfd_process.c| 8 +-------2 files changed, 1 insertion(+), 14 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-1@@ -983,7 +983,6 @@ struct kfd_process { /* Kobj for our procfs */ struct kobject *kobj; struct kobject *kobj_queues; - struct attribute attr_pasid; /* Keep track cwsr init */ bool has_cwsr;@@ -1100,12 +1099,6 @@ void kfd_process_device_remove_obj_handle(struct kfd_process_device *pdd, int handle); struct kfd_process *kfd_lookup_process_by_pid(struct pid *pid);-/* PASIDs */
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-5-int kfd_pasid_init (void ); -void kfd_pasid_exit (void ); -u32 kfd_pasid_alloc (void ); -void kfd_pasid_free (u32 pasid); -/* Doorbells */
size_tkfd_doorbell_process_slice(struct kfd_dev *kfd); intkfd_doorbell_init(struct kfd_dev *kfd);drivers/gpu/drm/amd/amdkfd/kfd_process.c +0
-0@@ -328,9 +328,7 @@ static int kfd_get_cu_occupancy(struct attribute *attr, char *buffer)static
ssize_tkfd_procfs_show(struct kobject *kobj, struct attribute *attr,
char *buffer)
{
- if (strcmp(attr->name, "pasid")== 0)
- returnsnprintf(buffer, PAGE_SIZE, "%d\n", 0);
- else if (strncmp(attr->name, "vram_", 5)== 0) {
+ if (strncmp(attr->name, "vram_", 5)== 0) {
structkfd_process_device*pdd = container_of(attr, structkfd_process_device,
attr_vram);
returnsnprintf(buffer, PAGE_SIZE, "%llu\n", atomic64_read(&pdd->vram_usage));drivers/gpu/drm/amd/amdkfd/kfd_process.c +0
-2@@ -888,9 +886,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) goto out; } - kfd_sysfs_create_file(process->kobj, &process->attr_pasid, - "pasid"); - process->kobj_queues = kobject_create_and_add("queues", process->kobj);if (!process->kobj_queues)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +0
-0@@ -1104,7 +1099,6 @@ static void kfd_process_remove_sysfs(struct kfd_process *p) if (!p->kobj) return; - sysfs_remove_file(p->kobj, &p->attr_pasid); kobject_del(p->kobj_queues); kobject_put(p->kobj_queues);
p->kobj_queues= NULL;