Bug 254373 - T440p fails to boot while docked with 13.0-RC2
Summary: T440p fails to boot while docked with 13.0-RC2
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: needs-qa, regression
: 257293 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-18 07:02 UTC by Alex Thomas
Modified: 2021-07-29 14:18 UTC (History)
6 users (show)

See Also:
markj: mfc-stable13+
markj: mfc-stable12-
markj: mfc-stable11-


Attachments
dmesg.boot of T440p after install. (14.19 KB, text/plain)
2021-03-18 08:15 UTC, Alex Thomas
no flags Details
/var/log/messages after docking (25.44 KB, text/plain)
2021-03-18 08:16 UTC, Alex Thomas
no flags Details
pciconf -lv without docking station (4.36 KB, text/plain)
2021-03-18 08:17 UTC, Alex Thomas
no flags Details
pciconf -lv with docking station (4.36 KB, text/plain)
2021-03-18 08:17 UTC, Alex Thomas
no flags Details
Panic screenshot and backtrace (406.81 KB, image/jpeg)
2021-03-20 01:44 UTC, Kubilay Kocak
no flags Details
panic: modified loader.conf and SD card plugged in (648.78 KB, image/jpeg)
2021-07-06 19:15 UTC, Yang Zhong
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thomas 2021-03-18 07:02:44 UTC
Tried to installl new RC to my testbed machine. This is a T440p with and i5-4300M with 16GB RAM and 1TB Samsung 860 EVO. I also have an Lenovo Ultra Dock. With 12.2-RELEASE the usb stick boots no problem while laptop is attached to docking station. With 13.0-RC{1,2} it kernel panics on boot. Testing without being attached to dock allowed me to boot and install. It ran fine being docked, after being booted. Rebooting installed system while attached to docking station resulted in kernel panic once again.  Attached is picture I took of the initial kernel panics.
Comment 1 Michael Zhilin freebsd_committer freebsd_triage 2021-03-18 07:11:43 UTC
I've heart same story about Lenovo dock in combination with T14 yesterday.

You mentioned attachment, but ticket has no attachments at the moment. Can you please attach it?
Comment 2 Alex Thomas 2021-03-18 07:25:54 UTC
Sorry bugzilla does not like pictures so here is a link to the picture I took. https://www.dropbox.com/s/asvea77kglch8wv/IMG_1618.JPEG?dl=0

Will be reinstalling and grabbing dmesg, /var/log/message when docking, and pciconf -lv when I get up.
Comment 3 Michael Zhilin freebsd_committer freebsd_triage 2021-03-18 08:06:44 UTC
Thank you for attachment. 

Panic happened inside delayed attachment of mmc after detaching of mmc (see "mmc0: detach"). Detachment of devices during boot is abnormal behaviour, but I can't explain reason why it happened. 

Can you please boot docked laptop with verbose option chosen in boot menu?
It may bring information about detachment reason.

Thanks!
Comment 4 Alex Thomas 2021-03-18 08:15:26 UTC
Created attachment 223380 [details]
dmesg.boot of T440p after install.

Here is the dmesg.boot after doing install without the dock.
Comment 5 Alex Thomas 2021-03-18 08:16:14 UTC
Created attachment 223381 [details]
/var/log/messages after docking

Here is the /var/log/messages after docking the laptop
Comment 6 Alex Thomas 2021-03-18 08:17:06 UTC
Created attachment 223382 [details]
pciconf -lv without docking station

Here is the pciconf -lv without the docking station.
Comment 7 Alex Thomas 2021-03-18 08:17:54 UTC
Created attachment 223383 [details]
pciconf -lv with docking station

Here is pciconf -lv with the docking station
Comment 8 Michael Zhilin freebsd_committer freebsd_triage 2021-03-18 15:15:20 UTC
Hi, 

Is it possible to boot laptop attached to docking station with increased verbosity? 

Thanks!
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2021-03-20 01:44:08 UTC
Created attachment 223437 [details]
Panic screenshot and backtrace
Comment 10 Michael Zhilin freebsd_committer freebsd_triage 2021-03-31 10:33:25 UTC
Can you try to add following parameters to loader.conf? 

