libthinkpad / dockd

Lenovo ThinkPad Dock Management Daemon. Docs:
http://thinkpads.org/projects/dockd/
Other
131 stars 22 forks source link

Not working with P51 #3

Open rdoursenaud opened 6 years ago

rdoursenaud commented 6 years ago

Context

Laptop model: Lenovo ThinkPad P51 Details of the specific hardware configuration can be found on my blog. Dock model: Lenovo ThinkPad Workstation Dock Distribution: Arch Linux Dockd version: 1.20 from the AUR. Window manager: i3wm Launched by i3 at startup in ~/.config/i3/config with

exec --no-startup-id dockd --daemon

docked.conf

[Screen]
height=2260
width=6840
mm_height=598
mm_width=1811

[CRTC]
crtc=63
x=0
y=1180
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=eDP-1-1

[CRTC]
crtc=611
x=1920
y=380
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP-0.1

[CRTC]
crtc=612
x=3840
y=0
rotation=8
mode=1920x1080
outputs_len=1
outputs_0=DP-0.2

[CRTC]
crtc=613
x=4920
y=380
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP-0.3

[CRTC]
crtc=614
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=64
x=0
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=65
x=0
y=0
rotation=1
mode=None
outputs_len=0

undocked.conf

[Screen]
height=1080
width=1920
mm_height=194
mm_width=345

[CRTC]
crtc=63
x=0
y=0
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=eDP-1-1

[CRTC]
crtc=611
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=612
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=613
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=614
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=64
x=0
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=65
x=0
y=0
rotation=1
mode=None
outputs_len=0

Tests

ps ax | grep dockd

1868 ?        Sl     0:00 dockd --daemon

systemctl status acpid

● acpid.service - ACPI event daemon
   Loaded: loaded (/usr/lib/systemd/system/acpid.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-01-16 18:09:57 CET; 2h 37min ago
     Docs: man:acpid(8)
 Main PID: 1047 (acpid)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/acpid.service
           └─1047 /usr/bin/acpid --foreground --netlink

janv. 16 20:38:18 thinkpad0 root[27386]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27389]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27392]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27395]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27399]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27402]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27405]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:19 thinkpad0 root[27501]: ACPI action undefined: ACPI0003:00
janv. 16 20:38:19 thinkpad0 root[27519]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
janv. 16 20:38:19 thinkpad0 root[27522]: ACPI group/action undefined: thermal_zone / LNXTHERM:00

journalctl -f | grep dockd issues nothing upon docking nor undocking.

ACPI events

Captured with acpi_listen.

Docking

ibm/hotkey LEN0268:00 00000080 00004010
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
battery PNP0C0A:00 00000080 00000001
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
ac_adapter ACPI0003:00 00000080 00000001
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000

Undocking

video/switchmode VMOD 00000080 00000000
battery PNP0C0A:00 00000080 00000001
ibm/hotkey LEN0268:00 00000080 00004011
ac_adapter ACPI0003:00 00000080 00000000
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000

Note

Please let me know if you need me to provide more informations or try something. I'd be happy to!

smclt30p commented 6 years ago

On Tue, Jan 16, 2018 at 06:51:27PM +0000, Raphaël Doursenaud wrote:

Context

Model: Lenovo ThinkPad P51 Details of the specific hardware configuration can be found on my blog. Distribution: Arch Linux Dockd version: 1.20 from the AUR. Window manager: i3wm Launched by i3 at startup in ~/.config/i3/config with

exec --no-startup-id dockd --daemon

docked.conf

[Screen]
height=2260
width=6840
mm_height=598
mm_width=1811

[CRTC]
crtc=63
x=0
y=1180
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=eDP-1-1

[CRTC]
crtc=611
x=1920
y=380
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP-0.1

[CRTC]
crtc=612
x=3840
y=0
rotation=8
mode=1920x1080
outputs_len=1
outputs_0=DP-0.2

[CRTC]
crtc=613
x=4920
y=380
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=DP-0.3

[CRTC]
crtc=614
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=64
x=0
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=65
x=0
y=0
rotation=1
mode=None
outputs_len=0

undocked.conf

[Screen]
height=1080
width=1920
mm_height=194
mm_width=345

[CRTC]
crtc=63
x=0
y=0
rotation=1
mode=1920x1080
outputs_len=1
outputs_0=eDP-1-1

[CRTC]
crtc=611
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=612
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=613
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=614
x=0
y=0
rotation=0
mode=None
outputs_len=0

[CRTC]
crtc=64
x=0
y=0
rotation=1
mode=None
outputs_len=0

[CRTC]
crtc=65
x=0
y=0
rotation=1
mode=None
outputs_len=0

Tests

ps ax | grep dockd

1868 ?        Sl     0:00 dockd --daemon

systemctl status acpid

● acpid.service - ACPI event daemon
   Loaded: loaded (/usr/lib/systemd/system/acpid.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-01-16 18:09:57 CET; 2h 37min ago
     Docs: man:acpid(8)
 Main PID: 1047 (acpid)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/acpid.service
           └─1047 /usr/bin/acpid --foreground --netlink

janv. 16 20:38:18 thinkpad0 root[27386]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27389]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27392]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27395]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27399]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27402]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:18 thinkpad0 root[27405]: ACPI group/action undefined: video/switchmode / VMOD
janv. 16 20:38:19 thinkpad0 root[27501]: ACPI action undefined: ACPI0003:00
janv. 16 20:38:19 thinkpad0 root[27519]: ACPI group/action undefined: ibm/hotkey / LEN0268:00
janv. 16 20:38:19 thinkpad0 root[27522]: ACPI group/action undefined: thermal_zone / LNXTHERM:00

journalctl -f | grep dockd issues nothing upon docking nor undocking.

ACPI events

Captured with acpi_listen.

Docking

