From owner-freebsd-current@freebsd.org Wed May 12 12:46:27 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69CFD63D35F for ; Wed, 12 May 2021 12:46:27 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgF0M2XHhz4Z0X; Wed, 12 May 2021 12:46:27 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [148.251.9.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 2F3852E1F8; Wed, 12 May 2021 12:46:27 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [192.168.134.16] (unknown [94.19.224.8]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 142494650; Wed, 12 May 2021 15:46:25 +0300 (MSK) Reply-To: lev@FreeBSD.org Subject: Re: CURRENT crashes at early boot on Lenovo T540p: rtsx to blame - 13.0-RELEASE crashes same way! To: Henri Hennebert , freebsd-current@freebsd.org References: <740cd7a0-3faf-7a56-80f7-dbb9bdacb55b@FreeBSD.org> <37122994-8172-b943-2602-fd1b4e9af78a@FreeBSD.org> <20210512122747.51d2f574@laptop.domain> <1e23c1de-7529-0be9-c4ec-83d17b2b6bac@restart.be> From: Lev Serebryakov Organization: FreeBSD Message-ID: Date: Wed, 12 May 2021 15:46:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1e23c1de-7529-0be9-c4ec-83d17b2b6bac@restart.be> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 12:46:27 -0000 On 12.05.2021 13:01, Henri Hennebert via freebsd-current wrote: > It would be fine if you can test the driver with dev.rtsx.0.inversion=1 in loader.conf and see it it solve the problem. > the output of > sysctl dev.rtsx  and > kenv | grep smbios.system > would be useful > > BTW is a dummy card inserted in the SD slot? > > Thank for your time My T540p: (1) rtsx in the kernel, enabled in BIOS, no settings in loader.conf, EMPTY SLOT — panic on boot, typically WITHOUT rtsx in stack trace. (2) rtsx in the kernel, enabled in BIOS, no settings in loader.conf, SD CARD IN THE SLOT — no panic on boot, but WiFi card detected too late for startup scripts to run wpa_supplicant properly. (3) rtsx in the kernel, enabled in BIOS, "dev.rtsx.0.inversion=1", SD CARD IN THE SLOT — no panic on boot, but WiFi card detected too late for startup scripts to run wpa_supplicant properly. And card reporting is inverted related to real deal: rtsx0 reports "Card present" when I remove card and vice versa. (4) rtsx in the kernel, disabled in BIOS — device not found, everything (but SD reader) boots & works (as expected!) (5) rtsx in the kernel, enabled in BIOS, "dev.rtsx.0.inversion=1", EMPTY SLOT — boots, but prints out "timeout for CMD8/55/1" for very long time and *console*is*not*accessible* till "no compatible cards found on bus". ALSO (!) wifi card is found only AFTER all these timeouts, when startup scripts are FAILED to attach to wireless network (!!!). ALSO (!) it says "Card Absent" when I *INSERT* card after boot, and "Card present" (+ a lot of timeouts again) when I *REMOVE* card, looks like this "inversion" is wrong for my hardware. So, it boots, but practically unusable. (6) rtsx in the kernel, enabled in BIOS, "dev.rtsx.0.inversion=1", SD CARD IN THE SLOT (7) rtsx is loaded as module after boot (manually, from console), enabled in BIOS, no setting in loader.conf — looks to work properly. Card could be mounted, read/write, it works. (9) rtsx is loaded as module after boot (manually, from console), enabled in BIOS, "dev.rtsx.0.inversion=1" — don't panic, but thinks wrong about card state (Card Present/Absent is inverted, as instructed). My theory: rtsx detect/attach code has some race conditions / incompatibilities for multi-core boot when card is not present, and it thrash kernel memory and/or block something on boot. "inversion" removes this bad behavior due to waiting for card commands (as with "inversion" it thinks card is here and try to access it). See (2), (3) and (4) — when rtsx doesn't cause panic on boot, it still mangle other devices detection & initialization. I could provide any additional information. Unfortunately, memory dump of panic-on-boot is impossible :-( -- // Lev Serebryakov