From nobody Tue Jan 11 14:38:40 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C3A59194C5C6 for ; Tue, 11 Jan 2022 14:38:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JYCxM3cbCz4m0y; Tue, 11 Jan 2022 14:38:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 20BEcepT083353 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 11 Jan 2022 16:38:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 20BEcepT083353 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 20BEcesk083352; Tue, 11 Jan 2022 16:38:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 11 Jan 2022 16:38:40 +0200 From: Konstantin Belousov To: Mark Johnston Cc: Andriy Gapon , Mateusz Guzik , freebsd-hackers@freebsd.org Subject: Re: Debugging a (potentially?) ZFS-related panic, and discussion about large patchsets Message-ID: References: <20220110221116.gustgfgfge6pb5fe@mutt-hbsd> <1bf39343-c9b2-353c-63e7-8604adc9d391@FreeBSD.org> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4JYCxM3cbCz4m0y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Tue, Jan 11, 2022 at 09:16:46AM -0500, Mark Johnston wrote: > On Tue, Jan 11, 2022 at 09:28:27AM +0200, Andriy Gapon wrote: > > On 11/01/2022 01:43, Mateusz Guzik wrote: > > > imo the kernel should be patched to obtain the trace on its own. As > > > the target has interrupts disabled it will have to do it with NMI, but > > > support for that got scrapped in > > > > > > commit 1c29da02798d968eb874b86221333a56393a94c3 > > > Author: Mark Johnston > > > Date: Fri Jan 31 15:43:33 2020 +0000 > > > > > > Reimplement stack capture of running threads on i386 and amd64. > > > > This is an off-topic for the thread, but as far as I recall, even when the stack > > capture (e.g., for procstat -k) was implemented using NMI there was a piece of > > code in the corresponding NMI handler that skipped the stack tracing if > > interrupts were disabled. I don't recall / know why. > > You can see that in the removed stack_nmi_handler() that used to be in > > sys/x86/x86/stack_machdep.c. > > I think it may have been to avoid tracing threads in the middle of a > context switch, but I can't remember exactly which inconsistencies were > problematic. Thread stack can become unmapped any moment it went off cpu. You do not know which place in the context switch code was interrupted.