Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > On 11/08/2016 09:31 AM, Thomas Gleixner wrote: > > On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > > > [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 > > > [0.016398] smpboot: APIC(0) Converting physical 0 to

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > On 11/08/2016 09:31 AM, Thomas Gleixner wrote: > > On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > > > [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 > > > [0.016398] smpboot: APIC(0) Converting physical 0 to

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Charles (Chas) Williams
On 11/08/2016 09:31 AM, Thomas Gleixner wrote: On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 [0.016398] smpboot: APIC(0) Converting physical 0 to logical package 0, cpu 0 (88023fc0a040) [

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Charles (Chas) Williams
On 11/08/2016 09:31 AM, Thomas Gleixner wrote: On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 [0.016398] smpboot: APIC(0) Converting physical 0 to logical package 0, cpu 0 (88023fc0a040) [

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 > [0.016398] smpboot: APIC(0) Converting physical 0 to logical > package 0, cpu 0 (88023fc0a040) > [0.016399] topology_update_package_map: apicid

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Charles (Chas) Williams wrote: > [0.016335] topology_update_package_map: apicid 0 pkg 0 cpu 0 > [0.016398] smpboot: APIC(0) Converting physical 0 to logical > package 0, cpu 0 (88023fc0a040) > [0.016399] topology_update_package_map: apicid

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Charles (Chas) Williams
On 11/07/2016 03:20 PM, Thomas Gleixner wrote: On Mon, 7 Nov 2016, Charles (Chas) Williams wrote: On 11/07/2016 11:19 AM, Thomas Gleixner wrote: On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: I don't know why the CPU's phys_proc_id is 2. max_physical_pkg_id gets initialized via:

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-08 Thread Charles (Chas) Williams
On 11/07/2016 03:20 PM, Thomas Gleixner wrote: On Mon, 7 Nov 2016, Charles (Chas) Williams wrote: On 11/07/2016 11:19 AM, Thomas Gleixner wrote: On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: I don't know why the CPU's phys_proc_id is 2. max_physical_pkg_id gets initialized via:

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Thomas Gleixner
On Mon, 7 Nov 2016, Charles (Chas) Williams wrote: > On 11/07/2016 11:19 AM, Thomas Gleixner wrote: > > On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: > > > I don't know why the CPU's phys_proc_id is 2. > > > > max_physical_pkg_id gets initialized via: > > > > cpus =

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Thomas Gleixner
On Mon, 7 Nov 2016, Charles (Chas) Williams wrote: > On 11/07/2016 11:19 AM, Thomas Gleixner wrote: > > On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: > > > I don't know why the CPU's phys_proc_id is 2. > > > > max_physical_pkg_id gets initialized via: > > > > cpus =

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Charles (Chas) Williams
On 11/07/2016 11:19 AM, Thomas Gleixner wrote: On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: I am not sure if this a race with the new hotplug code or something that was always there. Both (M. Vefa Bicakc and Charles) say that the

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Charles (Chas) Williams
On 11/07/2016 11:19 AM, Thomas Gleixner wrote: On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: I am not sure if this a race with the new hotplug code or something that was always there. Both (M. Vefa Bicakc and Charles) say that the

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Thomas Gleixner
On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: > On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: > > I am not sure if this a race with the new hotplug code or something that was > > always there. Both (M. Vefa Bicakc and Charles) say that the box boots > > sometimes fine (without the

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-07 Thread Thomas Gleixner
On Wed, 2 Nov 2016, Charles (Chas) Williams wrote: > On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: > > I am not sure if this a race with the new hotplug code or something that was > > always there. Both (M. Vefa Bicakc and Charles) say that the box boots > > sometimes fine (without the

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Sebastian Andrzej Siewior
On 2016-11-04 16:42:33 [-0400], Charles (Chas) Williams wrote: > This comes from here: > > unsigned int apicid = apic->cpu_present_to_apicid(cpu); > > if (apicid == BAD_APICID || !apic->apic_id_valid(apicid)) > continue; >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Sebastian Andrzej Siewior
On 2016-11-04 16:42:33 [-0400], Charles (Chas) Williams wrote: > This comes from here: > > unsigned int apicid = apic->cpu_present_to_apicid(cpu); > > if (apicid == BAD_APICID || !apic->apic_id_valid(apicid)) > continue; >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Charles (Chas) Williams
On 11/04/2016 02:03 PM, Sebastian Andrzej Siewior wrote: On 2016-11-04 08:20:37 [-0400], Charles (Chas) Williams wrote: The initial CPU boots and is identified: [0.009018] identify_boot_cpu [0.009174] generic_identify: phys_proc_id is now 0 ... [0.009427] identify_cpu: before c

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Charles (Chas) Williams
On 11/04/2016 02:03 PM, Sebastian Andrzej Siewior wrote: On 2016-11-04 08:20:37 [-0400], Charles (Chas) Williams wrote: The initial CPU boots and is identified: [0.009018] identify_boot_cpu [0.009174] generic_identify: phys_proc_id is now 0 ... [0.009427] identify_cpu: before c

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Sebastian Andrzej Siewior
On 2016-11-04 08:20:37 [-0400], Charles (Chas) Williams wrote: > The initial CPU boots and is identified: > > [0.009018] identify_boot_cpu > [0.009174] generic_identify: phys_proc_id is now 0 > ... > [0.009427] identify_cpu: before c 81ae2680 logical_proc_id 0 >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Sebastian Andrzej Siewior
On 2016-11-04 08:20:37 [-0400], Charles (Chas) Williams wrote: > The initial CPU boots and is identified: > > [0.009018] identify_boot_cpu > [0.009174] generic_identify: phys_proc_id is now 0 > ... > [0.009427] identify_cpu: before c 81ae2680 logical_proc_id 0 >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Charles (Chas) Williams
On 11/03/2016 01:47 PM, Sebastian Andrzej Siewior wrote: On 2016-11-02 18:47:49 [-0400], Charles (Chas) Williams wrote: I don't this this is a race. Here is some debugging from the two CPU VM (2 sockets, 1 core per socket). In identify_cpu() we have: /* The boot/hotplug time

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-04 Thread Charles (Chas) Williams
On 11/03/2016 01:47 PM, Sebastian Andrzej Siewior wrote: On 2016-11-02 18:47:49 [-0400], Charles (Chas) Williams wrote: I don't this this is a race. Here is some debugging from the two CPU VM (2 sockets, 1 core per socket). In identify_cpu() we have: /* The boot/hotplug time

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-03 Thread Sebastian Andrzej Siewior
On 2016-11-02 18:47:49 [-0400], Charles (Chas) Williams wrote: > I don't this this is a race. Here is some debugging from the two CPU VM > (2 sockets, 1 core per socket). In identify_cpu() we have: > > /* The boot/hotplug time assigment got cleared, restore it */ >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-03 Thread Sebastian Andrzej Siewior
On 2016-11-02 18:47:49 [-0400], Charles (Chas) Williams wrote: > I don't this this is a race. Here is some debugging from the two CPU VM > (2 sockets, 1 core per socket). In identify_cpu() we have: > > /* The boot/hotplug time assigment got cleared, restore it */ >

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-02 Thread Charles (Chas) Williams
On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: I am not sure if this a race with the new hotplug code or something that was always there. Both (M. Vefa Bicakc and Charles) say that the box boots sometimes fine (without the patch). smp_store_boot_cpu_info() should have run before the

Re: [RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-02 Thread Charles (Chas) Williams
On 11/02/2016 08:25 AM, Sebastian Andrzej Siewior wrote: I am not sure if this a race with the new hotplug code or something that was always there. Both (M. Vefa Bicakc and Charles) say that the box boots sometimes fine (without the patch). smp_store_boot_cpu_info() should have run before the

[RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-02 Thread Sebastian Andrzej Siewior
After the hotplug rework Charles Williams reported that his vmware virtualized system no longer boots and crashes in rapl_cpu_online(). As it turns out topology_max_packages() reports four while topology_logical_package_id() for CPU two and three returns 65535. That means cpu_to_rapl_pmu() for

[RFC PATCH] perf/x86/intel/rapl: avoid access unallocate memory

2016-11-02 Thread Sebastian Andrzej Siewior
After the hotplug rework Charles Williams reported that his vmware virtualized system no longer boots and crashes in rapl_cpu_online(). As it turns out topology_max_packages() reports four while topology_logical_package_id() for CPU two and three returns 65535. That means cpu_to_rapl_pmu() for