PERFORCE change 34282 for review

Peter Wemm peter at FreeBSD.org
Wed Jul 9 16:07:58 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=34282

Change 34282 by peter at peter_daintree on 2003/07/09 16:07:00

	IFC @34281

Affected files ...

.. //depot/projects/hammer/etc/pam.d/su#6 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_sig.c#14 integrate
.. //depot/projects/hammer/sys/amd64/amd64/pmap.c#27 integrate
.. //depot/projects/hammer/sys/amd64/include/pmap.h#17 integrate
.. //depot/projects/hammer/sys/amd64/include/vmparam.h#12 integrate
.. //depot/projects/hammer/sys/dev/aac/aac.c#12 integrate
.. //depot/projects/hammer/sys/dev/aac/aacvar.h#6 integrate
.. //depot/projects/hammer/sys/kern/sys_pipe.c#9 integrate
.. //depot/projects/hammer/sys/sys/vnode.h#14 integrate

Differences ...

==== //depot/projects/hammer/etc/pam.d/su#6 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $FreeBSD: src/etc/pam.d/su,v 1.15 2003/06/14 12:35:05 des Exp $
+# $FreeBSD: src/etc/pam.d/su,v 1.16 2003/07/09 18:40:49 des Exp $
 #
 # PAM configuration for the "su" service
 #
@@ -14,4 +14,4 @@
 account		include		system
 
 # session
-session		include		system
+session		required	pam_permit.so

==== //depot/projects/hammer/lib/libpthread/thread/thr_sig.c#14 (text+ko) ====

@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libpthread/thread/thr_sig.c,v 1.60 2003/07/09 14:30:51 davidxu Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_sig.c,v 1.61 2003/07/09 22:30:55 davidxu Exp $
  */
 #include <sys/param.h>
 #include <sys/types.h>
@@ -770,10 +770,12 @@
 			} else {
 				/* Increment the pending signal count. */
 				SIGADDSET(pthread->sigpend, sig);
-				pthread->check_pending = 1;
-				pthread->interrupted = 1;
-				pthread->sigmask = pthread->oldsigmask;
-				_thr_setrunnable_unlocked(pthread);
+				if (!SIGISMEMBER(pthread->oldsigmask, sig)) {
+					pthread->check_pending = 1;
+					pthread->interrupted = 1;
+					pthread->sigmask = pthread->oldsigmask;
+					_thr_setrunnable_unlocked(pthread);
+				}
 			}
 		
 			return;
@@ -836,10 +838,12 @@
 		} else {
 			/* Increment the pending signal count. */
 			SIGADDSET(pthread->sigpend, sig);
-			pthread->check_pending = 1;
-			pthread->interrupted = 1;
-			pthread->sigmask = pthread->oldsigmask;
-			_thr_setrunnable_unlocked(pthread);
+			if (!SIGISMEMBER(pthread->oldsigmask, sig)) {
+				pthread->check_pending = 1;
+				pthread->interrupted = 1;
+				pthread->sigmask = pthread->oldsigmask;
+				_thr_setrunnable_unlocked(pthread);
+			}
 		}
 		break;
 

==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#27 (text+ko) ====

