PERFORCE change 34232 for review

Marcel Moolenaar marcel at FreeBSD.org
Wed Jul 9 00:08:15 PDT 2003


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

Change 34232 by marcel at marcel_nfs on 2003/07/09 00:07:31

	IFC @34224

Affected files ...

.. //depot/projects/uart/alpha/alpha/pmap.c#4 integrate
.. //depot/projects/uart/amd64/amd64/pmap.c#4 integrate
.. //depot/projects/uart/conf/NOTES#2 integrate
.. //depot/projects/uart/conf/files#4 integrate
.. //depot/projects/uart/dev/acpica/acpi_isab.c#1 branch
.. //depot/projects/uart/dev/pci/isa_pci.c#2 integrate
.. //depot/projects/uart/dev/sound/pci/ich.c#4 integrate
.. //depot/projects/uart/dev/sound/pcm/feeder.c#2 integrate
.. //depot/projects/uart/dev/sound/pcm/feeder.h#2 integrate
.. //depot/projects/uart/dev/usb/umct.c#3 integrate
.. //depot/projects/uart/dev/wi/if_wi_pccard.c#2 integrate
.. //depot/projects/uart/geom/geom_dump.c#2 integrate
.. //depot/projects/uart/i386/i386/pmap.c#4 integrate
.. //depot/projects/uart/i386/i386/sys_machdep.c#2 integrate
.. //depot/projects/uart/isa/isa_common.c#2 integrate
.. //depot/projects/uart/isa/isavar.h#2 integrate
.. //depot/projects/uart/isa/psm.c#3 integrate
.. //depot/projects/uart/kern/sched_ule.c#3 integrate
.. //depot/projects/uart/kern/subr_param.c#2 integrate
.. //depot/projects/uart/kern/sys_pipe.c#2 integrate
.. //depot/projects/uart/modules/acpi/Makefile#2 integrate
.. //depot/projects/uart/net/if_vlan.c#3 integrate
.. //depot/projects/uart/net/if_vlan_var.h#2 integrate
.. //depot/projects/uart/netinet/ip_fw2.c#3 integrate
.. //depot/projects/uart/pci/if_dc.c#3 integrate
.. //depot/projects/uart/pci/if_dcreg.h#2 integrate
.. //depot/projects/uart/sparc64/sparc64/pmap.c#4 integrate
.. //depot/projects/uart/sys/pipe.h#2 integrate
.. //depot/projects/uart/vm/vm_pageout.c#3 integrate

Differences ...

==== //depot/projects/uart/alpha/alpha/pmap.c#4 (text+ko) ====

@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.129 2003/07/03 20:18:00 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.130 2003/07/06 20:32:42 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -993,7 +993,7 @@
 		if (m->wire_count == 0) {
 			vm_page_busy(m);
 			vm_page_free_zero(m);
-			--cnt.v_wire_count;
+			atomic_subtract_int(&cnt.v_wire_count, 1);
 		}
 		return 1;
 	}
@@ -1181,7 +1181,7 @@
 #endif
 
 	p->wire_count--;
-	cnt.v_wire_count--;
+	atomic_subtract_int(&cnt.v_wire_count, 1);
 	vm_page_free_zero(p);
 	vm_page_unlock_queues();
 	return 1;

==== //depot/projects/uart/amd64/amd64/pmap.c#4 (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.419 2003/07/03 20:18:01 alc Exp $
+ * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.420 2003/07/08 19:40:34 alc Exp $
  */
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -2119,7 +2119,7 @@
 			ptepa += NBPDR;
 			pde++;
 		}
-		pmap_invalidate_all(kernel_pmap);
+		pmap_invalidate_all(pmap);
 	}
 }
 

==== //depot/projects/uart/conf/NOTES#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1157 2003/06/28 05:47:34 scottl Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1161 2003/07/07 21:19:04 wollman Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -456,7 +456,7 @@
 #  The `ether' device provides generic code to handle
 #  Ethernets; it is MANDATORY when an Ethernet device driver is
 #  configured or token-ring is enabled.
-#  The 'wlan' device provides generic code to support 802.11
+#  The `wlan' device provides generic code to support 802.11
 #  drivers, including host AP mode; it is MANDATORY for the wi
 #  driver and will eventually be required by all 802.11 drivers.
 #  The `fddi' device provides generic code to support FDDI.
@@ -674,13 +674,13 @@
 # One of these is mandatory:
 options 	FFS			#Fast filesystem
 options 	NFSCLIENT		#Network File System
-options 	NFSSERVER		#Network File System
 
 # The rest are optional:
 options 	CD9660			#ISO 9660 filesystem
 options 	FDESCFS			#File descriptor filesystem
 options 	HPFS			#OS/2 File system
 options 	MSDOSFS			#MS DOS File System (FAT, FAT32)
