* [PATCH] hw/nvme: set DNR on compare failure
@ 2022-08-25 5:32 Klaus Jensen
2022-11-02 7:58 ` Klaus Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Klaus Jensen @ 2022-08-25 5:32 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Klaus Jensen, Keith Busch, Klaus Jensen, Jim Harris
From: Klaus Jensen <k.jensen@samsung.com>
Even if the host is somehow using compare to do compare-and-write, the
host should be notified immediately about the compare failure and not
have to wait for the driver to potentially retry the command.
Reported-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 87aeba056499..299cbb1f2205 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -2242,7 +2242,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
for (bufp = buf; mbufp < end; bufp += ns->lbaf.ms, mbufp += ns->lbaf.ms) {
if (memcmp(bufp + pil, mbufp + pil, ns->lbaf.ms - pil)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
}
@@ -2251,7 +2251,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
}
if (memcmp(buf, ctx->mdata.bounce, ctx->mdata.iov.size)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
@@ -2300,7 +2300,7 @@ static void nvme_compare_data_cb(void *opaque, int ret)
}
if (memcmp(buf, ctx->data.bounce, ctx->data.iov.size)) {
- req->status = NVME_CMP_FAILURE;
+ req->status = NVME_CMP_FAILURE | NVME_DNR;
goto out;
}
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw/nvme: set DNR on compare failure
2022-08-25 5:32 [PATCH] hw/nvme: set DNR on compare failure Klaus Jensen
@ 2022-11-02 7:58 ` Klaus Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Klaus Jensen @ 2022-11-02 7:58 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Keith Busch, Klaus Jensen, Jim Harris
[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]
On Aug 25 07:32, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Even if the host is somehow using compare to do compare-and-write, the
> host should be notified immediately about the compare failure and not
> have to wait for the driver to potentially retry the command.
>
> Reported-by: Jim Harris <james.r.harris@intel.com>
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
> hw/nvme/ctrl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 87aeba056499..299cbb1f2205 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -2242,7 +2242,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
>
> for (bufp = buf; mbufp < end; bufp += ns->lbaf.ms, mbufp += ns->lbaf.ms) {
> if (memcmp(bufp + pil, mbufp + pil, ns->lbaf.ms - pil)) {
> - req->status = NVME_CMP_FAILURE;
> + req->status = NVME_CMP_FAILURE | NVME_DNR;
> goto out;
> }
> }
> @@ -2251,7 +2251,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
> }
>
> if (memcmp(buf, ctx->mdata.bounce, ctx->mdata.iov.size)) {
> - req->status = NVME_CMP_FAILURE;
> + req->status = NVME_CMP_FAILURE | NVME_DNR;
> goto out;
> }
>
> @@ -2300,7 +2300,7 @@ static void nvme_compare_data_cb(void *opaque, int ret)
> }
>
> if (memcmp(buf, ctx->data.bounce, ctx->data.iov.size)) {
> - req->status = NVME_CMP_FAILURE;
> + req->status = NVME_CMP_FAILURE | NVME_DNR;
> goto out;
> }
>
> --
> 2.37.2
>
Bump :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-02 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 5:32 [PATCH] hw/nvme: set DNR on compare failure Klaus Jensen
2022-11-02 7:58 ` Klaus Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).