@@ -39,7 +39,7 @@
  * SUCH DAMAGE.
  *
  *	from:	@(#)pmap.c	7.7 (Berkeley)	5/12/91
- * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.420 2003/07/08 19:40:34 alc Exp $
+ * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.423 2003/07/09 22:59:45 peter Exp $
  */
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.

==== //depot/projects/hammer/sys/amd64/include/pmap.h#17 (text+ko) ====

@@ -42,7 +42,7 @@
  *
  *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90
  *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.104 2003/06/22 13:02:45 simokawa Exp $
+ * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.105 2003/07/09 23:04:23 peter Exp $
  */
 
 #ifndef _MACHINE_PMAP_H_

==== //depot/projects/hammer/sys/amd64/include/vmparam.h#12 (text+ko) ====

@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.38 2003/05/23 06:36:46 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.39 2003/07/09 23:04:23 peter Exp $
  */
 
 

==== //depot/projects/hammer/sys/dev/aac/aac.c#12 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/aac/aac.c,v 1.72 2003/07/09 19:30:30 scottl Exp $
+ *	$FreeBSD: src/sys/dev/aac/aac.c,v 1.73 2003/07/09 21:16:23 scottl Exp $
  */
 
 /*
@@ -67,7 +67,7 @@
 
 /* Command Processing */
 static void	aac_timeout(struct aac_softc *sc);
-static int	aac_start(struct aac_command *cm);
+static int	aac_map_command(struct aac_command *cm);
 static void	aac_complete(void *context, int pending);
 static int	aac_bio_command(struct aac_softc *sc, struct aac_command **cmp);
 static void	aac_bio_complete(struct aac_command *cm);
@@ -75,11 +75,12 @@
 static void	aac_command_thread(struct aac_softc *sc);
 
 /* Command Buffer Management */
+static void	aac_map_command_sg(void *arg, bus_dma_segment_t *segs,
+				   int nseg, int error);
 static void	aac_map_command_helper(void *arg, bus_dma_segment_t *segs,
 				       int nseg, int error);
 static int	aac_alloc_commands(struct aac_softc *sc);
 static void	aac_free_commands(struct aac_softc *sc);
-static void	aac_map_command(struct aac_command *cm);
 static void	aac_unmap_command(struct aac_command *cm);
 
 /* Hardware Interface */
@@ -667,6 +668,9 @@
 
 	debug_called(2);
 
+	if (sc->flags & AAC_QUEUE_FRZN)
+		return;
+
 	for (;;) {
 		/*
 		 * Try to get a command that's been put off for lack of 
@@ -686,7 +690,7 @@
 			break;
 
 		/* try to give the command to the controller */
-		if (aac_start(cm) == EBUSY) {
+		if (aac_map_command(cm) == EBUSY) {
 			/* put it on the ready queue for later */
 			aac_requeue_ready(cm);
 			break;
@@ -699,7 +703,7 @@
  * last moment when possible.
  */
 static int
-aac_start(struct aac_command *cm)
+aac_map_command(struct aac_command *cm)
 {
 	struct aac_softc *sc;
 	int error;
@@ -707,22 +711,23 @@
 	debug_called(2);
 
 	sc = cm->cm_sc;
+	error = 0;
 
-	/* get the command mapped */
-	aac_map_command(cm);
+	/* don't map more than once */
+	if (cm->cm_flags & AAC_CMD_MAPPED)
+		return (0);
 
-	/* Fix up the address values in the FIB.  Use the command array index
-	 * instead of a pointer since these fields are only 32 bits.  Shift
-	 * the SenderFibAddress over to make room for the fast response bit.
-	 */
-	cm->cm_fib->Header.SenderFibAddress = (cm->cm_index << 1);
-	cm->cm_fib->Header.ReceiverFibAddress = cm->cm_fibphys;
-
-	/* save a pointer to the command for speedy reverse-lookup */
-	cm->cm_fib->Header.SenderData = cm->cm_index;
-	/* put the FIB on the outbound queue */
-	error = aac_enqueue_fib(sc, cm->cm_queue, cm);
-	return(error);
+	if (cm->cm_datalen != 0) {
+		error = bus_dmamap_load(sc->aac_buffer_dmat, cm->cm_datamap,
+					cm->cm_data, cm->cm_datalen,
+					aac_map_command_sg, cm, 0);
+		if (error == EINPROGRESS) {
+			debug(1, "freezing queue\n");
+			sc->flags |= AAC_QUEUE_FRZN;
+			error = 0;
+		}
+	}
+	return (error);
 }
 
 /*
@@ -859,6 +864,7 @@
 	}
 
 	/* see if we can start some more I/O */
+	sc->flags &= ~AAC_QUEUE_FRZN;
 	aac_startio(sc);
 
 	AAC_LOCK_RELEASE(&sc->aac_io_lock);
@@ -1158,9 +1164,10 @@
 		return (ENOMEM);
 	}
 
-	bus_dmamap_load(sc->aac_fib_dmat, fm->aac_fibmap, fm->aac_fibs, 
-			AAC_FIB_COUNT * sizeof(struct aac_fib),
-			aac_map_command_helper, &fibphys, 0);
+	/* Ignore errors since this doesn't bounce */
+	(void)bus_dmamap_load(sc->aac_fib_dmat, fm->aac_fibmap, fm->aac_fibs, 
+			      AAC_FIB_COUNT * sizeof(struct aac_fib),
+			      aac_map_command_helper, &fibphys, 0);
 
 	/* initialise constant fields in the command structure */
 	bzero(fm->aac_fibs, AAC_FIB_COUNT * sizeof(struct aac_fib));
@@ -1227,6 +1234,7 @@
 static void
 aac_map_command_sg(void *arg, bus_dma_segment_t *segs, int nseg, int error)
 {
+	struct aac_softc *sc;
 	struct aac_command *cm;
 	struct aac_fib *fib;
 	int i;
@@ -1234,6 +1242,7 @@
 	debug_called(3);
 
 	cm = (struct aac_command *)arg;
+	sc = cm->cm_sc;
 	fib = cm->cm_fib;
 
 	/* copy into the FIB */
@@ -1260,37 +1269,30 @@
 			fib->Header.Size += nseg*sizeof(struct aac_sg_entry64);
 		}
 	}
-}
 
-/*
- * Map a command into controller-visible space.
- */
-static void
-aac_map_command(struct aac_command *cm)
-{
-	struct aac_softc *sc;
+	/* Fix up the address values in the FIB.  Use the command array index
+	 * instead of a pointer since these fields are only 32 bits.  Shift
+	 * the SenderFibAddress over to make room for the fast response bit.
+	 */
+	cm->cm_fib->Header.SenderFibAddress = (cm->cm_index << 1);
+	cm->cm_fib->Header.ReceiverFibAddress = cm->cm_fibphys;
 
-	debug_called(2);
+	/* save a pointer to the command for speedy reverse-lookup */
+	cm->cm_fib->Header.SenderData = cm->cm_index;
 
-	sc = cm->cm_sc;
+	if (cm->cm_flags & AAC_CMD_DATAIN)
+		bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap,
+				BUS_DMASYNC_PREREAD);
+	if (cm->cm_flags & AAC_CMD_DATAOUT)
+		bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap,
+				BUS_DMASYNC_PREWRITE);
+	cm->cm_flags |= AAC_CMD_MAPPED;
 
