Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jul 1997 19:27:30 -0700 (PDT)
From:      Vinay Bannai <vinay@agni.nuko.com>
To:        dg@root.com
Cc:        terry@lambert.org, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Location of copyin() and copyout()..
Message-ID:  <199707300227.TAA05696@agni.nuko.com>
In-Reply-To: <199707300146.SAA11272@implode.root.com> from "David Greenman" at "Jul 29, 97 06:46:08 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
According to David Greenman:
> >> It is generally considered _extremely_ bad to use copyin/copyout, as it
> >> precludes your functions from being called from within kernel space.
> >> 
> >> FWIW, this is what eventually stumped me when it came to getting Linux
> >> WABI running on FreeBSD.
> >
> >This is a good point, considering that kernel preemption is one
> >of my own goals.
> >
> >The issue is recursion with a paging operation in progress.
> >
> >I think with the limited cases I gave (the page is filled, the
> >call made, and the page is still mapped) are OK.
> >
> >copying out is more likely to cause problems than copying in,
> >since you copy in pages after they are touched, but you potentially
> >touch on copyout.
> >
> >Probably there needs to be _copyin/_copyout for the internal usage,
> >and a "safe" copyin/copyout for usage which isn't safed against
> >reentrancy.
> 
>    There is no problem with using copyout() in the kernel to copy data out to
> a user process, assuming that the currently running process is the intended
> target of the copy. That is the sole purpose of the function. copyout()
> correctly handles all issues of COW/ZF/page faults.
>    uiomove() is escentially a wrapper for copyin/copyout that has an
> optimization for the case of kernel-to-kernel copies (in which case it
> uses bcopy instead).
> 
> -DG

So in a situation where I pin the user pages down (for DMA), it is okay to
use copyin()/copyout().

In the meantime, I am having a little trouble with the code that is
running on the i960 board. It is essentially probed/attached/mmapped from
the host side. It mostly pertains to style and structure on the code that
is running on the i960 board. The card offers a broad functionality
(depending on the code running on the board). How do I offer these
services thru the device driver end on the host side? For instance I can't
seem to map the functiions provided by the i960 processor onto the
ioctl(). I am ignoring the I2O model for the time being. I want to be able
to get the initial prototype atleast working before I touch the I20
specs... 

Suggestions and words of wisdom gladly accepted...

Vinay
-- 
Vinay Bannai                     E-mail: vinay@agni.nuko.com
(408)-526-0280 x 275 (Work)     http://agni.nuko.com/~vinay




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707300227.TAA05696>