Re: [PATCH v4 4/5] nvme: wire-up uring-cmd support for io-passthru on char-device.

Christoph Hellwig
2022-05-05T13:43:15Z

On Thu, May 05, 2022 at 07:38:31AM -0600, Jens Axboe wrote:
> > + req = nvme_alloc_user_request(q, &c, nvme_to_user_ptr(cmd->addr),
> > + cmd->data_len, nvme_to_user_ptr(cmd->metadata),
> > + cmd->metadata_len, 0, cmd->timeout_ms ?
> > + msecs_to_jiffies(cmd->timeout_ms) : 0, 0, rq_flags,
> > + blk_flags);
>
> You need to be careful with reading/re-reading the shared memory. For
> example, you do:

Uh, yes. With ioucmd->cmd pointing to the user space mapped SQ
we need to be very careful here. To the point where I'd almost prfer
to memcpy it out first, altough there might be performance implications.

On something unrelated while looking over the code again: the cast
when asssigning cmd in nvme_uring_cmd_io should not be needed any more.