2011-06-23 11:46:25

by Ralf Baechle

[permalink] [raw]
Subject: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
into tragedy:

CC [M] drivers/staging/comedi/drivers.o
drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
make[3]: *** [drivers/staging/comedi/drivers.o] Error 1

Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.

PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
are even uable to offer uncached operation - at least in the way an unwitting
driver might assume. I haven't looked in details how the driver is using
the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
APIs in conjunction with the DMA API is a practical alternative.

Signed-off-by: Ralf Baechle <[email protected]>

drivers/staging/comedi/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 1502d80..bccdc12 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -2,6 +2,7 @@ config COMEDI
tristate "Data acquisition support (comedi)"
default N
depends on m
+ depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86
---help---
Enable support a wide range of data acquisition devices
for Linux.


2011-06-23 11:58:46

by Martyn Welch

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On 23/06/11 12:45, Ralf Baechle wrote:
> On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
> into tragedy:
>
> CC [M] drivers/staging/comedi/drivers.o
> drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
> drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
> drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
> make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
>
> Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
>
> PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
> are even uable to offer uncached operation - at least in the way an unwitting
> driver might assume. I haven't looked in details how the driver is using
> the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
> cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
> APIs in conjunction with the DMA API is a practical alternative.
>
> Signed-off-by: Ralf Baechle <[email protected]>
>
> drivers/staging/comedi/Kconfig | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
> index 1502d80..bccdc12 100644
> --- a/drivers/staging/comedi/Kconfig
> +++ b/drivers/staging/comedi/Kconfig
> @@ -2,6 +2,7 @@ config COMEDI
> tristate "Data acquisition support (comedi)"
> default N
> depends on m
> + depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86

I'm sure I got comedi to compile on a 32-bit PPC board not that long ago. Has
something changed, or is this just not an exhaustive list?

> ---help---
> Enable support a wide range of data acquisition devices
> for Linux.
> _______________________________________________
> devel mailing list
> [email protected]
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E [email protected] | M2 3AB VAT:GB 927559189

2011-06-23 12:03:42

by Ralf Baechle

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On Thu, Jun 23, 2011 at 12:53:36PM +0100, Martyn Welch wrote:

> On 23/06/11 12:45, Ralf Baechle wrote:
> > On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
> > into tragedy:
> >
> > CC [M] drivers/staging/comedi/drivers.o
> > drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
> > drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
> > drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
> > make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
> >
> > Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
> >
> > PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
> > are even uable to offer uncached operation - at least in the way an unwitting
> > driver might assume. I haven't looked in details how the driver is using
> > the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
> > cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
> > APIs in conjunction with the DMA API is a practical alternative.
> >
> > Signed-off-by: Ralf Baechle <[email protected]>
> >
> > drivers/staging/comedi/Kconfig | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
> > index 1502d80..bccdc12 100644
> > --- a/drivers/staging/comedi/Kconfig
> > +++ b/drivers/staging/comedi/Kconfig
> > @@ -2,6 +2,7 @@ config COMEDI
> > tristate "Data acquisition support (comedi)"
> > default N
> > depends on m
> > + depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86
>
> I'm sure I got comedi to compile on a 32-bit PPC board not that long ago. Has
> something changed, or is this just not an exhaustive list?

(Adding the PPC folks to cc.)

A "git grep -w PAGE_KERNEL_NOCACHE arch/powerpc/" doesn't find anything so
I don't think the driver will build there. I don't have a PPC toolchain
to verify that.

Ralf

2011-06-23 12:24:03

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE


On Jun 23, 2011, at 7:02 AM, Ralf Baechle wrote:

