2009-12-10 15:56:04

by Ralf Hildebrandt

[permalink] [raw]
Subject: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()

Running a vanilla 2.6.32 as Xen DomU, I'm getting:

[ 0.000999] CPU: Physical Processor ID: 0
[ 0.000999] CPU: Processor Core ID: 1
[ 0.000999] Performance Events: AMD PMU driver.
[ 0.000999] ------------[ cut here ]------------
[ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
[ 0.000999] Modules linked in:
[ 0.000999] Pid: 0, comm: swapper Not tainted 2.6.32 #3
[ 0.000999] Call Trace:
[ 0.000999] [<ffffffff8102611a>] ? native_apic_write_dummy+0x30/0x3c
[ 0.000999] [<ffffffff8104c5a2>] warn_slowpath_common+0x77/0x8f
[ 0.000999] [<ffffffff8104c5c9>] warn_slowpath_null+0xf/0x11
[ 0.000999] [<ffffffff8102611a>] native_apic_write_dummy+0x30/0x3c
[ 0.000999] [<ffffffff8101bf49>] perf_events_lapic_init+0x2e/0x30
[ 0.000999] [<ffffffff818cc6fe>] init_hw_perf_events+0x300/0x39d
[ 0.000999] [<ffffffff818cc25a>] identify_boot_cpu+0x3c/0x3e
[ 0.000999] [<ffffffff818cc3da>] check_bugs+0x9/0x2d
[ 0.000999] [<ffffffff818c4cae>] start_kernel+0x37a/0x38f
[ 0.000999] [<ffffffff818c42c1>] x86_64_start_reservations+0xac/0xb0
[ 0.000999] [<ffffffff818c7b79>] xen_start_kernel+0x530/0x534
[ 0.000999] ---[ end trace 4eaa2a86a8e2da22 ]---
[ 0.000999] ... version: 0
[ 0.000999] ... bit width: 48
[ 0.000999] ... generic registers: 4
[ 0.000999] ... value mask: 0000ffffffffffff
[ 0.000999] ... max period: 00007fffffffffff
[ 0.000999] ... fixed-purpose events: 0
[ 0.000999] ... event mask: 000000000000000f
[ 0.000999] SMP alternatives: switching to UP code

# uname -a
Linux fatush.arschkrebs.de 2.6.32 #3 SMP Tue Dec 8 22:09:42 CET 2009 x86_64 GNU/Linux

# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 67
model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
stepping : 3
cpu MHz : 2799.966
cache size : 1024 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu de tsc msr pae cx8 cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
bogomips : 5599.93
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

--
Ralf Hildebrandt
Geschäftsbereich IT | Abteilung Netzwerk
Charité - Universitätsmedizin Berlin
Campus Benjamin Franklin
Hindenburgdamm 30 | D-12203 Berlin
Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962
[email protected] | http://www.charite.de


2009-12-10 16:13:33

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()

On Thu, Dec 10, 2009 at 04:48:37PM +0100, Ralf Hildebrandt wrote:
> Running a vanilla 2.6.32 as Xen DomU, I'm getting:
>
> [ 0.000999] CPU: Physical Processor ID: 0
> [ 0.000999] CPU: Processor Core ID: 1
> [ 0.000999] Performance Events: AMD PMU driver.
> [ 0.000999] ------------[ cut here ]------------
> [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
> [ 0.000999] Modules linked in:
> [ 0.000999] Pid: 0, comm: swapper Not tainted 2.6.32 #3
> [ 0.000999] Call Trace:
> [ 0.000999] [<ffffffff8102611a>] ? native_apic_write_dummy+0x30/0x3c
> [ 0.000999] [<ffffffff8104c5a2>] warn_slowpath_common+0x77/0x8f
> [ 0.000999] [<ffffffff8104c5c9>] warn_slowpath_null+0xf/0x11
> [ 0.000999] [<ffffffff8102611a>] native_apic_write_dummy+0x30/0x3c
> [ 0.000999] [<ffffffff8101bf49>] perf_events_lapic_init+0x2e/0x30
> [ 0.000999] [<ffffffff818cc6fe>] init_hw_perf_events+0x300/0x39d
> [ 0.000999] [<ffffffff818cc25a>] identify_boot_cpu+0x3c/0x3e
> [ 0.000999] [<ffffffff818cc3da>] check_bugs+0x9/0x2d
> [ 0.000999] [<ffffffff818c4cae>] start_kernel+0x37a/0x38f
> [ 0.000999] [<ffffffff818c42c1>] x86_64_start_reservations+0xac/0xb0
> [ 0.000999] [<ffffffff818c7b79>] xen_start_kernel+0x530/0x534
> [ 0.000999] ---[ end trace 4eaa2a86a8e2da22 ]---
> [ 0.000999] ... version: 0
> [ 0.000999] ... bit width: 48
> [ 0.000999] ... generic registers: 4
> [ 0.000999] ... value mask: 0000ffffffffffff
> [ 0.000999] ... max period: 00007fffffffffff
> [ 0.000999] ... fixed-purpose events: 0
> [ 0.000999] ... event mask: 000000000000000f
> [ 0.000999] SMP alternatives: switching to UP code
>

It seems amd_pmu_init() do not check if apic is enabled :(
Thanks for report!

-- Cyrill

2009-12-10 16:30:56

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()

On Thu, Dec 10, 2009 at 07:13:35PM +0300, Cyrill Gorcunov wrote:
> On Thu, Dec 10, 2009 at 04:48:37PM +0100, Ralf Hildebrandt wrote:
> > Running a vanilla 2.6.32 as Xen DomU, I'm getting:
> >
> > [ 0.000999] CPU: Physical Processor ID: 0
> > [ 0.000999] CPU: Processor Core ID: 1
> > [ 0.000999] Performance Events: AMD PMU driver.
> > [ 0.000999] ------------[ cut here ]------------
> > [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
> > [ 0.000999] Modules linked in:
...

I suppose it should be something like the patch below.
Please test/review.
---
perf_event: check if we have APIC enabled on AMD cpu

Ralf Hildebrandt reported:

|
| Running a vanilla 2.6.32 as Xen DomU, I'm getting:
|
| [ 0.000999] CPU: Physical Processor ID: 0
| [ 0.000999] CPU: Processor Core ID: 1
| [ 0.000999] Performance Events: AMD PMU driver.
| [ 0.000999] ------------[ cut here ]------------
| [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
| [ 0.000999] Modules linked in:
| [ 0.000999] Pid: 0, comm: swapper Not tainted 2.6.32 #3
| [ 0.000999] Call Trace:
| [ 0.000999] [<ffffffff8102611a>] ? native_apic_write_dummy+0x30/0x3c
| [ 0.000999] [<ffffffff8104c5a2>] warn_slowpath_common+0x77/0x8f
| [ 0.000999] [<ffffffff8104c5c9>] warn_slowpath_null+0xf/0x11
| [ 0.000999] [<ffffffff8102611a>] native_apic_write_dummy+0x30/0x3c
| [ 0.000999] [<ffffffff8101bf49>] perf_events_lapic_init+0x2e/0x30
| [ 0.000999] [<ffffffff818cc6fe>] init_hw_perf_events+0x300/0x39d
| [ 0.000999] [<ffffffff818cc25a>] identify_boot_cpu+0x3c/0x3e
| [ 0.000999] [<ffffffff818cc3da>] check_bugs+0x9/0x2d
| [ 0.000999] [<ffffffff818c4cae>] start_kernel+0x37a/0x38f
| [ 0.000999] [<ffffffff818c42c1>] x86_64_start_reservations+0xac/0xb0
| [ 0.000999] [<ffffffff818c7b79>] xen_start_kernel+0x530/0x534
| [ 0.000999] ---[ end trace 4eaa2a86a8e2da22 ]---
|

So we need to check if APIC has a proper state.

Reported-by: Ralf Hildebrandt <[email protected]>
Signed-off-by: Cyrill Gorcunov <[email protected]>
---
arch/x86/kernel/cpu/perf_event.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event.c
+++ linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
@@ -627,6 +627,16 @@ static __initconst u64 amd_hw_cache_even
},
};

+static void __init perfmon_check_apic(struct x86_pmu* pmu)
+{
+ if (cpu_has_apic)
+ return;
+
+ pmu->apic = 0;
+ pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
+ pr_info("no hardware sampling interrupt available.\n");
+}
+
/*
* AMD Performance Monitor K7 and later.
*/
@@ -2062,11 +2072,7 @@ static __init int p6_pmu_init(void)

x86_pmu = p6_pmu;

- if (!cpu_has_apic) {
- pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
- pr_info("no hardware sampling interrupt available.\n");
- x86_pmu.apic = 0;
- }
+ perfmon_check_apic(&x86_pmu);

return 0;
}
@@ -2156,6 +2162,8 @@ static __init int amd_pmu_init(void)
memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
sizeof(hw_cache_event_ids));

+ perfmon_check_apic(&x86_pmu);
+
return 0;
}

