public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Cc: 'Hariprasad Shenai'
	<hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	leedom-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org,
	nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH for-4.1 2/2] iw_cxgb4: support for bar2 qid densities exceeding the page size
Date: Tue, 09 Jun 2015 10:25:18 -0400	[thread overview]
Message-ID: <1433859918.90034.25.camel@redhat.com> (raw)
In-Reply-To: <003f01d0a2bf$377ac3b0$a6704b10$@opengridcomputing.com>

[-- Attachment #1: Type: text/plain, Size: 2000 bytes --]

On Tue, 2015-06-09 at 09:18 -0500, Steve Wise wrote:
> 

> > > > Why are you using a cast here at all?  bar2_pa is already u64...
> > > >
> > >
> > > So it should just have the (uintptr_t) cast?
> > 
> > No, it should be no cast at all.  The uintptr_t cast is only for casting
> > an int->ptr or ptr->int.  In those cases, if the size of an int != size
> > of ptr, you can loose data, and uintptr_t tells the compiler "I know I'm
> > casting between possibly lossy data sizes and either A) I've checked and
> > it's OK or B) I'm ok with ptr truncation and the loss won't hurt us".
> > It basically turns off size checks when sticking a ptr into an int.  You
> > should therefore use it only in those circumstances.  For example, when
> > storing a cookie that doesn't have a strict uniqueness requirement, the
> > loss due to truncation is probably OK.  Or if you know you are only
> > doing something like initially storing an int into a pointer, and then
> > later storing that pointer back into an int, so there can never be any
> > truncation because the source of the ptr was always int sized.  Those
> > are the times to use uintptr.  In this case, you have a real u64 going
> > into a real u64, there should be no casts.
> >
> 
> My bad.  I thought bar2_pa was a ptr...

I didn't look up the actual structure definition, but:

+       cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS,
+                                     &cq->bar2_qid,
+                                     user ? &cq->bar2_pa : NULL);

+void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid,
+                             enum cxgb4_bar2_qtype qtype,
+                             unsigned int *pbar2_qid, u64 *pbar2_pa)

Looks like either it's a u64 or else there should be compiler warnings
about passing &cq->bar2_pa to c4iw_bar2_addrs.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-06-09 14:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 12:53 [PATCH for-4.1 0/2] Adds support for user mode bar2 mapping and bar2 qid density Hariprasad Shenai
     [not found] ` <1433854392-6531-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2015-06-09 12:53   ` [PATCH for-4.1 1/2] cxgb4: Support for user mode bar2 mappings with T4 Hariprasad Shenai
2015-06-09 12:53   ` [PATCH for-4.1 2/2] iw_cxgb4: support for bar2 qid densities exceeding the page size Hariprasad Shenai
     [not found]     ` <1433854392-6531-3-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2015-06-09 14:03       ` Doug Ledford
     [not found]         ` <1433858594.90034.14.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-09 14:07           ` Steve Wise
2015-06-09 14:16             ` Doug Ledford
     [not found]               ` <1433859363.90034.19.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-09 14:18                 ` Steve Wise
2015-06-09 14:25                   ` Doug Ledford [this message]
2015-06-11  5:01   ` [PATCH for-4.1 0/2] Adds support for user mode bar2 mapping and bar2 qid density Doug Ledford
     [not found]     ` <1433998881.71666.147.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11 14:08       ` Steve Wise
2015-06-11 14:10         ` Doug Ledford

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=1433859918.90034.25.camel@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=leedom-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
    --cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@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