Skip to contentSkip to conversation

RDMA/counter: Query a counter before release

PATCH Applied Leon Romanovsky 2 participants 2 messages Jun 21, 2020 – Jun 22, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/counter: Query a counter before release

From: Mark Zhang <[email protected]>

Query a dynamically-allocated counter before release it, to update it's hwcounters and log all of them into history data. Otherwise all values of these hwcounters will be lost.

Fixes f34a55e497e8 ("RDMA/core: Get sum value of all counters when perform a sysfs stat read")
---
 drivers/infiniband/core/counters.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/core/counters.c +3 -1
index 2257d7f7810f..738d1faf4bba 100644
@@ -202,7 +202,7 @@ static int __rdma_counter_unbind_qp(struct ib_qp *qp)
 	return ret;
 }
 
-static void counter_history_stat_update(const struct rdma_counter *counter)
+static void counter_history_stat_update(struct rdma_counter *counter)
 {
 	struct ib_device *dev = counter->device;
 	struct rdma_port_counter *port_counter;
@@ -212,6 +212,8 @@ static void counter_history_stat_update(const struct rdma_counter *counter)
 	if (!port_counter->hstats)
 		return;
 
+	rdma_counter_query_stats(counter);
+
 	for (i = 0; i < counter->stats->num_counters; i++)
 		port_counter->hstats->value[i] += counter->stats->value[i];
 }
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Leon Romanovsky

From: Mark Zhang <[email protected]>

Query a dynamically-allocated counter before release it, to update it's hwcounters and log all of them into history data. Otherwise all values of these hwcounters will be lost.

Quoted 7 lines
Fixes f34a55e497e8 ("RDMA/core: Get sum value of all counters when perform a sysfs stat read")
---
 drivers/infiniband/core/counters.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied to for-rc, thanks

Jason