destroy_dev_drain stuck (devscd) after kldload, ls -l cloned device, kldunload (trying to fix kqemu...)

From: Juergen Lock <nox_at_jelal.kn-bremen.de>
Date: Fri, 18 Apr 2008 21:51:50 +0200
Using this... after what has been done to /sys/netsmb/smb_dev.c:

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/kqemu-kmod/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- Makefile	26 Jul 2007 21:46:30 -0000	1.21
+++ Makefile	18 Apr 2008 18:58:29 -0000
_at__at_ -7,7 +7,7 _at__at_
 
 PORTNAME=	kqemu
 PORTVERSION=	1.3.0.p11
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	emulators kld
 MASTER_SITES=	http://fabrice.bellard.free.fr/qemu/ \
 		http://qemu.org/ \
_at__at_ -57,17 +57,6 _at__at_ IGNORE=		kqemu requires kernel source to
 CFLAGS+=	-DKSE
 .endif
 
-# XXX the following is wrong if you run a custom SMP kernel on a
-# singleprocessor machine (but it probably doesn't really matter)
-KERNCONF!=	${UNAME} -v | ${SED} 's-.*/--' | ${TR} -d ' '
-NCPU!=		${SYSCTL} -n hw.ncpu 2>/dev/null
-# we know 7.x GENERIC has SMP
-.if ${KERNCONF} == "GENERIC" && ${OSVERSION} >= 700000
-CFLAGS+=	-DSMP
-.elif ${NCPU} > 1
-CFLAGS+=	-DSMP
-.endif
-
 post-extract:
 .if ${OSVERSION} >= 700024 && !defined(NOKSE)
 	_at_${ECHO_MSG} "Compiling with -DKSE."
Index: files/patch-kqemu-freebsd.c
===================================================================
RCS file: /home/pcvs/ports/emulators/kqemu-kmod/files/patch-kqemu-freebsd.c,v
retrieving revision 1.6
diff -u -p -r1.6 patch-kqemu-freebsd.c
--- files/patch-kqemu-freebsd.c	21 Jul 2007 19:38:16 -0000	1.6
+++ files/patch-kqemu-freebsd.c	18 Apr 2008 18:37:00 -0000
_at__at_ -17,13 +17,30 _at__at_ Index: kqemu-freebsd.c
      return SIGPENDING(curthread);
  }
  #endif
-_at__at_ -320,6 +328,9 _at__at_
+_at__at_ -320,8 +320,15 _at__at_
  #if __FreeBSD_version >= 500000
      dev->si_drv1 = NULL;
      TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent);
++#if __FreeBSD_version >= 700051
++    destroy_dev_sched(dev);
++#else
 +#if __FreeBSD_version >= 700024
 +    dev_relthread(dev); 
 +#endif
      destroy_dev(dev);
  #endif
++#endif
      free(ks, M_KQEMU);
+     --kqemu_ref_count;
+ }
+_at__at_ -500,6 +507,10 _at__at_
+ 	while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) {
+ 	    kqemu_destroy(ks);
+ 	}
++#if __FreeBSD_version >= 700051
++	drain_dev_clone_events();
++	/* destroy_dev_drain(&kqemu_cdevsw); */
++#endif
+ 	clone_cleanup(&kqemuclones);
+ #endif
+         kqemu_global_delete(kqemu_gs);

 (and uncommenting the destroy_dev_drain call) I get a hang when I do:
	kldload kqemu
	ls -l /dev/kqemu
	kldunload kqemu

 Am I doing something wrong or is the bug elsewhere?

 Oh and does anyone still see qemu hanging using the commented version?
(Only you shouldn't kldunload too quickly after running qemu I guess... :)

 Thanx,
	Juergen
Received on Fri Apr 18 2008 - 18:12:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:30 UTC