From: Jason Gunthorpe <jgg@nvidia.com>
To: liweihang <liweihang@huawei.com>
Cc: "leon@kernel.org" <leon@kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH rdma-core 4/4] libhns: Add support for direct wqe
Date: Fri, 11 Jun 2021 08:31:24 -0300 [thread overview]
Message-ID: <20210611113124.GO1002214@nvidia.com> (raw)
In-Reply-To: <efc5283d762542f6a4add9329744c4ee@huawei.com>
On Fri, Jun 11, 2021 at 09:20:51AM +0000, liweihang wrote:
> On 2021/6/4 22:50, Jason Gunthorpe wrote:
> > On Fri, May 28, 2021 at 05:32:59PM +0800, Weihang Li wrote:
> >> diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
> >> index aa57cc4..28d455b 100644
> >> +++ b/providers/hns/hns_roce_u_hw_v2.c
> >> @@ -33,10 +33,15 @@
> >> #define _GNU_SOURCE
> >> #include <stdio.h>
> >> #include <string.h>
> >> +#include <sys/mman.h>
> >> #include "hns_roce_u.h"
> >> #include "hns_roce_u_db.h"
> >> #include "hns_roce_u_hw_v2.h"
> >>
> >> +#if defined(__aarch64__) || defined(__arm__)
> >> +#include <arm_neon.h>
> >> +#endif
> >> +
> >> #define HR_IBV_OPC_MAP(ib_key, hr_key) \
> >> [IBV_WR_ ## ib_key] = HNS_ROCE_WQE_OP_ ## hr_key
> >>
> >> @@ -313,6 +318,39 @@ static void hns_roce_update_sq_db(struct hns_roce_context *ctx,
> >> (__le32 *)&sq_db);
> >> }
> >>
> >> +static inline void hns_roce_write512(uint64_t *dest, uint64_t *val)
> >> +{
> >> +#if defined(__aarch64__) || defined(__arm__)
> >> + uint64x2x4_t dwqe;
> >> +
> >> + /* Load multiple 4-element structures to 4 registers */
> >> + dwqe = vld4q_u64(val);
> >> + /* store multiple 4-element structures from 4 registers */
> >> + vst4q_u64(dest, dwqe);
> >> +#else
> >> + int i;
> >> +
> >> + for (i = 0; i < HNS_ROCE_WRITE_TIMES; i++)
> >> + hns_roce_write64(dest + i, val + HNS_ROCE_WORD_NUM * i);
> >> +#endif
> >> +}
> >
> > No code like this in providers. This should be done similiarly to how
> > SSE is handled on x86
> >
> > This is
> >
> > mmio_memcpy_x64(dest, val, 64);
> >
> > The above should be conditionalized to trigger NEON
> >
> > #if defined(__aarch64__) || defined(__arm__)
> > static inline void __mmio_memcpy_x64_64b(..)
> > {..
> > vst4q_u64(dest, vld4q_u64(src))
> > ..}
> > #endif
> >
> > #define mmio_memcpy_x64(dest, src, bytecount)
> > ({if (__builtin_constant_p(bytecount == 64)
> > __mmio_memcpy_x64_64b(dest,src,bytecount)
> > ...
> >
>
> OK, thank you.
>
> > And I'm not sure what barriers you need for prot_device, but certainly
> > more than none. If you don't know then use the WC barriers
> >
>
> ST4 instructions can guarantee the 64 bytes data to be wrote at a time, so we
> don't need a barrier.
arm is always a relaxed out of order storage model, you need barriers
to ensure that the observance of the ST4 is in-order with the other
writes that might be going on
Jason
next prev parent reply other threads:[~2021-06-11 11:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-28 9:32 [PATCH rdma-core 0/4] libhns: Add support for direct WQE Weihang Li
2021-05-28 9:32 ` [PATCH rdma-core 1/4] Update kernel headers Weihang Li
2021-05-28 9:32 ` [PATCH rdma-core 2/4] libhns: Refactor hns uar mmap flow Weihang Li
2021-05-28 9:32 ` [PATCH rdma-core 3/4] libhns: Fixes data type when writing doorbell Weihang Li
2021-06-04 14:43 ` Jason Gunthorpe
2021-06-09 3:35 ` liweihang
2021-05-28 9:32 ` [PATCH rdma-core 4/4] libhns: Add support for direct wqe Weihang Li
2021-06-04 14:50 ` Jason Gunthorpe
2021-06-11 9:20 ` liweihang
2021-06-11 11:31 ` Jason Gunthorpe [this message]
2021-06-16 9:55 ` liweihang
2021-06-16 19:14 ` Jason Gunthorpe
2021-06-18 7:23 ` liweihang
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=20210611113124.GO1002214@nvidia.com \
--to=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liweihang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.