evdi icon indicating copy to clipboard operation
evdi copied to clipboard

Module cannot initialise when compiled with LTO

Open corrmaan opened this issue 6 years ago • 4 comments

Initially please make sure the problem hasn't been already addressed:

  • [ Y ] Are you using the latest driver? (https://www.displaylink.com/downloads/ubuntu)
  • [ Y ] Are you using the latest EVDI version? (https://github.com/DisplayLink/evdi/releases)
  • [ Y ] If you are using a DisplayLink device, have you checked 'troubleshooting' on DisplayLink's website? (https://support.displaylink.com/knowledgebase/topics/103927-troubleshooting-ubuntu)
  • [ Y ] Is this issue related to evdi/kernel? (if it is rather connected to DisplayLinkManager please take a look at support https://support.displaylink.com or forum https://www.displaylink.org/forum/)

Some information for baseline would help a lot:

  • Linux distribution and its version Gentoo ~amd64
  • Linux kernel version 5.7.3
  • Xorg version (if used) N/A
  • Desktop environment in use N/A

When the module is compiled without LTO:

CFLAGS="-march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed"
CXXFLAGS="-march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -falign-functions=32"
$ dmesg | grep -i evdi
[   32.537517] evdi: [I] Initialising logging on level 5
[   32.537517] evdi: [I] Atomic driver:yes
[   32.537578] evdi: [D] evdi_add_devices:156 Increasing device count to 4
[   32.537617] evdi: [D] evdi_crtc_init:389 drm_crtc_init: 0 p000000001915a3c8
[   32.537623] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.537626] evdi evdi.0: [drm] Cannot find any crtc or sizes
[   32.537630] evdi: [W] evdi_painter_send_update_ready_if_needed:645 Painter does not exist!
[   32.537739] [drm] Initialized evdi 1.7.0 20200327 for evdi.0 on minor 1
[   32.537770] evdi: [D] evdi_crtc_init:389 drm_crtc_init: 0 p00000000b23fa811
[   32.537773] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.537775] evdi evdi.1: [drm] Cannot find any crtc or sizes
[   32.537778] evdi: [W] evdi_painter_send_update_ready_if_needed:645 Painter does not exist!
[   32.537871] [drm] Initialized evdi 1.7.0 20200327 for evdi.1 on minor 2
[   32.537895] evdi: [D] evdi_crtc_init:389 drm_crtc_init: 0 p0000000073a432d2
[   32.537899] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.537901] evdi evdi.2: [drm] Cannot find any crtc or sizes
[   32.537904] evdi: [W] evdi_painter_send_update_ready_if_needed:645 Painter does not exist!
[   32.537971] [drm] Initialized evdi 1.7.0 20200327 for evdi.2 on minor 3
[   32.537994] evdi: [D] evdi_crtc_init:389 drm_crtc_init: 0 p0000000077774758
[   32.537997] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.537999] evdi evdi.3: [drm] Cannot find any crtc or sizes
[   32.538001] evdi: [W] evdi_painter_send_update_ready_if_needed:645 Painter does not exist!
[   32.538100] [drm] Initialized evdi 1.7.0 20200327 for evdi.3 on minor 4
[   32.689645] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.689653] evdi: [D] evdi_driver_postclose:133 (dev=0) Process tries to close us, postclose
[   32.689654] evdi: [I] Task 669 (plymouthd) of process 669 (plymouthd)
[   32.691759] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.691767] evdi: [D] evdi_driver_postclose:133 (dev=0) Process tries to close us, postclose
[   32.691768] evdi: [I] Task 669 (plymouthd) of process 669 (plymouthd)
[   32.693665] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.693670] evdi: [D] evdi_driver_postclose:133 (dev=0) Process tries to close us, postclose
[   32.693670] evdi: [I] Task 669 (plymouthd) of process 669 (plymouthd)
[   32.694873] evdi: [D] evdi_detect:94 (dev=0) poll connector state: disconnected
[   32.694878] evdi: [D] evdi_driver_postclose:133 (dev=0) Process tries to close us, postclose
[   32.694879] evdi: [I] Task 669 (plymouthd) of process 669 (plymouthd)
[   45.491176] Modules linked in: evdi(O) ...

When the module is compiled with LTO:

The difference being that *FLAGS includes -flto=16

CFLAGS="-march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed"
CXXFLAGS="-march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32 -Wl,-O1 -Wl,--as-needed"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=skylake -mabm -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=16 -fuse-linker-plugin -pipe -falign-functions=32"
$ dmesg | grep -i evdi
[   25.286218] evdi: unknown parameter 'initial_device_count' ignored
[   38.110022] Modules linked in: evdi(PO) ...

corrmaan avatar Jun 29 '20 18:06 corrmaan

Thanks for the report :) Will take a look at it :)

displaylink-dkurek avatar Jun 30 '20 07:06 displaylink-dkurek

@displaylink-dkurek

The question here would be how the system CFLAGS are passed to evdi. build. So far I see you force CFLAGS to FLAGS from top Makefile.

abucodonosor avatar Oct 14 '20 16:10 abucodonosor

As @abucodonosor noted we were overriding the CFLAGS when compiling module. With commit c085b0110242c58d87a720321a28f9c92f417d73 this should not be a problem anymore. Hope this simple change will fix the problem.

displaylink-dkurek avatar Dec 15 '20 18:12 displaylink-dkurek

That fix makes sense, thanks to you both for looking in to it. Unfortunately I'm unable to test at the moment since I stopped using LTO system-wide. So, I'll close it for now.

corrmaan avatar Dec 15 '20 23:12 corrmaan