From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Marciniszyn,
Mike" <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Dalessandro,
Dennis"
<dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] IB/hfi1: Fix a wrapping test (make it less strict)
Date: Wed, 25 Oct 2017 05:14:35 +0000 [thread overview]
Message-ID: <20171025051435.rz5dpmguey6c6d5b@mwanda> (raw)
In-Reply-To: <32E1700B9017364D9B60AED9960492BC3443EB1C-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
On Tue, Oct 24, 2017 at 07:54:40PM +0000, Marciniszyn, Mike wrote:
> > Subject: Re: [PATCH] IB/hfi1: Fix a wrapping test (make it less strict)
> >
> > 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.
> >
>
> I agree that this is an issue.
>
> My proposal:
> - Change s64 to u64 for ts and in timestamp in opa_hfi1_cong_log_event_internal
> - Change the calls:
> ktime_to_ns(ktime_get()) / 1024
> -- to --
> ktime_get_ns() / 1024
> - Change to use Jason's test from above with UINT_MAX
>
> Dan, we can do the patch or you can send a v2?
>
Can you do the patch and give me a Reported-by tag?
regards,
dan carpenter
prev parent reply other threads:[~2017-10-25 5:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 10:56 [PATCH] IB/hfi1: Fix a wrapping test (make it less strict) Dan Carpenter
2017-10-23 15:05 ` Doug Ledford
[not found] ` <1508771116.3325.0.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-23 17:57 ` Dennis Dalessandro
2017-10-23 18:33 ` Doug Ledford
2017-10-23 19:04 ` Jason Gunthorpe
2017-10-24 19:54 ` Marciniszyn, Mike
[not found] ` <32E1700B9017364D9B60AED9960492BC3443EB1C-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-10-24 20:02 ` Jason Gunthorpe
[not found] ` <20171024200216.GA15994-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-10-24 20:03 ` Marciniszyn, Mike
2017-10-25 5:27 ` Dan Carpenter
2017-10-25 5:14 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171025051435.rz5dpmguey6c6d5b@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox