From nobody Mon Feb 9 03:03:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543261550147593.4571952162172; Mon, 26 Nov 2018 11:45:50 -0800 (PST) Received: from localhost ([::1]:38454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRMp7-0003yv-5q for importer@patchew.org; Mon, 26 Nov 2018 14:45:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRMkN-00081D-Uh for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:40:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRMkN-0004IE-31 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:40:43 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39727) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRMkM-0004Hv-TT for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:40:43 -0500 Received: by mail-wr1-x42e.google.com with SMTP id t27so12265244wra.6 for ; Mon, 26 Nov 2018 11:40:42 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id s139sm2412468wmd.3.2018.11.26.11.40.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 11:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=g9DQblS5alv7eceXBvQoMJeu4n6ray3NZcYJEG924tg=; b=Fme5xRAMwfFTfZ4H9xj1qFZK90hEWRvrFGQhrh8qGMSlBXE8e1HDdVrsEsNm94vb0X BDGXvSxmt2TPQlr8iCRhWAE4k+RLg0W4fUKNWja6wp0Vh+q6GoFREm/PuombGLonFfzy Xad0ePdv0vsmn6LjrtjkUFLI6ZSZXETdByV2EOK+Mmk+z8p5TF/yWl6o2b84x6iUxvGg qxf3KFQTiB5rXKQRChKhqJ5JHJyu+q9EfaNWpMd7AqrWfTF+/k098Xv1f7j0o8SHZ++U AXZxNxkiU13QUv2IFjQ5KIV3/lOtd/Kt4y9HgKTtOw2vPRRwPakwvD2TMK+4QI7GK6bA y1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=g9DQblS5alv7eceXBvQoMJeu4n6ray3NZcYJEG924tg=; b=K4GGwmAEBlbOR7ungW8/ph+SN77RkGEio5iK4v153kmNPOziCftfmokUVG2TU1rUIB 1wOQkxDEVFAKKzSCta4NNQ2TNUaMEoIu/6mstwz/zTLIQsxFH5KgXJ5aBY2XhjATUkUB HwAfGygUUdYTwAiH2pugbZo9bPvKAROgwra4oWEiQFWCw41Y1R1YntqoY1MYyYzLZNik 8auHdGkKh47MtTa5bH2m29dGl8jXvmwjGzwRMAi117SVBErpziTp4/Z/7KpFIthQLgz2 BzOGWI2EHEp4UWrjPwsoGjSz38Z3t94DuPHtrGDY2k4RjmilJOzTxj9BgMhWNToeQOLi FpaA== X-Gm-Message-State: AA+aEWZl16P6n1S4lqu8wfwAEmdmBbzwMbbH5+I/mjC3PL4X2nvBaT1Y WzzVKZmH188K1WAX9H+Pe2nDQFOZ X-Google-Smtp-Source: AFSGD/UiQMxRbzoRbmqULGDGiCYj0MEWByx13Q77n/mcWf8wWbTNJvkIQQo0bdeqM4pc1L3fPhS9lQ== X-Received: by 2002:a05:6000:104b:: with SMTP id c11mr25418341wrx.303.1543261241312; Mon, 26 Nov 2018 11:40:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 20:40:23 +0100 Message-Id: <1543261235-2834-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543261235-2834-1-git-send-email-pbonzini@redhat.com> References: <1543261235-2834-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PULL 03/15] lsi: Reselection needed to remove pending commands from queue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: George Kennedy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: George Kennedy 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 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 --- 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); } =20 +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; =20 /* 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); =20 - if (!level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON)) { + if (!s->current && !level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SC= NTL1_CON)) { + lsi_request *p; + trace_lsi_update_irq_disconnected(); - QTAILQ_FOREACH(p, &s->queue, next) { - if (p->pending) { - lsi_reselect(s, p); - break; - } + p =3D get_pending_req(s); + if (p) { + lsi_reselect(s, p); } } } @@ -1065,11 +1076,12 @@ static void lsi_wait_reselect(LSIState *s) =20 trace_lsi_wait_reselect(); =20 - QTAILQ_FOREACH(p, &s->queue, next) { - if (p->pending) { - lsi_reselect(s, p); - break; - } + if (s->current) { + return; + } + p =3D get_pending_req(s); + if (p) { + lsi_reselect(s, p); } if (s->current =3D=3D NULL) { s->waiting =3D 1; @@ -1259,6 +1271,18 @@ again: case 1: /* Disconnect */ trace_lsi_execute_script_io_disconnect(); s->scntl1 &=3D ~LSI_SCNTL1_CON; + /* FIXME: this is not entirely correct; the target need no= t ask + * for reselection until it has to send data, while here w= e force a + * reselection as soon as the bus is free. The correct fl= ow would + * reselect before lsi_transfer_data and disconnect as soo= n as + * DMA ends. + */ + if (!s->current) { + lsi_request *p =3D get_pending_req(s); + if (p) { + lsi_reselect(s, p); + } + } break; case 2: /* Wait Reselect */ if (!lsi_irq_on_rsl(s)) { --=20 1.8.3.1