Message ID | 20200930220414.562527-9-kbusch@kernel.org |
---|---|
State | New |
Headers | show |
Series | nvme qemu cleanups and fixes | expand |
> -----Original Message----- > From: Keith Busch <kbusch@kernel.org> > Sent: Wednesday, September 30, 2020 6:04 PM > To: qemu-block@nongnu.org; qemu-devel@nongnu.org; Klaus Jensen > <k.jensen@samsung.com> > Cc: Niklas Cassel <Niklas.Cassel@wdc.com>; Dmitry Fomichev > <Dmitry.Fomichev@wdc.com>; Kevin Wolf <kwolf@redhat.com>; Philippe > Mathieu-Daudé <philmd@redhat.com>; Keith Busch <kbusch@kernel.org> > Subject: [PATCH 8/9] hw/block/nvme: add trace event for requests with > non-zero status code > > From: Klaus Jensen <k.jensen@samsung.com> > > If a command results in a non-zero status code, trace it. > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> > Signed-off-by: Keith Busch <kbusch@kernel.org> > --- > hw/block/nvme.c | 6 ++++++ > hw/block/trace-events | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/hw/block/nvme.c b/hw/block/nvme.c > index dc971c9653..16804d0278 100644 > --- a/hw/block/nvme.c > +++ b/hw/block/nvme.c > @@ -777,6 +777,12 @@ static void > nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req) > assert(cq->cqid == req->sq->cqid); > trace_pci_nvme_enqueue_req_completion(nvme_cid(req), cq->cqid, > req->status); > + > + if (req->status) { > + trace_pci_nvme_err_req_status(nvme_cid(req), nvme_nsid(req->ns), > + req->status, req->cmd.opcode); > + } > + Very useful. Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> > QTAILQ_REMOVE(&req->sq->out_req_list, req, entry); > QTAILQ_INSERT_TAIL(&cq->req_list, req, entry); > timer_mod(cq->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + > 500); > diff --git a/hw/block/trace-events b/hw/block/trace-events > index 180c43d258..ff3ca4bbf6 100644 > --- a/hw/block/trace-events > +++ b/hw/block/trace-events > @@ -89,6 +89,7 @@ pci_nvme_mmio_shutdown_cleared(void) "shutdown > bit cleared" > > # nvme traces for error conditions > pci_nvme_err_mdts(uint16_t cid, size_t len) "cid %"PRIu16" len %zu" > +pci_nvme_err_req_status(uint16_t cid, uint32_t nsid, uint16_t status, > uint8_t opc) "cid %"PRIu16" nsid %"PRIu32" status 0x%"PRIx16" opc > 0x%"PRIx8"" > pci_nvme_err_addr_read(uint64_t addr) "addr 0x%"PRIx64"" > pci_nvme_err_addr_write(uint64_t addr) "addr 0x%"PRIx64"" > pci_nvme_err_cfs(void) "controller fatal status" > -- > 2.24.1
On 10/1/20 12:04 AM, Keith Busch wrote: > From: Klaus Jensen <k.jensen@samsung.com> > > If a command results in a non-zero status code, trace it. > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> > Signed-off-by: Keith Busch <kbusch@kernel.org> > --- > hw/block/nvme.c | 6 ++++++ > hw/block/trace-events | 1 + > 2 files changed, 7 insertions(+) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index dc971c9653..16804d0278 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -777,6 +777,12 @@ static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req) assert(cq->cqid == req->sq->cqid); trace_pci_nvme_enqueue_req_completion(nvme_cid(req), cq->cqid, req->status); + + if (req->status) { + trace_pci_nvme_err_req_status(nvme_cid(req), nvme_nsid(req->ns), + req->status, req->cmd.opcode); + } + QTAILQ_REMOVE(&req->sq->out_req_list, req, entry); QTAILQ_INSERT_TAIL(&cq->req_list, req, entry); timer_mod(cq->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 500); diff --git a/hw/block/trace-events b/hw/block/trace-events index 180c43d258..ff3ca4bbf6 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -89,6 +89,7 @@ pci_nvme_mmio_shutdown_cleared(void) "shutdown bit cleared" # nvme traces for error conditions pci_nvme_err_mdts(uint16_t cid, size_t len) "cid %"PRIu16" len %zu" +pci_nvme_err_req_status(uint16_t cid, uint32_t nsid, uint16_t status, uint8_t opc) "cid %"PRIu16" nsid %"PRIu32" status 0x%"PRIx16" opc 0x%"PRIx8"" pci_nvme_err_addr_read(uint64_t addr) "addr 0x%"PRIx64"" pci_nvme_err_addr_write(uint64_t addr) "addr 0x%"PRIx64"" pci_nvme_err_cfs(void) "controller fatal status"