ibm/hotkey LEN0268:00 00000080 00004010
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
battery PNP0C0A:00 00000080 00000001
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
video/switchmode VMOD 00000080 00000000
ac_adapter ACPI0003:00 00000080 00000001
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000

Undocking

video/switchmode VMOD 00000080 00000000
battery PNP0C0A:00 00000080 00000001
ibm/hotkey LEN0268:00 00000080 00004011
ac_adapter ACPI0003:00 00000080 00000000
ibm/hotkey LEN0268:00 00000080 00006030
thermal_zone LNXTHERM:00 00000081 00000000

Note

Please let me know if you need me to provide more informations or try something. I'd be happy to!

First, did you try setting the configuration manually?

dockd --set docked
dockd --set undocked

Does the configuration switch when triggered manually?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/libthinkpad/dockd/issues/3

rdoursenaud commented 6 years ago

Oh forgot to add these. Sorry.

No, they don't work. The monitors flashes black for a second and the following errors appear:

dockd --set docked

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Value in failed request:  0x0
  Serial number of failed request:  40
  Current serial number in output stream:  40

dockd --set undocked

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Value in failed request:  0x0
  Serial number of failed request:  28
  Current serial number in output stream:  28

After that, the layout us messed up: Screen 1 is at the top instead of the bottom. Screen 2 and 4 seem to have too much height and scroll. Looks like it's doing something weird (reversed?) with the Y axis.

rdoursenaud commented 6 years ago

Looks like it's an nVidia bug (again…). Here's what the kernel spat out after dockd --set docked:

janv. 16 20:57:29 thinkpad0 kernel: [drm:nvidia_drm_fence_context_create [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate fence signaling event
janv. 16 20:57:29 thinkpad0 kernel: [drm:nvidia_drm_fence_context_create [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to import fence semaphore surface
janv. 16 20:57:29 thinkpad0 kernel: BUG: scheduling while atomic: Xorg/1623/0x00000002
janv. 16 20:57:29 thinkpad0 kernel: Modules linked in: ccm uhid algif_hash algif_skcipher af_alg cmac rfcomm ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter devlink wacom hid_generic bnep snd_seq_midi nls_iso8859_1 nls_cp437 vfat fat snd_usb_audio snd_usbmidi_lib snd_rawmidi uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev cdc_mbim cdc_wdm cdc_ncm usbnet qcserial usb_wwan btusb media usbserial mii btrtl usbhid sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) joydev mousedev wmi_bmof tpm_crb snd_hda_codec_hdmi arc4 snd_hda_codec_realtek snd_hda_codec_generic mei_wdt iwlmvm mac80211 intel_rapl x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iwlwifi aesni_intel aes_x86_64 crypto_simd
janv. 16 20:57:29 thinkpad0 kernel:  glue_helper cryptd intel_cstate intel_rapl_perf snd_hda_intel rtsx_pci_ms cfg80211 pcspkr input_leds psmouse snd_hda_codec e1000e memstick snd_hda_core snd_hwdep hci_uart ptp snd_pcm i2c_i801 pps_core mei_me btbcm btqca thinkpad_acpi btintel ucsi_acpi typec_ucsi idma64 mei bluetooth nvram intel_lpss_pci intel_pch_thermal shpchp typec thermal ie31200_edac wmi led_class battery ac i2c_hid pinctrl_sunrisepoint ecdh_generic hid rfkill pinctrl_intel crc16 intel_lpss_acpi intel_lpss tpm_tis tpm_tis_core tpm evdev acpi_pad mac_hid usbip_host usbip_core coretemp snd_seq_dummy msr snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_timer snd soundcore cuse fuse sg crypto_user acpi_call(O) ip_tables x_tables nvhda(O) bbswitch(O) ses enclosure scsi_transport_sas sd_mod nvidia_uvm(PO) mmc_block
janv. 16 20:57:29 thinkpad0 kernel:  btrfs xor zstd_decompress zstd_compress xxhash uas usb_storage raid6_pq rtsx_pci_sdmmc mmc_core serio_raw atkbd libps2 crc32c_intel nvidia_drm(PO) nvidia_modeset(PO) ahci libahci xhci_pci nvidia(PO) libata rtsx_pci xhci_hcd nvme nvme_core scsi_mod usbcore usb_common i8042 serio i915 video button intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
janv. 16 20:57:29 thinkpad0 kernel: CPU: 0 PID: 1623 Comm: Xorg Tainted: P     U     O    4.14.13-1-ARCH #1
janv. 16 20:57:29 thinkpad0 kernel: Hardware name: LENOVO 20HHCTO1WW/20HHCTO1WW, BIOS N1UET42W (1.16 ) 11/27/2017
janv. 16 20:57:29 thinkpad0 kernel: Call Trace:
janv. 16 20:57:29 thinkpad0 kernel:  dump_stack+0x5c/0x85
janv. 16 20:57:29 thinkpad0 kernel:  __schedule_bug+0x51/0x70
janv. 16 20:57:29 thinkpad0 kernel:  __schedule+0x62a/0x890
janv. 16 20:57:29 thinkpad0 kernel:  schedule+0x2f/0x90
janv. 16 20:57:29 thinkpad0 kernel:  exit_to_usermode_loop+0x4f/0xa0
janv. 16 20:57:29 thinkpad0 kernel:  syscall_return_slowpath+0x9b/0xb0
janv. 16 20:57:29 thinkpad0 kernel:  entry_SYSCALL_64_fastpath+0x7b/0x7d
janv. 16 20:57:29 thinkpad0 kernel: RIP: 0033:0x7f927af1ee54
janv. 16 20:57:29 thinkpad0 kernel: RSP: 002b:00007ffd6b18a580 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
janv. 16 20:57:29 thinkpad0 kernel: RAX: 0000000000000020 RBX: 00007ffd6b18a870 RCX: 00007f927af1ee54
janv. 16 20:57:29 thinkpad0 kernel: RDX: 0000000000000001 RSI: 00007ffd6b18a870 RDI: 0000000000000041
janv. 16 20:57:29 thinkpad0 kernel: RBP: 0000564897a280f0 R08: 0000000000000000 R09: 0000564897a289e0
janv. 16 20:57:29 thinkpad0 kernel: R10: 0000564897afd010 R11: 0000000000000293 R12: 0000000000000001
janv. 16 20:57:29 thinkpad0 kernel: R13: 00007ffd6b18a870 R14: 0000000000000020 R15: 0000564897cff000
smclt30p commented 6 years ago

I see your P51 is running Bumblebee, which means that no CRT Controllers are available upon redock if it switched to the Intel graphics.

Can you try docking, running bbswitch and then running dockd --set docked?

rdoursenaud commented 6 years ago

I don't think bbswitch is to blame. The nVidia GPU stays active regardless of the docking situation.

The nVidia driver is buggy though. Trying to set xrandr parameters manually (via the following shell scripts) after docking/undocking results in an Xorg lockup one out of three times and the kernel error reported previously also happens sometimes :/

FWIW here are the scripts used: docked.sh

#!/bin/sh
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x1180 --rotate normal --primary --output DP-0.3 --mode 1920x1080 --pos 4920x380 --output DP-0.2 --mode 1920x1080 --pos 3840x0 --rotate right --output DP-0.1 --mode 1920x1080 --pos 1920x380 --rotate normal --output DP-5 --off --output DP-4 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off --output DP-0 --off

undocked.sh

#!/bin/sh
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x0 --rotate normal --primary --output DP-0.3 --off --output DP-0.2 --off --output DP-0.1 --off --output DP-5 --off --output DP-4 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off --output DP-0 --off

Furthermore dockd is not triggered by ACPI events anyway.

smclt30p commented 6 years ago

On Tue, Jan 16, 2018 at 11:32:37AM -0800, Raphaël Doursenaud wrote:

I don't think bbswitch is to blame. The nVidia GPU stays active regardless of the docking situation.

That was a wild guess. :)

The nVidia driver is buggy though. Trying to set xrandr parameters manually (via the following shell scripts) after docking/undocking results in an Xorg lockup one out of three times and the kernel error reported previously also happens sometimes :/

FWIW here are the scripts used: docked.sh

#!/bin/sh
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x1180 --rotate normal --primary --output DP-0.3 --mode 1920x1080 --pos 4920x380 --output DP-0.2 --mode 1920x1080 --pos 3840x0 --rotate right --output DP-0.1 --mode 1920x1080 --pos 1920x380 --rotate normal --output DP-5 --off --output DP-4 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off --output DP-0 --off

undocked.sh

#!/bin/sh
xrandr --output eDP-1-1 --mode 1920x1080 --pos 0x0 --rotate normal --primary --output DP-0.3 --off --output DP-0.2 --off --output DP-0.1 --off --output DP-5 --off --output DP-4 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off --output DP-0 --off

That's a shame. To be fair, does dockd work on Intel only? Did you try nouveau?

Furthermore dockd is not triggered by ACPI events anyway.

Don't sweat that, that's a really, really easy fix, its just a matter of adding the correct ACPI event ids to the source. :)

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/libthinkpad/dockd/issues/3#issuecomment-358078006

rdoursenaud commented 6 years ago

Progress update.

Following the hybrid graphics trail, I decided to try with dedicated graphics.

Seems that the internal display is then routed to DP-2, so I updated my scripts and replaced eDP-1-1 with DP-2 while removing other DP-2 references and also updated dockd configs.

Results

With scripts

Docked to undocked: OK Undocked to docked: KO

There seem to be an issue that makes xrandr think there is only one display connected at DP-0 instead of the three (sub?) displays DP-0.1 to DP-0.3 which are now seen disconnected. Maybe Xorg/xrandr doesn't handle DisplayPort chaining (which seem to be used internally by the dock to provide the physical outputs which are not DisplayPort) very well yet. xrandr --auto enables DP-0 which results in displays mirroring the same image.

With dockd

Docked to undocked : KO

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Value in failed request:  0x0
  Serial number of failed request:  21
  Current serial number in output stream:  21

Undocked to docked: WTF No error is issued but the display configuration does not change!

Conclusions

DisplayPort chaining is not working properly (Xorg or nVidia's fault?) and I believe this is the root of all evil. If I had to guess, I'd say it's a timing issue preventing the proper detection of the hardware monitors. This is above my skills. For now.

The journey continues ;)

Any ideas?

smclt30p commented 6 years ago

On Tue, Jan 16, 2018 at 08:11:29PM +0000, Raphaël Doursenaud wrote:

Progress update.

Following the hybrid graphics trail, I decided to try with dedicated graphics.

Seems that the internal display is then routed to DP-2, so I updated my scripts and replaced eDP-1-1 with DP-2 while removing other DP-2 references and dockd configs.

Results

With scripts

Docked to undocked: OK Undocked to docked: KO

There seem to be an issue that makes xrandr think there is only one display connected at DP-0 instead of the three (sub?) displays DP-0.1 to DP-0.3 which are now seen disconnected. Maybe Xorg/xrandr doesn't handle DisplayPort chaining (which seem to be used internally by the dock to provide the physical outputs which are not DisplayPort) very well yet. xrandr --auto enables DP-0 which results in displays mirroring the same image.

Yeah DisplayPort chaining is a really tricky issue. And I'm not really surprised that it does not work on the nvidia driver.

With dockd

Docked to undocked : KO

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Value in failed request:  0x0
  Serial number of failed request:  21
  Current serial number in output stream:  21

Undocked to docked: WTF No error is issued but the display configuration does not change!

Check journalctl?

Conclusions

DisplayPort chaining is not working properly (Xorg or nVidia's fault?) and I believe this is the root of all evil. If I had to guess, I'd say it's a timing issue preventing the proper detection of the hardware monitors. This is above my skills. For now.

The journey continues ;)

Not really, we can'f fix Nvidia's bugs. All we can do is report the bug to Nvidia and hope for an update.

Any ideas?

Well, dockd is basically a load/dump profile xrandr-type of thing. It dumps the profile when --config is called and recalls it on --set. It uses the exact same API as xrandr and the same logic. So, if Xrandr does not work, dockd wont either. :)

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/libthinkpad/dockd/issues/3#issuecomment-358089504

