From owner-freebsd-current@freebsd.org Wed May 12 13:36:03 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 B542B63EA5E for ; Wed, 12 May 2021 13:36:03 +0000 (UTC) (envelope-from hlh@restart.be) Received: from tignes.restart.be (tignes.restart.be [37.187.123.11]) (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 (2048 bits) client-digest SHA256) (Client CN "tignes.restart.be", Issuer "CA master" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgG5b3pH3z4c9w; Wed, 12 May 2021 13:36:03 +0000 (UTC) (envelope-from hlh@restart.be) X-Comment: SPF check N/A for local connections - client-ip=192.168.25.127; helo=restart.be; envelope-from=hlh@restart.be; receiver= DKIM-Filter: OpenDKIM Filter v2.10.3 tignes.restart.be 4FgG5S3WkLz4g Received: from restart.be (norquay.tunnel.bel [192.168.25.127]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.restart.be", Issuer "CA master" (verified OK)) by tignes.restart.be (Postfix) with ESMTPS id 4FgG5S3WkLz4g; Wed, 12 May 2021 15:35:54 +0200 (CEST) Received: from morzine.restart.bel (morzine.restart.be [IPv6:2001:41d0:a:f40b:1:1:0:1]) (authenticated bits=0) by restart.be (8.16.1/8.16.1) with ESMTPSA id 14CDZrKC001472 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=OK); Wed, 12 May 2021 15:35:53 +0200 (CEST) (envelope-from hlh@restart.be) X-Authentication-Warning: norquay.restart.bel: Host morzine.restart.be [IPv6:2001:41d0:a:f40b:1:1:0:1] claimed to be morzine.restart.bel Subject: Re: CURRENT crashes at early boot on Lenovo T540p: rtsx to blame - 13.0-RELEASE crashes same way! To: lev@FreeBSD.org, 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: Henri Hennebert Message-ID: Date: Wed, 12 May 2021 15:35:53 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FgG5b3pH3z4c9w X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] 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 13:36:03 -0000 On 5/12/21 2:46 PM, Lev Serebryakov wrote: > 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). Firts, thank you for your exhaustive testing! Your analysis seems pertinent for me. What seems strange: case (1) and (3) follow the same path in the driver but (1) produce a panic. > >  See (2), (3) and (4) — when rtsx doesn't cause panic on boot, it still mangle > other devices detection & initialization. booting in case (2) can you show the output of pciconf -lvbc and vmstat -i > >  I could provide any additional information. Unfortunately, memory dump of > panic-on-boot is impossible :-( >