+options 	NFSSERVER		#Network File System
 options 	NTFS			#NT File System
 options 	NULLFS			#NULL filesystem
 #options 	NWFS			#NetWare filesystem
@@ -727,8 +727,8 @@
 #
 # In order to manage swap, the system must reserve bitmap space that
 # scales with the largest mounted swap device multiplied by NSWAPDEV, 
-# irregardless of whether other swap devices exist or not.  So it
-# is not a good idea to make this value too large.
+# irrespective of whether other swap devices exist.  So it is not a
+# good idea to make this value too large.
 options 	NSWAPDEV=5
 
 # Disk quotas are supported when this option is enabled.
@@ -848,14 +848,15 @@
 # device drivers.  The host adapters are listed in the ISA and PCI
 # device configuration sections below.
 #
-# Beginning with FreeBSD 2.0.5 you can wire down your SCSI devices so
-# that a given bus, target, and LUN always come on line as the same
-# device unit.  In earlier versions the unit numbers were assigned
-# in the order that the devices were probed on the SCSI bus.  This
-# means that if you removed a disk drive, you may have had to rewrite
-# your /etc/fstab file, and also that you had to be careful when adding
-# a new disk as it may have been probed earlier and moved your device
-# configuration around.
+# It is possible to wire down your SCSI devices so that a given bus,
+# target, and LUN always come on line as the same device unit.  In
+# earlier versions the unit numbers were assigned in the order that
+# the devices were probed on the SCSI bus.  This means that if you
+# removed a disk drive, you may have had to rewrite your /etc/fstab
+# file, and also that you had to be careful when adding a new disk
+# as it may have been probed earlier and moved your device configuration
+# around.  (See also option GEOM_VOL for a different solution to this
+# problem.)
 
 # This old behavior is maintained as the default behavior.  The unit
 # assignment begins with the first non-wired down unit for a device

==== //depot/projects/uart/conf/files#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.801 2003/06/28 06:12:41 sam Exp $
+# $FreeBSD: src/sys/conf/files,v 1.802 2003/07/08 18:59:32 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -241,6 +241,7 @@
 dev/acpica/acpi_cmbat.c		optional acpi
 dev/acpica/acpi_cpu.c		optional acpi
 dev/acpica/acpi_ec.c		optional acpi
+dev/acpica/acpi_isab.c		optional acpi
 dev/acpica/acpi_lid.c		optional acpi
 dev/acpica/acpi_pci.c		optional acpi pci
 dev/acpica/acpi_pci_link.c	optional acpi pci

==== //depot/projects/uart/dev/pci/isa_pci.c#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/pci/isa_pci.c,v 1.7 2002/10/30 19:55:06 iedowse Exp $
+ *	$FreeBSD: src/sys/dev/pci/isa_pci.c,v 1.8 2003/07/08 18:56:58 jhb Exp $
  */
 
 /*
@@ -42,6 +42,7 @@
 #include <sys/bus.h>
 #include <sys/rman.h>
 
+#include <isa/isavar.h>
 #include <pci/pcivar.h>
 #include <pci/pcireg.h>
 
@@ -54,7 +55,7 @@
 };
 
 static int	isab_probe(device_t dev);
-static int	isab_attach(device_t dev);
+static int	pci_isab_attach(device_t dev);
 static int	isab_detach(device_t dev);
 static int	isab_resume(device_t dev);
 static int	isab_suspend(device_t dev);
@@ -62,7 +63,7 @@
 static device_method_t isab_methods[] = {
     /* Device interface */
     DEVMETHOD(device_probe,		isab_probe),
-    DEVMETHOD(device_attach,		isab_attach),
+    DEVMETHOD(device_attach,		pci_isab_attach),
     DEVMETHOD(device_detach,		isab_detach),
     DEVMETHOD(device_shutdown,		bus_generic_shutdown),
     DEVMETHOD(device_suspend,		isab_suspend),
@@ -86,8 +87,6 @@
     sizeof(struct isab_softc),
 };
 
-static devclass_t isab_devclass;
-
 DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0);
 
 /*
@@ -155,21 +154,17 @@
 }
 
 static int
-isab_attach(device_t dev)
+pci_isab_attach(device_t dev)
 {
-    device_t	child;
     struct isab_softc *sc = device_get_softc(dev);
     int error, rid;
 
     /*
      * Attach an ISA bus.  Note that we can only have one ISA bus.
      */
