Re: [PATCH] IB/hfi1: Fix a wrapping test (make it less strict)

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

 



On Mon, Oct 23, 2017 at 02:33:46PM -0400, Doug Ledford wrote:
> > > > @@ -3781,7 +3781,7 @@ static int
> > > > __subn_get_opa_hfi1_cong_log(struct
> > > > opa_smp *smp, u32 am,
> > > >   		 * required to wrap the counter are supposed to
> > > >   		 * be zeroed (CA10-49 IBTA, release 1.2.1, V1).
> > > >   		 */
> > > > -		if ((u64)(ts - cce->timestamp) > (2 * UINT_MAX))
> > > > +		if ((u64)(ts - cce->timestamp) > (2ULL *
> > > > UINT_MAX))

This is really weird looking. Both ts and cce->timestamp are s64, why
do the convoluted conversion to unsigned? And surely UINT_MAX is not
the right thing..

if ((ts - cce->timestamp)/2 > 0xFFFFFFFF)

?

ktime_get is defined to be monotonic, so ts - cce->timestamp should
never go negative.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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