Re: [PATCHv1] IB/rxe: Make counters thread safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 14, 2018 at 12:32:42AM -0600, Parav Pandit wrote:
> Current rxe device counters are not thread safe.
> When multiple QPs are used, they can be racy.
> Make them thread safe by making it atomic64.
>
> Fixes: 0b1e5b99a48b ("IB/rxe: Add port protocol stats")
> Signed-off-by: Parav Pandit <parav@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/sw/rxe/rxe_hw_counters.c | 2 +-
>  drivers/infiniband/sw/rxe/rxe_verbs.h       | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
> index 4a24895..636edb5 100644
> --- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c
> +++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
> @@ -62,7 +62,7 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,
>  		return -EINVAL;
>
>  	for (cnt = 0; cnt  < ARRAY_SIZE(rxe_counter_name); cnt++)
> -		stats->value[cnt] = dev->stats_counters[cnt];
> +		stats->value[cnt] = atomic64_read(&dev->stats_counters[cnt]);

atomic64_read receives atomic64_t as an input and not u64 as declared by stats_counters.
lib/atomic64.c:
	long long atomic64_read(const atomic64_t *v)

Thanks

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux