linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: Kevin Diggs <kevdig@hypersurf.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: to schedule() or not to schedule() ?
Date: Tue, 05 Aug 2008 12:37:50 -0600	[thread overview]
Message-ID: <48989DFE.7080506@nortel.com> (raw)
In-Reply-To: <4895F9EB.8050508@hypersurf.com>

Kevin Diggs wrote:
> Hi,
> 
> 
>     I have the following near the top of my cpufreq driver target routine:
> 
> while(test_and_set_bit(cf750gxmCfgChangeBit,&cf750gxvStateBits)) {
>         /*
>          * Someone mucking with our cfg? (I hope it is ok to call
>          * schedule() here! - truth is I have no idea what I am doing
>          * ... my reasoning is I want to yeild the cpu so whoever is
>          * mucking around can finish)
>          */
>         schedule();
> }
> 
> This is to prevent bad things from happening if someone is trying to 
> change a parameter for the driver via sysfs while the target routine is 
> running. Fortunately, because I had a bug where this bit was not getting 
> cleared on one of the paths through the target routine ... I now know it 
> is not safe to call schedule (it got stuck in there - knocked out my adb 
> keyboard! - (I think target is called from a timer that the governor 
> sets up ... interrupt context?)).

Is the issue that someone may be in the middle of a multi-stage 
procedure, and you've woken up partway through?

If so, what about simply rescheduling the timer for some short time in 
the future and aborting the current call?

Chris

  reply	other threads:[~2008-08-05 18:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 18:33 to schedule() or not to schedule() ? Kevin Diggs
2008-08-05 18:37 ` Chris Friesen [this message]
2008-08-05 19:26   ` Kevin Diggs
2008-08-05 23:00     ` Michael Ellerman
2008-08-06  1:59       ` Kevin Diggs
2008-08-06 21:12         ` Arnd Bergmann

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=48989DFE.7080506@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=kevdig@hypersurf.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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).