How to gracefully handle pci remove
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 > /sys/class/drm/card0/device/remove
One of the problems I encountered was hitting WARNs in amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious since
we didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 3460a3cb-91b9-3f3c-22af-d61b72a53454-5C7GfCeVMHo@public.gmane.org
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.S I tried with Intel card (i915) driver on 4.18.1 kernel to do the same to get some reference point, but it just hanged.
Andrey
Quoted 4 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious since
Quoted 8 lines
we didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 02a4e04d-6f6d-ea00-5345-abbcc5b86176-5C7GfCeVMHo@public.gmane.org
Quoted 6 lines · Andrey Grodzovsky
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.SI tried with Intel card (i915) driver on 4.18.1 kernel to do the same to get some reference point, but it just hanged.
drm_device hot-unplug is defacto unsolved. We've only just started to fix the most obvious races around the refcounting of drm_device it'self, see the work from Noralf Tronnes around drm_dev_get/put.
No one has even started to think about what it would take to correctly refcount a full-blown memory manager to handle hotunplug. I'd expect lots of nightmares. The real horror is that it's not just the drm_device, but also lots of things we're exporting: dma_buf, dma_fence, ... All of that must be handled one way or the other.
So expect your kernel to Oops when you unplug a device.
Wrt userspace handling this: Probably an even bigger question. No idea, and will depend upon what userspace you're running. -Daniel
Quoted 29 lines
Andrey
Quoted 21 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious sincewe didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CAKMK7uGEsERMvipQaC1_fY2AAmrJfANH4t3wOCZj83X=PpzNPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Thanks.
Andrey
Quoted 18 lines · Daniel Vetter
Quoted 6 lines · Andrey Grodzovsky
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.SI tried with Intel card (i915) driver on 4.18.1 kernel to do the same to get some reference point, but it just hanged.
drm_devicehot-unplug is defacto unsolved. We've only just started to fix the most obvious races around the refcounting ofdrm_deviceit'self, see the work from Noralf Tronnes around drm_dev_get/put.No one has even started to think about what it would take to correctly refcount a full-blown memory manager to handle hotunplug. I'd expect lots of nightmares. The real horror is that it's not just the
drm_device, but also lots of things we're exporting:dma_buf,dma_fence, ... All of that must be handled one way or the other.
Quoted 34 lines
So expect your kernel to Oops when you unplug a device.
Wrt userspace handling this: Probably an even bigger question. No idea, and will depend upon what userspace you're running. -Daniel
Quoted 26 lines
Andrey
Quoted 20 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious sincewe didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Actually, I've just spotted this drm_dev_unplug, does it make sense to use it in our pci_driver.remove hook
instead of explicitly doing drm_dev_unregister and drm_dev_put(dev) ?
This way at least any following IOCTL will fail with ENODEV.
Andrey
Quoted 18 lines · Daniel Vetter
Quoted 6 lines · Andrey Grodzovsky
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.SI tried with Intel card (i915) driver on 4.18.1 kernel to do the same to get some reference point, but it just hanged.
drm_devicehot-unplug is defacto unsolved. We've only just started to fix the most obvious races around the refcounting ofdrm_deviceit'self, see the work from Noralf Tronnes around drm_dev_get/put.No one has even started to think about what it would take to correctly refcount a full-blown memory manager to handle hotunplug. I'd expect lots of nightmares. The real horror is that it's not just the
drm_device, but also lots of things we're exporting:dma_buf,dma_fence, ... All of that must be handled one way or the other.
Quoted 34 lines
So expect your kernel to Oops when you unplug a device.
Wrt userspace handling this: Probably an even bigger question. No idea, and will depend upon what userspace you're running. -Daniel
Quoted 26 lines
Andrey
Quoted 20 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious sincewe didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 7e7f7ab2-0b39-0aeb-14b5-79a42999bc64-5C7GfCeVMHo@public.gmane.org
Take a look at what the udl drm driver does. It's a usb display chip.
Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Andrey Grodzovsky <[email protected]>
Sent: Wednesday, August 29, 2018 2:28:42 PM
To: Daniel Vetter; Noralf Trønnes
Cc: Dave Airlie; [email protected]; ML dri-devel; Koenig, Christian
Subject: Re: How to gracefully handle pci remove
Actually, I've just spotted this drm_dev_unplug, does it make sense to use it in our pci_driver.remove hook
instead of explicitly doing drm_dev_unregister and drm_dev_put(dev) ?
This way at least any following IOCTL will fail with ENODEV.
Andrey
Quoted 18 lines · Daniel Vetter
Quoted 6 lines · Andrey Grodzovsky
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.SI tried with Intel card (i915) driver on 4.18.1 kernel to do the same to get some reference point, but it just hanged.
drm_devicehot-unplug is defacto unsolved. We've only just started to fix the most obvious races around the refcounting ofdrm_deviceit'self, see the work from Noralf Tronnes around drm_dev_get/put.No one has even started to think about what it would take to correctly refcount a full-blown memory manager to handle hotunplug. I'd expect lots of nightmares. The real horror is that it's not just the
drm_device, but also lots of things we're exporting:dma_buf,dma_fence, ... All of that must be handled one way or the other.
Quoted 34 lines
So expect your kernel to Oops when you unplug a device.
Wrt userspace handling this: Probably an even bigger question. No idea, and will depend upon what userspace you're running. -Daniel
Quoted 26 lines
Andrey
Quoted 20 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs allocations which is obvious sincewe didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since they indeed may be extracted in any moment, is there any way to notify Xorg and other clients about this so they may
have a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · Andrey Grodzovsky
Actually, I've just spotted this
drm_dev_unplug, does it make sense to use it in our pci_driver.remove hookinstead of explicitly doing
drm_dev_unregisteranddrm_dev_put(dev)?This way at least any following IOCTL will fail with ENODEV.
Definitely. The problem is still that the refcounting beyond the drm_device is totally screwed up, and your kernel will Oops eventually.
-Daniel
Quoted 66 lines
Andrey
Quoted 60 lines · Daniel Vetter
Quoted 8 lines · Andrey Grodzovsky
Just another ping...
Daniel, Dave - maybe you could give some advise on that ?
P.SI tried with Intel card (i915) driver on 4.18.1 kernel to do the same to
get some reference point, but it just hanged.
drm_devicehot-unplug is defacto unsolved. We've only just started to fix the most obvious races around the refcounting ofdrm_deviceit'self, see the work from Noralf Tronnes around drm_dev_get/put.No one has even started to think about what it would take to correctly refcount a full-blown memory manager to handle hotunplug. I'd expect lots of nightmares. The real horror is that it's not just the
drm_device, but also lots of things we're exporting:dma_buf,dma_fence, ... All of that must be handled one way or the other.So expect your kernel to Oops when you unplug a device.
Wrt userspace handling this: Probably an even bigger question. No idea, and will depend upon what userspace you're running. -Daniel
Quoted 30 lines
Andrey
Quoted 24 lines · Andrey Grodzovsky
Hi everybody , I am trying to resolve various problems I observe when logically removing AMDGPU device from pci - echo 1 >
/sys/class/drm/card0/device/removeOne of the problems I encountered was hitting WARNs in
amdgpu_gem_force_release. It complaints about still open client FDs and BOs
allocations which is obvious sincewe didn't let user space clients know about the device removal and hence they won't release allocations and won't close their FDs.
Question - how other drivers handle this use case, especially eGPUs since
they indeed may be extracted in any moment, is there any way to notify Xorg
and other clients about this so they mayhave a chance to release all their allocations and probably terminate ? Maybe some kind of uevent ?
Andrey
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx