Syniurge / i2c-amd-mp2

DKMS-ready driver for AMD PCI-E MP2 I2C controllers
22 stars 4 forks source link

i2c read timed out #1

Closed nekinie closed 5 years ago

nekinie commented 6 years ago

First off, thank you for taking the time to work on this project :)

I'm using a Lenovo Ideapad 530s with the AMD 2500U CPU. I'm running a fresh install of Arch Linux with the 4.18.16 kernel.

This project enables the touch pad to work for a short period of time before it stops.

dmesg output:

[ 2883.598041] i2c_amd_plat_mp2 AMDI0011:01: i2c read timed out [ 3071.563513] INFO: task irq/65-MSFT0001:406 blocked for more than 120 seconds. [ 3071.563520] Tainted: G OE 4.18.16-arch1-1-ARCH #1 [ 3071.563523] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 3071.563526] irq/65-MSFT0001 D 0 406 2 0x80000080 [ 3071.563531] Call Trace: [ 3071.563543] ? schedule+0x29b/0x8b0 [ 3071.563548] ? rcu_preempt_qs+0x2b/0x50 [ 3071.563551] schedule+0x32/0x90 [ 3071.563555] schedule_preempt_disabled+0x14/0x20 [ 3071.563558] mutex_lock.isra.0+0x220/0x530 [ 3071.563564] ? switch_to_asm+0x40/0x70 [ 3071.563567] ? switch_to_asm+0x34/0x70 [ 3071.563570] ? switch_to_asm+0x34/0x70 [ 3071.563578] amd_mp2_read+0x4f/0x17b [i2c_amd_pci_mp2] [ 3071.563584] i2c_amd_xfer+0x61/0x150 [i2c_amd_plat_mp2] [ 3071.563590] ? irq_thread_dtor+0x80/0x80 [ 3071.563595] i2c_transfer+0x113/0x430 [ 3071.563599] ? _raw_spin_unlock_irq+0x1d/0x30 [ 3071.563602] ? irq_thread_dtor+0x80/0x80 [ 3071.563604] i2c_transfer+0x51/0xc0 [ 3071.563607] ? irq_forced_thread_fn+0x70/0x70 [ 3071.563610] i2c_transfer_buffer_flags+0x4c/0x70 [ 3071.563616] i2c_hid_irq+0x3c/0x130 [i2c_hid] [ 3071.563619] ? irq_forced_thread_fn+0x70/0x70 [ 3071.563622] irq_thread_fn+0x1f/0x50 [ 3071.563626] ? irq_forced_thread_fn+0x70/0x70 [ 3071.563628] irq_thread+0x142/0x1a0 [ 3071.563632] ? wake_threads_waitq+0x30/0x30 [ 3071.563637] kthread+0x112/0x130 [ 3071.563641] ? kthread_flush_work_fn+0x10/0x10 [ 3071.563645] ret_from_fork+0x22/0x40

splav commented 5 years ago

Just installed. There are freezes after inactivity (>1s, so resume works not so good...). No error messages. Cursor disappears during the freeze.

Syniurge commented 5 years ago

Saw that once, it was back to normal after a module reload. Looking into it..

Syniurge commented 5 years ago

@splav does the freeze happen every time for you? Until now this happened only once here until module reload, I saw the cursor disappear and also the freezes occurred after inactivity but within less than one 1s so it's pretty weird, I don't think that it's resume that doesn't work properly, still investigating..

splav commented 5 years ago

@Syniurge not every time. It happened on first boot. The next time everything was normal. The it happened again. I tried to set PM timeout to 100000ms, without any change. So, the PM is probably not related... Reloading helped. It seems that there is some condition ( software or, maybe, hardware ) when freezes happen after each inactivity. But it is not so common (may be initialization order during boot matters or some kind of data race?).

Syniurge commented 5 years ago

I haven't been able to reproduce the issue since 3 days ago. Since it seems more frequent on Ideapad this is probably another sync issue affecting touchpads with short i2c messages foremost. Also I haven't dug very deep into the hid/ code but the fact that the cursor disappeared might mean that it received an incorrect HID report, maybe all zeros. So I'm still trying to figure this out..

Syniurge commented 5 years ago

Oh actually by adding a warning I may have figured it out just now, it may be fixed in the latest commit.

If not I added a few more warnings in cases that shouldn't happen and may point towards something wrong with how the driver communicates with the MP2, please let me know if you see new error messages.