2009-12-10 16:38:11

by Ingo Molnar

[permalink] [raw]
Subject: Re: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()


* Cyrill Gorcunov <[email protected]> wrote:

> On Thu, Dec 10, 2009 at 07:13:35PM +0300, Cyrill Gorcunov wrote:
> > On Thu, Dec 10, 2009 at 04:48:37PM +0100, Ralf Hildebrandt wrote:
> > > Running a vanilla 2.6.32 as Xen DomU, I'm getting:
> > >
> > > [ 0.000999] CPU: Physical Processor ID: 0
> > > [ 0.000999] CPU: Processor Core ID: 1
> > > [ 0.000999] Performance Events: AMD PMU driver.
> > > [ 0.000999] ------------[ cut here ]------------
> > > [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
> > > [ 0.000999] Modules linked in:
> ...
>
> I suppose it should be something like the patch below.
> Please test/review.
> ---
> perf_event: check if we have APIC enabled on AMD cpu
>
> Ralf Hildebrandt reported:
>
> |
> | Running a vanilla 2.6.32 as Xen DomU, I'm getting:
> |
> | [ 0.000999] CPU: Physical Processor ID: 0
> | [ 0.000999] CPU: Processor Core ID: 1
> | [ 0.000999] Performance Events: AMD PMU driver.
> | [ 0.000999] ------------[ cut here ]------------
> | [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
> | [ 0.000999] Modules linked in:
> | [ 0.000999] Pid: 0, comm: swapper Not tainted 2.6.32 #3
> | [ 0.000999] Call Trace:
> | [ 0.000999] [<ffffffff8102611a>] ? native_apic_write_dummy+0x30/0x3c
> | [ 0.000999] [<ffffffff8104c5a2>] warn_slowpath_common+0x77/0x8f
> | [ 0.000999] [<ffffffff8104c5c9>] warn_slowpath_null+0xf/0x11
> | [ 0.000999] [<ffffffff8102611a>] native_apic_write_dummy+0x30/0x3c
> | [ 0.000999] [<ffffffff8101bf49>] perf_events_lapic_init+0x2e/0x30
> | [ 0.000999] [<ffffffff818cc6fe>] init_hw_perf_events+0x300/0x39d
> | [ 0.000999] [<ffffffff818cc25a>] identify_boot_cpu+0x3c/0x3e
> | [ 0.000999] [<ffffffff818cc3da>] check_bugs+0x9/0x2d
> | [ 0.000999] [<ffffffff818c4cae>] start_kernel+0x37a/0x38f
> | [ 0.000999] [<ffffffff818c42c1>] x86_64_start_reservations+0xac/0xb0
> | [ 0.000999] [<ffffffff818c7b79>] xen_start_kernel+0x530/0x534
> | [ 0.000999] ---[ end trace 4eaa2a86a8e2da22 ]---
> |
>
> So we need to check if APIC has a proper state.
>
> Reported-by: Ralf Hildebrandt <[email protected]>
> Signed-off-by: Cyrill Gorcunov <[email protected]>
> ---
> arch/x86/kernel/cpu/perf_event.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
> =====================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event.c
> +++ linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
> @@ -627,6 +627,16 @@ static __initconst u64 amd_hw_cache_even
> },
> };
>
> +static void __init perfmon_check_apic(struct x86_pmu* pmu)
> +{
> + if (cpu_has_apic)
> + return;
> +
> + pmu->apic = 0;
> + pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
> + pr_info("no hardware sampling interrupt available.\n");
> +}
> +
> /*
> * AMD Performance Monitor K7 and later.
> */
> @@ -2062,11 +2072,7 @@ static __init int p6_pmu_init(void)
>
> x86_pmu = p6_pmu;
>
> - if (!cpu_has_apic) {
> - pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
> - pr_info("no hardware sampling interrupt available.\n");
> - x86_pmu.apic = 0;
> - }
> + perfmon_check_apic(&x86_pmu);
>
> return 0;
> }
> @@ -2156,6 +2162,8 @@ static __init int amd_pmu_init(void)
> memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
> sizeof(hw_cache_event_ids));
>
> + perfmon_check_apic(&x86_pmu);
> +
> return 0;
> }

