Re: 2.6.35-rc2-git2: Reported regressions from 2.6.34

From: Sedat Dilek
Date: Wed Jun 16 2010 - 17:00:50 EST


How do cpu-freq related stuff find its way into mainline?
Is there a GIT repository/branch on <git.kernel.org> where you can pull from?

- Sedat -

On Wed, Jun 16, 2010 at 10:42 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 9 Jun 2010 11:22:35 +0200
> "Rafael J. Wysocki" <rjw@xxxxxxx> wrote:
>
>> On Wednesday 09 June 2010, Sedat Dilek wrote:
>> > The patch from [1] is still missing.
>> >
>> > Â Â"cpufreq-call-nr_iowait_cpu-with-disabled-preemption.patch" from
>> > Dmitry Monakhoc
>> >
>> > Tested-by: Sedat Dilek <sedat.dilek@xxxxxxxxx>
>> > Tested-by Maciej Rutecki <maciej.rutecki@xxxxxxxxx>
>> >
>> > I have already reported this issue on LKML [2] and cpufreq ML [3].
>> >
>> > - Sedat -
>> >
>> > [1] http://www.spinics.net/lists/cpufreq/msg01631.html
>> > [2] http://lkml.org/lkml/2010/5/31/77
>> > [3] http://www.spinics.net/lists/cpufreq/msg01637.html
>>
>> Thanks, added.
>
> I just merged a different patch whcih should address this:
>
>
> From: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
>
> Fix
>
> ÂBUG: using smp_processor_id() in preemptible [00000000] code: s2disk/3392
> Âcaller is nr_iowait_cpu+0xe/0x1e
> ÂPid: 3392, comm: s2disk Not tainted 2.6.35-rc3-dbg-00106-ga75e02b #2
> ÂCall Trace:
> Â[<c1184c55>] debug_smp_processor_id+0xa5/0xbc
> Â[<c10282a5>] nr_iowait_cpu+0xe/0x1e
> Â[<c104ab7c>] update_ts_time_stats+0x32/0x6c
> Â[<c104ac73>] get_cpu_idle_time_us+0x36/0x58
> Â[<c124229b>] get_cpu_idle_time+0x12/0x74
> Â[<c1242963>] cpufreq_governor_dbs+0xc3/0x2dc
> Â[<c1240437>] __cpufreq_governor+0x51/0x85
> Â[<c1241190>] __cpufreq_set_policy+0x10c/0x13d
> Â[<c12413d3>] cpufreq_add_dev_interface+0x212/0x233
> Â[<c1241b1e>] ? handle_update+0x0/0xd
> Â[<c1241a18>] cpufreq_add_dev+0x34b/0x35a
> Â[<c103c973>] ? schedule_delayed_work_on+0x11/0x13
> Â[<c12c14db>] cpufreq_cpu_callback+0x59/0x63
> Â[<c1042f39>] notifier_call_chain+0x26/0x48
> Â[<c1042f7d>] __raw_notifier_call_chain+0xe/0x10
> Â[<c102efb9>] __cpu_notify+0x15/0x29
> Â[<c102efda>] cpu_notify+0xd/0xf
> Â[<c12bfb30>] _cpu_up+0xaf/0xd2
> Â[<c12b3ad4>] enable_nonboot_cpus+0x3d/0x94
> Â[<c1055eef>] hibernation_snapshot+0x104/0x1a2
> Â[<c1058b49>] snapshot_ioctl+0x24b/0x53e
> Â[<c1028ad1>] ? sub_preempt_count+0x7c/0x89
> Â[<c10ab91d>] vfs_ioctl+0x2e/0x8c
> Â[<c10588fe>] ? snapshot_ioctl+0x0/0x53e
> Â[<c10ac2c7>] do_vfs_ioctl+0x42f/0x45a
> Â[<c10a0ba5>] ? fsnotify_modify+0x4f/0x5a
> Â[<c11e9dc3>] ? tty_write+0x0/0x1d0
> Â[<c10a12d6>] ? vfs_write+0xa2/0xda
> Â[<c10ac333>] sys_ioctl+0x41/0x62
> Â[<c10027d3>] sysenter_do_call+0x12/0x2d
>
> The initial fix was to use get_cpu/put_cpu in nr_iowait_cpu. ÂHowever,
> Arjan stated that "the bug is that it needs to be nr_iowait_cpu(int cpu)".
>
> This patch introduces nr_iowait_cpu(int cpu) and changes to it callers.
>
> akpm: addresses about 30,000,000 different bug reports.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rjw@xxxxxxx>
> Cc: Maxim Levitsky <maximlevitsky@xxxxxxxxx>
> Cc: Len Brown <len.brown@xxxxxxxxx>
> Cc: Pavel Machek <pavel@xxxxxx>
> Cc: Jiri Slaby <jslaby@xxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> Âdrivers/cpuidle/governors/menu.c | Â 10 ++++++++--
> Âinclude/linux/sched.h      Â|  Â2 +-
> Âkernel/sched.c          |  Â4 ++--
> Âkernel/time/tick-sched.c     |  Â4 +++-
> Â4 files changed, 14 insertions(+), 6 deletions(-)
>
> diff -puN drivers/cpuidle/governors/menu.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu drivers/cpuidle/governors/menu.c
> --- a/drivers/cpuidle/governors/menu.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu
> +++ a/drivers/cpuidle/governors/menu.c
> @@ -137,15 +137,18 @@ static inline int which_bucket(unsigned
> Â{
> Â Â Â Âint bucket = 0;
>
> + Â Â Â int cpu = get_cpu();
> Â Â Â Â/*
> Â Â Â Â * We keep two groups of stats; one with no
> Â Â Â Â * IO pending, one without.
> Â Â Â Â * This allows us to calculate
> Â Â Â Â * E(duration)|iowait
> Â Â Â Â */
> - Â Â Â if (nr_iowait_cpu())
> + Â Â Â if (nr_iowait_cpu(cpu))
> Â Â Â Â Â Â Â Âbucket = BUCKETS/2;
>
> + Â Â Â put_cpu();
> +
> Â Â Â Âif (duration < 10)
> Â Â Â Â Â Â Â Âreturn bucket;
> Â Â Â Âif (duration < 100)
> @@ -169,13 +172,16 @@ static inline int which_bucket(unsigned
> Âstatic inline int performance_multiplier(void)
> Â{
> Â Â Â Âint mult = 1;
> + Â Â Â int cpu = get_cpu();
>
> Â Â Â Â/* for higher loadavg, we are more reluctant */
>
> Â Â Â Âmult += 2 * get_loadavg();
>
> Â Â Â Â/* for IO wait tasks (per cpu!) we add 5x each */
> - Â Â Â mult += 10 * nr_iowait_cpu();
> + Â Â Â mult += 10 * nr_iowait_cpu(cpu);
> +
> + Â Â Â put_cpu();
>
> Â Â Â Âreturn mult;
> Â}
> diff -puN include/linux/sched.h~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu include/linux/sched.h
> --- a/include/linux/sched.h~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu
> +++ a/include/linux/sched.h
> @@ -139,7 +139,7 @@ extern int nr_processes(void);
> Âextern unsigned long nr_running(void);
> Âextern unsigned long nr_uninterruptible(void);
> Âextern unsigned long nr_iowait(void);
> -extern unsigned long nr_iowait_cpu(void);
> +extern unsigned long nr_iowait_cpu(int cpu);
> Âextern unsigned long this_cpu_load(void);
>
>
> diff -puN kernel/sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu kernel/sched.c
> --- a/kernel/sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu
> +++ a/kernel/sched.c
> @@ -2864,9 +2864,9 @@ unsigned long nr_iowait(void)
> Â Â Â Âreturn sum;
> Â}
>
> -unsigned long nr_iowait_cpu(void)
> +unsigned long nr_iowait_cpu(int cpu)
> Â{
> - Â Â Â struct rq *this = this_rq();
> + Â Â Â struct rq *this = cpu_rq(cpu);
> Â Â Â Âreturn atomic_read(&this->nr_iowait);
> Â}
>
> diff -puN kernel/time/tick-sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu kernel/time/tick-sched.c
> --- a/kernel/time/tick-sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu
> +++ a/kernel/time/tick-sched.c
> @@ -159,10 +159,12 @@ update_ts_time_stats(struct tick_sched *
> Â Â Â Âktime_t delta;
>
> Â Â Â Âif (ts->idle_active) {
> + Â Â Â Â Â Â Â int cpu = get_cpu();
> Â Â Â Â Â Â Â Âdelta = ktime_sub(now, ts->idle_entrytime);
> Â Â Â Â Â Â Â Âts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
> - Â Â Â Â Â Â Â if (nr_iowait_cpu() > 0)
> + Â Â Â Â Â Â Â if (nr_iowait_cpu(cpu) > 0)
> Â Â Â Â Â Â Â Â Â Â Â Âts->iowait_sleeptime = ktime_add(ts->iowait_sleeptime, delta);
> + Â Â Â Â Â Â Â put_cpu();
> Â Â Â Â Â Â Â Âts->idle_entrytime = now;
> Â Â Â Â}
>
> _
>
>
--
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/