public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [never mind] kiobufs and highmem
@ 2002-07-19 15:00 William D Waddington
  2002-07-19 15:32 ` Benjamin LaHaise
  2002-07-19 22:39 ` Ingo Oeser
  0 siblings, 2 replies; 4+ messages in thread
From: William D Waddington @ 2002-07-19 15:00 UTC (permalink / raw)
  To: linux-kernel

>Hello All,
>
>I have a 2.4.x char driver which works fine, except in boxes with lots of
>memory.
>
>user_buffer -> write() -> map_user_kiobuf() -> pci_map_sg() -> Pci DMA
>
>I'm using the .page/.offset version of the scatterlist, but in the HIGHMEM case,
>map_user_kiobuf() seems to return peculiar page addresses.
>
>What is the state of kiobufs/HIGHMEM in 2.4.x?  Do I need to implement
>a bounce buffer in the driver?  Some email correspondence indicates so,
>but I would be grateful for a definitive word from the kernel folks.
>

I finally googled up a couple of threads that shed some light ...
Seems that page_address() will return 0 when used on a high mem entry
in the kiobuf maplist.

Looks like three (?) options: go back to copying to a kernel DMA
buffer for all cases (swell for performance), split the code path into
map_user and copy_user branches (not that fond of spaghetti),
or - in the highmem case - copy to a local buffer and populate the
kiobuf with those pages and feed that to pci_map_sg().

The last is my preference, as it keeps the code cleaner, and since
my hardware is scatter-gather, I can either build the local buffer out
of discrete pages (at load time) or allocate a (possibly) non-
contiguous kernel buffer.  I would prefer to not use kmalloc if
possible, since I don't really need contiguous pages, and would
like to keep the chances of allocation success as high as possible.

I haven't yet figured out how to allocate a (possibly) non-contiguous
buffer, since vmalloc is frowned on, or how to populate the kiobuf
with its pages.

Any advice gratefully accepted,
Bill

---------------------------------------
William D Waddington
Bainbridge Island, WA, USA
csbwaddington@att.net
waddington@tahomatech.com
william.waddington@beezmo.com
---------------------------------------


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

end of thread, other threads:[~2002-07-23 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-19 15:00 [never mind] kiobufs and highmem William D Waddington
2002-07-19 15:32 ` Benjamin LaHaise
2002-07-19 22:39 ` Ingo Oeser
2002-07-23 11:17   ` Gerd Knorr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox