Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2006 17:21:45 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 92272 for review
Message-ID:  <200602231721.k1NHLjT5010176@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92272

Change 92272 by marcel@marcel_nfs on 2006/02/23 17:21:00

	IFC @92269

Affected files ...

.. //depot/projects/uart/alpha/alpha/machdep.c#17 integrate
.. //depot/projects/uart/alpha/alpha/trap.c#9 integrate
.. //depot/projects/uart/arm/arm/machdep.c#8 integrate
.. //depot/projects/uart/arm/arm/undefined.c#9 integrate
.. //depot/projects/uart/dev/ar/if_ar.c#8 integrate
.. //depot/projects/uart/dev/mse/mse.c#4 integrate
.. //depot/projects/uart/dev/pcf/envctrl.c#3 integrate
.. //depot/projects/uart/dev/pcf/pcf_ebus.c#3 integrate
.. //depot/projects/uart/dev/pcf/pcf_isa.c#3 integrate
.. //depot/projects/uart/dev/ppbus/if_plip.c#7 integrate
.. //depot/projects/uart/dev/ppbus/lpt.c#7 integrate
.. //depot/projects/uart/dev/ppbus/ppi.c#5 integrate
.. //depot/projects/uart/dev/ppc/ppc.c#7 integrate
.. //depot/projects/uart/dev/sio/sio.c#15 integrate
.. //depot/projects/uart/dev/sr/if_sr.c#8 integrate
.. //depot/projects/uart/dev/uart/uart_core.c#42 integrate
.. //depot/projects/uart/fs/pseudofs/pseudofs_vnops.c#12 integrate
.. //depot/projects/uart/i386/include/mptable.h#3 integrate
.. //depot/projects/uart/i386/linux/linux_ptrace.c#5 integrate
.. //depot/projects/uart/ia64/ia64/machdep.c#25 integrate
.. //depot/projects/uart/kern/kern_condvar.c#6 integrate
.. //depot/projects/uart/kern/kern_exit.c#12 integrate
.. //depot/projects/uart/kern/kern_kse.c#11 integrate
.. //depot/projects/uart/kern/kern_sig.c#24 integrate
.. //depot/projects/uart/kern/kern_synch.c#14 integrate
.. //depot/projects/uart/kern/subr_sleepqueue.c#9 integrate
.. //depot/projects/uart/kern/sys_process.c#14 integrate
.. //depot/projects/uart/kern/vfs_subr.c#21 integrate
.. //depot/projects/uart/kern/vfs_syscalls.c#20 integrate
.. //depot/projects/uart/modules/Makefile#25 integrate
.. //depot/projects/uart/pc98/cbus/fdc.c#3 integrate
.. //depot/projects/uart/pc98/cbus/pckbd.c#2 integrate
.. //depot/projects/uart/pc98/cbus/ppc.c#3 integrate
.. //depot/projects/uart/pc98/cbus/sio.c#4 integrate
.. //depot/projects/uart/sys/proc.h#19 integrate

Differences ...

==== //depot/projects/uart/alpha/alpha/machdep.c#17 (text+ko) ====

