PERFORCE change 122844 for review

Ulf Lilleengen lulf at FreeBSD.org
Wed Jul 4 08:32:22 UTC 2007


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

Change 122844 by lulf at lulf_carrot on 2007/07/04 08:31:35

	IFC

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sbin/Makefile#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/Makefile#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#9 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#11 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#8 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/acpica/acpi_machdep.c#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/pmap.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/Make.tags.inc#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/Makefile#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_malloc.c#7 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_rwlock.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_timeout.c#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/tty.c#4 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/modules/Makefile#6 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/sys/_rwlock.h#2 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/sys/rwlock.h#3 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/swap_pager.c#5 integrate
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_pageout.c#7 integrate

Differences ...

==== //depot/projects/soc2007/lulf/gvinum_fixup/sbin/Makefile#3 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.5 (Berkeley) 3/31/94
-# $FreeBSD: src/sbin/Makefile,v 1.166 2007/06/12 21:31:39 phk Exp $
+# $FreeBSD: src/sbin/Makefile,v 1.167 2007/06/25 05:06:53 rafan Exp $
 
 .include <bsd.own.mk>
 
@@ -59,7 +59,6 @@
 	mount_ntfs \
 	mount_nullfs \
 	mount_udf \
-	mount_umapfs \
 	mount_unionfs \
 	natd \
 	newfs \

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/Makefile,v 1.42 2007/04/14 16:29:15 maxim Exp $
+# $FreeBSD: src/sys/Makefile,v 1.43 2007/07/01 11:38:26 gnn Exp $
 
 .include <bsd.own.mk>
 
@@ -10,7 +10,7 @@
 # Directories to include in cscope name file and TAGS.
 CSCOPEDIRS=	bsm cam coda compat conf contrib crypto ddb dev fs geom gnu \
 		i4b isa kern libkern modules net net80211 netatalk netatm \
-		netgraph netinet netinet6 netipx netkey netnatm netncp \
+		netgraph netinet netinet6 netipx netnatm netncp \
 		netsmb nfs nfsclient nfs4client rpc pccard pci security sys \
 		ufs vm ${ARCHDIR}
 

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#9 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1434 2007/06/16 04:57:03 alc Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1439 2007/07/01 11:38:26 gnn Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -495,9 +495,9 @@
 #
 options 	INET			#Internet communications protocols
 options 	INET6			#IPv6 communications protocols
-options 	IPSEC			#IP security
-options 	IPSEC_ESP		#IP security (crypto; define w/ IPSEC)
-options 	IPSEC_DEBUG		#debug for IP security
+#options 	IPSEC			#IP security
+#options 	IPSEC_ESP		#IP security (crypto; define w/ IPSEC)
+#options 	IPSEC_DEBUG		#debug for IP security
 #
 # Set IPSEC_FILTERGIF to force packets coming through a gif tunnel
 # to be processed by any configured packet filtering (ipfw, ipf).
@@ -509,7 +509,7 @@
 #
 #options 	IPSEC_FILTERGIF		#filter ipsec packets from a tunnel
 
-#options 	FAST_IPSEC		#new IPsec (cannot define w/ IPSEC)
+options 	FAST_IPSEC		#new IPsec (cannot define w/ IPSEC)
 
 options 	IPX			#IPX/SPX communications protocols
 
@@ -938,10 +938,12 @@
 # currently be demand-loaded.)  Some people still prefer to statically
 # compile other filesystems as well.
 #
-# NB: The NULL, PORTAL, UMAP and UNION filesystems are known to be
-# buggy, and WILL panic your system if you attempt to do anything with
-# them.  They are included here as an incentive for some enterprising
-# soul to sit down and fix them.
+# NB: The PORTAL filesystem is known to be buggy, and WILL panic your
+# system if you attempt to do anything with it.  It is included here
+# as an incentive for some enterprising soul to sit down and fix it.
+# The UNION filesystem was known to be buggy in the past.  It is now
+# being actively maintained, although there are still some issues being
+# resolved.
 #
 
 # One of these is mandatory:
@@ -964,8 +966,6 @@
 options 	PSEUDOFS_TRACE		#Debugging support for PSEUDOFS
 options 	SMBFS			#SMB/CIFS filesystem
 options 	UDF			#Universal Disk Format
-# Broken (seriously (functionally) broken):
-#options 	UMAPFS			#UID map filesystem
 options 	UNIONFS			#Union filesystem
 # The xFS_ROOT options REQUIRE the associated ``options xFS''
 options 	NFS_ROOT		#NFS usable as root device
@@ -1905,6 +1905,7 @@
 # PCI Ethernet NICs.
 device		de		# DEC/Intel DC21x4x (``Tulip'')
 device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
