lkml.org 
[lkml]   [2008]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kmap_atomic_pfn for PCI BAR access?
Dave Airlie wrote:
> On Thu, Jun 26, 2008 at 11:18 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>> Keith Packard wrote:
>>
>>> The graphics memory BAR is generally fairly good sized; on Intel chips,
>>> it's between 256M and 1G (and growing). I want to write data into this
>>> region from kernel space, but it's really too big to map the whole thing
>>> into kernel address space, especially on 32-bit systems. ioremap is not
>>> a good option here -- it's way too slow.
>>>
>>> With CONFIG_HIGHMEM enabled, I can use kmap_atomic_pfn (well, actually
>>> the kmap_atomic_proc_pfn included in the DRM tree) and things work quite
>>> well -- performance is good, with barely any measurable time spent in
>>> the PTE whacking (~1%).
>>>
>>> However, with CONFIG_HIGHMEM disabled, there aren't any PTEs reserved
>>> for this kind of mapping fun. This makes me suspect that abusing
>>> kmap_atomic for this operation would not be appreciated.
>>> Should I use kmap_atomic_pfn to reach my PCI BAR like this?
>>>
>>> Would it be reasonable to supply a patch that made this work even
>>> without CONFIG_HIGHMEM?
>>>
>>>
>> Usually people use ioremap to map device memory. Wouldn't that work in this
>> case?
>>
>>
>
> "but it's really too big to map the whole thing
> into kernel address space, especially on 32-bit systems. ioremap is not
> a good option here -- it's way too slow."
>
> From the original mail.
>

Uh, yep.

> doing tlb flush for iounmap is slow as all hell if you do it a lot,
> and we can't afford to mmap the whole aperture it can 1GB.
>

Maybe Nick's vmap reimplementation would help here. It effectively
allows you to map stuff into the vmalloc space, and do lazy tlb flushes
to mitigate the cost of map/unmap. He posted the patches week or so ago.

J


\
 
 \ /
  Last update: 2008-06-26 05:13    [from the cache]
©2003-2011 Jasper Spaans