9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Devon H. O'Dell " <dodell@offmyserver.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: [9fans] tsleep / timer questions
Date: Fri, 25 Mar 2005 19:36:06 +0100	[thread overview]
Message-ID: <20050325183606.GA93332@smp500.sitetronics.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0503241539520.12105@athena>

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

Related to my work writing a driver for the Ziatech ZT5503 SBC
watchdogs, I've come up with a question.

Obviously the watchdog needs to be `strobed' at some interval to
keep it from resetting the machine (after it has been enabled).
I'm having troubles figuring out how to do this.

Taking a look at the driver for the Ziatech 5512 watchdog that
Eric Van Hensbergen write for Inferno, I see that he's making
use of addclock0link(), which makes sense. This seems to be
overkill for my needs though. I'm not sure the resolution of the
timer on the ZT5512 blades, but mine have a minimum resolution
of 250ms, which means that they'd be strobed twice in their
timeout period.

That's not so bad, but some of the other resolutions (the timer
supports 250ms, 500ms, 1s, 8s, 32s, 64s, 128s and 256s
intervals), this can get to be an issue. I personally have no
use for the 256s resolution, and I'm sure I'm the only person on
the planet running Plan 9 on these blades, but I'd really like
to have a driver that's not overkill.

So, I thought a nifty solution would be to make use of the
rendezvous stuff and call tsleep. But I don't understand how
this should work. When the watchdog is enabled, I need to start
some procedure that never returns. This would be easy in
userland, where I could simply start another thread, but how do
I do this in-kernel. If I've read in /dev/watchdog

enable resolution 500ms

and I've parsed that, how do I then call the procedure to do the
timer? My procedure looked like (until I realized that it'd
never work if I understand the behavior correctly, which I'm
fairly certain I do):

void
watchdog_strobe(void)
{
	for(;;) {
		if (!enabled)
			break;

		tsleep(wd_timer, return0, nil, wd_resolution);
		inb(IOP_Watchdog); /* Reading the IO port strobes the WD */
	}
}

So I'm stuck with the problem: how do I enable a separate timer?

Hope the question is clear.

Thanks,

Devon

[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]

  parent reply	other threads:[~2005-03-25 18:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-24 15:08 Fwd: [9fans] Ad link Brantley Coile
2005-03-24 15:54 ` Ronald G. Minnich
2005-03-24 21:15   ` Sam
2005-03-24 22:31     ` Ronald G. Minnich
2005-03-24 22:47       ` Russ Cox
2005-03-25 15:34         ` Brantley Coile
2005-03-26  0:00           ` geoff
2005-03-26  0:19             ` Russ Cox
2005-03-27 19:03         ` Fwd: " McLone
2005-03-25  4:39       ` geoff
2005-03-25  9:02     ` vdharani
2005-03-25 18:36     ` Devon H. O'Dell  [this message]
2005-03-25 18:55       ` [9fans] tsleep / timer questions jmk
2005-03-25 20:19         ` Devon H. O'Dell 
2005-03-25 18:57       ` Russ Cox
2005-03-25 20:04         ` Devon H. O'Dell 
2005-03-25 20:12           ` Russ Cox
2005-03-25 20:23             ` Devon H. O'Dell 
2005-03-25 21:36               ` Russ Cox
2005-03-26  8:30                 ` Devon H. O'Dell 
2005-03-26  8:36                   ` [9fans] Kernel interface manpages Devon H. O'Dell 
2005-03-26 17:45                     ` Russ Cox
2005-03-26 19:56                       ` Devon H. O'Dell 
2005-03-26 23:03                     ` vdharani
2005-03-26  0:22       ` [9fans] tsleep / timer questions vdharani
2005-03-25  8:51 ` Fwd: [9fans] Ad link vdharani
2005-03-25 15:27   ` Brantley Coile
2005-03-28  1:28 [9fans] tsleep / timer questions YAMANASHI Takeshi
2005-03-28  3:38 ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050325183606.GA93332@smp500.sitetronics.com \
    --to=dodell@offmyserver.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).