diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2016-09-25 10:44:44 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-10-02 08:42:19 -0400 |
commit | af3674d62d3470c4573709c031e6b17f1f39c96b (patch) | |
tree | bb779f5bda5f27164f30084c8fb03b5057d969bb | |
parent | 2d01c37d7501decfdcee2ff7ef32a017b7276a34 (diff) |
IB/hfi1: Add new debugfs sdma_cpu_list file
Add a debugfs sdma_cpu_list file that can be used to examine the CPU to
sdma engine assignments for the whole device.
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Reviewed-by: Jianxin Xiong <jianxin.xiong@intel.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/hw/hfi1/debugfs.c | 38 | ||||
-rw-r--r-- | drivers/infiniband/hw/hfi1/sdma.c | 43 | ||||
-rw-r--r-- | drivers/infiniband/hw/hfi1/sdma.h | 2 |
3 files changed, 83 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c index 5e9be16f6cd3..632ba21759ab 100644 --- a/drivers/infiniband/hw/hfi1/debugfs.c +++ b/drivers/infiniband/hw/hfi1/debugfs.c | |||
@@ -933,6 +933,43 @@ static const struct counter_info port_cntr_ops[] = { | |||
933 | DEBUGFS_OPS("asic_flags", asic_flags_read, asic_flags_write), | 933 | DEBUGFS_OPS("asic_flags", asic_flags_read, asic_flags_write), |
934 | }; | 934 | }; |
935 | 935 | ||
936 | static void *_sdma_cpu_list_seq_start(struct seq_file *s, loff_t *pos) | ||
937 | { | ||
938 | if (*pos >= num_online_cpus()) | ||
939 | return NULL; | ||
940 | |||
941 | return pos; | ||
942 | } | ||
943 | |||
944 | static void *_sdma_cpu_list_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
945 | { | ||
946 | ++*pos; | ||
947 | if (*pos >= num_online_cpus()) | ||
948 | return NULL; | ||
949 | |||
950 | return pos; | ||
951 | } | ||
952 | |||
953 | static void _sdma_cpu_list_seq_stop(struct seq_file *s, void *v) | ||
954 | { | ||
955 | /* nothing allocated */ | ||
956 | } | ||
957 | |||
958 | static int _sdma_cpu_list_seq_show(struct seq_file *s, void *v) | ||
959 | { | ||
960 | struct hfi1_ibdev *ibd = (struct hfi1_ibdev *)s->private; | ||
961 | struct hfi1_devdata *dd = dd_from_dev(ibd); | ||
962 | loff_t *spos = v; | ||
963 | loff_t i = *spos; | ||
964 | |||
965 | sdma_seqfile_dump_cpu_list(s, dd, (unsigned long)i); | ||
966 | return 0; | ||
967 | } | ||
968 | |||
969 | DEBUGFS_SEQ_FILE_OPS(sdma_cpu_list); | ||
970 | DEBUGFS_SEQ_FILE_OPEN(sdma_cpu_list) | ||
971 | DEBUGFS_FILE_OPS(sdma_cpu_list); | ||
972 | |||
936 | void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd) | 973 | void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd) |
937 | { | 974 | { |
938 | char name[sizeof("port0counters") + 1]; | 975 | char name[sizeof("port0counters") + 1]; |
@@ -961,6 +998,7 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd) | |||
961 | DEBUGFS_SEQ_FILE_CREATE(ctx_stats, ibd->hfi1_ibdev_dbg, ibd); | 998 | DEBUGFS_SEQ_FILE_CREATE(ctx_stats, ibd->hfi1_ibdev_dbg, ibd); |
962 | DEBUGFS_SEQ_FILE_CREATE(qp_stats, ibd->hfi1_ibdev_dbg, ibd); | 999 | DEBUGFS_SEQ_FILE_CREATE(qp_stats, ibd->hfi1_ibdev_dbg, ibd); |
963 | DEBUGFS_SEQ_FILE_CREATE(sdes, ibd->hfi1_ibdev_dbg, ibd); | 1000 | DEBUGFS_SEQ_FILE_CREATE(sdes, ibd->hfi1_ibdev_dbg, ibd); |
1001 | DEBUGFS_SEQ_FILE_CREATE(sdma_cpu_list, ibd->hfi1_ibdev_dbg, ibd); | ||
964 | /* dev counter files */ | 1002 | /* dev counter files */ |
965 | for (i = 0; i < ARRAY_SIZE(cntr_ops); i++) | 1003 | for (i = 0; i < ARRAY_SIZE(cntr_ops); i++) |
966 | DEBUGFS_FILE_CREATE(cntr_ops[i].name, | 1004 | DEBUGFS_FILE_CREATE(cntr_ops[i].name, |
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c index 8cfa960a1a4a..fd39bcaa062d 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c | |||
@@ -1093,6 +1093,49 @@ static void sdma_rht_free(void *ptr, void *arg) | |||
1093 | kfree(rht_node); | 1093 | kfree(rht_node); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | /** | ||
1097 | * sdma_seqfile_dump_cpu_list() - debugfs dump the cpu to sdma mappings | ||
1098 | * @s: seq file | ||
1099 | * @dd: hfi1_devdata | ||
1100 | * @cpuid: cpu id | ||
1101 | * | ||
1102 | * This routine dumps the process to sde mappings per cpu | ||
1103 | */ | ||
1104 | void sdma_seqfile_dump_cpu_list(struct seq_file *s, | ||
1105 | struct hfi1_devdata *dd, | ||
1106 | unsigned long cpuid) | ||
1107 | { | ||
1108 | struct sdma_rht_node *rht_node; | ||
1109 | int i, j; | ||
1110 | |||
1111 | rht_node = rhashtable_lookup_fast(&dd->sdma_rht, &cpuid, | ||
1112 | sdma_rht_params); | ||
1113 | if (!rht_node) | ||
1114 | return; | ||
1115 | |||
1116 | seq_printf(s, "cpu%3lu: ", cpuid); | ||
1117 | for (i = 0; i < HFI1_MAX_VLS_SUPPORTED; i++) { | ||
1118 | if (!rht_node->map[i] || !rht_node->map[i]->ctr) | ||
1119 | continue; | ||
1120 | |||
1121 | seq_printf(s, " vl%d: [", i); | ||
1122 | |||
1123 | for (j = 0; j < rht_node->map[i]->ctr; j++) { | ||
1124 | if (!rht_node->map[i]->sde[j]) | ||
1125 | continue; | ||
1126 | |||
1127 | if (j > 0) | ||
1128 | seq_puts(s, ","); | ||
1129 | |||
1130 | seq_printf(s, " sdma%2d", | ||
1131 | rht_node->map[i]->sde[j]->this_idx); | ||
1132 | } | ||
1133 | seq_puts(s, " ]"); | ||
1134 | } | ||
1135 | |||
1136 | seq_puts(s, "\n"); | ||
1137 | } | ||
1138 | |||
1096 | /* | 1139 | /* |
1097 | * Free the indicated map struct | 1140 | * Free the indicated map struct |
1098 | */ | 1141 | */ |
diff --git a/drivers/infiniband/hw/hfi1/sdma.h b/drivers/infiniband/hw/hfi1/sdma.h index 93025f6ded15..56257ea3598f 100644 --- a/drivers/infiniband/hw/hfi1/sdma.h +++ b/drivers/infiniband/hw/hfi1/sdma.h | |||
@@ -1068,6 +1068,8 @@ ssize_t sdma_set_cpu_to_sde_map(struct sdma_engine *sde, const char *buf, | |||
1068 | size_t count); | 1068 | size_t count); |
1069 | int sdma_engine_get_vl(struct sdma_engine *sde); | 1069 | int sdma_engine_get_vl(struct sdma_engine *sde); |
1070 | void sdma_seqfile_dump_sde(struct seq_file *s, struct sdma_engine *); | 1070 | void sdma_seqfile_dump_sde(struct seq_file *s, struct sdma_engine *); |
1071 | void sdma_seqfile_dump_cpu_list(struct seq_file *s, struct hfi1_devdata *dd, | ||
1072 | unsigned long cpuid); | ||
1071 | 1073 | ||
1072 | #ifdef CONFIG_SDMA_VERBOSITY | 1074 | #ifdef CONFIG_SDMA_VERBOSITY |
1073 | void sdma_dumpstate(struct sdma_engine *); | 1075 | void sdma_dumpstate(struct sdma_engine *); |