From owner-freebsd-current@freebsd.org Fri May 14 08:17:40 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 9FF5663D0B1 for ; Fri, 14 May 2021 08:17:40 +0000 (UTC) (envelope-from hlh@restart.be) Received: from tignes.restart.be (tignes.restart.be [IPv6:2001:41d0:a:f40b::1]) (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 4FhLxG5c6jz4r8W; Fri, 14 May 2021 08:17:38 +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 4FhLxC4XTVzH6 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 4FhLxC4XTVzH6; Fri, 14 May 2021 10:17:33 +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 14E8HTa3017749 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=OK); Fri, 14 May 2021 10:17:32 +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: Marc Veldman Cc: "lev@freebsd.org" , freebsd-current@freebsd.org References: <9f0abf48-ed13-bff3-5687-fca0d57195d8@restart.be> <8d4e076b-9ecd-aef2-0ee8-73519bb9d939@FreeBSD.org> <8d2be5f2-4144-082e-4237-0dac0c4b37e6@restart.be> <6798878a-c499-d78d-e96d-d744513cb80d@restart.be> <1de588e2-20cb-3206-3aea-f3f88f577675@restart.be> <67f0874a-6a05-67f1-3f2b-c4b3dc67fa11@FreeBSD.org> <83b823bf-c6c2-2f6a-b5dd-2e91b4d1931e@restart.be> <2c208bbc-5adc-2327-4717-a5e7c8d64b4b@FreeBSD.org> <9a15daa7-2b17-e257-d4d1-850c632a9db8@restart.be> <417a97b9-2c40-310c-c445-b193c493b880@FreeBSD.org> <7eb763ce-0bbf-9baf-2ede-968ee25cff2e@restart.be> From: Henri Hennebert Message-ID: <0e13f794-a691-ddd1-4122-339bbc9e06f8@restart.be> Date: Fri, 14 May 2021 10:17:29 +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: 4FhLxG5c6jz4r8W X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.55 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:41d0:a:f40b::1/128:c]; HAS_XAW(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[restart.be:+]; DMARC_POLICY_ALLOW(-0.50)[restart.be,reject]; NEURAL_HAM_SHORT(-0.55)[-0.551]; SUBJECT_ENDS_EXCLAIM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:41d0:a:f40b::1:from]; ASN(0.00)[asn:16276, ipnet:2001:41d0::/32, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[restart.be:s=tignes]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2001:41d0:a:f40b::1:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-current] 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: Fri, 14 May 2021 08:17:40 -0000 On 5/13/21 7:25 PM, Marc Veldman wrote: > > >> On 13 May 2021, at 17:56, Henri Hennebert wrote: >> >> On 5/13/21 5:51 PM, Lev Serebryakov wrote: >>> On 13.05.2021 18:38, Henri Hennebert via freebsd-current wrote: >>>> This seems a good news. >>>> >>>> Can you replace sys/dev/rtsx.c by the latest version (2.0g) from >>>> https://github.com/hlh-restart/rtsx >>>> >>>> I reduce the DELAY to 250000 and make some other updates waiting in the pipeline. >>> I've replaced two files in /usr/src/sys/dev/rtsx, rebuilt GENERIC kernel and it boots! >>> Output WITHOUT card is like this: >>> pci2: on pcib2 >>> rtsx0: <2.0g Realtek RTS5227 PCI MMC/SD Card Reader> mem 0xf4500000-0xf4500fff at device 0.0 on pci2 >>> rtsx0: We are running with inversion: 0 >>> rtsx0: Interrupt card inserted/removed >>> rtsx0: Card absent >>> rtsx0: No card is detected >>> pcib3: at device 28.1 on pci0 >>> Output WITH card is like this: >>> pci2: on pcib2 >>> rtsx0: <2.0g Realtek RTS5227 PCI MMC/SD Card Reader> mem 0xf4500000-0xf4500fff at device 0.0 on pci2 >>> rtsx0: We are running with inversion: 0 >>> rtsx0: Interrupt card inserted/removed >>> rtsx0: Card present >>> rtsx0: A card is detected >>> mmc0: on rtsx0 >>> pcib3: at device 28.1 on pci0 >>> ... >>> mmcsd0: 16GB at mmc0 50.0MHz/4bit/2048-block >>> ... >>> No visible delays in both cases. >>> Both boots are "cold", with AC cycle >> So if I understand correctly, your problem is solved. >> > > On my laptop (Lenovo P50s) the laptop now boots fine with and without the > card inserted, but it panics immediately on insertion or removal of the card, > unfortunately. > > > 1) > > #dev.rtsx.0.inversion=“1" > > commented out in boot/loader.conf. > > 1.a) > > Booting with the card works. > When I remove the card a few minutes after boot I get a panic: > > Unread portion of the kernel message buffer: > rtsx0: Interrupt card inserted/removed > rtsx0: Card present > panic: mutex Giant not owned at /usr/src/sys/kern/subr_bus.c:2944 > cpuid = 3 > time = 1620924849 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00c6780910 > vpanic() at vpanic+0x181/frame 0xfffffe00c6780960 > panic() at panic+0x43/frame 0xfffffe00c67809c0 > __mtx_assert() at __mtx_assert+0xb0/frame 0xfffffe00c67809d0 > device_probe_and_attach() at device_probe_and_attach+0x2a/frame 0xfffffe00c6780a00 > taskqueue_run_locked() at taskqueue_run_locked+0xaa/frame 0xfffffe00c6780a80 > taskqueue_thread_loop() at taskqueue_thread_loop+0x94/frame 0xfffffe00c6780ab0 > fork_exit() at fork_exit+0x80/frame 0xfffffe00c6780af0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00c6780af0 > --- trap 0, rip = 0, rsp = 0, rbp = 0 — Really strange, on my configuration, under 13.0-STABLE (stable/13-n245247-53c0fd84096) all was working smoothly. I switch back to taskqueue_swi_giant. Please test from GitHub version 2.0h. I am also interested by the output of kenv | grep smbios.system I think that in your case (P50s) inersion is not needed and you must add dev.rtsx.0.inversion=0 in loader.conf The inversion heuristic is not working for you. Please show the rtsx lines from dmesg. > > 1.b) > Booting without the card works, when I insert the card I get the same panic. > > 2) > With ndev.rtsx.0.inversion="1" > > Now enabled in /boot/loader.conf > > 2a) > Booting with the card inserted works, but when I remove the card I get the above panic. > > 2b) > Booting without the card inserted works, but when Insert the card I get the above panic. > >> I will push this new version to current, but it will take some time because I am not a committer. >> > > A minor thing about the patch/change. > I suspect the delay is a quarter of a second, not half as stated in the comments. Thanks, I forget to update the comment when I switch from 500000 to 250000. > > Again, thank you very much for your work on this! > > Best regards, > > Marc Veldman > >