From owner-freebsd-emulation@FreeBSD.ORG Sat Apr 19 15:26:36 2008 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4064D106564A; Sat, 19 Apr 2008 15:26:36 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.freebsd.org (Postfix) with ESMTP id B7E938FC14; Sat, 19 Apr 2008 15:26:35 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: by gwyn.kn-bremen.de (Postfix, from userid 10) id 8B7582C06D3; Sat, 19 Apr 2008 17:26:34 +0200 (CEST) Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id m3JF7np9043355; Sat, 19 Apr 2008 17:07:49 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id m3JF7nZH043354; Sat, 19 Apr 2008 17:07:49 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Sat, 19 Apr 2008 17:07:49 +0200 To: Kostik Belousov Message-ID: <20080419150749.GA43335@saturn.kn-bremen.de> Mail-Followup-To: Kostik Belousov , freebsd-emulation@FreeBSD.org, freebsd-current@FreeBSD.org References: <20080418195150.GA18338@saturn.kn-bremen.de> <20080419035736.GD18958@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080419035736.GD18958@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-emulation@FreeBSD.org, freebsd-current@FreeBSD.org Subject: Re: destroy_dev_drain stuck (devscd) after kldload, ls -l cloned device, kldunload (trying to fix kqemu...) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Apr 2008 15:26:36 -0000 On Sat, Apr 19, 2008 at 06:57:36AM +0300, Kostik Belousov wrote: > On Fri, Apr 18, 2008 at 09:51:50PM +0200, Juergen Lock wrote: > > 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 > > @@ -7,7 +7,7 @@ > > > > 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/ \ > > @@ -57,17 +57,6 @@ 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) > > @${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 > > @@ -17,13 +17,30 @@ Index: kqemu-freebsd.c > > return SIGPENDING(curthread); > > } > > #endif > > -@@ -320,6 +328,9 @@ > > +@@ -320,8 +320,15 @@ > > #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; > > + } > > +@@ -500,6 +507,10 @@ > > + 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); > > The destroy_dev_drain() function waits for the cdevs having the > kqemu_cdevsw cdevsw to be destroyed. I did not looked into the actual > kqemu sources, but assumed that kqemuclones have kqemu_cdevsw as > cdevsw. If this is the case, you shall call clone_cleanup() before > destroy_dev_drain(). Ah, that seems to work indeed. Thanx! Juergen