diff options
| author | Mark Zhang <[email protected]> | 2020-06-21 11:00:00 +0000 |
|---|---|---|
| committer | Jason Gunthorpe <[email protected]> | 2020-06-22 17:36:56 +0000 |
| commit | c1d869d64a1955817c4d6fff08ecbbe8e59d36f8 (patch) | |
| tree | e35da3f31cf3d4cd4ef938ad8c5946a57c71c2c4 /drivers/infiniband/core/counters.c | |
| parent | RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() (diff) | |
| download | kernel-c1d869d64a1955817c4d6fff08ecbbe8e59d36f8.tar.gz kernel-c1d869d64a1955817c4d6fff08ecbbe8e59d36f8.zip | |
RDMA/counter: Query a counter before release
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")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Zhang <[email protected]>
Reviewed-by: Maor Gottlieb <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
Diffstat (limited to 'drivers/infiniband/core/counters.c')
| -rw-r--r-- | drivers/infiniband/core/counters.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c index 2257d7f7810f..738d1faf4bba 100644 --- a/drivers/infiniband/core/counters.c +++ b/drivers/infiniband/core/counters.c @@ -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]; } |
