Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
qemu
0163-scsi-add-tracing-for-SG_IO-commands.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0163-scsi-add-tracing-for-SG_IO-commands.patch of Package qemu
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 524f58ea0b26847569f22a419097..25d007722975b4cd9b31fd331e8f 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2696,7 +2696,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 802071b117ffb89ee12b15f5719b..0a0f8e6094f0c8ec2c23f89c4a8b 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -125,6 +125,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; @@ -327,7 +329,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); @@ -380,7 +382,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); @@ -515,8 +517,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 61b75d707e0bd01955e8d88ab92c..5b957abad543982a5fef2994bb55 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -326,14 +326,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" # hw/scsi/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