+device		nxge		# Neterion Xframe 10GbE Server/Storage Adapter
 device		txp		# 3Com 3cR990 (``Typhoon'')
 device		vx		# 3Com 3c590, 3c595 (``Vortex'')
 

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#11 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1222 2007/06/16 04:57:04 alc Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1227 2007/07/01 12:42:37 gnn Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -811,6 +811,17 @@
 dev/ncv/ncr53c500.c		optional ncv
 dev/ncv/ncr53c500_pccard.c	optional ncv pccard
 dev/nge/if_nge.c		optional nge
+dev/nxge/if_nxge.c		optional nxge
+dev/nxge/xgehal/xgehal-device.c	optional nxge
+dev/nxge/xgehal/xgehal-mm.c	optional nxge
+dev/nxge/xgehal/xge-queue.c	optional nxge
+dev/nxge/xgehal/xgehal-driver.c	optional nxge
+dev/nxge/xgehal/xgehal-ring.c	optional nxge
+dev/nxge/xgehal/xgehal-channel.c	optional nxge
+dev/nxge/xgehal/xgehal-fifo.c	optional nxge
+dev/nxge/xgehal/xgehal-stats.c	optional nxge
+dev/nxge/xgehal/xgehal-config.c	optional nxge
+dev/nxge/xgehal/xgehal-mgmt.c	optional nxge
 dev/nmdm/nmdm.c			optional nmdm
 dev/nsp/nsp.c			optional nsp
 dev/nsp/nsp_pccard.c		optional nsp pccard
@@ -1199,9 +1210,6 @@
 fs/udf/udf_iconv.c		optional udf_iconv
 fs/udf/udf_vfsops.c		optional udf
 fs/udf/udf_vnops.c		optional udf
-fs/umapfs/umap_subr.c		optional umapfs
-fs/umapfs/umap_vfsops.c		optional umapfs
-fs/umapfs/umap_vnops.c		optional umapfs
 fs/unionfs/union_subr.c		optional unionfs
 fs/unionfs/union_vfsops.c	optional unionfs
 fs/unionfs/union_vnops.c	optional unionfs
@@ -1209,7 +1217,6 @@
 fs/tmpfs/tmpfs_fifoops.c 	optional tmpfs
 fs/tmpfs/tmpfs_vfsops.c 	optional tmpfs
 fs/tmpfs/tmpfs_subr.c 		optional tmpfs
-fs/tmpfs/tmpfs_uma.c 		optional tmpfs
 gdb/gdb_cons.c			optional gdb
 gdb/gdb_main.c			optional gdb
 gdb/gdb_packet.c		optional gdb
@@ -1822,7 +1829,6 @@
 netinet/ip_fw_pfil.c		optional ipfirewall
 netinet/ip_icmp.c		optional inet
 netinet/ip_input.c		optional inet
-netinet/ip_ipsec.c		optional ipsec
 netinet/ip_ipsec.c		optional fast_ipsec
 netinet/ip_mroute.c		optional mrouting inet | mrouting inet6
 netinet/ip_options.c		optional inet
@@ -1858,17 +1864,7 @@
 netinet/libalias/alias_mod.c	optional libalias | netgraph_nat
 netinet/libalias/alias_proxy.c	optional libalias | netgraph_nat
 netinet/libalias/alias_util.c	optional libalias | netgraph_nat
-netinet6/ah_aesxcbcmac.c	optional ipsec
-netinet6/ah_core.c		optional ipsec
-netinet6/ah_input.c		optional ipsec
-netinet6/ah_output.c		optional ipsec
 netinet6/dest6.c		optional inet6
-netinet6/esp_aesctr.c		optional ipsec ipsec_esp
-netinet6/esp_core.c		optional ipsec ipsec_esp
-netinet6/esp_input.c		optional ipsec ipsec_esp
-netinet6/esp_output.c		optional ipsec ipsec_esp
-netinet6/esp_rijndael.c		optional ipsec ipsec_esp
-netinet6/esp_camellia.c		optional ipsec ipsec_esp
 netinet6/frag6.c		optional inet6
 netinet6/icmp6.c		optional inet6
 netinet6/in6.c			optional inet6
@@ -1884,10 +1880,7 @@
 netinet6/ip6_input.c		optional inet6
 netinet6/ip6_mroute.c		optional mrouting inet6
 netinet6/ip6_output.c		optional inet6
-netinet6/ipcomp_core.c		optional ipsec
-netinet6/ipcomp_input.c		optional ipsec
-netinet6/ipcomp_output.c	optional ipsec
-netinet6/ipsec.c		optional ipsec
+netinet6/ip6_ipsec.c		optional fast_ipsec
 netinet6/mld6.c			optional inet6
 netinet6/nd6.c			optional inet6
 netinet6/nd6_nbr.c		optional inet6
