From owner-freebsd-current@FreeBSD.ORG Fri Jun 12 18:55:27 2015 Return-Path: Delivered-To: current@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22442DE9; Fri, 12 Jun 2015 18:55:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E5D033D; Fri, 12 Jun 2015 18:55:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t5CItL3e098298 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 12 Jun 2015 21:55:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t5CItL3e098298 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t5CItL3j098296; Fri, 12 Jun 2015 21:55:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Jun 2015 21:55:21 +0300 From: Konstantin Belousov To: Maksim Yevmenkin Cc: Andriy Gapon , "current@freebsd.org" Subject: Re: obtaining a minidump from panic() called from NMI handler Message-ID: <20150612185521.GE2080@kib.kiev.ua> References: <557B1905.80307@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 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, 12 Jun 2015 18:55:27 -0000 On Fri, Jun 12, 2015 at 11:49:01AM -0700, Maksim Yevmenkin wrote: > Andriy, > > >> i have a question about obtaining minidump as result of panic() being > >> called from nmi handler. basically, i have a way to trigger nmi, and, > >> i would like to panic() system and obtain a minidump. > >> > >> i have modified isa_nmi() to appropriately inspect bits and return > >> non-zero return code. i have turned off machdep.kdb_on_nmi knob (set > >> it to zero). i have confirmed that amd64 trap() is called with correct > >> T_NMI type. i've also confirmed that panic() is called from amd64's > >> trap(). > >> > >> the issue i have is that system is rebooting too early. basically, it > >> looks like minidump is started, but, for whatever reason, other cpus > >> are not completely stopped (or may be they are panic()ing again) and > >> system just reboots without having complete the minidump. > >> > >> the issue is not present when machdep.kdb_on_nmi is set to 1. in this > >> case, system drops into ddb prompt and 'call doadump' works as > >> expected. for various reasons i can not use ddb, and, would like to > >> have system save nmi triggered minidump completely unattended. > >> > >> can someone please give me a clue as to what i should be looking into > >> to make this work? > > > > could it be that more than one CPUs get the NMI at the same time? > > i guess, its possible. is there an easy way to check for that? > > > IF yes, then the current code wouldn't handle that well - each of the NMI-ed > > CPUs will try to stop all others with another NMI and it will wait until each of > > those CPUs sets an acknowledgement bit in its NMI handler. This scheme works > > fine if there's only one CPU that wants to become the master, but results in a > > deadlock otherwise. > > that makes sense. i don't observe deadlock, but, simple reboot. I believe I posted patches to serialize ddb entrance or panics due to nmi. I do not have references handy, you could search lists.