@@ -130,11 +130,16 @@ struct rapl_pmus {
130
130
struct rapl_pmu * pmus [];
131
131
};
132
132
133
+ enum rapl_unit_quirk {
134
+ RAPL_UNIT_QUIRK_NONE ,
135
+ RAPL_UNIT_QUIRK_INTEL_HSW ,
136
+ };
137
+
133
138
struct rapl_model {
134
139
struct perf_msr * rapl_msrs ;
135
140
unsigned long events ;
136
141
unsigned int msr_power_unit ;
137
- bool apply_quirk ;
142
+ enum rapl_unit_quirk unit_quirk ;
138
143
};
139
144
140
145
/* 1/2^hw_unit Joule */
@@ -612,14 +617,20 @@ static int rapl_check_hw_unit(struct rapl_model *rm)
612
617
for (i = 0 ; i < NR_RAPL_DOMAINS ; i ++ )
613
618
rapl_hw_unit [i ] = (msr_rapl_power_unit_bits >> 8 ) & 0x1FULL ;
614
619
620
+ switch (rm -> unit_quirk ) {
615
621
/*
616
622
* DRAM domain on HSW server and KNL has fixed energy unit which can be
617
623
* different than the unit from power unit MSR. See
618
624
* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
619
625
* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
620
626
*/
621
- if ( rm -> apply_quirk )
627
+ case RAPL_UNIT_QUIRK_INTEL_HSW :
622
628
rapl_hw_unit [PERF_RAPL_RAM ] = 16 ;
629
+ break ;
630
+ default :
631
+ break ;
632
+ }
633
+
623
634
624
635
/*
625
636
* Calculate the timer rate:
@@ -698,7 +709,6 @@ static struct rapl_model model_snb = {
698
709
.events = BIT (PERF_RAPL_PP0 ) |
699
710
BIT (PERF_RAPL_PKG ) |
700
711
BIT (PERF_RAPL_PP1 ),
701
- .apply_quirk = false,
702
712
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
703
713
.rapl_msrs = intel_rapl_msrs ,
704
714
};
@@ -707,7 +717,6 @@ static struct rapl_model model_snbep = {
707
717
.events = BIT (PERF_RAPL_PP0 ) |
708
718
BIT (PERF_RAPL_PKG ) |
709
719
BIT (PERF_RAPL_RAM ),
710
- .apply_quirk = false,
711
720
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
712
721
.rapl_msrs = intel_rapl_msrs ,
713
722
};
@@ -717,7 +726,6 @@ static struct rapl_model model_hsw = {
717
726
BIT (PERF_RAPL_PKG ) |
718
727
BIT (PERF_RAPL_RAM ) |
719
728
BIT (PERF_RAPL_PP1 ),
720
- .apply_quirk = false,
721
729
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
722
730
.rapl_msrs = intel_rapl_msrs ,
723
731
};
@@ -726,15 +734,15 @@ static struct rapl_model model_hsx = {
726
734
.events = BIT (PERF_RAPL_PP0 ) |
727
735
BIT (PERF_RAPL_PKG ) |
728
736
BIT (PERF_RAPL_RAM ),
729
- .apply_quirk = true ,
737
+ .unit_quirk = RAPL_UNIT_QUIRK_INTEL_HSW ,
730
738
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
731
739
.rapl_msrs = intel_rapl_msrs ,
732
740
};
733
741
734
742
static struct rapl_model model_knl = {
735
743
.events = BIT (PERF_RAPL_PKG ) |
736
744
BIT (PERF_RAPL_RAM ),
737
- .apply_quirk = true ,
745
+ .unit_quirk = RAPL_UNIT_QUIRK_INTEL_HSW ,
738
746
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
739
747
.rapl_msrs = intel_rapl_msrs ,
740
748
};
@@ -745,14 +753,12 @@ static struct rapl_model model_skl = {
745
753
BIT (PERF_RAPL_RAM ) |
746
754
BIT (PERF_RAPL_PP1 ) |
747
755
BIT (PERF_RAPL_PSYS ),
748
- .apply_quirk = false,
749
756
.msr_power_unit = MSR_RAPL_POWER_UNIT ,
750
757
.rapl_msrs = intel_rapl_msrs ,
751
758
};
752
759
753
760
static struct rapl_model model_amd_fam17h = {
754
761
.events = BIT (PERF_RAPL_PKG ),
755
- .apply_quirk = false,
756
762
.msr_power_unit = MSR_AMD_RAPL_POWER_UNIT ,
757
763
.rapl_msrs = amd_rapl_msrs ,
758
764
};
0 commit comments