rdoursenaud commented 6 years ago

Thanks for the prompt replies and for coding dockd of course!

I don't want to try nouveau just yet as I've been unable to make it work at all when I tried a few months ago. The Quadro M2200 Mobile is quite exotic I guess.

rdoursenaud commented 6 years ago

OK, retried dockd --set docked to grab the journalctl output and… it worked ! With config applied from /etc/dockd/docked.conf issued whereas it was previously not issuing anything. dockd --set undocked still does weird things though. There's obviously an issue when resizing the (virtual) framebuffer. Sometimes it's resized, sometimes not…

I don't know if logging all my attempts here is proper. Let me know if you prefer me to move this to a more appropriate place like my blog.

rdoursenaud commented 6 years ago

I'm getting close to a usable configuration.

The issue is indeed in the framebuffer size and automatic setting of the panning attribute by xrandr.

dockd works partially and my scripts now work reliably (in dedicated graphics mode).

Moving from docked to undocked, I need to reset the panning manually by appending --panning 0x0+0+0 to the output driving the internal panel. Otherwise, the huge 6840x2260 framebuffer is kept and panning is applied. Both with dockd and xrandr.

On the other hand, moving from undocked to docked now works flawlessly without specifying the framebuffer size or any panning option from xrandr. dockd needs to be launched twice to register the proper framebuffer configuration.

I think it's time for me to take a look at dockd's source code.

smclt30p commented 6 years ago

Let me give you some guidelines if you are going to write a patch:

You will need to understand the X.Org RandR protocol defined here. You will need to know details up-to line 220.

The actual configuration is commited to X here. The "framebuffer" you talk about is know as a Screen in X.Org, and It's resized here. You can check the screen size here.

If you want to debug stuff and not mess with X.Org, define DRYRUN.

The ACPI trigger does not happen in dockd, it happens in libthinkpad

Here are the acpid constants.

If you need to know what a ACPI constant means, you can find that here.

Interesting data structures: RRCrtc - CRT Controller ID (long) RRCrtcInfo - CRT Controller Info (struct) RROutput - Physical Output ID (long) RROutputInfo - Physical Output Info (struct)

Good luck!

smclt30p commented 6 years ago

I patched libthinkpad, it should now detect the ACPI events for your P51.

rdoursenaud commented 6 years ago

Thanks a lot for the pointers and the ACPI patch. I'm already hacking at it ;)

The thing I can't figure out is why xrandr sometimes insist on adding panning to the mix and how I can prevent it from doing so. Trying to disable it with xrandr --output DP-2 --panning 0x0+0+0 --output DP-0.3 --panning 0x0+0+0 --output DP-0.2 --panning 0x0+0+0 --output DP-0.1 --panning 0x0+0+0 I have to run the command twice for it to register properly.

Also, when going from docked to undocked, RRSetCrtcConfig fails on the outputs it's supposed to disable. Any idea what's causing that?

smclt30p commented 6 years ago

Invalid screen sizes can cause it to fail

On 16 Jan 2018 11:28 pm, "Raphaël Doursenaud" notifications@github.com wrote:

Thanks a lot for the pointers and the ACPI patch. I'm already hacking at it ;)

The thing I can't figure out is why xrandr sometimes insist on adding panning to the mix and how I can prevent it from doing so. Trying to disable it with xrandr --output DP-2 --panning 0x0+0+0 --output DP-0.3 --panning 0x0+0+0 --output DP-0.2 --panning 0x0+0+0 --output DP-0.1 --panning 0x0+0+0 I have to run the command twice for it to register properly.

Also, when going from docked to undocked, RRSetCrtcConfig fails on the outputs it's supposed to disable. Any idea what's causing that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/libthinkpad/dockd/issues/3#issuecomment-358129260, or mute the thread https://github.com/notifications/unsubscribe-auth/ANUV-_vxkgSj_M62u6A1UErZxp6aaAEOks5tLSKcgaJpZM4RgQR7 .

rdoursenaud commented 6 years ago

