lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Jun 2008 21:36:03 -0700
From:	Arjan van de Ven <arjan@...radead.org>
To:	"Dave Airlie" <airlied@...il.com>
Cc:	"Jeremy Fitzhardinge" <jeremy@...p.org>,
	"Keith Packard" <keithp@...thp.com>,
	"Dave Airlie" <airlied@...ux.ie>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: kmap_atomic_pfn for PCI BAR access?

On Thu, 26 Jun 2008 11:23:11 +1000
"Dave Airlie" <airlied@...il.com> wrote:

> On Thu, Jun 26, 2008 at 11:18 AM, Jeremy Fitzhardinge
> <jeremy@...p.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.
> 
> 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.

well kmap does a tlb flush as well... you can't get away from doing a
flush if you change cpu mapping.
What you CAN do is play tricks and flush only once in a while and make
sure you don't recycle mappings in the mean time (like kmap does).

I can totally see doing an iounmap_lazy() and then have an
iounmap_flush_lazy() thing or something like that....


-- 
If you want to reach me at my work email, use arjan@...ux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists