drm/amdgpu: stop resetting xgmi perfmons on disable
Subsystems (2)
PATCH 1/6 drm/amdgpu: stop resetting xgmi perfmons on disable
Disabling perf events does not specify reset in ABI so stop doing it in hardware.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_df.h | 4 ++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_df.h +2 -2
@@ -44,9 +44,9 @@ struct amdgpu_df_funcs {void (*enable_ecc_force_par_wr_rmw)(struct amdgpu_device *adev,bool enable);int (*pmc_start)(struct amdgpu_device *adev,uint64_t config, -int is_enable); +int is_add);int (*pmc_stop)(struct amdgpu_device *adev,uint64_t config, -int is_disable); +int is_remove);void (*pmc_get_count)(struct amdgpu_device *adev,uint64_t config,uint64_t *count);uint64_t (*get_fica)(struct amdgpu_device *adev,uint32_t ficaa_val);
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +14 -9
@@ -455,7 +455,8 @@ static int df_v3_6_pmc_get_ctrl_settings(struct amdgpu_device *adev,uint32_t *lo_base_addr, uint32_t *hi_base_addr, uint32_t *lo_val, - uint32_t *hi_val) + uint32_t *hi_val, + bool is_enable) { uint32_t eventsel, instance, unitmask;
@@ -477,7 +478,8 @@ static int df_v3_6_pmc_get_ctrl_settings(struct amdgpu_device *adev, instance_5432 = (instance >>2 ) &0xf ; instance_76 = (instance >>6 ) &0x3 ; - *lo_val = (unitmask <<8 ) | (instance_10 <<6 ) | eventsel | (1 <<22 ); + *lo_val = (unitmask <<8 ) | (instance_10 <<6 ) | eventsel; + *lo_val = is_enable ? *lo_val | (1 <<22 ) : *lo_val & ~(1 <<22 ); *hi_val = (instance_76 <<29 ) | instance_5432; DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x:%08x",
@@ -572,14 +574,14 @@ static void df_v3_6_reset_perfmon_cntr(struct amdgpu_device *adev, }static int df_v3_6_pmc_start (struct amdgpu_device *adev,uint64_t config, -int is_enable) +int is_add) {uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val;int err =0 , ret =0 ;switch (adev->asic_type) {case CHIP_VEGA20 : -if (is_enable) +if (is_add)return df_v3_6_pmc_add_cntr (adev, config);df_v3_6_reset_perfmon_cntr (adev, config);
@@ -589,7 +591,8 @@ static int df_v3_6_pmc_start(struct amdgpu_device *adev, uint64_t config, &lo_base_addr, &hi_base_addr, &lo_val, - &hi_val); + &hi_val, + true);if (ret)return ret;
@@ -612,7 +615,7 @@ static int df_v3_6_pmc_start(struct amdgpu_device *adev, uint64_t config, }static int df_v3_6_pmc_stop (struct amdgpu_device *adev,uint64_t config, -int is_disable) +int is_remove) {uint32_t lo_base_addr, hi_base_addr, lo_val, hi_val;int ret =0 ;
@@ -624,15 +627,17 @@ static int df_v3_6_pmc_stop(struct amdgpu_device *adev, uint64_t config, &lo_base_addr, &hi_base_addr, &lo_val, - &hi_val); + &hi_val, + false);if (ret)return ret; -df_v3_6_reset_perfmon_cntr (adev, config); -if (is_disable) +if (is_remove) { +df_v3_6_reset_perfmon_cntr (adev, config);df_v3_6_pmc_release_cntr (adev, config); + }break ;default :
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/6 drm/amdgpu: fix xgmi perfmon a-b-a problem
Mapping hw counters per event config will cause ABA problems so map per event instead.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_df.h | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 23 ++++-- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 104 +++++++++++------------- 3 files changed, 65 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_df.h +3 -3
@@ -44,11 +44,11 @@ struct amdgpu_df_funcs {void (*enable_ecc_force_par_wr_rmw)(struct amdgpu_device *adev,bool enable);int (*pmc_start)(struct amdgpu_device *adev,uint64_t config, -int is_add); +int counter_idx,int is_add);int (*pmc_stop)(struct amdgpu_device *adev,uint64_t config, -int is_remove); +int counter_idx,int is_remove);void (*pmc_get_count)(struct amdgpu_device *adev,uint64_t config, -uint64_t *count); +int counter_idx,uint64_t *count);uint64_t (*get_fica)(struct amdgpu_device *adev,uint32_t ficaa_val);void (*set_fica)(struct amdgpu_device *adev,uint32_t ficaa_val,uint32_t ficadl_val,uint32_t ficadh_val);
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +16 -7
@@ -74,9 +74,11 @@ static void amdgpu_perf_start(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF :if (!(flags &PERF_EF_RELOAD )) - pe->adev->df.funcs->pmc_start (pe->adev, hwc->config,1 ); + pe->adev->df.funcs->pmc_start (pe->adev, hwc->config, + hwc->idx,1 ); - pe->adev->df.funcs->pmc_start (pe->adev, hwc->config,0 ); + pe->adev->df.funcs->pmc_start (pe->adev, hwc->config, + hwc->idx,0 );break ;default :break ;
@@ -101,8 +103,8 @@ static void amdgpu_perf_read(struct perf_event *event)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : - pe->adev->df.funcs->pmc_get_count (pe->adev, hwc->config, - &count); + pe->adev->df.funcs->pmc_get_count (pe->adev, + hwc->config, hwc->idx, &count);break ;default : count =0 ;
@@ -126,7 +128,8 @@ static void amdgpu_perf_stop(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : - pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config,0 ); + pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config, hwc->idx, +0 );break ;default :break ;
@@ -157,7 +160,12 @@ static int amdgpu_perf_add(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : retval = pe->adev->df.funcs->pmc_start (pe->adev, - hwc->config,1 ); + hwc->config, hwc->idx,1 ); +if (retval >=0 ) { + hwc->idx = retval; + retval =0 ; + } +break ;default :return 0 ;
@@ -185,7 +193,8 @@ static void amdgpu_perf_del(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : - pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config,1 ); + pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config, hwc->idx, +1 );break ;default :break ;
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +46 -58
250 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/6 drm/amdgpu: make df defines private and change counter report
In reply to Jonathan KimDF public defines should not be used outside of DF IP version so make them private.
Also, users do not care about the number of available programmable hardware counters so report the number of events available instead.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/df_v3_6.h | 9 --------- 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +4 -4
@@ -30,6 +30,7 @@#include "df_v3_6.h" #define PMU_NAME_SIZE 32 +#define NUM_EVENTS_DF_VEGA20 8/* record to keep track of pmu entry per pmu type per device */ struct amdgpu_pmu_entry {
@@ -41,7 +42,6 @@ struct amdgpu_pmu_entry {static LIST_HEAD (amdgpu_pmu_list); -/* initialize perf counter */ static int amdgpu_perf_event_init (struct perf_event *event) {
@@ -210,7 +210,7 @@ static int init_pmu_by_type(struct amdgpu_device *adev,const struct attribute_group *attr_groups[], char *pmu_type_name, char *pmu_file_prefix, unsigned int pmu_perf_type, - unsigned int num_counters) + unsigned int num_events) { char pmu_name[PMU_NAME_SIZE];struct amdgpu_pmu_entry *pmu_entry;
@@ -246,7 +246,7 @@ static int init_pmu_by_type(struct amdgpu_device *adev, }pr_info ("Detected AMDGPU %s Counters. # of Counters = %d.\n" , - pmu_type_name, num_counters); + pmu_type_name, num_events);list_add_tail (&pmu_entry->entry, &amdgpu_pmu_list);
@@ -263,7 +263,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)/* init df */ ret =init_pmu_by_type (adev, df_v3_6_attr_groups,"DF" ,"amdgpu_df" ,PERF_TYPE_AMDGPU_DF , -DF_V3_6_MAX_COUNTERS ); +NUM_EVENTS_DF_VEGA20 );/* other pmu types go here*/ break ;
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +9 -0
@@ -30,6 +30,15 @@#define DF_3_6_SMN_REG_INST_DIST 0x8#define DF_3_6_INST_CNT 8 +/* Defined in global_features.h as FTI_PERFMON_VISIBLE */ +#define DF_V3_6_MAX_COUNTERS 4 + +/* get flags from df perfmon config */ +#define DF_V3_6_GET_EVENT (x) (x & 0xFFUL) +#define DF_V3_6_GET_INSTANCE (x) ((x >> 8) & 0xFFUL) +#define DF_V3_6_GET_UNITMASK (x) ((x >> 16) & 0xFFUL) +#define DF_V3_6_PERFMON_OVERFLOW 0xFFFFFFFFFFFFULL +static u32 df_v3_6_channel_number[] = {1 ,2 ,0 ,4 ,0 ,8 ,0 ,16 ,32 ,0 ,0 ,0 ,2 ,4 ,8 };
drivers/gpu/drm/amd/amdgpu/df_v3_6.h +0 -9
@@ -35,15 +35,6 @@ enum DF_V3_6_MGCG { DF_V3_6_MGCG_ENABLE_63_CYCLE_DELAY = 15 }; -/* Defined in global_features.h as FTI_PERFMON_VISIBLE */ -#define DF_V3_6_MAX_COUNTERS 4 - -/* get flags from df perfmon config */ -#define DF_V3_6_GET_EVENT (x) (x & 0xFFUL) -#define DF_V3_6_GET_INSTANCE (x) ((x >> 8) & 0xFFUL) -#define DF_V3_6_GET_UNITMASK (x) ((x >> 16) & 0xFFUL) -#define DF_V3_6_PERFMON_OVERFLOW 0xFFFFFFFFFFFFULL -extern const struct attribute_group *df_v3_6_attr_groups[];extern const struct amdgpu_df_funcs df_v3_6_funcs;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/6 drm/amdgpu: cleanup pmu
In reply to Jonathan KimSwitch from marcros to helper that builds events per chip. Also abstract IP events from version since they can bind to chip instead.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 13 --- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 108 +++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 63 -------------- 3 files changed, 95 insertions(+), 89 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -13
@@ -1265,19 +1265,6 @@ void amdgpu_unregister_gpu_instance(struct amdgpu_device *adev);#include "amdgpu_object.h" -/* used by df_v3_6.c and amdgpu_pmu.c */ -#define AMDGPU_PMU_ATTR (_name, _object) \ -static ssize_t \ -_name##_show(struct device *dev, \ - struct device_attribute *attr, \ - char *page) \ -{ \ - BUILD_BUG_ON(sizeof(_object) >= PAGE_SIZE - 1); \ - return sprintf(page, _object "\n"); \ -} \ - \ -static struct device_attribute pmu_attr_##_name = __ATTR_RO(_name) -static inline bool amdgpu_is_tmz (struct amdgpu_device *adev) {return adev->gmc.tmz_enabled;
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +95 -13
163 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +0 -63
69 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/6 drm/amdgpu: add user friendly xgmi events
In reply to Jonathan KimNon-outbound data is useless for throughput metrics. Add human readable events and note deprecated events. New events are now per-device and not per-device-per-ip.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 38 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.h | 1 + 2 files changed, 39 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +38 -0
@@ -31,6 +31,7 @@#define PMU_NAME_SIZE 32#define NUM_FORMATS_DF_VEGA20 3#define NUM_EVENTS_DF_VEGA20 8 +#define NUM_EVENTS_XGMI_VEGA20 2/* record to keep track of pmu entry per pmu type per device */ struct amdgpu_pmu_entry {
@@ -52,18 +53,33 @@ static struct attribute_group df_vega20_event_attr_group = { .attrs = NULL }; +static struct attribute_group xgmi_vega20_event_attr_group = { + .name ="events" , + .attrs =NULL +}; +const struct attribute_group *df_vega20_attr_groups[] = { &df_vega20_format_attr_group, &df_vega20_event_attr_group,NULL }; +const struct attribute_group *xgmi_vega20_attr_groups[] = { + &df_vega20_format_attr_group, + &xgmi_vega20_event_attr_group, +NULL +}; +static const char *df_vega20_formats[NUM_FORMATS_DF_VEGA20 ][2 ] = { {"event" ,"config:0-7" }, {"instance" ,"config:8-15" }, {"umask" ,"config:16-23" } }; +/* +* DF events for xGMI - DEPRECATED. +* Potential for non-xgmi DF counters in the future. +*/ static const char *df_vega20_events[NUM_EVENTS_DF_VEGA20 ][2 ] = { {"cake0_pcsout_txdata" ,"event=0x7,instance=0x46,umask=0x2" }, {"cake1_pcsout_txdata" ,"event=0x7,instance=0x47,umask=0x2" },
@@ -75,6 +91,11 @@ static const char *df_vega20_events[NUM_EVENTS_DF_VEGA20][2] = { { "cake1_ftiinstat_rspalloc", "event=0xb,instance=0x47,umask=0x8" }, }; +static const char *xgmi_vega20_events[NUM_EVENTS_XGMI_VEGA20 ][2 ] = { + {"xgmi_link0_data_outbound" ,"event=0x7,instance=0x46,umask=0x2" }, + {"xgmi_link1_data_outbound" ,"event=0x7,instance=0x47,umask=0x2" } +}; +/* initialize perf counter */ static int amdgpu_perf_event_init (struct perf_event *event) {
@@ -106,6 +127,7 @@ static void amdgpu_perf_start(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI :if (!(flags &PERF_EF_RELOAD )) pe->adev->df.funcs->pmc_start (pe->adev, hwc->config, hwc->idx,1 );
@@ -136,6 +158,7 @@ static void amdgpu_perf_read(struct perf_event *event)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_get_count (pe->adev, hwc->config, hwc->idx, &count);break ;
@@ -161,6 +184,7 @@ static void amdgpu_perf_stop(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config, hwc->idx,0 );break ;
@@ -192,6 +216,7 @@ static int amdgpu_perf_add(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : retval = pe->adev->df.funcs->pmc_start (pe->adev, hwc->config, hwc->idx,1 );if (retval >=0 ) {
@@ -226,6 +251,7 @@ static void amdgpu_perf_del(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_stop (pe->adev, hwc->config, hwc->idx,1 );break ;
@@ -346,6 +372,18 @@ int amdgpu_pmu_init(struct amdgpu_device *adev) df_vega20_events, &df_vega20_event_attr_group, NUM_EVENTS_DF_VEGA20); +if (ret) +break ; + +/* init xgmi */ + ret =init_pmu_by_type (adev, xgmi_vega20_attr_groups, +"XGMI" ,"amdgpu" ,PERF_TYPE_AMDGPU_XGMI , + df_vega20_formats, + &df_vega20_format_attr_group, +NUM_FORMATS_DF_VEGA20 , + xgmi_vega20_events, + &xgmi_vega20_event_attr_group, +NUM_EVENTS_XGMI_VEGA20 );/* other pmu types go here*/ break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.h +1 -0
@@ -28,6 +28,7 @@enum amdgpu_pmu_perf_type {PERF_TYPE_AMDGPU_DF =0 , +PERF_TYPE_AMDGPU_XGMI ,PERF_TYPE_AMDGPU_MAX };
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/6 drm/amdgpu: add xgmi perfmons for arcturus
In reply to Jonathan KimAdd xgmi perfmons for Arcturus.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 32 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 3 +++ 2 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +32 -0
@@ -32,6 +32,7 @@#define NUM_FORMATS_DF_VEGA20 3#define NUM_EVENTS_DF_VEGA20 8#define NUM_EVENTS_XGMI_VEGA20 2 +#define NUM_EVENTS_XGMI_ARCTURUS 6/* record to keep track of pmu entry per pmu type per device */ struct amdgpu_pmu_entry {
@@ -58,6 +59,11 @@ static struct attribute_group xgmi_vega20_event_attr_group = { .attrs = NULL }; +static struct attribute_group xgmi_arcturus_event_attr_group = { + .name ="events" , + .attrs =NULL +}; +const struct attribute_group *df_vega20_attr_groups[] = { &df_vega20_format_attr_group, &df_vega20_event_attr_group,
@@ -70,6 +76,12 @@ const struct attribute_group *xgmi_vega20_attr_groups[] = {NULL }; +const struct attribute_group *xgmi_arcturus_attr_groups[] = { + &df_vega20_format_attr_group, + &xgmi_arcturus_event_attr_group, +NULL +}; +static const char *df_vega20_formats[NUM_FORMATS_DF_VEGA20 ][2 ] = { {"event" ,"config:0-7" }, {"instance" ,"config:8-15" },
@@ -96,6 +108,15 @@ static const char *xgmi_vega20_events[NUM_EVENTS_XGMI_VEGA20][2] = { { "xgmi_link1_data_outbound", "event=0x7,instance=0x47,umask=0x2" } }; +static const char *xgmi_arcturus_events[NUM_EVENTS_XGMI_ARCTURUS ][2 ] = { + {"xgmi_link0_data_outbound" ,"event=0x7,instance=0x4b,umask=0x2" }, + {"xgmi_link1_data_outbound" ,"event=0x7,instance=0x4c,umask=0x2" }, + {"xgmi_link2_data_outbound" ,"event=0x7,instance=0x4d,umask=0x2" }, + {"xgmi_link3_data_outbound" ,"event=0x7,instance=0x4e,umask=0x2" }, + {"xgmi_link4_data_outbound" ,"event=0x7,instance=0x4f,umask=0x2" }, + {"xgmi_link5_data_outbound" ,"event=0x7,instance=0x50,umask=0x2" } +}; +/* initialize perf counter */ static int amdgpu_perf_event_init (struct perf_event *event) {
@@ -387,6 +408,17 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)/* other pmu types go here*/ break ; +case CHIP_ARCTURUS : +/* init xgmi */ + ret =init_pmu_by_type (adev, xgmi_arcturus_attr_groups, +"XGMI" ,"amdgpu" ,PERF_TYPE_AMDGPU_XGMI , + df_vega20_formats, + &df_vega20_format_attr_group, +NUM_FORMATS_DF_VEGA20 , + xgmi_arcturus_events, + &xgmi_arcturus_event_attr_group, +NUM_EVENTS_XGMI_ARCTURUS ); +break ;default :return 0 ; }
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +3 -0
@@ -512,6 +512,7 @@ static int df_v3_6_pmc_start(struct amdgpu_device *adev, uint64_t config,switch (adev->asic_type) {case CHIP_VEGA20 : +case CHIP_ARCTURUS :if (is_add)return df_v3_6_pmc_add_cntr (adev, config);
@@ -553,6 +554,7 @@ static int df_v3_6_pmc_stop(struct amdgpu_device *adev, uint64_t config,switch (adev->asic_type) {case CHIP_VEGA20 : +case CHIP_ARCTURUS : ret = df_v3_6_pmc_get_ctrl_settings(adev, config, counter_idx,
@@ -589,6 +591,7 @@ static void df_v3_6_pmc_get_count(struct amdgpu_device *adev,switch (adev->asic_type) {case CHIP_VEGA20 : +case CHIP_ARCTURUS :df_v3_6_pmc_get_read_settings (adev, config, counter_idx, &lo_base_addr, &hi_base_addr);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 5/6] drm/amdgpu: add user friendly xgmi events
In reply to Jonathan Kim[AMD Official Use Only - Internal Distribution Only]
Please ignore patches 5 & 6. We'll run into EEXIST if future non xgmi counters are added to amdgpu_x this way.
Quoted 163 lines
-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Thursday, September 3, 2020 12:22 PM
To: [email protected]
Cc: Kuehling, Felix <[email protected]>; Kim, Jonathan <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH 5/6] drm/amdgpu: add user friendly xgmi eventsNon-outbound data is useless for throughput metrics. Add human readable events and note deprecated events. New events are now per-device and not per-device-per-ip.
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 38 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.h | 1 + 2 files changed, 39 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +1
-0@@ -31,6 +31,7 @@#define PMU_NAME_SIZE 32#define NUM_FORMATS_DF_VEGA203 #define NUM_EVENTS_DF_VEGA208 +#define NUM_EVENTS_XGMI_VEGA202 /* record to keep track of pmu entry per pmu type per device */ struct
amdgpu_pmu_entry{ @@ -52,18 +53,33 @@ static structattribute_groupdf_vega20_event_attr_group= {
.attrs = NULL
};drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +18
-0+static struct attribute_group xgmi_vega20_event_attr_group = { +.name ="events" , +.attrs =NULL +}; +const struct attribute_group *df_vega20_attr_groups[] = { &df_vega20_format_attr_group, &df_vega20_event_attr_group,NULL }; +const struct attribute_group *xgmi_vega20_attr_groups[] = { +&df_vega20_format_attr_group, +&xgmi_vega20_event_attr_group, +NULL +}; +static const char *df_vega20_formats[NUM_FORMATS_DF_VEGA20 ][2 ] = { {"event" ,"config:0-7" }, {"instance" ,"config:8-15" }, {"umask" ,"config:16-23" } }; +/* +* DF events for xGMI - DEPRECATED. +* Potential for non-xgmi DF counters in the future. +*/ static const char *df_vega20_events[NUM_EVENTS_DF_VEGA20 ][2 ] = { {"cake0_pcsout_txdata" ,"event=0x7,instance=0x46,umask=0x2" }, {"cake1_pcsout_txdata" ,"event=0x7,instance=0x47,umask=0x2" },@@ -75,6 +91,11 @@ static const char *df_vega20_events[NUM_EVENTS_DF_VEGA20][2] = { { "cake1_ftiinstat_rspalloc", "event=0xb,instance=0x47,umask=0x8" }, }; +static const char *xgmi_vega20_events[NUM_EVENTS_XGMI_VEGA20 ][2 ] = { +{"xgmi_link0_data_outbound" ,"event=0x7,instance=0x46,umask=0x2" }, +{"xgmi_link1_data_outbound" ,"event=0x7,instance=0x47,umask=0x2" } };
+
/* initialize perf counter */
static intamdgpu_perf_event_init(struct perf_event *event){ @@ -106,6
+127,7 @@ static voidamdgpu_perf_start(struct perf_event *event, int flags)switch (
pe->pmu_perf_type) {
casePERF_TYPE_AMDGPU_DF:
+casePERF_TYPE_AMDGPU_XGMI:
if (!(flags &PERF_EF_RELOAD))
pe->adev->df.funcs->pmc_start(pe->adev, hwc-Quoted 1 line
config,
hwc->idx, 1);drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +1
-0@@ -136,6 +158,7 @@ static void amdgpu_perf_read(struct perf_event *event)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_get_count(pe->adev, hwc->config, hwc->idx,&count);
break;drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +1
-0@@ -161,6 +184,7 @@ static void amdgpu_perf_stop(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, hwc- >idx,0);
break;drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +1
-0@@ -192,6 +216,7 @@ static int amdgpu_perf_add(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : retval = pe->adev->df.funcs->pmc_start (pe->adev, hwc->config, hwc->idx,1 );if (retval >= 0) {
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +1
-0@@ -226,6 +251,7 @@ static void amdgpu_perf_del(struct perf_event *event, int flags)switch (pe->pmu_perf_type) {case PERF_TYPE_AMDGPU_DF : +case PERF_TYPE_AMDGPU_XGMI : pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, hwc- >idx,1);
break;drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c +12
-0@@ -346,6 +372,18 @@ int amdgpu_pmu_init(struct amdgpu_device *adev) df_vega20_events, &df_vega20_event_attr_group, NUM_EVENTS_DF_VEGA20); +if (ret) +break ; + +/* init xgmi */ +ret =init_pmu_by_type (adev, xgmi_vega20_attr_groups, +"XGMI" ,"amdgpu" ,PERF_TYPE_AMDGPU_XGMI , +df_vega20_formats, +&df_vega20_format_attr_group, +NUM_FORMATS_DF_VEGA20 , +xgmi_vega20_events, +&xgmi_vega20_event_attr_group, +NUM_EVENTS_XGMI_VEGA20 );/* other pmu types go here*/ break;
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.h +1
-1@@ -28,6 +28,7 @@enum amdgpu_pmu_perf_type {PERF_TYPE_AMDGPU_DF =0 , +PERF_TYPE_AMDGPU_XGMI ,PERF_TYPE_AMDGPU_MAX }; --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx