From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: George Kennedy <george.kennedy@oracle.com>
Subject: [Qemu-devel] [PULL 03/15] lsi: Reselection needed to remove pending commands from queue
Date: Mon, 26 Nov 2018 20:40:23 +0100 [thread overview]
Message-ID: <1543261235-2834-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1543261235-2834-1-git-send-email-pbonzini@redhat.com>
From: George Kennedy <george.kennedy@oracle.com>
Under heavy IO (e.g. fio) the queue is not checked frequently enough for
pending commands. As a result some pending commands are timed out by the
linux sym53c8xx driver, which sends SCSI Abort messages for the timed out
commands. The SCSI Abort messages result in linux errors, which show up
on the console and in /var/log/messages.
e.g.
sd 0:0:3:0: [sdd] tag#33 ABORT operation started
scsi target0:0:3: control msgout:
80 20 47 d
sd 0:0:3:0: ABORT operation complete.
scsi target0:0:4: message d sent on bad reselection
Now following a WAIT DISCONNECT Script instruction, and if there is no
current command, check for a pending command on the queue and if one
exists call lsi_reselect().
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Message-Id: <1541776692-12271-1-git-send-email-george.kennedy@oracle.com>
[For safety, add a s->current check in lsi_update_irq - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/lsi53c895a.c | 48 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 3f207f6..52a3893 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -298,6 +298,18 @@ static inline int lsi_irq_on_rsl(LSIState *s)
return (s->sien0 & LSI_SIST0_RSL) && (s->scid & LSI_SCID_RRE);
}
+static lsi_request *get_pending_req(LSIState *s)
+{
+ lsi_request *p;
+
+ QTAILQ_FOREACH(p, &s->queue, next) {
+ if (p->pending) {
+ return p;
+ }
+ }
+ return NULL;
+}
+
static void lsi_soft_reset(LSIState *s)
{
trace_lsi_reset();
@@ -446,7 +458,6 @@ static void lsi_update_irq(LSIState *s)
{
int level;
static int last_level;
- lsi_request *p;
/* It's unclear whether the DIP/SIP bits should be cleared when the
Interrupt Status Registers are cleared or when istat0 is read.
@@ -476,13 +487,13 @@ static void lsi_update_irq(LSIState *s)
}
lsi_set_irq(s, level);
- if (!level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON)) {
+ if (!s->current && !level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON)) {
+ lsi_request *p;
+
trace_lsi_update_irq_disconnected();
- QTAILQ_FOREACH(p, &s->queue, next) {
- if (p->pending) {
- lsi_reselect(s, p);
- break;
- }
+ p = get_pending_req(s);
+ if (p) {
+ lsi_reselect(s, p);
}
}
}
@@ -1065,11 +1076,12 @@ static void lsi_wait_reselect(LSIState *s)
trace_lsi_wait_reselect();
- QTAILQ_FOREACH(p, &s->queue, next) {
- if (p->pending) {
- lsi_reselect(s, p);
- break;
- }
+ if (s->current) {
+ return;
+ }
+ p = get_pending_req(s);
+ if (p) {
+ lsi_reselect(s, p);
}
if (s->current == NULL) {
s->waiting = 1;
@@ -1259,6 +1271,18 @@ again:
case 1: /* Disconnect */
trace_lsi_execute_script_io_disconnect();
s->scntl1 &= ~LSI_SCNTL1_CON;
+ /* FIXME: this is not entirely correct; the target need not ask
+ * for reselection until it has to send data, while here we force a
+ * reselection as soon as the bus is free. The correct flow would
+ * reselect before lsi_transfer_data and disconnect as soon as
+ * DMA ends.
+ */
+ if (!s->current) {
+ lsi_request *p = get_pending_req(s);
+ if (p) {
+ lsi_reselect(s, p);
+ }
+ }
break;
case 2: /* Wait Reselect */
if (!lsi_irq_on_rsl(s)) {
--
1.8.3.1
next prev parent reply other threads:[~2018-11-26 19:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 19:40 [Qemu-devel] [PULL 00/15] Misc patches for QEMU 3.1-rc3 Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 01/15] target/i386: kvm: add VMX migration blocker Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 02/15] cpus: run work items for all vCPUs if single-threaded Paolo Bonzini
2018-11-26 19:40 ` Paolo Bonzini [this message]
2018-11-26 19:40 ` [Qemu-devel] [PULL 04/15] migration: savevm: consult migration blockers Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 05/15] vmstate: constify VMStateField Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 06/15] vl: Improve error message when we can't load fw_cfg from file Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 07/15] vhost-user-bridge: fix recvmsg iovlen Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 08/15] vl.c: remove outdated comment Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 09/15] checkpatch: g_test_message does not need a trailing newline Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 10/15] target/i386: Generate #UD when applying LOCK to a register destination Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 11/15] MAINTAINERS: Add some missing entries related to accelerators Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 12/15] MAINTAINERS: Add an entry for the Firmware Configuration (fw_cfg) device Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 13/15] configure: fix elf2dmp check Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 14/15] hostmem-memfd: honour share=on/off property Paolo Bonzini
2018-11-26 19:40 ` [Qemu-devel] [PULL 15/15] hostmem: no need to check for host_memory_backend_mr_inited() in alloc() Paolo Bonzini
2018-11-27 9:54 ` [Qemu-devel] [PULL 00/15] Misc patches for QEMU 3.1-rc3 Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2018-11-27 14:36 [Qemu-devel] [PULL v2 " Paolo Bonzini
2018-11-27 14:36 ` [Qemu-devel] [PULL 03/15] lsi: Reselection needed to remove pending commands from queue 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=1543261235-2834-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=george.kennedy@oracle.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).