From: "Kristian Høgsberg" <krh@redhat.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: Re: [PATCH 0/3] New firewire stack
Date: Tue, 05 Dec 2006 18:21:44 -0500 [thread overview]
Message-ID: <4575FF08.2030100@redhat.com> (raw)
In-Reply-To: <20061205184921.GA5029@martell.zuzino.mipt.ru>
Alexey Dobriyan wrote:
> On Tue, Dec 05, 2006 at 12:22:29AM -0500, Kristian Høgsberg wrote:
>> I'm announcing an alternative firewire stack that I've been working on
>> the last few weeks.
>
> Is mainline firewire so hopeless, that you've decided to rewrite it? Could
> you show some ugly places in it?
Yes. I'm not doing this lightheartedly. It's a lot of work and it will
introduce regressions and instability for a little while.
My main point about ohci1394 (the old stacks PCI driver) is, that if you
really want to fix the issues with this driver, you have to shuffle the code
around so much that you'll introduce as many regressions as a clean rewrite.
The big problems in the ohci1394 drivers is the irq_handler, bus reset
handling and config rom handling. These are some of the strong points of
fw-ohci.c:
- Rock solid handling of generations and node IDs around bus resets.
The only way to handle this atomically is to pass the generation
count along all the way to the transmit function in the low-level
driver. The linux1394 low level driver API is broken in this
respect.
- Better handling of self ID receive and possible recursive bus
resets. Successive bus resets could overwrite the self ID DMA
buffer, while we read out the contents. The OHCI specification
recommends a method similiar to linux/seqlock.h for reading out
self IDs, to ensure we get a consistent result.
- Much simpler bus reset handling; we only subscribe to the
selfIDComplete interrupt and don't use the troublesome busReset
interrupt. Rely on async transmit context to not send data while
busReset event bit is set.
- Atomic updates of config rom contents as specified in section 5.5.6
in the OHCI specification. The contents of the ConfigROMheader,
BusOptions and ConfigROMmap registers are updated atomically by the
controller after a reset.
The OHCI specification describes a number of the techniques to ensure race
free operation for the above cases, but the ohci1394 driver generally doesn't
use any of these. If you want to see ugly code look at the ohci1394 irq
handler. Much of the uglyness comes from trying to handle the busReset
interrupt, so that the mid-level linux1394 stack can fail I/O while the bus
reset takes place. Now, OHCI hardware already reliably fails I/O during bus
reset, so there is no need to complicate the core stack with this extra state,
and the OHCI driver becomes much simpler and more reliable, since we now just
need to know when a bus reset has successfully completed.
Fixing this problem requires significant changes to the ohci1394 driver and
the mid-level stack, and will destabilize things until we've figure out how to
work around the odd flaky device out there. Similar problems exists related
to sending packets without bus reset races, updating the config rom, and
reporting self ID packets and all require significant changes to the core
stack and ohci1394. All taken together the scale tips towards a rewrite.
Another point is the various streaming drivers. There used to be 5 different
userspace streaming APIs in the linux1394: raw1394, video1394, amdtp, dv1394
and rawiso. Recently, amdtp (audio streaming) has been removed, since with
the rawiso interface, this can be done in userspace. However the remaining 4
interfaces have slightly disjoint feature sets and can't really be phased out.
In the long run, supporting 4 different interfaces that does almost the same
thing isn't feasible. The streaming interface in my new stack (only
transmission implemented at this point) can replace all of these interfaces.
Finally, some parts aren't actually rewritten, just ported over and
refactored. This is the case for the SBP-2 driver. Functionally, my
fw-sbp2.c is identical to sbp2.c in the current stack, but I've changed it to
work with the new interfaces and cleaned up some of the redundancy.
> We can end up with two not quite working sets of firewire drivers your way.
>
You can patch up the current stack to be less flaky, and Stefan has been doing
a great job at that lately, but it's still fundamentally broken in the ways
described above.
While my stack may less stable for the first couple of weeks, these are
transient issues, such as, say, lack of big endian testing, that are easily
fixed. In the long run this new stack is much more maintainable and has a
bigger potential for stability.
Kristian
next prev parent reply other threads:[~2006-12-05 23:25 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-05 5:22 [PATCH 0/3] New firewire stack Kristian Høgsberg
2006-12-05 5:22 ` [PATCH 2/3] Import fw-ohci driver Kristian Høgsberg
2006-12-05 5:54 ` Pete Zaitcev
2006-12-05 5:58 ` Jeff Garzik
2006-12-05 6:09 ` Benjamin Herrenschmidt
2006-12-09 2:08 ` Kristian Høgsberg
2006-12-09 7:31 ` Stefan Richter
2006-12-10 21:47 ` Kristian Høgsberg
2006-12-10 22:59 ` Stefan Richter
2006-12-10 23:00 ` alignment and packing of struct types (was Re: [PATCH 2/3] Import fw-ohci driver.) Stefan Richter
2006-12-05 5:22 ` [PATCH 3/3] Import fw-sbp2 driver Kristian Høgsberg
2006-12-05 6:07 ` Jeff Garzik
2006-12-05 18:18 ` Stefan Richter
2006-12-14 20:48 ` Kristian Høgsberg
2006-12-14 21:40 ` Stefan Richter
2006-12-15 15:08 ` Kristian Høgsberg
2006-12-15 18:27 ` Stefan Richter
2006-12-05 5:42 ` [PATCH 0/3] New firewire stack Benjamin Herrenschmidt
2006-12-05 6:20 ` Kristian Høgsberg
2006-12-05 16:28 ` Ray Lee
2006-12-05 23:24 ` Kristian Høgsberg
2006-12-05 7:05 ` David Miller
2006-12-05 16:42 ` Kristian Høgsberg
2006-12-05 18:49 ` Stefan Richter
2006-12-05 21:41 ` Benjamin Herrenschmidt
2006-12-05 23:15 ` Stefan Richter
2006-12-05 8:46 ` Marcel Holtmann
2006-12-05 15:13 ` Kristian Høgsberg
2006-12-05 15:30 ` Marcel Holtmann
2006-12-06 16:21 ` Geert Uytterhoeven
2006-12-06 16:32 ` Stefan Richter
2006-12-05 16:05 ` Erik Mouw
2006-07-12 14:56 ` Pavel Machek
2006-12-08 15:09 ` Stefan Richter
2006-12-09 19:44 ` Kristian Høgsberg
2006-12-10 12:57 ` Stefan Richter
2006-12-10 22:17 ` Kristian Høgsberg
2006-12-10 23:21 ` Stefan Richter
2006-12-09 21:51 ` Benjamin Herrenschmidt
2006-12-09 22:51 ` Stefan Richter
2006-12-05 16:53 ` Marcel Holtmann
2006-12-05 23:27 ` Kristian Høgsberg
2006-12-05 18:49 ` Alexey Dobriyan
2006-12-05 19:53 ` Stefan Richter
2006-12-05 23:21 ` Kristian Høgsberg [this message]
2006-12-06 5:35 ` Ben Collins
2006-12-06 8:56 ` Stefan Richter
2006-12-06 11:40 ` Alexander Neundorf
2006-12-06 12:38 ` Stefan Richter
2006-12-06 21:21 ` Kristian Høgsberg
2006-12-06 14:49 ` Ben Collins
2006-12-07 0:31 ` Kristian Høgsberg
2006-12-06 8:36 ` Stefan Richter
2006-12-06 22:27 ` Kristian Høgsberg
2006-12-06 23:55 ` Stefan Richter
2006-12-05 23:23 ` Olaf Hering
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=4575FF08.2030100@redhat.com \
--to=krh@redhat.com \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
/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