linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [BK PATCHES] add ata scsi driver
Date: Mon, 26 May 2003 07:13:10 -0400	[thread overview]
Message-ID: <3ED1F6C6.3050400@pobox.com> (raw)
In-Reply-To: <Pine.SOL.4.30.0305261217020.12542-100000@mion.elka.pw.edu.pl>

Bartlomiej Zolnierkiewicz wrote:
> On Mon, 26 May 2003, Jeff Garzik wrote:
> 
> 
>>Linus Torvalds wrote:
>>
>>>On Mon, 26 May 2003, Jeff Garzik wrote:
>>>
>>>
>>>>Just to echo some comments I said in private, this driver is _not_
>>>>a replacement for drivers/ide.  This is not, and has never been,
>>>>the intention.  In fact, I need drivers/ide's continued existence,
>>>>so that I may have fewer boundaries on future development.
>>>
>>>
>>>Just out of interest, is there any _point_ to this driver? I can
>>>appreciate the approach, but I'd like to know if it does anything (at all)
>>>better than the native IDE driver? Faster? Anything?
>>
>>
>>Direction:  SATA is much more suited to SCSI, because otherwise you wind
>>up re-creating all the queueing and error handling mess that SCSI
>>already does for you.  The SATA2 host controllers coming out soon do
>>full host-side TCQ, not the dain-bramaged ATA TCQ bus-release stuff.
>>Doing SATA2 devel in drivers/ide will essentially be re-creating the
>>SCSI mid-layer.
> 
> 
> And now you are recreating ATA in SCSI ;-).
> 
> Don't get me wrong: I like idea very much, but why you can't
> share common code between drivers/ide and your ATA-SCSI.

SATA2 is really 100% different from PATA in all respects except for the 
ATA commands themselves being sent down the pipe.  Doing that inside 
drivers/ide really means two driver cores at that point.

Sharing code is definitely an option, though!
Why do you think I named it "libata"?  :)


Another SATA wrinkle:  the phy layer.

SATA, like network cards, has an underlying connection layer.  The host 
connects to the device.  Your link state may be up or down.  This is 
easily mapped to SCSI semantics (initiator connection to target).  Much 
more code if writing from scratch.


>>Legacy-free:  Because I don't have to worry about legacy host
>>controllers, I can ignore limitations drivers/ide cannot.  In
>>drivers/ide, each host IO (PIO/MMIO) is done via function pointer.  If
>>your arch has a mach_vec, more function pointers.  Mine does direct
>>calls to the asm/io.h functions in faster.  So, ATA command submission
>>is measureably faster.
> 
> 
> I think it is simply wrong, you should use function pointers.
> You can have ie. two PCI hosts, one using PIO and one using MMIO.
> 
> "measureably faster", I doubt.
> IO operations are REALLY slow when compared to CPU cycles.

You misunderstand.

drivers/ide -- uses function pointers HWIF->outb, etc. inside a static 
taskfile-submit function.  The TF submit functions statically order each 
HWIF->outb() call, and you cannot change that order from the low-level 
driver.

my driver -- uses separate taskfile-submit functions for different hardware.

My method directly uses outb(), writel(), or whatever is necessary.  It 
allows one to use __writel() and barriers to optimize as needed, or to 
support special cache coherency needs.  Further, for SATA and some 
advanced PATA controllers, my method allows one to use a completely 
alien and new taskfile submission method.  For example, building SATA2 
FIS's as an array of u32's, and then queueing that FIS onto a DMA ring. 
  The existing drivers/ide code is nowhere close to that.

Putting it into drivers/ide language, my driver adds a 
HWIF->do_flagged_taskfile hook, and eliminates the HWIF->outb hooks. 
Turns ~13 hook calls into one, from looking at flagged_taskfile.

And FWIW, I would not state "measureably faster" unless I actually 
benchmarked it.  :)  It's a pittance in the grand scheme of things, 
since you're inevitably limited by device speed, but lower CPU usage is 
something nobody complains about...


>>sysfs:  James and co are putting time into getting scsi sysfs right.  I
>>would rather ride their coattails, and have my driver Just Work with
>>sysfs and the driver model.
> 
> 
> No big deal here, ATA will get it too.

Oh agreed.  But scsi is pretty much there now (it's in testing in a BK 
tree), and we're darn close to 2.6.0.


>>PIO data transfer is faster and more scheduler-friendly, since it polls
>>from a kernel thread.
> 
> 
> CPU polling is faster than IRQs?

Yes, almost always.

The problem with polling is that it chews up CPU if you're not careful, 
starving out other processes.  I'm careful :)


>>And for specifically Intel SATA, drivers/ide flat out doesn't work (even
>>though it claims to).
> 
> 
> So fix it ;-).

