Skip to contentSkip to conversation

Global per-type support for QP counters

PATCH Applied Leon Romanovsky 2 participants 5 messages Aug 4, 2020 – Aug 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Global per-type support for QP counters

From: Leon Romanovsky <[email protected]>

Changelog:
* Update first patch to latest rdma_netlink.h file.
* Drop RFC, the kernel part was accepted.
https://lore.kernel.org/linux-rdma/[email protected]

---------------------------------------------------

Hi,

This is complimentary part of kernel series [1] that extends netlink interface to allow automatic binding of QP counters based on their type, in very similar manner to already existing per-PID ability.

Thanks

[1] https://lore.kernel.org/lkml/[email protected]

Mark Zhang (3):
rdma: update uapi headers
rdma: Add "PID" criteria support for statistic counter auto mode
rdma: Document the new "pid" criteria for auto mode

 man/man8/rdma-statistic.8             | 23 +++++--
 rdma/include/uapi/rdma/rdma_netlink.h |  9 +--
 rdma/res-cmid.c                       |  6 --
 rdma/res.c                            |  6 ++
 rdma/res.h                            |  2 +-
 rdma/stat.c                           | 95 ++++++++++++++++++++-------
 6 files changed, 102 insertions(+), 39 deletions(-)

--
2.26.2

#1 lore raw

PATCH 1/3 rdma: update uapi headers

From: Mark Zhang <[email protected]>

Update rdma_netlink.h file upto kernel commit 76251e15ea73 ("RDMA/counter: Add PID category support in auto mode")

---
 rdma/include/uapi/rdma/rdma_netlink.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
rdma/include/uapi/rdma/rdma_netlink.h +5 -4
index fe127b88..4aef76ae 100644
@@ -287,11 +287,11 @@ enum rdma_nldev_command {
 
 	RDMA_NLDEV_CMD_STAT_DEL,
 
-	RDMA_NLDEV_CMD_RES_QP_GET_RAW, /* can dump */
+	RDMA_NLDEV_CMD_RES_QP_GET_RAW,
 
-	RDMA_NLDEV_CMD_RES_CQ_GET_RAW, /* can dump */
+	RDMA_NLDEV_CMD_RES_CQ_GET_RAW,
 
-	RDMA_NLDEV_CMD_RES_MR_GET_RAW, /* can dump */
+	RDMA_NLDEV_CMD_RES_MR_GET_RAW,
 
 	RDMA_NLDEV_NUM_OPS
 };
