9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9fans@9fans.net
Subject: Re: [9fans] 9front sleep interrupted in kproc?
Date: Tue, 31 Dec 2013 14:17:52 +0100	[thread overview]
Message-ID: <e0f12013b2f130aa426c990d23a17aeb@felloff.net> (raw)
In-Reply-To: <a904a257f1455cbd4fab9cf6ae3d19e4@brasstown.quanstro.net>

its just a case of defensive programming paranoia. i did the change
after sl reported wifi kproc exiting (went into Broken) state. there
seemed no other explaination other than a note interrupting it
so i made all the kprocs safe to be interrupted by notes. i found this
pattern in many places. most of the kprocs are just loops waiting for
something and in case of error, just restart the loop. even if it is
obvious that nobody is calling error() in there. (see devfloppy
kproc for example). you just setup the error label at before your loop
and it make it automatically restart your loop on errors. this doesnt
cost you any cycles in the loop. when i see this code, i can stop worrying
and assume *less* about of the surroundings.

so simply put, yes, you are right. these kprocs shouldnt get interrupted.
but i made sure to catch the case anyway.

i wouldnt rule out notes out of the blue. the use of postnote() is racy in
many places. a Proc* pointer is not a good identifier for a process
*unless* you can guaratee that the proc will not exit while you call
postnote(). alarms have this race. pexit() just does up->alarm = 0;
to clear alarms. if the alarm kproc was already commited
posting you the note at this point (and before it got hold onto
the p->debug qlock), the new process reusing your Proc*
structure can get the alarm out of the blue.

--
cinap



  reply	other threads:[~2013-12-31 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30 17:43 erik quanstrom
2013-12-31  1:06 ` Anthony Martin
2013-12-31  1:24   ` Anthony Martin
2013-12-31  4:40     ` erik quanstrom
2013-12-31 13:17       ` cinap_lenrek [this message]
2013-12-31 14:38         ` erik quanstrom
2013-12-31 10:55     ` Charles Forsyth

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=e0f12013b2f130aa426c990d23a17aeb@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9fans@9fans.net \
    /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).