Ok, reading the randrproto doc, I see that since v1.5 (which I'm running) there's now a Monitor concept that's been introduced. Your code only manipulates CRTCs and not Monitors. Monitors now hold data previously handled directly by CRTCs. Maybe that's the missing link!

Interesting quote in RRSetScreenSize section:

All active monitors must be configured to display a subset of the specified size, else a Match error results.

Sorry for rambling so much. Hope you don't mind.

smclt30p commented 6 years ago

I'm also using 1.5, ignore monitors for now.

Want to have nightmares? Look at the source for xrandr.

On 16 Jan 2018 11:36 pm, "Raphaël Doursenaud" notifications@github.com wrote:

Ok, reading the randrproto doc, I see that since v1.5 (which I'm running) there's now a Monitor concept that's been introduced. Your code only manipulates CRTCs and not Monitors. Monitors now hold data previously handled directly by CRTCs. Maybe that's the missing link!

Interesting quote in RRSetScreenSize:

All active monitors must be configured to display a subset of the specified size, else a Match error results.

Sorry for rambling so much. Hope you don't mind.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/libthinkpad/dockd/issues/3#issuecomment-358131105, or mute the thread https://github.com/notifications/unsubscribe-auth/ANUV-4Pzeo3IAuPssi5umujf8XOZzv_xks5tLSRhgaJpZM4RgQR7 .

rdoursenaud commented 6 years ago

OK, update time ;)

I have a naive attempt that somewhat works in dedicated graphics.

I stumbled upon this from the SPICE project.

I've taken an even more naive approach doing:

I was still getting a RRSetCrtcConfig error upon setting the DP-0.1 when switching from docked to undocked but the resulting setup is what I expected and undocked to docked worked perfectly.

I then decided to only apply the CRTC configs to outputs that needs to be enabled and, presto, good result!

Now off to try if this still works with the hybrid graphics.

If everything's fine, I'll cleanup the code and PR it to you.

rdoursenaud commented 6 years ago

Hybrid graphics report:

Kernel error retrieved from SSH:

[   68.745278] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[   68.745281] BUG: unable to handle kernel paging request at ffff92067d4b3a30
[   68.745285] IP: 0xffff92067d4b3a30
[   68.745285] PGD e8d62e067 P4D e8d62e067 PUD fff86e063 PMD faf9ab063 PTE 8000000ffd4b3063
[   68.745289] Oops: 0011 [#1] PREEMPT SMP PTI
[   68.745290] Modules linked in: cmac rfcomm wacom hid_generic snd_seq_midi snd_usb_audio snd_usbmidi_lib snd_rawmidi uvcvideo videobuf2_vmalloc cdc_mbim videobuf2_memops cdc_wdm videobuf2_v4l2 cdc_ncm videobuf2_core qcserial usb_wwan usbnet videodev usbserial mii btusb media btrtl usbhid ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter devlink bnep sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) joydev mousedev wmi_bmof tpm_crb snd_hda_codec_hdmi arc4 snd_hda_codec_realtek snd_hda_codec_generic nls_iso8859_1 nls_cp437 vfat fat mei_wdt iwlmvm intel_rapl mac80211 x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iwlwifi aesni_intel aes_x86_64 crypto_simd glue_helper cryptd intel_cstate intel_rapl_perf
[   68.745318]  psmouse cfg80211 snd_hda_intel pcspkr input_leds snd_hda_codec rtsx_pci_ms e1000e snd_hda_core memstick snd_hwdep i2c_i801 snd_pcm hci_uart thinkpad_acpi ptp pps_core btbcm btqca btintel mei_me idma64 nvram ucsi_acpi mei shpchp typec_ucsi intel_pch_thermal ie31200_edac intel_lpss_pci bluetooth battery led_class ac thermal typec wmi evdev i2c_hid hid mac_hid pinctrl_sunrisepoint ecdh_generic tpm_tis pinctrl_intel acpi_pad rfkill intel_lpss_acpi tpm_tis_core crc16 intel_lpss usbip_host tpm usbip_core coretemp msr snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_timer snd soundcore cuse fuse sg crypto_user acpi_call(O) ip_tables x_tables nvhda(O) bbswitch(O) sd_mod nvidia_uvm(PO) mmc_block btrfs xor zstd_decompress zstd_compress xxhash raid6_pq rtsx_pci_sdmmc mmc_core
[   68.745349]  serio_raw atkbd libps2 crc32c_intel nvidia_drm(PO) nvidia_modeset(PO) ahci libahci nvidia(PO) xhci_pci rtsx_pci libata nvme xhci_hcd nvme_core scsi_mod usbcore usb_common i8042 serio i915 video button intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[   68.745364] CPU: 4 PID: 172 Comm: irq/128-nvidia Tainted: P     U     O    4.14.13-1-ARCH #1
[   68.745365] Hardware name: LENOVO 20HHCTO1WW/20HHCTO1WW, BIOS N1UET42W (1.16 ) 11/27/2017
[   68.745366] task: ffff9206a8103d00 task.stack: ffffa60a46cf0000
[   68.745367] RIP: 0010:0xffff92067d4b3a30
[   68.745367] RSP: 0018:ffffa60a46cf3d40 EFLAGS: 00010246
[   68.745369] RAX: ffff920690143c70 RBX: ffff92067d407b88 RCX: 0000000000000000
[   68.745369] RDX: 0000000000010006 RSI: 0000000000000000 RDI: 0000000000000000
[   68.745370] RBP: ffff9206a141ddd8 R08: 0000000000000000 R09: ffff92067d4b3a30
[   68.745371] R10: 0000000002020008 R11: ffffffffc0905760 R12: ffff92067d407b88
[   68.745372] R13: 0000000000000000 R14: ffff9206a181c008 R15: 0000000000000000
[   68.745373] FS:  0000000000000000(0000) GS:ffff9206ef500000(0000) knlGS:0000000000000000
[   68.745374] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   68.745375] CR2: ffff92067d4b3a30 CR3: 0000000e8d00a004 CR4: 00000000003606e0
[   68.745376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   68.745377] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   68.745377] Call Trace:
[   68.745507]  ? _nv029074rm+0x115/0x180 [nvidia]
[   68.745667]  ? _nv026080rm+0x8b/0xf0 [nvidia]
[   68.745757]  ? _nv010340rm+0x33b/0x410 [nvidia]
[   68.745836]  ? _nv010340rm+0x318/0x410 [nvidia]
[   68.746020]  ? _nv006922rm+0x1a8/0x290 [nvidia]
[   68.746199]  ? _nv025510rm+0x71/0xa0 [nvidia]
[   68.746317]  ? _nv001199rm+0x10e/0x150 [nvidia]
[   68.746320]  ? irq_thread_check_affinity+0xa0/0xa0
[   68.746432]  ? rm_isr_bh+0x23/0x70 [nvidia]
[   68.746433]  ? irq_forced_thread_fn+0x60/0x60
[   68.746543]  ? nvidia_isr_common_bh+0x38/0x60 [nvidia]
[   68.746544]  ? irq_thread_fn+0x1b/0x50
[   68.746546]  ? irq_thread+0x13f/0x190
[   68.746547]  ? wake_threads_waitq+0x30/0x30
[   68.746550]  ? kthread+0x118/0x130
[   68.746551]  ? kthread_create_on_node+0x70/0x70
[   68.746553]  ? SyS_exit_group+0x10/0x10
[   68.746555]  ? ret_from_fork+0x1f/0x30
[   68.746557] Code: 00 00 00 72 50 01 80 00 00 00 00 08 1e 4b 7d 06 92 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 <28> 00 0d 85 06 92 ff ff 72 50 01 80 00 00 00 00 30 04 cf a6 06 
[   68.746577] RIP: 0xffff92067d4b3a30 RSP: ffffa60a46cf3d40
[   68.746578] CR2: ffff92067d4b3a30
[   68.746579] ---[ end trace fccfbc2ace423b29 ]---
[   68.746587] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[   68.746588] BUG: unable to handle kernel paging request at ffff92050d00a920
[   68.746590] IP: 0xffff92050d00a920
[   68.746590] PGD e8d62e067 P4D e8d62e067 PUD 102844b063 PMD 8000000e8d0000e3 
[   68.746593] Oops: 0011 [#2] PREEMPT SMP PTI
[   68.746594] Modules linked in: cmac rfcomm wacom hid_generic snd_seq_midi snd_usb_audio snd_usbmidi_lib snd_rawmidi uvcvideo videobuf2_vmalloc cdc_mbim videobuf2_memops cdc_wdm videobuf2_v4l2 cdc_ncm videobuf2_core qcserial usb_wwan usbnet videodev usbserial mii btusb media btrtl usbhid ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter devlink bnep sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) joydev mousedev wmi_bmof tpm_crb snd_hda_codec_hdmi arc4 snd_hda_codec_realtek snd_hda_codec_generic nls_iso8859_1 nls_cp437 vfat fat mei_wdt iwlmvm intel_rapl mac80211 x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iwlwifi aesni_intel aes_x86_64 crypto_simd glue_helper cryptd intel_cstate intel_rapl_perf
[   68.746619]  psmouse cfg80211 snd_hda_intel pcspkr input_leds snd_hda_codec rtsx_pci_ms e1000e snd_hda_core memstick snd_hwdep i2c_i801 snd_pcm hci_uart thinkpad_acpi ptp pps_core btbcm btqca btintel mei_me idma64 nvram ucsi_acpi mei shpchp typec_ucsi intel_pch_thermal ie31200_edac intel_lpss_pci bluetooth battery led_class ac thermal typec wmi evdev i2c_hid hid mac_hid pinctrl_sunrisepoint ecdh_generic tpm_tis pinctrl_intel acpi_pad rfkill intel_lpss_acpi tpm_tis_core crc16 intel_lpss usbip_host tpm usbip_core coretemp msr snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_timer snd soundcore cuse fuse sg crypto_user acpi_call(O) ip_tables x_tables nvhda(O) bbswitch(O) sd_mod nvidia_uvm(PO) mmc_block btrfs xor zstd_decompress zstd_compress xxhash raid6_pq rtsx_pci_sdmmc mmc_core
[   68.746648]  serio_raw atkbd libps2 crc32c_intel nvidia_drm(PO) nvidia_modeset(PO) ahci libahci nvidia(PO) xhci_pci rtsx_pci libata nvme xhci_hcd nvme_core scsi_mod usbcore usb_common i8042 serio i915 video button intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[   68.746660] CPU: 4 PID: 172 Comm: irq/128-nvidia Tainted: P     UD    O    4.14.13-1-ARCH #1
[   68.746662] Hardware name: LENOVO 20HHCTO1WW/20HHCTO1WW, BIOS N1UET42W (1.16 ) 11/27/2017
[   68.746663] task: ffff9206a8103d00 task.stack: ffffa60a46cf0000
[   68.746664] RIP: 0010:0xffff92050d00a920
[   68.746665] RSP: 0018:ffffa60a46cf3ea8 EFLAGS: 00010282
[   68.746666] RAX: ffffa60a46cf3ed0 RBX: ffff9206a8104478 RCX: 0000000000000000
[   68.746669] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffa60a46cf3ed0
[   68.746670] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
[   68.746671] R10: ffffffff90006a80 R11: ffffffff9055736d R12: ffff9206a8103d00
[   68.746671] R13: ffffa60a46cf3ed0 R14: 0000000000000000 R15: ffff9206a81044a4
[   68.746672] FS:  0000000000000000(0000) GS:ffff9206ef500000(0000) knlGS:0000000000000000
[   68.746673] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   68.746674] CR2: ffff92050d00a920 CR3: 0000000e8d00a004 CR4: 00000000003606e0
[   68.746675] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   68.746676] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   68.746676] Call Trace:
[   68.746678]  ? task_work_run+0x7f/0xa0
[   68.746680]  ? do_exit+0x309/0xb60
[   68.746681]  ? kthread+0x118/0x130
[   68.746683]  ? rewind_stack_do_exit+0x17/0x20
[   68.746684] Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 67 a0 62 8d 0e 00 00 00 <67> e0 62 8d 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[   68.746726] RIP: 0xffff92050d00a920 RSP: ffffa60a46cf3ea8
[   68.746727] CR2: ffff92050d00a920
[   68.746728] ---[ end trace fccfbc2ace423b2a ]---
[   68.746728] Fixing recursive fault but reboot is needed!
[   79.413396] asynchronous wait on fence NVIDIA:nvidia.prime:3 timed out

