All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: Lin Ming <ming.m.lin@intel.com>,
	Stephane Eranian <eranian@google.com>,
	"robert.richter" <robert.richter@amd.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	fweisbec <fweisbec@gmail.com>, paulus <paulus@samba.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Kyle Moffett <kyle@moffetthome.net>,
	linux-kernel@vger.kernel.org, davem <davem@davemloft.net>,
	Michael Cree <mcree@orcon.net.nz>,
	Deng-Cheng Zhu <dengcheng.zhu@gmail.com>,
	paulus <paulus@samba.org>, Will Deacon <will.deacon@arm.com>,
	Paul Mundt <lethal@linux-sh.org>, Don Zickus <dzickus@redhat.com>
Subject: Re: [RFC][PATCH 2/8] perf, arch: Use early_initcall() for all arch pmu implementations
Date: Thu, 25 Nov 2010 11:25:13 +0100	[thread overview]
Message-ID: <1290680713.2145.18.camel@laptop> (raw)
In-Reply-To: <20101117222056.040309789@chello.nl>

On Wed, 2010-11-17 at 23:17 +0100, Peter Zijlstra wrote:
> plain text document attachment (perf-fix-hw-init.patch)
> Currently architectures use various random locations to init the PMU
> driver, for some this happens before the perf core code is
> initialized.
> 
> In order to avoid calling perf_pmu_register() before the core code is
> up and running and able to deal with it, move all arch init to at
> least early_initcall (some archs use a later init, which is fine).
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---

<snip alpha,sparc bits>

> Index: linux-2.6/arch/x86/kernel/cpu/perf_event.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/cpu/perf_event.c
> +++ linux-2.6/arch/x86/kernel/cpu/perf_event.c
> @@ -1348,7 +1348,7 @@ static void __init pmu_check_apic(void)
>  	pr_info("no hardware sampling interrupt available.\n");
>  }
>  
> -void __init init_hw_perf_events(void)
> +int __init init_hw_perf_events(void)
>  {
>  	struct event_constraint *c;
>  	int err;
> @@ -1363,11 +1363,11 @@ void __init init_hw_perf_events(void)
>  		err = amd_pmu_init();
>  		break;
>  	default:
> -		return;
> +		return 0;
>  	}
>  	if (err != 0) {
>  		pr_cont("no PMU driver, software events only.\n");
> -		return;
> +		return 0;
>  	}
>  
>  	pmu_check_apic();
> @@ -1420,7 +1420,10 @@ void __init init_hw_perf_events(void)
>  
>  	perf_pmu_register(&pmu);
>  	perf_cpu_notifier(x86_pmu_notifier);
> +
> +	return 0;
>  }
> +early_initcall(init_hw_perf_events);
>  
>  static inline void x86_pmu_read(struct perf_event *event)
>  {

Right, so hw perf init happens from (after this patch):

 arch_initcall: powerpc, arm, sh, mips
 early_initcall: x86, sparc, alpha


Now the problem is that the generic watchdog code (kernel/watchdog.c)
tries to create hw perf events, and that too runs from early_initcall.

So my question is, how do we go about curing this, because powerpc, arm,
sh and mips are too late and the rest depends on link order to work, not
really a nice situation.

There's two categories of solutions:
 - move the watchdog later, and
 - move the hw perf init earlier.

The former is undesired because we want the watchdog as early as
possible, the later needs new infrastructure (also, I don't know if the
arch implementations can actually run this early).

So do I create a perf_initcall() or is there another solution that
avoids things like calling the watchdog code from all arch init code?

  reply	other threads:[~2010-11-25 10:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 22:17 [RFC][PATCH 0/8] perf sysfs bits Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 1/8] perf, x86: Fixup Kconfig deps Peter Zijlstra
2010-11-26 15:01   ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 2/8] perf, arch: Use early_initcall() for all arch pmu implementations Peter Zijlstra
2010-11-25 10:25   ` Peter Zijlstra [this message]
2010-11-25 14:47     ` Peter Zijlstra
2010-11-25 16:22       ` Will Deacon
2010-11-25 16:34         ` Peter Zijlstra
2010-11-25 17:55     ` Peter Zijlstra
2010-11-26  7:13       ` Paul Mundt
2010-11-26  9:41       ` Will Deacon
2010-11-26 15:05       ` [tip:perf/core] perf, arch: Cleanup perf-pmu init vs lockup-detector tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 3/8] perf: Move perf_event_init() into main.c Peter Zijlstra
2010-12-16 12:32   ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 4/8] perf: Use early_initcall() for tracepoint and breakpoint init Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 5/8] init: Initialized IRD earlier Peter Zijlstra
2010-12-16 12:32   ` [tip:perf/core] init: Initialized IDR earlier tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 6/8] perf: Dynamic pmu types Peter Zijlstra
2010-12-16 12:32   ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 7/8] perf: Sysfs enumeration Peter Zijlstra
2010-12-16 12:33   ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-11-17 22:17 ` [RFC][PATCH 8/8] perf: Sysfs events Peter Zijlstra

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=1290680713.2145.18.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=dengcheng.zhu@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=kay.sievers@vrfy.org \
    --cc=kyle@moffetthome.net \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcree@orcon.net.nz \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=robert.richter@amd.com \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.