@@ -1919,10 +1912,6 @@
 netipx/ipx_usrreq.c		optional ipx
 netipx/spx_debug.c		optional ipx
 netipx/spx_usrreq.c		optional ipx
-netkey/key.c			optional ipsec
-netkey/key_debug.c		optional ipsec
-netkey/keydb.c			optional ipsec
-netkey/keysock.c		optional ipsec
 netnatm/natm.c			optional natm
 netnatm/natm_pcb.c		optional natm
 netnatm/natm_proto.c		optional natm

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#8 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.596 2007/06/16 04:57:04 alc Exp $
+# $FreeBSD: src/sys/conf/options,v 1.597 2007/06/25 05:06:55 rafan Exp $
 #
 #        On the handling of kernel options
 #
@@ -198,7 +198,6 @@
 SMBFS		opt_dontuse.h
 TMPFS		opt_dontuse.h
 UDF		opt_dontuse.h
-UMAPFS		opt_dontuse.h
 UNIONFS		opt_dontuse.h
 
 # Pseudofs debugging

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/acpica/acpi_machdep.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.35 2007/03/31 23:23:41 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.36 2007/06/21 22:50:36 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -33,6 +33,8 @@
 #include <sys/conf.h>
 #include <sys/fcntl.h>
 #include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/poll.h>
 #include <sys/sysctl.h>
 #include <sys/uio.h>
 #include <vm/vm.h>
@@ -46,8 +48,6 @@
  * APM driver emulation 
  */
 
-#include <sys/selinfo.h>
-
 #include <machine/apm_bios.h>
 #include <machine/pc/bios.h>
 
@@ -64,21 +64,31 @@
 
 static int intr_model = ACPI_INTR_PIC;
 static int apm_active;
+static struct clonedevs *apm_clones;
+
+MALLOC_DEFINE(M_APMDEV, "apmdev", "APM device emulation");
 
-static d_open_t apmopen;
-static d_close_t apmclose;
-static d_write_t apmwrite;
-static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
+static d_open_t		apmopen;
+static d_close_t	apmclose;
+static d_write_t	apmwrite;
+static d_ioctl_t	apmioctl;
+static d_poll_t		apmpoll;
+static d_kqfilter_t	apmkqfilter;
+static void		apmreadfiltdetach(struct knote *kn);
+static int		apmreadfilt(struct knote *kn, long hint);
+static struct filterops	apm_readfiltops =
+	{ 1, NULL, apmreadfiltdetach, apmreadfilt };
 
 static struct cdevsw apm_cdevsw = {
 	.d_version =	D_VERSION,
+	.d_flags =	D_TRACKCLOSE,
 	.d_open =	apmopen,
 	.d_close =	apmclose,
 	.d_write =	apmwrite,
 	.d_ioctl =	apmioctl,
 	.d_poll =	apmpoll,
 	.d_name =	"apm",
+	.d_kqfilter =	apmkqfilter
 };
 
 static int
@@ -202,44 +212,177 @@
 	return (0);
 }
 
