Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
qemu.23275
scsi-add-tracing-for-SG_IO-commands.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File scsi-add-tracing-for-SG_IO-commands.patch of Package qemu.23275
From: Hannes Reinecke <hare@suse.de> Date: Thu, 12 Nov 2020 14:02:24 +0100 Subject: scsi: add tracing for SG_IO commands References: bsc#1178049 Add tracepoints for SG_IO commands to get a grip on the timeout settings. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Bruce Rogers <brogers@suse.com> --- hw/scsi/scsi-disk.c | 3 ++- hw/scsi/scsi-generic.c | 12 +++++++++--- hw/scsi/trace-events | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 29eb2e6629297342f34bac5d98bd..2240478deb6488d2947e7e9e56ef 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2775,7 +2775,8 @@ static BlockAIOCB *scsi_block_do_sgio(SCSIBlockReq *req, io_header->timeout = s->qdev.io_timeout; io_header->usr_ptr = r; io_header->flags |= SG_FLAG_DIRECT_IO; - + trace_scsi_disk_aio_sgio_command(r->req.tag, req->cdb[0], lba, + nb_logical_blocks, io_header->timeout); aiocb = blk_aio_ioctl(s->qdev.conf.blk, SG_IO, io_header, cb, opaque); assert(aiocb != NULL); return aiocb; diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 3027885538ad20f8cddbad8c4026..6ea04de98c04aa36aa68230a6b87 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -128,6 +128,8 @@ static int execute_command(BlockBackend *blk, r->io_header.usr_ptr = r; r->io_header.flags |= SG_FLAG_DIRECT_IO; + trace_scsi_generic_aio_sgio_command(r->req.tag, r->req.cmd.buf[0], + r->io_header.timeout); r->req.aiocb = blk_aio_ioctl(blk, SG_IO, &r->io_header, complete, r); if (r->req.aiocb == NULL) { return -EIO; @@ -334,7 +336,7 @@ static void scsi_read_data(SCSIRequest *req) SCSIDevice *s = r->req.dev; int ret; - trace_scsi_generic_read_data(req->tag); + trace_scsi_generic_read_data(req->tag, s->io_timeout); /* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref(&r->req); @@ -387,7 +389,7 @@ static void scsi_write_data(SCSIRequest *req) SCSIDevice *s = r->req.dev; int ret; - trace_scsi_generic_write_data(req->tag); + trace_scsi_generic_write_data(req->tag, s->io_timeout); if (r->len == 0) { r->len = r->buflen; scsi_req_data(&r->req, r->len); @@ -522,8 +524,12 @@ int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size, io_header.sbp = sensebuf; io_header.timeout = timeout; + trace_scsi_generic_ioctl_sgio_command(cmd[0], io_header.timeout); ret = blk_ioctl(blk, SG_IO, &io_header); - if (ret < 0 || io_header.driver_status || io_header.host_status) { + if (ret < 0 || io_header.status || + io_header.driver_status || io_header.host_status) { + trace_scsi_generic_ioctl_sgio_done(cmd[0], ret, io_header.status, + io_header.host_status); return -1; } return 0; diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 9e1196f2117982c5bbc5db3bfffb..13babd26dff43d5052886cf955a5 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -327,14 +327,18 @@ scsi_disk_emulate_command_UNKNOWN(int cmd, const char *name) "Unknown SCSI comma scsi_disk_dma_command_READ(uint64_t lba, uint32_t len) "Read (sector %" PRId64 ", count %u)" scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write %s(sector %" PRId64 ", count %u)" scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Command: lun=%d tag=0x%x data=%s" +scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int len, uint32_t timeout) "disk aio sgio: tag=0x%x cmd 0x%x (sector %" PRId64 ", count %d) timeout %u" # scsi-generic.c scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc) "Command complete %p tag=0x%x status=%d" scsi_generic_read_complete(uint32_t tag, int len) "Data ready tag=0x%x len=%d" -scsi_generic_read_data(uint32_t tag) "scsi_read_data tag=0x%x" +scsi_generic_read_data(uint32_t tag, uint32_t timeout) "scsi_read_data tag=0x%x timeout %u" scsi_generic_write_complete(int ret) "scsi_write_complete() ret = %d" scsi_generic_write_complete_blocksize(int blocksize) "block size %d" -scsi_generic_write_data(uint32_t tag) "scsi_write_data tag=0x%x" +scsi_generic_write_data(uint32_t tag, uint32_t timeout) "scsi_write_data tag=0x%x timeout %u" scsi_generic_send_command(const char *line) "Command: data=%s" scsi_generic_realize_type(int type) "device type %d" scsi_generic_realize_blocksize(int blocksize) "block size %d" +scsi_generic_aio_sgio_command(uint32_t tag, uint8_t cmd, uint32_t timeout) "generic aio sgio: tag=0x%x cmd 0x%x, timeout %u" +scsi_generic_ioctl_sgio_command(uint8_t cmd, uint32_t timeout) "generic ioctl sgio: cmd 0x%x timeout %u" +scsi_generic_ioctl_sgio_done(uint8_t cmd, int ret, uint8_t status, uint8_t host_status) "generic ioctl sgio: cmd 0x%x ret %d status 0x%x host_status 0x%x"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor