From owner-freebsd-hackers@freebsd.org Mon Oct 10 08:32:35 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 262E0C07FF0 for ; Mon, 10 Oct 2016 08:32:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 50256B1; Mon, 10 Oct 2016 08:32:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA18316; Mon, 10 Oct 2016 11:32:27 +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 1btW0Z-000Exu-5X; Mon, 10 Oct 2016 11:32:27 +0300 Subject: Re: hpet as nmi watchdog To: John Baldwin , freebsd-hackers@FreeBSD.org References: <56DEB97D.2010804@FreeBSD.org> <2056148.ZvOkyra82H@ralph.baldwin.cx> From: Andriy Gapon Message-ID: <2dd34cf9-fc85-c598-e631-e5c79f5f35ae@FreeBSD.org> Date: Mon, 10 Oct 2016 11:31:30 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <2056148.ZvOkyra82H@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 08:32:35 -0000 On 23/05/2016 23:44, John Baldwin wrote: > On Tuesday, March 08, 2016 01:37:33 PM Andriy Gapon wrote: >> >> I toyed a little bit with an idea of using a HPET timer as an NMI watchdog. >> The idea is that a HPET timer is somehow configured to generate an NMI when it >> fires. The timer normally would not fire, of course, as it is constantly being >> reprogrammed to some future time as is the case for all watchdogs. >> >> I have written some proof of concept code using two approaches. One approach is >> to use the "FSB" (MSI-like) mode of a HPET timer and program a corresponding FSB >> data register (HPET_TIMER_FSB_VAL) with a value that sets NMI delivery mode >> using the IO-APIC specification. The other approach is to use legacy interrupt >> mode for the HPET timer and program a corresponding IO-APIC pin for NMI deliver >> mode. >> In both cases I haven't got a desired result - instead of an NMI a test system >> gets reset when the timer fires. I wonder if this is a quirk of my old hardware >> (HPET in AMD SB7xx, family 10h processor) or if my idea is a non-starter. > > This is an interesting idea. You could also use one of the other timers (8254, > etc.) as a watchdog by setting the I/O APIC pin to NMI as well. It maybe that > for the MSI case the chipset treats the NMI delivery mode as an error, hence > the reset. :-/ > I got this working on the same hardware using HyperTransport definition of the NMI message type (see my recent post in this mailing list). Both in the FSB/MSI and I/O-APIC modes. -- Andriy Gapon