> On Thu, Jun 23, 2011 at 12:53:36PM +0100, Martyn Welch wrote:
>
>> On 23/06/11 12:45, Ralf Baechle wrote:
>>> On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
>>> into tragedy:
>>>
>>> CC [M] drivers/staging/comedi/drivers.o
>>> drivers/staging/comedi/drivers.c: In function ?comedi_buf_alloc?:
>>> drivers/staging/comedi/drivers.c:505:41: error: ?PAGE_KERNEL_NOCACHE? undeclared (first use in this function)
>>> drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
>>> make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
>>>
>>> Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
>>>
>>> PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
>>> are even uable to offer uncached operation - at least in the way an unwitting
>>> driver might assume. I haven't looked in details how the driver is using
>>> the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
>>> cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
>>> APIs in conjunction with the DMA API is a practical alternative.
>>>
>>> Signed-off-by: Ralf Baechle <[email protected]>
>>>
>>> drivers/staging/comedi/Kconfig | 1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
>>> index 1502d80..bccdc12 100644
>>> --- a/drivers/staging/comedi/Kconfig
>>> +++ b/drivers/staging/comedi/Kconfig
>>> @@ -2,6 +2,7 @@ config COMEDI
>>> tristate "Data acquisition support (comedi)"
>>> default N
>>> depends on m
>>> + depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86
>>
>> I'm sure I got comedi to compile on a 32-bit PPC board not that long ago. Has
>> something changed, or is this just not an exhaustive list?
>
> (Adding the PPC folks to cc.)
>
> A "git grep -w PAGE_KERNEL_NOCACHE arch/powerpc/" doesn't find anything so
> I don't think the driver will build there. I don't have a PPC toolchain
> to verify that.

I can verify it fails on PPC as well:

drivers/staging/comedi/drivers.c: In function 'comedi_buf_alloc':
drivers/staging/comedi/drivers.c:505:37: error: 'PAGE_KERNEL_NOCACHE' undeclared (first use in this function)
drivers/staging/comedi/drivers.c:505:37: note: each undeclared identifier is reported only once for each function it appears in

However, we do have a #define for PAGE_KERNEL_NC.

- k-

2011-06-23 12:13:47

by Martyn Welch

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On 23/06/11 13:02, Ralf Baechle wrote:
> On Thu, Jun 23, 2011 at 12:53:36PM +0100, Martyn Welch wrote:
>
>> On 23/06/11 12:45, Ralf Baechle wrote:
>>> On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
>>> into tragedy:
>>>
>>> CC [M] drivers/staging/comedi/drivers.o
>>> drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
>>> drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
>>> drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
>>> make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
>>>
>>> Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
>>>
>>> PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
>>> are even uable to offer uncached operation - at least in the way an unwitting
>>> driver might assume. I haven't looked in details how the driver is using
>>> the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
>>> cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
>>> APIs in conjunction with the DMA API is a practical alternative.
>>>
>>> Signed-off-by: Ralf Baechle <[email protected]>
>>>
>>> drivers/staging/comedi/Kconfig | 1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
>>> index 1502d80..bccdc12 100644
>>> --- a/drivers/staging/comedi/Kconfig
>>> +++ b/drivers/staging/comedi/Kconfig
>>> @@ -2,6 +2,7 @@ config COMEDI
>>> tristate "Data acquisition support (comedi)"
>>> default N
>>> depends on m
>>> + depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86
>>
>> I'm sure I got comedi to compile on a 32-bit PPC board not that long ago. Has
>> something changed, or is this just not an exhaustive list?
>
> (Adding the PPC folks to cc.)
>
> A "git grep -w PAGE_KERNEL_NOCACHE arch/powerpc/" doesn't find anything so
> I don't think the driver will build there. I don't have a PPC toolchain
> to verify that.

Ah, just found the tree looks like I had a little patch to make it seemingly
work, though it will make it "not work" for most other archs at a guess (it
may not even be right on PPC):

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 44d6b62..263ad3d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -505,7 +505,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct
comedi_subdevice *s,
}
if (i == n_pages) {
async->prealloc_buf =
- vmap(pages, n_pages, VM_MAP, PAGE_KERNEL_NOCACHE);
+ vmap(pages, n_pages, VM_MAP, PAGE_KERNEL_NC);
}
vfree(pages);

(Sorry for the wrapping)

--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E [email protected] | M2 3AB VAT:GB 927559189

2011-06-23 15:07:02

by Ralf Baechle

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On Thu, Jun 23, 2011 at 07:10:29AM -0500, Kumar Gala wrote:

> > (Adding the PPC folks to cc.)
> >
> > A "git grep -w PAGE_KERNEL_NOCACHE arch/powerpc/" doesn't find anything so
> > I don't think the driver will build there. I don't have a PPC toolchain
> > to verify that.
>
> I can verify it fails on PPC as well:
>
> drivers/staging/comedi/drivers.c: In function 'comedi_buf_alloc':
> drivers/staging/comedi/drivers.c:505:37: error: 'PAGE_KERNEL_NOCACHE' undeclared (first use in this function)
> drivers/staging/comedi/drivers.c:505:37: note: each undeclared identifier is reported only once for each function it appears in
>
> However, we do have a #define for PAGE_KERNEL_NC.

Do you think this driver in it's current stage is so valuable that some
ifdefery to get it to work on PPC is the way to go?

IA-64 has PAGE_KERNEL_UC, so basically the same question for IA-64, too.

But preferably the driver should be sorted out properly and until the v1
of my patch which disables it on all architectures that don't provide a
PAGE_KERNEL_NOCACHE definition will do just fine.

Ralf

2011-06-23 16:01:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On Thu, Jun 23, 2011 at 13:45, Ralf Baechle <[email protected]> wrote:
> On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
> into tragedy:
>
>  CC [M]  drivers/staging/comedi/drivers.o
> drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
> drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
> drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
> make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
>
> Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
>
> PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
> are even uable to offer uncached operation - at least in the way an unwitting
> driver might assume.  I haven't looked in details how the driver is using
> the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
> cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
> APIs in conjunction with the DMA API is a practical alternative.
>
> Signed-off-by: Ralf Baechle <[email protected]>

Acked-by: Geert Uytterhoeven <[email protected]>

If only to get m68k/allmodconfig going again (hmm, there's another
staging driver
preventing a green light).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

2011-06-23 16:31:56

by Ralf Baechle

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On Thu, Jun 23, 2011 at 06:01:47PM +0200, Geert Uytterhoeven wrote:

> If only to get m68k/allmodconfig going again (hmm, there's another
> staging driver
> preventing a green light).

I ran into this doing an allyesconfig. Allyesconfig has one disadvantage,
for choice it will only select the first or default option which means
that option gets exercised well and all the other options not at all. On
MIPS that'd be IP22, 32-bit, R4x00, big endian, 4K pages, no multithreading,
250Hz. Make randconfig disables lots of things so often misses the
opportunity to trigger some issues.

I'd really want an "make allrandconfig" which enables as many options as
possible but picks a random one from choice statements, something like that.

Ralf

2011-06-23 19:18:33

by Arnaud Lacombe

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

Hi,

On Thu, Jun 23, 2011 at 12:31 PM, Ralf Baechle <[email protected]> wrote:
> On Thu, Jun 23, 2011 at 06:01:47PM +0200, Geert Uytterhoeven wrote:
>
>> If only to get m68k/allmodconfig going again (hmm, there's another
>> staging driver
>> preventing a green light).
>
> I ran into this doing an allyesconfig. ?Allyesconfig has one disadvantage,
> for choice it will only select the first or default option which means
> that option gets exercised well and all the other options not at all. ?On
> MIPS that'd be IP22, 32-bit, R4x00, big endian, 4K pages, no multithreading,
> 250Hz. ?Make randconfig disables lots of things so often misses the
> opportunity to trigger some issues.
>
> I'd really want an "make allrandconfig" which enables as many options as
> possible but picks a random one from choice statements, something like that.
>
Something like the attached patch ? [sorry for the attachment, gmail
is so much a PITA for that ...]