JanValiska commented 5 years ago

I got this errors when i booted with latest version of module:

[    3.895345] tpm_crb MSFT0101:00: can't request region for resource [mem 0xbf7a6000-0xbf7a9fff]                                                                                             
[    3.896582] tpm_crb: probe of MSFT0101:00 failed with error -16  

After 5 minutes touchpad freezed, but with no error message in dmesg at all. Module reload helped.

Syniurge commented 5 years ago

MSFT0101:00 is the Trusted Platform Module I believe and not related to the MP2 or touchpad.

After 5 minutes touchpad freezed, but with no error message in dmesg at all. Module reload helped.

By freeze do you mean stop working entirely or having intermittent freezes like the ones described by @splav?

splav commented 5 years ago

Haven't tried yet, will do today later. But according to Windows device manager MSFT is a touchpad device.

JanValiska commented 5 years ago

After 5 minutes touchpad stopped working entirely.

nekinie commented 5 years ago

For me MSFT0001:00 is the touchpad

Device: MSFT0001:00 04F3:304B Touchpad Kernel: /dev/input/event11 Group: 7 Seat: seat0, default Size: 100x66mm Capabilities: pointer gesture Tap-to-click: disabled Tap-and-drag: enabled Tap drag lock: disabled Left-handed: disabled Nat.scrolling: disabled Middle emulation: disabled Calibration: n/a Scroll methods: *two-finger edge Click methods: *button-areas clickfinger Disable-w-typing: enabled Accel profiles: none Rotation: n/a

Every now and then the touchpad stops working for me also, reloading the i2c-amd-mp2 module brings it back to life.

nekinie commented 5 years ago

By stops working, mouse input through the touchpad and click button no longer results in movement to the cursor.

nekinie commented 5 years ago

here's dmesg after the trackpad stopped working, unloaded and reloaded the module to return correct functionality.

https://gist.github.com/nekinie/e402e0eaa358217c8817eab6db4bf6a4

Syniurge commented 5 years ago

But according to Windows device manager MSFT is a touchpad device.

For me MSFT0001:00 is the touchpad

Yes for me too, but the similarly named MSFT0101 is a different device:

        Device (TPD0)
        {
            Name (_HID, "MSFT0001")  // _HID: Hardware ID
            Name (_CID, "PNP0C50" /* HID Protocol Device (I2C bus) */)  // _CID: Compatible ID
...
        Device (TPM2)
        {
            Name (_HID, "MSFT0101" /* TPM 2.0 Security Device */)  // _HID: Hardware ID
            Name (_CID, "MSFT0101" /* TPM 2.0 Security Device */)  // _CID: Compatible ID
mlaggner commented 5 years ago

hit something similar today: after the touchpad worked like a charm yesterday evening, I've put the laptop to sleep overnight and today touchpad freezes occurred. nothing to see in dmseg, but I saw the following line in top:

screenshot_20181129_183205

[manuel@Yoga ~]$ uname -a
Linux Yoga 4.19.4-1-MANJARO #1 SMP PREEMPT Fri Nov 23 18:23:26 UTC 2018 x86_64 GNU/Linux
Syniurge commented 5 years ago

@mlaggner Thanks I didn't notice that the one time it happened for me.

Thanks for the other clues as well. I'll try forcing my MP2 into communicating through <32 bytes messages by truncating HID reports, see if I can reproduce the freezes here.

Syniurge commented 5 years ago

Truncating the HID reports from my touchpad worked, I was finally able to reproduce the Ideapad issues on my Yoga!

The freezes should be definitely fixed by 10ef847c0864de5c75e3ddd50555680680289da0. Reloaded the module/suspended about 20 times and no freeze in sight. I also used the touchpad for about an hour without any issue.

mlaggner commented 5 years ago

will test it tomorrow (where I can use the touchpad the whole day ;) )

splav commented 5 years ago

It seems than the issue has gone. Thank you very much!

JanValiska commented 5 years ago

I can confirm that there is no more problems with touchpad using newest module loaded. Thank you for your work.

nekinie commented 5 years ago

I also have experienced no more issues since using the newest version, thank you :+1:

mlaggner commented 5 years ago

worked the whole two days with the touchpad and no issues so far - great work! :+1:

Syniurge commented 5 years ago

Thank you for all the testing and helping improve the driver, it should be in pretty good shape now.