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

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

 




> -----Original Message-----
> From: Leon Romanovsky <leon@xxxxxxxxxx>
> Sent: Sunday, December 16, 2018 2:11 AM
> To: Parav Pandit <parav@xxxxxxxxxxxx>
> Cc: linux-rdma@xxxxxxxxxxxxxxx; jgg@xxxxxxxx; dledford@xxxxxxxxxx; Moni
> Shoua <monis@xxxxxxxxxxxx>
> Subject: Re: [PATCHv1] IB/rxe: Make counters thread safe
> 
> On Sun, Dec 16, 2018 at 07:19:45AM +0000, Parav Pandit wrote:
> >
> >
> > > -----Original Message-----
> > > From: Leon Romanovsky <leon@xxxxxxxxxx>
> > > Sent: Sunday, December 16, 2018 12:58 AM
> > > To: Parav Pandit <parav@xxxxxxxxxxxx>
> > > Cc: linux-rdma@xxxxxxxxxxxxxxx; jgg@xxxxxxxx; dledford@xxxxxxxxxx;
> > > Moni Shoua <monis@xxxxxxxxxxxx>
> > > Subject: Re: [PATCHv1] IB/rxe: Make counters thread safe
> > >
> > > 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.
> > I didn't follow  you. In this patch, in rxe_verbs.h stats_counters of the
> device is declared as atomic64_t.
> 
> What about stats->value[cnt]?
atomic64_read() returns long long which is 64-bit on 64-bit and 32-bit platform.
stats->value[cnt] is u64 which matches what atomic64_read() returns.




[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