Re: can device drivers return non-ram via vm_ops->nopage?

From: Russell King
Date: Sat Mar 20 2004 - 11:10:09 EST


On Sat, Mar 20, 2004 at 04:58:21PM +0100, Jaroslav Kysela wrote:
> On Sat, 20 Mar 2004, Russell King wrote:
> > Actually, ALSA is broken in that respect - it isn't portable as it
> > stands. It isn't the API which is broken - it's ALSA which is broken.
> > Performing virt_to_page() on any non-direct mapped RAM page (which
> > means the value returned from dma_alloc_coherent or pci_alloc_consistent)
> > is undefined.
> >
> > One of my current projects is fixing this crap in ALSA.
>
> Yes, but if there's no API in the kernel code allowing to obtain page
> pointers using any value returned from dma_alloc_coherent(), then we
> cannot fix this problem.

It is fixable, if someone sits down and works through it, which is
precisely what I've been doing.

> So, it's not much subsystem (ALSA) problem, but kernel core is not matured
> enough.

It is well known that virt_to_page() is only valid on virtual addresses
which correspond to kernel direct mapped RAM pages, and undefined on
everything else. Unfortunately, ALSA has been using it with
pci_alloc_consistent() for a long time, and this behaviour is what
makes ALSA broken. The fact it works on x86 is merely incidental.

If ALSA wants this functionality, the ALSA people should ideally have
put their requirements forward during the 2.5 development cycle so the
problem could be addressed. However, luckily in this instance, it is
not a big problem to solve. It just requires time to sort through all
the abstraction layers upon abstraction layers which ALSA has.

- and I'm doing exactly this, right now. Be patient. -

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/