Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Benjamin Herrenschmidt
On Mon, 2007-07-16 at 17:03 -0500, James Bottomley wrote: > On Tue, 2007-07-17 at 07:49 +1000, Benjamin Herrenschmidt wrote: > > > No ... that was the point of flush_kernel_dcache_page(). The page in > > > question is page cache backed and contains user mappings. However, the > > > block layer ha

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread James Bottomley
On Tue, 2007-07-17 at 07:49 +1000, Benjamin Herrenschmidt wrote: > > No ... that was the point of flush_kernel_dcache_page(). The page in > > question is page cache backed and contains user mappings. However, the > > block layer has already done a flush_dcache_page() in get_user_pages() > > and t

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Benjamin Herrenschmidt
> No ... that was the point of flush_kernel_dcache_page(). The page in > question is page cache backed and contains user mappings. However, the > block layer has already done a flush_dcache_page() in get_user_pages() > and the user shouldn't be touching memory under I/O (unless they want > self

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Benjamin Herrenschmidt
On Mon, 2007-07-16 at 08:47 -0500, James Bottomley wrote: > > No ... that was the point of flush_kernel_dcache_page(). The page in > question is page cache backed and contains user mappings. However, > the > block layer has already done a flush_dcache_page() in get_user_pages() > and the user sh

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Benjamin Herrenschmidt
> Upon closer look, while flush_kernel_dcache_page() is a no-op on ppc64, > flush_dcache_page() isn't. So I'd prefer to not call it if not really needed. > > And according to James, flush_kernel_dcache_page() should be sufficient... > > So I'm getting puzzled again... flush_dcache_page() handle

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Geert Uytterhoeven
On Mon, 16 Jul 2007, Jens Axboe wrote: > On Mon, Jul 16 2007, James Bottomley wrote: > > On Mon, 2007-07-16 at 14:16 +0200, Jens Axboe wrote: > > > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > > > Ah, that explains it. flush_dcache_page

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Jens Axboe
On Mon, Jul 16 2007, James Bottomley wrote: > On Mon, 2007-07-16 at 14:16 +0200, Jens Axboe wrote: > > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > > > I'll update m

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread James Bottomley
On Mon, 2007-07-16 at 14:16 +0200, Jens Axboe wrote: > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > > I'll update my patches. Thanks for the comments! > > > > Does this

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Jens Axboe
On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > On Mon, 16 Jul 2007, Geert Uytterhoeven wrote: > > On Mon, 16 Jul 2007, Jens Axboe wrote: > > > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > > > Ah, that explains it. flush_dcache_page()

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Geert Uytterhoeven
On Mon, 16 Jul 2007, Geert Uytterhoeven wrote: > On Mon, 16 Jul 2007, Jens Axboe wrote: > > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > > > I'll update my patches.

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Jens Axboe
On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > On Mon, 16 Jul 2007, Jens Axboe wrote: > > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > > > I'll update my patches.

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Geert Uytterhoeven
On Mon, 16 Jul 2007, Jens Axboe wrote: > On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > > I'll update my patches. Thanks for the comments! > > > > Does this look OK? > >

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Jens Axboe
On Mon, Jul 16 2007, Geert Uytterhoeven wrote: > On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > > Ah, that explains it. flush_dcache_page() is used in some drivers. > > I'll update my patches. Thanks for the comments! > > Does this look OK? > - Replaced KM_USER0 by KM_IRQ0 (all routines are ei

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Segher Boessenkool
I'm pretty sure that no ppc64 machine needs alias resolution in the kernel, although some are VIPT. Last time we discussed this, Segher explained it to me, but I don't remember which way Cell does it. IIRC, it automatically flushes cache lines that are accessed through aliases. Ah yes, I r

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-16 Thread Geert Uytterhoeven
On Fri, 13 Jul 2007, Geert Uytterhoeven wrote: > Ah, that explains it. flush_dcache_page() is used in some drivers. > I'll update my patches. Thanks for the comments! Does this look OK? - Replaced KM_USER0 by KM_IRQ0 (all routines are either called from an interrupt handler, from .request_fn

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Benjamin Herrenschmidt
On Fri, 2007-07-13 at 16:19 +0200, Arnd Bergmann wrote: > I'm pretty sure that no ppc64 machine needs alias resolution in the kernel, > although some are VIPT. Last time we discussed this, Segher explained it > to me, but I don't remember which way Cell does it. IIRC, it automatically > flushes cac

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Benjamin Herrenschmidt
On Fri, 2007-07-13 at 09:02 -0400, James Bottomley wrote: > On Wed, 2007-07-04 at 15:22 +0200, Geert Uytterhoeven wrote: > > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > > + if (!kaddr) > > + return -1; > > +

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Geert Uytterhoeven
On Fri, 13 Jul 2007, James Bottomley wrote: > On Fri, 2007-07-13 at 17:10 +0200, Geert Uytterhoeven wrote: > > On Fri, 13 Jul 2007, Arnd Bergmann wrote: > > > On Friday 13 July 2007, James Bottomley wrote: > > > > > IC. > > > > > > > > > > - flush_kernel_dcache_page() is a no-op on ppc64 > > > >

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Jens Axboe
On Fri, Jul 13 2007, Geert Uytterhoeven wrote: > > It's probably a good idea to have the flush_kernel_dcache_page() in there > > anyway, if only to serve as an example for people that copy it into > > architecture-independent drivers, same as what we do for the > > k{,un}map_atomic() that is also n

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread James Bottomley
On Fri, 2007-07-13 at 17:10 +0200, Geert Uytterhoeven wrote: > On Fri, 13 Jul 2007, Arnd Bergmann wrote: > > On Friday 13 July 2007, James Bottomley wrote: > > > > IC. > > > > > > > > - flush_kernel_dcache_page() is a no-op on ppc64 > > > > (ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE is defined on paris

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Geert Uytterhoeven
On Fri, 13 Jul 2007, Arnd Bergmann wrote: > On Friday 13 July 2007, James Bottomley wrote: > > > IC. > > > > > > � - flush_kernel_dcache_page() is a no-op on ppc64 > > > � � (ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE is defined on parisc only). > > > > > > � - For reference, drivers/scsi/ipr.c (another p

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Jens Axboe
On Fri, Jul 13 2007, Geert Uytterhoeven wrote: > On Fri, 13 Jul 2007, Jens Axboe wrote: > > On Fri, Jul 13 2007, James Bottomley wrote: > > > On Wed, 2007-07-04 at 15:22 +0200, Geert Uytterhoeven wrote: > > > > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > > > > +

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Arnd Bergmann
On Friday 13 July 2007, James Bottomley wrote: > > > IC. > > > >   - flush_kernel_dcache_page() is a no-op on ppc64 > >     (ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE is defined on parisc only). > > > >   - For reference, drivers/scsi/ipr.c (another ppc64 driver) just uses a > > plain > >     kmap/memc

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread James Bottomley
On Fri, 2007-07-13 at 15:45 +0200, Geert Uytterhoeven wrote: > On Fri, 13 Jul 2007, James Bottomley wrote: > > On Fri, 2007-07-13 at 15:25 +0200, Geert Uytterhoeven wrote: > > > kmap() just returns page_address() on ppc64, as there's no highmem. > > > kunmap() is a no-op. > > > > > So technically

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Geert Uytterhoeven
On Fri, 13 Jul 2007, James Bottomley wrote: > On Fri, 2007-07-13 at 15:25 +0200, Geert Uytterhoeven wrote: > > kmap() just returns page_address() on ppc64, as there's no highmem. > > kunmap() is a no-op. > > > So technically I could just use page_address() directly, but Christoph > > wanted > > me

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread James Bottomley
On Fri, 2007-07-13 at 15:25 +0200, Geert Uytterhoeven wrote: > kmap() just returns page_address() on ppc64, as there's no highmem. > kunmap() is a no-op. > So technically I could just use page_address() directly, but Christoph > wanted > me to keep the kmap()/kunmap() sequence because it's conside

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Geert Uytterhoeven
On Fri, 13 Jul 2007, Jens Axboe wrote: > On Fri, Jul 13 2007, James Bottomley wrote: > > On Wed, 2007-07-04 at 15:22 +0200, Geert Uytterhoeven wrote: > > > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > > > + if (!kaddr) > > > +

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread Jens Axboe
On Fri, Jul 13 2007, James Bottomley wrote: > On Wed, 2007-07-04 at 15:22 +0200, Geert Uytterhoeven wrote: > > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > > + if (!kaddr) > > + return -1; > > + len =

Re: [patch 5/6] ps3: BD/DVD/CD-ROM Storage Driver

2007-07-13 Thread James Bottomley
On Wed, 2007-07-04 at 15:22 +0200, Geert Uytterhoeven wrote: > + kaddr = kmap_atomic(sgpnt->page, KM_USER0); > + if (!kaddr) > + return -1; > + len = sgpnt->length; > + if ((req_len