Re: [PATCH 0/7] sg_ring: a ring of scatterlist arrays

From: Rusty Russell
Date: Wed Jan 09 2008 - 21:01:40 EST


On Thursday 10 January 2008 09:10:37 James Bottomley wrote:
> On Tue, 2008-01-08 at 11:39 +1100, Rusty Russell wrote:
> > On Tuesday 08 January 2008 02:48:23 James Bottomley wrote:
> > > We're always open to new APIs (or more powerful and expanded old ones).
> > > The way we've been doing the sg_chain conversion is to slide API layers
> > > into the drivers so sg_chain becomes a simple API flip when we turn it
> > > on. Unfortunately sg_ring doesn't quite fit nicely into this.
> >
> > Hi James,
> >
> > Well, it didn't touch any drivers. The only ones which needed
> > altering were those which wanted to use large scatter-gather lists. You
> > think of the subtlety of sg-chain conversion as a feature; it's a bug :)
>
> No, I think of the side effect of hiding scatterlist manipulations
> inside accessors as a feature because it insulates the drivers from the
> details of the implementation.

I completely disagree. Abstractions add complexity, and that costs. They
steal information from their users, and as they build up like sediment they
make debugging and understanding harder.

For example, an array is simple and well understood. An abstraction would
just buy confusion and YA thing to learn.

When a single array was no longer sufficient, I figured a linked-list of
arrays was the simplest replacement. Easy to understand and accepted
practice (tho rings are a bit exotic). Because the implementation is the
interface, authors can see what is legal.

More concretely, you're already regarding your abstractions as too expensive,
which is why sg_chain() doesn't handle chained sgs.

Result: you've got a complex implementation and a complex interface with a
complex abstraction.

> > sg_chains suck for manipulation, and AFAICT that's inherent. Here, take
> > a look at the sg_ring conversion of scsi_alloc_sgtable and
> > scsi_free_sgtable and you can see why I'm unhappy with the sg_chain code:
> [...]
>
> > Hope that clarifies,
>
> Actually, not really. If I want to continue the competition, I can just
> point out that your sg_ring code is bigger than those corresponding
> segments are after the sg_table conversion of scsi_lib.c ...
>
> However, this is pointless.

No, it's exactly the point. These details *matter*. The implementation
*matters*. sg_table moves this code out of scsi_lib (good!), but still
demonstrates how much of a PITA they are to manipulate.

As for being able to make arbitrary changes in future without hitting drivers:
this is the Kernel ABI pipe dream writ small.

OK, I give in with -ETIMEDOUT. I'll go away now and do something
productive :)

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/