History

Merge branch 'kvm-arm64/kill_oprofile_dependency' into kvmarm-master/next

Marc Zyngier committed 5 years ago

Commit 9a8aae62 parents 4085ae8 7f318848 files · +6 −84Browse files

Unified · Split

8 files
  1. arch/arm64/kvm/perf.c +1 −7
  2. arch/arm64/kvm/pmu-emul.c +1 −1
  3. arch/s390/kernel/perf_event.c +0 −21
  4. arch/sh/kernel/perf_event.c +0 −18
  5. drivers/perf/arm_pmu.c +0 −30
  6. include/kvm/arm_pmu.h +4 −0
  7. include/linux/perf_event.h +0 −2
  8. kernel/events/core.c +0 −5
arch/arm64/kvm/perf.c+1−7
@@ -50,13 +50,7 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = { · 49 unmodified lines
5050
5151 int kvm_perf_init(void)
5252 {
53− /*
54− * Check if HW_PERF_EVENTS are supported by checking the number of
55− * hardware performance counters. This could ensure the presence of
56− * a physical PMU and CONFIG_PERF_EVENT is selected.
57− */
58− if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0
59− && !is_protected_kvm_enabled())
53+ if (kvm_pmu_probe_pmuver() != 0xf && !is_protected_kvm_enabled())
6054 static_branch_enable(&kvm_arm_pmu_available);
6155
6256 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
arch/arm64/kvm/pmu-emul.c+1−1
@@ -739,7 +739,7 @@ void kvm_pmu_set_counter_event_type(struct kvm_vcpu *vcpu, u64 data, · 738 unmodified lines
739739 kvm_pmu_create_perf_event(vcpu, select_idx);
740740 }
741741
742−static int kvm_pmu_probe_pmuver(void)
742+int kvm_pmu_probe_pmuver(void)
743743 {
744744 struct perf_event_attr attr = { };
745745 struct perf_event *event;
arch/s390/kernel/perf_event.c+0−21
@@ -23,27 +23,6 @@ · 22 unmodified lines
2323 #include <asm/sysinfo.h>
2424 #include <asm/unwind.h>
2525
26−const char *perf_pmu_name(void)
27−{
28− if (cpum_cf_avail() || cpum_sf_avail())
29− return "CPU-Measurement Facilities (CPU-MF)";
30− return "pmu";
31−}
32−EXPORT_SYMBOL(perf_pmu_name);
33−
34−int perf_num_counters(void)
35−{
36− int num = 0;
37−
38− if (cpum_cf_avail())
39− num += PERF_CPUM_CF_MAX_CTR;
40− if (cpum_sf_avail())
41− num += PERF_CPUM_SF_MAX_CTR;
42−
43− return num;
44−}
45−EXPORT_SYMBOL(perf_num_counters);
46−
4726 static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)
4827 {
4928 struct stack_frame *stack = (struct stack_frame *) regs->gprs[15];
arch/sh/kernel/perf_event.c+0−18
@@ -57,24 +57,6 @@ static inline int sh_pmu_initialized(void) · 56 unmodified lines
5757 return !!sh_pmu;
5858 }
5959
60−const char *perf_pmu_name(void)
61−{
62− if (!sh_pmu)
63− return NULL;
64−
65− return sh_pmu->name;
66−}
67−EXPORT_SYMBOL_GPL(perf_pmu_name);
68−
69−int perf_num_counters(void)
70−{
71− if (!sh_pmu)
72− return 0;
73−
74− return sh_pmu->num_events;
75−}
76−EXPORT_SYMBOL_GPL(perf_num_counters);
77−
7860 /*
7961 * Release the PMU if this is the last perf_event.
8062 */
drivers/perf/arm_pmu.c+0−30
@@ -581,33 +581,6 @@ static const struct attribute_group armpmu_common_attr_group = { · 580 unmodified lines
581581 .attrs = armpmu_common_attrs,
582582 };
583583
584−/* Set at runtime when we know what CPU type we are. */
585−static struct arm_pmu *__oprofile_cpu_pmu;
586−
587−/*
588− * Despite the names, these two functions are CPU-specific and are used
589− * by the OProfile/perf code.
590− */
591−const char *perf_pmu_name(void)
592−{
593− if (!__oprofile_cpu_pmu)
594− return NULL;
595−
596− return __oprofile_cpu_pmu->name;
597−}
598−EXPORT_SYMBOL_GPL(perf_pmu_name);
599−
600−int perf_num_counters(void)
601−{
602− int max_events = 0;
603−
604− if (__oprofile_cpu_pmu != NULL)
605− max_events = __oprofile_cpu_pmu->num_events;
606−
607− return max_events;
608−}
609−EXPORT_SYMBOL_GPL(perf_num_counters);
610−
611584 static int armpmu_count_irq_users(const int irq)
612585 {
613586 int cpu, count = 0;
@@ -979,9 +952,6 @@ int armpmu_register(struct arm_pmu *pmu) · 365 unmodified lines
979952 if (ret)
980953 goto out_destroy;
981954
982− if (!__oprofile_cpu_pmu)
983− __oprofile_cpu_pmu = pmu;
984−
985955 pr_info("enabled with %s PMU driver, %d counters available%s\n",
986956 pmu->name, pmu->num_events,
987957 has_nmi ? ", using NMIs" : "");
include/kvm/arm_pmu.h+4−0
@@ -61,6 +61,7 @@ int kvm_arm_pmu_v3_get_attr(struct kvm_vcpu *vcpu, · 60 unmodified lines
6161 int kvm_arm_pmu_v3_has_attr(struct kvm_vcpu *vcpu,
6262 struct kvm_device_attr *attr);
6363 int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu);
64+int kvm_pmu_probe_pmuver(void);
6465 #else
6566 struct kvm_pmu {
6667 };
@@ -116,6 +117,9 @@ static inline u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1) · 49 unmodified lines
116117 {
117118 return 0;
118119 }
120+
121+static inline int kvm_pmu_probe_pmuver(void) { return 0xf; }
122+
119123 #endif
120124
121125 #endif
include/linux/perf_event.h+0−2
@@ -951,8 +951,6 @@ extern void perf_event_itrace_started(struct perf_event *event); · 950 unmodified lines
951951 extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
952952 extern void perf_pmu_unregister(struct pmu *pmu);
953953
954−extern int perf_num_counters(void);
955−extern const char *perf_pmu_name(void);
956954 extern void __perf_event_task_sched_in(struct task_struct *prev,
957955 struct task_struct *task);
958956 extern void __perf_event_task_sched_out(struct task_struct *prev,
kernel/events/core.c+0−5
@@ -580,11 +580,6 @@ static u64 perf_event_time(struct perf_event *event); · 579 unmodified lines
580580
581581 void __weak perf_event_print_debug(void) { }
582582
583−extern __weak const char *perf_pmu_name(void)
584−{
585− return "pmu";
586−}
587−
588583 static inline u64 perf_clock(void)
589584 {
590585 return local_clock();