From nobody Sat May 4 05:14:18 2024 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=pass; 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=pass(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541777417868281.31456020321514; Fri, 9 Nov 2018 07:30:17 -0800 (PST) Received: from localhost ([::1]:34756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gL8jd-00012Z-1Q for importer@patchew.org; Fri, 09 Nov 2018 10:30:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gL8bm-0001gX-Uv for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:22:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gL8bj-0004lP-P4 for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:22:06 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gL8bj-0004Xy-F5 for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:22:03 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wA9FIwie185112; Fri, 9 Nov 2018 15:21:59 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2nh4ar7h91-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Nov 2018 15:21:59 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wA9FLwdl029836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Nov 2018 15:21:58 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wA9FLw3H007187; Fri, 9 Nov 2018 15:21:58 GMT Received: from dhcp-10-152-34-187.usdhcp.oraclecorp.com.com (/10.152.34.187) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 09 Nov 2018 07:21:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2018-07-02; bh=6sieCeHk/DTk8caOtx1aigTZgbQCFjiPwAeIByH3gNk=; b=ckXjwigyjf6KVtj5tk69QrTAj7c4O5663Jg8iDPK53FetIg0D+Ezt3tw42HLp3TFsl/x gQ2PDaLUx+F0Y9lVxJv2C5n1faOB9qdzmFh/ChiCGauOj38TJRQsQjuzNtljquv6FGWx nWrQRgoewh1N/IMxEkCBBL1u6YGSGdXGQ3B2N4HXhQ9asrY0sLK/PrOSKJuKXDw+QgCx O1e+Qaqx4GVBJ2+ZvVXMclDn69Xhm/41cBu6JEv6WSp/65lgB8HxddvMx3dJ7FAlq/Jv YBENkYdzugIwh7nCtCmafzeHopF+KGNBxOujvPcZfhtD5blib9ZodyW6UtsBYP3dC3FM yg== From: George Kennedy To: pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, boris.ostrovsky@oracle.com Date: Fri, 9 Nov 2018 10:18:12 -0500 Message-Id: <1541776692-12271-1-git-send-email-george.kennedy@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9071 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=967 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811090140 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH v7] 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- Thanks again Paolo, Your latest suggested fix reduces the patch even further. Now there's no need for a "pending" flag. (Will try to find the intermediary patches and mail them offlist). hw/scsi/lsi53c895a.c | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index d1e6534..959b893 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. @@ -477,12 +488,12 @@ 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)) { + 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); } } } @@ -1064,11 +1075,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; @@ -1258,6 +1270,12 @@ again: case 1: /* Disconnect */ trace_lsi_execute_script_io_disconnect(); s->scntl1 &=3D ~LSI_SCNTL1_CON; + 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