-	/* don't map more than once */
-	if (cm->cm_flags & AAC_CMD_MAPPED)
-		return;
+	/* put the FIB on the outbound queue */
+	if (aac_enqueue_fib(sc, cm->cm_queue, cm) == EBUSY)
+		aac_requeue_ready(cm);
 
-	if (cm->cm_datalen != 0) {
-		bus_dmamap_load(sc->aac_buffer_dmat, cm->cm_datamap,
-				cm->cm_data, cm->cm_datalen,
-				aac_map_command_sg, cm, 0);
-
-		if (cm->cm_flags & AAC_CMD_DATAIN)
-			bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap,
-					BUS_DMASYNC_PREREAD);
-		if (cm->cm_flags & AAC_CMD_DATAOUT)
-			bus_dmamap_sync(sc->aac_buffer_dmat, cm->cm_datamap,
-					BUS_DMASYNC_PREWRITE);
-	}
-	cm->cm_flags |= AAC_CMD_MAPPED;
+	return;
 }
 
 /*
@@ -1386,7 +1388,8 @@
 		sc->flags |= AAC_FLAGS_4GB_WINDOW;
 	if (options & AAC_SUPPORTED_NONDASD)
 		sc->flags |= AAC_FLAGS_ENABLE_CAM;
-	if ((options & AAC_SUPPORTED_SGMAP_HOST64) != 0 && (sizeof(bus_addr_t) > 4)) {
+	if ((options & AAC_SUPPORTED_SGMAP_HOST64) != 0
+	     && (sizeof(bus_addr_t) > 4)) {
 		device_printf(sc->aac_dev, "Enabling 64-bit address support\n");
 		sc->flags |= AAC_FLAGS_SG_64BIT;
 	}
@@ -1510,7 +1513,7 @@
 	 * XXX If the padding is not needed, can it be put to use instead
 	 * of ignored?
 	 */