Similar check needed in intel_pmu_init() as well? Also, i'd suggest to
name it pmu_check_apic() or so - and why call it in the middle of of the
PMU init functions? All PMU drivers are APIC based, so this call can be
done right after:

if (err != 0) {
pr_cont("no PMU driver, software events only.\n");
return;
}

pmu_check_apic();

in a single place. Also, no need to pass in &x86_pmu - we have a single
PMU driver.

Thanks,

Ingo

2009-12-10 16:49:01

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()

On Thu, Dec 10, 2009 at 05:37:45PM +0100, Ingo Molnar wrote:
...
> >
> > + perfmon_check_apic(&x86_pmu);
> > +
> > return 0;
> > }
>
> Similar check needed in intel_pmu_init() as well?

Yes (though p6 model already has such a check [fixed by Peter iirc])

>
> Also, i'd suggest to
> name it pmu_check_apic() or so - and why call it in the middle of of the
> PMU init functions? All PMU drivers are APIC based, so this call can be
> done right after:
>
> if (err != 0) {
> pr_cont("no PMU driver, software events only.\n");
> return;
> }
>
> pmu_check_apic();
>
> in a single place. Also, no need to pass in &x86_pmu - we have a single
> PMU driver.
>
> Thanks,
>
> Ingo
>

OK, will update and resend. Thanks for comments!

