Subject: Re: Pipes 1.1, bugfix available
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 04/10/2001 14:21:56
>> Perhaps it would be interesting to try uvm_io versus copying through
>> a kernel buffer [...].
> I hate to burst your bubble, but uvm_io() copies through a kernel
> buffer :-)

Oh. :-)

> It temporarily maps the user destination pages into kernel space and
> does the I/O to them.

Well, yeah, that's more or less what it has to do.

However, there's no conceptual reason why we couldn't map the "other"
vmspace's pages into kernel space temporarily and then copy directly
between "our" memory and "the other" memory, even if uvm_io can't be
made to do that as it stands.

Actually, on reading uvm_io, I think it could be used semi-directly.
There are two uios involved, one in the current vmspace and one in a
"foreign" vmspace.  You just need to walk the "foreign" one yourself:

	save the uio_resid and uio_offset values from the "native" uio
	for each iov in the "foreign" uio
		set the "native" uio's resid and offset
		call uvm_io
		error-check
		update the saved resid/offset
	load (updated) saved values back into the "native" uio

The actual data move would then be directly from user pages to user
pages (by copyin/copyout inside uiomove inside uvm_io), which is what I
was trying for.

On the other hand, on reading uvm_io, it's not clear to me whether it's
willing to fault in currently nonresident pages, which of course is
potentially necessary.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B