linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* virt_to_page(pci_alloc_consistent())
@ 2002-10-03  6:38 Pete Zaitcev
  2002-10-03  8:03 ` virt_to_page(pci_alloc_consistent()) David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Zaitcev @ 2002-10-03  6:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pete Zaitcev

Guys,

I just noticed that sound drivers use the address from
pci_alloc_consistent() as the input to virt_to_page() all
over the place. I looked into the Documentation/DMA-mapping.txt,
and it says:

  This routine will allocate RAM for that region, so it acts similarly to
  __get_free_pages (but takes size instead of a page order).

I know for fact I got it wrong in sparc in whole 2.4, and it seems
RMK got it wrong in arm. I suggest other architecture maintainers
to look at it ASAP. May even be oopsabe, by indexing outside of
mem_map[] with a suitable sound driver.

-- Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_page(pci_alloc_consistent())
  2002-10-03  6:38 virt_to_page(pci_alloc_consistent()) Pete Zaitcev
@ 2002-10-03  8:03 ` David S. Miller
  2002-10-03 16:25   ` virt_to_page(pci_alloc_consistent()) Pete Zaitcev
  0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2002-10-03  8:03 UTC (permalink / raw)
  To: zaitcev; +Cc: linux-kernel

   From: Pete Zaitcev <zaitcev@redhat.com>
   Date: Thu, 3 Oct 2002 02:38:14 -0400

   I just noticed that sound drivers use the address from
   pci_alloc_consistent() as the input to virt_to_page() all
   over the place. I looked into the Documentation/DMA-mapping.txt,
   and it says:
   
     This routine will allocate RAM for that region, so it acts similarly to
     __get_free_pages (but takes size instead of a page order).
   
   I know for fact I got it wrong in sparc in whole 2.4, and it seems
   RMK got it wrong in arm. I suggest other architecture maintainers
   to look at it ASAP. May even be oopsabe, by indexing outside of
   mem_map[] with a suitable sound driver.

I think we MUST allow architectures to do what SPARC and ARM
do, there is simply no other way to change the page protections
easily for these kinds of systems.

So please instead change the DMA-mapping.txt documentation and
propose pci_consistent_to_page(ptr) API additions.  Next, inform
the subsytems trying to use virt_to_page() on this memory that
they need to use the new interface.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_page(pci_alloc_consistent())
  2002-10-03  8:03 ` virt_to_page(pci_alloc_consistent()) David S. Miller
@ 2002-10-03 16:25   ` Pete Zaitcev
  2002-10-03 17:11     ` virt_to_page(pci_alloc_consistent()) David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Zaitcev @ 2002-10-03 16:25 UTC (permalink / raw)
  To: David S. Miller; +Cc: zaitcev, linux-kernel

> Date: Thu, 03 Oct 2002 01:03:44 -0700 (PDT)
> From: "David S. Miller" <davem@redhat.com>

>    From: Pete Zaitcev <zaitcev@redhat.com>
>    Date: Thu, 3 Oct 2002 02:38:14 -0400
> 
>    I just noticed that sound drivers use the address from
>    pci_alloc_consistent() as the input to virt_to_page() all
>    over the place. I looked into the Documentation/DMA-mapping.txt,
>    and it says:
>    
>      This routine will allocate RAM for that region, so it acts similarly to
>      __get_free_pages (but takes size instead of a page order).
>    
>    I know for fact I got it wrong in sparc in whole 2.4, and it seems
>    RMK got it wrong in arm. I suggest other architecture maintainers
>    to look at it ASAP. May even be oopsabe, by indexing outside of
>    mem_map[] with a suitable sound driver.
> 
> I think we MUST allow architectures to do what SPARC and ARM
> do, there is simply no other way to change the page protections
> easily for these kinds of systems.

I can fix sparc, dunno about others. Do you have a problem
on sparc64? Are you using a huge page to map the kernel?

> So please instead change the DMA-mapping.txt documentation and
> propose pci_consistent_to_page(ptr) API additions.  Next, inform
> the subsytems trying to use virt_to_page() on this memory that
> they need to use the new interface.

It's hell on earth trying to find them without __pa barfing
on addresses outside of linear area. Don't you think it may
be time to add a BUG_ON there, at least for 2.5?

I also toyed with idea of __pa which walks page tables.
The problem now is that every Joe Driver Writer on the street
started to use pte_offset(pmd_offset(pgd_offset())), which they
duly copy from bttv. Of course, highmem or other changes break
that, because it was not an API meant to be exposed. We kinda
let Kraxel to do it because there was no other way for V4L.

The idea of some virtual addresses more equial than others is
extremely hard to impart into heads of driver writers, in my
expirience. At least we have to invent a new term for vmalloc
area, such as "logical" address, and make Corbet to fix THE BOOK.

-- Pete

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virt_to_page(pci_alloc_consistent())
  2002-10-03 16:25   ` virt_to_page(pci_alloc_consistent()) Pete Zaitcev
@ 2002-10-03 17:11     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2002-10-03 17:11 UTC (permalink / raw)
  To: zaitcev; +Cc: linux-kernel

   From: Pete Zaitcev <zaitcev@redhat.com>
   Date: Thu, 3 Oct 2002 12:25:10 -0400

   > Date: Thu, 03 Oct 2002 01:03:44 -0700 (PDT)
   > From: "David S. Miller" <davem@redhat.com>
   
   > I think we MUST allow architectures to do what SPARC and ARM
   > do, there is simply no other way to change the page protections
   > easily for these kinds of systems.
   
   I can fix sparc, dunno about others. Do you have a problem
   on sparc64? Are you using a huge page to map the kernel?

ARM I believe does not have luxury you have.

See, some processors are like MIPS and something sort of
KSEG0 is used for PAGE_OFFSET mapping of physical pages.
So pages with page protections changes must live in some other
area of the kernel address space just like vmalloc() to get
the different protection bits.

I really would like sun4m to use big pages for the PAGE_OFFSET
mappings when possible Peter.  So I even don't think fixing Sparc
the way I know you are likely to is wise.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-03 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03  6:38 virt_to_page(pci_alloc_consistent()) Pete Zaitcev
2002-10-03  8:03 ` virt_to_page(pci_alloc_consistent()) David S. Miller
2002-10-03 16:25   ` virt_to_page(pci_alloc_consistent()) Pete Zaitcev
2002-10-03 17:11     ` virt_to_page(pci_alloc_consistent()) David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).