linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Hedrick <andre@linux-ide.org>
To: Jens Axboe <axboe@suse.de>, Russell King <rmk@arm.linux.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linus Torvalds <torvalds@transmeta.com>,
	james <jdickens@ameritech.net>, Ingo Molnar <mingo@elte.hu>,
	Jeff Garzik <jgarzik@pobox.com>,
	Larry Kessler <kessler@us.ibm.com>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	"Andrew V. Savochkin" <saw@saw.sw.com.sg>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Richard J Moore <richardj_moore@uk.ibm.com>
Subject: Re: v2.6 vs v3.0
Date: Mon, 30 Sep 2002 19:17:07 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.10.10209301158130.31864-100000@master.linux-ide.org> (raw)
In-Reply-To: <20020930130517.GA23933@suse.de>


First an apology to Russell for bring him into this thread.

On Mon, 30 Sep 2002, Jens Axboe wrote:

> On Mon, Sep 30 2002, Alan Cox wrote:
> > On Mon, 2002-09-30 at 08:56, Jens Axboe wrote:
> > > 2.5 at least does not have the taskfile hang, because I killed taskfile
> > > io.
> > 
> > Thats not exactly a fix 8). 2.5 certainly has the others. Taskfile I/O
> 
> I didn't claim it was, I just don't want a user setting taskfile io to
> 'y' because he thinks its cool when we know its broken.
> 
> > is pretty low on my fix list. The fix isnt trivial because we set the
> > IRQ handler late - so the IRQ can beat us setting the handler, but
> > equally if we set it early we get to worry about all the old races in
> > 2.3.x
> 
> Where exactly is the race?

As soon as you complete read or writing the final byte in a pio state
diagram, the device can interrupt instantly!  I do mean instantly.


ide_startstop_t task_out_intr (ide_drive_t *drive)
{
        ide_hwif_t *hwif        = HWIF(drive);
        struct request *rq      = HWGROUP(drive)->rq;
        char *pBuf              = NULL;
        unsigned long flags;
        u8 stat;

        if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),
                     DRIVE_READY, drive->bad_wstat)) {
                DTF("%s: WRITE attempting to recover last " \
                        "sector counter status=0x%02x\n",
                        drive->name, stat);
                rq->current_nr_sectors++;
                return DRIVER(drive)->error(drive, "task_out_intr", stat);
        }
        /*
         * Safe to update request for partial completions.
         * We have a good STATUS CHECK!!!
         */
        if (!rq->current_nr_sectors)
                if (!DRIVER(drive)->end_request(drive, 1))
                        return ide_stopped;
        if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
                 rq = HWGROUP(drive)->rq;
                pBuf = task_map_rq(rq, &flags);
                DTF("write: %p, rq->current_nr_sectors: %d\n",
                        pBuf, (int) rq->current_nr_sectors);
                taskfile_output_data(drive, pBuf, SECTOR_WORDS);
KABOOM! The RACE is on! (The handler start point)
                task_unmap_rq(rq, pBuf, &flags);
                rq->errors = 0;
                rq->current_nr_sectors--;
        }
        if (HWGROUP(drive)->handler == NULL)
                ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL);
Driver WINS!
        return ide_started;
}

If the device issues an interrupt to the host controller before we can arm
the handler we are dead.

void taskfile_output_data (ide_drive_t *drive, void *buffer, u32 wcount)
{
        if (drive->bswap) {
                ata_bswap_data(buffer, wcount);
                HWIF(drive)->ata_output_data(drive, buffer, wcount);
KABOOM! The RACE is on! (The Second fake start point)
                ata_bswap_data(buffer, wcount);
        } else {
                HWIF(drive)->ata_output_data(drive, buffer, wcount);
KABOOM! The RACE is on! (The Second fake start point)
        }
}

void ata_output_data (ide_drive_t *drive, void *buffer, u32 wcount)
{
        ide_hwif_t *hwif        = HWIF(drive);
        u8 io_32bit             = drive->io_32bit;

        if (io_32bit) {
                if (io_32bit & 2) {
                        unsigned long flags;
                        local_irq_save(flags);
                        ata_vlb_sync(drive, IDE_NSECTOR_REG);
                        hwif->OUTSL(IDE_DATA_REG, buffer, wcount);
                        local_irq_restore(flags);
                } else
                        hwif->OUTSL(IDE_DATA_REG, buffer, wcount);
        } else {
                hwif->OUTSW(IDE_DATA_REG, buffer, wcount<<1);
        }
KABOOM! The RACE is on! (The Real start point)
}


If we are having to lollygag in the kernel for a byteswap or a bounce
buffer (aka memcpy/free) we can/will loose the interrupt.  The old code
would push the handler early resulting in timeouts and double handlers
added.

