From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755033AbbLFEA7 (ORCPT ); Sat, 5 Dec 2015 23:00:59 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:53124 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754199AbbLFDoB (ORCPT ); Sat, 5 Dec 2015 22:44:01 -0500 Message-Id: <20151206013132.635523027@telegraphics.com.au> User-Agent: quilt/0.50-1 Date: Sun, 06 Dec 2015 12:31:49 +1100 From: Finn Thain To: "James E.J. Bottomley" , Michael Schmitz , , , Subject: [PATCH v2 23/72] ncr5380: Always retry arbitration and selection References: <20151206013126.995379403@telegraphics.com.au> Content-Disposition: inline; filename=ncr5380-retry-selection-phase Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If NCR5380_select() returns -1, it means arbitration was lost or selection failed and should be retried. If the main loop simply terminates when there are still commands on the issue queue, they will remain queued until they expire. Fix this by clearing the 'done' flag after selection failure or lost arbitration. The "else break" clause in NCR5380_main() that gets removed here appears to be a vestige of a long-gone loop that iterated over host instances. See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in history/history.git. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 3 +-- drivers/scsi/atari_NCR5380.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) Index: linux/drivers/scsi/NCR5380.c =================================================================== --- linux.orig/drivers/scsi/NCR5380.c 2015-12-06 12:29:56.000000000 +1100 +++ linux/drivers/scsi/NCR5380.c 2015-12-06 12:30:00.000000000 +1100 @@ -1047,8 +1047,7 @@ static void NCR5380_main(struct work_str NCR5380_information_transfer(instance); dprintk(NDEBUG_MAIN, "scsi%d : main() : done set false\n", instance->host_no); done = 0; - } else - break; + } } while (!done); spin_unlock_irq(instance->host_lock); Index: linux/drivers/scsi/atari_NCR5380.c =================================================================== --- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-06 12:29:56.000000000 +1100 +++ linux/drivers/scsi/atari_NCR5380.c 2015-12-06 12:30:00.000000000 +1100 @@ -1176,6 +1176,7 @@ static void NCR5380_main(struct work_str #endif hostdata->retain_dma_intr--; local_irq_restore(flags); + done = 0; dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, " "returned to issue_queue\n", HOSTNO); } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Finn Thain Subject: [PATCH v2 23/72] ncr5380: Always retry arbitration and selection Date: Sun, 06 Dec 2015 12:31:49 +1100 Message-ID: <20151206013132.635523027@telegraphics.com.au> References: <20151206013126.995379403@telegraphics.com.au> Return-path: Content-Disposition: inline; filename=ncr5380-retry-selection-phase Sender: linux-kernel-owner@vger.kernel.org To: "James E.J. Bottomley" , Michael Schmitz , linux-m68k@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-m68k@vger.kernel.org If NCR5380_select() returns -1, it means arbitration was lost or selection failed and should be retried. If the main loop simply terminates when there are still commands on the issue queue, they will remain queued until they expire. Fix this by clearing the 'done' flag after selection failure or lost arbitration. The "else break" clause in NCR5380_main() that gets removed here appears to be a vestige of a long-gone loop that iterated over host instances. See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in history/history.git. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 3 +-- drivers/scsi/atari_NCR5380.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) Index: linux/drivers/scsi/NCR5380.c =================================================================== --- linux.orig/drivers/scsi/NCR5380.c 2015-12-06 12:29:56.000000000 +1100 +++ linux/drivers/scsi/NCR5380.c 2015-12-06 12:30:00.000000000 +1100 @@ -1047,8 +1047,7 @@ static void NCR5380_main(struct work_str NCR5380_information_transfer(instance); dprintk(NDEBUG_MAIN, "scsi%d : main() : done set false\n", instance->host_no); done = 0; - } else - break; + } } while (!done); spin_unlock_irq(instance->host_lock); Index: linux/drivers/scsi/atari_NCR5380.c =================================================================== --- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-06 12:29:56.000000000 +1100 +++ linux/drivers/scsi/atari_NCR5380.c 2015-12-06 12:30:00.000000000 +1100 @@ -1176,6 +1176,7 @@ static void NCR5380_main(struct work_str #endif hostdata->retain_dma_intr--; local_irq_restore(flags); + done = 0; dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, " "returned to issue_queue\n", HOSTNO); }