From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Bart Van Assche <Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: "leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
<devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [rdma-core v3 8/9] libbnxt_re: Add support for atomic operations
Date: Thu, 16 Mar 2017 10:40:18 -0600 [thread overview]
Message-ID: <20170316164018.GG23821@obsidianresearch.com> (raw)
In-Reply-To: <1489680444.2574.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
On Thu, Mar 16, 2017 at 04:07:38PM +0000, Bart Van Assche wrote:
> Does that mean that you consider optimizing for 32-bit CPUs more important than
> optimizing for 64-bit CPUs? Does this also mean that you expect that the macros
> you introduced in your driver to be more efficient than the glibc endianness
> conversion macros? Sorry but this sounds like a weird explanation to me. I agree
> with Leon that it would be a significant improvement if 64-bit data types would
> be used instead of using numerous lower_32_bits() / upper_32_bits() calls.
I actually think this is all just wrong.
For instance looking at bnxt_re_atomic I see it is written to a
wqe/sqe buf, which come from here:
sqe = (void *)(sq->va + (sq->tail * sq->stride));
Which suggests it is DMA'd from the NIC, and I suspect it is 64 bit
aligned.
The driver does a whole struct 64 bit by 64 bit byteswap on every sqe:
bnxt_re_host_to_le64((uint64_t *)sqe, sq->stride);
Which means if we look at BE then this struct:
struct bnxt_re_atomic {
__u32 rva_lo;
__u32 rva_hi;
__u32 swp_dt_lo;
__u32 swp_dt_hi;
__u32 cmp_dt_lo;
__u32 cmp_dt_hi;
};
becomes
struct bnxt_re_atomic {
__le32 rva_hi;
__le32 rva_lo;
__le32 swp_dt_hi;
__le32 swp_dt_lo;
__le32 cmp_dt_hi;
__le32 cmp_dt_lo;
};
Which doesn't look like it will work right to me.
I think Bart is basically right, you need to elimiante all of the
calls to bnxt_re_host_to_le64 and related, directly use __leXX in your
DMA structures and byte swap when storing.
For instance, if instead you do:
struct bnxt_re_atomic {
__le64 rva;
__le64 swp_dt;
__le64 cmp_dt;
};
Then things will just work out properly and you will end up with the
same memory image for DMA on BE or LE platforms.
Does the kernel driver have the same problem?
Also, please use the kernel ABI file directly (see how mw_pvrdma-abi.h
makes this happen) as much as possible, drop the copies out of
providers/bnxt_re/bnxt_re-abi.h
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-03-16 16:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 10:37 [rdma-core v3 0/9] Broadcom User Space RoCE Driver Devesh Sharma
[not found] ` <1489574253-20300-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-03-15 10:37 ` [rdma-core v3 1/9] libbnxt_re: introduce bnxtre user space RDMA provider Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 2/9] libbnxt_re: Add support for user memory regions Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 3/9] libbnxt_re: Add support for CQ and QP management Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 4/9] libbnxt_re: Add support for posting and polling Devesh Sharma
[not found] ` <1489574253-20300-5-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-03-15 16:34 ` Jason Gunthorpe
[not found] ` <20170315163454.GD29562-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-16 3:04 ` Devesh Sharma
[not found] ` <CANjDDBh9JP-0W4NDW4p-Jx2fivcSKS9ZAt5AdLRdQPXH8WxxCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-16 16:17 ` Jason Gunthorpe
[not found] ` <20170316161754.GF23821-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-16 16:53 ` Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 5/9] libbnxt_re: Allow apps to poll for flushed completions Devesh Sharma
[not found] ` <1489574253-20300-6-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-03-15 19:20 ` Leon Romanovsky
[not found] ` <20170315192028.GI2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-16 15:22 ` Devesh Sharma
[not found] ` <CANjDDBgPrPPDBOy9N4X=XdU9AUTFpL2pE9-9kPvqAcYj09vDLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-19 8:12 ` Leon Romanovsky
[not found] ` <20170319081258.GR2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-19 14:36 ` Devesh Sharma
[not found] ` <CANjDDBiLnAhJWGfJ2TfJ=3_RoQW_KrfDBkxcSp586JuEL4hQXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-20 6:37 ` Leon Romanovsky
2017-03-15 10:37 ` [rdma-core v3 6/9] libbnxt_re: Enable UD control path and wqe posting Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 7/9] libbnxt_re: Enable polling for UD completions Devesh Sharma
2017-03-15 10:37 ` [rdma-core v3 8/9] libbnxt_re: Add support for atomic operations Devesh Sharma
[not found] ` <1489574253-20300-9-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-03-15 19:15 ` Leon Romanovsky
[not found] ` <20170315191515.GH2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-16 15:54 ` Devesh Sharma
[not found] ` <CANjDDBjGCCc8MLLQ3jhToWyc0Z+Qm3pYejz3BrMrRketDdZbEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-16 16:07 ` Bart Van Assche
[not found] ` <1489680444.2574.9.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-03-16 16:40 ` Jason Gunthorpe [this message]
2017-03-15 10:37 ` [rdma-core v3 9/9] libbnxt_re: Add support for SRQ in user lib Devesh Sharma
[not found] ` <1489574253-20300-10-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-03-15 19:24 ` Leon Romanovsky
[not found] ` <20170315192408.GJ2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-19 14:34 ` Devesh Sharma
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=20170316164018.GG23821@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
--cc=devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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