File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,14 @@ config PERF_EVENTS_AMD_POWER
34
34
(CPUID Fn8000_0007_EDX[12]) interface to calculate the
35
35
average power consumption on Family 15h processors.
36
36
37
+ config PERF_EVENTS_AMD_UNCORE
38
+ tristate "AMD Uncore performance events"
39
+ depends on PERF_EVENTS && CPU_SUP_AMD
40
+ default y
41
+ help
42
+ Include support for AMD uncore performance events for use with
43
+ e.g., perf stat -e amd_l3/.../,amd_df/.../.
44
+
45
+ To compile this driver as a module, choose M here: the
46
+ module will be called 'amd-uncore'.
37
47
endmenu
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: GPL-2.0
2
- obj-$(CONFIG_CPU_SUP_AMD) += core.o uncore.o
2
+ obj-$(CONFIG_CPU_SUP_AMD) += core.o
3
3
obj-$(CONFIG_PERF_EVENTS_AMD_POWER) += power.o
4
4
obj-$(CONFIG_X86_LOCAL_APIC) += ibs.o
5
+ obj-$(CONFIG_PERF_EVENTS_AMD_UNCORE) += amd-uncore.o
6
+ amd-uncore-objs := uncore.o
5
7
ifdef CONFIG_AMD_IOMMU
6
8
obj-$(CONFIG_CPU_SUP_AMD) += iommu.o
7
9
endif
8
-
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ static struct pmu amd_nb_pmu = {
347
347
.stop = amd_uncore_stop ,
348
348
.read = amd_uncore_read ,
349
349
.capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT ,
350
+ .module = THIS_MODULE ,
350
351
};
351
352
352
353
static struct pmu amd_llc_pmu = {
@@ -360,6 +361,7 @@ static struct pmu amd_llc_pmu = {
360
361
.stop = amd_uncore_stop ,
361
362
.read = amd_uncore_read ,
362
363
.capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT ,
364
+ .module = THIS_MODULE ,
363
365
};
364
366
365
367
static struct amd_uncore * amd_uncore_alloc (unsigned int cpu )
@@ -665,4 +667,28 @@ static int __init amd_uncore_init(void)
665
667
666
668
return ret ;
667
669
}
668
- device_initcall (amd_uncore_init );
670
+
671
+ static void __exit amd_uncore_exit (void )
672
+ {
673
+ cpuhp_remove_state (CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE );
674
+ cpuhp_remove_state (CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING );
675
+ cpuhp_remove_state (CPUHP_PERF_X86_AMD_UNCORE_PREP );
676
+
677
+ if (boot_cpu_has (X86_FEATURE_PERFCTR_LLC )) {
678
+ perf_pmu_unregister (& amd_llc_pmu );
679
+ free_percpu (amd_uncore_llc );
680
+ amd_uncore_llc = NULL ;
681
+ }
682
+
683
+ if (boot_cpu_has (X86_FEATURE_PERFCTR_NB )) {
684
+ perf_pmu_unregister (& amd_nb_pmu );
685
+ free_percpu (amd_uncore_nb );
686
+ amd_uncore_nb = NULL ;
687
+ }
688
+ }
689
+
690
+ module_init (amd_uncore_init );
691
+ module_exit (amd_uncore_exit );
692
+
693
+ MODULE_DESCRIPTION ("AMD Uncore Driver" );
694
+ MODULE_LICENSE ("GPL v2" );
You can’t perform that action at this time.
0 commit comments