From: Andrea Arcangeli <andrea@suse.de>
To: William Lee Irwin III <wli@holomorphy.com>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
Linus Torvalds <torvalds@osdl.org>
Subject: Re: can device drivers return non-ram via vm_ops->nopage?
Date: Sat, 20 Mar 2004 16:57:39 +0100 [thread overview]
Message-ID: <20040320155739.GQ9009@dualathlon.random> (raw)
In-Reply-To: <20040320154419.A6726@flint.arm.linux.org.uk>
On Sat, Mar 20, 2004 at 03:44:19PM +0000, Russell King wrote:
> On Sat, Mar 20, 2004 at 04:06:21PM +0100, Andrea Arcangeli wrote:
> > On Sat, Mar 20, 2004 at 06:40:22AM -0800, William Lee Irwin III wrote:
> > > On Sat, Mar 20, 2004 at 02:30:25PM +0100, Andrea Arcangeli wrote:
> > > > Anyways returning to the non-ram returned by ->nopage see the below
> > > > email exchange with Jens. the bug triggering of course is the
> > > > BUG_ON(!pfn_valid(page_to_pfn(new_page))).
> > > > If we want to return non-ram, we could, but I believe we should change
> > > > the API to return a pfn not a page_t * if we want to.
> > >
> > > This would be very helpful for other reasons also. There's a general
> > > API issue with drivers that want or need to do this. The one I've
> >
> > I'm afraid I'll have to teach ->nopage how to deal with non-ram with
> > this page_t API too (changing it to pfn sounds too intrusive in the
> > short term), it seems to me that alsa can return non-ram (in the nopage
> > callback there's a virt_to_page on some iomm region), and changing alsa
> > to use remap_file_pages sounds too intrusive too.
>
> 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.
this is exactly the problem.
> One of my current projects is fixing this crap in ALSA.
Do you agree it should be fixed by returning a PFN from ->nopage? or are
you doing it differently with remap_file_pages or peraphs you're just
multiplying the right pfn for sizeof(page_t) ingoring the misleading API?
> Besides, returning an invalid struct page will lead to Bad Things(tm)
> in set_pte().
you mean in the non-x86 archs right?
there is no way I can change ->nopage to return a pfn right now (this
stuff must work stable ASAP), so I'm currently teaching do_no_page to
handle non-ram pages (for the first time ever it will be able to do
that), I expect this at least will make it work right on x86 w/o iommu.
for mainline 2.6 if we want to keep using ->nopage I agree with Wli that
an API change is reasonable.
BTW, I was wrong talking about machine checks, the problem here is
reading random _virtual_ address (not phyisical ones), so it could oops
too on x86, and starting from 2.6.5-rc1 it'll corrupt mem too.
next prev parent reply other threads:[~2004-03-20 15:56 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-20 13:30 Andrea Arcangeli
2004-03-20 14:40 ` William Lee Irwin III
2004-03-20 15:06 ` Andrea Arcangeli
2004-03-20 15:27 ` William Lee Irwin III
2004-03-20 15:44 ` Russell King
2004-03-20 15:57 ` Andrea Arcangeli [this message]
2004-03-20 16:15 ` Russell King
2004-03-20 16:25 ` Andrea Arcangeli
2004-03-20 16:57 ` William Lee Irwin III
2004-03-20 17:48 ` Andrea Arcangeli
2004-03-20 19:03 ` Andrea Arcangeli
2004-03-20 15:58 ` Jaroslav Kysela
2004-03-20 16:09 ` Russell King
2004-03-20 19:44 ` Jaroslav Kysela
2004-03-20 22:23 ` Russell King
2004-03-20 22:45 ` William Lee Irwin III
2004-03-20 23:54 ` Russell King
2004-03-21 0:22 ` Zwane Mwaikambo
2004-03-22 4:46 ` Benjamin Herrenschmidt
2004-03-22 18:23 ` Richard Curnow
2004-03-21 0:23 ` William Lee Irwin III
2004-03-21 9:52 ` Arjan van de Ven
2004-03-21 10:39 ` Jaroslav Kysela
2004-03-22 4:43 ` Benjamin Herrenschmidt
2004-03-20 20:13 ` Andrew Morton
2004-03-20 20:28 ` Andrea Arcangeli
2004-03-20 20:50 ` William Lee Irwin III
2004-03-20 22:26 ` Russell King
2004-03-20 22:45 ` William Lee Irwin III
2004-03-21 20:45 ` David Woodhouse
2004-03-21 20:49 ` Christoph Hellwig
2004-03-21 20:57 ` David Woodhouse
2004-03-21 21:53 ` Linus Torvalds
2004-03-21 22:17 ` Jeff Garzik
2004-03-21 22:23 ` David Woodhouse
2004-03-21 22:23 ` Russell King
2004-03-21 22:34 ` Jeff Garzik
2004-03-21 22:42 ` David Woodhouse
2004-03-21 23:06 ` Jeff Garzik
2004-03-21 22:51 ` Russell King
2004-03-21 23:09 ` Jeff Garzik
2004-03-21 23:11 ` Linus Torvalds
2004-03-21 23:22 ` Jeff Garzik
2004-03-21 23:51 ` Linus Torvalds
2004-03-21 23:58 ` Russell King
2004-03-22 0:34 ` Andrea Arcangeli
2004-03-22 3:05 ` Linus Torvalds
2004-03-23 17:59 ` Andy Whitcroft
2004-03-23 17:58 ` David Woodhouse
2004-03-23 18:11 ` William Lee Irwin III
2004-03-22 0:02 ` David Woodhouse
2004-03-22 3:28 ` Linus Torvalds
2004-03-22 0:10 ` Jeff Garzik
2004-03-22 0:20 ` Russell King
2004-03-22 0:33 ` Jeff Garzik
2004-03-22 4:57 ` Benjamin Herrenschmidt
2004-03-21 23:45 ` Russell King
2004-03-22 0:23 ` William Lee Irwin III
2004-03-22 0:29 ` Jeff Garzik
2004-03-22 1:28 ` William Lee Irwin III
2004-03-22 6:36 ` William Lee Irwin III
2004-03-20 17:39 ` Linus Torvalds
2004-03-20 17:56 ` Andrea Arcangeli
2004-03-20 18:22 ` William Lee Irwin III
2004-03-21 3:13 ` Chris Wedgwood
2004-03-21 6:23 ` Christoph Hellwig
2004-03-21 7:00 ` Chris Wedgwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040320155739.GQ9009@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®