Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-07 Thread FUJITA Tomonori
On Mon, 07 Jan 2008 15:25:36 +0200 Boaz Harrosh <[EMAIL PROTECTED]> wrote: > On Mon, Jan 07 2008 at 8:53 +0200, FUJITA Tomonori <[EMAIL PROTECTED]> wrote: > > On Sun, 23 Dec 2007 13:09:05 +0200 > > Boaz Harrosh <[EMAIL PROTECTED]> wrote: > > > >> On Fri, Dec 21 2007 at 4:30 +0200, Benjamin

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-07 Thread Boaz Harrosh
On Mon, Jan 07 2008 at 8:53 +0200, FUJITA Tomonori <[EMAIL PROTECTED]> wrote: > On Sun, 23 Dec 2007 13:09:05 +0200 > Boaz Harrosh <[EMAIL PROTECTED]> wrote: > >> On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt <[EMAIL >> PROTECTED]> wrote: >>> The sense buffer ins scsi_cmnd can

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-07 Thread Boaz Harrosh
On Mon, Jan 07 2008 at 8:53 +0200, FUJITA Tomonori [EMAIL PROTECTED] wrote: On Sun, 23 Dec 2007 13:09:05 +0200 Boaz Harrosh [EMAIL PROTECTED] wrote: On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-07 Thread FUJITA Tomonori
On Mon, 07 Jan 2008 15:25:36 +0200 Boaz Harrosh [EMAIL PROTECTED] wrote: On Mon, Jan 07 2008 at 8:53 +0200, FUJITA Tomonori [EMAIL PROTECTED] wrote: On Sun, 23 Dec 2007 13:09:05 +0200 Boaz Harrosh [EMAIL PROTECTED] wrote: On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt [EMAIL

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-06 Thread FUJITA Tomonori
On Sun, 23 Dec 2007 13:09:05 +0200 Boaz Harrosh <[EMAIL PROTECTED]> wrote: > On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt <[EMAIL PROTECTED]> > wrote: > > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > > by some low level drivers (that typically happens with

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2008-01-06 Thread FUJITA Tomonori
On Sun, 23 Dec 2007 13:09:05 +0200 Boaz Harrosh [EMAIL PROTECTED] wrote: On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-23 Thread Benjamin Herrenschmidt
> This has the potential of leaving a big fat ugly hole in the middle of > scsi_cmnd. I would suggest of *just* moving the sense_buffer array to be > the *first member* of struct scsi_cmnd. The command itself is already cache > aligned, allocated by the proper flags to it's slab. And put a fat

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-23 Thread Boaz Harrosh
On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > by some low level drivers (that typically happens with USB mass > storage). > > This is a problem on non cache coherent architectures such

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-23 Thread Boaz Harrosh
On Fri, Dec 21 2007 at 4:30 +0200, Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage). This is a problem on non cache coherent architectures such as

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-23 Thread Benjamin Herrenschmidt
This has the potential of leaving a big fat ugly hole in the middle of scsi_cmnd. I would suggest of *just* moving the sense_buffer array to be the *first member* of struct scsi_cmnd. The command itself is already cache aligned, allocated by the proper flags to it's slab. And put a fat

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Benjamin Herrenschmidt
On Fri, 2007-12-21 at 10:33 +, Alan Cox wrote: > On Fri, 21 Dec 2007 13:30:08 +1100 > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > > by some low level drivers (that typically happens with USB mass > > storage).

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Benjamin Herrenschmidt
On Fri, 2007-12-21 at 06:16 -0700, Matthew Wilcox wrote: > On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: > > On Fri, 21 Dec 2007 13:30:08 +1100 > > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > > > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > > > by

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Roland Dreier
> It's also incomplete as a fix because I don't see what guarantees the > buffer size will always exceed cache line size There's a macro trick that adds a pad member after the buffer too, so that it gets rounded up to the cacheline size: > +#define __dma_aligned >

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Thomas Bogendoerfer
On Fri, Dec 21, 2007 at 07:00:25AM -0700, Matthew Wilcox wrote: > On Fri, Dec 21, 2007 at 02:30:28PM +0100, Thomas Bogendoerfer wrote: > > there are SCSI host drivers, which also DMA to the sense buffer like > > sgiwd93.c for example. > > Yes ... and there are others which don't, for example

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Matthew Wilcox
On Fri, Dec 21, 2007 at 02:30:28PM +0100, Thomas Bogendoerfer wrote: > there are SCSI host drivers, which also DMA to the sense buffer like > sgiwd93.c for example. Yes ... and there are others which don't, for example qla2xxx and sym53c8xx. -- Intel are signing my paycheques ... these opinions

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Thomas Bogendoerfer
On Fri, Dec 21, 2007 at 06:16:41AM -0700, Matthew Wilcox wrote: > On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: > > On Fri, 21 Dec 2007 13:30:08 +1100 > > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > > > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly >

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Matthew Wilcox
On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: > On Fri, 21 Dec 2007 13:30:08 +1100 > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > > by some low level drivers (that typically happens with USB mass > >

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Alan Cox
On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly > by some low level drivers (that typically happens with USB mass > storage). Should that not be fixed in USB storage by using

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Alan Cox
On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage). Should that not be fixed in USB storage by using pci_alloc_coherent

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Matthew Wilcox
On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage).

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Matthew Wilcox
On Fri, Dec 21, 2007 at 02:30:28PM +0100, Thomas Bogendoerfer wrote: there are SCSI host drivers, which also DMA to the sense buffer like sgiwd93.c for example. Yes ... and there are others which don't, for example qla2xxx and sym53c8xx. -- Intel are signing my paycheques ... these opinions

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Thomas Bogendoerfer
On Fri, Dec 21, 2007 at 06:16:41AM -0700, Matthew Wilcox wrote: On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Thomas Bogendoerfer
On Fri, Dec 21, 2007 at 07:00:25AM -0700, Matthew Wilcox wrote: On Fri, Dec 21, 2007 at 02:30:28PM +0100, Thomas Bogendoerfer wrote: there are SCSI host drivers, which also DMA to the sense buffer like sgiwd93.c for example. Yes ... and there are others which don't, for example qla2xxx and

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Roland Dreier
It's also incomplete as a fix because I don't see what guarantees the buffer size will always exceed cache line size There's a macro trick that adds a pad member after the buffer too, so that it gets rounded up to the cacheline size: +#define __dma_aligned

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Benjamin Herrenschmidt
On Fri, 2007-12-21 at 06:16 -0700, Matthew Wilcox wrote: On Fri, Dec 21, 2007 at 10:33:26AM +, Alan Cox wrote: On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level

Re: [PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-21 Thread Benjamin Herrenschmidt
On Fri, 2007-12-21 at 10:33 +, Alan Cox wrote: On Fri, 21 Dec 2007 13:30:08 +1100 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage). Should

[PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-20 Thread Benjamin Herrenschmidt
The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage). This is a problem on non cache coherent architectures such as embedded PowerPCs where the sense buffer can share cache lines with other structure members,

[PATCH 2/2] scsi: Use new __dma_buffer to align sense buffer in scsi_cmnd

2007-12-20 Thread Benjamin Herrenschmidt
The sense buffer ins scsi_cmnd can nowadays be DMA'ed into directly by some low level drivers (that typically happens with USB mass storage). This is a problem on non cache coherent architectures such as embedded PowerPCs where the sense buffer can share cache lines with other structure members,