Subject: Re: port-xen/29775: Cannot use a vnode disk for domU
To: None <port-xen-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 03/23/2005 21:13:02
The following reply was made to PR port-xen/29775; it has been noted by GNATS.

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: tech-kern@NetBSD.org
Cc: port-xen-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org, gnats-bugs@NetBSD.org
Subject: Re: port-xen/29775: Cannot use a vnode disk for domU
Date: Wed, 23 Mar 2005 22:12:45 +0100

 [ moving to tech-kern ]
 
 On Wed, Mar 23, 2005 at 05:42:00PM +0000, juan@xtraeme.nopcode.org wrote:
 > >Description:
 > 	With -current Xen sources, I want to create a domU using
 > 	a vnode disk in a file:
 > 
 > 	$ dd if=/dev/zero of=mydisk.img bs=1k seek=20480k count=1
 > 	$ vnconfig vnd0 mydisk.img
 > 	
 > 	$ grep vnd0 /etc/xen/netbsd
 > 	disk = [ 'phy:/dev/cd0a,cd0a,r', 'phy:/dev/vnd0a,wd0d,w' ]
 > 	$
 > 
 > 	The system will crash.
 
 With:
 panic: lockmgr: no context
 It is in vndstrategy:
 		vn_lock(vnd->sc_vp, LK_EXCLUSIVE | LK_RETRY | LK_CANRECURSE);
 
 This means that I/O on the vnd block device expect to be called from
 a process context, while the xbd backend calls it from interrupt context.
 And obvious way to fix this would be to add a kernel thread to the xbd backend
 to do this. But maybe this needs a closer look:
 - Can we safely say that vnd will always be called from process context ?
   What if we stack something else on vnd (fss or cgd for example) ?
 - Always taking a kernel thread in the xbd backend means an extra context
   switch, which we may want to avoid if possible. Is there a way to know if
   the underlying device can handle interrupt context or not ?
 
 -- 
 Manuel Bouyer <bouyer@antioche.eu.org>
      NetBSD: 26 ans d'experience feront toujours la difference
 --