From nobody Mon Feb 9 09:52:52 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543329554441571.9835800385606; Tue, 27 Nov 2018 06:39:14 -0800 (PST) Received: from localhost ([::1]:42782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gReW2-0005Ju-8D for importer@patchew.org; Tue, 27 Nov 2018 09:39:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gReTp-0003jt-M7 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:36:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gReTo-0001Hw-MD for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:36:49 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:55851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gReTo-0001Gu-Fo for qemu-devel@nongnu.org; Tue, 27 Nov 2018 09:36:48 -0500 Received: by mail-wm1-x335.google.com with SMTP id y139so21952796wmc.5 for ; Tue, 27 Nov 2018 06:36:48 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n62sm2821869wmd.25.2018.11.27.06.36.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 06:36:45 -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=KKkCvVVYmnulUMb3kiw6V31Am+Hd6OHlQZfu9gsiv52UvfwzYKQA/Rt8lbuUWZg5wj LtEfFZ+YItFvn8Brw+3MoLl9EYubgAmoe2BVWa9el1ZL8o5fS9+bXRhjciEaXEYR+nJd PN6c8MCrNxUkG6ipHmY/arRpduqQriRa1sv9Akxf+7hsVdu60mJ0Xpz8H8ME6MSlyEnS /RM/xJ5rnelynqgHNFYWwi1on5LG1AegOl4BEcFgkr8ekpnNvIA1xJcboWFtg6VWnyv/ WHXy1i8gjYFrQie+nHZOej0OZnVJ6FcMWLtmsMhfLskH3BELHgmdS5DcuLz3IEmL0Bpb nwVQ== 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=uO7vRa84RP6Uqinuj494v3fC1+7QJ7S/pqgOwQVSaEdoeBb0qMZtvqA4i3UJzRLKgI X6vJqWSkRoqRYJ/KnTcCeP7gSbPc9wVVv6/apStRb8HX2a3AT8VNH/s4AoILaZTjkIfb t4SMWiei/aYt3RAo8TUTmOzkmbagvDWTFvvBAyliqpvl7o0j4V2Hpwo07l93drcCgggQ yTQ15QcePZk3DsUG4caJOEQBjwYnk2id406qjLSJEEeaQ0bL24Oi/VCstnyHqa2l8exr Orx+qcd+XJzzn/CBxbpmKoGum29PkOFOe9M1w10pllZ9ymDl/vI++LxvIehXXmOn2XrR rqaQ== X-Gm-Message-State: AA+aEWbzhA3tjaJWJBzzIhKpR3Pj81U6yojOhJfc0MhTz7jR4T3KWheG X1N9w1angu74PsZF7Ve5gJ1DCiE/ X-Google-Smtp-Source: AFSGD/WSuhUFe7rdZ0B+bJmI+9LwzrSWC0AYcEUTkoP2kcaqRdrtXy/9ZuaEusNx+pgEENzdmWuW/w== X-Received: by 2002:a1c:f0e:: with SMTP id 14mr8831104wmp.37.1543329406942; Tue, 27 Nov 2018 06:36:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 15:36:25 +0100 Message-Id: <1543329397-48407-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543329397-48407-1-git-send-email-pbonzini@redhat.com> References: <1543329397-48407-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::335 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