Bug 49943 - radeon/drm: Hotplug udev events stop working
Summary: radeon/drm: Hotplug udev events stop working
Status: RESOLVED MOVED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Radeon (show other bugs)
Version: XOrg git
Hardware: All Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 02:00 UTC by Harald Judt
Modified: 2019-11-19 08:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Harald Judt 2012-05-15 02:00:47 UTC
Making use of udev events, I'd like to launch a script when a monitor gets connected or disconnected. However, an event is only fired once and then never again.

Kernel: linux-3.4.0-rc7

lspci:
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Cayman PRO [Radeon HD 6950] (prog-if 00 [VGA controller])
        Subsystem: Advanced Micro Devices [AMD] nee ATI Device 0b00
        Flags: bus master, fast devsel, latency 0, IRQ 54
        Memory at c0000000 (64-bit, prefetchable) [size=256M]
        Memory at fe620000 (64-bit, non-prefetchable) [size=128K]
        I/O ports at e000 [size=256]
        Expansion ROM at fe600000 [disabled] [size=128K]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150] Advanced Error Reporting
        Kernel driver in use: radeon

xrandr --verbose:
HDMI-0 connected (normal left inverted right x axis y axis)
        Identifier: 0x58
        Timestamp:  21810
        Subpixel:   horizontal rgb
        Clones:    
        CRTCs:      0 1 2 3 4 5
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        EDID:
                00ffffffffffff002203010be9030000
                00110103804627780b1990a755469824
                10494b3fcf00818081cf81c061c04bc0
                4bcf453c61cf011d007251d01e206e28
                5500c48e2100001e011d8018711c1620
                582c2500c48e2100009e000000fc004d
                737461722044656d6f0a2020000000fd
                0016500e5b10000a202020202020014b
                02031df24a0102038405101293141f23
                0907078301000065030c0010008c0ad0
                8a20e02d10103e9600138e2100001801
                1d00bc52d01e20b8285540c48e210000
                1e011d80d0721c1620102c2580c48e21
                00009e8c0ad08a20e02d10103e9600c4
                8e210000188c0ad090204031200c4055
                00c48e2100001800000000000000002b
        underscan vborder: 0 (0x00000000)       range:  (0,128)
        underscan hborder: 0 (0x00000000)       range:  (0,128)
        underscan:      off
                supported: off          on           auto        
        coherent: 1 (0x00000001)        range:  (0,1)
----- [modes cut off here] -----

ls -la /sys/class/drm/card0-HDMI-A-1/
insgesamt 0
drwxr-xr-x 3 root root    0 15. Mai 2012  .
drwxr-xr-x 8 root root    0 15. Mai 2012  ..
lrwxrwxrwx 1 root root    0 15. Mai 10:12 device -> ../../card0
-r--r--r-- 1 root root 4096 15. Mai 10:12 dpms
-r--r--r-- 1 root root    0 15. Mai 10:12 edid
-r--r--r-- 1 root root 4096 15. Mai 10:12 enabled
-r--r--r-- 1 root root 4096 15. Mai 10:12 modes
drwxr-xr-x 2 root root    0 15. Mai 10:12 power
-r--r--r-- 1 root root 4096 15. Mai 09:14 status
lrwxrwxrwx 1 root root    0 15. Mai 2012  subsystem -> ../../../../../../../class/drm
-rw-r--r-- 1 root root 4096 15. Mai 2012  uevent

Note the modification date of status and the other files. That of status did not change at all since boot, and the mdates of the others did change once apparently.

I can poll "status" and see the changes when executing xrandr, but there will be no more events, and the modification dates do not change anymore.
Comment 1 Harald Judt 2012-05-18 06:35:44 UTC
Ok, I've run radeonreg, here is the output:

Before HDMI connected:
0x601c  0x00000000 (0)
0x6028  0x06000012 (100663314)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0x00000000 (0)

HDMI connected:
0x601c  0x00000000 (0)
0x6028  0x06000012 (100663314)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff000012 (-16777198)

HDMI disconnected:
0x601c  0x00000000 (0)
0x6028  0x06000012 (100663314)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff0ff000 (-15732736)

The value of reg 0x6058 changes (HDMI-0). As you can see, after HDMI has been disconnected, it is different from the original value (0). I suspect that there is some problem with this?
Comment 2 Harald Judt 2012-05-18 06:45:13 UTC
BTW: Connecting HDMI again shows the following values:
HDMI connected:
0x601c  0x00000000 (0)
0x6028  0x06000012 (100663314)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff0ff012 (-15732718)

HDMI disconnected:
0x601c  0x00000000 (0)
0x6028  0x06000012 (100663314)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff0ff000 (-15732736)
Comment 3 Harald Judt 2012-05-20 05:05:10 UTC
Changing the register value using radeonreg also doesn't work:

radeonreg regset 0x6058 0x00000000
OLD: 0x6058 (6058)      0xff0ff000 (-15732736)
NEW: 0x6058 (6058)      0xff0ff000 (-15732736)
Comment 4 Harald Judt 2012-06-14 15:14:51 UTC
Ok, tried again with 3.4.0 final.

First, no HDMI monitor connected:

Evergreen HDMI regs:
0x601c  0x00000000 (0)
0x6028  0x050ff012 (84930578)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0x00000000 (0)

Connecting HDMI monitor:

udevadm monitor --property
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[115260.630569] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
ACTION=change
DEVNAME=/dev/dri/card0
DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=1815
SUBSYSTEM=drm

UDEV  [115260.638205] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
ACTION=change
DEVNAME=/dev/dri/card0
DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=1815
SUBSYSTEM=drm
USEC_INITIALIZED=115260630528

