[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080612175533.5b6c1736.akpm@linux-foundation.org>
Date: Thu, 12 Jun 2008 17:55:33 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, arjan@...radead.org,
andreas.herrmann3@....com
Subject: Re: [patch 6/6] x86: add c1e aware idle function
On Thu, 12 Jun 2008 10:29:00 -0000
Thomas Gleixner <tglx@...utronix.de> wrote:
> +static void c1e_idle(void)
> +{
> + static cpumask_t c1e_mask = CPU_MASK_NONE;
> + static int c1e_detected;
> +
> + if (need_resched())
> + return;
> +
> + if (!c1e_detected) {
> + u32 lo, hi;
> +
> + rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
> + if (lo & K8_INTP_C1E_ACTIVE_MASK) {
> + c1e_detected = 1;
> + mark_tsc_unstable("TSC halt in C1E");
> + printk(KERN_INFO "System has C1E enabled\n");
> + }
> + }
> +
> + if (c1e_detected) {
> + int cpu = smp_processor_id();
> +
> + if (!cpu_isset(cpu, c1e_mask)) {
> + cpu_set(cpu, c1e_mask);
> + /* Force broadcast so ACPI can not interfere */
> + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
> + &cpu);
> + printk(KERN_INFO "Switch to broadcast mode on CPU%d\n",
> + cpu);
> + }
> + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
> + default_idle();
> + local_irq_disable();
> + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
> + local_irq_enable();
I worked it out! It took me a while.
This function is called with local irqs disabled.
default_idle() is entered with local irqs disabled but returns with them
enabled.
clockevents_notify() is supposed to be called with local irqs disabled.
This functions returns with local irqs enabled.
Was I right? None of any of that is documented anywhere. But it should
be.
> + } else
> + default_idle();
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists