From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-core 3/8] mlx4: Add sparse annotations
Date: Thu, 13 Jul 2017 11:16:09 -0600 [thread overview]
Message-ID: <20170713171609.GA11069@obsidianresearch.com> (raw)
In-Reply-To: <20170713080752.GA25727-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
On Thu, Jul 13, 2017 at 01:07:52AM -0700, Christoph Hellwig wrote:
> > > case MLX4_RECV_OPCODE_SEND_INVAL:
> > > - return be32toh(cq->cqe->immed_rss_invalid);
> > > + /* This is returning invalidate_rkey which is in host order, see
> > > + * ibv_wc_read_invalidated_rkey */
> > > + return (__force __be32)be32toh(cq->cqe->immed_rss_invalid);
> >
> > Jason,
> > It is insane construction, convert to host-> force to be32 -> use as uint32_t.
>
> Yes, this doesn't make sense to me - we are swapping it but pretending
> it's native? There's certainly something very odd going on here.
Yes, it is odd.
mlx4_cq_read_wc_imm_data is an ABI entry point, we cannot change it.
The ABI defines it to return a be32 when the wc has immediate data and
a u32 when the wc has an remote invalidated rkey - hence the madness.
My approach is to retain this ABI, and put two user facing wrappers
around the function call that return the correct types depending on
the expected data accessed. Since the function is called '*_imm_data'
I choose to return a be32 to match the choice of name.
> It seems like the ->read_imm_data needs to be split and/or have a
> prototype change. The sad part is that it is an exported ABI, although
> one that is almost undocumented.
Even if we split it, the existing version must retain the same
behavior and the only way to get such insane behaviar and be sparse
clean is with force right here.
Since we are stuck with that I can't really justify adding another
entry point just for invalidated rkey.. I can't really get rid of the
ifdef CHECKER in the public header with this approach.
> > I see that librdmacm/rsocket.c full of these __force annotations.
> > I would be very happy to see it fixed rather suppressed, but don't know
> > if it is realistic goal or not.
>
> The db local variable in mlx4_alloc_db should be easily changed to a
> __be32 pointer - it is derived from a void pointer using pointer
> arithmetics.
Yeah, OK, I thought I tried that, but yep, it is OK. I will update
both places.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-07-13 17:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 21:17 [PATCH rdma-core 0/8] Sparse updates for Mellanox and vmw_pvrdma providers Jason Gunthorpe
[not found] ` <1499894262-10761-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-12 21:17 ` [PATCH rdma-core 1/8] verbs: Annoate ibv_wc helpers with endian Jason Gunthorpe
[not found] ` <1499894262-10761-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-13 6:50 ` Leon Romanovsky
[not found] ` <20170713065057.GH1528-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-07-13 17:48 ` Jason Gunthorpe
2017-07-19 16:53 ` Jason Gunthorpe
[not found] ` <20170719165351.GA25714-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-19 17:17 ` Leon Romanovsky
2017-07-12 21:17 ` [PATCH rdma-core 2/8] verbs: Annoate ibv_send_wr " Jason Gunthorpe
2017-07-12 21:17 ` [PATCH rdma-core 3/8] mlx4: Add sparse annotations Jason Gunthorpe
[not found] ` <1499894262-10761-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-13 7:23 ` Leon Romanovsky
[not found] ` <20170713072343.GI1528-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-07-13 8:07 ` Christoph Hellwig
[not found] ` <20170713080752.GA25727-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-07-13 17:16 ` Jason Gunthorpe [this message]
2017-07-12 21:17 ` [PATCH rdma-core 4/8] mlx5: Avoid sparse complaints about !! Jason Gunthorpe
[not found] ` <1499894262-10761-5-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-13 7:34 ` Leon Romanovsky
2017-07-13 7:51 ` Christoph Hellwig
[not found] ` <20170713075116.GA11233-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-07-13 17:20 ` Jason Gunthorpe
[not found] ` <20170713172035.GB11069-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-13 17:52 ` Bart Van Assche
[not found] ` <1499968325.2740.12.camel-Sjgp3cTcYWE@public.gmane.org>
2017-07-13 18:37 ` Jason Gunthorpe
[not found] ` <20170713183737.GF11069-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-15 8:07 ` Leon Romanovsky
2017-07-12 21:17 ` [PATCH rdma-core 5/8] mlx5: Add sparse annotations Jason Gunthorpe
2017-07-12 21:17 ` [PATCH rdma-core 6/8] mthca: " Jason Gunthorpe
2017-07-12 21:17 ` [PATCH rdma-core 7/8] vmw_pvrdma: Update kernel header Jason Gunthorpe
[not found] ` <1499894262-10761-8-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-14 17:50 ` Adit Ranadive
2017-07-12 21:17 ` [PATCH rdma-core 8/8] vmw_pvrdma: Add sparse annotations Jason Gunthorpe
[not found] ` <1499894262-10761-9-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-14 20:56 ` Adit Ranadive
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=20170713171609.GA11069@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@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;
as well as URLs for NNTP newsgroup(s).