public inbox for [email protected]
 help / color / mirror / Atom feed
* RE: [RFC 02/13] nvme: wire-up support for async-passthru on
@ 2021-12-21 21:16 Clay Mayers
  2021-12-22  8:02 ` hch
  2021-12-22 13:46 ` Kanchan Joshi
  0 siblings, 2 replies; 4+ messages in thread
From: Clay Mayers @ 2021-12-21 21:16 UTC (permalink / raw)
  To: [email protected], [email protected],
	[email protected]
  Cc: [email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected]

Message-ID: <[email protected]>

On 12/20/21 19:47:23 +0530, Kanchan Joshi wrote:
> Introduce handlers for fops->async_cmd(), implementing async passthru on
> char device (including the multipath one).
> The handlers supports NVME_IOCTL_IO64_CMD.
>
I commented on these two issues below in more detail at
https://github.com/joshkan/nvme-uring-pt/issues

> +static void nvme_setup_uring_cmd_data(struct request *rq,
> +		struct io_uring_cmd *ioucmd, void *meta,
> +		void __user *meta_buffer, u32 meta_len, bool write) {
> +	struct nvme_uring_cmd *cmd = nvme_uring_cmd(ioucmd);
> +
> +	/* to free bio on completion, as req->bio will be null at that time */
> +	cmd->bio = rq->bio;
> +	/* meta update is required only for read requests */
> +	if (meta && !write) {
> +		cmd->meta = meta;
> +		cmd->meta_buffer = meta_buffer;
> +		cmd->meta_len = meta_len;
> +	} else {
> +		cmd->meta = NULL;
I believe that not saving meta in cmd->meta will leak it when it's a write. 
But nvme_pt_task_cb also needs to change to copy to user when
cmd->meta_buffer is set instead of cmd->meta.

> +
> +int nvme_ns_chr_async_cmd(struct io_uring_cmd *ioucmd,
> +		enum io_uring_cmd_flags flags)
> +{
> +	struct nvme_ns *ns = container_of(file_inode(ioucmd->file)->i_cdev,
> +			struct nvme_ns, cdev);
> +
> +	return nvme_ns_async_ioctl(ns, ioucmd); }
> +
The uring cmd flags are not being passed to nvme_ns_async_ioctl - what if
IO_URING_F_NONBLOCK Is set?  When it is, I think the nvme_alloc_request()
call in nvme_submit_user_cmd() needs to pass in BLK_MQ_REQ_NOWAIT as
the flags parameter or move to another thread.  Our proto-type does the former
requiring user mode to retry on -EWOULDBLOCK and -EBUSY.

--
Clay Mayers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 02/13] nvme: wire-up support for async-passthru on
  2021-12-21 21:16 [RFC 02/13] nvme: wire-up support for async-passthru on Clay Mayers
@ 2021-12-22  8:02 ` hch
  2021-12-22 15:11   ` Clay Mayers
  2021-12-22 13:46 ` Kanchan Joshi
  1 sibling, 1 reply; 4+ messages in thread
From: hch @ 2021-12-22  8:02 UTC (permalink / raw)
  To: Clay Mayers
  Cc: [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected]

On Tue, Dec 21, 2021 at 09:16:27PM +0000, Clay Mayers wrote:
> Message-ID: <[email protected]>
> 
> On 12/20/21 19:47:23 +0530, Kanchan Joshi wrote:
> > Introduce handlers for fops->async_cmd(), implementing async passthru on
> > char device (including the multipath one).
> > The handlers supports NVME_IOCTL_IO64_CMD.
> >
> I commented on these two issues below in more detail at
> https://github.com/joshkan/nvme-uring-pt/issues

If you want people to read your comments send them here and not on some
random website no one is reading.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 02/13] nvme: wire-up support for async-passthru on
  2021-12-21 21:16 [RFC 02/13] nvme: wire-up support for async-passthru on Clay Mayers
  2021-12-22  8:02 ` hch
@ 2021-12-22 13:46 ` Kanchan Joshi
  1 sibling, 0 replies; 4+ messages in thread
From: Kanchan Joshi @ 2021-12-22 13:46 UTC (permalink / raw)
  To: Clay Mayers
  Cc: [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected]

On Wed, Dec 22, 2021 at 2:46 AM Clay Mayers <[email protected]> wrote:
>
> Message-ID: <[email protected]>
>
> On 12/20/21 19:47:23 +0530, Kanchan Joshi wrote:
> > Introduce handlers for fops->async_cmd(), implementing async passthru on
> > char device (including the multipath one).
> > The handlers supports NVME_IOCTL_IO64_CMD.
> >
> I commented on these two issues below in more detail at
> https://github.com/joshkan/nvme-uring-pt/issues

That is on general/existing nvme ioctl (and not specific to this
series). You might want to open up a discussion in the nvme mailing
list.

> > +static void nvme_setup_uring_cmd_data(struct request *rq,
> > +             struct io_uring_cmd *ioucmd, void *meta,
> > +             void __user *meta_buffer, u32 meta_len, bool write) {
> > +     struct nvme_uring_cmd *cmd = nvme_uring_cmd(ioucmd);
> > +
> > +     /* to free bio on completion, as req->bio will be null at that time */
> > +     cmd->bio = rq->bio;
> > +     /* meta update is required only for read requests */
> > +     if (meta && !write) {
> > +             cmd->meta = meta;
> > +             cmd->meta_buffer = meta_buffer;
> > +             cmd->meta_len = meta_len;
> > +     } else {
> > +             cmd->meta = NULL;
> I believe that not saving meta in cmd->meta will leak it when it's a write.

Indeed. Will fix that up.

> But nvme_pt_task_cb also needs to change to copy to user when
> cmd->meta_buffer is set instead of cmd->meta.
>
> > +
> > +int nvme_ns_chr_async_cmd(struct io_uring_cmd *ioucmd,
> > +             enum io_uring_cmd_flags flags)
> > +{
> > +     struct nvme_ns *ns = container_of(file_inode(ioucmd->file)->i_cdev,
> > +                     struct nvme_ns, cdev);
> > +
> > +     return nvme_ns_async_ioctl(ns, ioucmd); }
> > +
> The uring cmd flags are not being passed to nvme_ns_async_ioctl - what if
> IO_URING_F_NONBLOCK Is set?  When it is, I think the nvme_alloc_request()
> call in nvme_submit_user_cmd() needs to pass in BLK_MQ_REQ_NOWAIT as
> the flags parameter or move to another thread.  Our proto-type does the former
> requiring user mode to retry on -EWOULDBLOCK and -EBUSY.

Right, this part is not handled. Need to get that sorted in the next
version. Thanks.



-- 
Joshi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RFC 02/13] nvme: wire-up support for async-passthru on
  2021-12-22  8:02 ` hch
@ 2021-12-22 15:11   ` Clay Mayers
  0 siblings, 0 replies; 4+ messages in thread
From: Clay Mayers @ 2021-12-22 15:11 UTC (permalink / raw)
  To: [email protected]
  Cc: [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected]

> From: [email protected] <[email protected]>
> Sent: Wednesday, December 22, 2021 12:02 AM
> 
> On Tue, Dec 21, 2021 at 09:16:27PM +0000, Clay Mayers wrote:
> > Message-ID: <[email protected]>
> >
> > On 12/20/21 19:47:23 +0530, Kanchan Joshi wrote:
> > > Introduce handlers for fops->async_cmd(), implementing async
> > > passthru on char device (including the multipath one).
> > > The handlers supports NVME_IOCTL_IO64_CMD.
> > >
> > I commented on these two issues below in more detail at
> > https://github.com/joshkan/nvme-uring-pt/issues
> 
> If you want people to read your comments send them here and not on some
> random website no one is reading.

Of course.  That's the site this patch was staged on before being submitted
here.  The comments there precede the posting here.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-22 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21 21:16 [RFC 02/13] nvme: wire-up support for async-passthru on Clay Mayers
2021-12-22  8:02 ` hch
2021-12-22 15:11   ` Clay Mayers
2021-12-22 13:46 ` Kanchan Joshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox