RE: [PATCH] UAS: fix alignment of scatter/gather segments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Oliver Neukum
> On Mo, 2019-04-29 at 14:19 +0000, David Laight wrote:
> > From: Oliver Neukum
> > > Sent: 29 April 2019 14:38
> > > On Mo, 2019-04-29 at 13:31 +0000, David Laight wrote:
> > > > From: Oliver Neukum
> > > > >
> > > > > +	 * USB has unusual scatter-gather requirements: the length of each
> > > > > +	 * scatterlist element except the last must be divisible by the
> > > > > +	 * Bulk maxpacket value.  Fortunately this value is always a
> > > > > +	 * power of 2.  Inform the block layer about this requirement.
> > > > > +	 */
> > > >
> > > > That isn't the correct restriction for XHCI.
> > > > It has its own perverse restrictions.
> > > > I think they are all handled within the xhci driver.
> > >
> > > Yes, but that does not matter. You just cannot assume that only
> > > XHCI will be used with UAS. In particular virtual drivers will
> > > be used.
> >
> > True, but there is no need to enforce a 2k (IIRC) alignment for XHCI.
> > Perhaps you need a different property from the controller.
> 
> AFAICT controllers do not export that property.

Perhaps they need to ....

> > Even if you decide the code is 'good enough' (I don't know what the
> > cost is of enforcing a 2k alignment instead of 512 bytes)
> > the comment is just plain wrong.
> 
> Usually block IO will be pages. They are 4K aligned.
> In terms of performance this code is unlikely to matter.

Presumably there are some cases where the buffer isn't 4k aligned.
I'm guessing things like 'dd' of raw disks?

If the buffer has the wrong alignment then I presume a bounce buffer
has to be allocated?
The USB controller drivers are likely to need to be able to do that
anyway because buffers from the network stack can have almost
arbitrary alignment (I remember that code being horrid, I don't
remember a data copy in the TX path).

> But it is needed for correctness.

If you are doing it for 'correctness' then you need the correct size.
If you are doing it because you've seen too small an alignment you
should be mentioning the failing system.

> What would you want for the comment?

You need to be more specific about the alignment requirements than
the old comment, not far less specific.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux