public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nish Aravamudan <nish.aravamudan@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	linuxppc64-dev <linuxppc64-dev@ozlabs.org>
Subject: Re: [PATCH] ppc64: Thermal control for SMU based machines
Date: Tue, 4 Oct 2005 09:44:10 -0700	[thread overview]
Message-ID: <29495f1d0510040944i6d8eb36aud85b63ff12608e8a@mail.gmail.com> (raw)
In-Reply-To: <1128404215.31063.32.camel@gaston>

On 10/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> This is the actual thermal control support for PowerMac8,1, PowerMac8,2
> and PowerMac9,1 machines (SMU based), that is iMac G5 and single CPU desktop.
> It requires CPUFREQ to be enabled to properly deal with overtemp conditions.
> The new thermal control code implements a new framework (nicknamed "windfarm")
> to which I expect to port the old G5 thermal control, and possibly some of the
> powerbook thermal control drivers as well in the future.

<snip>

> --- /dev/null   1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/drivers/macintosh/windfarm_core.c        2005-10-04 15:17:33.000000000 +1000

<snip>

> +static int wf_thread_func(void *data)
> +{
> +       unsigned long next, delay;
> +
> +       next = jiffies;
> +
> +       DBG("wf: thread started\n");
> +
> +       while(!kthread_should_stop()) {
> +               try_to_freeze();
> +
> +               if (time_after_eq(jiffies, next)) {
> +                       wf_notify(WF_EVENT_TICK, NULL);
> +                       if (wf_overtemp) {
> +                               wf_overtemp_counter++;
> +                               /* 10 seconds overtemp, notify userland */
> +                               if (wf_overtemp_counter > 10)
> +                                       wf_critical_overtemp();
> +                               /* 30 seconds, shutdown */
> +                               if (wf_overtemp_counter > 30) {
> +                                       printk(KERN_ERR "windfarm: Overtemp "
> +                                              "for more than 30"
> +                                              " seconds, shutting down\n");
> +                                       machine_power_off();
> +                               }
> +                       }
> +                       next += HZ;
> +               }
> +
> +               set_current_state(TASK_INTERRUPTIBLE);
> +               delay = next - jiffies;
> +               if (delay <= HZ)
> +                       schedule_timeout(delay);
> +               set_current_state(TASK_RUNNING);

This can be schedule_timeout_interruptible(delay); and then you can
get rid of the set_current_state(TASK_RUNNING);

Thanks,
NIsh

  reply	other threads:[~2005-10-04 16:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-04  5:36 [PATCH] ppc64: Thermal control for SMU based machines Benjamin Herrenschmidt
2005-10-04 16:44 ` Nish Aravamudan [this message]
2005-10-04 21:59   ` Benjamin Herrenschmidt
2005-10-12  0:03 ` Andrew Morton
2005-10-12  0:20   ` Benjamin Herrenschmidt
2005-10-12  0:10 ` Andrew Morton
2005-10-12  0:23   ` Benjamin Herrenschmidt
2005-10-12  7:34     ` Eric Piel
2005-10-12  7:40       ` Benjamin Herrenschmidt
2005-10-12  0:13 ` Andrew Morton
2005-10-12  0:23   ` Benjamin Herrenschmidt
2005-10-12  0:24   ` Benjamin Herrenschmidt
2005-10-18 20:57     ` linas
2005-10-18 21:23       ` Andrew Morton
     [not found] <200511080502.jA852dWI011502@hera.kernel.org>
2005-11-13 17:47 ` Geert Uytterhoeven
2005-11-13 21:00   ` Benjamin Herrenschmidt

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=29495f1d0510040944i6d8eb36aud85b63ff12608e8a@mail.gmail.com \
    --to=nish.aravamudan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-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