Hi Felix,

> the extra checks for pci_dev_is_disconnected are unnecessary. IMO the
> cleanest solution is the one with the least special case handling
> deep in the KFD code. I.e. just guarding the critical sections that
> need HW access between drm_dev_enter/exit, and not having any
> unbounded fence-wait inside those critical sections, should be
> sufficient.

Agreed — that's cleaner. v5 drops all the unplugged/disconnected
checks; drm_dev_enter() fails fast once unplug starts, and the
AMDGPU_FENCE_JIFFIES_TIMEOUT bound covers the window where the link
is dead but drm_dev_unplug() hasn't run yet.

One observation for the record: in that dead-but-not-yet-unplugged
window dev_enter still succeeds, so each migration attempt submits
to hardware that can't complete and pays one ~500ms timeout instead
of failing instantly. In practice the window is short and the total
removal completed in ~7s on my repro, so the simpler code wins.

Re-verified the minimal version on the MI50/Thunderbolt repro: SIGBUS
delivered, coredump completes, kfd_processes_count drains in ~7s,
pciehp removal finishes, device re-enumerates on re-power.

Olivier

Reply via email to