Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amdkfd: unreachable duplicate GFX12.1 check in kfd_ioctl_set_xnack_mode() --
commit 34665c5afc18630d5c2e3d3dd0b64b6b650cafc2 Author: Kent Russell <[email protected]> drm/amdgpu: Disable XNACK retry on GFX12.1 This commit disables XNACK retry on GFX12.1 in both amdgpu and amdkfd by forcing noretry=1, setting RETRY_DISABLE in SH_MEM_CONFIG, and rejecting XNACK mode enablement for GFX12.1 devices. [ ... ] > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > index 5a7f4f0cd0ce7..0728271f8c087 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > @@ -1766,6 +1766,8 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep, > > mutex_lock(&p->mutex); > if (args->xnack_enabled >= 0) { > + int i; > + > if (!list_empty(&p->pqm.queues)) { > pr_debug("Process has user queues running\n"); > r = -EBUSY; > @@ -1780,6 +1782,16 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep, > goto out_unlock; > } > > + /* XNACK cannot be enabled for gfx12.1 */ > + for (i = 0; i < p->n_pdds; i++) { > + struct kfd_node *dev = p->pdds[i]->dev; > + > + if (KFD_GC_VERSION(dev) == IP_VERSION(12, 1, 0)) { > + r = -EPERM; > + goto out_unlock; > + } > + } [Severity: Low] Is this loop in kfd_ioctl_set_xnack_mode() reachable? Immediately above it, enabling XNACK checks kfd_process_xnack_mode(p, true), which already iterates over p->pdds[] and returns false when KFD_GC_VERSION(dev) == IP_VERSION(12, 1, 0) (or dev->kfd->noretry is set): drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:kfd_ioctl_set_xnack_mode() { ... if (p->xnack_enabled == args->xnack_enabled) goto out_unlock; if (args->xnack_enabled && !kfd_process_xnack_mode(p, true)) { r = -EPERM; goto out_unlock; } ... } When args->xnack_enabled is 0, p->xnack_enabled is already initialized to false on GFX12.1, so the p->xnack_enabled == args->xnack_enabled check exits early (and if p->xnack_enabled were ever true, this unguarded loop would reject disabling XNACK with -EPERM). -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
