linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Justin T. Gibbs" <gibbs@scsiguy.com>
To: Bulent Abali <abali@us.ibm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFQ] aic7xxx driver panics under heavy swap.
Date: Tue, 19 Jun 2001 10:58:22 -0600	[thread overview]
Message-ID: <200106191658.f5JGwMU29894@aslan.scsiguy.com> (raw)
In-Reply-To: Your message of "Tue, 19 Jun 2001 11:46:02 EDT." <OFFC1B2C1B.7F406B4A-ON85256A70.00564265@pok.ibm.com>

>
>Justin,
>When free memory is low, I get a series of aic7xxx messages followed by
>panic.  It appears to be a race condition in the code.

Its actually a logic error, not a race condition.  You should never
enter ahc_linux_run_device_queue() while the device is still on the
run queue.  The real issue is that ahc_linux_queue bypasses the
round-robin device scheduler by calling ahc_linux_run_device_queue()
directly.  The code should look like this (the LIST macro calls
where switched to TAILQ calls a bit ago to ensure round-robin, but
that change came just after 6.1.13).  I haven't tested this yet...

Thanks for the bug report.  If you can verify that this works under
memeory pressure, the printf can go away.

--
Justin

==== //depot/src/linux/drivers/scsi/aic7xxx/aic7xxx_linux.c#67 - /usr/src/linux/drivers/scsi/aic7xxx/aic7xxx_linux.c ====
--- /tmp/tmp.3288.0	Tue Jun 19 11:07:32 2001
+++ /usr/src/linux/drivers/scsi/aic7xxx/aic7xxx_linux.c	Tue Jun 19 11:02:54 2001
@@ -1514,7 +1514,11 @@
 	}
 	cmd->result = CAM_REQ_INPROG << 16;
 	TAILQ_INSERT_TAIL(&dev->busyq, (struct ahc_cmd *)cmd, acmd_links.tqe);
-	ahc_linux_run_device_queue(ahc, dev);
+	if ((dev->flags & AHC_DEV_ON_RUN_LIST) == 0) {
+		TAILQ_INSERT_TAIL(&ahc->platform_data->device_runq, dev, links);
+		dev->flags |= AHC_DEV_ON_RUN_LIST;
+		ahc_linux_run_device_queues(ahc);
+	}
 	ahc_unlock(ahc, &flags);
 	return (0);
 }
@@ -1530,6 +1534,9 @@
 	struct	 ahc_tmode_tstate *tstate;
 	uint16_t mask;
 
+	if ((dev->flags & AHC_DEV_ON_RUN_LIST) != 0)
+		panic("running device on run list");
+
 	while ((acmd = TAILQ_FIRST(&dev->busyq)) != NULL
 	    && dev->openings > 0 && dev->qfrozen == 0) {
 
@@ -1538,8 +1545,6 @@
 		 * running is because the whole controller Q is frozen.
 		 */
 		if (ahc->platform_data->qfrozen != 0) {
-			if ((dev->flags & AHC_DEV_ON_RUN_LIST) != 0)
-				return;
 
 			TAILQ_INSERT_TAIL(&ahc->platform_data->device_runq,
 					  dev, links);
@@ -1550,8 +1555,6 @@
 		 * Get an scb to use.
 		 */
 		if ((scb = ahc_get_scb(ahc)) == NULL) {
-			if ((dev->flags & AHC_DEV_ON_RUN_LIST) != 0)
-				panic("running device on run list");
 			TAILQ_INSERT_TAIL(&ahc->platform_data->device_runq,
 					 dev, links);
 			dev->flags |= AHC_DEV_ON_RUN_LIST;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

  reply	other threads:[~2001-06-19 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-19 15:46 Bulent Abali
2001-06-19 16:58 ` Justin T. Gibbs [this message]
2001-06-20 13:56 Bulent Abali

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=200106191658.f5JGwMU29894@aslan.scsiguy.com \
    --to=gibbs@scsiguy.com \
    --cc=abali@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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