Thread View: muc.lists.freebsd.hackers
6 messages
6 total messages
Started by Dave Cottlehuber
Thu, 22 Oct 2026 11:25
watchdogd rc ordering
Author: Dave Cottlehuber
Date: Thu, 22 Oct 2026 11:25
Date: Thu, 22 Oct 2026 11:25
35 lines
4274 bytes
4274 bytes
hi, I am working on a driver that attaches the ARM SBSA Generic Watchdog described by GTDT and takes it over from firmware, for DGX Spark[1]. Watchdogd starts via rc, and then all is well. But between when the driver loads, and when rc kicks in, I need to wait for network, because the rc ordering puts it after: # PROVIDE: watchdogd # REQUIRE: FILESYSTEMS syslogd # KEYWORD: nojail shutdown Would this not make more sense to happen earlier, such as `REQUIRE: DISK`? This seems mostly to be working so far, unless the NICs take longer than ~ 20s to initialise, in which case the watchdog timer fires *before* the userland watchdog rc script gets called to "pet the dog" in time. In my case, the mlx5en driver does take longer to initialise, because I don't have anything to plug it into, so the box times out & panics. [1]: https://dmesgd.nycbug.org/index.cgi?do=index&fts=spark A+ Dave ——— O for a muse of fire, that would ascend the brightest heaven of invention! -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: watchdogd rc ordering
Author: Adrian Chadd
Date: Fri, 23 Oct 2026 21:23
Date: Fri, 23 Oct 2026 21:23
115 lines
9978 bytes
9978 bytes
--000000000000a32aa2065e8898be Content-Type: text/plain; charset="UTF-8" hi! On Thu, 22 Oct 2026 at 04:26, Dave Cottlehuber <dch@freebsd.org> wrote: > hi, > > I am working on a driver that attaches the ARM SBSA Generic Watchdog > described by GTDT and takes it over from firmware, for DGX Spark[1]. > > Watchdogd starts via rc, and then all is well. But between when > the driver loads, and when rc kicks in, I need to wait for network, > because the rc ordering puts it after: > > # PROVIDE: watchdogd > # REQUIRE: FILESYSTEMS syslogd > # KEYWORD: nojail shutdown > > Would this not make more sense to happen earlier, such as `REQUIRE: DISK`? > > This seems mostly to be working so far, unless the NICs take longer > than ~ 20s to initialise, in which case the watchdog timer fires *before* > the userland watchdog rc script gets called to "pet the dog" in time. > > In my case, the mlx5en driver does take longer to initialise, because I > don't have anything to plug it into, so the box times out & panics. > > Is the problem here that the watchdog is already armed by the firmware? Are you explicitly re-configuring the timeout to some defined value? IIRC when working on this stuff for MIPS platforms you'll want a couple of things: * the driver self pats the watchdog until userland says "i'm ready to pat the watchdog again" at which point it goes back to userland triggered patting; * some optional configuration that you can set that starts the watchdog at attach time to set to some value that's notionally useful (ie, "the watchdog should fire if the box doesn't boot far enough in say, 60 seconds.") So I /can/ see having watchdogd started earlier being useful - as long as whatever it needs is available! - but unless we're defining it ourselves in the driver, we may see weird platform behaviour differences that lead to unwanted reboots. nice work though, I'm glad we're booting and running on it! -adrian --000000000000a32aa2065e8898be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">hi!</div><br><div class=3D"gmail_quote gm= ail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, 22 Oct 2= 026 at 04:26, Dave Cottlehuber <<a href=3D"mailto:dch@freebsd.org">dch@f= reebsd.org</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex">hi,<br> <br> I am working on a driver that attaches the ARM SBSA Generic Watchdog<br> described by GTDT and takes it over from firmware, for DGX Spark[1].<br> <br> Watchdogd starts via rc, and then all is well. But between when<br> the driver loads, and when rc kicks in, I need to wait for network,<br> because the rc ordering puts it after:<br> <br> # PROVIDE: watchdogd<br> # REQUIRE: FILESYSTEMS syslogd<br> # KEYWORD: nojail shutdown<br> <br> Would this not make more sense to happen earlier, such as `REQUIRE: DISK`?<= br> <br> This seems mostly to be working so far, unless the NICs take longer<br> than ~ 20s to initialise, in which case the watchdog timer fires *before*<b= r> the userland watchdog rc script gets called to "pet the dog" in t= ime.<br> <br> In my case, the mlx5en driver does take longer to initialise, because I<br> don't have anything to plug it into, so the box times out & panics.= <br><br></blockquote><div><br></div><div>Is the problem here that the watch= dog is already armed by the firmware?</div><div>Are you explicitly re-confi= guring the timeout to some defined value?</div><div><br></div><div>IIRC whe= n working on this stuff for MIPS platforms you'll want a couple</div><d= iv>of things:</div><div><br></div><div>* the driver self pats the watchdog = until userland says "i'm ready to pat the watchdog again"</di= v><div>=C2=A0 at which point it goes back to userland triggered patting;</d= iv><div>* some optional configuration that you can set that starts the watc= hdog at attach time</div><div>=C2=A0 to set to some value that's notion= ally useful (ie, "the watchdog should fire if the box</div><div>=C2=A0= doesn't boot far enough in say, 60 seconds.")</div><div><br></div= ><div>So I /can/ see having watchdogd started earlier being useful - as lon= g as whatever</div><div>it needs is available! - but unless we're defin= ing it ourselves in the driver, we may</div><div>see weird platform behavio= ur differences that lead to unwanted reboots.</div><div><br></div><div>nice= work though, I'm glad we're booting and running on it!</div><div><= br></div><div><br></div><div><br></div><div>-adrian</div><div>=C2=A0</div><= /div></div> --000000000000a32aa2065e8898be-- -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: watchdogd rc ordering
Author: Dave Cottlehuber
Date: Mon, 26 Oct 2026 10:20
Date: Mon, 26 Oct 2026 10:20
79 lines
6069 bytes
6069 bytes
On Fri, 23 Oct 2026, at 23:23, Adrian Chadd wrote: > hi! > > On Thu, 22 Oct 2026 at 04:26, Dave Cottlehuber <dch@freebsd.org> wrote: >> hi, >> >> I am working on a driver that attaches the ARM SBSA Generic Watchdog >> described by GTDT and takes it over from firmware, for DGX Spark[1]. >> >> Watchdogd starts via rc, and then all is well. But between when >> the driver loads, and when rc kicks in, I need to wait for network, >> because the rc ordering puts it after: >> >> # PROVIDE: watchdogd >> # REQUIRE: FILESYSTEMS syslogd >> # KEYWORD: nojail shutdown >> >> Would this not make more sense to happen earlier, such as `REQUIRE: DISK`? >> >> This seems mostly to be working so far, unless the NICs take longer >> than ~ 20s to initialise, in which case the watchdog timer fires *before* >> the userland watchdog rc script gets called to "pet the dog" in time. >> >> In my case, the mlx5en driver does take longer to initialise, because I >> don't have anything to plug it into, so the box times out & panics. >> > > Is the problem here that the watchdog is already armed by the firmware? Yes > Are you explicitly re-configuring the timeout to some defined value? That’s what watchdogd does, in the rc script - the driver just follows its lead. > IIRC when working on this stuff for MIPS platforms you'll want a couple > of things: > > * the driver self pats the watchdog until userland says "i'm ready to > pat the watchdog again" Ok that’s good to know, I wondered if this is ok, because if something happens during boot we could be wedged indefinitely and not trigger. > at which point it goes back to userland triggered patting; > * some optional configuration that you can set that starts the watchdog > at attach time > to set to some value that's notionally useful (ie, "the watchdog > should fire if the box > doesn't boot far enough in say, 60 seconds.") > > So I /can/ see having watchdogd started earlier being useful - as long > as whatever > it needs is available! - but unless we're defining it ourselves in the > driver, we may > see weird platform behaviour differences that lead to unwanted reboots. > > nice work though, I'm glad we're booting and running on it! I won’t confess how long it took me to realise that the reason there’s no crash dump was because of a watchdog, but it was measured in days not hours… A+ Dave ——— O for a muse of fire, that would ascend the brightest heaven of invention! -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: watchdogd rc ordering
Author: Sulev-Madis Silber
Date: Mon, 26 Oct 2026 11:01
Date: Mon, 26 Oct 2026 11:01
109 lines
8219 bytes
8219 bytes
On October 26, 2026 12:20:09 PM GMT+02:00, Dave Cottlehuber <dch@FreeBSD.org> wrote: >On Fri, 23 Oct 2026, at 23:23, Adrian Chadd wrote: >> hi! >> >> On Thu, 22 Oct 2026 at 04:26, Dave Cottlehuber <dch@freebsd.org> wrote: >>> hi, >>> >>> I am working on a driver that attaches the ARM SBSA Generic Watchdog >>> described by GTDT and takes it over from firmware, for DGX Spark[1]. >>> >>> Watchdogd starts via rc, and then all is well. But between when >>> the driver loads, and when rc kicks in, I need to wait for network, >>> because the rc ordering puts it after: >>> >>> # PROVIDE: watchdogd >>> # REQUIRE: FILESYSTEMS syslogd >>> # KEYWORD: nojail shutdown >>> >>> Would this not make more sense to happen earlier, such as `REQUIRE: DISK`? >>> >>> This seems mostly to be working so far, unless the NICs take longer >>> than ~ 20s to initialise, in which case the watchdog timer fires *before* >>> the userland watchdog rc script gets called to "pet the dog" in time. >>> >>> In my case, the mlx5en driver does take longer to initialise, because I >>> don't have anything to plug it into, so the box times out & panics. >>> >> >> Is the problem here that the watchdog is already armed by the firmware? > >Yes > >> Are you explicitly re-configuring the timeout to some defined value? > >That’s what watchdogd does, in the rc script - the driver just follows its lead. > >> IIRC when working on this stuff for MIPS platforms you'll want a couple >> of things: >> >> * the driver self pats the watchdog until userland says "i'm ready to >> pat the watchdog again" > >Ok that’s good to know, I wondered if this is ok, because if something happens during boot we could be wedged indefinitely and not trigger. that would be ok if driver has some <5min timeout there after which it decides that boot is stalled and resets system in a hope to boot cleanly some boards have really short timeout like 8s and you have to start patting immediately and boot really fast if you want to stay up while ultra fast timeouts would be fine if it boots up, as 8s missed is likely frozen system, a boot might take slightly longer and it's fine. unless it just bootloops but watchdog is not really meant to solve this in some applications a bootloop due timed out network is even ok if network is critical for system operation i think some intermediate timeout in kernel would be needed to allow boot to take reasonable time on systems with super short hw wdt timeouts (adhd dogs?) > >> at which point it goes back to userland triggered patting; >> * some optional configuration that you can set that starts the watchdog >> at attach time >> to set to some value that's notionally useful (ie, "the watchdog >> should fire if the box >> doesn't boot far enough in say, 60 seconds.") >> >> So I /can/ see having watchdogd started earlier being useful - as long >> as whatever >> it needs is available! - but unless we're defining it ourselves in the >> driver, we may >> see weird platform behaviour differences that lead to unwanted reboots. >> >> nice work though, I'm glad we're booting and running on it! > >I won’t confess how long it took me to realise that the reason there’s no crash dump was because of a watchdog, but it was measured in days not hours… > >A+ >Dave >——— >O for a muse of fire, that would ascend the brightest heaven of invention! > -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: watchdogd rc ordering
Author: Adrian Chadd
Date: Mon, 26 Oct 2026 23:18
Date: Mon, 26 Oct 2026 23:18
70 lines
8010 bytes
8010 bytes
--0000000000009f0838065ec68ecc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 26 Oct 2026 at 03:20, Dave Cottlehuber <dch@freebsd.org> wrote: > IIRC when working on this stuff for MIPS platforms you'll want a couple > > of things: > > > > * the driver self pats the watchdog until userland says "i'm ready to > > pat the watchdog again" > > Ok that=E2=80=99s good to know, I wondered if this is ok, because if some= thing > happens during boot we could be wedged indefinitely and not trigger. > That's always a risk, but you get to decide whether you want that or to initialise it to some longer time that'll allow a boot to happen. You can't say how long that's going to be as it really depends upon the system config. You may want to default it to program in some longer alarm value and have a device hint control the initial behaviour (kernel pat or not pat, watchdog alarm fire time) before userland can come configure it. (And then we should document that as a requirement somewhere....) -adrian --0000000000009f0838065ec68ecc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g= mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, 26 Oct = 2026 at 03:20, Dave Cottlehuber <<a href=3D"mailto:dch@freebsd.org">dch@= freebsd.org</a>> wrote:</div><div dir=3D"ltr" class=3D"gmail_attr"><br><= /div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo= rder-left:1px solid rgb(204,204,204);padding-left:1ex"> > IIRC when working on this stuff for MIPS platforms you'll want a c= ouple<br> > of things:<br> ><br> > * the driver self pats the watchdog until userland says "i'm = ready to <br> > pat the watchdog again"<br> <br> Ok that=E2=80=99s good to know, I wondered if this is ok, because if someth= ing happens during boot we could be wedged indefinitely and not trigger.<br= ></blockquote><div><br></div><div>That's always a risk, but you get to = decide whether you want that or to initialise it to some</div><div>longer t= ime that'll allow a boot to happen. You can't say how long that'= ;s going to be</div><div>as it really depends upon the system config.=C2=A0= You=C2=A0may want to default it to</div><div>program in some longer alarm = value and have a device hint control the initial</div><div>behaviour (kerne= l pat or not pat, watchdog=C2=A0alarm fire time) before userland</div><div>= can come configure it.</div><div><br></div><div>(And then we should=C2=A0do= cument that as a requirement somewhere....)</div><div><br></div><div><br></= div><div><br></div><div>-adrian</div><div>=C2=A0</div></div></div> --0000000000009f0838065ec68ecc-- -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: watchdogd rc ordering
Author: Warner Losh
Date: Mon, 26 Oct 2026 23:59
Date: Mon, 26 Oct 2026 23:59
107 lines
10755 bytes
10755 bytes
--0000000000006688ad065ec71e99 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Oct 26, 2026 at 5:19=E2=80=AFPM Adrian Chadd <adrian@freebsd.org> w= rote: > > > On Mon, 26 Oct 2026 at 03:20, Dave Cottlehuber <dch@freebsd.org> wrote: > > > IIRC when working on this stuff for MIPS platforms you'll want a couple >> > of things: >> > >> > * the driver self pats the watchdog until userland says "i'm ready to >> > pat the watchdog again" >> >> Ok that=E2=80=99s good to know, I wondered if this is ok, because if som= ething >> happens during boot we could be wedged indefinitely and not trigger. >> > > That's always a risk, but you get to decide whether you want that or to > initialise it to some > longer time that'll allow a boot to happen. You can't say how long that's > going to be > as it really depends upon the system config. You may want to default it = to > program in some longer alarm value and have a device hint control the > initial > behaviour (kernel pat or not pat, watchdog alarm fire time) before userla= nd > can come configure it. > > (And then we should document that as a requirement somewhere....) > Yes. What does the watchdog cover, and how do you cope with the mildly unexpected? Sometimes when the network is not available, I want it to be patient. Comcast internet can be flaky, and I don't want to watchdog my machine because of that. Sometimes I want it to reboot since the driver on a different machine might not be quite reliable at coming up the first time and the watchdog and reboot is the only way to fix it. I've often thought an early start watchdog would be better, and other times like the later start. On the whole, though I'm inclined to do an earlier start since it gives people a better chance to cope with $WEIRD_STUFF using the watchdog health script. Warner --0000000000006688ad065ec71e99 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g= mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 26,= 2026 at 5:19=E2=80=AFPM Adrian Chadd <<a href=3D"mailto:adrian@freebsd.= org">adrian@freebsd.org</a>> wrote:<br></div><blockquote class=3D"gmail_= quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,= 204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div= class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, 26 Oct= 2026 at 03:20, Dave Cottlehuber <<a href=3D"mailto:dch@freebsd.org" tar= get=3D"_blank">dch@freebsd.org</a>> wrote:</div><div dir=3D"ltr" class= =3D"gmail_attr"><br></div><blockquote class=3D"gmail_quote" style=3D"margin= :0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"= > > IIRC when working on this stuff for MIPS platforms you'll want a c= ouple<br> > of things:<br> ><br> > * the driver self pats the watchdog until userland says "i'm = ready to <br> > pat the watchdog again"<br> <br> Ok that=E2=80=99s good to know, I wondered if this is ok, because if someth= ing happens during boot we could be wedged indefinitely and not trigger.<br= ></blockquote><div><br></div><div>That's always a risk, but you get to = decide whether you want that or to initialise it to some</div><div>longer t= ime that'll allow a boot to happen. You can't say how long that'= ;s going to be</div><div>as it really depends upon the system config.=C2=A0= You=C2=A0may want to default it to</div><div>program in some longer alarm = value and have a device hint control the initial</div><div>behaviour (kerne= l pat or not pat, watchdog=C2=A0alarm fire time) before userland</div><div>= can come configure it.</div><div><br></div><div>(And then we should=C2=A0do= cument that as a requirement somewhere....)</div></div></div></blockquote><= div><br></div><div>Yes. What does the watchdog cover, and how do you cope w= ith the mildly unexpected?</div><div><br></div><div>Sometimes when the netw= ork is not available, I want it to be patient. Comcast internet can be flak= y, and I don't want to watchdog my machine because of that.=C2=A0</div>= <div>Sometimes I want it to reboot since the driver on a different machine = might not be quite reliable at coming up the first time and the watchdog an= d reboot is the only way to fix it.</div><div><br></div><div>I've often= thought an early start watchdog would be better, and other times like the = later start. On the whole, though I'm inclined to do an earlier start s= ince it gives people a better chance to cope with $WEIRD_STUFF using the wa= tchdog health script.</div><div><br></div><div>Warner</div></div></div> --0000000000006688ad065ec71e99-- -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads