@@ -3734,6 +3734,19 @@ EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1");
3734
3734
EVENT_ATTR_STR (cycles - ct , cycles_ct , "event=0x3c,in_tx=1,in_tx_cp=1" );
3735
3735
3736
3736
static struct attribute * hsw_events_attrs [] = {
3737
+ EVENT_PTR (mem_ld_hsw ),
3738
+ EVENT_PTR (mem_st_hsw ),
3739
+ EVENT_PTR (td_slots_issued ),
3740
+ EVENT_PTR (td_slots_retired ),
3741
+ EVENT_PTR (td_fetch_bubbles ),
3742
+ EVENT_PTR (td_total_slots ),
3743
+ EVENT_PTR (td_total_slots_scale ),
3744
+ EVENT_PTR (td_recovery_bubbles ),
3745
+ EVENT_PTR (td_recovery_bubbles_scale ),
3746
+ NULL
3747
+ };
3748
+
3749
+ static struct attribute * hsw_tsx_events_attrs [] = {
3737
3750
EVENT_PTR (tx_start ),
3738
3751
EVENT_PTR (tx_commit ),
3739
3752
EVENT_PTR (tx_abort ),
@@ -3746,18 +3759,16 @@ static struct attribute *hsw_events_attrs[] = {
3746
3759
EVENT_PTR (el_conflict ),
3747
3760
EVENT_PTR (cycles_t ),
3748
3761
EVENT_PTR (cycles_ct ),
3749
- EVENT_PTR (mem_ld_hsw ),
3750
- EVENT_PTR (mem_st_hsw ),
3751
- EVENT_PTR (td_slots_issued ),
3752
- EVENT_PTR (td_slots_retired ),
3753
- EVENT_PTR (td_fetch_bubbles ),
3754
- EVENT_PTR (td_total_slots ),
3755
- EVENT_PTR (td_total_slots_scale ),
3756
- EVENT_PTR (td_recovery_bubbles ),
3757
- EVENT_PTR (td_recovery_bubbles_scale ),
3758
3762
NULL
3759
3763
};
3760
3764
3765
+ static __init struct attribute * * get_hsw_events_attrs (void )
3766
+ {
3767
+ return boot_cpu_has (X86_FEATURE_RTM ) ?
3768
+ merge_attr (hsw_events_attrs , hsw_tsx_events_attrs ) :
3769
+ hsw_events_attrs ;
3770
+ }
3771
+
3761
3772
static ssize_t freeze_on_smi_show (struct device * cdev ,
3762
3773
struct device_attribute * attr ,
3763
3774
char * buf )
@@ -4186,7 +4197,7 @@ __init int intel_pmu_init(void)
4186
4197
4187
4198
x86_pmu .hw_config = hsw_hw_config ;
4188
4199
x86_pmu .get_event_constraints = hsw_get_event_constraints ;
4189
- x86_pmu .cpu_events = hsw_events_attrs ;
4200
+ x86_pmu .cpu_events = get_hsw_events_attrs () ;
4190
4201
x86_pmu .lbr_double_abort = true;
4191
4202
extra_attr = boot_cpu_has (X86_FEATURE_RTM ) ?
4192
4203
hsw_format_attr : nhm_format_attr ;
@@ -4225,7 +4236,7 @@ __init int intel_pmu_init(void)
4225
4236
4226
4237
x86_pmu .hw_config = hsw_hw_config ;
4227
4238
x86_pmu .get_event_constraints = hsw_get_event_constraints ;
4228
- x86_pmu .cpu_events = hsw_events_attrs ;
4239
+ x86_pmu .cpu_events = get_hsw_events_attrs () ;
4229
4240
x86_pmu .limit_period = bdw_limit_period ;
4230
4241
extra_attr = boot_cpu_has (X86_FEATURE_RTM ) ?
4231
4242
hsw_format_attr : nhm_format_attr ;
@@ -4283,7 +4294,7 @@ __init int intel_pmu_init(void)
4283
4294
extra_attr = boot_cpu_has (X86_FEATURE_RTM ) ?
4284
4295
hsw_format_attr : nhm_format_attr ;
4285
4296
extra_attr = merge_attr (extra_attr , skl_format_attr );
4286
- x86_pmu .cpu_events = hsw_events_attrs ;
4297
+ x86_pmu .cpu_events = get_hsw_events_attrs () ;
4287
4298
intel_pmu_pebs_data_source_skl (
4288
4299
boot_cpu_data .x86_model == INTEL_FAM6_SKYLAKE_X );
4289
4300
pr_cont ("Skylake events, " );
0 commit comments