From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756162AbcFHIGZ (ORCPT ); Wed, 8 Jun 2016 04:06:25 -0400 Received: from outbound-smtp11.blacknight.com ([46.22.139.16]:47513 "EHLO outbound-smtp11.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbcFHIGS (ORCPT ); Wed, 8 Jun 2016 04:06:18 -0400 Date: Wed, 8 Jun 2016 09:06:14 +0100 From: Mel Gorman To: Josh Poimboeuf Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Matt Fleming , Srikar Dronamraju Subject: Re: [PATCH 1/2] sched/debug: fix 'schedstats=enable' cmdline option Message-ID: <20160608080614.GE2527@techsingularity.net> References: <453775fe3433bed65731a583e228ccea806d18cd.1465322027.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <453775fe3433bed65731a583e228ccea806d18cd.1465322027.git.jpoimboe@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 07, 2016 at 02:43:16PM -0500, Josh Poimboeuf wrote: > The 'schedstats=enable' option doesn't work, and also produces the > following warning during boot: > > WARNING: CPU: 0 PID: 0 at /home/jpoimboe/git/linux/kernel/jump_label.c:61 static_key_slow_inc+0x8c/0xa0 > static_key_slow_inc used before call to jump_label_init > Modules linked in: > CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0-rc1+ #25 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014 > 0000000000000086 3ae3475a4bea95d4 ffffffff81e03da8 ffffffff8143fc83 > ffffffff81e03df8 0000000000000000 ffffffff81e03de8 ffffffff810b1ffb > 0000003d00000096 ffffffff823514d0 ffff88007ff197c8 0000000000000000 > Call Trace: > [] dump_stack+0x85/0xc2 > [] __warn+0xcb/0xf0 > [] warn_slowpath_fmt+0x5f/0x80 > [] static_key_slow_inc+0x8c/0xa0 > [] static_key_enable+0x16/0x40 > [] setup_schedstats+0x29/0x94 > [] unknown_bootoption+0x89/0x191 > [] parse_args+0x297/0x4b0 > [] start_kernel+0x1d8/0x4a9 > [] ? set_init_arg+0x55/0x55 > [] ? early_idt_handler_array+0x120/0x120 > [] x86_64_start_reservations+0x2f/0x31 > [] x86_64_start_kernel+0x14a/0x16d > > The problem is that it tries to update the 'sched_schedstats' static key > before jump labels have been initialized. > Odd, I thought that particular one had been addressed. At least I saw errors like that in other areas before and they got fixed later by ftrace. > Changing jump_label_init() to be called earlier before > parse_early_param() wouldn't fix it: it would still fail trying to > poke_text() because mm isn't yet initialized. > > Instead, just create a temporary '__sched_schedstats' variable which can > be copied to the static key later during sched_init() after jump labels > have been initialized. > > Fixes: cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default") > Cc: stable@vger.kernel.org > Signed-off-by: Josh Poimboeuf > --- > kernel/sched/core.c | 26 +++++++++++++++++++++----- > 1 file changed, 21 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 7f2cae4..385c947 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -2253,9 +2253,11 @@ int sysctl_numa_balancing(struct ctl_table *table, int write, > #endif > #endif > > +#ifdef CONFIG_SCHEDSTATS > + > DEFINE_STATIC_KEY_FALSE(sched_schedstats); > +static bool __initdata __sched_schedstats = false; > Initialisation is unnecessary. Otherwise; Acked-by: Mel Gorman -- Mel Gorman SUSE Labs