[patch] sched_clock: fix preempt count imbalance

From: Ingo Molnar
Date: Fri May 25 2007 - 07:46:26 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> > > please send me your current sched-clock.c, i'll redo any remaining
> > > cleanups.
> >
> > It needs at least one new preliminary patch (to add on_cpu_single);
> > please get the series from
> > ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt/patches-2.6.22-rc2-git7-070525-1.tar.gz
> > You need at least tsc-unstable upto paravirt-add-a-sched_clock-paravirt
> > for everything
>
> thanks.
>
> you missed one patch: please pick up the NUMAQ change i did too. (i
> kept the printk to make sure someone notices that and actually tests
> thing - i dont have a NUMAQ machine to try this on.)
>
> i'm looking at the other things now.

you introduced a crash-bug via your cleanups - the patch below fixes it.

Ingo

----------------------------->
Subject: [patch] sched_clock: fix preempt count imbalance
From: Ingo Molnar <mingo@xxxxxxx>

fix preempt count imbalance.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
arch/i386/kernel/sched-clock.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Index: linux-cfs-2.6.22-rc2-mm1.q/arch/i386/kernel/sched-clock.c
===================================================================
--- linux-cfs-2.6.22-rc2-mm1.q.orig/arch/i386/kernel/sched-clock.c
+++ linux-cfs-2.6.22-rc2-mm1.q/arch/i386/kernel/sched-clock.c
@@ -164,7 +164,10 @@ static int sc_freq_event(struct notifier
void *data)
{
struct cpufreq_freqs *freq = data;
- struct sc_data *sc = &per_cpu(sc_data, freq->cpu);
+ struct sc_data *sc;
+
+ preempt_disable();
+ sc = &per_cpu(sc_data, freq->cpu);

if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC))
goto out;
@@ -194,7 +197,8 @@ static int sc_freq_event(struct notifier
break;
}
out:
- put_cpu();
+ preempt_enable();
+
return NOTIFY_DONE;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/