Evergreen HDMI regs:
0x601c  0x00000000 (0)
0x6028  0x050ff012 (84930578)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff000012 (-16777198)

Disconnecting HDMI monitor:

<< No events reported by udevadm >>

Evergreen HDMI regs:
0x601c  0x00000000 (0)
0x6028  0x050ff012 (84930578)
0x6034  0x00000012 (18)
0x6040  0x00000000 (0)
0x604c  0x00000000 (0)
0x6058  0xff0ff000 (-15732736)

Nothing improved, event notification still doesn't work :-(
Comment 5 Alex Deucher 2012-06-14 15:20:27 UTC
Can you see if the hw is still generating interrupts?  Enable drm debugging (boot with drm.debug=1 on the kernel command line in grub or as root:
echo 1 > /sys/module/drm/parameters/debug
Then plug and unplug your monitor and check your dmesg output.  You should see HPD messages each time you plug or unplug.  I'd suggest doing this without X running otherwise there will be too much other stuff in your dmesg output.
Comment 6 Harald Judt 2012-06-14 16:09:16 UTC
Yes, the computer prints these everytime I plug or unplug the HDMI monitor:

[drm:evergreen_irq_process], IH: HPD6

There are exactly 6 such messages to be found in dmesg, that would exactly correspond to connecting and disconnecting the monitor 3 times.

More data, perhaps useful:

[drm] Connector 2:
[drm]   HDMI-A
[drm]   HPD6
[drm]   DDC: 0x6460 0x6460 0x6464 0x6464 0x6468 0x6468 0x646c 0x646c
[drm]   Encoders:
[drm]     DFP3: INTERNAL_UNIPHY1
....
[drm:evergreen_irq_set], evergreen_irq_set: sw int cp1
[drm:evergreen_irq_set], evergreen_irq_set: sw int cp2
[drm:evergreen_irq_set], evergreen_irq_set: vblank 2
[drm:evergreen_irq_set], evergreen_irq_set: vblank 3
[drm:evergreen_irq_set], evergreen_irq_set: vblank 4
[drm:evergreen_irq_set], evergreen_irq_set: vblank 5
[drm:evergreen_irq_set], evergreen_irq_set: hpd 1
[drm:evergreen_irq_set], evergreen_irq_set: hpd 3
[drm:evergreen_irq_set], evergreen_irq_set: hpd 4
[drm:evergreen_irq_set], evergreen_irq_set: hpd 5
[drm:evergreen_irq_set], evergreen_irq_set: hpd 6
[drm:drm_calc_vbltimestamp_from_scanoutpos], crtc 1 : v 5 p(2174,501)@ 1339714655.238103 -> 1339714655.230668 [e 1 us, 0 rep]
[drm:evergreen_irq_process], r600_irq_process start: rptr 19552, wptr 19568
[drm:evergreen_irq_process], IH: HPD6
[drm:evergreen_irq_process], r600_irq_process start: rptr 19568, wptr 19584
[drm:evergreen_irq_process], IH: HPD6
[drm:evergreen_irq_process], r600_irq_process start: rptr 19584, wptr 19600
[drm:evergreen_irq_process], IH: HPD6
[drm:evergreen_irq_process], r600_irq_process start: rptr 19600, wptr 19616
[drm:evergreen_irq_process], IH: HPD6
[drm:evergreen_irq_process], r600_irq_process start: rptr 19616, wptr 19632
[drm:evergreen_irq_process], IH: HPD6
Comment 7 Alex Deucher 2012-06-14 16:44:11 UTC
ok, so the hw is working fine, the event is just not getting propagated to userspace properly.  Might be a duplicate of bug 51042.
Comment 8 Harald Judt 2012-09-21 16:05:14 UTC
Reproducible with linux-3.6.0-rc6. If it is a duplicate of bug 51042, shouldn't this be fixed now, or have the patches referenced in that bug not been committed yet (http://comments.gmane.org/gmane.comp.freedesktop.xorg.drivers.ati/22107, or more specific the patches by Daniel Vetter: http://lists.freedesktop.org/archives/dri-devel/2012-May/023407.html)?

I still get only two events when monitoring with udevadm:

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[601.731162] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
ACTION=change
DEVNAME=/dev/dri/card0
DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=1407
SUBSYSTEM=drm

UDEV  [601.731859] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
ACTION=change
DEVNAME=/dev/dri/card0
DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
DEVTYPE=drm_minor
HOTPLUG=1
MAJOR=226
MINOR=0
SEQNUM=1407
SUBSYSTEM=drm

After that, no more events on plug/unplug.
Comment 9 Alex Deucher 2012-10-04 15:50:56 UTC
(In reply to comment #8)
> Reproducible with linux-3.6.0-rc6. If it is a duplicate of bug 51042,
> shouldn't this be fixed now, or have the patches referenced in that bug not
> been committed yet
> (http://comments.gmane.org/gmane.comp.freedesktop.xorg.drivers.ati/22107, or
> more specific the patches by Daniel Vetter:
> http://lists.freedesktop.org/archives/dri-devel/2012-May/023407.html)?

If you disable polling, it also disables hotplug propagation since they share the same infrastructure in the common drm code.  Daniel's patches have not been merged upstream yet.
Comment 10 Harald Judt 2012-10-04 16:20:55 UTC
I didn't disable polling. However, if the patches haven't been merged upstream yet, then it's clear that it will not work. Thanks for clarification.
Comment 11 Martin Peres 2019-11-19 08:26:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/drm/amd/issues/272.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.