From owner-freebsd-current@FreeBSD.ORG Fri Jun 12 17:39:14 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 C6899454 for ; Fri, 12 Jun 2015 17:39:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 08098EBF for ; Fri, 12 Jun 2015 17:39:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id UAA28082; Fri, 12 Jun 2015 20:39:10 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Z3Sv8-0004AP-4A; Fri, 12 Jun 2015 20:39:10 +0300 Message-ID: <557B1905.80307@FreeBSD.org> Date: Fri, 12 Jun 2015 20:38:13 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Maksim Yevmenkin , "current@freebsd.org" Subject: Re: obtaining a minidump from panic() called from NMI handler References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 17:39:14 -0000 On 10/06/2015 20:36, Maksim Yevmenkin wrote: > hello, > > 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? Maksim, could it be that more than one CPUs get the NMI at the same time? 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. -- Andriy Gapon