@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.237 2006/02/14 14:50:10 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.238 2006/02/22 18:57:48 jhb Exp $");
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
@@ -1756,6 +1756,8 @@
 {
 	struct iovec iov;
 	struct uio uio;
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
@@ -1773,6 +1775,8 @@
 {
 	struct iovec iov;
 	struct uio uio;
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) &v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
@@ -1836,6 +1840,8 @@
 static int
 ptrace_clear_bpt(struct thread *td, struct mdbpt *bpt)
 {
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	return ptrace_write_int(td, bpt->addr, bpt->contents);
 }
 
@@ -1844,6 +1850,8 @@
 {
 	int error;
 	u_int32_t bpins = 0x00000080;
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	error = ptrace_read_int(td, bpt->addr, &bpt->contents);
 	if (error)
 		return error;
@@ -1853,12 +1861,20 @@
 int
 ptrace_clear_single_step(struct thread *td)
 {
+	struct proc *p;
+
+	p = td->td_proc;
+	PROC_LOCK_ASSERT(p, MA_OWNED);
 	if (td->td_md.md_flags & MDTD_STEP2) {
+		PROC_UNLOCK(p);
 		ptrace_clear_bpt(td, &td->td_md.md_sstep[1]);
 		ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
+		PROC_LOCK(p);
 		td->td_md.md_flags &= ~MDTD_STEP2;
 	} else if (td->td_md.md_flags & MDTD_STEP1) {
+		PROC_UNLOCK(p);
 		ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
+		PROC_LOCK(p);
 		td->td_md.md_flags &= ~MDTD_STEP1;
 	}
 	return 0;
@@ -1867,6 +1883,7 @@
 int
 ptrace_single_step(struct thread *td)
 {
+	struct proc *p;
 	int error;
 	vm_offset_t pc = td->td_frame->tf_regs[FRAME_PC];
 	alpha_instruction ins;
@@ -1876,9 +1893,11 @@
 	if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2))
 		panic("ptrace_single_step: step breakpoints not removed");
 
+	p = td->td_proc;
+	PROC_UNLOCK(p);
 	error = ptrace_read_int(td, pc, &ins.bits);
 	if (error)
-		return (error);
+		goto out;
 
 	switch (ins.branch_format.opcode) {
 
@@ -1918,18 +1937,20 @@
 	td->td_md.md_sstep[0].addr = addr[0];
 	error = ptrace_set_bpt(td, &td->td_md.md_sstep[0]);
 	if (error)
-		return (error);
+		goto out;
 	if (count == 2) {
 		td->td_md.md_sstep[1].addr = addr[1];
 		error = ptrace_set_bpt(td, &td->td_md.md_sstep[1]);
 		if (error) {
 			ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
-			return (error);
+			goto out;
 		}
 		td->td_md.md_flags |= MDTD_STEP2;
 	} else
 		td->td_md.md_flags |= MDTD_STEP1;
 
+out:
+	PROC_LOCK(p);
 	return (error);
 }
 

==== //depot/projects/uart/alpha/alpha/trap.c#9 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/trap.c,v 1.128 2006/02/08 08:09:14 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/trap.c,v 1.129 2006/02/22 18:57:49 jhb Exp $");
 
 /* #include "opt_fix_unaligned_vax_fp.h" */
 #include "opt_ddb.h"
@@ -403,8 +403,12 @@
 		case ALPHA_IF_CODE_BUGCHK:
 			if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) {
 				mtx_lock(&Giant);
+				PROC_LOCK(p);
+				_PHOLD(p);
 				ptrace_clear_single_step(td);
 				td->td_frame->tf_regs[FRAME_PC] -= 4;
+				_PRELE(p);
+				PROC_UNLOCK(p);
 				mtx_unlock(&Giant);
 			}
 			ucode = a0;		/* trap type */

==== //depot/projects/uart/arm/arm/machdep.c#8 (text+ko) ====

@@ -44,7 +44,7 @@
 
 #include "opt_compat.h"
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.20 2005/11/24 08:16:17 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.21 2006/02/22 18:57:49 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -327,6 +327,8 @@
 {
 	struct iovec iov;
 	struct uio uio;
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
@@ -344,6 +346,8 @@
 {
 	struct iovec iov;
 	struct uio uio;
+
+	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) &v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
@@ -359,28 +363,38 @@
 int
 ptrace_single_step(struct thread *td)
 {
+	struct proc *p;
 	int error;
 	
 	KASSERT(td->td_md.md_ptrace_instr == 0,
 	 ("Didn't clear single step"));
+	p = td->td_proc;
+	PROC_UNLOCK(p);
 	error = ptrace_read_int(td, td->td_frame->tf_pc + 4, 
 	    &td->td_md.md_ptrace_instr);
 	if (error)
-		return (error);
+		goto out;
 	error = ptrace_write_int(td, td->td_frame->tf_pc + 4,
 	    PTRACE_BREAKPOINT);
 	if (error)
 		td->td_md.md_ptrace_instr = 0;
 	td->td_md.md_ptrace_addr = td->td_frame->tf_pc + 4;
+out:
+	PROC_LOCK(p);
 	return (error);
 }
 
 int
 ptrace_clear_single_step(struct thread *td)
 {
+	struct proc *p;
+
 	if (td->td_md.md_ptrace_instr) {
+		p = td->td_proc;
+		PROC_UNLOCK(p);
 		ptrace_write_int(td, td->td_md.md_ptrace_addr,
 		    td->td_md.md_ptrace_instr);
+		PROC_LOCK(p);
 		td->td_md.md_ptrace_instr = 0;
 	}
 	return (0);

==== //depot/projects/uart/arm/arm/undefined.c#9 (text+ko) ====

@@ -48,7 +48,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/undefined.c,v 1.10 2006/02/03 06:27:51 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/undefined.c,v 1.11 2006/02/22 18:57:49 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -261,7 +261,11 @@
 		    break;
 
 	if (fault_code & FAULT_USER && fault_instruction == PTRACE_BREAKPOINT) {
+		PROC_LOCK(td->td_proc);
+		_PHOLD(td->td_proc);
 		ptrace_clear_single_step(td);
+		_PRELE(td->td_proc);
+		PROC_UNLOCK(td->td_proc);
 		return;
 	}
 

==== //depot/projects/uart/dev/ar/if_ar.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ar/if_ar.c,v 1.72 2005/08/09 10:19:42 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ar/if_ar.c,v 1.73 2006/02/22 18:16:24 jhb Exp $");
 
 /*
  * Programming assumptions and other issues.
@@ -258,7 +258,7 @@
 	
 	arc_init(hc);
 
-	if(BUS_SETUP_INTR(device_get_parent(device), device, hc->res_irq,
+	if(bus_setup_intr(device, hc->res_irq,
 	    INTR_TYPE_NET, arintr, hc, &hc->intr_cookie) != 0)
 		return (1);
 
@@ -285,7 +285,7 @@
 #ifndef	NETGRAPH
 		ifp = SC2IFP(sc) = if_alloc(IFT_PPP);
 		if (ifp == NULL) {
-			if (BUS_TEARDOWN_INTR(device_get_parent(device), device,
+			if (bus_teardown_intr(device,
 			    hc->res_irq, hc->intr_cookie) != 0) {
 				printf("intr teardown failed.. continuing\n");
 			}
@@ -351,11 +351,10 @@
 int
 ar_detach(device_t device)
 {
-	device_t parent = device_get_parent(device);
 	struct ar_hardc *hc = device_get_softc(device);
 
 	if (hc->intr_cookie != NULL) {
-		if (BUS_TEARDOWN_INTR(parent, device,
+		if (bus_teardown_intr(device,
 			hc->res_irq, hc->intr_cookie) != 0) {
 				printf("intr teardown failed.. continuing\n");
 		}

==== //depot/projects/uart/dev/mse/mse.c#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/mse/mse.c,v 1.72 2005/04/08 05:22:58 imp Exp $
+ * $FreeBSD: src/sys/dev/mse/mse.c,v 1.73 2006/02/22 18:16:25 jhb Exp $
  */
 
 /*
@@ -134,7 +134,7 @@
 		return ENXIO;
 	}
 
-	if (BUS_SETUP_INTR(device_get_parent(dev), dev, sc->sc_intr,
+	if (bus_setup_intr(dev, sc->sc_intr,
 	    INTR_TYPE_TTY, mseintr, sc, &sc->sc_ih)) {
 		bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
 		bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);

==== //depot/projects/uart/dev/pcf/envctrl.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pcf/envctrl.c,v 1.5 2005/06/04 20:29:28 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pcf/envctrl.c,v 1.6 2006/02/22 18:16:25 jhb Exp $");
 
 /*
  * Device specific driver for the SUNW,envctrl device found on some
@@ -133,7 +133,7 @@
 	/* reset the chip */
 	pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
 
-	rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
+	rv = bus_setup_intr(dev, sc->res_irq,
 			    INTR_TYPE_NET /* | INTR_ENTROPY */,
 			    pcf_intr, sc, &sc->intr_cookie);
 	if (rv) {
@@ -180,8 +180,7 @@
 		return (rv);
 
 	if (sc->res_irq != 0) {
-		BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
-				  sc->intr_cookie);
+		bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie);
 		bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
 		bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
 	}

==== //depot/projects/uart/dev/pcf/pcf_ebus.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_ebus.c,v 1.4 2005/06/04 20:29:28 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_ebus.c,v 1.5 2006/02/22 18:16:25 jhb Exp $");
 
 /*
  * Device specific driver for the EBus i2c devices found on some sun4u
@@ -193,7 +193,7 @@
 	pcf_rst_card(dev, IIC_FASTEST, own_addr, NULL);
 
 	if (sc->res_irq) {
-		rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
+		rv = bus_setup_intr(dev, sc->res_irq,
 		    INTR_TYPE_NET /* | INTR_ENTROPY */, pcf_intr, sc,
 		    &sc->intr_cookie);
 		if (rv) {
@@ -241,7 +241,7 @@
 		return (rv);
 
 	if (sc->res_irq != 0) {
-		BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
+		bus_teardown_intr(dev, sc->res_irq,
 		    sc->intr_cookie);
 		bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
 		    sc->res_irq);

==== //depot/projects/uart/dev/pcf/pcf_isa.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_isa.c,v 1.6 2006/02/02 23:57:31 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_isa.c,v 1.7 2006/02/22 18:16:25 jhb Exp $");
 
 /*
  * Hardware driver for a Philips PCF8584 I2C bus controller sitting
@@ -153,7 +153,7 @@
 	pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL);
 
 	if (sc->res_irq) {
-		rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq,
+		rv = bus_setup_intr(dev, sc->res_irq,
 				    INTR_TYPE_NET /* | INTR_ENTROPY */,
 				    pcf_intr, sc, &sc->intr_cookie);
 		if (rv) {
@@ -201,8 +201,7 @@
 		return (rv);
 
 	if (sc->res_irq != 0) {
-		BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
-				  sc->intr_cookie);
+		bus_teardown_intr(dev, sc->res_irq, sc->intr_cookie);
 		bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
 		bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq, sc->res_irq);
 	}

