On Mon, 29 Apr 2019, Oliver Neukum wrote: > On Mo, 2019-04-29 at 15:06 +0000, David Laight wrote: > > From: Oliver Neukum > > > On Mo, 2019-04-29 at 14:19 +0000, David Laight wrote: > > > > AFAICT controllers do not export that property. > > > > Perhaps they need to .... > > Feel free to make a patch. > > > > > 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? > > Possibly. > > > 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). > > You can ask the network layer to undo scatter/gather. > I don't see an issue. > > > > But it is needed for correctness. > > > > If you are doing it for 'correctness' then you need the correct size. > > Why? Any larger size will do. > > > If you are doing it because you've seen too small an alignment you > > should be mentioning the failing system. > > Why? > > > > 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. > > But the statement the old comment made are no longer correct. Perhaps David would be satisfied if the comment were changed to say that _some_ USB controller drivers have this unusual alignment requirement. Alan Stern