• Daniel Vetter's avatar
    drm/i915: Fix fbdev unload sequence · 4f256d82
    Daniel Vetter authored
    First thing we need to do is unregister the fbdev instance, but we
    can't just go ahead and kfree it. That must wait until the hotplug and
    polling work are stopped, since they can race with the with the
    teardown. That means we need to split up the fbdev teardown into the
    unregister part and the cleanup part.
    
    I originally suspected that this was broken in one of the unload
    shuffles, but on closer inspection the oldest sequence I've dug out
    also gets this wrong. Just not quite so badly.
    
    I've run drv_module_reload a few hundred times and it's rock solid
    compared to insta-death beforehand. This bug seems to have been
    uncovered by
    
    commit 88be58be
    Author: Daniel Vetter <daniel.vetter@ffwll.ch>
    Date:   Thu Jul 6 15:00:19 2017 +0200
    
        drm/i915/fbdev: Always forward hotplug events
    
    But the effect of that seems to only be to increase the race window
    enough to make it blow up easier. I'm not exactly clear on what's
    going on there ...
    
    v2: Fix whitespace and use fetch_and_zero (Chris).
    
    Testcase: igt/drv_module_reload
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101791
    Cc: martin.peres@free.fr
    Cc: chris@chris-wilson.co.uk
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20170714224656.6431-2-daniel.vetter@ffwll.ch
    4f256d82
intel_fbdev.c 23.4 KB