mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ross Biro <rossb@google.com>
Cc: alan@redhat.com, Stephan von Krawczynski <skraw@ithnet.com>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.4.21-pre4: PDC ide driver problems with shared interrupts
Date: 05 Feb 2003 18:12:31 +0100	[thread overview]
Message-ID: <1044465151.685.149.camel@zion.wanadoo.fr> (raw)
In-Reply-To: <3E414243.4090303@google.com>

On Wed, 2003-02-05 at 17:56, Ross Biro wrote:
> Benjamin Herrenschmidt wrote:
> 
> >>Okay, I had to watch for it a bit longer and it turns out that the kernel PDC driver has a problem in this shared interrupt setup. When loads get high it seems to run into some timing problem which causes things like:
> >>
> >>Feb  4 01:02:22 admin kernel: hde: dma_intr: status=0xd0 { Busy }
> >>
> >>    
> >>
> Since the busy bit is set, we know the drive must have received a 
> command.  Since dma_intr thought the drive was not busy, an interrupt 
> must have snuck through between the command being issued and the dma 
> being started.  I think in my original patch, I had the dma start 
> outside of the spinlock, that is a bug.  The command to the controller 
> to start the dma must be inside of the spinlock.

While I agree with you here, I don't think it's what's happening.

In ide-disk, do_rw_disk sets up the taskfile, then basically calls
hwif->ide_dma_read/write to start the command.

In ide-dma.c in 2.4.21-pre4, what happens is:

	/* PRD table */
	hwif->OUTL(hwif->dmatable_dma, hwif->dma_prdtable);
	/* specify r/w */
	hwif->OUTB(reading, hwif->dma_command);
	/* read dma_status for INTR & ERROR flags */
	dma_stat = hwif->INB(hwif->dma_status);
	/* clear INTR & ERROR flags */
	hwif->OUTB(dma_stat|6, hwif->dma_status);
	drive->waiting_for_dma = 1;
	if (drive->media != ide_disk)
		return 0;
        .../...
        Then issue command byte.

Below we clear the DMA status _and_ set waiting_for_dma to 1.
That means that if an IRQ sneaks in, we will call
drive_is_ready(), which shouldn't return INTR 1 since we
just cleared it. I don't see how a race could happen here,
but I might have missed something.

Even if, on SMP, the code below executes _simultaneously_
with ide_intr, the later will check for handler beeing
non-NULL before checking waiting_for_dma (drive_is_ready),
and thus will not race since we set the handler after.

The only thing I see is a possible wraparound of
waiting_for_dma. It's an u8, so it wraps at 255. However,
it's incremented in each __ide_dma_test_irq call. So if you
get more than 255 shared (network in your case) interrupts
before the end of the command, you die.

Alan: you can remove safely the waiting_for_dma++, I beleive,
in drive_is_ready(). I don't know how that code sneaked in
ide-dma. I indeed do that in ppc/pmac.c for other reasons
(sort of timeout condition on the DMA controller that happens
when I get an initial error), but this is totally unrelated
HW on which I know I have no shared IRQ.
   
Stephan: Can you try editing ide-dma.c, function
__ide_dma_test_irq(), and remove that line:

-	drive->waiting_for_dma++;

And tell us if it helps in any way.

Ben.


  reply	other threads:[~2003-02-05 17:02 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-02 15:18 2.4.21-pre4: tg3 " Stephan von Krawczynski
2003-02-02 16:49 ` Jeff Garzik
2003-02-02 17:09   ` Stephan von Krawczynski
2003-02-02 17:15     ` Jeff Garzik
2003-02-02 17:52   ` Stephan von Krawczynski
2003-02-02 18:28     ` Jeff Garzik
2003-02-02 18:31       ` Stephan von Krawczynski
2003-02-03 10:25       ` Stephan von Krawczynski
2003-02-05  9:48       ` 2.4.21-pre4: PDC ide " Stephan von Krawczynski
2003-02-05 11:16         ` Benjamin Herrenschmidt
2003-02-05 11:39           ` Stephan von Krawczynski
2003-02-05 12:21             ` Alan Cox
2003-02-05 12:22             ` Benjamin Herrenschmidt
2003-02-05 12:50               ` Alan Cox
2003-02-05 13:19               ` Stephan von Krawczynski
2003-02-05 12:24           ` Alan Cox
2003-02-05 16:56           ` Ross Biro
2003-02-05 17:12             ` Benjamin Herrenschmidt [this message]
2003-02-05 17:19               ` Ross Biro
2003-02-05 17:34                 ` Benjamin Herrenschmidt
2003-02-05 17:38                   ` Stephan von Krawczynski
     [not found]                     ` <1044467091.685.155.camel@zion.wanadoo.fr>
2003-02-05 17:58                       ` Stephan von Krawczynski
2003-02-05 20:00                     ` Bryan Andersen
2003-02-05 19:10                 ` Alan Cox
2003-02-06 12:20               ` Stephan von Krawczynski
2003-02-06 23:04                 ` Benjamin Herrenschmidt
2003-02-07  9:10                   ` Stephan von Krawczynski
2003-02-05 16:44 Robbert Kouprie
2003-02-05 19:45 ` Bryan Andersen
     [not found] <7b263321.0302140626.2ddb7980@posting.google.com>
2003-02-14 14:41 ` Edward King
2003-02-14 15:41   ` Benjamin Herrenschmidt
     [not found] <20030202153009$2e0d@gated-at.bofh.it>
     [not found] ` <20030205181006$107c@gated-at.bofh.it>
     [not found]   ` <20030205181006$7bb8@gated-at.bofh.it>
     [not found]     ` <20030205181006$455c@gated-at.bofh.it>
     [not found]       ` <20030205181006$5dba@gated-at.bofh.it>
     [not found]         ` <20030205181006$3358@gated-at.bofh.it>
     [not found]           ` <200302061451.h16Epl0Z001134@pc.skynet.be>
2003-02-23 14:33             ` Stephan von Krawczynski
2003-02-23 15:04               ` Arjan van de Ven
2003-02-23 17:29                 ` Stephan von Krawczynski
     [not found] <3F1C54A8.5020404@snarkhunter.com>
2003-07-22 14:44 ` Edward King
2003-07-22 18:07   ` John V. Martinez
2003-07-22 21:02     ` Edward King

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=1044465151.685.149.camel@zion.wanadoo.fr \
    --to=benh@kernel.crashing.org \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rossb@google.com \
    --cc=skraw@ithnet.com \
    /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

all inboxes | Powered by JetHome®