nvmet: support of Fused operations
Subsystems (3)
cover nvmet: support of Fused operations
Hi,
This patchset introduces a support of Atomic Test & Set (ATS) primitive. It's implemented by means of Compare And Write fused commands in nvme target.
That allows ESXi to use Linux NVME Target as VMFS datastore storage.
The first 3 patches add a single Compare command support.
4th patch an refactoring to have a common point in the command execution flow. 5,6 patches adds support of Fused commands.
And the last patch allows to send fused commands by nvme io-passthru tool for testing purposes.
The patchset based on nvme-6.12.
Dmitry Bogdanov (7):
nvmet: add support of Compare command
nvmet: bdev: add support of Compare command
nvmet: file: add support of Compare command
Revert "nvmet: Open code nvmet_req_execute()"
nvmet: add support of fused operations
nvmet: make fused commands be atomic
nvme: allow send fused commands
drivers/nvme/host/ioctl.c | 6 +- drivers/nvme/target/admin-cmd.c | 6 +- drivers/nvme/target/core.c | 391 +++++++++++++++++++++++++++++- drivers/nvme/target/fc.c | 6 +- drivers/nvme/target/io-cmd-bdev.c | 34 ++- drivers/nvme/target/io-cmd-file.c | 21 ++ drivers/nvme/target/loop.c | 2 +- drivers/nvme/target/nvmet.h | 16 +- drivers/nvme/target/rdma.c | 4 +- drivers/nvme/target/tcp.c | 4 +- include/linux/nvme.h | 2 + 11 files changed, 473 insertions(+), 19 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/7 nvmet: add support of Compare command
Report that Compare command is supported.
Make a common function for comparision of datas from the command and from the backstore.
--- drivers/nvme/target/admin-cmd.c | 4 ++- drivers/nvme/target/core.c | 55 +++++++++++++++++++++++++++++++++ drivers/nvme/target/nvmet.h | 2 ++ 3 files changed, 60 insertions(+), 1 deletion(-)
drivers/nvme/target/admin-cmd.c +3 -1
@@ -176,6 +176,7 @@ static void nvmet_get_cmd_effects_nvm(struct nvme_effects_log *log) log->iocs[nvme_cmd_read] = log->iocs[nvme_cmd_flush] = log->iocs[nvme_cmd_dsm] = + log->iocs[nvme_cmd_compare] =cpu_to_le32 (NVME_CMD_EFFECTS_CSUPP ); log->iocs[nvme_cmd_write] = log->iocs[nvme_cmd_write_zeroes] =
@@ -433,7 +434,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req) id->nn =cpu_to_le32 (NVMET_MAX_NAMESPACES ); id->mnan =cpu_to_le32 (NVMET_MAX_NAMESPACES ); id->oncs =cpu_to_le16 (NVME_CTRL_ONCS_DSM | -NVME_CTRL_ONCS_WRITE_ZEROES ); +NVME_CTRL_ONCS_WRITE_ZEROES | +NVME_CTRL_ONCS_COMPARE );/* XXX: don't report vwc if the underlying device is write through */ id->vwc =NVME_CTRL_VWC_PRESENT ;
drivers/nvme/target/core.c +55 -0
73 lines not on this page · raw message
drivers/nvme/target/nvmet.h +2 -0
@@ -373,6 +373,7 @@ struct nvmet_req {struct nvmet_ns *ns;struct scatterlist *sg;struct scatterlist *metadata_sg; +struct scatterlist *cmp_sg;struct bio_vec inline_bvec[NVMET_MAX_INLINE_BIOVEC ]; union { struct {
@@ -602,6 +603,7 @@ void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns);void nvmet_file_ns_revalidate (struct nvmet_ns *ns);bool nvmet_ns_revalidate (struct nvmet_ns *ns);u16 blk_to_nvme_status (struct nvmet_req *req,blk_status_t blk_sts); +int nvmet_compare_sg (struct nvmet_req *req);bool nvmet_bdev_zns_enable (struct nvmet_ns *ns);void nvmet_execute_identify_ctrl_zns (struct nvmet_req *req);
Signature · 1 line
2.25.1
PATCH 2/7 nvmet: bdev: add support of Compare command
In reply to Dmitry BogdanovAdd handling of Compare command for block device backend.
--- drivers/nvme/target/io-cmd-bdev.c | 34 ++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)
drivers/nvme/target/io-cmd-bdev.c +31 -3
@@ -183,8 +183,19 @@ u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)static void nvmet_bio_done (struct bio *bio) {struct nvmet_req *req = bio->bi_private; +u16 status; + + status =blk_to_nvme_status (req, bio->bi_status); + +if (req->cmd->rw.opcode == nvme_cmd_compare) { +if (likely (!status)) + status =nvmet_compare_sg (req); + +sgl_free (req->sg); + req->sg = req->cmp_sg; + } -nvmet_req_complete (req,blk_to_nvme_status (req, bio->bi_status)); +nvmet_req_complete (req, status);nvmet_req_bio_put (req, bio); }
@@ -262,14 +273,30 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)return ; } -if (req->cmd->rw.opcode == nvme_cmd_write) { +switch (req->cmd->rw.opcode) { +case nvme_cmd_write: opf =REQ_OP_WRITE |REQ_SYNC |REQ_IDLE ;if (req->cmd->rw.control &cpu_to_le16 (NVME_RW_FUA )) opf |=REQ_FUA ; iter_flags =SG_MITER_TO_SG ; - }else { +break ; +case nvme_cmd_compare: opf =REQ_OP_READ ; iter_flags =SG_MITER_FROM_SG ; + + req->cmp_sg = req->sg; + req->sg =sgl_alloc (nvmet_rw_data_len (req),GFP_KERNEL , + &req->sg_cnt); + +if (unlikely (!req->sg ||WARN_ON (sg_cnt != req->sg_cnt))) { +nvmet_req_complete (req,NVME_SC_INTERNAL ); +return ; + } +break ; +default : + opf =REQ_OP_READ ; + iter_flags =SG_MITER_FROM_SG ; +break ; }if (is_pci_p2pdma_page (sg_page (req->sg)))
@@ -458,6 +485,7 @@ u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req)switch (req->cmd->common.opcode) {case nvme_cmd_read:case nvme_cmd_write: +case nvme_cmd_compare: req->execute = nvmet_bdev_execute_rw;if (req->sq->ctrl->pi_support &&nvmet_ns_has_pi (req->ns)) req->metadata_len =nvmet_rw_metadata_len (req);
Signature · 1 line
2.25.1
PATCH 3/7 nvmet: file: add support of Compare command
In reply to Dmitry BogdanovAdd handling of Compare command in file backend.
--- drivers/nvme/target/io-cmd-file.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/nvme/target/io-cmd-file.c +21 -0
@@ -114,6 +114,15 @@ static void nvmet_file_io_done(struct kiocb *iocb, long ret)if (unlikely (ret != req->transfer_len)) status =errno_to_nvme_status (req, ret); + +if (req->cmd->rw.opcode == nvme_cmd_compare) { +if (likely (!status)) + status =nvmet_compare_sg (req); + +sgl_free (req->sg); + req->sg = req->cmp_sg; + } +nvmet_req_complete (req, status); }
@@ -227,6 +236,17 @@ static void nvmet_file_execute_rw(struct nvmet_req *req)return ; } +if (req->cmd->rw.opcode == nvme_cmd_compare) { + req->cmp_sg = req->sg; + req->sg =sgl_alloc (nvmet_rw_data_len (req),GFP_KERNEL , + &req->sg_cnt); + +if (unlikely (!req->sg ||WARN_ON (nr_bvec != req->sg_cnt))) { +nvmet_req_complete (req,NVME_SC_INTERNAL ); +return ; + } + } +if (nr_bvec >NVMET_MAX_INLINE_BIOVEC ) req->f.bvec =kmalloc_array (nr_bvec,sizeof (struct bio_vec ),GFP_KERNEL );
@@ -365,6 +385,7 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req)switch (req->cmd->common.opcode) {case nvme_cmd_read:case nvme_cmd_write: +case nvme_cmd_compare: req->execute = nvmet_file_execute_rw;return 0 ;case nvme_cmd_flush:
Signature · 1 line
2.25.1
PATCH 4/7 Revert "nvmet: Open code nvmet_req_execute()"
In reply to Dmitry BogdanovThis reverts commit be3f3114ddd58d12f64b872247bb1bc46df56b36.
Common nvmet_req_execute() is needed for fused commands support.
--- drivers/nvme/target/core.c | 6 ++++++ drivers/nvme/target/fc.c | 4 ++-- drivers/nvme/target/loop.c | 2 +- drivers/nvme/target/nvmet.h | 1 + drivers/nvme/target/rdma.c | 4 ++-- drivers/nvme/target/tcp.c | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-)
drivers/nvme/target/core.c +6 -0
@@ -1098,6 +1098,12 @@ bool nvmet_check_data_len_lte(struct nvmet_req *req, size_t data_len)return true; } +void nvmet_req_execute (struct nvmet_req *req) +{ + req->execute (req); +} +EXPORT_SYMBOL_GPL (nvmet_req_execute); +static unsigned int nvmet_data_transfer_len (struct nvmet_req *req) {return req->transfer_len - req->metadata_len;
drivers/nvme/target/fc.c +2 -2
@@ -2392,7 +2392,7 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod) }/* data transfer complete, resume with nvmet layer */ - fod->req.execute (&fod->req); +nvmet_req_execute (&fod->req);break ;case NVMET_FCOP_READDATA :
@@ -2603,7 +2603,7 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,* can invoke the nvmet_layer now. If read data, cmd completion will * push the data */ - fod->req.execute (&fod->req); +nvmet_req_execute (&fod->req);return ; transport_error:
drivers/nvme/target/loop.c +1 -1
@@ -125,7 +125,7 @@ static void nvme_loop_execute_work(struct work_struct *work)struct nvme_loop_iod *iod = container_of(work, struct nvme_loop_iod, work); - iod->req.execute (&iod->req); +nvmet_req_execute (&iod->req); } static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
drivers/nvme/target/nvmet.h +1 -0
@@ -480,6 +480,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,void nvmet_req_uninit (struct nvmet_req *req);bool nvmet_check_transfer_len (struct nvmet_req *req,size_t len);bool nvmet_check_data_len_lte (struct nvmet_req *req,size_t data_len); +void nvmet_req_execute (struct nvmet_req *req);void nvmet_req_complete (struct nvmet_req *req,u16 status);int nvmet_req_alloc_sgls (struct nvmet_req *req);void nvmet_req_free_sgls (struct nvmet_req *req);
drivers/nvme/target/rdma.c +2 -2
@@ -773,7 +773,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc)if (unlikely (status))nvmet_req_complete (&rsp->req, status);else - rsp->req.execute (&rsp->req); +nvmet_req_execute (&rsp->req); }static void nvmet_rdma_write_data_done (struct ib_cq *cq,struct ib_wc *wc)
@@ -958,7 +958,7 @@ static bool nvmet_rdma_execute_command(struct nvmet_rdma_rsp *rsp) queue->cm_id->port_num, &rsp->read_cqe, NULL))nvmet_req_complete (&rsp->req,NVME_SC_DATA_XFER_ERROR ); }else { - rsp->req.execute (&rsp->req); +nvmet_req_execute (&rsp->req); }return true;
drivers/nvme/target/tcp.c +2 -2
@@ -598,7 +598,7 @@ static void nvmet_tcp_execute_request(struct nvmet_tcp_cmd *cmd)if (unlikely (cmd->flags &NVMET_TCP_F_INIT_FAILED ))nvmet_tcp_queue_response (&cmd->req);else - cmd->req.execute (&cmd->req); +nvmet_req_execute (&cmd->req); }static int nvmet_try_send_data_pdu (struct nvmet_tcp_cmd *cmd)
@@ -1104,7 +1104,7 @@ static int nvmet_tcp_done_recv_pdu(struct nvmet_tcp_queue *queue) goto out; } - queue->cmd->req.execute (&queue->cmd->req); +nvmet_req_execute (&queue->cmd->req); out:nvmet_prepare_receive_pdu (queue);return ret;
Signature · 1 line
2.25.1
PATCH 5/7 nvmet: add support of fused operations
In reply to Dmitry BogdanovAdd support of Compare And Write fused operation. There can be several different Fused pairs inflight. Atomicity is garanteed for just one logical block.
--- drivers/nvme/target/admin-cmd.c | 2 + drivers/nvme/target/core.c | 326 +++++++++++++++++++++++++++++++- drivers/nvme/target/fc.c | 2 +- drivers/nvme/target/nvmet.h | 12 +- include/linux/nvme.h | 2 + 5 files changed, 338 insertions(+), 6 deletions(-)
drivers/nvme/target/admin-cmd.c +2 -0
@@ -437,6 +437,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)NVME_CTRL_ONCS_WRITE_ZEROES | NVME_CTRL_ONCS_COMPARE); + id->fuses =cpu_to_le16 (NVME_CTRL_FUSES_COMPARE_AND_WRITE ); +/* XXX: don't report vwc if the underlying device is write through */ id->vwc =NVME_CTRL_VWC_PRESENT ;
drivers/nvme/target/core.c +321 -4
372 lines not on this page · raw message
drivers/nvme/target/fc.c +1 -1
@@ -2186,7 +2186,7 @@ nvmet_fc_prep_fcp_rsp(struct nvmet_fc_tgtport *tgtport,nvme_is_fabrics ((struct nvme_command *) sqe) || xfr_length != fod->req.transfer_len || (le16_to_cpu (cqe->status) &0xFFFE ) || cqewd[0 ] || cqewd[1 ] || - (sqe->flags & (NVME_CMD_FUSE_FIRST |NVME_CMD_FUSE_SECOND )) || + (sqe->flags &NVME_CMD_FUSE_MASK ) || queue_90percent_full(fod->queue, le16_to_cpu(cqe->sq_head))) send_ersp = true;
drivers/nvme/target/nvmet.h +11 -1
@@ -102,6 +102,7 @@ struct nvmet_cq {u16 size; }; +struct nvmet_req ;struct nvmet_sq {struct nvmet_ctrl *ctrl;struct percpu_ref ref;
@@ -124,6 +125,8 @@ struct nvmet_sq {#endif struct completion free_done;struct completion confirm_done; +struct nvmet_req *first_fused_req; +spinlock_t fused_lock; };struct nvmet_ana_group {
@@ -340,7 +343,6 @@ struct nvmet_subsys_link {struct nvmet_subsys *subsys; }; -struct nvmet_req ;struct nvmet_fabrics_ops {struct module *owner;unsigned int type;
@@ -374,6 +376,14 @@ struct nvmet_req {struct scatterlist *sg;struct scatterlist *metadata_sg;struct scatterlist *cmp_sg; +struct nvmet_req *fused_pair; +struct work_struct fused_work; +spinlock_t fused_lock; +int fused_state; +#define NVMET_FUSED_STATE_INIT 0 +#define NVMET_FUSED_STATE_EXECUTING 1 +#define NVMET_FUSED_STATE_COMPLETED 2 +#define NVMET_FUSED_STATE_FAILED 3struct bio_vec inline_bvec[NVMET_MAX_INLINE_BIOVEC ]; union { struct {
include/linux/nvme.h +2 -0
@@ -374,6 +374,7 @@ enum {NVME_CTRL_ONCS_WRITE_ZEROES =1 <<3 ,NVME_CTRL_ONCS_RESERVATIONS =1 <<5 ,NVME_CTRL_ONCS_TIMESTAMP =1 <<6 , +NVME_CTRL_FUSES_COMPARE_AND_WRITE =1 <<0 ,NVME_CTRL_VWC_PRESENT =1 <<0 ,NVME_CTRL_OACS_SEC_SUPP =1 <<0 , NVME_CTRL_OACS_NS_MNGT_SUPP = 1 << 3,
@@ -949,6 +950,7 @@ union nvme_data_ptr {enum {NVME_CMD_FUSE_FIRST = (1 <<0 ),NVME_CMD_FUSE_SECOND = (1 <<1 ), +NVME_CMD_FUSE_MASK =NVME_CMD_FUSE_FIRST |NVME_CMD_FUSE_SECOND ,NVME_CMD_SGL_METABUF = (1 <<6 ),NVME_CMD_SGL_METASEG = (1 <<7 ),
Signature · 1 line
2.25.1
PATCH 6/7 nvmet: make fused commands be atomic
In reply to Dmitry BogdanovEnsure that the fused commands are executed in atomic manner. One Fused pair per whole namespace.
--- drivers/nvme/target/core.c | 6 ++++++ drivers/nvme/target/nvmet.h | 1 + 2 files changed, 7 insertions(+)
drivers/nvme/target/core.c +6 -0
@@ -705,6 +705,7 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)uuid_gen (&ns->uuid); ns->buffered_io = false; ns->csi =NVME_CSI_NVM ; +sema_init (&ns->caw_lock,1 );return ns; }
@@ -872,6 +873,8 @@ static void __nvmet_fused_req_complete(struct nvmet_req *req,spin_unlock (&second_req->fused_lock);spin_unlock_irqrestore (&first_req->fused_lock, flags); +up (&req->ns->caw_lock); +if (first_req->ns)nvmet_put_namespace (first_req->ns); first_req->ops->queue_response (first_req);
@@ -1376,6 +1379,8 @@ void nvmet_req_execute(struct nvmet_req *req)if (req->fused_pair->fused_state ==NVMET_FUSED_STATE_EXECUTING ) {spin_unlock (&req->fused_pair->fused_lock);spin_unlock (&req->fused_lock); + +down (&req->ns->caw_lock); req->execute (req);return ; }
@@ -1411,6 +1416,7 @@ void nvmet_req_execute(struct nvmet_req *req)spin_unlock (&req->fused_lock);spin_unlock (&first_req->fused_lock);/* both fused command are ready to execute */ +down (&req->ns->caw_lock); first_req->execute (first_req);return ; }
drivers/nvme/target/nvmet.h +1 -0
@@ -85,6 +85,7 @@ struct nvmet_ns {int pi_type;int metadata_size;u8 csi; +struct semaphore caw_lock; };static inline struct nvmet_ns *to_nvmet_ns (struct config_item *item)
Signature · 1 line
2.25.1
PATCH 7/7 nvme: allow send fused commands
In reply to Dmitry BogdanovAllow a user to pass fused flags for the commands.
--- drivers/nvme/host/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/host/ioctl.c +3 -3
@@ -220,7 +220,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)if (copy_from_user (&io, uio,sizeof (io)))return -EFAULT ; -if (io.flags) +if (io.flags &0xFC )return -EINVAL ;switch (io.opcode) {
@@ -299,7 +299,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,if (copy_from_user (&cmd, ucmd,sizeof (cmd)))return -EFAULT ; -if (cmd.flags) +if (cmd.flags &0xFC )return -EINVAL ;if (!nvme_validate_passthru_nsid (ctrl, ns, cmd.nsid))return -EINVAL ;
@@ -346,7 +346,7 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns,if (copy_from_user (&cmd, ucmd,sizeof (cmd)))return -EFAULT ; -if (cmd.flags) +if (cmd.flags &0xFC )return -EINVAL ;if (!nvme_validate_passthru_nsid (ctrl, ns, cmd.nsid))return -EINVAL ;
Signature · 1 line
2.25.1
Re: [PATCH 7/7] nvme: allow send fused commands
There is prior discussion about exactly this change at
https://github.com/linux-nvme/nvme-cli/issues/318. The concerns raised there still appear valid 6 years later. The main issue is that this interface requires 2 separate ioctls/io_uring operations to submit a Fused Compare and Write. That means the 2 commands could be submitted to different I/O queues, which wouldn't work. Not to mention that 2 threads are required in order to submit the commands concurrently if the blocking ioctls are used. Additionally, another application using the NVMe controller concurrently could submit a command in between the fused commands, which would also break the Fused Compare and Write.
FYI there was a set of patches sent to the mailing list
https://lore.kernel.org/linux-nvme/[email protected]/T/#u
that attempted to implement a new passthru ioctl for submitting fused commands. But it adds memory overhead to each NVMe request and there are a lot of corner cases to consider around error handling.
As an implementer of Fused Compare and Write on the target side, I can say the concept of "fused commands" is pretty horrible to work with. It breaks the model where each NVMe command is an independent operation and requires a ton of additional error propagation logic. Not to mention that the NSID, SLBA, and NLB parameters are now duplicated between the 2 commands... As far as I can tell, the only reason to make the operation 2 commands is to allow a separate PRP/SGL for each command. I guess this avoids the memcpy that would be required if a single concatenated data buffer was used? But at what cost???
Quoted 43 lines · Dmitry Bogdanov
Allow a user to pass fused flags for the commands.
Signed-off-by Dmitry Bogdanov <[email protected]>--- drivers/nvme/host/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/nvme/host/ioctl.c +3
-4@@ -220,7 +220,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)if (copy_from_user (&io, uio,sizeof (io)))return -EFAULT ; -if (io.flags) +if (io.flags &0xFC )return -EINVAL ;switch (io.opcode) {@@ -299,7 +299,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,if (copy_from_user (&cmd, ucmd,sizeof (cmd)))return -EFAULT ; -if (cmd.flags) +if (cmd.flags &0xFC )return -EINVAL ;if (!nvme_validate_passthru_nsid (ctrl, ns, cmd.nsid))return -EINVAL ;@@ -346,7 +346,7 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns,if (copy_from_user (&cmd, ucmd,sizeof (cmd)))return -EFAULT ; -if (cmd.flags) +if (cmd.flags &0xFC )return -EINVAL ;if (!nvme_validate_passthru_nsid (ctrl, ns, cmd.nsid))return -EINVAL ; --2.25.1
Re: [PATCH 7/7] nvme: allow send fused commands
Hi,
Quoted 10 lines
There is prior discussion about exactly this change at
https://github.com/linux-nvme/nvme-cli/issues/318. The concerns raised there still appear valid 6 years later. The main issue is that this interface requires 2 separate ioctls/io_uring operations to submit a Fused Compare and Write. That means the 2 commands could be submitted to different I/O queues, which wouldn't work. Not to mention that 2 threads are required in order to submit the commands concurrently if the blocking ioctls are used. Additionally, another application using the NVMe controller concurrently could submit a command in between the fused commands, which would also break the Fused Compare and Write.
This patch is not for a production usage of Fused commands from the host, but instead it is just for the purpose to test the target side. Of course, it has some limitations like working only with one IO queue and one user, but all of that is under the user's control:
# nvme connect-all -i 1 -t tcp # nvme io-passthru --o 0x5 -n 1 -f 0x1 -w --cdw10=0 --cdw12=0x0 -l 4096 -i ./4k0 /dev/nvme0n1 & nvme io-passthru --o 0x1 -n 1 -f 0x2 -w --cdw10=0 --cdw12=0x0 -l 4096 -i ./4k1 /dev/nvme0n1 NVMe command result:00000000 NVMe command result:00000000
And the patch provides enough kernel functionality to test the target side.
Quoted 23 lines
FYI there was a set of patches sent to the mailing list
https://lore.kernel.org/linux-nvme/[email protected]/T/#u
that attempted to implement a new passthru ioctl for submitting fused commands. But it adds memory overhead to each NVMe request and there are a lot of corner cases to consider around error handling.As an implementer of Fused Compare and Write on the target side, I can say the concept of "fused commands" is pretty horrible to work with. It breaks the model where each NVMe command is an independent operation and requires a ton of additional error propagation logic. Not to mention that the NSID, SLBA, and NLB parameters are now duplicated between the 2 commands... As far as I can tell, the only reason to make the operation 2 commands is to allow a separate PRP/SGL for each command. I guess this avoids the memcpy that would be required if a single concatenated data buffer was used? But at what cost???
Quoted 4 lines · Dmitry Bogdanov
Allow a user to pass fused flags for the commands.
Signed-off-by Dmitry Bogdanov <[email protected]>