dev.rtsx.0.inversion=1
rtsx_load="YES"
Comment 11 Yang Zhong 2021-07-06 19:15:58 UTC
Created attachment 226275 [details]
panic: modified loader.conf and SD card plugged in

I'm experiencing a very similar issue with my T440p, but without any docks. When I try to boot an unmodified FreeBSD-13.0-RELEASE-amd64-mini-memstick.img while the laptop's SD card slot is empty, I get the same kernel panic as https://bugs.freebsd.org/bugzilla/attachment.cgi?id=223437. (Some of the addresses are different; I can upload an image if necessary.) If I plug an SD card into the slot before booting, the unmodified image boots fine.

I also tried a modified image with the lines

dev.rtsx.0.inversion=1
rtsx_load="YES"

added to loader.conf. With no SD card it boots successfully, but on the first installation screen these lines slowly overwrite the interface:

rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD8
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD55
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
rtsx0: Controller timeout for CMD1
mmc0: No compatible cards found on bus
iwm0: hw rev 0x140, fw ver 17.352738, address 7c:7a:91:c2:9b:56

I cannot perform any interface actions until the last line prints. When I boot the modified image with an SD card plugged in beforehand, I get the attached kernel panic.
Comment 12 Yang Zhong 2021-07-21 19:45:04 UTC
Here is a patch that should fix this problem: https://reviews.freebsd.org/D31262
(I don't have a dock and so can't test this exact issue, but the cause is likely the same)
Comment 13 commit-hook freebsd_committer freebsd_triage 2021-07-22 17:52:14 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5341d72a11be200e536ac7d8967449a3f521792

commit d5341d72a11be200e536ac7d8967449a3f521792
Author:     Yang Zhong <yzhong@freebsdfoundation.org>
AuthorDate: 2021-07-22 17:16:01 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-07-22 17:50:10 +0000

    mmc: Drain the intrhook in mmc_detach()

    Buggy SD card drivers may attach and detach a mmc(4) driver instance in
    quick succession.  In this case mmc(4) must disestablish its intrhook
    callback during detach.  Thus, this change adds a call to
    config_intrhook_drain(), which blocks or does nothing if the intrhook is
    running or has already ran (the SD card was plugged in), and
    disestablishes the hook if it hasn't ran yet (the SD card was not
    plugged in).

    PR:             254373
    Reviewed by:    imp, manu, markj
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D31262

 sys/dev/mmc/mmc.c | 1 +
 1 file changed, 1 insertion(+)
Comment 14 Mark Johnston freebsd_committer freebsd_triage 2021-07-23 22:40:32 UTC
*** Bug 257293 has been marked as a duplicate of this bug. ***
Comment 15 commit-hook freebsd_committer freebsd_triage 2021-07-29 12:14:59 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=50b26566c7f4b605d5db4464e259d7db9626dd86

commit 50b26566c7f4b605d5db4464e259d7db9626dd86
Author:     Yang Zhong <yzhong@freebsdfoundation.org>
AuthorDate: 2021-07-22 17:16:01 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-07-29 12:11:50 +0000

    mmc: Drain the intrhook in mmc_detach()

    Buggy SD card drivers may attach and detach a mmc(4) driver instance in
    quick succession.  In this case mmc(4) must disestablish its intrhook
    callback during detach.  Thus, this change adds a call to
    config_intrhook_drain(), which blocks or does nothing if the intrhook is
    running or has already ran (the SD card was plugged in), and
    disestablishes the hook if it hasn't ran yet (the SD card was not
    plugged in).

    PR:             254373
    Reviewed by:    imp, manu, markj
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit d5341d72a11be200e536ac7d8967449a3f521792)

 sys/dev/mmc/mmc.c | 1 +
 1 file changed, 1 insertion(+)
Comment 16 Mark Johnston freebsd_committer freebsd_triage 2021-07-29 14:18:30 UTC
Resolving since the problem has been reported fixed by this change for several users, and it is triggered by rtsx, which is in 13.0 only.