From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Anders Eriksson <aeriksson@fastmail.fm>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Jens Axboe <jens.axboe@oracle.com>, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Linux 2.6.25-rc4
Date: Wed, 19 Mar 2008 04:24:30 +0100 [thread overview]
Message-ID: <200803190424.30971.bzolnier@gmail.com> (raw)
In-Reply-To: <alpine.LFD.1.00.0803181814170.3020@woody.linux-foundation.org>
On Wednesday 19 March 2008, Linus Torvalds wrote:
>
> On Wed, 19 Mar 2008, Bartlomiej Zolnierkiewicz wrote:
> >
> > Which is with compliance with PIO-in protocol specification and years of
> > usage of the task_in_intr() code for fs code paths and HDIO_DRIVE_TASKFILE
> > ioctl has proven that real hardware also works this way (please note that
> > the changed code was used only for HDIO_DRIVE_CMD ioctl requests).
>
> .. and years of drive_cmd_intr() which is much more widely used is *not*
> in agreement.
>
> > If INTRQ is asserted and "BSY is cleared to zero and DRQ is cleared, then
> > the device has completed the command with an error." (thus task_in_intr()
> > assumed ERR bit to be set), otherwise the value ERR may not be defined
> > (however task_in_intr() still assumed that it is OK to check ERR bit).
>
> First off, the patch I sent out _works_.
>
> Secondly, it's a hell of a lot more robust than yours is, exactly because
> it doesn't get confused if the data direction or size bit disagrees with
> the particular command in question.
>
> > This is SMART command with SMART ENABLE ATTRIBUTE AUTOSAVE sub-command
> > (feat == 0xd2, nsect == 0xf1) but it should use no-data protocol instead of
> > PIO-in which brings us back to commit 18a056feccabdfa9764016a615121b194828bc72
> > ("ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)"):
>
> .. and what about all the magic special IDE commands that may be
> drive-specific? What are we going to do about them?
>
> In other words, we should not try to create an impossible-to-maintain
> piece of shit code that does the wrong thing if you send a command to the
> drive that the IDE layer doesn't understand (but the sending code
> hopefully does).
>
> We should make the core IDE code *robust*.
>
> Your "real fix" is nothing of the sort. It's just a workaround for the
> fragility of the code that looks at the drive status. The real fix is to
> be robust in the face of even unexpected drive status codes, *especially*
> for the code that handles commands injected by the user!
Please take a closer look - my "real fix" _only_ affects WIN_SMART command
and _not_ vendor special ones (no, there are none vendor special commands
using the same opcode).
DRQ/ERR bits handling is a tangent issue (and yes it also needs fixing).
> In other words, you can talk about protocol specifications for things like
> the regular filesystem READ/WRITE commands. But don't create total crap
> like this that depends on the code knowing all possible outcomes of every
> single possible command.
>
> Your patch is utter crap.
>
> You say (about commit 18a056feccabdfa9764016a615121b194828bc72):
>
> > as can be seen before this patch protocol to use was decided basing on DRQ bit
> > being set - what would you call _that_ if taskfile code is horrible, he? ;-)
>
> I would call that *correct*.
>
> And my point is, we used to be better. You made the code buggy and fragile
> with that crap commit, and with the others like it (ie the already
> much-mentioned commit 4d977e43d8ae758434e603cf2455d955f71c77c4).
>
> And that is and was *exactly* my point. The reason I called the taskfile
> code horrible was exactly the fact that it only worked if it thought it
> knew exactly what was going on.
This is actually how the ATA hardware operates.
You cannot just bang random commands and expect that later driver will be
able to 100% correctly deduce what the command wants from the drive status
itself (this may work more-or-less well for no-data and PIO-in by using DRQ
bit trick, but we also have PIO-out, DMA, PACKET etc).
IOW this won't fly as drive/controller alone doesn't provide use with enough
information about command being currently executed.
> Deciding what to do based on the DRQ bit (and the READY/BUSY/ERROR bits)
> is the *right* thing to do. It's the intelligent approach - actually
> tekign the response of the hardware into account, and being robust. The
> *stupid* and horrible thing to do is to think that you know better than
> what the hardware tells you, and think that you can look up every command
> that the user sends in the spec and use *that* to figure out what to do.
There is some misunderstaning here - taskfile approach lets user specify
_both_ the command and what it really wants (protocol etc.), and no - we
don't do any command checking with the spec but give user the control...
Call taskfile crap all you want but the fact is that taskfile approach
handles _all_ protocols and _all_ commands while the beloved "robust"
and "intelligent" approach is able to handle only 28-bit commands using
no-data or PIO-in protocols (this is what HDIO_DRIVE_CMD is supporting
and there is no way it will ever support more than that with its design).
[ BTW libata also uses taskfile approach (including HDIO_DRIVE_CMD!) ]
> Trust the hardware, not the paper. Don't make the code only work when you
> think you know what is going on. Make the code work _always_.
The problem here is that we cannot fully trust neither hardware nor the
paper (so we give the control to the user for the final decision).
> In short, there is no way in hell I'll apply a workaround patch for crap
> code, when we already know what the robust solution is.
Please re-consider this decision given the above facts.
Thanks,
Bart
next prev parent reply other threads:[~2008-03-19 21:36 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 5:03 Linux 2.6.25-rc4 Linus Torvalds
2008-03-05 8:09 ` FUJITA Tomonori
2008-03-05 16:46 ` Grant Grundler
2008-03-06 9:00 ` Ingo Molnar
2008-03-06 12:59 ` Jens Axboe
2008-03-06 13:06 ` Ingo Molnar
2008-03-06 13:12 ` Jens Axboe
2008-03-07 8:53 ` Ingo Molnar
2008-03-07 8:57 ` Jens Axboe
2008-03-07 9:02 ` Ingo Molnar
2008-03-07 9:59 ` Paul Mackerras
2008-03-07 15:20 ` Valdis.Kletnieks
2008-03-08 23:36 ` Pavel Machek
2008-03-09 11:59 ` Ingo Molnar
2008-03-09 12:55 ` Andi Kleen
2008-03-10 10:10 ` Pavel Machek
2008-03-10 11:52 ` Andi Kleen
2008-03-06 13:38 ` Bartlomiej Zolnierkiewicz
2008-03-06 13:33 ` Ingo Molnar
2008-03-06 14:06 ` Bartlomiej Zolnierkiewicz
2008-03-06 13:55 ` Jens Axboe
2008-03-06 21:17 ` Anders Eriksson
2008-03-07 8:48 ` Jens Axboe
2008-03-07 22:04 ` Anders Eriksson
2008-03-08 20:22 ` Linus Torvalds
2008-03-08 21:05 ` Anders Eriksson
2008-03-10 8:55 ` Anders Eriksson
2008-03-10 12:36 ` Bartlomiej Zolnierkiewicz
2008-03-10 13:10 ` Rafael J. Wysocki
2008-03-10 14:04 ` Bartlomiej Zolnierkiewicz
2008-03-16 14:01 ` Anders Eriksson
2008-03-16 14:29 ` Bartlomiej Zolnierkiewicz
2008-03-16 14:29 ` Anders Eriksson
2008-03-16 15:14 ` Bartlomiej Zolnierkiewicz
2008-03-16 16:56 ` Linus Torvalds
2008-03-16 17:13 ` Linus Torvalds
2008-03-16 18:18 ` Anders Eriksson
2008-03-16 18:07 ` Bartlomiej Zolnierkiewicz
2008-03-16 18:13 ` Linus Torvalds
2008-03-16 18:36 ` Bartlomiej Zolnierkiewicz
2008-03-16 19:08 ` Anders Eriksson
2008-03-16 18:56 ` Alan Cox
2008-03-16 19:39 ` Linus Torvalds
2008-03-16 20:31 ` Alan Cox
2008-03-16 21:06 ` Linus Torvalds
2008-03-21 15:03 ` Mark Lord
2008-03-21 14:49 ` Alan Cox
2008-03-16 19:54 ` Bartlomiej Zolnierkiewicz
2008-03-16 22:59 ` Anders Eriksson
2008-03-16 23:27 ` Linus Torvalds
2008-03-17 21:09 ` Anders Eriksson
2008-03-17 22:52 ` Linus Torvalds
2008-03-18 0:18 ` Anders Eriksson
2008-03-18 13:03 ` Bartlomiej Zolnierkiewicz
2008-03-18 13:32 ` Anders Eriksson
2008-03-18 14:48 ` Bartlomiej Zolnierkiewicz
2008-03-18 15:10 ` Anders Eriksson
2008-03-18 15:41 ` Linus Torvalds
2008-03-18 16:30 ` Anders Eriksson
2008-03-18 16:47 ` Linus Torvalds
2008-03-18 21:02 ` Anders Eriksson
2008-03-19 1:21 ` Bartlomiej Zolnierkiewicz
2008-03-19 1:28 ` Linus Torvalds
2008-03-19 3:24 ` Bartlomiej Zolnierkiewicz [this message]
2008-03-19 3:28 ` Linus Torvalds
2008-03-19 3:56 ` Linus Torvalds
2008-03-19 4:03 ` Bartlomiej Zolnierkiewicz
2008-03-19 4:48 ` Linus Torvalds
2008-03-19 11:14 ` Bartlomiej Zolnierkiewicz
2008-03-16 18:23 ` Anders Eriksson
2008-03-16 18:26 ` Bartlomiej Zolnierkiewicz
2008-03-16 18:25 ` Anders Eriksson
2008-03-17 7:23 ` Jens Axboe
2008-03-16 18:44 ` Alan Cox
2008-03-10 13:19 ` Anders Eriksson
2008-03-10 13:56 ` Bartlomiej Zolnierkiewicz
2008-03-16 18:59 ` Andrey Borzenkov
2008-03-07 10:08 ` [patch] drivers/char/esp.c: fix bootup lockup (was: Re: Linux 2.6.25-rc4) Ingo Molnar
2008-03-09 13:41 ` [patch] drivers/char/esp.c: fix bootup lockup Jiri Slaby
2008-03-09 22:49 ` Rafael J. Wysocki
2008-03-09 23:04 ` Jiri Slaby
-- strict thread matches above, loose matches on Subject: below --
2008-03-05 22:30 Linux 2.6.25-rc4 Jonathan McDowell
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=200803190424.30971.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=aeriksson@fastmail.fm \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rjw@sisk.pl \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.