Re: restart_syscall: use freezable blocking call

From: Sasha Levin
Date: Thu Apr 02 2015 - 12:04:07 EST


On 03/31/2015 11:07 AM, Peter Zijlstra wrote:
>>> @@ -1781,7 +1781,7 @@ schedule_hrtimeout_range_clock(ktime_t *
>>> > > t.task = NULL;
>>> > >
>>> > > if (likely(t.task))
>>> > > - schedule();
>>> > > + freezable_schedule();
>>> > >
>>> > > hrtimer_cancel(&t.timer);
>>> > > destroy_hrtimer_on_stack(&t.timer);
> Not a single word on why this would be correct. At the very least show
> us you've thought about it.

It's not correct.

[ 0.634248] =====================================
[ 0.635011] [ BUG: swapper/0/1 still has locks held! ]
[ 0.635566] 4.0.0-rc6-next-20150402-sasha-00038-g3637da5 #2121 Not tainted
[ 0.636009] -------------------------------------
[ 0.636508] 2 locks held by swapper/0/1:
[ 0.637008] #0: (cpu_hotplug.lock){.+.+.+}, at: get_online_cpus (kernel/cpu.c:96)
[ 0.638009] #1: (smpboot_threads_lock){+.+.+.}, at: smpboot_register_percpu_thread (kernel/smpboot.c:286)
[ 0.639013] Mutex: counter: 0 owner: swapper/0
[ 0.640010]
[ 0.640010] stack backtrace:
[ 0.640543] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc6-next-20150402-sasha-00038-g3637da5 #2121
[ 0.641012] ffff8809e2748000 00000000d284eea5 ffff88004e8df948 ffffffff9dabb4a2
[ 0.642622] 0000000000000000 ffff8809e2748000 ffff88004e8df968 ffffffff932e848d
[ 0.643627] ffff88004e8df9a8 ffff88004e8dfa48 ffff88004e8dfa78 ffffffff9db2e57c
[ 0.644624] Call Trace:
[ 0.645021] dump_stack (lib/dump_stack.c:52)
[ 0.645644] debug_check_no_locks_held (kernel/locking/lockdep.c:4178)
[ 0.646019] schedule_hrtimeout_range_clock (include/linux/freezer.h:56 include/linux/freezer.h:66 include/linux/freezer.h:127 include/linux/freezer.h:172 kernel/time/hrtimer.c:1784)
[ 0.647017] ? hrtimer_nanosleep_restart (kernel/time/hrtimer.c:1754)
[ 0.648015] ? get_lock_stats (kernel/locking/lockdep.c:249)
[ 0.648702] ? hrtimer_get_res (kernel/time/hrtimer.c:1472)
[ 0.649016] ? schedule_hrtimeout_range_clock (kernel/time/hrtimer.c:1780)
[ 0.650020] ? __this_cpu_preempt_check (lib/smp_processor_id.c:63)
[ 0.651016] schedule_hrtimeout (kernel/time/hrtimer.c:1856)
[ 0.652015] wait_task_inactive (kernel/sched/core.c:1260 (discriminator 1))
[ 0.652656] ? migrate_swap (kernel/sched/core.c:1184)
[ 0.653015] ? out_of_line_wait_on_atomic_t (kernel/sched/completion.c:121)
[ 0.654016] ? wake_up_state (kernel/sched/core.c:2973)
[ 0.654614] __kthread_bind (kernel/kthread.c:331)
[ 0.655015] __kthread_unpark (kernel/kthread.c:394)
[ 0.655622] kthread_unpark (kernel/kthread.c:413)
[ 0.656014] ? ftrace_define_fields_softirq (kernel/softirq.c:755)
[ 0.657014] smpboot_unpark_thread.isra.0 (kernel/smpboot.c:227)
[ 0.657725] smpboot_register_percpu_thread (kernel/smpboot.c:286)
[ 0.658013] ? ftrace_define_fields_softirq (kernel/softirq.c:755)
[ 0.659015] ? ftrace_define_fields_softirq (kernel/softirq.c:755)
[ 0.660013] spawn_ksoftirqd (kernel/softirq.c:758)
[ 0.660609] do_one_initcall (init/main.c:787)
[ 0.661014] ? try_to_run_init_process (init/main.c:776)
[ 0.662017] ? print_cpu_info (arch/x86/kernel/cpu/common.c:1140 arch/x86/kernel/cpu/common.c:1135)
[ 0.662638] ? native_smp_prepare_cpus (arch/x86/kernel/smpboot.c:1167)
[ 0.663016] kernel_init_freeable (init/main.c:888 init/main.c:994)
[ 0.664014] ? start_kernel (init/main.c:972)
[ 0.664619] ? finish_task_switch (include/linux/tick.h:125 kernel/sched/core.c:2248)
[ 0.665013] ? finish_task_switch (kernel/sched/sched.h:1077 kernel/sched/core.c:2230)
[ 0.666019] ? rest_init (init/main.c:927)
[ 0.666597] kernel_init (init/main.c:932)
[ 0.667015] ? rest_init (init/main.c:927)
[ 0.667593] ret_from_fork (arch/x86/kernel/entry_64.S:535)
[ 0.668014] ? rest_init (init/main.c:927)


Thanks,
Sasha
--
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/