-- Cyrill

2009-12-10 16:56:33

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [2.6.32] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()

On Thu, Dec 10, 2009 at 07:49:04PM +0300, Cyrill Gorcunov wrote:
...
>
> OK, will update and resend. Thanks for comments!
>
> -- Cyrill

Here is it, please review.

-- Cyrill
---
x86,pmu: check if we have APIC enabled

Ralf Hildebrandt reported:

|
| Running a vanilla 2.6.32 as Xen DomU, I'm getting:
|
| [ 0.000999] CPU: Physical Processor ID: 0
| [ 0.000999] CPU: Processor Core ID: 1
| [ 0.000999] Performance Events: AMD PMU driver.
| [ 0.000999] ------------[ cut here ]------------
| [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x30/0x3c()
| [ 0.000999] Modules linked in:
| [ 0.000999] Pid: 0, comm: swapper Not tainted 2.6.32 #3
| [ 0.000999] Call Trace:
| [ 0.000999] [<ffffffff8102611a>] ? native_apic_write_dummy+0x30/0x3c
| [ 0.000999] [<ffffffff8104c5a2>] warn_slowpath_common+0x77/0x8f
| [ 0.000999] [<ffffffff8104c5c9>] warn_slowpath_null+0xf/0x11
| [ 0.000999] [<ffffffff8102611a>] native_apic_write_dummy+0x30/0x3c
| [ 0.000999] [<ffffffff8101bf49>] perf_events_lapic_init+0x2e/0x30
| [ 0.000999] [<ffffffff818cc6fe>] init_hw_perf_events+0x300/0x39d
| [ 0.000999] [<ffffffff818cc25a>] identify_boot_cpu+0x3c/0x3e
| [ 0.000999] [<ffffffff818cc3da>] check_bugs+0x9/0x2d
| [ 0.000999] [<ffffffff818c4cae>] start_kernel+0x37a/0x38f
| [ 0.000999] [<ffffffff818c42c1>] x86_64_start_reservations+0xac/0xb0
| [ 0.000999] [<ffffffff818c7b79>] xen_start_kernel+0x530/0x534
| [ 0.000999] ---[ end trace 4eaa2a86a8e2da22 ]---
|

So we need to check if APIC has a proper state (ie enabled).

Reported-by: Ralf Hildebrandt <[email protected]>
Signed-off-by: Cyrill Gorcunov <[email protected]>
---
arch/x86/kernel/cpu/perf_event.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event.c
+++ linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
@@ -2062,12 +2062,6 @@ static __init int p6_pmu_init(void)

x86_pmu = p6_pmu;

- if (!cpu_has_apic) {
- pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
- pr_info("no hardware sampling interrupt available.\n");
- x86_pmu.apic = 0;
- }
-
return 0;
}