Now the question is how to addresss the race.

At this point we have two paths each with bugs.
The old legacy path can allow for the wrong handler to be executed for a
given interrupt.  The old path can with the above bug can potentially crap
data.  Specifically wrong handle execution.

The new path can miss setting the handler in time.

It can be fixed and maybe the account process stuff is already present,
and we are at another communication delay but it shall be worked through
calmly, not like the past where nothing gets done and people just become
offended.

Cheers,


Andre Hedrick
LAD Storage Consulting Group




  reply	other threads:[~2002-10-01  2:14 UTC|newest]

Thread overview: 212+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-24  1:54 [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAID device driver Larry Kessler
2002-09-24  2:22 ` Jeff Garzik
2002-09-26 15:52   ` Alan Cox
2002-09-26 22:55     ` [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAIDdevice driver Larry Kessler
2002-09-26 22:58       ` Jeff Garzik
2002-09-26 23:07         ` Linus Torvalds
2002-09-27  2:27           ` Jeff Garzik
2002-09-27  4:45             ` Linus Torvalds
2002-09-28  7:46               ` Ingo Molnar
2002-09-28  9:16                 ` jw schultz
2002-09-30 14:05                   ` Denis Vlasenko
2002-09-30 10:22                     ` Tomas Szepe
2002-09-30 11:10                       ` jw schultz
2002-09-30 11:17                       ` Adrian Bunk
2002-09-30 19:48                       ` Rik van Riel
2002-09-30 20:30                         ` Christoph Hellwig
2002-09-28 15:40                 ` Kernel version [Was: Re: [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAIDdevice driver] Horst von Brand
2002-09-29  1:31                 ` v2.6 vs v3.0 Linus Torvalds
2002-09-29  6:14                   ` james
2002-09-29  6:55                     ` Andre Hedrick
2002-09-29 12:59                     ` Gerhard Mack
2002-09-29 13:46                       ` Dr. David Alan Gilbert
2002-09-29 14:06                         ` Wakko Warner
2002-09-29 15:42                         ` Jens Axboe
2002-09-29 16:21                           ` Alan Cox
2002-09-29 16:17                             ` Jens Axboe
2002-09-30  0:39                             ` Jeff Chua
2002-09-29 16:22                           ` Dave Jones
2002-09-29 16:26                             ` Jens Axboe
2002-09-29 21:46                             ` Matthias Andree
2002-09-30  7:05                               ` Michael Clark
2002-09-30  7:22                                 ` Andrew Morton
2002-09-30 13:08                                   ` Kevin Corry
2002-09-30 13:05                                 ` Kevin Corry
2002-09-30 13:49                                   ` Michael Clark
2002-09-30 14:26                                     ` Kevin Corry
2002-09-30 13:59                                   ` Michael Clark
2002-09-30 15:50                                     ` Kevin Corry
2002-09-29 17:06                       ` Jochen Friedrich
2002-09-29 15:18                     ` Trever L. Adams
2002-09-29 15:45                       ` Jens Axboe
2002-09-29 15:59                         ` Trever L. Adams
2002-09-29 16:06                           ` Jens Axboe
2002-09-29 16:13                             ` Trever L. Adams
2002-09-30  6:54                               ` Kai Henningsen
2002-09-30 18:40                                 ` Bill Davidsen
2002-10-01 12:38                                   ` Matthias Andree
2002-10-04 19:58                                     ` Bill Davidsen
2002-09-29 17:42                     ` Linus Torvalds
2002-09-29 17:54                       ` Rik van Riel
2002-09-29 18:24                       ` Alan Cox
2002-09-30  7:56                         ` Jens Axboe
2002-09-30  9:53                           ` Andre Hedrick
2002-09-30 11:54                             ` Jens Axboe
2002-09-30 12:58                           ` Alan Cox
2002-09-30 13:05                             ` Jens Axboe
2002-10-01  2:17                               ` Andre Hedrick [this message]
2002-09-30 16:39                       ` jbradford
2002-09-30 16:47                     ` Pau Aliagas
2002-09-29  7:16                   ` jbradford
2002-09-29  8:08                     ` Jeff Garzik
2002-09-29  8:17                     ` David S. Miller
2002-09-29  9:12                     ` Jens Axboe
2002-09-29 11:19                       ` Murray J. Root
2002-09-29 15:50                         ` Jens Axboe
2002-09-30  7:01                           ` Kai Henningsen
2002-09-29 16:04                         ` Zwane Mwaikambo
2002-09-29 14:56                       ` Alan Cox
2002-09-29 15:38                         ` Jens Axboe
2002-09-29 16:30                           ` Dave Jones
2002-09-29 16:42                           ` Bjoern A. Zeeb
2002-09-29 21:16                           ` Russell King
2002-09-29 21:32                             ` Alan Cox
2002-09-29 21:49                             ` steve
2002-09-29 21:52                           ` Matthias Andree
2002-09-30  7:31                             ` Tomas Szepe
2002-09-30 15:33                           ` Jan Harkes
2002-09-30 18:13                           ` Jeff Willis
2002-09-29 17:48                         ` Linus Torvalds
2002-09-29 18:13                           ` Jaroslav Kysela
2002-09-30 19:32                       ` Bill Davidsen
2002-10-01  6:26                         ` Jens Axboe
2002-10-01  7:54                           ` Mikael Pettersson
2002-10-01  8:27                             ` Jens Axboe
2002-10-01  8:44                               ` jbradford
2002-10-01 11:31                             ` Alan Cox
2002-10-01 11:25                               ` Jens Axboe
2002-09-29 15:34                     ` Andi Kleen
2002-09-29 17:26                       ` Jochen Friedrich
2002-09-29 17:35                         ` Jeff Garzik
2002-09-30  0:00                         ` Andi Kleen
2002-10-01 19:28                         ` IPv6 stability (success story ;) Petr Baudis
2002-09-29  9:15                   ` v2.6 vs v3.0 Jens Axboe
2002-09-29 19:53                     ` james
2002-09-29 15:26                   ` Matthias Andree
2002-09-29 16:24                     ` Alan Cox
2002-09-29 22:00                       ` Matthias Andree
2002-09-30 19:02                       ` Bill Davidsen
2002-09-30 18:37                   ` Bill Davidsen
2002-10-03 15:51               ` [OT] 2.6 not 3.0 - (WAS Re: [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAIDdevice) jbradford
2002-10-03 15:57                 ` Linus Torvalds
2002-10-03 16:16                   ` [OT] 2.6 not 3.0 - (WAS Re: [PATCH-RFC] 4 of 4 - New problem jbradford
2002-10-03 22:30                     ` Greg KH
2002-10-04  6:33                       ` jbradford
2002-10-04  6:37                         ` Greg KH
2002-10-04  7:17                           ` jbradford
2002-10-04  7:30                             ` Greg KH
2002-10-03 16:37                   ` [OT] 2.6 not 3.0 - (WAS Re: [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAIDdevice) Alan Cox
2002-10-03 16:56                     ` Linus Torvalds
2002-10-03 17:40                       ` Alan Cox
2002-10-03 19:55                       ` jlnance
2002-10-03 16:51                   ` Dave Jones
2002-10-03 17:04                     ` Alan Cox
2002-10-03 20:43                     ` Andrew Morton
2002-10-03 22:05                       ` Dave Jones
2002-10-04  3:46                         ` Andreas Boman
2002-10-04  7:44                         ` jbradford
2002-10-03 19:51                   ` Rik van Riel
2002-10-04 22:26                   ` [OT] 2.6 not 3.0 - (NUMA) Martin J. Bligh
2002-10-04 23:13                     ` Linus Torvalds
2002-10-05  0:21                       ` Martin J. Bligh
2002-10-05  0:36                         ` Linus Torvalds
2002-10-05  1:25                           ` Michael Hohnbaum
2002-10-05 20:30                       ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 - (NUMA)) Rob Landley
2002-10-06  2:15                         ` Andrew Morton
2002-10-06  9:42                           ` Russell King
2002-10-06 17:06                             ` Alan Cox
2002-10-06 13:44                           ` Oliver Neukum
2002-10-06 15:19                             ` Martin J. Bligh
2002-10-06 15:14                               ` Oliver Neukum
2002-10-07  8:08                               ` Helge Hafting
2002-10-07  9:18                                 ` Oliver Neukum
2002-10-07 14:11                                   ` Jan Hudec
2002-10-07 15:01                                     ` Jesse Pollard
2002-10-07 15:34                                       ` Jan Hudec
2002-10-08  3:12                                         ` [OT] " Scott Mcdermott
2002-10-10 23:49                                           ` Mike Fedyk
2002-10-07 15:15                                   ` Martin J. Bligh
2002-10-08 13:49                                   ` Helge Hafting
2002-10-07 17:43                               ` Daniel Phillips
2002-10-07 18:31                                 ` Andrew Morton
2002-10-07 18:51                                   ` Linus Torvalds
2002-10-07 20:14                                     ` Alan Cox
2002-10-07 20:31                                       ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not3.0 " Andrew Morton
2002-10-07 20:46                                         ` Linus Torvalds
2002-10-07 20:44                                       ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 " Linus Torvalds
2002-10-07 21:16                                         ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not3.0 " Andrew Morton
2002-10-07 23:47                                           ` jw schultz
2002-10-11  0:02                                           ` Mike Fedyk
2002-10-07 18:58                                   ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 " Chris Friesen
2002-10-07 19:21                                     ` Daniel Phillips
2002-10-07 19:35                                       ` Linus Torvalds
2002-10-08  0:39                                         ` Theodore Ts'o
2002-10-08  2:59                                           ` Andrew Morton
2002-10-08 16:15                                             ` Theodore Ts'o
2002-10-08 19:39                                               ` Andrew Morton
2002-10-08 17:06                                                 ` Rob Landley
2002-10-07 19:36                                     ` Andrew Morton
2002-10-08  2:36                                       ` Simon Kirby
2002-10-08  2:47                                         ` Daniel Phillips
2002-10-08  2:50                                         ` Andrew Morton
2002-10-08  2:54                                           ` Simon Kirby
2002-10-08  3:00                                             ` Andrew Morton
2002-10-08 16:17                                               ` Theodore Ts'o
2002-10-08 12:49                                           ` jlnance
2002-10-08 17:09                                             ` Andrew Morton
2002-10-10 20:53                                               ` Thomas Zimmerman
2002-10-08 13:54                                       ` Helge Hafting
2002-10-08 15:31                                         ` Andreas Dilger
2002-10-07 19:05                                   ` Daniel Phillips
2002-10-07 19:24                                     ` Linus Torvalds
2002-10-07 20:02                                       ` Daniel Phillips
2002-10-07 20:14                                         ` Andrew Morton
2002-10-07 20:22                                           ` Daniel Phillips
2002-10-07 20:28                                         ` Linus Torvalds
2002-10-07 21:16                                           ` Daniel Phillips
2002-10-07 21:55                                             ` Linus Torvalds
2002-10-07 22:02                                               ` Daniel Phillips
2002-10-07 22:12                                                 ` Andrew Morton
2002-10-08  8:49                                                   ` Padraig Brady
2002-10-07 22:14                                             ` Charles Cazabon
2002-10-30 18:26                                   ` Lee Leahu
2002-10-06  6:33                         ` Martin J. Bligh
2002-10-07  5:28                         ` John Alvord
2002-10-07  8:39                         ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 n Giuliano Pochini
2002-10-07 13:56                         ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 - (NUMA)) Jesse Pollard
2002-10-07 14:03                           ` Rob Landley
2002-10-08 22:14                             ` Jesse Pollard
2002-10-08 19:11                               ` Rob Landley
2002-10-09  8:17                             ` Alexander Kellett
2002-10-07 18:22                           ` Daniel Phillips
2002-10-08  8:19                             ` Jan Hudec
2002-10-11 23:53                         ` Hans Reiser
2002-10-11 20:26                           ` Rob Landley
2002-10-12  4:14                             ` Nick LeRoy
2002-10-13 17:27                               ` Rob Landley
2002-10-12 10:03                             ` Hans Reiser
2002-10-13 17:32                               ` Rob Landley
2002-10-13 23:51                                 ` Hans Reiser
2002-10-14 16:33                                   ` Rob Landley
2002-10-14  7:10                                 ` Nikita Danilov
2002-10-21 15:36                                   ` [OT] Please don't call it 3.0!! (was Re: The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 - (NUMA))) Calin A. Culianu
2002-10-21 16:20                                     ` Wakko Warner
2002-10-12 11:42                             ` The reason to call it 3.0 is the desktop (was Re: [OT] 2.6 not 3.0 - (NUMA)) Matthias Andree
2002-10-12 14:56                               ` Hugh Dickins
2002-09-27 11:32       ` [PATCH-RFC] 4 of 4 - New problem logging macros, SCSI RAIDdevice driver Alan Cox
     [not found] <fa.e52m04v.plkfqo@ifi.uio.no>
     [not found] ` <fa.jgmettv.1hku79s@ifi.uio.no>
2002-09-30  0:16   ` v2.6 vs v3.0 walt
2002-09-30 18:20 John L. Males
     [not found] ` <200209302059.g8UKxQEh007769@darkstar.example.net>
2002-09-30 22:02   ` John L. Males
2002-10-01  2:02     ` Nick Piggin
2002-10-01 11:20     ` Christoph Hellwig
2002-10-02  7:55 Mikael Pettersson

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=Pine.LNX.4.10.10209301158130.31864-100000@master.linux-ide.org \
    --to=andre@linux-ide.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=jdickens@ameritech.net \
    --cc=jgarzik@pobox.com \
    --cc=kessler@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=richardj_moore@uk.ibm.com \
    --cc=rmk@arm.linux.org.uk \
    --cc=rusty@rustcorp.com.au \
    --cc=saw@saw.sw.com.sg \
    --cc=torvalds@transmeta.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;
as well as URLs for NNTP newsgroup(s).