public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Jens Axboe <axboe@suse.de>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: hda: error: DMA in progress..
Date: Fri, 21 Jun 2002 13:10:06 +0200	[thread overview]
Message-ID: <3D13098E.2020100@evision-ventures.com> (raw)
In-Reply-To: 20020621103553.GI27090@suse.de

Użytkownik Jens Axboe napisał:

>>OK. We have now just one single place where IDE_DMA gets unset ->
>>udma_stop. This to too early to reset IDE_BUSY. However it well
>>may be that ide_dma_intr() simply doesn't care about IDE_BUSY.
>>Let's have a look...
> 
> 
> You can leave IDE_BUSY there, that's ok. It's not invalid for IDE_BUSY
> to be set while IDE_DMA gets cleared. That's expected.
> 

>>Well lets look at ata_irq_intr, the end of it:
>>
>>	 * Note that handler() may have set things up for another
>>	 * interrupt to occur soon, but it cannot happen until
>>	 * we exit from this routine, because it will be the
>>	 * same irq as is currently being serviced here, and Linux
>>	 * won't allow another of the same (on any CPU) until we return.
>>	 */
>>	if (startstop == ide_stopped) {
>>		if (!ch->handler) {	/* paranoia */
>>			clear_bit(IDE_BUSY, ch->active);
>>			do_request(ch);
>>		} else {
>>			printk("%s: %s: huh? expected NULL handler on 
>>			exit\n", drive->name, __FUNCTION__);
>>		}
>>	} else if (startstop == ide_released)
>>		queue_commands(drive);
>>
>>I think the above needs more tough now...
> 
> 
> Same case as the one I described in the email following this, will only
> happen for TCQ with release interrupt enabled. Otherwise it's illegal to
> release the bus from the tcq interrupt handler. Since I removed all
> traces of that long ago, you can safely kill the
> 
> 	} else if (startstop == ide_released)
> 		queue_commands(drive);
> 
> part of it.

I'm glad to get confirmation on this. This leaves only one place, vide:
do_request, where we can queue up new commands. Much easier to trace and
makes queue_commands never run from IRQ context, which is simplyfiying
things too.

> The rest looks sane. If handler returns it's no longer busy
> (ide_stopped), we clear IDE_BUSY (IDE_DMA damn well better be cleared at
> this point as well!!) and let do_request() start a new request (heck or
> the same, we don't know and don't care).

Right now the handlers are expected to clear IDE_BUSY and ->handler
themself. I have now an idea: Could you add a reporting about
the handler function there:

  	if (test_bit(IDE_DMA, ch->active)) {
			printk(KERN_ERR "%s: error: DMA in progress... %p\n", drive->name, ch->handler);
			break;
		}

And please take a short look at System.map.

This will show which IRQ handler is the culprit...

If it's indeed ide_dma_intr, let's have a look on it:

We see that it's calling udma_stop() immediately. This should
reset IDE_DMA unconditionally.. immediately on enty:

static inline int udma_stop(struct ata_device *drive)
{
	clear_bit(IDE_DMA, drive->channel->active);

	return drive->channel->udma_stop(drive);
}

Argh... There is a race in the above it should be:

static inline int udma_stop(struct ata_device *drive)
{
	int ret = drive->channel->udma_stop(drive);
         clear_bit(IDE_DMA, drive->channel->active);
         return ret;
}

Or we should move the clar_bit down do ide_dma_intr and
silbings behind __ata_end_request().
And finally we don't clear the IDE_BUSY on this code path.


  reply	other threads:[~2002-06-21 11:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-21  9:24 hda: error: DMA in progress Jens Axboe
2002-06-21 10:05 ` Martin Dalecki
2002-06-21 10:12   ` Jens Axboe
2002-06-21 10:28     ` Jens Axboe
2002-06-21 10:31     ` Martin Dalecki
2002-06-21 10:35       ` Jens Axboe
2002-06-21 11:10         ` Martin Dalecki [this message]
2002-06-21 14:57           ` Stelian Pop
2002-06-24  8:54             ` Stelian Pop

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=3D13098E.2020100@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.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