Looks like an nVidia bug to me!

Anyway, at least the code works with dedicated graphics and I'll work with nVidia to get this resolved.

Good results \o/

smclt30p commented 6 years ago

On Tue, Jan 16, 2018 at 06:36:59PM -0800, Raphaël Doursenaud wrote:

Hybrid graphics report:

  • Docked to undocked: OK
  • Undocked to docked: X freeze

Kernel error retrieved from SSH:

[   68.745278] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[   68.745281] BUG: unable to handle kernel paging request at ffff92067d4b3a30
[   68.745285] IP: 0xffff92067d4b3a30
[   68.745285] PGD e8d62e067 P4D e8d62e067 PUD fff86e063 PMD faf9ab063 PTE 8000000ffd4b3063
[   68.745289] Oops: 0011 [#1] PREEMPT SMP PTI
[   68.745290] Modules linked in: cmac rfcomm wacom hid_generic snd_seq_midi snd_usb_audio snd_usbmidi_lib snd_rawmidi uvcvideo videobuf2_vmalloc cdc_mbim videobuf2_memops cdc_wdm videobuf2_v4l2 cdc_ncm videobuf2_core qcserial usb_wwan usbnet videodev usbserial mii btusb media btrtl usbhid ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter devlink bnep sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) joydev mousedev wmi_bmof tpm_crb snd_hda_codec_hdmi arc4 snd_hda_codec_realtek snd_hda_codec_generic nls_iso8859_1 nls_cp437 vfat fat mei_wdt iwlmvm intel_rapl mac80211 x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iwlwifi aesni_intel aes_x86_64 crypto_simd glue_helper cryptd intel_cstate intel_rapl_perf
[   68.745318]  psmouse cfg80211 snd_hda_intel pcspkr input_leds snd_hda_codec rtsx_pci_ms e1000e snd_hda_core memstick snd_hwdep i2c_i801 snd_pcm hci_uart thinkpad_acpi ptp pps_core btbcm btqca btintel mei_me idma64 nvram ucsi_acpi mei shpchp typec_ucsi intel_pch_thermal ie31200_edac intel_lpss_pci bluetooth battery led_class ac thermal typec wmi evdev i2c_hid hid mac_hid pinctrl_sunrisepoint ecdh_generic tpm_tis pinctrl_intel acpi_pad rfkill intel_lpss_acpi tpm_tis_core crc16 intel_lpss usbip_host tpm usbip_core coretemp msr snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_timer snd soundcore cuse fuse sg crypto_user acpi_call(O) ip_tables x_tables nvhda(O) bbswitch(O) sd_mod nvidia_uvm(PO) mmc_block btrfs xor zstd_decompress zstd_compress xxhash raid6_pq rtsx_pci_sdmmc mmc_core
[   68.745349]  serio_raw atkbd libps2 crc32c_intel nvidia_drm(PO) nvidia_modeset(PO) ahci libahci nvidia(PO) xhci_pci rtsx_pci libata nvme xhci_hcd nvme_core scsi_mod usbcore usb_common i8042 serio i915 video button intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[   68.745364] CPU: 4 PID: 172 Comm: irq/128-nvidia Tainted: P     U     O    4.14.13-1-ARCH #1
[   68.745365] Hardware name: LENOVO 20HHCTO1WW/20HHCTO1WW, BIOS N1UET42W (1.16 ) 11/27/2017
[   68.745366] task: ffff9206a8103d00 task.stack: ffffa60a46cf0000
[   68.745367] RIP: 0010:0xffff92067d4b3a30
[   68.745367] RSP: 0018:ffffa60a46cf3d40 EFLAGS: 00010246
[   68.745369] RAX: ffff920690143c70 RBX: ffff92067d407b88 RCX: 0000000000000000
[   68.745369] RDX: 0000000000010006 RSI: 0000000000000000 RDI: 0000000000000000
[   68.745370] RBP: ffff9206a141ddd8 R08: 0000000000000000 R09: ffff92067d4b3a30
[   68.745371] R10: 0000000002020008 R11: ffffffffc0905760 R12: ffff92067d407b88
[   68.745372] R13: 0000000000000000 R14: ffff9206a181c008 R15: 0000000000000000
[   68.745373] FS:  0000000000000000(0000) GS:ffff9206ef500000(0000) knlGS:0000000000000000
[   68.745374] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   68.745375] CR2: ffff92067d4b3a30 CR3: 0000000e8d00a004 CR4: 00000000003606e0
[   68.745376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   68.745377] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   68.745377] Call Trace:
[   68.745507]  ? _nv029074rm+0x115/0x180 [nvidia]
[   68.745667]  ? _nv026080rm+0x8b/0xf0 [nvidia]
[   68.745757]  ? _nv010340rm+0x33b/0x410 [nvidia]
[   68.745836]  ? _nv010340rm+0x318/0x410 [nvidia]
[   68.746020]  ? _nv006922rm+0x1a8/0x290 [nvidia]
[   68.746199]  ? _nv025510rm+0x71/0xa0 [nvidia]
[   68.746317]  ? _nv001199rm+0x10e/0x150 [nvidia]
[   68.746320]  ? irq_thread_check_affinity+0xa0/0xa0
[   68.746432]  ? rm_isr_bh+0x23/0x70 [nvidia]
[   68.746433]  ? irq_forced_thread_fn+0x60/0x60
[   68.746543]  ? nvidia_isr_common_bh+0x38/0x60 [nvidia]
[   68.746544]  ? irq_thread_fn+0x1b/0x50
[   68.746546]  ? irq_thread+0x13f/0x190
[   68.746547]  ? wake_threads_waitq+0x30/0x30
[   68.746550]  ? kthread+0x118/0x130
[   68.746551]  ? kthread_create_on_node+0x70/0x70
[   68.746553]  ? SyS_exit_group+0x10/0x10
[   68.746555]  ? ret_from_fork+0x1f/0x30
[   68.746557] Code: 00 00 00 72 50 01 80 00 00 00 00 08 1e 4b 7d 06 92 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 <28> 00 0d 85 06 92 ff ff 72 50 01 80 00 00 00 00 30 04 cf a6 06 
[   68.746577] RIP: 0xffff92067d4b3a30 RSP: ffffa60a46cf3d40
[   68.746578] CR2: ffff92067d4b3a30
[   68.746579] ---[ end trace fccfbc2ace423b29 ]---
[   68.746587] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[   68.746588] BUG: unable to handle kernel paging request at ffff92050d00a920
[   68.746590] IP: 0xffff92050d00a920
[   68.746590] PGD e8d62e067 P4D e8d62e067 PUD 102844b063 PMD 8000000e8d0000e3 
[   68.746593] Oops: 0011 [#2] PREEMPT SMP PTI
[   68.746594] Modules linked in: cmac rfcomm wacom hid_generic snd_seq_midi snd_usb_audio snd_usbmidi_lib snd_rawmidi uvcvideo videobuf2_vmalloc cdc_mbim videobuf2_memops cdc_wdm videobuf2_v4l2 cdc_ncm videobuf2_core qcserial usb_wwan usbnet videodev usbserial mii btusb media btrtl usbhid ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter devlink bnep sch_fq_codel vboxnetflt(O) vboxnetadp(O) pci_stub vboxpci(O) vboxdrv(O) joydev mousedev wmi_bmof tpm_crb snd_hda_codec_hdmi arc4 snd_hda_codec_realtek snd_hda_codec_generic nls_iso8859_1 nls_cp437 vfat fat mei_wdt iwlmvm intel_rapl mac80211 x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc iwlwifi aesni_intel aes_x86_64 crypto_simd glue_helper cryptd intel_cstate intel_rapl_perf
[   68.746619]  psmouse cfg80211 snd_hda_intel pcspkr input_leds snd_hda_codec rtsx_pci_ms e1000e snd_hda_core memstick snd_hwdep i2c_i801 snd_pcm hci_uart thinkpad_acpi ptp pps_core btbcm btqca btintel mei_me idma64 nvram ucsi_acpi mei shpchp typec_ucsi intel_pch_thermal ie31200_edac intel_lpss_pci bluetooth battery led_class ac thermal typec wmi evdev i2c_hid hid mac_hid pinctrl_sunrisepoint ecdh_generic tpm_tis pinctrl_intel acpi_pad rfkill intel_lpss_acpi tpm_tis_core crc16 intel_lpss usbip_host tpm usbip_core coretemp msr snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_timer snd soundcore cuse fuse sg crypto_user acpi_call(O) ip_tables x_tables nvhda(O) bbswitch(O) sd_mod nvidia_uvm(PO) mmc_block btrfs xor zstd_decompress zstd_compress xxhash raid6_pq rtsx_pci_sdmmc mmc_core
[   68.746648]  serio_raw atkbd libps2 crc32c_intel nvidia_drm(PO) nvidia_modeset(PO) ahci libahci nvidia(PO) xhci_pci rtsx_pci libata nvme xhci_hcd nvme_core scsi_mod usbcore usb_common i8042 serio i915 video button intel_gtt i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm agpgart
[   68.746660] CPU: 4 PID: 172 Comm: irq/128-nvidia Tainted: P     UD    O    4.14.13-1-ARCH #1
[   68.746662] Hardware name: LENOVO 20HHCTO1WW/20HHCTO1WW, BIOS N1UET42W (1.16 ) 11/27/2017
[   68.746663] task: ffff9206a8103d00 task.stack: ffffa60a46cf0000
[   68.746664] RIP: 0010:0xffff92050d00a920
[   68.746665] RSP: 0018:ffffa60a46cf3ea8 EFLAGS: 00010282
[   68.746666] RAX: ffffa60a46cf3ed0 RBX: ffff9206a8104478 RCX: 0000000000000000
[   68.746669] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffa60a46cf3ed0
[   68.746670] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
[   68.746671] R10: ffffffff90006a80 R11: ffffffff9055736d R12: ffff9206a8103d00
[   68.746671] R13: ffffa60a46cf3ed0 R14: 0000000000000000 R15: ffff9206a81044a4
[   68.746672] FS:  0000000000000000(0000) GS:ffff9206ef500000(0000) knlGS:0000000000000000
[   68.746673] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   68.746674] CR2: ffff92050d00a920 CR3: 0000000e8d00a004 CR4: 00000000003606e0
[   68.746675] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   68.746676] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   68.746676] Call Trace:
[   68.746678]  ? task_work_run+0x7f/0xa0
[   68.746680]  ? do_exit+0x309/0xb60
[   68.746681]  ? kthread+0x118/0x130
[   68.746683]  ? rewind_stack_do_exit+0x17/0x20
[   68.746684] Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 67 a0 62 8d 0e 00 00 00 <67> e0 62 8d 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[   68.746726] RIP: 0xffff92050d00a920 RSP: ffffa60a46cf3ea8
[   68.746727] CR2: ffff92050d00a920
[   68.746728] ---[ end trace fccfbc2ace423b2a ]---
[   68.746728] Fixing recursive fault but reboot is needed!
[   79.413396] asynchronous wait on fence NVIDIA:nvidia.prime:3 timed out

Looks like an nVidia bug to me!

Anyway, at least the code works with dedicated graphics and I'll work with nVidia to get this resolved.

Good effort! Did you try nouveau?

Good results \o/

Did you try the ACPI patch I did?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/libthinkpad/dockd/issues/3#issuecomment-358176349

rdoursenaud commented 6 years ago

The ACPI patch works like a charm and triggers dockd as expected. Thanks.

As for trying nouveau, I haven't yet. I'll do that and hopefully fix that PR as soon as I have some spare time…

smclt30p commented 6 years ago

On Tue, Jan 30, 2018 at 07:02:15PM -0800, Raphaël Doursenaud wrote:

The ACPI patch works like a charm and triggers dockd as expected. Thanks.

Fantastic, glad to hear that.

As for trying nouveau, I haven't yet. I'll do that and hopefully fix that PR as soon as I have some spare time…

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/libthinkpad/dockd/issues/3#issuecomment-361808838