diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2012-09-10 03:53:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-17 12:11:43 -0400 |
commit | 314d9f63f385096580e9e2a06eaa0745d92fe4ac (patch) | |
tree | 7e24dc677fd3f1488f6c312ff56690366c34eb4a | |
parent | 60e5c706b3ea56f87afc2a4a3096118d28f9cc24 (diff) |
perf/x86: Add cpumask for uncore pmu
This patch adds a cpumask file to the uncore pmu sysfs directory. The
cpumask file contains one active cpu for every socket.
Signed-off-by: "Yan, Zheng" <zheng.z.yan@intel.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: "Yan, Zheng" <zheng.z.yan@intel.com>
Link: http://lkml.kernel.org/r/1347263631-23175-2-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.c | 28 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_uncore.h | 6 |
2 files changed, 29 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 0a5571080e74..62ec3e6af7ea 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -2341,6 +2341,27 @@ int uncore_pmu_event_init(struct perf_event *event) | |||
2341 | return ret; | 2341 | return ret; |
2342 | } | 2342 | } |
2343 | 2343 | ||
2344 | static ssize_t uncore_get_attr_cpumask(struct device *dev, | ||
2345 | struct device_attribute *attr, char *buf) | ||
2346 | { | ||
2347 | int n = cpulist_scnprintf(buf, PAGE_SIZE - 2, &uncore_cpu_mask); | ||
2348 | |||
2349 | buf[n++] = '\n'; | ||
2350 | buf[n] = '\0'; | ||
2351 | return n; | ||
2352 | } | ||
2353 | |||
2354 | static DEVICE_ATTR(cpumask, S_IRUGO, uncore_get_attr_cpumask, NULL); | ||
2355 | |||
2356 | static struct attribute *uncore_pmu_attrs[] = { | ||
2357 | &dev_attr_cpumask.attr, | ||
2358 | NULL, | ||
2359 | }; | ||
2360 | |||
2361 | static struct attribute_group uncore_pmu_attr_group = { | ||
2362 | .attrs = uncore_pmu_attrs, | ||
2363 | }; | ||
2364 | |||
2344 | static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu) | 2365 | static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu) |
2345 | { | 2366 | { |
2346 | int ret; | 2367 | int ret; |
@@ -2378,8 +2399,8 @@ static void __init uncore_type_exit(struct intel_uncore_type *type) | |||
2378 | free_percpu(type->pmus[i].box); | 2399 | free_percpu(type->pmus[i].box); |
2379 | kfree(type->pmus); | 2400 | kfree(type->pmus); |
2380 | type->pmus = NULL; | 2401 | type->pmus = NULL; |
2381 | kfree(type->attr_groups[1]); | 2402 | kfree(type->events_group); |
2382 | type->attr_groups[1] = NULL; | 2403 | type->events_group = NULL; |
2383 | } | 2404 | } |
2384 | 2405 | ||
2385 | static void __init uncore_types_exit(struct intel_uncore_type **types) | 2406 | static void __init uncore_types_exit(struct intel_uncore_type **types) |
@@ -2431,9 +2452,10 @@ static int __init uncore_type_init(struct intel_uncore_type *type) | |||
2431 | for (j = 0; j < i; j++) | 2452 | for (j = 0; j < i; j++) |
2432 | attrs[j] = &type->event_descs[j].attr.attr; | 2453 | attrs[j] = &type->event_descs[j].attr.attr; |
2433 | 2454 | ||
2434 | type->attr_groups[1] = events_group; | 2455 | type->events_group = events_group; |
2435 | } | 2456 | } |
2436 | 2457 | ||
2458 | type->pmu_group = &uncore_pmu_attr_group; | ||
2437 | type->pmus = pmus; | 2459 | type->pmus = pmus; |
2438 | return 0; | 2460 | return 0; |
2439 | fail: | 2461 | fail: |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h index 5b81c1856aac..e68a4550e952 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h | |||
@@ -369,10 +369,12 @@ struct intel_uncore_type { | |||
369 | struct intel_uncore_pmu *pmus; | 369 | struct intel_uncore_pmu *pmus; |
370 | struct intel_uncore_ops *ops; | 370 | struct intel_uncore_ops *ops; |
371 | struct uncore_event_desc *event_descs; | 371 | struct uncore_event_desc *event_descs; |
372 | const struct attribute_group *attr_groups[3]; | 372 | const struct attribute_group *attr_groups[4]; |
373 | }; | 373 | }; |
374 | 374 | ||
375 | #define format_group attr_groups[0] | 375 | #define pmu_group attr_groups[0] |
376 | #define format_group attr_groups[1] | ||
377 | #define events_group attr_groups[2] | ||
376 | 378 | ||
377 | struct intel_uncore_ops { | 379 | struct intel_uncore_ops { |
378 | void (*init_box)(struct intel_uncore_box *); | 380 | void (*init_box)(struct intel_uncore_box *); |