From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Hannes Reinecke <hare@suse.de>, Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] scsi: make io_timeout configurable
Date: Wed, 22 Sep 2021 17:47:37 +0200 [thread overview]
Message-ID: <dae9daae-aa8d-ddb7-ecf3-95e91defea53@redhat.com> (raw)
In-Reply-To: <20201116183114.55703-3-hare@suse.de>
Hi Hannes,
On 11/16/20 19:31, Hannes Reinecke wrote:
> The current code sets an infinite timeout on SG_IO requests,
> causing the guest to stall if the host experiences a frame
> loss.
> This patch adds an 'io_timeout' parameter for SCSIDevice to
> make the SG_IO timeout configurable, and also shortens the
> default timeout to 30 seconds to avoid infinite stalls.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> hw/scsi/scsi-disk.c | 6 ++++--
> hw/scsi/scsi-generic.c | 17 +++++++++++------
> include/hw/scsi/scsi.h | 4 +++-
> 3 files changed, 18 insertions(+), 9 deletions(-)
> int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
> - uint8_t *buf, uint8_t buf_size)
> + uint8_t *buf, uint8_t buf_size, uint32_t timeout)
> {
> sg_io_hdr_t io_header;
> uint8_t sensebuf[8];
> @@ -520,7 +522,7 @@ int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
> io_header.cmd_len = cmd_size;
> io_header.mx_sb_len = sizeof(sensebuf);
> io_header.sbp = sensebuf;
> - io_header.timeout = 6000; /* XXX */
> + io_header.timeout = timeout * 1000;
> @@ -637,7 +639,7 @@ static int get_stream_blocksize(BlockBackend *blk)
> cmd[0] = MODE_SENSE;
> cmd[4] = sizeof(buf);
>
> - ret = scsi_SG_IO_FROM_DEV(blk, cmd, sizeof(cmd), buf, sizeof(buf));
> + ret = scsi_SG_IO_FROM_DEV(blk, cmd, sizeof(cmd), buf, sizeof(buf), 6);
Why is this timeout hardcoded? Due to the /* XXX */ comment?
next prev parent reply other threads:[~2021-09-22 15:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 18:31 [PATCH 0/3] scsi: infinite guest hangs with scsi-disk Hannes Reinecke
2020-11-16 18:31 ` [PATCH 1/3] virtio-scsi: trace events Hannes Reinecke
2020-11-16 18:31 ` [PATCH 2/3] scsi: make io_timeout configurable Hannes Reinecke
2021-09-20 18:56 ` Paolo Bonzini
2021-09-21 5:39 ` Hannes Reinecke
2021-09-21 7:25 ` Paolo Bonzini
2021-09-22 15:47 ` Philippe Mathieu-Daudé [this message]
2021-09-23 6:03 ` Hannes Reinecke
2021-09-23 7:19 ` Paolo Bonzini
2020-11-16 18:31 ` [PATCH 3/3] scsi: add tracing for SG_IO commands Hannes Reinecke
2020-11-16 19:09 ` [PATCH 0/3] scsi: infinite guest hangs with scsi-disk no-reply
2020-12-17 13:49 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dae9daae-aa8d-ddb7-ecf3-95e91defea53@redhat.com \
--to=philmd@redhat.com \
--cc=hare@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).