@@ -531,7 +531,7 @@ enum rdma_nldev_attr {
 	 */
 	RDMA_NLDEV_ATTR_DEV_DIM,                /* u8 */
 
-	RDMA_NLDEV_ATTR_RES_RAW,                /* binary */
+	RDMA_NLDEV_ATTR_RES_RAW,	/* binary */
 
 	/*
 	 * Always the end
@@ -569,5 +569,6 @@ enum rdma_nl_counter_mode {
  */
 enum rdma_nl_counter_mask {
 	RDMA_COUNTER_MASK_QP_TYPE = 1,
+	RDMA_COUNTER_MASK_PID = 1 << 1,
 };
 #endif /* _RDMA_NETLINK_H */
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/3 rdma: Add "PID" criteria support for statistic counter auto mode

In reply to Leon Romanovsky

From: Mark Zhang <[email protected]>

With this new criteria, QPs have different PIDs will be bound to different counters in auto mode. This can be used in combination with other criteria like "type". Examples:

$ rdma statistic qp set link mlx5_2/1 auto pid on
$ rdma statistic qp set link mlx5_2/1 auto type,pid on
$ rdma statistic qp set link mlx5_2/1 auto off
$ rdma statistic qp show link mlx5_0 qp-type UD
---
 rdma/res-cmid.c |  6 ----
 rdma/res.c      |  6 ++++
 rdma/res.h      |  2 +-
 rdma/stat.c     | 95 ++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 78 insertions(+), 31 deletions(-)
rdma/res-cmid.c +0 -6
index f167800f..bfaa47b5 100644
@@ -7,12 +7,6 @@
 #include "res.h"
 #include <inttypes.h>
 
-static void print_qp_type(struct rd *rd, uint32_t val)
-{
-	print_color_string(PRINT_ANY, COLOR_NONE, "qp-type", "qp-type %s ",
-			   qp_types_to_str(val));
-}
-
 static const char *cm_id_state_to_str(uint8_t idx)
 {
 	static const char *const cm_id_states_str[] = {
rdma/res.c +6 -0
index 251f5041..c99a1fcb 100644
@@ -179,6 +179,12 @@ void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
 		print_color_uint(PRINT_ANY, COLOR_NONE, "port", "%u ", port);
 }
 
+void print_qp_type(struct rd *rd, uint32_t val)
+{
+	print_color_string(PRINT_ANY, COLOR_NONE, "qp-type", "qp-type %s ",
+			   qp_types_to_str(val));
+}
+
 char *get_task_name(uint32_t pid)
 {
 	char *comm;
rdma/res.h +1 -1
index 70ce5758..707941da 100644
@@ -165,5 +165,5 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
 		    struct nlattr *nlattr);
 void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line);
 const char *qp_types_to_str(uint8_t idx);
-
+void print_qp_type(struct rd *rd, uint32_t val);
 #endif /* _RDMA_TOOL_RES_H_ */
rdma/stat.c +71 -24

152 lines not on this page · raw message

Signature · 1 line
2.26.2
#3 lore raw

PATCH 3/3 rdma: Document the new "pid" criteria for auto mode

In reply to Leon Romanovsky

From: Mark Zhang <[email protected]>

Document the new supported criteria of auto mode. Examples:

$ rdma statistic qp set link mlx5_2/1 auto pid on
$ rdma statistic qp set link mlx5_2/1 auto pid,type on
---
 man/man8/rdma-statistic.8 | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
man/man8/rdma-statistic.8 +19 -4
index 7de495c9..7160bcdf 100644
@@ -68,11 +68,11 @@ rdma-statistic \- RDMA statistic counter configuration
 
 .ti -8
 .IR CRITERIA " := "
-.RB "{ " type " }"
+.RB "{ " type " | " pid " }"
 
 .ti -8
 .IR FILTER_NAME " := "
-.RB "{ " cntn " | " lqpn " | " pid " }"
+.RB "{ " cntn " | " lqpn " | " pid " | " qp-type " }"
 
 .SH "DESCRIPTION"
 .SS rdma statistic [object] show - Queries the specified RDMA device for RDMA and driver-specific statistics. Show the default hw counters if object is not specified
@@ -88,7 +88,7 @@ rdma-statistic \- RDMA statistic counter configuration
 - specifies a filter to show only the results matching it.
 
 .SS rdma statistic <object> set - configure counter statistic auto-mode for a specific device/port
-In auto mode all objects belong to one category are bind automatically to a single counter set. Not applicable for MR's.
+In auto mode all objects belong to one category are bind automatically to a single counter set. The "off" is global for all auto modes together. Not applicable for MR's.
 
 .SS rdma statistic <object> bind - manually bind an object (e.g., a qp) with a counter
 When bound the statistics of this object are available in this counter. Not applicable for MR's.
@@ -127,6 +127,11 @@ rdma statistic qp show link mlx5_2 pid 30489
 Shows the state of all qp counters of specified RDMA port and belonging to pid 30489
 .RE
 .PP
+rdma statistic qp show link mlx5_2 qp-type UD
+.RS 4
+Shows the state of all qp counters of specified RDMA port and with QP type UD
+.RE
+.PP
 rdma statistic qp mode
 .RS 4
 List current counter mode on all devices
@@ -139,7 +144,17 @@ List current counter mode of device mlx5_2 port 1
 .PP
 rdma statistic qp set link mlx5_2/1 auto type on
 .RS 4
-On device mlx5_2 port 1, for each new QP bind it with a counter automatically. Per counter for QPs with same qp type in each process. Currently only "type" is supported.
+On device mlx5_2 port 1, for each new user QP bind it with a counter automatically. Per counter for QPs with same qp type.
+.RE
+.PP
+rdma statistic qp set link mlx5_2/1 auto pid on
+.RS 4
+On device mlx5_2 port 1, for each new user QP bind it with a counter automatically. Per counter for QPs with same pid.
+.RE
+.PP
+rdma statistic qp set link mlx5_2/1 auto pid,type on
+.RS 4
+On device mlx5_2 port 1, for each new user QP bind it with a counter automatically. Per counter for QPs with same pid and same type.
 .RE
 .PP
 rdma statistic qp set link mlx5_2/1 auto off
Signature · 1 line
2.26.2