<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Take a look at what the udl drm driver does. It's a usb display chip.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Alex<br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Andrey Grodzovsky <Andrey.Grodzovsky@amd.com><br>
<b>Sent:</b> Wednesday, August 29, 2018 2:28:42 PM<br>
<b>To:</b> Daniel Vetter; Noralf Trønnes<br>
<b>Cc:</b> Dave Airlie; amd-gfx@lists.freedesktop.org; ML dri-devel; Koenig, Christian<br>
<b>Subject:</b> Re: How to gracefully handle pci remove</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Actually, I've just spotted this drm_dev_unplug, does it make sense to
<br>
use it in our pci_driver.remove hook<br>
<br>
instead of explicitly doing drm_dev_unregister and drm_dev_put(dev) ?<br>
<br>
This way at least any following IOCTL will fail with ENODEV.<br>
<br>
Andrey<br>
<br>
<br>
On 08/29/2018 11:07 AM, Daniel Vetter wrote:<br>
> On Wed, Aug 29, 2018 at 4:43 PM, Andrey Grodzovsky<br>
> <Andrey.Grodzovsky@amd.com> wrote:<br>
>> Just another ping...<br>
>><br>
>> Daniel, Dave - maybe you could give some advise on that ?<br>
>><br>
>> P.S I tried with Intel card (i915) driver on 4.18.1 kernel to do the same to<br>
>> get some reference point, but it just hanged.<br>
> drm_device hot-unplug is defacto unsolved. We've only just started to<br>
> fix the most obvious races around the refcounting of drm_device<br>
> it'self, see the work from Noralf Tronnes around drm_dev_get/put.<br>
><br>
> No one has even started to think about what it would take to correctly<br>
> refcount a full-blown memory manager to handle hotunplug. I'd expect<br>
> lots of nightmares. The real horror is that it's not just the<br>
> drm_device, but also lots of things we're exporting: dma_buf,<br>
> dma_fence, ... All of that must be handled one way or the other.<br>
><br>
> So expect your kernel to Oops when you unplug a device.<br>
><br>
> Wrt userspace handling this: Probably an even bigger question. No<br>
> idea, and will depend upon what userspace you're running.<br>
> -Daniel<br>
><br>
>> Andrey<br>
>><br>
>><br>
>><br>
>><br>
>> On 08/27/2018 12:04 PM, Andrey Grodzovsky wrote:<br>
>>> Hi everybody , I am trying to resolve various problems I observe when<br>
>>> logically removing AMDGPU device from pci - echo 1 ><br>
>>> /sys/class/drm/card0/device/remove<br>
>>><br>
>>> One of the problems I encountered was hitting WARNs in<br>
>>> amdgpu_gem_force_release. It complaints about still open client FDs and BOs<br>
>>> allocations which is obvious since<br>
>>><br>
>>> we didn't let user space clients know about the device removal and hence<br>
>>> they won't release allocations and won't close their FDs.<br>
>>><br>
>>> Question - how other drivers handle this use case, especially eGPUs since<br>
>>> they indeed may be extracted in any moment, is there any way to notify Xorg<br>
>>> and other clients about this so they may<br>
>>><br>
>>> have a chance to release all their allocations and probably terminate ?<br>
>>> Maybe some kind of uevent ?<br>
>>><br>
>>> Andrey<br>
>>><br>
><br>
><br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>