bq2415x_charger.patch: Make sure that hook function can be called for init reported...
[kernel-power] / kernel-power-2.6.28 / debian / patches / ARM_6066_1_Fix_BUG_scheduling_while_atomic_swapper_0_0x00000002.diff
1 commit 13ea9cc82138691856d7cd855dff9aef1479adb9
2 Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
3 Date:   Fri Apr 30 06:51:20 2010 +0100
4
5     ARM: 6066/1: Fix "BUG: scheduling while atomic: swapper/0/0x00000002
6     
7     This patch fixes the preempt leak in the cpuidle path invoked from
8     cpu-hotplug. The fix is suggested by Russell King and is based
9     on x86 idea of calling init_idle() on the idle task when it's
10     re-used which also resets the preempt count amongst other things
11     
12     dump:
13     BUG: scheduling while atomic: swapper/0/0x00000002
14     Modules linked in:
15     Backtrace:
16     [<c0024f90>] (dump_backtrace+0x0/0x110) from [<c0173bc4>] (dump_stack+0x18/0x1c)
17      r7:c02149e4 r6:c033df00 r5:c7836000 r4:00000000
18     [<c0173bac>] (dump_stack+0x0/0x1c) from [<c003b4f0>] (__schedule_bug+0x60/0x70)
19     [<c003b490>] (__schedule_bug+0x0/0x70) from [<c0174214>] (schedule+0x98/0x7b8)
20      r5:c7836000 r4:c7836000
21     [<c017417c>] (schedule+0x0/0x7b8) from [<c00228c4>] (cpu_idle+0xb4/0xd4)
22     # [<c0022810>] (cpu_idle+0x0/0xd4) from [<c0171dd8>] (secondary_start_kernel+0xe0/0xf0)
23      r5:c7836000 r4:c0205f40
24     [<c0171cf8>] (secondary_start_kernel+0x0/0xf0) from [<c002d57c>] (prm_rmw_mod_reg_bits+0x88/0xa4)
25      r7:c02149e4 r6:00000001 r5:00000001 r4:c7836000
26     Backtrace aborted due to bad frame pointer <c7837fbc>
27     
28     Cc: Catalin Marinas <catalin.marinas@arm.com>
29     Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
30     Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
31
32 diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
33 index 577543f..a01194e 100644
34 --- a/arch/arm/kernel/smp.c
35 +++ b/arch/arm/kernel/smp.c
36 @@ -86,6 +86,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
37                         return PTR_ERR(idle);
38                 }
39                 ci->idle = idle;
40 +       } else {
41 +               /*
42 +                * Since this idle thread is being re-used, call
43 +                * init_idle() to reinitialize the thread structure.
44 +                */
45 +               init_idle(idle, cpu);
46         }
47  
48         /*