From nobody Tue Oct 01 06:07:28 2024 X-Original-To: freebsd-hardware@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 4XHnxV45lDz5XL5J for ; Tue, 01 Oct 2024 06:25:34 +0000 (UTC) (envelope-from Stephane.ROCHOY@stormshield.eu) Received: from mail.stormshield.eu (mail.stormshield.eu [91.212.116.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.stormshield.eu", Issuer "Sectigo RSA Organization Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XHnxV1m3Hz4Y62 for ; Tue, 1 Oct 2024 06:25:34 +0000 (UTC) (envelope-from Stephane.ROCHOY@stormshield.eu) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stormshield.eu; s=signer2; t=1727763931; h=From:Subject:Date:Message-ID:To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To :References; bh=UI1fenzYampuYiX9gIjmxvrvAb0DjqpRL83JyoZyc2s=; b=R1Jkv86tj 5V9KgC0ZsWor3N08Cmkn7lK+340RgyfStOsPy7pY4tO7y9KFl7AKBaNhw9vzmdESoaUDFzbAu H4EDDnX8MDLT7U4U1sWfuAzgWYZCFjY1EV8ET49Xfu9GR0robgg/fk+2I1ge3z+H8VttbSfpV ayJ2zAiEMoCEqNwXuSNRs/q1OeiNNUijSnjhrMvm5m451I3T+gzcsS+ahzIqW4ePZKmKN1BRG MZQyrNX9bFGl385fvNsqV1Ud6osRooHbJMiA8k6R0R+gjwWShaKTYLteu+tazOdPmXY/wVede FkjwoE38Nd3GTA2hlBFcA1ANiLb6XvCGCoXvzSfCw==; References: <3065debc-8d4f-4487-abbb-c9408810cea6@sentex.net> <86plotbk5b.fsf@cthulhu.stephaner.labo.int> <9008b389-ab06-401d-9a95-84f849ca602a@sentex.net> <86plosdv48.fsf@cthulhu.stephaner.labo.int> <78e9461c-b93d-403f-b3a1-3568548b9283@sentex.net> <86h6a1egcs.fsf@cthulhu.stephaner.labo.int> <868qvddwph.fsf@cthulhu.stephaner.labo.int> <2d850ccc-2e90-4a1a-927c-045d4750d570@sentex.net> <864j5xehes.fsf@cthulhu.stephaner.labo.int> User-agent: mu4e 1.10.7; emacs 29.4 From: Stephane Rochoy To: mike tancsa CC: Chris6 via freebsd-hardware Subject: Re: watchdog timer programming Date: Tue, 1 Oct 2024 08:07:28 +0200 In-Reply-To: Message-ID: <86zfnocpb8.fsf@cthulhu.stephaner.labo.int> List-Id: General discussion of FreeBSD hardware List-Archive: https://lists.freebsd.org/archives/freebsd-hardware List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hardware@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: ICTDCCEXCH003.one.local (10.180.4.3) To ICTDCCEXCH002.one.local (10.180.4.2) X-DKIM-Signer: DkimX (v3.60.360) X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:49068, ipnet:91.212.116.0/24, country:FR] X-Rspamd-Queue-Id: 4XHnxV1m3Hz4Y62 X-Spamd-Bar: ---- mike tancsa writes: > WARNING: This e-mail comes from someone outside your=20 > organisation. Do not click > on links or open attachments if you do not know the sender and=20 > are not sure that > the content is safe. > > On 9/30/2024 3:18 AM, Stephane Rochoy wrote: >> >> mike tancsa writes: >> >>> Do you know off hand how to set the system to just reboot ?=20 >>> The ddb man >>> page seems to imply I need options DDB as well, which is not=20 >>> in GENERIC >>> in order to set script actions. >> >> I would try the following: >> >> ddb script kdb.enter.default=3Dreset >> > If I build a custom kernel then that will work. But with GENERIC=20 > (I am > tracking project via freebsd-update), it fails > > # ddb script kdb.enter.default=3Dreset > ddb: sysctl: debug.ddb.scripting.scripts: No such file or=20 > directory > > With a customer kernel, adding > > options DDB > > it works perfectly. > > Is there any way to get this to work without having ddb custom > compiled in ? I don't understand what's happening here. AFAIK, the code corresponding to the soft watchdog being triggered is the following: static void wd_timeout_cb(void *arg) { const char *type =3D arg; #ifdef DDB if ((wd_pretimeout_act & WD_SOFT_DDB)) { char kdb_why[80]; snprintf(kdb_why, sizeof(kdb_why), "watchdog %s-timeout",=20 type); kdb_backtrace(); kdb_enter(KDB_WHY_WATCHDOG, kdb_why); } #endif if ((wd_pretimeout_act & WD_SOFT_LOG)) log(LOG_EMERG, "watchdog %s-timeout, WD_SOFT_LOG\n", type); if ((wd_pretimeout_act & WD_SOFT_PRINTF)) printf("watchdog %s-timeout, WD_SOFT_PRINTF\n", type); if ((wd_pretimeout_act & WD_SOFT_PANIC)) panic("watchdog %s-timeout, WD_SOFT_PANIC set", type); } So without DDB, it should call panic. But in your case, it called kdb_backtrace. So initial hypothesis was wrong. What I missed is that panic was natively able to kdb_backtrace if gently asked to do so: #ifdef KDB if ((newpanic || trace_all_panics) && trace_on_panic) kdb_backtrace(); if (debugger_on_panic) kdb_enter(KDB_WHY_PANIC, "panic"); else if (!newpanic && debugger_on_recursive_panic) kdb_enter(KDB_WHY_PANIC, "re-panic"); #endif /*thread_lock(td); */ td->td_flags |=3D TDF_INPANIC; /* thread_unlock(td); */ if (!sync_on_panic) bootopt |=3D RB_NOSYNC; if (poweroff_on_panic) bootopt |=3D RB_POWEROFF; if (powercycle_on_panic) bootopt |=3D RB_POWERCYCLE; kern_reboot(bootopt); So it definitely should reboot but as it don't, maybe playing with kern.powercycle_on_panic would help? Regards, --=20=20 St=C3=A9phane Rochoy O: Stormshield