#include <linux/perf_event.h>
#include <linux/sysfs.h>
#include <linux/nospec.h>
#include <asm/cpu_device_id.h>
#include "probe.h"
enum perf_msr_id { … };
static bool test_aperfmperf(int idx, void *data)
{ … }
static bool test_ptsc(int idx, void *data)
{ … }
static bool test_irperf(int idx, void *data)
{ … }
static bool test_therm_status(int idx, void *data)
{ … }
static bool test_intel(int idx, void *data)
{ … }
PMU_EVENT_ATTR_STRING(tsc, attr_tsc, "event=0x00" );
PMU_EVENT_ATTR_STRING(aperf, attr_aperf, "event=0x01" );
PMU_EVENT_ATTR_STRING(mperf, attr_mperf, "event=0x02" );
PMU_EVENT_ATTR_STRING(pperf, attr_pperf, "event=0x03" );
PMU_EVENT_ATTR_STRING(smi, attr_smi, "event=0x04" );
PMU_EVENT_ATTR_STRING(ptsc, attr_ptsc, "event=0x05" );
PMU_EVENT_ATTR_STRING(irperf, attr_irperf, "event=0x06" );
PMU_EVENT_ATTR_STRING(cpu_thermal_margin, attr_therm, "event=0x07" );
PMU_EVENT_ATTR_STRING(cpu_thermal_margin.snapshot, attr_therm_snap, "1" );
PMU_EVENT_ATTR_STRING(cpu_thermal_margin.unit, attr_therm_unit, "C" );
static unsigned long msr_mask;
PMU_EVENT_GROUP(…);
PMU_EVENT_GROUP(…);
PMU_EVENT_GROUP(…);
PMU_EVENT_GROUP(…);
PMU_EVENT_GROUP(…);
PMU_EVENT_GROUP(…);
static struct attribute *attrs_therm[] = …;
static struct attribute_group group_therm = …;
static struct perf_msr msr[] = …;
static struct attribute *events_attrs[] = …;
static struct attribute_group events_attr_group = …;
PMU_FORMAT_ATTR(…);
static struct attribute *format_attrs[] = …;
static struct attribute_group format_attr_group = …;
static const struct attribute_group *attr_groups[] = …;
static const struct attribute_group *attr_update[] = …;
static int msr_event_init(struct perf_event *event)
{ … }
static inline u64 msr_read_counter(struct perf_event *event)
{ … }
static void msr_event_update(struct perf_event *event)
{ … }
static void msr_event_start(struct perf_event *event, int flags)
{ … }
static void msr_event_stop(struct perf_event *event, int flags)
{ … }
static void msr_event_del(struct perf_event *event, int flags)
{ … }
static int msr_event_add(struct perf_event *event, int flags)
{ … }
static struct pmu pmu_msr = …;
static int __init msr_init(void)
{ … }
device_initcall(msr_init);