On 2015-06-27 13:00, Borislav Petkov wrote: > On Sat, Jun 27, 2015 at 11:55:49AM +0200, Jan Kiszka wrote: >> From: Jan Kiszka >> >> migrate_timers is invoked with preemption enabled. Therefore we have to >> get/put the cpu-local variable tvec_bases like before commit 0eeda71bc3. >> >> This fixes >> >> BUG: using smp_processor_id() in preemptible [00000000] code: bash/4917 >> caller is debug_smp_processor_id+0x17/0x19 >> CPU: 0 PID: 4917 Comm: bash Not tainted 4.1.0-dbg+ #97 >> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014 >> ffff880038674040 ffff880002e6fb98 ffffffff815356a0 0000000000000002 >> 0000000000000000 ffff880002e6fbc8 ffffffff8130c16f ffff88003fd8d500 >> 000000000000d500 0000000000000000 0000000000000003 ffff880002e6fbd8 >> Call Trace: >> [] dump_stack+0x4f/0x7b >> [] check_preemption_disabled+0xdd/0xef >> [] debug_smp_processor_id+0x17/0x19 >> [] timer_cpu_notify+0x4f/0x112 >> [] notifier_call_chain+0x4c/0x71 >> [] __raw_notifier_call_chain+0xe/0x10 >> [] __cpu_notify+0x20/0x37 >> [] cpu_notify+0x13/0x15 >> [] cpu_notify_nofail+0xe/0x16 >> [] _cpu_down+0x178/0x268 >> [] ? trace_hardirqs_on+0xd/0xf >> [] cpu_down+0x28/0x3c >> [] cpu_subsys_offline+0x14/0x16 >> [] device_offline+0x7d/0xb1 >> [] online_store+0x48/0x68 >> [] dev_attr_store+0x18/0x22 >> [] sysfs_kf_write+0x49/0x51 >> [] kernfs_fop_write+0x105/0x158 >> [] __vfs_write+0x28/0xbd >> [] ? security_file_permission+0x23/0x90 >> [] vfs_write+0xb2/0x169 >> [] SyS_write+0x4a/0x91 >> [] entry_SYSCALL_64_fastpath+0x12/0x76 >> >> triggered when offlining a CPU, e.g. via sysfs. >> >> Signed-off-by: Jan Kiszka >> --- >> kernel/time/timer.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/kernel/time/timer.c b/kernel/time/timer.c >> index 520499d..c826178 100644 >> --- a/kernel/time/timer.c >> +++ b/kernel/time/timer.c >> @@ -1566,7 +1566,7 @@ static void migrate_timers(int cpu) >> >> BUG_ON(cpu_online(cpu)); >> old_base = per_cpu_ptr(&tvec_bases, cpu); >> - new_base = this_cpu_ptr(&tvec_bases); >> + new_base = &get_cpu_var(tvec_bases); > > Hmm, tglx's version doesn't disable preemtion around it: > > http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=timers/urgent&id=24bfcb100959c8641a627b5604d967243f8f240c > Oh, there is a fix already. It's just the same: both implicitly disable preemption via get_cpu_ptr/var, look at the macros. Jan