@@ -2159,6 +2153,16 @@ static __init int amd_pmu_init(void)
return 0;
}

+static void __init pmu_check_apic(void)
+{
+ if (cpu_has_apic)
+ return;
+
+ x86_pmu.apic = 0;
+ pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
+ pr_info("no hardware sampling interrupt available.\n");
+}
+
void __init init_hw_perf_events(void)
{
int err;
@@ -2180,6 +2184,8 @@ void __init init_hw_perf_events(void)
return;
}

+ pmu_check_apic();
+
pr_cont("%s PMU driver.\n", x86_pmu.name);

if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {

2009-12-10 17:19:59

by Cyrill Gorcunov

[permalink] [raw]
Subject: [tip:perf/urgent] x86, perf events: Check if we have APIC enabled

Commit-ID: 125580380f418000b1a06d9a54700f1191b6e561
Gitweb: http://git.kernel.org/tip/125580380f418000b1a06d9a54700f1191b6e561
Author: Cyrill Gorcunov <[email protected]>
AuthorDate: Thu, 10 Dec 2009 19:56:34 +0300
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 10 Dec 2009 18:00:30 +0100

x86, perf events: Check if we have APIC enabled

Ralf Hildebrandt reported this boot warning:

| Running a vanilla 2.6.32 as Xen DomU, I'm getting:
|
| [ 0.000999] CPU: Physical Processor ID: 0
| [ 0.000999] CPU: Processor Core ID: 1
| [ 0.000999] Performance Events: AMD PMU driver.
| [ 0.000999] ------------[ cut here ]------------
| [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy

So we need to check if APIC functionality is available, and
not just in the P6 driver but elsewhere as well.

Reported-by: Ralf Hildebrandt <[email protected]>
Signed-off-by: Cyrill Gorcunov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <20091210165634.GF5086@lenovo>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/perf_event.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 1342f23..18f05ec 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2066,12 +2066,6 @@ static __init int p6_pmu_init(void)

x86_pmu = p6_pmu;

- if (!cpu_has_apic) {
- pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
- pr_info("no hardware sampling interrupt available.\n");
- x86_pmu.apic = 0;
- }
-
return 0;
}

@@ -2163,6 +2157,16 @@ static __init int amd_pmu_init(void)
return 0;
}

+static void __init pmu_check_apic(void)
+{
+ if (cpu_has_apic)
+ return;
+
+ x86_pmu.apic = 0;
+ pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
+ pr_info("no hardware sampling interrupt available.\n");
+}
+
void __init init_hw_perf_events(void)
{
int err;
@@ -2184,6 +2188,8 @@ void __init init_hw_perf_events(void)
return;
}

+ pmu_check_apic();
+
pr_cont("%s PMU driver.\n", x86_pmu.name);

