@@ -769,6 +769,7 @@ void intel_pmu_lbr_disable_all(void)
769
769
void intel_pmu_lbr_read_32 (struct cpu_hw_events * cpuc )
770
770
{
771
771
unsigned long mask = x86_pmu .lbr_nr - 1 ;
772
+ struct perf_branch_entry * br = cpuc -> lbr_entries ;
772
773
u64 tos = intel_pmu_lbr_tos ();
773
774
int i ;
774
775
@@ -784,15 +785,11 @@ void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc)
784
785
785
786
rdmsrl (x86_pmu .lbr_from + lbr_idx , msr_lastbranch .lbr );
786
787
787
- cpuc -> lbr_entries [i ].from = msr_lastbranch .from ;
788
- cpuc -> lbr_entries [i ].to = msr_lastbranch .to ;
789
- cpuc -> lbr_entries [i ].mispred = 0 ;
790
- cpuc -> lbr_entries [i ].predicted = 0 ;
791
- cpuc -> lbr_entries [i ].in_tx = 0 ;
792
- cpuc -> lbr_entries [i ].abort = 0 ;
793
- cpuc -> lbr_entries [i ].cycles = 0 ;
794
- cpuc -> lbr_entries [i ].type = 0 ;
795
- cpuc -> lbr_entries [i ].reserved = 0 ;
788
+ perf_clear_branch_entry_bitfields (br );
789
+
790
+ br -> from = msr_lastbranch .from ;
791
+ br -> to = msr_lastbranch .to ;
792
+ br ++ ;
796
793
}
797
794
cpuc -> lbr_stack .nr = i ;
798
795
cpuc -> lbr_stack .hw_idx = tos ;
@@ -807,6 +804,7 @@ void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
807
804
{
808
805
bool need_info = false, call_stack = false;
809
806
unsigned long mask = x86_pmu .lbr_nr - 1 ;
807
+ struct perf_branch_entry * br = cpuc -> lbr_entries ;
810
808
u64 tos = intel_pmu_lbr_tos ();
811
809
int i ;
812
810
int out = 0 ;
@@ -878,15 +876,14 @@ void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
878
876
if (abort && x86_pmu .lbr_double_abort && out > 0 )
879
877
out -- ;
880
878
881
- cpuc -> lbr_entries [out ].from = from ;
882
- cpuc -> lbr_entries [out ].to = to ;
883
- cpuc -> lbr_entries [out ].mispred = mis ;
884
- cpuc -> lbr_entries [out ].predicted = pred ;
885
- cpuc -> lbr_entries [out ].in_tx = in_tx ;
886
- cpuc -> lbr_entries [out ].abort = abort ;
887
- cpuc -> lbr_entries [out ].cycles = cycles ;
888
- cpuc -> lbr_entries [out ].type = 0 ;
889
- cpuc -> lbr_entries [out ].reserved = 0 ;
879
+ perf_clear_branch_entry_bitfields (br + out );
880
+ br [out ].from = from ;
881
+ br [out ].to = to ;
882
+ br [out ].mispred = mis ;
883
+ br [out ].predicted = pred ;
884
+ br [out ].in_tx = in_tx ;
885
+ br [out ].abort = abort ;
886
+ br [out ].cycles = cycles ;
890
887
out ++ ;
891
888
}
892
889
cpuc -> lbr_stack .nr = out ;
@@ -951,6 +948,8 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc,
951
948
to = rdlbr_to (i , lbr );
952
949
info = rdlbr_info (i , lbr );
953
950
951
+ perf_clear_branch_entry_bitfields (e );
952
+
954
953
e -> from = from ;
955
954
e -> to = to ;
956
955
e -> mispred = get_lbr_mispred (info );
@@ -959,7 +958,6 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc,
959
958
e -> abort = !!(info & LBR_INFO_ABORT );
960
959
e -> cycles = get_lbr_cycles (info );
961
960
e -> type = get_lbr_br_type (info );
962
- e -> reserved = 0 ;
963
961
}
964
962
965
963
cpuc -> lbr_stack .nr = i ;
0 commit comments