* [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group()
@ 2013-09-17 6:48 Yan, Zheng
2013-09-18 11:31 ` Peter Zijlstra
2013-09-20 9:57 ` [tip:perf/urgent] perf/x86/intel/uncore: Don' t " tip-bot for Yan, Zheng
0 siblings, 2 replies; 4+ messages in thread
From: Yan, Zheng @ 2013-09-17 6:48 UTC (permalink / raw)
To: peterz; +Cc: eranian, mingo, linux-kernel, Yan, Zheng
From: "Yan, Zheng" <zheng.z.yan@intel.com>
uncore_validate_group() can't call smp_processor_id() because it is
in preemptible context. Pass NUMA_NO_NODE to the allocator instead.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index fd8011e..11b1582 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
struct intel_uncore_box *fake_box;
int ret = -EINVAL, n;
- fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
+ fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
if (!fake_box)
return -ENOMEM;
--
1.8.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group()
2013-09-17 6:48 [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group() Yan, Zheng
@ 2013-09-18 11:31 ` Peter Zijlstra
2013-09-20 3:27 ` Bjorn Helgaas
2013-09-20 9:57 ` [tip:perf/urgent] perf/x86/intel/uncore: Don' t " tip-bot for Yan, Zheng
1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2013-09-18 11:31 UTC (permalink / raw)
To: Yan, Zheng; +Cc: eranian, mingo, linux-kernel, Bjorn Helgaas
On Tue, Sep 17, 2013 at 02:48:13PM +0800, Yan, Zheng wrote:
> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>
> uncore_validate_group() can't call smp_processor_id() because it is
> in preemptible context. Pass NUMA_NO_NODE to the allocator instead.
>
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
> arch/x86/kernel/cpu/perf_event_intel_uncore.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index fd8011e..11b1582 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
> struct intel_uncore_box *fake_box;
> int ret = -EINVAL, n;
>
> - fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
> + fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
Doesn't work since you're passing cpu, not node.
I changed it to the below. However upon doing so I noticed you
hard coded PCI devices live on Node0, this is not true in general
(although likely true for tiny systems).
I've absolutely no clue about the entire PCI layer, but it would be nice
if there's a method to extract the local node of a pci device.
Bjorn is there such a thing?
---
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2706,14 +2706,14 @@ static void uncore_pmu_init_hrtimer(stru
box->hrtimer.function = uncore_pmu_hrtimer;
}
-struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cpu)
+static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int node)
{
struct intel_uncore_box *box;
int i, size;
size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);
- box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
+ box = kzalloc_node(size, GFP_KERNEL, node);
if (!box)
return NULL;
@@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct
struct intel_uncore_box *fake_box;
int ret = -EINVAL, n;
- fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
+ fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
if (!fake_box)
return -ENOMEM;
@@ -3294,7 +3294,7 @@ static int uncore_pci_probe(struct pci_d
}
type = pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data)];
- box = uncore_alloc_box(type, 0);
+ box = uncore_alloc_box(type, NUMA_NO_NODE);
if (!box)
return -ENOMEM;
@@ -3499,7 +3499,7 @@ static int uncore_cpu_prepare(int cpu, i
if (pmu->func_id < 0)
pmu->func_id = j;
- box = uncore_alloc_box(type, cpu);
+ box = uncore_alloc_box(type, cpu_to_node(cpu));
if (!box)
return -ENOMEM;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group()
2013-09-18 11:31 ` Peter Zijlstra
@ 2013-09-20 3:27 ` Bjorn Helgaas
0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2013-09-20 3:27 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Yan, Zheng, Stephane Eranian, Ingo Molnar, linux-kernel
On Wed, Sep 18, 2013 at 5:31 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Sep 17, 2013 at 02:48:13PM +0800, Yan, Zheng wrote:
>> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>>
>> uncore_validate_group() can't call smp_processor_id() because it is
>> in preemptible context. Pass NUMA_NO_NODE to the allocator instead.
>>
>> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
>> ---
>> arch/x86/kernel/cpu/perf_event_intel_uncore.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> index fd8011e..11b1582 100644
>> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
>> @@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
>> struct intel_uncore_box *fake_box;
>> int ret = -EINVAL, n;
>>
>> - fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
>> + fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
>
> Doesn't work since you're passing cpu, not node.
>
> I changed it to the below. However upon doing so I noticed you
> hard coded PCI devices live on Node0, this is not true in general
> (although likely true for tiny systems).
>
> I've absolutely no clue about the entire PCI layer, but it would be nice
> if there's a method to extract the local node of a pci device.
>
> Bjorn is there such a thing?
dev_to_node(&pdev->dev), as in pci_call_probe()?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/urgent] perf/x86/intel/uncore: Don' t use smp_processor_id() in validate_group()
2013-09-17 6:48 [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group() Yan, Zheng
2013-09-18 11:31 ` Peter Zijlstra
@ 2013-09-20 9:57 ` tip-bot for Yan, Zheng
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Yan, Zheng @ 2013-09-20 9:57 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, zheng.z.yan, tglx
Commit-ID: 73c4427c6ca3b32fa0441791e9c6eadceff7242f
Gitweb: http://git.kernel.org/tip/73c4427c6ca3b32fa0441791e9c6eadceff7242f
Author: Yan, Zheng <zheng.z.yan@intel.com>
AuthorDate: Tue, 17 Sep 2013 14:48:13 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 20 Sep 2013 06:54:36 +0200
perf/x86/intel/uncore: Don't use smp_processor_id() in validate_group()
uncore_validate_group() can't call smp_processor_id() because it is
in preemptible context. Pass NUMA_NO_NODE to the allocator instead.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1379400493-11505-1-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 8ed4458..4118f9f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2706,14 +2706,14 @@ static void uncore_pmu_init_hrtimer(struct intel_uncore_box *box)
box->hrtimer.function = uncore_pmu_hrtimer;
}
-struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int cpu)
+static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type, int node)
{
struct intel_uncore_box *box;
int i, size;
size = sizeof(*box) + type->num_shared_regs * sizeof(struct intel_uncore_extra_reg);
- box = kzalloc_node(size, GFP_KERNEL, cpu_to_node(cpu));
+ box = kzalloc_node(size, GFP_KERNEL, node);
if (!box)
return NULL;
@@ -3031,7 +3031,7 @@ static int uncore_validate_group(struct intel_uncore_pmu *pmu,
struct intel_uncore_box *fake_box;
int ret = -EINVAL, n;
- fake_box = uncore_alloc_box(pmu->type, smp_processor_id());
+ fake_box = uncore_alloc_box(pmu->type, NUMA_NO_NODE);
if (!fake_box)
return -ENOMEM;
@@ -3294,7 +3294,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
}
type = pci_uncores[UNCORE_PCI_DEV_TYPE(id->driver_data)];
- box = uncore_alloc_box(type, 0);
+ box = uncore_alloc_box(type, NUMA_NO_NODE);
if (!box)
return -ENOMEM;
@@ -3499,7 +3499,7 @@ static int uncore_cpu_prepare(int cpu, int phys_id)
if (pmu->func_id < 0)
pmu->func_id = j;
- box = uncore_alloc_box(type, cpu);
+ box = uncore_alloc_box(type, cpu_to_node(cpu));
if (!box)
return -ENOMEM;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-20 9:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-17 6:48 [PATCH] perf/x86/intel/uncore: don't use smp_processor_id() in validate_group() Yan, Zheng
2013-09-18 11:31 ` Peter Zijlstra
2013-09-20 3:27 ` Bjorn Helgaas
2013-09-20 9:57 ` [tip:perf/urgent] perf/x86/intel/uncore: Don' t " tip-bot for Yan, Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome