mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>, Mike Galbraith <efault@gmx.de>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 1/3] sched: Introduce sched_time_avg_ns minimal value
Date: Tue, 14 Jun 2016 17:28:00 +0200	[thread overview]
Message-ID: <1465918082-27005-2-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1465918082-27005-1-git-send-email-fweisbec@gmail.com>

Writing 0 to sysctl value "kernel.sched_time_avg_ms" triggers a lockup:

	NMI watchdog: Watchdog detected hard LOCKUP on cpu 4
	Modules linked in:
	irq event stamp: 81894
	hardirqs last  enabled at (81893): [<ffffffff8111af88>] rcu_idle_exit+0x68/0xa0
	hardirqs last disabled at (81894): [<ffffffff8113536e>] tick_nohz_idle_exit+0x2e/0x110
	softirqs last  enabled at (81870): [<ffffffff810ab8a1>] _local_bh_enable+0x21/0x50
	softirqs last disabled at (81869): [<ffffffff810ace2b>] irq_enter+0x4b/0x70
	CPU: 4 PID: 0 Comm: swapper/4 Not tainted 4.6.0-rc4+ #269
	Hardware name: MSI MS-7850/Z87-G41 PC Mate(MS-7850), BIOS V1.3 08/18/2013
	0000000000000000 ffff88021fb05b80 ffffffff8141b023 0000000000000000
	0000000000000004 ffff88021fb05ba0 ffffffff81163fcf 0000000000000000
	ffff88021fb05c40 ffff88021fb05be0 ffffffff8119ae7c 00000001810077ce
	Call Trace:
	<NMI>  [<ffffffff8141b023>] dump_stack+0x85/0xc2
	[<ffffffff81163fcf>] watchdog_overflow_callback+0x13f/0x160
	[<ffffffff8119ae7c>] __perf_event_overflow+0x9c/0x1f0
	[<ffffffff8119baa4>] perf_event_overflow+0x14/0x20
	[<ffffffff8100d235>] intel_pmu_handle_irq+0x1d5/0x4a0
	[<ffffffff810062ad>] perf_event_nmi_handler+0x2d/0x50
	[<ffffffff81174397>] ? tracing_generic_entry_update+0x97/0xb0
	[<ffffffff81039cef>] nmi_handle+0xbf/0x2f0
	[<ffffffff81039c35>] ? nmi_handle+0x5/0x2f0
	[<ffffffff81174397>] ? tracing_generic_entry_update+0x97/0xb0
	[<ffffffff8103a171>] default_do_nmi+0x71/0x1b0
	[<ffffffff8103a3c5>] do_nmi+0x115/0x170
	[<ffffffff8194b511>] end_repeat_nmi+0x1a/0x1e
	[<ffffffff81174397>] ? tracing_generic_entry_update+0x97/0xb0
	[<ffffffff81174397>] ? tracing_generic_entry_update+0x97/0xb0
	[<ffffffff81174397>] ? tracing_generic_entry_update+0x97/0xb0
	<<EOE>>  [<ffffffff81177d3f>] ? trace_buffer_lock_reserve+0x3f/0x60
	[<ffffffff810d3d51>] ? sched_avg_update+0x51/0xc0
	[<ffffffff811781e5>] __trace_bputs+0x75/0x100
	[<ffffffff810d3d79>] sched_avg_update+0x79/0xc0
	[<ffffffff810dedc3>] cpu_load_update+0xa3/0xd0
	[<ffffffff810e694a>] cpu_load_update_nohz_stop+0x7a/0x80
	[<ffffffff811353b7>] tick_nohz_idle_exit+0x77/0x110
	[<ffffffff810f0866>] cpu_startup_entry+0x176/0x420
	[<ffffffff810589f4>] start_secondary+0x104/0x110

This is due to the loop in sched_avg_update() that fails to make any
progress when the update delay is 0.

Since this is non-sense to set that value to 0 anyway, force a minimum
of at least 1 millisecond.

Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/sysctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 87b2fc3..b730dd6 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -345,7 +345,8 @@ static struct ctl_table kern_table[] = {
 		.data		= &sysctl_sched_time_avg,
 		.maxlen		= sizeof(unsigned int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &one,
 	},
 	{
 		.procname	= "sched_shares_window_ns",
-- 
2.7.0

  reply	other threads:[~2016-06-14 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 15:27 [PATCH 0/3] sched: Enhance/fix sched_avg_update() Frederic Weisbecker
2016-06-14 15:28 ` Frederic Weisbecker [this message]
2016-06-14 15:28 ` [PATCH 2/3] sched: Unloop sched avg decaying Frederic Weisbecker
2016-06-14 15:58   ` Peter Zijlstra
2016-06-30 12:52     ` Frederic Weisbecker
2016-06-30 13:20       ` Peter Zijlstra
2016-07-06 11:53         ` Frederic Weisbecker
2016-06-14 15:28 ` [NOT-FOR-MERGE-PATCH 3/3] Debug: Alternate old/new version of sched_avg_update calls for profiling Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465918082-27005-2-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®