mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: Fix boot on uniprocessor systems
@ 2014-03-24 22:59 Artem Fetishev
  2014-03-26 20:31 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Fetishev @ 2014-03-24 22:59 UTC (permalink / raw)
  To: akpm, eranian; +Cc: linux-kernel

On x86 uniprocessor systems topology_physical_package_id() returns -1 which
causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized which leads
to GPF in rapl_pmu_init(). See arch/x86/kernel/cpu/perf_event_intel_rapl.c.

It turns out that physical_package_id and core_id can actually be retreived for
uniprocessor systems too. Enabling them also fixes rapl_pmu code.

Signed-off-by: Artem Fetishev <artem_fetishev@epam.com>
---
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index d35f24e..1306d11 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
 
 extern const struct cpumask *cpu_coregroup_mask(int cpu);
 
-#ifdef ENABLE_TOPO_DEFINES
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).phys_proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
+
+#ifdef ENABLE_TOPO_DEFINES
 #define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
 #define topology_thread_cpumask(cpu)		(per_cpu(cpu_sibling_map, cpu))
 #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Fix boot on uniprocessor systems
  2014-03-24 22:59 [PATCH] x86: Fix boot on uniprocessor systems Artem Fetishev
@ 2014-03-26 20:31 ` Andrew Morton
  2014-03-26 22:01   ` Stephane Eranian
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2014-03-26 20:31 UTC (permalink / raw)
  To: Artem Fetishev; +Cc: eranian, linux-kernel, Ingo Molnar, Peter Zijlstra

On Tue, 25 Mar 2014 01:59:10 +0300 Artem Fetishev <artem_fetishev@epam.com> wrote:

> On x86 uniprocessor systems topology_physical_package_id() returns -1 which
> causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized which leads
> to GPF in rapl_pmu_init(). See arch/x86/kernel/cpu/perf_event_intel_rapl.c.
> 
> It turns out that physical_package_id and core_id can actually be retreived for
> uniprocessor systems too. Enabling them also fixes rapl_pmu code.
> 
> Signed-off-by: Artem Fetishev <artem_fetishev@epam.com>
> ---
> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> index d35f24e..1306d11 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
>  
>  extern const struct cpumask *cpu_coregroup_mask(int cpu);
>  
> -#ifdef ENABLE_TOPO_DEFINES
>  #define topology_physical_package_id(cpu)	(cpu_data(cpu).phys_proc_id)
>  #define topology_core_id(cpu)			(cpu_data(cpu).cpu_core_id)
> +
> +#ifdef ENABLE_TOPO_DEFINES
>  #define topology_core_cpumask(cpu)		(per_cpu(cpu_core_map, cpu))
>  #define topology_thread_cpumask(cpu)		(per_cpu(cpu_sibling_map, cpu))
>  #endif

The patch applies to 3.13 and perhaps earlier kernels.  Is it needed in
those kernel versions?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Fix boot on uniprocessor systems
  2014-03-26 20:31 ` Andrew Morton
@ 2014-03-26 22:01   ` Stephane Eranian
  2014-03-26 22:10     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Stephane Eranian @ 2014-03-26 22:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Artem Fetishev, LKML, Ingo Molnar, Peter Zijlstra

On Wed, Mar 26, 2014 at 9:31 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Tue, 25 Mar 2014 01:59:10 +0300 Artem Fetishev <artem_fetishev@epam.com> wrote:
>
>> On x86 uniprocessor systems topology_physical_package_id() returns -1 which
>> causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized which leads
>> to GPF in rapl_pmu_init(). See arch/x86/kernel/cpu/perf_event_intel_rapl.c.
>>
>> It turns out that physical_package_id and core_id can actually be retreived for
>> uniprocessor systems too. Enabling them also fixes rapl_pmu code.
>>
>> Signed-off-by: Artem Fetishev <artem_fetishev@epam.com>
>> ---
>> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
>> index d35f24e..1306d11 100644
>> --- a/arch/x86/include/asm/topology.h
>> +++ b/arch/x86/include/asm/topology.h
>> @@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
>>
>>  extern const struct cpumask *cpu_coregroup_mask(int cpu);
>>
>> -#ifdef ENABLE_TOPO_DEFINES
>>  #define topology_physical_package_id(cpu)    (cpu_data(cpu).phys_proc_id)
>>  #define topology_core_id(cpu)                        (cpu_data(cpu).cpu_core_id)
>> +
>> +#ifdef ENABLE_TOPO_DEFINES
>>  #define topology_core_cpumask(cpu)           (per_cpu(cpu_core_map, cpu))
>>  #define topology_thread_cpumask(cpu)         (per_cpu(cpu_sibling_map, cpu))
>>  #endif
>
> The patch applies to 3.13 and perhaps earlier kernels.  Is it needed in
> those kernel versions?

Before 3.13 there was no RAPL support.
But it seems the patch is still useful regardless

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: Fix boot on uniprocessor systems
  2014-03-26 22:01   ` Stephane Eranian
@ 2014-03-26 22:10     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2014-03-26 22:10 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: Artem Fetishev, LKML, Ingo Molnar, Peter Zijlstra

On Wed, 26 Mar 2014 23:01:07 +0100 Stephane Eranian <eranian@google.com> wrote:

> On Wed, Mar 26, 2014 at 9:31 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> > On Tue, 25 Mar 2014 01:59:10 +0300 Artem Fetishev <artem_fetishev@epam.com> wrote:
> >
> >> On x86 uniprocessor systems topology_physical_package_id() returns -1 which
> >> causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized which leads
> >> to GPF in rapl_pmu_init(). See arch/x86/kernel/cpu/perf_event_intel_rapl.c.
> >>
> >> It turns out that physical_package_id and core_id can actually be retreived for
> >> uniprocessor systems too. Enabling them also fixes rapl_pmu code.
> >>
> >> Signed-off-by: Artem Fetishev <artem_fetishev@epam.com>
> >> ---
> >> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
> >> index d35f24e..1306d11 100644
> >> --- a/arch/x86/include/asm/topology.h
> >> +++ b/arch/x86/include/asm/topology.h
> >> @@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
> >>
> >>  extern const struct cpumask *cpu_coregroup_mask(int cpu);
> >>
> >> -#ifdef ENABLE_TOPO_DEFINES
> >>  #define topology_physical_package_id(cpu)    (cpu_data(cpu).phys_proc_id)
> >>  #define topology_core_id(cpu)                        (cpu_data(cpu).cpu_core_id)
> >> +
> >> +#ifdef ENABLE_TOPO_DEFINES
> >>  #define topology_core_cpumask(cpu)           (per_cpu(cpu_core_map, cpu))
> >>  #define topology_thread_cpumask(cpu)         (per_cpu(cpu_sibling_map, cpu))
> >>  #endif
> >
> > The patch applies to 3.13 and perhaps earlier kernels.  Is it needed in
> > those kernel versions?
> 
> Before 3.13 there was no RAPL support.
> But it seems the patch is still useful regardless

Is that an ack?  If so I'll squirt it Linuswards right now for 3.14.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-26 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24 22:59 [PATCH] x86: Fix boot on uniprocessor systems Artem Fetishev
2014-03-26 20:31 ` Andrew Morton
2014-03-26 22:01   ` Stephane Eranian
2014-03-26 22:10     ` Andrew Morton

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®