-	bus_dmamap_load(sc->aac_common_dmat, sc->aac_common_dmamap,
+	(void)bus_dmamap_load(sc->aac_common_dmat, sc->aac_common_dmamap,
 			sc->aac_common, 8192 + sizeof(*sc->aac_common),
 			aac_common_map, sc, 0);
 

==== //depot/projects/hammer/sys/dev/aac/aacvar.h#6 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/aac/aacvar.h,v 1.34 2003/07/09 19:19:16 scottl Exp $
+ *	$FreeBSD: src/sys/dev/aac/aacvar.h,v 1.35 2003/07/09 21:16:23 scottl Exp $
  */
 
 #include <sys/bio.h>
@@ -167,6 +167,8 @@
 #define AAC_ON_AACQ_BUSY	(1<<7)
 #define AAC_ON_AACQ_COMPLETE	(1<<8)
 #define AAC_ON_AACQ_MASK	((1<<5)|(1<<6)|(1<<7)|(1<<8))
+#define AAC_QUEUE_FRZN		(1<<9)		/* Freeze the processing of
+						 * commands on the queue. */
 
 	void			(* cm_complete)(struct aac_command *cm);
 	void			*cm_private;

==== //depot/projects/hammer/sys/kern/sys_pipe.c#9 (text+ko) ====

@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sys_pipe.c,v 1.138 2003/07/08 04:02:31 silby Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sys_pipe.c,v 1.139 2003/07/09 21:59:48 silby Exp $");
 
 #include "opt_mac.h"
 
@@ -183,13 +183,15 @@
 SYSCTL_DECL(_kern_ipc);
 
 SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipes, CTLFLAG_RW,
-	   &maxpipes, 0, "");
+	   &maxpipes, 0, "Max # of pipes");
 SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RW,
 	   &maxpipekva, 0, "Pipe KVA limit");
 SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipekvawired, CTLFLAG_RW,
 	   &maxpipekvawired, 0, "Pipe KVA wired limit");
 SYSCTL_INT(_kern_ipc, OID_AUTO, pipes, CTLFLAG_RD,
-	   &amountpipes, 0, "");
+	   &amountpipes, 0, "Current # of pipes");
+SYSCTL_INT(_kern_ipc, OID_AUTO, bigpipes, CTLFLAG_RD,
+	   &nbigpipe, 0, "Current # of big pipes");
 SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
 	   &amountpipekva, 0, "Pipe KVA usage");
 SYSCTL_INT(_kern_ipc, OID_AUTO, pipekvawired, CTLFLAG_RD,
@@ -962,7 +964,7 @@
 		if ((error = pipelock(wpipe, 1)) == 0) {
 			PIPE_GET_GIANT(wpipe);
 			if (pipespace(wpipe, BIG_PIPE_SIZE) == 0)
-				nbigpipe++;
+				atomic_add_int(&nbigpipe, 1);
 			PIPE_DROP_GIANT(wpipe);
 			pipeunlock(wpipe);
 		}
@@ -1000,8 +1002,7 @@
 		 */
 		if ((uio->uio_iov->iov_len >= PIPE_MINDIRECT) &&
 		    (fp->f_flag & FNONBLOCK) == 0 &&
-			 amountpipekvawired < maxpipekvawired &&
-			(uio->uio_iov->iov_len >= PIPE_MINDIRECT)) {
+		    amountpipekvawired < maxpipekvawired) { 
 			error = pipe_direct_write(wpipe, uio);
 			if (error)
 				break;
@@ -1405,7 +1406,7 @@
 
 	if (cpipe->pipe_buffer.buffer != NULL) {
 		if (cpipe->pipe_buffer.size > PIPE_SIZE)
-			--nbigpipe;
+			atomic_subtract_int(&nbigpipe, 1);
 		atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size);
 		atomic_subtract_int(&amountpipes, 1);
 		kmem_free(kernel_map,

==== //depot/projects/hammer/sys/sys/vnode.h#14 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)vnode.h	8.7 (Berkeley) 2/4/94
- * $FreeBSD: src/sys/sys/vnode.h,v 1.224 2003/05/31 16:42:44 phk Exp $
+ * $FreeBSD: src/sys/sys/vnode.h,v 1.225 2003/07/09 22:23:10 hsu Exp $
  */
 
 #ifndef _SYS_VNODE_H_
@@ -460,20 +460,9 @@
  */
 extern struct mtx mntvnode_mtx;
 
-/*
- * This macro is very helpful in defining those offsets in the vdesc struct.
- *
- * This is stolen from X11R4.  I ignored all the fancy stuff for
- * Crays, so if you decide to port this to such a serious machine,
- * you might want to consult Intrinsic.h's XtOffset{,Of,To}.
- */
-#define	VOPARG_OFFSET(p_type,field) \
-	((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-#define	VOPARG_OFFSETOF(s_type,field) \
-	VOPARG_OFFSET(s_type*,field)
-#define	VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \
-	((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET)))
-
+#define	VOPARG_OFFSETOF(s_type, field)	__offsetof(s_type, field)
+#define	VOPARG_OFFSETTO(s_type, s_offset, struct_p) \
+    ((s_type)(((char*)(struct_p)) + (s_offset)))
 
 /*
  * This structure is used to configure the new vnodeops vector.


More information about the p4-projects mailing list