- Arnaud

ps: the patch breaks all the others *config target.

> ?Ralf
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>


Attachments:
0001-allyesrandchoiceconfig.patch (3.84 kB)

2011-06-23 22:02:39

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

On Thu, 2011-06-23 at 13:02 +0100, Ralf Baechle wrote:
> On Thu, Jun 23, 2011 at 12:53:36PM +0100, Martyn Welch wrote:
>
> > On 23/06/11 12:45, Ralf Baechle wrote:
> > > On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
> > > into tragedy:
> > >
> > > CC [M] drivers/staging/comedi/drivers.o
> > > drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
> > > drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
> > > drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
> > > make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
> > >
> > > Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
> > >
> > > PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
> > > are even uable to offer uncached operation - at least in the way an unwitting
> > > driver might assume. I haven't looked in details how the driver is using
> > > the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
> > > cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
> > > APIs in conjunction with the DMA API is a practical alternative.
> > >
> > > Signed-off-by: Ralf Baechle <[email protected]>
> > >
> > > drivers/staging/comedi/Kconfig | 1 +
> > > 1 files changed, 1 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
> > > index 1502d80..bccdc12 100644
> > > --- a/drivers/staging/comedi/Kconfig
> > > +++ b/drivers/staging/comedi/Kconfig
> > > @@ -2,6 +2,7 @@ config COMEDI
> > > tristate "Data acquisition support (comedi)"
> > > default N
> > > depends on m
> > > + depends on BROKEN || FRV || M32R || MN10300 || SUPERH || TILE || X86
> >
> > I'm sure I got comedi to compile on a 32-bit PPC board not that long ago. Has
> > something changed, or is this just not an exhaustive list?

It went away. There's a proper API (pgprot_noncached), but it depends
what this is used for and it's likely to be broken anyways... what is
that driver trying to map non-cached ?

Cheers,
Ben.

> (Adding the PPC folks to cc.)
>
> A "git grep -w PAGE_KERNEL_NOCACHE arch/powerpc/" doesn't find anything so
> I don't think the driver will build there. I don't have a PPC toolchain
> to verify that.
>
> Ralf
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arch" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-06-23 23:56:01

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH] STAGING: Comedi: Build only on arches providing PAGE_KERNEL_NOCACHE

Hi Ralf,

On Thu, 23 Jun 2011 12:45:37 +0100 Ralf Baechle <[email protected]> wrote:
>
> On architectures that don't define PAGE_KERNEL_NOCACHE, the Comedi driver turns
> into tragedy:
>
> CC [M] drivers/staging/comedi/drivers.o
> drivers/staging/comedi/drivers.c: In function ‘comedi_buf_alloc’:
> drivers/staging/comedi/drivers.c:505:41: error: ‘PAGE_KERNEL_NOCACHE’ undeclared (first use in this function)
> drivers/staging/comedi/drivers.c:505:41: note: each undeclared identifier is rep orted only once for each function it appears in
> make[3]: *** [drivers/staging/comedi/drivers.o] Error 1
>
> Restrict the driver to only those architectures that define PAGE_KERNEL_NOCACHE.
>
> PAGE_KERNEL_NOCACHE is a kludge - some system architectures such as SGI IP27
> are even uable to offer uncached operation - at least in the way an unwitting
> driver might assume. I haven't looked in details how the driver is using
> the area vmaped with PAGE_KERNEL_NOCACHE but maybe doing it XFS-style using
> cached memory and the flush_kernel_vmap_range / invalidate_kernel_vmap_range
> APIs in conjunction with the DMA API is a practical alternative.
>
> Signed-off-by: Ralf Baechle <[email protected]>

Since Greg is on vacation, I will add this patch to my fixes tree in
linux-next until a better fix comes along (if there is one).

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (1.42 kB)
(No filename) (490.00 B)
Download all attachments