-    child = device_add_child(dev, "isa", 0);
-    if (child != NULL) {
-	error = bus_generic_attach(dev);
-	if (error)
-	     return (error);
-    }
+    error = isab_attach(dev);
+    if (error)
+	    return (error);
 
     switch (pci_get_devid(dev)) {
     case 0x71108086: /* Intel 82371AB */

==== //depot/projects/uart/dev/sound/pci/ich.c#4 (text+ko) ====

@@ -32,7 +32,7 @@
 #include <pci/pcireg.h>
 #include <pci/pcivar.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.30 2003/07/06 03:11:06 cg Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.31 2003/07/06 23:54:00 cg Exp $");
 
 /* -------------------------------------------------------------------- */
 
@@ -43,6 +43,7 @@
 
 #define SIS7012ID       0x70121039      /* SiS 7012 needs special handling */
 #define ICH4ID		0x24c58086	/* ICH4 needs special handling too */
+#define ICH5ID		0x24d58086	/* ICH5 needs to be treated as ICH4 */
 
 /* buffer descriptor */
 struct ich_desc {
@@ -577,8 +578,8 @@
 	stat = ich_rd(sc, ICH_REG_GLOB_STA, 4);
 
 	if ((stat & ICH_GLOB_STA_PCR) == 0) {
-		/* ICH4 may fail when busmastering is enabled. Continue */
-		if (pci_get_devid(sc->dev) != ICH4ID) {
+		/* ICH4/ICH5 may fail when busmastering is enabled. Continue */
+		if ((pci_get_devid(sc->dev) != ICH4ID) && (pci_get_devid(sc->dev) != ICH5ID)) {
 			return ENXIO;
 		}
 	}
@@ -628,7 +629,11 @@
 
 	case ICH4ID:
 		device_set_desc(dev, "Intel ICH4 (82801DB)");
-		return 0;
+		return -1000;	/* allow a better driver to override us */
+
+	case ICH5ID:
+		device_set_desc(dev, "Intel ICH5 (82801EB)");
+		return -1000;	/* allow a better driver to override us */
 
 	case SIS7012ID:
 		device_set_desc(dev, "SiS 7012");
@@ -682,15 +687,15 @@
 	 * By default, ich4 has NAMBAR and NABMBAR i/o spaces as
 	 * read-only.  Need to enable "legacy support", by poking into
 	 * pci config space.  The driver should use MMBAR and MBBAR,
-	 * but doing so will mess things up here.  ich4 has enough new
-	 * features it warrants it's own driver.
+	 * but doing so will mess things up here.  ich4/5 have enough new
+	 * features to warrant a seperate driver.
 	 */
-	if (pci_get_devid(dev) == ICH4ID) {
+	if ((pci_get_devid(dev) == ICH4ID) || (pci_get_devid(dev) == ICH5ID)) {
 		pci_write_config(dev, PCIR_ICH_LEGACY, ICH_LEGACY_ENABLE, 1);
 	}
 
 	/*
-	 * Enable bus master. On ich4 this may prevent the detection of
+	 * Enable bus master. On ich4/5 this may prevent the detection of
 	 * the primary codec becoming ready in ich_init().
 	 */
 	pci_enable_busmaster(dev);
@@ -712,7 +717,7 @@
 
 	sc->bufsz = pcm_getbuffersize(dev, 4096, ICH_DEFAULT_BUFSZ, ICH_MAX_BUFSZ);
 	if (bus_dma_tag_create(NULL, 8, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
-			       NULL, NULL, sc->bufsz, 1, 0x3ffff, 0, 
+			       NULL, NULL, sc->bufsz, 1, 0x3ffff, 0,
 			       busdma_lock_mutex, &Giant, &sc->dmat) != 0) {
 		device_printf(dev, "unable to create dma tag\n");
 		goto bad;
@@ -811,7 +816,7 @@
 	struct sc_info *sc;
 	int i;
 
-	sc = pcm_getdevinfo(dev);	
+	sc = pcm_getdevinfo(dev);
 	for (i = 0 ; i < 3; i++) {
 		sc->ch[i].run_save = sc->ch[i].run;
 		if (sc->ch[i].run) {

==== //depot/projects/uart/dev/sound/pcm/feeder.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
 
 #include "feeder_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.29 2003/03/05 14:48:28 orion Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.30 2003/07/07 17:40:02 cg Exp $");
 
 MALLOC_DEFINE(M_FEEDER, "feeder", "pcm feeder");
 
@@ -194,11 +194,13 @@
 
 	nf->source = c->feeder;
 
+	/* XXX we should use the lowest common denominator for align */
 	if (nf->align > 0)
 		c->align += nf->align;
 	else if (nf->align < 0 && c->align < -nf->align)
 		c->align = -nf->align;
-
+	if (c->feeder != NULL)
+		c->feeder->parent = nf;
 	c->feeder = nf;
 
 	return 0;
@@ -372,6 +374,20 @@
 	return (c->direction == PCMDIR_REC)? best : c->feeder->desc->out;
 }
 
+void
+feeder_printchain(struct pcm_feeder *head)
+{
+	struct pcm_feeder *f;
+
+	printf("feeder chain (head @%p)\n", head);
+	f = head;
+	while (f != NULL) {
+		printf("%s/%d @ %p\n", f->class->name, f->desc->idx, f);
+		f = f->source;
+	}
+	printf("[end]\n\n");
+}
+
 /*****************************************************************************/
 
 static int

==== //depot/projects/uart/dev/sound/pcm/feeder.h#2 (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/sound/pcm/feeder.h,v 1.8 2002/01/26 22:13:24 cg Exp $
+ * $FreeBSD: src/sys/dev/sound/pcm/feeder.h,v 1.9 2003/07/07 17:40:02 cg Exp $
  */
 
 struct pcm_feederdesc {
@@ -57,6 +57,7 @@
 int chn_addfeeder(struct pcm_channel *c, struct feeder_class *fc, struct pcm_feederdesc *desc);
 int chn_removefeeder(struct pcm_channel *c);
 struct pcm_feeder *chn_findfeeder(struct pcm_channel *c, u_int32_t type);
+void feeder_printchain(struct pcm_feeder *head);
 
 #define FEEDER_DECLARE(feeder, palign, pdata) \
 static struct feeder_class feeder ## _class = { \

==== //depot/projects/uart/dev/usb/umct.c#3 (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/usb/umct.c,v 1.2 2003/07/04 01:50:39 jmg Exp $
+ *	$FreeBSD: src/sys/dev/usb/umct.c,v 1.3 2003/07/07 18:01:23 wpaul Exp $
  */
 
 /*
@@ -241,7 +241,10 @@
 
 		if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) {
 			ucom->sc_bulkout_no = ed->bEndpointAddress;
-			ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
+			if (uaa->product == USB_PRODUCT_MCT_SITECOM_USB232)
+				ucom->sc_obufsize = 16; /* device is broken */
+			else
+				ucom->sc_obufsize = UGETW(ed->wMaxPacketSize);
 			continue;
 		}
 

==== //depot/projects/uart/dev/wi/if_wi_pccard.c#2 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi_pccard.c,v 1.28 2003/06/28 06:17:26 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi_pccard.c,v 1.29 2003/07/07 07:57:35 imp Exp $");
 
 #include "opt_wi.h"
 
@@ -137,6 +137,7 @@
 	PCMCIA_CARD(COREGA, WIRELESS_LAN_PCC_11, 0),
 	PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCA_11, 0),
 	PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCB_11, 0),
+	PCMCIA_CARD(COREGA, WIRELESS_LAN_PCCL_11, 0),
 	PCMCIA_CARD(DLINK, DWL650H, 0),
 	PCMCIA_CARD(ELSA, XI300_IEEE, 0),
 	PCMCIA_CARD(ELSA, XI325_IEEE, 0),

==== //depot/projects/uart/geom/geom_dump.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/geom_dump.c,v 1.28 2003/06/11 06:49:15 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/geom_dump.c,v 1.29 2003/07/08 21:12:40 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/sbuf.h>
@@ -114,6 +114,8 @@
 	struct g_provider *pp;
 	struct g_consumer *cp;
 
+	if (gp->flags & G_GEOM_WITHER)
+		return;
 	LIST_FOREACH(pp, &gp->provider, provider) {
 		sbuf_printf(sb, "%d %s %s %ju %u", level, gp->class->name,
 		    pp->name, (uintmax_t)pp->mediasize, pp->sectorsize);
@@ -162,7 +164,9 @@
 		sbuf_printf(sb, "\t  <provider ref=\"%p\"/>\n", cp->provider);
 	sbuf_printf(sb, "\t  <mode>r%dw%de%d</mode>\n",
 	    cp->acr, cp->acw, cp->ace);
-	if (cp->geom->dumpconf != NULL) {
+	if (cp->geom->flags & G_GEOM_WITHER)
+		;
+	else if (cp->geom->dumpconf != NULL) {
 		sbuf_printf(sb, "\t  <config>\n");
 		cp->geom->dumpconf(sb, "\t    ", cp->geom, cp, NULL);
 		sbuf_printf(sb, "\t  </config>\n");
@@ -182,7 +186,9 @@
 	sbuf_printf(sb, "\t  <mediasize>%jd</mediasize>\n",
 	    (intmax_t)pp->mediasize);
 	sbuf_printf(sb, "\t  <sectorsize>%u</sectorsize>\n", pp->sectorsize);
-	if (pp->geom->dumpconf != NULL) {
+	if (pp->geom->flags & G_GEOM_WITHER)
+		;
+	else if (pp->geom->dumpconf != NULL) {
 		sbuf_printf(sb, "\t  <config>\n");
 		pp->geom->dumpconf(sb, "\t    ", pp->geom, NULL, pp);
 		sbuf_printf(sb, "\t  </config>\n");
@@ -201,7 +207,9 @@
 	sbuf_printf(sb, "      <class ref=\"%p\"/>\n", gp->class);
 	sbuf_printf(sb, "      <name>%s</name>\n", gp->name);
 	sbuf_printf(sb, "      <rank>%d</rank>\n", gp->rank);
-	if (gp->dumpconf != NULL) {
+	if (gp->flags & G_GEOM_WITHER)
+		sbuf_printf(sb, "      <wither/>\n");
+	else if (gp->dumpconf != NULL) {
 		sbuf_printf(sb, "      <config>\n");
 		gp->dumpconf(sb, "\t", gp, NULL, NULL);
 		sbuf_printf(sb, "      </config>\n");

==== //depot/projects/uart/i386/i386/pmap.c#4 (text+ko) ====

@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.416 2003/07/04 22:13:39 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.417 2003/07/08 19:40:35 alc Exp $");
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
  * All rights reserved.
@@ -2264,7 +2264,7 @@
 			ptepa += NBPDR;
 			ptepindex += 1;
 		}
-		pmap_invalidate_all(kernel_pmap);
+		pmap_invalidate_all(pmap);
 	}
 }
 

==== //depot/projects/uart/i386/i386/sys_machdep.c#2 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/sys_machdep.c,v 1.83 2003/06/15 00:31:23 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/sys_machdep.c,v 1.84 2003/07/08 00:14:30 davidxu Exp $");
 
 #include "opt_kstack_pages.h"
 #include "opt_mac.h"
@@ -289,9 +289,7 @@
 	if (td->td_proc != curthread->td_proc)
 		return;
 
-	mtx_lock_spin(&sched_lock);
 	set_user_ldt(&td->td_proc->p_md);
-	mtx_unlock_spin(&sched_lock);
 }
 #endif
 
@@ -462,9 +460,6 @@
 #endif
 		} else {
 			mdp->md_ldt = pldt = new_ldt;
-#ifdef SMP
-			mtx_unlock_spin(&sched_lock);
-#endif
 		}
 #ifdef SMP
 		/* signal other cpus to reload ldt */
@@ -472,8 +467,8 @@
 		    NULL, td);
 #else
 		set_user_ldt(mdp);
+#endif
 		mtx_unlock_spin(&sched_lock);
-#endif
 	}
 
 	descs_size = uap->num * sizeof(union descriptor);

==== //depot/projects/uart/isa/isa_common.c#2 (text+ko) ====

@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/isa/isa_common.c,v 1.35 2003/06/11 00:32:45 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/isa/isa_common.c,v 1.36 2003/07/08 18:56:58 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1117,3 +1117,20 @@
 DRIVER_MODULE(isa, legacy, isa_driver, isa_devclass, 0, 0);
 #endif
 MODULE_VERSION(isa, 1);
+
+/*
+ * Code common to ISA bridges.
+ */
+
+devclass_t isab_devclass;
+
+int
+isab_attach(device_t dev)
+{
+	device_t child;
+
+	child = device_add_child(dev, "isa", 0);
+	if (child != NULL)
+		return (bus_generic_attach(dev));
+	return (ENXIO);
+}

==== //depot/projects/uart/isa/isavar.h#2 (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/isa/isavar.h,v 1.24 2002/10/15 00:02:51 jhb Exp $
+ * $FreeBSD: src/sys/isa/isavar.h,v 1.25 2003/07/08 18:56:58 jhb Exp $
  */
 
 #ifndef _ISA_ISAVAR_H_
@@ -152,6 +152,9 @@
 ISA_ACCESSOR(compatid, COMPATID, int)
 ISA_ACCESSOR(configattr, CONFIGATTR, int)
 
+/* Device class for ISA bridges. */
+extern devclass_t isab_devclass;
+
 extern intrmask_t isa_irq_pending(void);
 extern void	isa_probe_children(device_t dev);
 
@@ -164,6 +167,8 @@
 extern int	isa_dmastatus(int chan);
 extern int	isa_dmastop(int chan);
 
+int	isab_attach(device_t dev);
+
 #ifdef PC98
 #include <machine/bus.h>
 

==== //depot/projects/uart/isa/psm.c#3 (text+ko) ====

@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/isa/psm.c,v 1.59 2003/07/01 14:41:16 mikeh Exp $");
+__FBSDID("$FreeBSD: src/sys/isa/psm.c,v 1.60 2003/07/07 05:40:13 mikeh Exp $");
 
 #include "opt_psm.h"
 
@@ -1040,6 +1040,10 @@
 	/*
 	 * NOTE: some controllers appears to hang the `keyboard' when the aux
 	 * port doesn't exist and `PSMC_RESET_DEV' is issued.
+	 *
+	 * Attempt to reset the controller twice -- this helps
+	 * pierce through some KVM switches. The second reset
+	 * is non-fatal.
 	 */
 	if (!reset_aux_dev(sc->kbdc)) {
             recover_from_error(sc->kbdc);
@@ -1047,6 +1051,11 @@
             if (verbose)
         	printf("psm%d: failed to reset the aux device.\n", unit);
             endprobe(ENXIO);
+	} else if (!reset_aux_dev(sc->kbdc)) {
+	    recover_from_error(sc->kbdc);
+	    if (verbose >= 2)
+        	printf("psm%d: failed to reset the aux device (2).\n",
+        	    unit);
 	}
     }
 

==== //depot/projects/uart/kern/sched_ule.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.51 2003/07/04 19:59:00 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.53 2003/07/08 06:19:40 jeff Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -237,7 +237,7 @@
 int sched_pickcpu(void);
 
 /* Operations on per processor queues */
-static struct kse * kseq_choose(struct kseq *kseq);
+static struct kse * kseq_choose(struct kseq *kseq, int steal);
 static void kseq_setup(struct kseq *kseq);
 static void kseq_add(struct kseq *kseq, struct kse *ke);
 static void kseq_rem(struct kseq *kseq, struct kse *ke);
@@ -455,7 +455,7 @@
 {
 	struct kse *ke;
 
-	ke = kseq_choose(from);
+	ke = kseq_choose(from, 1);
 	runq_remove(ke->ke_runq, ke);
 	ke->ke_state = KES_THREAD;
 	kseq_rem(from, ke);
@@ -465,8 +465,14 @@
 }
 #endif
 
+/*
+ * Pick the highest priority task we have and return it.   If steal is 1 we
+ * will return kses that have been denied slices due to their nice being too
+ * low.  In the future we should prohibit stealing interrupt threads as well.
+ */
+
 struct kse *
-kseq_choose(struct kseq *kseq)
+kseq_choose(struct kseq *kseq, int steal)
 {
 	struct kse *ke;
 	struct runq *swap;
@@ -492,7 +498,7 @@
 		 * TIMESHARE kse group and its nice was too far out
 		 * of the range that receives slices. 
 		 */
-		if (ke->ke_slice == 0) {
+		if (ke->ke_slice == 0 && steal == 0) {
 			runq_remove(ke->ke_runq, ke);
 			sched_slice(ke);
 			ke->ke_runq = kseq->ksq_next;
@@ -528,7 +534,9 @@
 static void
 sched_setup(void *dummy)
 {
+#ifdef SMP
 	int i;
+#endif
 
 	slice_min = (hz/100);	/* 10ms */
 	slice_max = (hz/7);	/* ~140ms */
@@ -1060,7 +1068,7 @@
 	 */
 	kseq = KSEQ_SELF();
 #if 0
-	if (kseq->ksq_load > 1 && (nke = kseq_choose(kseq)) != NULL) {
+	if (kseq->ksq_load > 1 && (nke = kseq_choose(kseq, 0)) != NULL) {
 		if (sched_strict &&
 		    nke->ke_thread->td_priority < td->td_priority)
 			td->td_flags |= TDF_NEEDRESCHED;
@@ -1157,7 +1165,7 @@
 #else
 		    kseq->ksq_load > 1 &&
 #endif
-		    (ke = kseq_choose(kseq)) != NULL &&
+		    (ke = kseq_choose(kseq, 0)) != NULL &&
 		    ke->ke_thread->td_priority < td->td_priority)
 			curthread->td_flags |= TDF_NEEDRESCHED;
 		mtx_unlock_spin(&sched_lock);
@@ -1175,7 +1183,7 @@
 retry:
 #endif
 	kseq = KSEQ_SELF();
-	ke = kseq_choose(kseq);
+	ke = kseq_choose(kseq, 0);
 	if (ke) {
 		runq_remove(ke->ke_runq, ke);
 		ke->ke_state = KES_THREAD;

==== //depot/projects/uart/kern/subr_param.c#2 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_param.c,v 1.56 2003/06/11 00:56:57 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_param.c,v 1.58 2003/07/08 18:59:21 silby Exp $");
 
 #include "opt_param.h"
 #include "opt_maxusers.h"
@@ -77,6 +77,9 @@
 int	nswbuf;
 int	maxswzone;			/* max swmeta KVA storage */
 int	maxbcache;			/* max buffer cache KVA storage */
+int	maxpipes;			/* Limit on # of pipes */
+int	maxpipekva;			/* Limit on pipe KVA */
+int	maxpipekvawired;		/* Limit on wired pipe KVA */
 u_quad_t	maxtsiz;			/* max text size */
 u_quad_t	dfldsiz;			/* initial data size limit */
 u_quad_t	maxdsiz;			/* max data size */
@@ -132,6 +135,23 @@
 init_param2(long physpages)
 {
 
+	/* Kernel map size */
+	int kmempages, kmemtunable;
+	kmempages = VM_KMEM_SIZE / PAGE_SIZE;
+#if defined(VM_KMEM_SIZE_SCALE)
+        if ((physpages / VM_KMEM_SIZE_SCALE) > kmempages)
+                kmempages = (physpages / VM_KMEM_SIZE_SCALE);
+#endif   
+      
+#if defined(VM_KMEM_SIZE_MAX)
+        if (kmempages * PAGE_SIZE >= VM_KMEM_SIZE_MAX)
+                kmempages = VM_KMEM_SIZE_MAX / PAGE_SIZE;
+#endif
+	kmemtunable = 0;
+	TUNABLE_INT_FETCH("kern.vm.kmem.size", &kmemtunable);
+	if (kmemtunable != 0)
+		kmempages = kmemtunable / PAGE_SIZE;
+	kmempages = min(physpages, kmempages);
 	/* Base parameters */
 	maxusers = MAXUSERS;
 	TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
@@ -161,6 +181,23 @@
 	maxfilesperproc = (maxfiles * 9) / 10;
 
 	/*
+	 * Limit number of pipes to a reasonable fraction of kmap entries,
+	 * pageable pipe memory usage to 2.5% of the kernel map, and wired
+	 * pipe memory usage to 1% of the same.  Ensure that all have
+	 * reasonable floors.  (See sys_pipe.c for more info.)
+	 */
+	maxpipes = kmempages / 5;
+	maxpipekva = (kmempages / 40) * PAGE_SIZE;
+	maxpipekvawired = (kmempages / 100) * PAGE_SIZE;
+
+	if (maxpipes < 128)
+		maxpipes = 128;
+	if (maxpipekva < 512 * 1024)
+		maxpipekva = 512 * 1024;
+	if (maxpipekvawired < 512 * 1024)
+		maxpipekvawired = 512 * 1024;
+	
+	/*
 	 * Cannot be changed after boot.
 	 */
 	nbuf = NBUF;

==== //depot/projects/uart/kern/sys_pipe.c#2 (text+ko) ====

@@ -45,10 +45,32 @@
  * happen for small transfers so that the system will not spend all of
  * its time context switching.  PIPE_SIZE is constrained by the
  * amount of kernel virtual memory.
+ *
+ * In order to limit the resource use of pipes, three sysctls exist:
+ *
+ * kern.ipc.maxpipes - A limit on the total number of pipes in the system.
+ * Note that since pipes are bidirectional, the effective value is this
+ * number divided by two.
+ *
+ * kern.ipc.maxpipekva - This value limits the amount of pageable memory that
+ * can be used by pipes.  Whenever the amount in use exceeds this value,
+ * all new pipes will be SMALL_PIPE_SIZE in size, rather than PIPE_SIZE.
+ * Big pipe creation will be limited as well.
+ *
+ * kern.ipc.maxpipekvawired - This value limits the amount of memory that may
+ * be wired in order to facilitate direct copies using page flipping.
+ * Whenever this value is exceeded, pipes will fall back to using regular
+ * copies.
+ *
+ * These values are autotuned in subr_param.c.
+ *
+ * Memory usage may be monitored through the sysctls
+ * kern.ipc.pipes, kern.ipc.pipekva and kern.ipc.pipekvawired.
+ *
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sys_pipe.c,v 1.137 2003/06/18 18:16:39 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sys_pipe.c,v 1.138 2003/07/08 04:02:31 silby Exp $");
 
 #include "opt_mac.h"
 
@@ -68,6 +90,7 @@
 #include <sys/poll.h>
 #include <sys/selinfo.h>
 #include <sys/signalvar.h>
+#include <sys/sysctl.h>
 #include <sys/sysproto.h>
 #include <sys/pipe.h>
 #include <sys/proc.h>
@@ -148,25 +171,30 @@
 #define MAXPIPESIZE (2*PIPE_SIZE/3)
 
 /*
- * Maximum amount of kva for pipes -- this is kind-of a soft limit, but
- * is there so that on large systems, we don't exhaust it.
- */
-#define MAXPIPEKVA (8*1024*1024)
-
-/*
- * Limit for direct transfers, we cannot, of course limit
- * the amount of kva for pipes in general though.
- */
-#define LIMITPIPEKVA (16*1024*1024)
-
-/*
  * Limit the number of "big" pipes
  */
 #define LIMITBIGPIPES	32
 static int nbigpipe;
 
+static int amountpipes;
 static int amountpipekva;
+static int amountpipekvawired;
 
+SYSCTL_DECL(_kern_ipc);
+
+SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipes, CTLFLAG_RW,
+	   &maxpipes, 0, "");
+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, "");
+SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
+	   &amountpipekva, 0, "Pipe KVA usage");
+SYSCTL_INT(_kern_ipc, OID_AUTO, pipekvawired, CTLFLAG_RD,
+	   &amountpipekvawired, 0, "Pipe wired KVA usage");
+
 static void pipeinit(void *dummy __unused);
 static void pipeclose(struct pipe *cpipe);
 static void pipe_free_kmem(struct pipe *cpipe);
@@ -303,11 +331,19 @@
 	struct vm_object *object;
 	caddr_t buffer;
 	int npages, error;
+	static int curfail = 0;
+	static struct timeval lastfail;
 
 	GIANT_REQUIRED;
 	KASSERT(cpipe->pipe_mtxp == NULL || !mtx_owned(PIPE_MTX(cpipe)),
 	       ("pipespace: pipe mutex locked"));
 
+	if (amountpipes > maxpipes) {
+		if (ppsratecheck(&lastfail, &curfail, 1))
+			printf("kern.maxpipes exceeded, please see tuning(7).\n");
+		return (ENOMEM);
+	}
+
 	npages = round_page(size)/PAGE_SIZE;
 	/*
 	 * Create an object, I don't like the idea of paging to/from
@@ -339,6 +375,7 @@
 	cpipe->pipe_buffer.in = 0;
 	cpipe->pipe_buffer.out = 0;
 	cpipe->pipe_buffer.cnt = 0;
+	atomic_add_int(&amountpipes, 1);
 	atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size);
 	return (0);
 }
@@ -385,7 +422,13 @@
 #endif
 
 	cpipe->pipe_mtxp = NULL;	/* avoid pipespace assertion */
-	error = pipespace(cpipe, PIPE_SIZE);
+	/*
+	 * Reduce to 1/4th pipe size if we're over our global max.
+	 */
+	if (amountpipekva > maxpipekva)
+		error = pipespace(cpipe, SMALL_PIPE_SIZE);
+	else
+		error = pipespace(cpipe, PIPE_SIZE);
 	if (error)
 		return (error);
 
@@ -654,8 +697,11 @@
 			int j;
 
 			vm_page_lock_queues();
-			for (j = 0; j < i; j++)
+			for (j = 0; j < i; j++) {
 				vm_page_unwire(wpipe->pipe_map.ms[j], 1);
+				atomic_subtract_int(&amountpipekvawired,
+					 	    PAGE_SIZE);
+			}
 			vm_page_unlock_queues();
 			return (EFAULT);
 		}
@@ -663,6 +709,7 @@
 		m = PHYS_TO_VM_PAGE(paddr);
 		vm_page_lock_queues();
 		vm_page_wire(m);
+		atomic_add_int(&amountpipekvawired, PAGE_SIZE);
 		vm_page_unlock_queues();
 		wpipe->pipe_map.ms[i] = m;
 	}
@@ -719,7 +766,7 @@
 	if (wpipe->pipe_map.kva) {
 		pmap_qremove(wpipe->pipe_map.kva, wpipe->pipe_map.npages);
 
-		if (amountpipekva > MAXPIPEKVA) {
+		if (amountpipekva > maxpipekva) {
 			vm_offset_t kva = wpipe->pipe_map.kva;
 			wpipe->pipe_map.kva = 0;
 			kmem_free(kernel_map, kva,
@@ -729,8 +776,10 @@
 		}
 	}
 	vm_page_lock_queues();
-	for (i = 0; i < wpipe->pipe_map.npages; i++)
+	for (i = 0; i < wpipe->pipe_map.npages; i++) {
 		vm_page_unwire(wpipe->pipe_map.ms[i], 1);
+		atomic_subtract_int(&amountpipekvawired, PAGE_SIZE);
+	}
 	vm_page_unlock_queues();
 	wpipe->pipe_map.npages = 0;
 }
@@ -904,6 +953,7 @@
 	 * so.
 	 */
 	if ((uio->uio_resid > PIPE_SIZE) &&
+		(amountpipekva < maxpipekva) &&
 		(nbigpipe < LIMITBIGPIPES) &&
 		(wpipe->pipe_state & PIPE_DIRECTW) == 0 &&
 		(wpipe->pipe_buffer.size <= PIPE_SIZE) &&
@@ -950,7 +1000,7 @@

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


More information about the p4-projects mailing list