Commit 314d9f63 authored by Yan, Zheng's avatar Yan, Zheng Committed by Arnaldo Carvalho de Melo

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: default avatar"Yan, Zheng" <zheng.z.yan@intel.com>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarIngo 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 60e5c706
...@@ -2341,6 +2341,27 @@ int uncore_pmu_event_init(struct perf_event *event) ...@@ -2341,6 +2341,27 @@ int uncore_pmu_event_init(struct perf_event *event)
return ret; return ret;
} }
static ssize_t uncore_get_attr_cpumask(struct device *dev,
struct device_attribute *attr, char *buf)
{
int n = cpulist_scnprintf(buf, PAGE_SIZE - 2, &uncore_cpu_mask);
buf[n++] = '\n';
buf[n] = '\0';
return n;
}
static DEVICE_ATTR(cpumask, S_IRUGO, uncore_get_attr_cpumask, NULL);
static struct attribute *uncore_pmu_attrs[] = {
&dev_attr_cpumask.attr,
NULL,
};
static struct attribute_group uncore_pmu_attr_group = {
.attrs = uncore_pmu_attrs,
};
static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu) static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu)
{ {
int ret; int ret;
...@@ -2378,8 +2399,8 @@ static void __init uncore_type_exit(struct intel_uncore_type *type) ...@@ -2378,8 +2399,8 @@ static void __init uncore_type_exit(struct intel_uncore_type *type)
free_percpu(type->pmus[i].box); free_percpu(type->pmus[i].box);
kfree(type->pmus); kfree(type->pmus);
type->pmus = NULL; type->pmus = NULL;
kfree(type->attr_groups[1]); kfree(type->events_group);
type->attr_groups[1] = NULL; type->events_group = NULL;
} }
static void __init uncore_types_exit(struct intel_uncore_type **types) 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,9 +2452,10 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
attrs[j] = &type->event_descs[j].attr.attr; attrs[j] = &type->event_descs[j].attr.attr;
type->attr_groups[1] = events_group; type->events_group = events_group;
} }
type->pmu_group = &uncore_pmu_attr_group;
type->pmus = pmus; type->pmus = pmus;
return 0; return 0;
fail: fail:
......
...@@ -369,10 +369,12 @@ struct intel_uncore_type { ...@@ -369,10 +369,12 @@ struct intel_uncore_type {
struct intel_uncore_pmu *pmus; struct intel_uncore_pmu *pmus;
struct intel_uncore_ops *ops; struct intel_uncore_ops *ops;
struct uncore_event_desc *event_descs; struct uncore_event_desc *event_descs;
const struct attribute_group *attr_groups[3]; const struct attribute_group *attr_groups[4];
}; };
#define format_group attr_groups[0] #define pmu_group attr_groups[0]
#define format_group attr_groups[1]
#define events_group attr_groups[2]
struct intel_uncore_ops { struct intel_uncore_ops {
void (*init_box)(struct intel_uncore_box *); void (*init_box)(struct intel_uncore_box *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment