[Public] Seems reasonable to me, but I'd want Felix (unlikely due to PTO) or Harish to weigh in to make sure I am not missing something obvious.
>From what I can tell, it was called way back when KFD Topology was first >written, back when it was for APUs-only. So they'd do 2 calls to update sysfs, >once for the CPU and once for the GPU. I think the logic just never got >touched because it still works, even though we've changed things a bit now. Kent > -----Original Message----- > From: amd-gfx <[email protected]> On Behalf Of Mario > Limonciello (AMD) > Sent: Wednesday, December 10, 2025 3:15 PM > To: [email protected] > Cc: Mario Limonciello (AMD) <[email protected]> > Subject: [PATCH v2 2/3] amdkfd: Don't rebuild node tree when calling > kfd_topology_update_sysfs() > > There is no need to remove all the nodes and rebuild them. The content > will be the same. Instead check whether the node was created and skip > the creation. > > Signed-off-by: Mario Limonciello (AMD) <[email protected]> > --- > drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c > b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c > index a0990dd2378c1..b65f29294e2d6 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c > @@ -650,8 +650,8 @@ static int kfd_build_sysfs_node_entry(struct > kfd_topology_device *dev, > uint32_t i, num_attrs; > struct attribute **attrs; > > - if (WARN_ON(dev->kobj_node)) > - return -EEXIST; > + if (dev->kobj_node) > + return 0; > > /* > * Creating the sysfs folders > @@ -888,8 +888,6 @@ static int kfd_topology_update_sysfs(void) > return ret; > } > > - kfd_remove_sysfs_node_tree(); > - > return kfd_build_sysfs_node_tree(); > } > > -- > 2.43.0
