public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: "Daisuke Matsuda (Fujitsu)" <matsuda-daisuke@fujitsu.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"zyjzyj2000@gmail.com" <zyjzyj2000@gmail.com>,
	"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
Subject: Re: [PATCH for-next v2 2/2] RDMA/rxe: Enable ODP in ATOMIC WRITE operation
Date: Wed, 19 Mar 2025 10:58:25 +0200	[thread overview]
Message-ID: <20250319085825.GH1322339@unreal> (raw)
In-Reply-To: <OS3PR01MB98651EE8E000B0682056B381E5D92@OS3PR01MB9865.jpnprd01.prod.outlook.com>

On Wed, Mar 19, 2025 at 02:58:51AM +0000, Daisuke Matsuda (Fujitsu) wrote:
> On Tue, Mar 18, 2025 7:10 PM Leon Romanovsky wrote:
> > On Tue, Mar 18, 2025 at 06:49:32PM +0900, Daisuke Matsuda wrote:
> > 
> > <...>
> > 
> > > +static inline int rxe_odp_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value)
> > > +{
> > > +	return RESPST_ERR_UNSUPPORTED_OPCODE;
> > > +}
> > >  #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
> > 
> > You are returning "enum resp_states", while function expects to return "int". You should return -EOPNOTSUPP.
> 
> Other than my patches, there are some functions that do the same thing.

Yes, but you are adding new code and in the new code you should try to
have correlated function declaration and returned values.

> I would like to post a patch to make them consistent, but I think we need
> reach an agreement on the design of rxe responder before taking up.
> Please see my opinion below.
> 
> > 
> > >
> > >  #endif /* RXE_LOC_H */
> 
> <...>
> 
> > > diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c
> > > index 9a9aae967486..f3443c604a7f 100644
> > > --- a/drivers/infiniband/sw/rxe/rxe_odp.c
> > > +++ b/drivers/infiniband/sw/rxe/rxe_odp.c
> > > @@ -378,3 +378,56 @@ int rxe_odp_flush_pmem_iova(struct rxe_mr *mr, u64 iova,
> > >
> > >  	return 0;
> > >  }
> > > +
> > > +#if defined CONFIG_64BIT
> > > +/* only implemented or called for 64 bit architectures */
> > > +int rxe_odp_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value)
> > > +{
> > > +	struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
> > > +	unsigned int page_offset;
> > > +	unsigned long index;
> > > +	struct page *page;
> > > +	int err;
> > > +	u64 *va;
> > > +
> > > +	/* See IBA oA19-28 */
> > > +	err = mr_check_range(mr, iova, sizeof(value));
> > > +	if (unlikely(err)) {
> > > +		rxe_dbg_mr(mr, "iova out of range\n");
> > > +		return RESPST_ERR_RKEY_VIOLATION;
> > 
> > Please don't redefine returned errors.
> 
> As a general principle, I think your comment is totally correct.
> The problem is that rxe_receiver(), the responder of rxe, is originally designed
> as a state machine, and the returned values of "enum resp_states" are used
> to specify the next state.
> 
> One thing to note is that rxe_receiver() run solely in workqueue, so the errors
> generated in the bottom half context are never returned to userspace. In that regard,
> I think redefining the error codes with different enum values can be justified.

In places where rxe_odp_do_atomic_write() respond is important, you can
write something like:
err = rxe_odp_do_atomic_write(...)
if (err == -EPERM)
   state = RESPST_ERR_RKEY_VIOLATION
...

or declare rxe_odp_do_atomic_write() to return enum resp_state.

Thanks

  reply	other threads:[~2025-03-19  8:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18  9:49 [PATCH for-next v2 0/2] RDMA/rxe: RDMA FLUSH and ATOMIC WRITE with ODP Daisuke Matsuda
2025-03-18  9:49 ` [PATCH for-next v2 1/2] RDMA/rxe: Enable ODP in RDMA FLUSH operation Daisuke Matsuda
2025-03-20  6:59   ` Zhijian Li (Fujitsu)
2025-03-24  5:16     ` Daisuke Matsuda (Fujitsu)
2025-03-18  9:49 ` [PATCH for-next v2 2/2] RDMA/rxe: Enable ODP in ATOMIC WRITE operation Daisuke Matsuda
2025-03-18 10:10   ` Leon Romanovsky
2025-03-19  2:58     ` Daisuke Matsuda (Fujitsu)
2025-03-19  8:58       ` Leon Romanovsky [this message]
2025-03-24  8:05         ` Daisuke Matsuda (Fujitsu)

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=20250319085825.GH1322339@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=matsuda-daisuke@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox