Re: copyin()/copyout() constraints ?

From: Luigi Rizzo <rizzo_at_iet.unipi.it>
Date: Fri, 14 Jun 2013 18:38:12 +0200
On Fri, Jun 14, 2013 at 12:07:29PM -0400, John Baldwin wrote:
> On Wednesday, June 12, 2013 2:36:52 pm Alfred Perlstein wrote:
> > On 6/12/13 11:01 AM, Luigi Rizzo wrote:
> > > hi,
> > > is it possible to run copyin() or copyout() in one of these cases:
> > > 1. while holding a spinlock
> > > 2. while holding a regular mutex/lock
> > > 3. while holding a read lock (on an RWLOCK or RMLOCK)
> > > 4. while holding a write lock (on an RWLOCK or RMLOCK)
> > >
> > > I suspect #1 is forbidden, but am a bit unclear for the
> > > other cases.
> > No on all of the above unless the memory is wired.

ok i suppose i'll move to an sx lock, which i have been told
allows me to sleep ?

My use case is that while i run the copyin(), and possibly take a
page fault, nobody destroys the destination buffer.  So i wanted
to hold a read lock (sx_slock() ?) in the thread doing the copy
(there may be several writers to different parts of the destination),
and a write lock (sx_xlock() ?) for the other thread which may
destroy the buffer.

	cheers
	luigi
Received on Fri Jun 14 2013 - 14:35:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:38 UTC