Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Nov 2006 20:27:31 +0900
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Cc:        Jeremie Le Hen <jeremie@le-hen.org>, freebsd-current@freebsd.org, "Devon H. O'Dell" <devon.odell@gmail.com>, Andriy Gapon <avg@icyb.net.ua>
Subject:   Re: no kld in minidumps
Message-ID:  <20061106112731.GA78511@cdnetworks.co.kr>
In-Reply-To: <20061105025754.M20747@atlantis.atlantis.dp.ua>
References:  <1155864187.00584864.1155853201@10.7.7.3> <1155882183.00584920.1155870001@10.7.7.3> <44E5C008.9010008@icyb.net.ua> <20060818204915.S42981@atlantis.atlantis.dp.ua> <44E5FFF3.9040908@icyb.net.ua> <20061105025754.M20747@atlantis.atlantis.dp.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Nov 05, 2006 at 03:43:25AM +0200, Dmitry Pryanishnikov wrote:
 > 
 > Hello!
 > 
 >   Well, maybe it's a little late to reply now, but anyway...
 > 
 > On Fri, 18 Aug 2006, Andriy Gapon wrote:
 > >on 18/08/2006 20:50 Dmitry Pryanishnikov said the following:
 > >>>BTW, has anyone contemplated or even done this - some sort of a script
 > >>>to automatically add all modules that were loaded at a time of crash ?
 > >>
 > >>  Hmm, isn't this the task for asf(8). If not, what is asf(8) for?
 > >
 > >This is a very nice command, thank you!
 > >But it does not seem to be directly applicable to postmortem situation
 > >i.e. crash dump debugging.
 > 
 >   Actually asf(8) _can_ be useful during crash dump analysis in the limited
 > yet quite common case when currently loaded kernel and modules are the same 
 > as they were during the crash. E.g. I've booted to singleuser mode with
 > fdc.ko loaded as a module, established crash dump device and then crashed 
 > the system with 'kldunload fdc.ko' (see kern/104079). After reboot I've got
 > a core dump which can't be analyzed corectly w/o symbols from fdc.ko:
 > 

Hmm, it seems that I fixed the bug in sparc64 fdc(4) support code.
Try attached patch.
I'm not familiar with geom(4) so it needs review from geom guru so
I've CCed to pjd@.

 > root@homelynx# asf -kf /boot/kernel my.asf
 > root@homelynx# kgdb /boot/kernel/kernel.debug vmcore.7
 > ...
 > (here 'bt' doesn't show frames which belong to fdc.ko and above)
 > ...
 > (kgdb) source my.asf
 > 
 > Now 'bt' correctly shows all frames.
 > 
-- 
Regards,
Pyun YongHyeon

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fdc.patch"

Index: fdc.c
===================================================================
RCS file: /pool/ncvs/src/sys/dev/fdc/fdc.c,v
retrieving revision 1.313
diff -u -r1.313 fdc.c
--- fdc.c	8 Sep 2006 21:46:00 -0000	1.313
+++ fdc.c	6 Nov 2006 11:26:40 -0000
@@ -426,7 +426,7 @@
 		step += step;
 		DELAY(step);
 	}
-	return (fdc_err(fdc, bootverbose? "input ready timeout\n": 0));
+	return (fdc_err(fdc, bootverbose? "input ready timeout\n": NULL));
 }
 
 static int
@@ -446,7 +446,7 @@
 		step += step;
 		DELAY(step);
 	}
-	return (fdc_err(fdc, bootverbose? "output ready timeout\n": 0));
+	return (fdc_err(fdc, bootverbose? "output ready timeout\n": NULL));
 }
 
 /*
@@ -470,7 +470,7 @@
 		i = va_arg(ap, int);
 		if (n == 0)
 			cmd = i;
-		if (fdc_out(fdc, i) < 0) {
+		if (fdc_out(fdc, i)) {
 			char msg[50];
 			snprintf(msg, sizeof(msg),
 				"cmd %x failed at out byte %d of %d\n",
@@ -483,7 +483,7 @@
 	n_in = va_arg(ap, int);
 	for (n = 0; n < n_in; n++) {
 		int *ptr = va_arg(ap, int *);
-		if (fdc_in(fdc, ptr) < 0) {
+		if (fdc_in(fdc, ptr)) {
 			char msg[50];
 			snprintf(msg, sizeof(msg),
 				"cmd %02x failed at in byte %d of %d\n",
@@ -577,7 +577,7 @@
 		return (FD_NOT_VALID);
 	}
 
-	if (fdc_in(fdc, &cyl) < 0)
+	if (fdc_in(fdc, &cyl))
 		return fdc_err(fdc, "can't get cyl num\n");
 
 	if (cylp)
@@ -1014,7 +1014,7 @@
 			fdc_pio(fdc);
 	}
 
-	switch(bp->bio_cmd) {
+	switch (bp->bio_cmd) {
 	case BIO_FMT:
 		/* formatting */
 		finfo = (struct fd_formb *)bp->bio_data;
@@ -1142,7 +1142,7 @@
 		return (1);
 	}
 	/* All OK */
-	switch(bp->bio_cmd) {
+	switch (bp->bio_cmd) {
 	case BIO_RDID:
 		/* copy out ID field contents */
 		idp = (struct fdc_readid *)bp->bio_data;
@@ -1537,9 +1537,7 @@
 		break;
 	}
 	return (error);
-};
-
-
+}
 
 /*
  * Configuration/initialization stuff, per controller.
@@ -1998,16 +1996,24 @@
 fd_detach(device_t dev)
 {
 	struct	fd_data *fd;
+	struct	g_provider *gp;
+	int	error;
 
+	error = 0;
 	fd = device_get_softc(dev);
+	DROP_GIANT();
 	g_topology_lock();
-	g_wither_geom(fd->fd_geom, ENXIO);
+	gp = fd->fd_provider;
+	KASSERT(gp != NULL, ("NULL provider"));
+	if (gp->acr > 0 || gp->acw > 0 || gp->ace > 0)
+		error = EBUSY;
+	if (error == 0)
+		g_wither_geom(fd->fd_geom, ENXIO);
 	g_topology_unlock();
-	while (device_get_state(dev) == DS_BUSY)
-		tsleep(fd, PZERO, "fdd", hz/10);
 	callout_drain(&fd->toffhandle);
+	PICKUP_GIANT();
 
-	return (0);
+	return (error);
 }
 
 static device_method_t fd_methods[] = {
@@ -2031,8 +2037,7 @@
 fdc_modevent(module_t mod, int type, void *data)
 {
 
-	g_modevent(NULL, type, &g_fd_class);
-	return (0);
+	return (g_modevent(NULL, type, &g_fd_class));
 }
 
 DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, fdc_modevent, 0);

--PNTmBPCT7hxwcZjr--



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