Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Marc Zyngier <maz@kernel.org>

+6 -84
+1 -7
arch/arm64/kvm/perf.c
··· 50 50 51 51 int kvm_perf_init(void) 52 52 { 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()) 60 54 static_branch_enable(&kvm_arm_pmu_available); 61 55 62 56 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
+1 -1
arch/arm64/kvm/pmu-emul.c
··· 739 739 kvm_pmu_create_perf_event(vcpu, select_idx); 740 740 } 741 741 742 - static int kvm_pmu_probe_pmuver(void) 742 + int kvm_pmu_probe_pmuver(void) 743 743 { 744 744 struct perf_event_attr attr = { }; 745 745 struct perf_event *event;
-21
arch/s390/kernel/perf_event.c
··· 23 23 #include <asm/sysinfo.h> 24 24 #include <asm/unwind.h> 25 25 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 - 47 26 static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs) 48 27 { 49 28 struct stack_frame *stack = (struct stack_frame *) regs->gprs[15];
-18
arch/sh/kernel/perf_event.c
··· 57 57 return !!sh_pmu; 58 58 } 59 59 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 - 78 60 /* 79 61 * Release the PMU if this is the last perf_event. 80 62 */
-30
drivers/perf/arm_pmu.c
··· 581 581 .attrs = armpmu_common_attrs, 582 582 }; 583 583 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 - 611 584 static int armpmu_count_irq_users(const int irq) 612 585 { 613 586 int cpu, count = 0; ··· 951 978 ret = perf_pmu_register(&pmu->pmu, pmu->name, -1); 952 979 if (ret) 953 980 goto out_destroy; 954 - 955 - if (!__oprofile_cpu_pmu) 956 - __oprofile_cpu_pmu = pmu; 957 981 958 982 pr_info("enabled with %s PMU driver, %d counters available%s\n", 959 983 pmu->name, pmu->num_events,
+4
include/kvm/arm_pmu.h
··· 61 61 int kvm_arm_pmu_v3_has_attr(struct kvm_vcpu *vcpu, 62 62 struct kvm_device_attr *attr); 63 63 int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu); 64 + int kvm_pmu_probe_pmuver(void); 64 65 #else 65 66 struct kvm_pmu { 66 67 }; ··· 117 116 { 118 117 return 0; 119 118 } 119 + 120 + static inline int kvm_pmu_probe_pmuver(void) { return 0xf; } 121 + 120 122 #endif 121 123 122 124 #endif
-2
include/linux/perf_event.h
··· 951 951 extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); 952 952 extern void perf_pmu_unregister(struct pmu *pmu); 953 953 954 - extern int perf_num_counters(void); 955 - extern const char *perf_pmu_name(void); 956 954 extern void __perf_event_task_sched_in(struct task_struct *prev, 957 955 struct task_struct *task); 958 956 extern void __perf_event_task_sched_out(struct task_struct *prev,
-5
kernel/events/core.c
··· 580 580 581 581 void __weak perf_event_print_debug(void) { } 582 582 583 - extern __weak const char *perf_pmu_name(void) 584 - { 585 - return "pmu"; 586 - } 587 - 588 583 static inline u64 perf_clock(void) 589 584 { 590 585 return local_clock();