As you can see from the discussion, I think a new driver best serves the 
future of SATA2 as well as today's SATA.  So I'm not gonna bother...  I 
have a driver that works.

If you're interested in working the problem, the result of booting ICH5 
SATA in drivers/ide is a hang at
	hdX: attached to ide-disk driver

Nothing happens after that.  sysrq doesn't work, so my assumption was 
that the bus was locked up.


>>So, I conclude:  faster, smaller, and better future direction.  IMO, of
>>course :)
> 
> 
> And right now ugly and incomplete.
> IMO, of course ;-).

Incomplete?  Kinda sorta.  SATAPI isn't here yet, so all it needs is 
more fine-grained error handling.  I call it 100% stable now, though.

Ugly?  Compared to drivers/ide?  I actually have a lot of admiration and 
respect for the PATA knowledge embedded in drivers/ide.  But I would 
never call it pretty :)

	Jeff




  reply	other threads:[~2003-05-26 11:00 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-26  4:58 [BK PATCHES] add ata scsi driver Jeff Garzik
2003-05-26  5:15 ` Linus Torvalds
2003-05-26  5:30   ` Jeff Garzik
2003-05-26  5:36     ` Jeff Garzik
2003-05-26  5:42       ` Linus Torvalds
2003-05-26  6:01         ` Jeff Garzik
2003-05-26 16:56           ` Linus Torvalds
2003-05-26 17:47             ` Jeff Garzik
2003-05-26 20:09               ` Linus Torvalds
2003-05-27  0:29                 ` Alan Cox
2003-05-27  6:07                 ` Jeff Garzik
2003-05-27  6:30                   ` Linus Torvalds
2003-05-27  6:51                     ` Linus Torvalds
2003-05-27  7:29                       ` Jeff Garzik
2003-05-26  5:40     ` Linus Torvalds
2003-05-26  5:53       ` Jeff Garzik
2003-05-26  6:21         ` Jeff Garzik
2003-05-26 16:57           ` Linus Torvalds
2003-05-26 17:24             ` Jens Axboe
2003-05-26 17:54               ` Jeff Garzik
2003-05-26 17:59               ` Jeff Garzik
2003-05-26 18:11                 ` Jens Axboe
2003-05-27  0:22       ` Alan Cox
2003-05-27  4:15         ` Linus Torvalds
2003-05-26 10:32     ` Bartlomiej Zolnierkiewicz
2003-05-26 11:13       ` Jeff Garzik [this message]
2003-05-26 11:37         ` Bartlomiej Zolnierkiewicz
2003-05-26  5:59 ` Benjamin Herrenschmidt
2003-05-26  6:03   ` Jeff Garzik
2003-06-02  9:46 ` Andre Hedrick
2003-06-02 13:56   ` Alan Cox
2003-05-26 18:12 James Bottomley
2003-05-26 18:18 ` Jens Axboe
2003-05-26 18:47   ` James Bottomley
2003-05-26 19:07     ` Jens Axboe
2003-05-26 19:17       ` James Bottomley
2003-05-26 19:33         ` Jens Axboe
2003-05-27 12:39           ` Jens Axboe
2003-05-27 14:26             ` James Bottomley
2003-05-27 17:16               ` Jens Axboe
2003-05-27 18:09                 ` James Bottomley
2003-05-27 18:21                   ` Jens Axboe
2003-05-27 18:30                     ` James Bottomley
2003-05-26 20:27         ` Linus Torvalds
2003-05-26 20:36           ` James Bottomley
2003-05-26 20:45             ` Linus Torvalds
2003-05-26 20:51               ` Jens Axboe
2003-05-26 20:56               ` James Bottomley
2003-05-26 20:38           ` Jens Axboe
2003-05-26 20:49             ` Linus Torvalds
2003-05-26 20:57               ` Jens Axboe
2003-05-26 21:34                 ` Linus Torvalds
2003-05-26 23:58                   ` Nick Piggin
2003-05-27  0:09                     ` Linus Torvalds
2003-05-27  0:49                       ` Nick Piggin
2003-05-27  0:16                   ` Alan Cox
2003-05-27  6:54                   ` Jens Axboe
2003-05-27 14:20                     ` James Bottomley
2003-05-27 14:36                     ` Linus Torvalds
2003-05-27 14:59                       ` James Bottomley
2003-05-27 15:21                         ` Jeff Garzik
2003-05-27 15:38                           ` James Bottomley
2003-05-27 15:50                             ` Jeff Garzik
2003-05-27 16:00                               ` James Bottomley
2003-05-27 16:16                                 ` Jeff Garzik
2003-05-28  9:35                                   ` Christoph Hellwig
2003-05-28 10:50                           ` Lincoln Dale
2003-05-27 19:43                       ` Jens Axboe

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=3ED1F6C6.3050400@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=linux-kernel@vger.kernel.org \
    --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).