if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {

2009-12-10 18:15:57

by Cyrill Gorcunov

[permalink] [raw]
Subject: Re: [tip:perf/urgent] x86, perf events: Check if we have APIC enabled

On Thu, Dec 10, 2009 at 05:18:32PM +0000, tip-bot for Cyrill Gorcunov wrote:
> Commit-ID: 125580380f418000b1a06d9a54700f1191b6e561
> Gitweb: http://git.kernel.org/tip/125580380f418000b1a06d9a54700f1191b6e561
> Author: Cyrill Gorcunov <[email protected]>
> AuthorDate: Thu, 10 Dec 2009 19:56:34 +0300
> Committer: Ingo Molnar <[email protected]>
> CommitDate: Thu, 10 Dec 2009 18:00:30 +0100
>
> x86, perf events: Check if we have APIC enabled
>
> Ralf Hildebrandt reported this boot warning:
>
> | Running a vanilla 2.6.32 as Xen DomU, I'm getting:
> |
> | [ 0.000999] CPU: Physical Processor ID: 0
> | [ 0.000999] CPU: Processor Core ID: 1
> | [ 0.000999] Performance Events: AMD PMU driver.
> | [ 0.000999] ------------[ cut here ]------------
> | [ 0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy
>
> So we need to check if APIC functionality is available, and
> not just in the P6 driver but elsewhere as well.
>
> Reported-by: Ralf Hildebrandt <[email protected]>
> Signed-off-by: Cyrill Gorcunov <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Mike Galbraith <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Cc: Frederic Weisbecker <[email protected]>
> LKML-Reference: <20091210165634.GF5086@lenovo>
> Signed-off-by: Ingo Molnar <[email protected]>
> ---
> arch/x86/kernel/cpu/perf_event.c | 18 ++++++++++++------
> 1 files changed, 12 insertions(+), 6 deletions(-)
>
...

Btw, is there some particular reason to have x86_pmu::apic item?
Can't we use cpu_has_apic directly? Or there some plans about
this item? Or I miss something obvious?

-- Cyrill

2009-12-11 08:39:33

by Christian Hartmann

[permalink] [raw]
Subject: Re: [tip:perf/urgent] x86, perf events: Check if we have APIC enabled

Hello list,

wow, I reported this bug also "PROBLEM: WARNING: at
arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy+0x32/0x3e()
(git 2.6.32-rc5)" on 22.october 09, this a delay of 1,5 month ;)
But anyway, good to know, that they comes now a hint from the kernel
by this patch... :)





2009/12/10 tip-bot for Cyrill Gorcunov <[email protected]>:
> Commit-ID: ?125580380f418000b1a06d9a54700f1191b6e561
> Gitweb: ? ? http://git.kernel.org/tip/125580380f418000b1a06d9a54700f1191b6e561
> Author: ? ? Cyrill Gorcunov <[email protected]>
> AuthorDate: Thu, 10 Dec 2009 19:56:34 +0300
> Committer: ?Ingo Molnar <[email protected]>
> CommitDate: Thu, 10 Dec 2009 18:00:30 +0100
>
> x86, perf events: Check if we have APIC enabled
>
> Ralf Hildebrandt reported this boot warning:
>
> | Running a vanilla 2.6.32 as Xen DomU, I'm getting:
> |
> | [ ? ?0.000999] CPU: Physical Processor ID: 0
> | [ ? ?0.000999] CPU: Processor Core ID: 1
> | [ ? ?0.000999] Performance Events: AMD PMU driver.
> | [ ? ?0.000999] ------------[ cut here ]------------
> | [ ? ?0.000999] WARNING: at arch/x86/kernel/apic/apic.c:249 native_apic_write_dummy
>
> So we need to check if APIC functionality is available, and
> not just in the P6 driver but elsewhere as well.
>
> Reported-by: Ralf Hildebrandt <[email protected]>
> Signed-off-by: Cyrill Gorcunov <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Mike Galbraith <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Cc: Frederic Weisbecker <[email protected]>
> LKML-Reference: <20091210165634.GF5086@lenovo>
> Signed-off-by: Ingo Molnar <[email protected]>
> ---
> ?arch/x86/kernel/cpu/perf_event.c | ? 18 ++++++++++++------
> ?1 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 1342f23..18f05ec 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -2066,12 +2066,6 @@ static __init int p6_pmu_init(void)
>
> ? ? ? ?x86_pmu = p6_pmu;
>
> - ? ? ? if (!cpu_has_apic) {
> - ? ? ? ? ? ? ? pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
> - ? ? ? ? ? ? ? pr_info("no hardware sampling interrupt available.\n");
> - ? ? ? ? ? ? ? x86_pmu.apic = 0;
> - ? ? ? }
> -
> ? ? ? ?return 0;
> ?}
>
> @@ -2163,6 +2157,16 @@ static __init int amd_pmu_init(void)
> ? ? ? ?return 0;
> ?}
>
> +static void __init pmu_check_apic(void)
> +{
> + ? ? ? if (cpu_has_apic)
> + ? ? ? ? ? ? ? return;
> +
> + ? ? ? x86_pmu.apic = 0;
> + ? ? ? pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
> + ? ? ? pr_info("no hardware sampling interrupt available.\n");
> +}
> +
> ?void __init init_hw_perf_events(void)
> ?{
> ? ? ? ?int err;
> @@ -2184,6 +2188,8 @@ void __init init_hw_perf_events(void)
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
>
> + ? ? ? pmu_check_apic();
> +
> ? ? ? ?pr_cont("%s PMU driver.\n", x86_pmu.name);
>
> ? ? ? ?if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at ?http://www.tux.org/lkml/
>



--
--
......oooO..............
.....(....).....Oooo...
......)../.....(....)....
.....(_/.......)../.....
...............(_/.......
... I WAS ..............
.......... HERE...... ;)