From: Jason Gunthorpe <jgg@nvidia.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Xiao Yang <yangx.jy@fujitsu.com>,
linux-rdma@vger.kernel.org, rpearsonhpe@gmail.com,
leon@kernel.org, lizhijian@fujitsu.com, y-goto@fujitsu.com,
zyjzyj2000@gmail.com
Subject: Re: [PATCH v7 6/8] RDMA/rxe: Make responder support atomic write on RC service
Date: Thu, 15 Dec 2022 11:32:33 -0400 [thread overview]
Message-ID: <Y5s+EVE7eLWQqOwv@nvidia.com> (raw)
In-Reply-To: <20221215151924.GA2574647@roeck-us.net>
On Thu, Dec 15, 2022 at 07:19:24AM -0800, Guenter Roeck wrote:
> On Thu, Dec 01, 2022 at 02:39:26PM +0000, Xiao Yang wrote:
> > Make responder process an atomic write request and send a read response
> > on RC service.
> >
> > Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> > ---
>
> On all 32-bit builds with CONFIG_WERROR enabled:
Why are we only just seeing this now? It has been in linux-next for
long enough?
From 7e708569f7bb5dba6df8342bc2402deda4e2414e Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgg@nvidia.com>
Date: Thu, 15 Dec 2022 11:29:25 -0400
Subject: [PATCH] RDMA/rxe: Fix compile warnings on 32-bit
Move the conditional code into a function, with two varients so it is
harder to make these kinds of mistakes.
drivers/infiniband/sw/rxe/rxe_resp.c: In function 'atomic_write_reply':
drivers/infiniband/sw/rxe/rxe_resp.c:794:13: error: unused variable 'payload' [-Werror=unused-variable]
794 | int payload = payload_size(pkt);
| ^~~~~~~
drivers/infiniband/sw/rxe/rxe_resp.c:793:24: error: unused variable 'mr' [-Werror=unused-variable]
793 | struct rxe_mr *mr = qp->resp.mr;
| ^~
drivers/infiniband/sw/rxe/rxe_resp.c:791:19: error: unused variable 'dst' [-Werror=unused-variable]
791 | u64 src, *dst;
| ^~~
drivers/infiniband/sw/rxe/rxe_resp.c:791:13: error: unused variable 'src' [-Werror=unused-variable]
791 | u64 src, *dst;
Fixes: 034e285f8b99 ("RDMA/rxe: Make responder support atomic write on RC service")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/infiniband/sw/rxe/rxe_resp.c | 72 +++++++++++++++-------------
1 file changed, 40 insertions(+), 32 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 7a60c7709da045..c74972244f08f5 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -785,53 +785,61 @@ static enum resp_states atomic_reply(struct rxe_qp *qp,
return ret;
}
-static enum resp_states atomic_write_reply(struct rxe_qp *qp,
- struct rxe_pkt_info *pkt)
+#ifdef CONFIG_64BIT
+static enum resp_states do_atomic_write(struct rxe_qp *qp,
+ struct rxe_pkt_info *pkt)
{
- u64 src, *dst;
- struct resp_res *res = qp->resp.res;
struct rxe_mr *mr = qp->resp.mr;
int payload = payload_size(pkt);
+ u64 src, *dst;
- if (!res) {
- res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_WRITE_MASK);
- qp->resp.res = res;
- }
-
- if (!res->replay) {
-#ifdef CONFIG_64BIT
- if (mr->state != RXE_MR_STATE_VALID)
- return RESPST_ERR_RKEY_VIOLATION;
-
- memcpy(&src, payload_addr(pkt), payload);
+ if (mr->state != RXE_MR_STATE_VALID)
+ return RESPST_ERR_RKEY_VIOLATION;
- dst = iova_to_vaddr(mr, qp->resp.va + qp->resp.offset, payload);
- /* check vaddr is 8 bytes aligned. */
- if (!dst || (uintptr_t)dst & 7)
- return RESPST_ERR_MISALIGNED_ATOMIC;
+ memcpy(&src, payload_addr(pkt), payload);
- /* Do atomic write after all prior operations have completed */
- smp_store_release(dst, src);
+ dst = iova_to_vaddr(mr, qp->resp.va + qp->resp.offset, payload);
+ /* check vaddr is 8 bytes aligned. */
+ if (!dst || (uintptr_t)dst & 7)
+ return RESPST_ERR_MISALIGNED_ATOMIC;
- /* decrease resp.resid to zero */
- qp->resp.resid -= sizeof(payload);
+ /* Do atomic write after all prior operations have completed */
+ smp_store_release(dst, src);
- qp->resp.msn++;
+ /* decrease resp.resid to zero */
+ qp->resp.resid -= sizeof(payload);
- /* next expected psn, read handles this separately */
- qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK;
- qp->resp.ack_psn = qp->resp.psn;
+ qp->resp.msn++;
- qp->resp.opcode = pkt->opcode;
- qp->resp.status = IB_WC_SUCCESS;
+ /* next expected psn, read handles this separately */
+ qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK;
+ qp->resp.ack_psn = qp->resp.psn;
- return RESPST_ACKNOWLEDGE;
+ qp->resp.opcode = pkt->opcode;
+ qp->resp.status = IB_WC_SUCCESS;
+ return RESPST_ACKNOWLEDGE;
+}
#else
- return RESPST_ERR_UNSUPPORTED_OPCODE;
+static enum resp_states do_atomic_write(struct rxe_qp *qp,
+ struct rxe_pkt_info *pkt)
+{
+ return RESPST_ERR_UNSUPPORTED_OPCODE;
+}
#endif /* CONFIG_64BIT */
+
+static enum resp_states atomic_write_reply(struct rxe_qp *qp,
+ struct rxe_pkt_info *pkt)
+{
+ struct resp_res *res = qp->resp.res;
+
+ if (!res) {
+ res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_WRITE_MASK);
+ qp->resp.res = res;
}
- return RESPST_ACKNOWLEDGE;
+ if (res->replay)
+ return RESPST_ACKNOWLEDGE;
+ return do_atomic_write(qp, pkt);
}
static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
--
2.38.2
next prev parent reply other threads:[~2022-12-15 15:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 14:39 [PATCH v7 5/8] RDMA/rxe: Make requester support atomic write on RC service Xiao Yang
2022-12-01 14:39 ` [PATCH v7 6/8] RDMA/rxe: Make responder " Xiao Yang
2022-12-15 15:19 ` Guenter Roeck
2022-12-15 15:32 ` Jason Gunthorpe [this message]
2022-12-01 14:39 ` [PATCH v7 7/8] RDMA/rxe: Implement atomic write completion Xiao Yang
2022-12-01 14:39 ` [PATCH v7 8/8] RDMA/rxe: Enable atomic write capability for rxe device Xiao Yang
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=Y5s+EVE7eLWQqOwv@nvidia.com \
--to=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lizhijian@fujitsu.com \
--cc=rpearsonhpe@gmail.com \
--cc=y-goto@fujitsu.com \
--cc=yangx.jy@fujitsu.com \
--cc=zyjzyj2000@gmail.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.