==== //depot/projects/uart/dev/ppbus/if_plip.c#7 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ppbus/if_plip.c,v 1.40 2006/02/13 17:53:39 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ppbus/if_plip.c,v 1.41 2006/02/22 18:16:25 jhb Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -357,7 +357,7 @@
 	    }
 
 	    /* attach our interrupt handler, later detached when the bus is released */
-	    if ((error = BUS_SETUP_INTR(ppbus, dev, sc->res_irq,
+	    if ((error = bus_setup_intr(dev, sc->res_irq,
 					INTR_TYPE_NET, lp_intr, dev, &ih))) {
 		ppb_release_bus(ppbus, dev);
 		return (error);

==== //depot/projects/uart/dev/ppbus/lpt.c#7 (text+ko) ====

@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ppbus/lpt.c,v 1.37 2005/12/21 10:54:46 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ppbus/lpt.c,v 1.38 2006/02/22 18:16:25 jhb Exp $");
 
 /*
  * Device Driver for AT parallel printer port
@@ -342,7 +342,7 @@
 
 	device_t dev;
 
-	dev = device_find_child(parent, LPT_NAME, 0);
+	dev = device_find_child(parent, LPT_NAME, -1);
 	if (!dev)
 		BUS_ADD_CHILD(parent, 0, LPT_NAME, -1);
 }
@@ -744,7 +744,7 @@
 	/* if interrupts are working, register the handler */
 	if (sc->sc_irq & LP_USE_IRQ) {
 		/* register our interrupt handler */
-		err = BUS_SETUP_INTR(ppbus, lptdev, sc->intr_resource,
+		err = bus_setup_intr(lptdev, sc->intr_resource,
 			       INTR_TYPE_TTY, lpt_intr, lptdev,
 			       &sc->intr_cookie);
 		if (err) {

==== //depot/projects/uart/dev/ppbus/ppi.c#5 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ppbus/ppi.c,v 1.39 2005/12/21 10:54:46 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ppbus/ppi.c,v 1.40 2006/02/22 18:16:25 jhb Exp $");
 #include "opt_ppb_1284.h"
 
 #include <sys/param.h>
@@ -135,7 +135,7 @@
 
 	device_t dev;
 
-	dev = device_find_child(parent, "ppi", 0);
+	dev = device_find_child(parent, "ppi", -1);
 	if (!dev)
 		BUS_ADD_CHILD(parent, 0, "ppi", -1);
 }
@@ -276,7 +276,7 @@
 #ifdef PERIPH_1284
 		if (ppi->intr_resource) {
 			/* register our interrupt handler */
-			BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
+			bus_setup_intr(ppidev, ppi->intr_resource,
 				       INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
 		}
 #endif /* PERIPH_1284 */

==== //depot/projects/uart/dev/ppc/ppc.c#7 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ppc/ppc.c,v 1.47 2005/12/21 10:54:47 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ppc/ppc.c,v 1.49 2006/02/22 21:47:04 jhb Exp $");
 
 #include "opt_ppc.h"
 
@@ -1969,7 +1969,6 @@
 	struct ppc_data *ppc = DEVTOSOFTC(dev);
 
 	device_t ppbus;
-	device_t parent = device_get_parent(dev);
 
 	device_printf(dev, "%s chipset (%s) in %s mode%s\n",
 		      ppc_models[ppc->ppc_model], ppc_avms[ppc->ppc_avm],
@@ -1997,8 +1996,8 @@
 	/* register the ppc interrupt handler as default */
 	if (ppc->res_irq) {
 		/* default to the tty mask for registration */	/* XXX */
-		if (BUS_SETUP_INTR(parent, dev, ppc->res_irq, INTR_TYPE_TTY,
-					    ppcintr, dev, &ppc->intr_cookie) == 0) {
+		if (bus_setup_intr(dev, ppc->res_irq, INTR_TYPE_TTY,
+		    ppcintr, dev, &ppc->intr_cookie) == 0) {
 
 			/* remember the ppcintr is registered */
 			ppc->ppc_registered = 1;

==== //depot/projects/uart/dev/sio/sio.c#15 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sio/sio.c,v 1.463 2005/12/07 07:23:53 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sio/sio.c,v 1.464 2006/02/22 18:16:25 jhb Exp $");
 
 #include "opt_comconsole.h"
 #include "opt_compat.h"
@@ -1074,11 +1074,11 @@
 	rid = 0;
 	com->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
 	if (com->irqres) {
-		ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres,
+		ret = bus_setup_intr(dev, com->irqres,
 				     INTR_TYPE_TTY | INTR_FAST,
 				     siointr, com, &com->cookie);
 		if (ret) {
-			ret = BUS_SETUP_INTR(device_get_parent(dev), dev,
+			ret = bus_setup_intr(dev,
 					     com->irqres, INTR_TYPE_TTY,
 					     siointr, com, &com->cookie);
 			if (ret == 0)

==== //depot/projects/uart/dev/sr/if_sr.c#8 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sr/if_sr.c,v 1.70 2005/08/09 10:19:54 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sr/if_sr.c,v 1.71 2006/02/22 18:16:26 jhb Exp $");
 
 /*
  * Programming assumptions and other issues.
@@ -389,7 +389,7 @@
 	src_init(hc);
 	sr_init_sca(hc);
 
-	if (BUS_SETUP_INTR(device_get_parent(device), device, hc->res_irq,
+	if (bus_setup_intr(device, hc->res_irq,
 	    INTR_TYPE_NET, srintr, hc, &hc->intr_cookie) != 0)
 		goto errexit;
 
@@ -462,11 +462,10 @@
 int
 sr_detach(device_t device)
 {
-	device_t parent = device_get_parent(device);
 	struct sr_hardc *hc = device_get_softc(device);
 
 	if (hc->intr_cookie != NULL) {
-		if (BUS_TEARDOWN_INTR(parent, device,
+		if (bus_teardown_intr(device,
 			hc->res_irq, hc->intr_cookie) != 0) {
 				printf("intr teardown failed.. continuing\n");
 		}

==== //depot/projects/uart/dev/uart/uart_core.c#42 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_core.c,v 1.14 2005/10/28 06:30:39 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_core.c,v 1.15 2006/02/22 18:16:26 jhb Exp $");
 
 #ifndef KLD_MODULE
 #include "opt_comconsole.h"
@@ -369,11 +369,11 @@
 	sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid,
 	    RF_ACTIVE | RF_SHAREABLE);
 	if (sc->sc_ires != NULL) {
-		error = BUS_SETUP_INTR(device_get_parent(dev), dev,
+		error = bus_setup_intr(dev,
 		    sc->sc_ires, INTR_TYPE_TTY | INTR_FAST, uart_intr,
 		    sc, &sc->sc_icookie);
 		if (error)
-			error = BUS_SETUP_INTR(device_get_parent(dev), dev,
+			error = bus_setup_intr(dev,
 			    sc->sc_ires, INTR_TYPE_TTY | INTR_MPSAFE,
 			    uart_intr, sc, &sc->sc_icookie);
 		else

==== //depot/projects/uart/fs/pseudofs/pseudofs_vnops.c#12 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/fs/pseudofs/pseudofs_vnops.c,v 1.58 2006/02/22 17:24:54 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/fs/pseudofs/pseudofs_vnops.c,v 1.59 2006/02/22 18:57:49 jhb Exp $");
 
 #include "opt_pseudofs.h"
 
@@ -99,6 +99,10 @@
 	if (pid != NO_PID) {
 		if ((proc = pfind(pid)) == NULL)
 			PFS_RETURN (0);
+		if (proc->p_flag & P_WEXIT) {
+			PROC_UNLOCK(proc);
+			PFS_RETURN (0);
+		}
 		if (p_cansee(td, proc) != 0 ||
 		    (pn->pn_vis != NULL && !(pn->pn_vis)(td, proc, pn))) {
 			PROC_UNLOCK(proc);
@@ -706,6 +710,10 @@
 	if (pvd->pvd_pid != NO_PID) {
 		if ((proc = pfind(pvd->pvd_pid)) == NULL)
 			PFS_RETURN (EIO);
+		if (proc->p_flag & P_WEXIT) {
+			PROC_UNLOCK(proc);
+			PFS_RETURN (EIO);
+		}
 		_PHOLD(proc);
 		PROC_UNLOCK(proc);
 	}

==== //depot/projects/uart/i386/include/mptable.h#3 (text+ko) ====

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/mptable.h,v 1.222 2005/01/06 22:18:15 imp Exp $
+ * $FreeBSD: src/sys/i386/include/mptable.h,v 1.223 2006/02/22 21:38:33 sam Exp $
  */
 
 #ifndef __MACHINE_MPTABLE_H__
@@ -139,7 +139,8 @@
 	char    name[16];
 }       basetable_entry;
 
+#ifdef _KERNEL
 int	mptable_pci_probe_table(int bus);
 int	mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin);
-
+#endif
 #endif /* !__MACHINE_MPTABLE_H__ */

==== //depot/projects/uart/i386/linux/linux_ptrace.c#5 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/linux/linux_ptrace.c,v 1.16 2005/07/02 20:06:44 delphij Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/linux/linux_ptrace.c,v 1.17 2006/02/22 18:57:49 jhb Exp $");
 
 #include "opt_cpu.h"
 
@@ -356,6 +356,12 @@
 			break;
 		}
 
+		/* Exiting processes can't be debugged. */
+		if ((p->p_flag & P_WEXIT) != 0) {
+			error = ESRCH;
+			goto fail;
+		}
+
 		if ((error = p_candebug(td, p)) != 0)
 			goto fail;
 

==== //depot/projects/uart/ia64/ia64/machdep.c#25 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.206 2006/02/14 14:50:10 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.207 2006/02/22 18:57:49 jhb Exp $");
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
@@ -1097,6 +1097,7 @@
 		r->rnat = (bspst > kstk && (bspst & 0x1ffL) < (kstk & 0x1ffL))
 		    ? *(uint64_t*)(kstk | 0x1f8L) : rnat;
 	} else {
+		PHOLD(td->td_proc);
 		iov.iov_base = (void*)(uintptr_t)kstk;
 		iov.iov_len = r->ndirty;
 		uio.uio_iov = &iov;
@@ -1114,6 +1115,7 @@
 		 */
 		if (uio.uio_resid != 0 && error == 0)
 			error = ENOSPC;
+		PRELE(td->td_proc);
 	}
 
 	r->bspstore += r->ndirty;

==== //depot/projects/uart/kern/kern_condvar.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_condvar.c,v 1.54 2006/02/15 23:52:00 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_condvar.c,v 1.55 2006/02/23 00:13:58 davidxu Exp $");
 
 #include "opt_ktrace.h"
 
@@ -192,18 +192,6 @@
 
 	sleepq_lock(cvp);
 
-	/*
-	 * Don't bother sleeping if we are exiting and not the exiting
-	 * thread or if our thread is marked as interrupted.
-	 */
-	mtx_lock_spin(&sched_lock);
-	rval = thread_sleep_check(td);
-	mtx_unlock_spin(&sched_lock);
-	if (rval != 0) {
-		sleepq_release(cvp);
-		return (rval);
-	}
-
 	cvp->cv_waiters++;
 	DROP_GIANT();
 	mtx_unlock(mp);
@@ -315,18 +303,6 @@
 
 	sleepq_lock(cvp);
 
-	/*
-	 * Don't bother sleeping if we are exiting and not the exiting
-	 * thread or if our thread is marked as interrupted.
-	 */
-	mtx_lock_spin(&sched_lock);
-	rval = thread_sleep_check(td);
-	mtx_unlock_spin(&sched_lock);
-	if (rval != 0) {
-		sleepq_release(cvp);
-		return (rval);
-	}
-
 	cvp->cv_waiters++;
 	DROP_GIANT();
 	mtx_unlock(mp);

==== //depot/projects/uart/kern/kern_exit.c#12 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.284 2006/02/21 21:48:42 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.285 2006/02/22 18:57:49 jhb Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -175,7 +175,29 @@
 		 */
 	}
 
+	/*
+	 * Wakeup anyone in procfs' PIOCWAIT.  They should have a hold
+	 * on our vmspace, so we should block below until they have
+	 * released their reference to us.  Note that if they have
+	 * requested S_EXIT stops we will block here until they ack
+	 * via PIOCCONT.
+	 */
+	_STOPEVENT(p, S_EXIT, rv);
+
+	/*
+	 * Note that we are exiting and do another wakeup of anyone in
+	 * PIOCWAIT in case they aren't listening for S_EXIT stops or
+	 * decided to wait again after we told them we are exiting.
+	 */
 	p->p_flag |= P_WEXIT;
+	wakeup(&p->p_stype);
+
+	/*
+	 * Wait for any processes that have a hold on our vmspace to
+	 * release their reference.
+	 */
+	while (p->p_lock > 0)
+		msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0);
 
 	PROC_LOCK(p->p_pptr);
 	sigqueue_take(p->p_ksi);
@@ -209,11 +231,6 @@
 		mtx_unlock(&ppeers_lock);
 	}
 
-	PROC_LOCK(p);
-	_STOPEVENT(p, S_EXIT, rv);
-	wakeup(&p->p_stype);	/* Wakeup anyone in procfs' PIOCWAIT */
-	PROC_UNLOCK(p);
-
 	/*
 	 * Check if any loadable modules need anything done at process exit.
 	 * E.g. SYSV IPC stuff

==== //depot/projects/uart/kern/kern_kse.c#11 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.222 2006/02/15 23:52:00 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.223 2006/02/22 18:57:49 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -148,7 +148,9 @@
 			td->td_mailbox = uap->tmbx;
 			td->td_pflags |= TDP_CAN_UNBIND;
 		}
+		PROC_LOCK(td->td_proc);
 		if (td->td_proc->p_flag & P_TRACED) {
+			_PHOLD(td->td_proc);
 			if (tmbx.tm_dflags & TMDF_SSTEP)
 				ptrace_single_step(td);
 			else
@@ -160,7 +162,9 @@
 					ku->ku_flags |= KUF_DOUPCALL;
 				mtx_unlock_spin(&sched_lock);
 			}
+			_PRELE(td->td_proc);
 		}
+		PROC_UNLOCK(td->td_proc);
 	}
 	return ((error == 0) ? EJUSTRETURN : error);
 }
@@ -782,8 +786,13 @@
 			 */
 			cpu_set_upcall_kse(newtd, newku->ku_func,
 				newku->ku_mailbox, &newku->ku_stack);
-			if (p->p_flag & P_TRACED)
+			PROC_LOCK(p);
+			if (p->p_flag & P_TRACED) {
+				_PHOLD(p);
 				ptrace_clear_single_step(newtd);
+				_PRELE(p);
+			}
+			PROC_UNLOCK(p);
 		}
 	}
 	
@@ -1376,8 +1385,13 @@
 		if (!(ku->ku_mflags & KMF_NOUPCALL)) {
 			cpu_set_upcall_kse(td, ku->ku_func, ku->ku_mailbox,
 				&ku->ku_stack);
-			if (p->p_flag & P_TRACED)
+			PROC_LOCK(p);
+			if (p->p_flag & P_TRACED) {
+				_PHOLD(p);
 				ptrace_clear_single_step(td);
+				_PRELE(p);
+			}
+			PROC_UNLOCK(p);
 			error = suword32(&ku->ku_mailbox->km_lwp,
 					td->td_tid);
 			if (error)

==== //depot/projects/uart/kern/kern_sig.c#24 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.323 2006/02/15 23:52:00 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.325 2006/02/23 09:24:19 davidxu Exp $");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
@@ -1189,35 +1189,40 @@
 		}
 	}
 
-again:
+restart:
 	for (i = 1; i <= _SIG_MAXSIG; ++i) {
 		if (!SIGISMEMBER(waitset, i))
 			continue;
-		if (SIGISMEMBER(td->td_sigqueue.sq_signals, i)) {
-			SIGFILLSET(td->td_sigmask);
-			SIG_CANTMASK(td->td_sigmask);
-			SIGDELSET(td->td_sigmask, i);
-			mtx_lock(&ps->ps_mtx);
-			sig = cursig(td);
-			i = 0;
-			mtx_unlock(&ps->ps_mtx);
-		} else if (SIGISMEMBER(p->p_sigqueue.sq_signals, i)) {
-			if (p->p_flag & P_SA) {
-				p->p_flag |= P_SIGEVENT;
-				wakeup(&p->p_siglist);
-			}
-			sigqueue_move(&p->p_sigqueue, &td->td_sigqueue, i);
-			SIGFILLSET(td->td_sigmask);
-			SIG_CANTMASK(td->td_sigmask);
-			SIGDELSET(td->td_sigmask, i);
-			mtx_lock(&ps->ps_mtx);
-			sig = cursig(td);
-			i = 0;
-			mtx_unlock(&ps->ps_mtx);
+		if (!SIGISMEMBER(td->td_sigqueue.sq_signals, i)) {
+			if (SIGISMEMBER(p->p_sigqueue.sq_signals, i)) {
+				if (p->p_flag & P_SA) {
+					p->p_flag |= P_SIGEVENT;
+					wakeup(&p->p_siglist);
+				}
+				sigqueue_move(&p->p_sigqueue,
+					&td->td_sigqueue, i);
+			} else
+				continue;
 		}
+
+		SIGFILLSET(td->td_sigmask);
+		SIG_CANTMASK(td->td_sigmask);
+		SIGDELSET(td->td_sigmask, i);
+		mtx_lock(&ps->ps_mtx);
+		sig = cursig(td);
+		mtx_unlock(&ps->ps_mtx);
 		if (sig)
 			goto out;
+		else {
+			/*
+			 * Because cursig() may have stopped current thread,
+			 * after it is resumed, things may have already been 
+			 * changed, it should rescan any pending signals.
+			 */
+			goto restart;
+		}
 	}
+
 	if (error)
 		goto out;
 
@@ -1255,30 +1260,37 @@
 			error = 0;
 		}
 	}
-	goto again;
+	goto restart;
 
 out:
+	td->td_sigmask = savedmask;
+	signotify(td);
 	if (sig) {
-		sig_t action;
-
 		ksiginfo_init(ksi);
 		sigqueue_get(&td->td_sigqueue, sig, ksi);
 		ksi->ksi_signo = sig;
 		if (ksi->ksi_code == SI_TIMER)
 			itimer_accept(p, ksi->ksi_timerid, ksi);
 		error = 0;
-		mtx_lock(&ps->ps_mtx);
-		action = ps->ps_sigact[_SIG_IDX(sig)];

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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