+/* Create single-use devices for /dev/apm and /dev/apmctl. */
+static void
+apm_clone(void *arg, struct ucred *cred, char *name, int namelen,
+    struct cdev **dev)
+{
+	int ctl_dev, unit;
+
+	if (*dev != NULL)
+		return;
+	if (strcmp(name, "apmctl") == 0)
+		ctl_dev = TRUE;
+	else if (strcmp(name, "apm") == 0)
+		ctl_dev = FALSE;
+	else
+		return;
+
+	/* Always create a new device and unit number. */
+	unit = -1;
+	if (clone_create(&apm_clones, &apm_cdevsw, &unit, dev, 0)) {
+		if (ctl_dev) {
+			*dev = make_dev(&apm_cdevsw, unit2minor(unit),
+			    UID_ROOT, GID_OPERATOR, 0660, "apmctl%d", unit);
+		} else {
+			*dev = make_dev(&apm_cdevsw, unit2minor(unit),
+			    UID_ROOT, GID_OPERATOR, 0664, "apm%d", unit);
+		}
+		if (*dev != NULL) {
+			dev_ref(*dev);
+			(*dev)->si_flags |= SI_CHEAPCLONE;
+		}
+	}
+}
+
+/* Create a struct for tracking per-device suspend notification. */
+static struct apm_clone_data *
+apm_create_clone(struct cdev *dev, struct acpi_softc *acpi_sc)
+{
+	struct apm_clone_data *clone;
+
+	clone = malloc(sizeof(*clone), M_APMDEV, M_WAITOK);
+	clone->cdev = dev;
+	clone->acpi_sc = acpi_sc;
+	clone->notify_status = APM_EV_NONE;
+	bzero(&clone->sel_read, sizeof(clone->sel_read));
+	knlist_init(&clone->sel_read.si_note, &acpi_mutex, NULL, NULL, NULL);
+
+	/*
+	 * The acpi device is always managed by devd(8) and is considered
+	 * writable (i.e., ack is required to allow suspend to proceed.)
+	 */
+	if (strcmp("acpi", devtoname(dev)) == 0)
+		clone->flags = ACPI_EVF_DEVD | ACPI_EVF_WRITE;
+	else
+		clone->flags = ACPI_EVF_NONE;
+
+	ACPI_LOCK(acpi);
+	STAILQ_INSERT_TAIL(&acpi_sc->apm_cdevs, clone, entries);
+	ACPI_UNLOCK(acpi);
+	return (clone);
+}
+
+/* XXX Kernel should be updated to allow calls to destroy_dev() in close(). */
+static void
+apm_destroy_clone(void *arg)
+{
+
+	destroy_dev((struct cdev *)arg);
+}
+
 static int
 apmopen(struct cdev *dev, int flag, int fmt, d_thread_t *td)
 {
+	struct	acpi_softc *acpi_sc;
+	struct 	apm_clone_data *clone;
+
+	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
+	clone = apm_create_clone(dev, acpi_sc);
+	dev->si_drv1 = clone;
+
+	/* If the device is opened for write, record that. */
+	if ((flag & FWRITE) != 0)
+		clone->flags |= ACPI_EVF_WRITE;
+
 	return (0);
 }
 
 static int
 apmclose(struct cdev *dev, int flag, int fmt, d_thread_t *td)
 {
+	struct	apm_clone_data *clone;
+	struct	acpi_softc *acpi_sc;
+
+	clone = dev->si_drv1;
+	acpi_sc = clone->acpi_sc;
+
+	/* We are about to lose a reference so check if suspend should occur */
+	if (acpi_sc->acpi_next_sstate != 0 &&
+	    clone->notify_status != APM_EV_ACKED)
+		acpi_AckSleepState(clone, 0);
+
+	/* Remove this clone's data from the list and free it. */
+	ACPI_LOCK(acpi);
+	STAILQ_REMOVE(&acpi_sc->apm_cdevs, clone, apm_clone_data, entries);
+	knlist_destroy(&clone->sel_read.si_note);
+	ACPI_UNLOCK(acpi);
+	free(clone, M_APMDEV);
+	AcpiOsExecute(OSL_GPE_HANDLER, apm_destroy_clone, dev);
 	return (0);
 }
 
 static int
 apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
 {
-	int	error = 0;
+	int	error;
+	struct	apm_clone_data *clone;
 	struct	acpi_softc *acpi_sc;
-	struct apm_info info;
+	struct	apm_info info;
+	struct 	apm_event_info *ev_info;
 	apm_info_old_t aiop;
 
-	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
+	error = 0;
+	clone = dev->si_drv1;
+	acpi_sc = clone->acpi_sc;
 
 	switch (cmd) {
 	case APMIO_SUSPEND:
 		if ((flag & FWRITE) == 0)
 			return (EPERM);
-		if (apm_active)
-			acpi_SetSleepState(acpi_sc, acpi_sc->acpi_suspend_sx);
-		else
-			error = EINVAL;
+		if (acpi_sc->acpi_next_sstate == 0) {
+			if (acpi_sc->acpi_suspend_sx != ACPI_STATE_S5) {
+				error = acpi_ReqSleepState(acpi_sc,
+				    acpi_sc->acpi_suspend_sx);
+			} else {
+				printf(
+			"power off via apm suspend not supported\n");
+				error = ENXIO;
+			}
+		} else
+			error = acpi_AckSleepState(clone, 0);
 		break;
 	case APMIO_STANDBY:
 		if ((flag & FWRITE) == 0)
 			return (EPERM);
-		if (apm_active)
-			acpi_SetSleepState(acpi_sc, acpi_sc->acpi_standby_sx);
-		else
-			error = EINVAL;
+		if (acpi_sc->acpi_next_sstate == 0) {
+			if (acpi_sc->acpi_standby_sx != ACPI_STATE_S5) {
+				error = acpi_ReqSleepState(acpi_sc,
+				    acpi_sc->acpi_standby_sx);
+			} else {
+				printf(
+			"power off via apm standby not supported\n");
+				error = ENXIO;
+			}
+		} else
+			error = acpi_AckSleepState(clone, 0);
+		break;
+	case APMIO_NEXTEVENT:
+		printf("apm nextevent start\n");
+		ACPI_LOCK(acpi);
+		if (acpi_sc->acpi_next_sstate != 0 && clone->notify_status ==
+		    APM_EV_NONE) {
+			ev_info = (struct apm_event_info *)addr;
+			if (acpi_sc->acpi_next_sstate <= ACPI_STATE_S3)
+				ev_info->type = PMEV_STANDBYREQ;
+			else
+				ev_info->type = PMEV_SUSPENDREQ;
+			ev_info->index = 0;
+			clone->notify_status = APM_EV_NOTIFIED;
+			printf("apm event returning %d\n", ev_info->type);
+		} else
+			error = EAGAIN;
+		ACPI_UNLOCK(acpi);
 		break;
 	case APMIO_GETINFO_OLD:
 		if (acpi_capm_get_info(&info))
@@ -300,24 +443,71 @@
 static int
 apmpoll(struct cdev *dev, int events, d_thread_t *td)
 {
+	struct	apm_clone_data *clone;
+	int revents;
+
+	revents = 0;
+	ACPI_LOCK(acpi);
+	clone = dev->si_drv1;
+	if (clone->acpi_sc->acpi_next_sstate)
+		revents |= events & (POLLIN | POLLRDNORM);
+	else
+		selrecord(td, &clone->sel_read);
+	ACPI_UNLOCK(acpi);
+	return (revents);
+}
+
+static int
+apmkqfilter(struct cdev *dev, struct knote *kn)
+{
+	struct	apm_clone_data *clone;
+
+	ACPI_LOCK(acpi);
+	clone = dev->si_drv1;
+	kn->kn_hook = clone;
+	kn->kn_fop = &apm_readfiltops;
+	knlist_add(&clone->sel_read.si_note, kn, 0);
+	ACPI_UNLOCK(acpi);
 	return (0);
 }
 
 static void
-acpi_capm_init(struct acpi_softc *sc)
+apmreadfiltdetach(struct knote *kn)
+{
+	struct	apm_clone_data *clone;
+
+	ACPI_LOCK(acpi);
+	clone = kn->kn_hook;
+	knlist_remove(&clone->sel_read.si_note, kn, 0);
+	ACPI_UNLOCK(acpi);
+}
+
+static int
+apmreadfilt(struct knote *kn, long hint)
 {
-        make_dev(&apm_cdevsw, 0, 0, 5, 0664, "apm");
+	struct	apm_clone_data *clone;
+	int	sleeping;
+
+	ACPI_LOCK(acpi);
+	clone = kn->kn_hook;
+	sleeping = clone->acpi_sc->acpi_next_sstate ? 1 : 0;
+	ACPI_UNLOCK(acpi);
+	return (sleeping);
 }
 
 int
 acpi_machdep_init(device_t dev)
 {
-	struct	acpi_softc *sc;
+	struct	acpi_softc *acpi_sc;
 
-	sc = devclass_get_softc(devclass_find("acpi"), 0);
-	acpi_capm_init(sc);
+	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
 
-	acpi_install_wakeup_handler(sc);
+	/* Create a clone for /dev/acpi also. */
+	STAILQ_INIT(&acpi_sc->apm_cdevs);
+	acpi_sc->acpi_clone = apm_create_clone(acpi_sc->acpi_dev_t, acpi_sc);
+	clone_setup(&apm_clones);
+	EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000);
+	acpi_install_wakeup_handler(acpi_sc);
 
 	if (intr_model == ACPI_INTR_PIC)
 		BUS_CONFIG_INTR(dev, AcpiGbl_FADT.SciInterrupt,
@@ -325,8 +515,8 @@
 	else
 		acpi_SetIntrModel(intr_model);
 
-	SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx,
-	    SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_UINT(&acpi_sc->acpi_sysctl_ctx,
+	    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO,
 	    "reset_video", CTLFLAG_RW, &acpi_reset_video, 0,
 	    "Call the VESA reset BIOS vector on the resume path");
 

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/pmap.c#5 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.592 2007/05/31 22:52:12 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.593 2007/07/01 07:08:26 alc Exp $");
 
 /*
  *	Manages physical address maps.
@@ -271,7 +271,8 @@
     vm_page_t m, vm_prot_t prot, vm_page_t mpte);
 static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva,
     vm_page_t *free);
-static void pmap_remove_page(struct pmap *pmap, vm_offset_t va);
+static void pmap_remove_page(struct pmap *pmap, vm_offset_t va,
+    vm_page_t *free);
 static void pmap_remove_entry(struct pmap *pmap, vm_page_t m,
 					vm_offset_t va);
 static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
@@ -1987,19 +1988,17 @@
  * Remove a single page from a process address space
  */
 static void
-pmap_remove_page(pmap_t pmap, vm_offset_t va)
+pmap_remove_page(pmap_t pmap, vm_offset_t va, vm_page_t *free)
 {
 	pt_entry_t *pte;
-	vm_page_t free = NULL;
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	KASSERT(curthread->td_pinned > 0, ("curthread not pinned"));
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	if ((pte = pmap_pte_quick(pmap, va)) == NULL || *pte == 0)
 		return;
-	pmap_remove_pte(pmap, pte, va, &free);
+	pmap_remove_pte(pmap, pte, va, free);
 	pmap_invalidate_page(pmap, va);
-	pmap_free_zero_pages(free);
 }
 
 /*
@@ -2036,7 +2035,7 @@
 	 */
 	if ((sva + PAGE_SIZE == eva) && 
 	    ((pmap->pm_pdir[(sva >> PDRSHIFT)] & PG_PS) == 0)) {
-		pmap_remove_page(pmap, sva);
+		pmap_remove_page(pmap, sva, &free);
 		goto out;
 	}
 
@@ -2095,12 +2094,11 @@
 	}
 out:
 	sched_unpin();
-	if (anyvalid) {
+	if (anyvalid)
 		pmap_invalidate_all(pmap);
-		pmap_free_zero_pages(free);
-	}
 	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
+	pmap_free_zero_pages(free);
 }
 
 /*
@@ -3119,9 +3117,9 @@
 	}
 	sched_unpin();
 	pmap_invalidate_all(pmap);
-	pmap_free_zero_pages(free);
 	vm_page_unlock_queues();
 	PMAP_UNLOCK(pmap);
+	pmap_free_zero_pages(free);
 }
 
 /*

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/Make.tags.inc#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/kern/Make.tags.inc,v 1.18 2007/05/13 18:21:54 mckusick Exp $
+# $FreeBSD: src/sys/kern/Make.tags.inc,v 1.19 2007/06/25 05:06:56 rafan Exp $
 #	@(#)Make.tags.inc	8.1 (Berkeley) 6/11/93
 
 SYS?=	${.CURDIR}/..
@@ -37,7 +37,6 @@
 	${SYS}/fs/procfs/*.[ch] \
 	${SYS}/fs/smbfs/*.[ch] \
 	${SYS}/fs/udf/*.[ch] \
-	${SYS}/fs/umapfs/*.[ch] \
 	${SYS}/fs/unionfs/*.[ch] \
 	${SYS}/kern/*.[ch] \
 	${SYS}/net/*.[ch] \
@@ -96,7 +95,6 @@
 	${SYS}/fs/portalfs \
 	${SYS}/fs/procfs \
 	${SYS}/fs/specfs \
-	${SYS}/fs/umapfs \
 	${SYS}/fs/unionfs \
 	${SYS}/fs/cd9660 \
 	${SYS}/ufs/ffs \

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/Makefile#2 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.2 (Berkeley) 3/21/94
-# $FreeBSD: src/sys/kern/Makefile,v 1.13 2006/08/05 19:25:14 jb Exp $
+# $FreeBSD: src/sys/kern/Makefile,v 1.14 2007/06/25 05:06:56 rafan Exp $
 
 # Makefile for kernel tags files, init_sysent, etc.
 
@@ -38,7 +38,7 @@
 	dev dev/scsi \
 	fs fs/deadfs fs/fdescfs fs/fifofs \
 	fs/lofs fs/nullfs fs/portalfs fs/procfs \
-	fs/specfs fs/umapfs fs/unionfs \
+	fs/specfs fs/unionfs \
 	hp hp/dev hp/hpux \
 	kern libkern \
 	net netinet nfs scripts sys \

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_malloc.c#7 (text+ko) ====

@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_malloc.c,v 1.161 2007/06/14 03:02:33 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_malloc.c,v 1.162 2007/06/27 13:39:38 rwatson Exp $");
 
 #include "opt_ddb.h"
 #include "opt_vm.h"
@@ -112,8 +112,8 @@
 static MALLOC_DEFINE(M_FREE, "free", "should be on free list");
 
 static struct malloc_type *kmemstatistics;
-static char *kmembase;
-static char *kmemlimit;
+static vm_offset_t kmembase;
+static vm_offset_t kmemlimit;
 static int kmemcount;
 
 #define KMEM_ZSHIFT	4
@@ -593,8 +593,8 @@
 	 */
 	init_param3(vm_kmem_size / PAGE_SIZE);
 
-	kmem_map = kmem_suballoc(kernel_map, (vm_offset_t *)&kmembase,
-		(vm_offset_t *)&kmemlimit, vm_kmem_size);
+	kmem_map = kmem_suballoc(kernel_map, &kmembase, &kmemlimit,
+	    vm_kmem_size);
 	kmem_map->system_map = 1;
 
 #ifdef DEBUG_MEMGUARD

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_rwlock.c#5 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.26 2007/06/04 23:51:43 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.27 2007/06/26 21:31:56 attilio Exp $");
 
 #include "opt_ddb.h"
 #include "opt_no_adaptive_rwlocks.h"
@@ -48,6 +48,8 @@
 #include <sys/lock_profile.h>
 #include <machine/cpu.h>
 
+CTASSERT((RW_RECURSE & LO_CLASSFLAGS) == RW_RECURSE);
+
 #if defined(SMP) && !defined(NO_ADAPTIVE_RWLOCKS)
 #define	ADAPTIVE_RWLOCKS
 #endif
@@ -79,6 +81,17 @@
 	    (struct thread *)RW_OWNER((rw)->rw_lock))
 
 /*
+ * Returns if a write owner is recursed.  Write ownership is not assured
+ * here and should be previously checked.
+ */
+#define	rw_recursed(rw)		((rw)->rw_recurse != 0)
+
+/*
+ * Return true if curthread helds the lock.
+ */
+#define	rw_wlocked(rw)		(rw_wowner((rw)) == curthread)
+
+/*
  * Return a pointer to the owning thread for this lock who should receive
  * any priority lent by threads that block on this lock.  Currently this
  * is identical to rw_wowner().
@@ -118,13 +131,27 @@
 }
 
 void
-rw_init(struct rwlock *rw, const char *name)
+rw_init_flags(struct rwlock *rw, const char *name, int opts)
 {
+	int flags;
+
+	MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET |
+	    RW_RECURSE)) == 0);
+
+	flags = LO_UPGRADABLE | LO_RECURSABLE;
+	if (opts & RW_DUPOK)
+		flags |= LO_DUPOK;
+	if (opts & RW_NOPROFILE)
+		flags |= LO_NOPROFILE;
+	if (!(opts & RW_NOWITNESS))
+		flags |= LO_WITNESS;
+	if (opts & RW_QUIET)
+		flags |= LO_QUIET;
+	flags |= opts & RW_RECURSE;
 
 	rw->rw_lock = RW_UNLOCKED;
-
-	lock_init(&rw->lock_object, &lock_class_rw, name, NULL, LO_WITNESS |
-	    LO_RECURSABLE | LO_UPGRADABLE);
+	rw->rw_recurse = 0;
+	lock_init(&rw->lock_object, &lock_class_rw, name, NULL, flags);
 }
 
 void
@@ -132,6 +159,7 @@
 {
 
 	KASSERT(rw->rw_lock == RW_UNLOCKED, ("rw lock not unlocked"));
+	KASSERT(rw->rw_recurse == 0, ("rw lock still recursed"));
 	rw->rw_lock = RW_DESTROYED;
 	lock_destroy(&rw->lock_object);
 }
@@ -164,7 +192,7 @@
 	WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
 	    line);
 	__rw_wlock(rw, curthread, file, line);
-	LOCK_LOG_LOCK("WLOCK", &rw->lock_object, 0, 0, file, line);
+	LOCK_LOG_LOCK("WLOCK", &rw->lock_object, 0, rw->rw_recurse, file, line);
 	WITNESS_LOCK(&rw->lock_object, LOP_EXCLUSIVE, file, line);
 	curthread->td_locks++;
 }
@@ -179,8 +207,10 @@
 	_rw_assert(rw, RA_WLOCKED, file, line);
 	curthread->td_locks--;
 	WITNESS_UNLOCK(&rw->lock_object, LOP_EXCLUSIVE, file, line);
-	LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, 0, file, line);
-	lock_profile_release_lock(&rw->lock_object);
+	LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, rw->rw_recurse, file,
+	    line);
+	if (!rw_recursed(rw))
+		lock_profile_release_lock(&rw->lock_object);
 	__rw_wunlock(rw, curthread, file, line);
 }
 
@@ -466,6 +496,17 @@
 #endif
 	uintptr_t v;
 
+	if (rw_wlocked(rw)) {
+		KASSERT(rw->lock_object.lo_flags & RW_RECURSE,
+		    ("%s: recursing but non-recursive rw %s @ %s:%d\n",
+		    __func__, rw->lock_object.lo_name, file, line));
+		rw->rw_recurse++;
+		atomic_set_ptr(&rw->rw_lock, RW_LOCK_RECURSED);
+		if (LOCK_LOG_TEST(&rw->lock_object, 0))
+			CTR2(KTR_LOCK, "%s: %p recursing", __func__, rw);
+		return;
+	}
+
 	if (LOCK_LOG_TEST(&rw->lock_object, 0))
 		CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
 		    rw->lock_object.lo_name, (void *)rw->rw_lock, file, line);
@@ -570,6 +611,14 @@
 	uintptr_t v;
 	int queue;
 
+	if (rw_wlocked(rw) && rw_recursed(rw)) {
+		if ((--rw->rw_recurse) == 0)
+			atomic_clear_ptr(&rw->rw_lock, RW_LOCK_RECURSED);
+		if (LOCK_LOG_TEST(&rw->lock_object, 0))
+			CTR2(KTR_LOCK, "%s: %p unrecursing", __func__, rw);
+		return;
+	}
+
 	KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS),
 	    ("%s: neither of the waiter flags are set", __func__));
 
@@ -732,7 +781,11 @@
 
 	KASSERT(rw->rw_lock != RW_DESTROYED,
 	    ("rw_downgrade() of destroyed rwlock @ %s:%d", file, line));
-	_rw_assert(rw, RA_WLOCKED, file, line);
+	_rw_assert(rw, RA_WLOCKED | RA_NOTRECURSED, file, line);
+#ifndef INVARIANTS
+	if (rw_recursed(rw))
+		panic("downgrade of a recursed lock");
+#endif
 
 	WITNESS_DOWNGRADE(&rw->lock_object, 0, file, line);
 
@@ -809,7 +862,8 @@
 		return;
 	switch (what) {
 	case RA_LOCKED:
-	case RA_LOCKED | LA_NOTRECURSED:
+	case RA_LOCKED | RA_RECURSED:
+	case RA_LOCKED | RA_NOTRECURSED:
 	case RA_RLOCKED:
 #ifdef WITNESS
 		witness_assert(&rw->lock_object, what, file, line);
@@ -825,12 +879,32 @@
 			panic("Lock %s not %slocked @ %s:%d\n",
 			    rw->lock_object.lo_name, (what == RA_RLOCKED) ?
 			    "read " : "", file, line);
+
+		if (!(rw->rw_lock & RW_LOCK_READ)) {
+			if (rw_recursed(rw)) {
+				if (what & RA_NOTRECURSED)
+					panic("Lock %s recursed @ %s:%d\n",
+					    rw->lock_object.lo_name, file,
+					    line);
+			} else if (what & RA_RECURSED)
+				panic("Lock %s not recursed @ %s:%d\n",
+				    rw->lock_object.lo_name, file, line);
+		}
 #endif
 		break;
 	case RA_WLOCKED:
+	case RA_WLOCKED | RA_RECURSED:
+	case RA_WLOCKED | RA_NOTRECURSED:
 		if (rw_wowner(rw) != curthread)
 			panic("Lock %s not exclusively locked @ %s:%d\n",
 			    rw->lock_object.lo_name, file, line);
+		if (rw_recursed(rw)) {
+			if (what & RA_NOTRECURSED)
+				panic("Lock %s recursed @ %s:%d\n",
+				    rw->lock_object.lo_name, file, line);
+		} else if (what & RA_RECURSED)
+			panic("Lock %s not recursed @ %s:%d\n",
+			    rw->lock_object.lo_name, file, line);
 		break;
 	case RA_UNLOCKED:
 #ifdef WITNESS
@@ -874,6 +948,8 @@
 		td = rw_wowner(rw);
 		db_printf("WLOCK: %p (tid %d, pid %d, \"%s\")\n", td,
 		    td->td_tid, td->td_proc->p_pid, td->td_proc->p_comm);
+		if (rw_recursed(rw))
+			db_printf(" recursed: %u\n", rw->rw_recurse);
 	}
 	db_printf(" waiters: ");
 	switch (rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS)) {

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_timeout.c#3 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.103 2007/05/11 20:52:47 andre Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.104 2007/06/26 21:42:01 attilio Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,6 +46,7 @@
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/sleepqueue.h>
 #include <sys/sysctl.h>
 
 static int avg_depth;
@@ -308,8 +309,10 @@
 					 * There is someone waiting
 					 * for the callout to complete.
 					 */
+					callout_wait = 0;
+					mtx_unlock_spin(&callout_lock);
 					wakeup(&callout_wait);
-					callout_wait = 0;
+					mtx_lock_spin(&callout_lock);
 				}
 				steps = 0;
 				c = nextsoftcheck;
@@ -529,9 +532,38 @@
 			 * finish.
 			 */
 			while (c == curr_callout) {
+
+				/*
+				 * Use direct calls to sleepqueue interface
+				 * instead of cv/msleep in order to avoid
+				 * a LOR between callout_lock and sleepqueue
+				 * chain spinlocks.  This piece of code
+				 * emulates a msleep_spin() call actually.
+				 */
+				mtx_unlock_spin(&callout_lock);
+				sleepq_lock(&callout_wait);
+
+				/*
+				 * Check again the state of curr_callout
+				 * because curthread could have lost the
+				 * race previously won.
+				 */
+				mtx_lock_spin(&callout_lock);
+				if (c != curr_callout) {
+					sleepq_release(&callout_wait);
+					break;
+				}
 				callout_wait = 1;
-				msleep_spin(&callout_wait, &callout_lock,
-				    "codrain", 0);
+				DROP_GIANT();

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


More information about the p4-projects mailing list