PERFORCE change 100286 for review

John Baldwin jhb at FreeBSD.org
Thu Jun 29 14:42:14 UTC 2006


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

Change 100286 by jhb at jhb_mutex on 2006/06/29 14:04:43

	IFC @100284.

Affected files ...

.. //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#48 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-all.h#48 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#68 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-cd.c#63 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bge.c#77 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bgereg.h#43 integrate
.. //depot/projects/smpng/sys/dev/re/if_re.c#41 integrate
.. //depot/projects/smpng/sys/dev/usb/uplcom.c#25 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#91 integrate
.. //depot/projects/smpng/sys/fs/pseudofs/pseudofs_vnops.c#46 integrate
.. //depot/projects/smpng/sys/i386/conf/XBOX#6 integrate
.. //depot/projects/smpng/sys/kern/sched_core.c#3 integrate
.. //depot/projects/smpng/sys/net/if_enc.c#2 integrate
.. //depot/projects/smpng/sys/net/if_gif.c#34 integrate
.. //depot/projects/smpng/sys/net/if_vlan.c#49 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.c#65 integrate
.. //depot/projects/smpng/sys/netinet/ip_fw2.c#73 integrate
.. //depot/projects/smpng/sys/netinet/ip_output.c#85 integrate
.. //depot/projects/smpng/sys/netinet/tcp_input.c#88 integrate
.. //depot/projects/smpng/sys/netinet6/in6_pcb.c#44 integrate
.. //depot/projects/smpng/sys/pci/if_rlreg.h#31 integrate

Differences ...

==== //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#48 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.95 2006/06/12 18:14:49 des Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.96 2006/06/27 20:11:58 netchild Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -63,6 +63,7 @@
 #include <sys/socket.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
+#include <sys/time.h>
 #include <sys/tty.h>
 #include <sys/user.h>
 #include <sys/vmmeter.h>
@@ -106,6 +107,22 @@
 #define P2B(x) ((x) << PAGE_SHIFT)			/* pages to bytes */
 #define P2K(x) ((x) << (PAGE_SHIFT - 10))		/* pages to kbytes */
 
+/**
+ * @brief Mapping of ki_stat in struct kinfo_proc to the linux state
+ *
+ * The linux procfs state field displays one of the characters RSDZTW to
+ * denote running, sleeping in an interruptible wait, waiting in an
+ * uninteruptible disk sleep, a zombie process, process is being traced
+ * or stopped, or process is paging respectively.
+ *
+ * Our struct kinfo_proc contains the variable ki_stat which contains a
+ * value out of SIDL, SRUN, SSLEEP, SSTOP, SZOMB, SWAIT and SLOCK.
+ *
+ * This character array is used with ki_stati-1 as an index and tries to
+ * map our states to suitable linux states.
+ */
+static char *linux_state = "RRSTZDD";
+
 /*
  * Filler function for proc/meminfo
  */
@@ -451,44 +468,51 @@
 	sbuf_printf(sb, "%d", p->p_pid);
 #define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
 	PS_ADD("comm",		"(%s)",	p->p_comm);
-	PS_ADD("statr",		"%c",	'0'); /* XXX */
+	KASSERT(kp.ki_stat <= sizeof(linux_state),
+		("linprocfs: don't know how to handle unknown FreeBSD state"));
+	PS_ADD("state",		"%c",	linux_state[kp.ki_stat - 1]);
 	PS_ADD("ppid",		"%d",	p->p_pptr ? p->p_pptr->p_pid : 0);
 	PS_ADD("pgrp",		"%d",	p->p_pgid);
 	PS_ADD("session",	"%d",	p->p_session->s_sid);
 	PROC_UNLOCK(p);
 	PS_ADD("tty",		"%d",	0); /* XXX */
-	PS_ADD("tpgid",		"%d",	0); /* XXX */
+	PS_ADD("tpgid",		"%d",	kp.ki_tpgid);
 	PS_ADD("flags",		"%u",	0); /* XXX */
-	PS_ADD("minflt",	"%u",	0); /* XXX */
-	PS_ADD("cminflt",	"%u",	0); /* XXX */
-	PS_ADD("majflt",	"%u",	0); /* XXX */
-	PS_ADD("cminflt",	"%u",	0); /* XXX */
-	PS_ADD("utime",		"%d",	0); /* XXX */
-	PS_ADD("stime",		"%d",	0); /* XXX */
-	PS_ADD("cutime",	"%d",	0); /* XXX */
-	PS_ADD("cstime",	"%d",	0); /* XXX */
-	PS_ADD("counter",	"%d",	0); /* XXX */
-	PS_ADD("priority",	"%d",	0); /* XXX */
-	PS_ADD("timeout",	"%u",	0); /* XXX */
-	PS_ADD("itrealvalue",	"%u",	0); /* XXX */
-	PS_ADD("starttime",	"%d",	0); /* XXX */
-	PS_ADD("vsize",		"%ju",	(uintmax_t)kp.ki_size);
-	PS_ADD("rss",		"%ju",	P2K((uintmax_t)kp.ki_rssize));
-	PS_ADD("rlim",		"%u",	0); /* XXX */
+	PS_ADD("minflt",	"%lu",	kp.ki_rusage.ru_minflt);
+	PS_ADD("cminflt",	"%lu",	kp.ki_rusage_ch.ru_minflt);
+	PS_ADD("majflt",	"%lu",	kp.ki_rusage.ru_majflt);
+	PS_ADD("cmajflt",	"%lu",	kp.ki_rusage_ch.ru_majflt);
+	PS_ADD("utime",		"%ld",	T2J(tvtohz(&kp.ki_rusage.ru_utime)));
+	PS_ADD("stime",		"%ld",	T2J(tvtohz(&kp.ki_rusage.ru_stime)));
+	PS_ADD("cutime",	"%ld",	T2J(tvtohz(&kp.ki_rusage_ch.ru_utime)));
+	PS_ADD("cstime",	"%ld",	T2J(tvtohz(&kp.ki_rusage_ch.ru_stime)));
+	PS_ADD("priority",	"%d",	kp.ki_pri.pri_user);
+	PS_ADD("nice",		"%d",	kp.ki_nice); /* 19 (nicest) to -19 */
+	PS_ADD("0",		"%d",	0); /* removed field */
+	PS_ADD("itrealvalue",	"%d",	0); /* XXX */
+	/* XXX: starttime is not right, it is the _same_ for _every_ process.
+	   It should be the number of jiffies between system boot and process
+	   start. */
+	PS_ADD("starttime",	"%lu",	T2J(tvtohz(&kp.ki_start)));
+	PS_ADD("vsize",		"%ju",	P2K((uintmax_t)kp.ki_size));
+	PS_ADD("rss",		"%ju",	(uintmax_t)kp.ki_rssize);
+	PS_ADD("rlim",		"%lu",	kp.ki_rusage.ru_maxrss);
 	PS_ADD("startcode",	"%u",	(unsigned)0);
 	PS_ADD("endcode",	"%u",	0); /* XXX */
 	PS_ADD("startstack",	"%u",	0); /* XXX */
-	PS_ADD("esp",		"%u",	0); /* XXX */
-	PS_ADD("eip",		"%u",	0); /* XXX */
-	PS_ADD("signal",	"%d",	0); /* XXX */
-	PS_ADD("blocked",	"%d",	0); /* XXX */
-	PS_ADD("sigignore",	"%d",	0); /* XXX */
-	PS_ADD("sigcatch",	"%d",	0); /* XXX */
+	PS_ADD("kstkesp",	"%u",	0); /* XXX */
+	PS_ADD("kstkeip",	"%u",	0); /* XXX */
+	PS_ADD("signal",	"%u",	0); /* XXX */
+	PS_ADD("blocked",	"%u",	0); /* XXX */
+	PS_ADD("sigignore",	"%u",	0); /* XXX */
+	PS_ADD("sigcatch",	"%u",	0); /* XXX */
 	PS_ADD("wchan",		"%u",	0); /* XXX */
-	PS_ADD("nswap",		"%lu",	(long unsigned)0); /* XXX */
-	PS_ADD("cnswap",	"%lu",	(long unsigned)0); /* XXX */
+	PS_ADD("nswap",		"%lu",	kp.ki_rusage.ru_nswap);
+	PS_ADD("cnswap",	"%lu",	kp.ki_rusage_ch.ru_nswap);
 	PS_ADD("exitsignal",	"%d",	0); /* XXX */
-	PS_ADD("processor",	"%d",	0); /* XXX */
+	PS_ADD("processor",	"%u",	kp.ki_lastcpu);
+	PS_ADD("rt_priority",	"%u",	0); /* XXX */ /* >= 2.5.19 */
+	PS_ADD("policy",	"%u",	kp.ki_pri.pri_class); /* >= 2.5.19 */
 #undef PS_ADD
 	sbuf_putc(sb, '\n');
 

==== //depot/projects/smpng/sys/dev/ata/ata-all.h#48 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.117 2006/03/31 08:09:04 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.118 2006/06/28 09:59:09 sos Exp $
  */
 
 /* ATA register defines */
@@ -149,6 +149,8 @@
 /* SATA AHCI v1.0 register defines */
 #define ATA_AHCI_CAP                    0x00
 #define         ATA_AHCI_NPMASK         0x1f
+#define		ATA_AHCI_CAP_CLO	0x01000000
+#define		ATA_AHCI_CAP_64BIT	0x80000000
 
 #define ATA_AHCI_GHC                    0x04
 #define         ATA_AHCI_GHC_AE         0x80000000

==== //depot/projects/smpng/sys/dev/ata/ata-chipset.c#68 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.163 2006/06/19 11:47:57 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.164 2006/06/28 09:59:09 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -59,6 +59,7 @@
 static void ata_sata_phy_event(void *context, int dummy);
 static int ata_sata_connect(struct ata_channel *ch);
 static void ata_sata_setmode(device_t dev, int mode);
+static int ata_ahci_chipinit(device_t dev);
 static int ata_ahci_allocate(device_t dev);
 static int ata_ahci_status(device_t dev);
 static int ata_ahci_begin_transaction(struct ata_request *request);
@@ -394,6 +395,54 @@
 
 
 static int
+ata_ahci_chipinit(device_t dev)
+{
+    struct ata_pci_controller *ctlr = device_get_softc(dev);
+    u_int32_t version;
+
+    /* reset AHCI controller */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
+	     ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_HR);
+    DELAY(1000000);
+    if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) {
+	bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
+	device_printf(dev, "AHCI controller reset failure\n");
+	return ENXIO;
+    }
+
+    /* enable AHCI mode */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
+	     ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_AE);
+
+    /* get the number of HW channels */
+    ctlr->channels = (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_NPMASK)+1;
+
+    /* clear interrupts */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_IS, ATA_INL(ctlr->r_res2, ATA_AHCI_IS));
+
+    /* enable AHCI interrupts */
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
+	     ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_IE);
+
+    ctlr->reset = ata_ahci_reset;
+    ctlr->dmainit = ata_ahci_dmainit;
+    ctlr->allocate = ata_ahci_allocate;
+    ctlr->setmode = ata_sata_setmode;
+
+    /* enable PCI interrupt */
+    pci_write_config(dev, PCIR_COMMAND,
+		     pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2);
+
+    /* announce we support the HW */
+    version = ATA_INL(ctlr->r_res2, ATA_AHCI_VS);
+    device_printf(dev,
+		  "AHCI Version %x%x.%x%x controller with %d ports detected\n",
+		  (version >> 24) & 0xff, (version >> 16) & 0xff,
+		  (version >> 8) & 0xff, version & 0xff, ctlr->channels);
+    return 0;
+}
+
+static int
 ata_ahci_allocate(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
@@ -459,7 +508,8 @@
     int offset = (ch->unit << 7);
     int tag = 0;
 
-    if ((action = ATA_INL(ctlr->r_res2, ATA_AHCI_IS)) & (1 << ch->unit)) {
+    action = ATA_INL(ctlr->r_res2, ATA_AHCI_IS);
+    if (action & (1 << ch->unit)) {
 	istatus = ATA_INL(ctlr->r_res2, ATA_AHCI_P_IS + offset);
 	issued = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CI + offset);
 	sstatus = ATA_INL(ctlr->r_res2, ATA_AHCI_P_SSTS + offset);
@@ -472,7 +522,7 @@
 
 	/* do we have cold connect surprise */
 	if (istatus & ATA_AHCI_P_IX_CPD) {
-	    printf("ata_ahci_intr status=%08x sstatus=%08x error=%08x\n",
+	    printf("ata_ahci_status status=%08x sstatus=%08x error=%08x\n",
 		   istatus, sstatus, error);
 	}
 
@@ -521,8 +571,8 @@
     struct ata_channel *ch = device_get_softc(device_get_parent(request->dev));
     struct ata_ahci_cmd_tab *ctp;
     struct ata_ahci_cmd_list *clp;
-    int fis_size, entries;
-    int tag = 0;
+    int tag = 0, entries = 0;
+    int fis_size;
 
     /* get a piece of the workspace for this request */
     ctp = (struct ata_ahci_cmd_tab *)
@@ -608,15 +658,37 @@
     struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
     struct ata_channel *ch = device_get_softc(dev);
     u_int32_t cmd;
-    int offset = (ch->unit << 7);
+    int timeout, offset = (ch->unit << 7);
 
     /* kill off all activity on this channel */
     cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset,
-	     cmd & ~(ATA_AHCI_P_CMD_CR | ATA_AHCI_P_CMD_FR |
-		     ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST));
+	     cmd & ~(ATA_AHCI_P_CMD_FRE | ATA_AHCI_P_CMD_ST));
+
+    /* XXX SOS this is not entirely wrong */
+    timeout = 0;
+    do {
+	DELAY(1000);
+	if (timeout++ > 500)
+	    device_printf(dev, "stopping AHCI engine failed\n");
+	    break;
+	}
+    while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset) & ATA_AHCI_P_CMD_CR);
 
-    DELAY(500000);      /* XXX SOS this is not entirely wrong */
+    /* issue Command List Override if supported */ 
+    if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_CLO) {
+	cmd = ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD + offset);
+	cmd |= ATA_AHCI_P_CMD_CLO;
+	ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset, cmd);
+	timeout = 0;
+	do {
+	    DELAY(1000);
+	    if (timeout++ > 500)
+		device_printf(dev, "executing CLO failed\n");
+		break;
+	    }
+	while (ATA_INL(ctlr->r_res2, ATA_AHCI_P_CMD+offset)&ATA_AHCI_P_CMD_CLO);
+    }
 
     /* spin up device */
     ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CMD + offset, ATA_AHCI_P_CMD_SUD);
@@ -1653,43 +1725,18 @@
 	ctlr->allocate = ata_intel_allocate;
 	ctlr->reset = ata_intel_reset;
 
-	/* if we have AHCI capability and BAR(5) as a memory resource */
-	if (ctlr->chip->cfg1 == AHCI) {
+	/* 
+	 * if we have AHCI capability and BAR(5) as a memory resource
+	 * and AHCI or RAID mode enabled in BIOS we go for AHCI mode
+	 */ 
+	if ((ctlr->chip->cfg1 == AHCI) &&
+	    (pci_read_config(dev, 0x90, 1) & 0xc0)) {
 	    ctlr->r_type2 = SYS_RES_MEMORY;
 	    ctlr->r_rid2 = PCIR_BAR(5);
 	    if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
 						       &ctlr->r_rid2,
-						       RF_ACTIVE))) {
-		/* is AHCI or RAID mode enabled in BIOS ? */
-		if (pci_read_config(dev, 0x90, 1) & 0xc0) {
-
-		    /* reset AHCI controller */
-		    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
-		    ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_HR);
-		    DELAY(1000000);
-		    if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) {
-			bus_release_resource(dev, ctlr->r_type2, 
-					     ctlr->r_rid2, ctlr->r_res2);
-			device_printf(dev, "AHCI controller reset failure\n");
-			return ENXIO;
-    		    }
-
-		    /* enable AHCI mode */
-		    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_AE);
-
-		    /* get the number of HW channels */
-		    ctlr->channels = (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) &
-				      ATA_AHCI_NPMASK) + 1;
-
-		    /* enable AHCI interrupts */
-		    ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
-			     ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) |
-			     ATA_AHCI_GHC_IE);
-		    ctlr->allocate = ata_ahci_allocate;
-		    ctlr->reset = ata_ahci_reset;
-		    ctlr->dmainit = ata_ahci_dmainit;
-		}
-	    }
+						       RF_ACTIVE)))
+		return ata_ahci_chipinit(dev);
 	}
 	ctlr->setmode = ata_sata_setmode;
 
@@ -2091,6 +2138,7 @@
 ata_jmicron_chipinit(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
+    int error;
 
     if (ata_setup_interrupt(dev))
 	return ENXIO;
@@ -2108,30 +2156,8 @@
     ctlr->r_rid2 = PCIR_BAR(5);
     if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
 						&ctlr->r_rid2, RF_ACTIVE))) {
-	/* reset AHCI controller */
-	ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
-		 ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_HR);
-	DELAY(1000000);
-	if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) {
-	    bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2,ctlr->r_res2);
-	    device_printf(dev, "AHCI controller reset failure\n");
-	    return ENXIO;
-	}
-
-	/* enable AHCI mode */
-	ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
-		 ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_AE);
-
-	/* clear interrupts */
-	ATA_OUTL(ctlr->r_res2, ATA_AHCI_IS, ATA_INL(ctlr->r_res2, ATA_AHCI_IS));
-
-	/* enable AHCI interrupts */
-	ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC,
-		 ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) | ATA_AHCI_GHC_IE);
-
-	/* enable PCI interrupt */
-	pci_write_config(dev, PCIR_COMMAND,
-			 pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2);
+	if ((error = ata_ahci_chipinit(dev)))
+	    return error;
     }
 
     /* set the number of HW channels */ 
@@ -4612,7 +4638,7 @@
     {{ ATA_VIA6410,   0x00, 0,      0x00,    ATA_UDMA6, "6410" },
      { ATA_VIA6420,   0x00, 7,      0x00,    ATA_SA150, "6420" },
      { ATA_VIA6421,   0x00, 6,      VIABAR,  ATA_SA150, "6421" },
-     { ATA_VIA8251,   0x00, 0,      VIAAHCI, ATA_SA150, "8251" },
+     { ATA_VIA8251,   0x00, 0,      VIAAHCI, ATA_SA300, "8251" },
      { 0, 0, 0, 0, 0, 0 }};
     char buffer[64];
 
@@ -4642,6 +4668,15 @@
 	return ENXIO;
     
     if (ctlr->chip->max_dma >= ATA_SA150) {
+	if (ctlr->chip->cfg2 == VIAAHCI) {
+	    ctlr->r_type2 = SYS_RES_MEMORY;
+	    ctlr->r_rid2 = PCIR_BAR(5);
+	    if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,
+						       &ctlr->r_rid2,
+						       RF_ACTIVE))) {
+		 return ata_ahci_chipinit(dev);
+	    } 
+	}
 	ctlr->r_type2 = SYS_RES_IOPORT;
 	ctlr->r_rid2 = PCIR_BAR(5);
 	if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,

==== //depot/projects/smpng/sys/dev/ata/atapi-cd.c#63 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.188 2006/03/31 08:09:05 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.189 2006/06/28 15:04:10 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -1335,7 +1335,8 @@
     error = ata_atapicmd(dev, ccb, (caddr_t)d, length,
 			 ai->format == DVD_INVALIDATE_AGID ? 0 : ATA_R_READ,10);
     if (error) {
-	free(d, M_ACD);
+	if (length)
+	    free(d, M_ACD);
 	return error;
     }
 
@@ -1377,7 +1378,8 @@
     default:
 	error = EINVAL;
     }
-    free(d, M_ACD);
+    if (length)
+	free(d, M_ACD);
     return error;
 }
 

==== //depot/projects/smpng/sys/dev/bge/if_bge.c#77 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.133 2006/06/15 14:35:31 glebius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.135 2006/06/29 06:38:21 glebius Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -171,10 +171,17 @@
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5753 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5753F },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5753M },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5754 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5754M },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5755 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5755M },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5780 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5780S },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5781 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5782 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5786 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5787 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5787M },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5788 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5789 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5901 },
@@ -223,6 +230,7 @@
 	{ BGE_CHIPID_BCM5703_A1,	"BCM5703 A1" },
 	{ BGE_CHIPID_BCM5703_A2,	"BCM5703 A2" },
 	{ BGE_CHIPID_BCM5703_A3,	"BCM5703 A3" },
+	{ BGE_CHIPID_BCM5703_B0,	"BCM5703 B0" },
 	{ BGE_CHIPID_BCM5704_A0,	"BCM5704 A0" },
 	{ BGE_CHIPID_BCM5704_A1,	"BCM5704 A1" },
 	{ BGE_CHIPID_BCM5704_A2,	"BCM5704 A2" },
@@ -256,36 +264,19 @@
  * that we don't know about have a shot at working.
  */
 static const struct bge_revision bge_majorrevs[] = {
-	{ BGE_ASICREV_BCM5700,
-	  "unknown BCM5700" },
+	{ BGE_ASICREV_BCM5700,		"unknown BCM5700" },
+	{ BGE_ASICREV_BCM5701,		"unknown BCM5701" },
+	{ BGE_ASICREV_BCM5703,		"unknown BCM5703" },
+	{ BGE_ASICREV_BCM5704,		"unknown BCM5704" },
+	{ BGE_ASICREV_BCM5705,		"unknown BCM5705" },
+	{ BGE_ASICREV_BCM5750,		"unknown BCM5750" },
+	{ BGE_ASICREV_BCM5714_A0,	"unknown BCM5714" },
+	{ BGE_ASICREV_BCM5752,		"unknown BCM5752" },
+	{ BGE_ASICREV_BCM5780,		"unknown BCM5780" },
+	{ BGE_ASICREV_BCM5714,		"unknown BCM5714" },
+	{ BGE_ASICREV_BCM5755,		"unknown BCM5755" },
+	{ BGE_ASICREV_BCM5787,		"unknown BCM5787" },
 
-	{ BGE_ASICREV_BCM5701,
-	  "unknown BCM5701" },
-
-	{ BGE_ASICREV_BCM5703,
-	  "unknown BCM5703" },
-
-	{ BGE_ASICREV_BCM5704,
-	  "unknown BCM5704" },
-
-	{ BGE_ASICREV_BCM5705,
-	  "unknown BCM5705" },
-
-	{ BGE_ASICREV_BCM5750,
-	  "unknown BCM5750" },
-
-	{ BGE_ASICREV_BCM5714_A0,
-	  "unknown BCM5714" },
-
-	{ BGE_ASICREV_BCM5752,
-	  "unknown BCM5752" },
-
-	{ BGE_ASICREV_BCM5780,
-	  "unknown BCM5780" },
-
-	{ BGE_ASICREV_BCM5714,
-	  "unknown BCM5714" },
-
 	{ 0, NULL }
 };
 
@@ -295,23 +286,29 @@
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5780	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5714	|| \
-	 (sc)->bge_asicrev == BGE_ASICREV_BCM5752)
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5752	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5755	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5787)
 
 #define BGE_IS_575X_PLUS(sc)				   \
 	((sc)->bge_asicrev == BGE_ASICREV_BCM5750	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5780	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5714	|| \
-	 (sc)->bge_asicrev == BGE_ASICREV_BCM5752)
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5752	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5755	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5787)
 
 #define BGE_IS_5714_FAMILY(sc)				   \
 	((sc)->bge_asicrev == BGE_ASICREV_BCM5714_A0	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5780	|| \
 	 (sc)->bge_asicrev == BGE_ASICREV_BCM5714)
 
-#define BGE_IS_JUMBO_CAPABLE(sc)			   \
-	((sc)->bge_asicrev != BGE_ASICREV_BCM5705	&& \
-	 (sc)->bge_asicrev != BGE_ASICREV_BCM5750)
+#define BGE_IS_JUMBO_CAPABLE(sc) \
+	((sc)->bge_asicrev == BGE_ASICREV_BCM5700	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5701	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5703	|| \
+	 (sc)->bge_asicrev == BGE_ASICREV_BCM5704)
 
 const struct bge_revision * bge_lookup_rev(uint32_t);
 const struct bge_vendor * bge_lookup_vendor(uint16_t);

==== //depot/projects/smpng/sys/dev/bge/if_bgereg.h#43 (text+ko) ====

@@ -30,7 +30,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.49 2006/06/15 14:31:49 glebius Exp $
+ * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.50 2006/06/28 09:12:29 glebius Exp $
  */
 
 /*
@@ -240,6 +240,7 @@
 #define BGE_CHIPID_BCM5703_A1		0x10010000
 #define BGE_CHIPID_BCM5703_A2		0x10020000
 #define BGE_CHIPID_BCM5703_A3		0x10030000
+#define BGE_CHIPID_BCM5703_B0		0x11000000
 #define BGE_CHIPID_BCM5704_A0		0x20000000
 #define BGE_CHIPID_BCM5704_A1		0x20010000
 #define BGE_CHIPID_BCM5704_A2		0x20020000
@@ -277,6 +278,8 @@
 #define BGE_ASICREV_BCM5700		0x07
 #define BGE_ASICREV_BCM5780		0x08
 #define BGE_ASICREV_BCM5714		0x09
+#define BGE_ASICREV_BCM5755		0x0a
+#define BGE_ASICREV_BCM5787		0x0b
 
 /* chip revisions */
 #define BGE_CHIPREV(x)			((x) >> 24)
@@ -1989,10 +1992,17 @@
 #define BCOM_DEVICEID_BCM5753		0x16F7
 #define BCOM_DEVICEID_BCM5753F		0x16FE
 #define BCOM_DEVICEID_BCM5753M		0x16FD
+#define BCOM_DEVICEID_BCM5754		0x167A
+#define BCOM_DEVICEID_BCM5754M		0x1672
+#define BCOM_DEVICEID_BCM5755		0x167B
+#define BCOM_DEVICEID_BCM5755M		0x1673
 #define BCOM_DEVICEID_BCM5780		0x166A
 #define BCOM_DEVICEID_BCM5780S		0x166B
 #define BCOM_DEVICEID_BCM5781		0x16DD
 #define BCOM_DEVICEID_BCM5782		0x1696
+#define BCOM_DEVICEID_BCM5786		0x169A
+#define BCOM_DEVICEID_BCM5787		0x169B
+#define BCOM_DEVICEID_BCM5787M		0x1693
 #define BCOM_DEVICEID_BCM5788		0x169C
 #define BCOM_DEVICEID_BCM5789		0x169D
 #define BCOM_DEVICEID_BCM5901		0x170D

==== //depot/projects/smpng/sys/dev/re/if_re.c#41 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.68 2006/06/26 20:31:31 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.69 2006/06/28 16:04:54 wpaul Exp $");
 
 /*
  * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
@@ -173,7 +173,9 @@
 	{ RT_VENDORID, RT_DEVICEID_8101E, RL_HWREV_8101E,
 		"RealTek 8101E PCIe 10/100baseTX" },
 	{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168,
-		"RealTek 8168B/8111B PCIe Gigabit Ethernet" },
+		"RealTek 8168B PCIe Gigabit Ethernet" },
+	{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8111,
+		"RealTek 8111B PCIe Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169,
 		"RealTek 8169 Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169S,
@@ -210,6 +212,7 @@
 	{ RL_HWREV_8101, RL_8139, "8101"},
 	{ RL_HWREV_8100E, RL_8169, "8100E"},
 	{ RL_HWREV_8101E, RL_8169, "8101E"},
+	{ RL_HWREV_8111, RL_8169, "8111"},
 	{ 0, 0, NULL }
 };
 

==== //depot/projects/smpng/sys/dev/usb/uplcom.c#25 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/uplcom.c,v 1.34 2006/06/19 16:31:58 matteo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/uplcom.c,v 1.36 2006/06/29 06:31:13 takawata Exp $");
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -236,6 +236,8 @@
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_RSAQ2, -1, TYPE_PL2303 },
 	/* I/O DATA USB-RSAQ3 */
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_RSAQ3, -1, TYPE_PL2303X },
+	/* Willcom W-SIM*/
+	{ USB_VENDOR_PROLIFIC2, USB_PRODUCT_PROLIFIC2_WSIM, -1, TYPE_PL2303X},
 	/* PLANEX USB-RS232 URS-03 */
 	{ USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC232A, -1, TYPE_PL2303 },
 	/* ST Lab USB-SERIAL-4 */

==== //depot/projects/smpng/sys/dev/usb/usbdevs#91 (text+ko) ====

@@ -1,4 +1,4 @@
-$FreeBSD: src/sys/dev/usb/usbdevs,v 1.261 2006/06/18 17:55:29 netchild Exp $
+$FreeBSD: src/sys/dev/usb/usbdevs,v 1.262 2006/06/29 06:17:48 takawata Exp $
 /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
 
 /*-
@@ -499,6 +499,7 @@
 vendor SERVERWORKS	0x1166	ServerWorks
 vendor ACERCM		0x1189	Acer Communications & Multimedia
 vendor SIERRA		0x1199	Sierra Wireless
+vendor PROLIFIC2	0x11f6	Prolific
 vendor TWINMOS		0x126f	TwinMOS
 vendor TSUNAMI		0x1241	Tsunami
 vendor CREATIVE2	0x1292	Creative Labs
@@ -1403,7 +1404,7 @@
 product PROLIFIC ATAPI4		0x2307	ATAPI-4 Controller
 product PROLIFIC PL2501		0x2501	PL2501 Host-Host interface
 product PROLIFIC RSAQ3		0xaaa2	PL2303 Serial adapter (IODATA USB-RSAQ3)
-
+product PROLIFIC2 WSIM		0x2001  Willcom WSIM
 /* Putercom products */
 product PUTERCOM UPA100		0x047e	USB-1284 BRIDGE
 

==== //depot/projects/smpng/sys/fs/pseudofs/pseudofs_vnops.c#46 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/fs/pseudofs/pseudofs_vnops.c,v 1.59 2006/02/22 18:57:49 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/fs/pseudofs/pseudofs_vnops.c,v 1.60 2006/06/27 20:21:38 netchild Exp $");
 
 #include "opt_pseudofs.h"
 
@@ -515,7 +515,7 @@
 	if (uio->uio_offset < 0 || uio->uio_resid < 0 ||
 	    (offset = uio->uio_offset) != uio->uio_offset ||
 	    (resid = uio->uio_resid) != uio->uio_resid ||
-	    (buflen = offset + resid) < offset || buflen > INT_MAX) {
+	    (buflen = offset + resid + 1) < offset || buflen > INT_MAX) {
 		if (proc != NULL)
 			PRELE(proc);
 		PFS_RETURN (EINVAL);

==== //depot/projects/smpng/sys/i386/conf/XBOX#6 (text+ko) ====

@@ -1,7 +1,7 @@
 #
 # XBOX -- kernel for an XBOX
 #
-# $FreeBSD: src/sys/i386/conf/XBOX,v 1.5 2006/06/15 19:58:50 netchild Exp $
+# $FreeBSD: src/sys/i386/conf/XBOX,v 1.6 2006/06/27 20:22:32 rink Exp $
 cpu		I686_CPU		# Celeron
 ident		XBOX
 
@@ -103,4 +103,4 @@
 device		sound
 device		snd_ich		# nForce audio
 
-device		nve		# nVidia nForce MCP on-board Ethernet Networking
+device		nfe		# nVidia nForce MCP on-board Ethernet Networking

==== //depot/projects/smpng/sys/kern/sched_core.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_core.c,v 1.5 2006/06/15 06:37:39 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_core.c,v 1.9 2006/06/29 12:29:20 davidxu Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_sched.h"
@@ -185,24 +185,26 @@
  * have several of these.
  */
 struct kse {
+	struct thread	*ke_thread;	/* (*) Active associated thread. */
 	TAILQ_ENTRY(kse) ke_procq;	/* (j/z) Run queue. */
 	int		ke_flags;	/* (j) KEF_* flags. */
-	struct thread	*ke_thread;	/* (*) Active associated thread. */
 	fixpt_t		ke_pctcpu;	/* (j) %cpu during p_swtime. */
 	u_char		ke_rqindex;	/* (j) Run queue index. */
 	enum {
 		KES_THREAD = 0x0,	/* slaved to thread state */
 		KES_ONRUNQ
 	} ke_state;			/* (j) thread sched specific status. */
-	int		ke_slice;
-	struct krunq	*ke_runq;
+	int		ke_slice;	/* Time slice in ticks */
+	struct kseq	*ke_kseq;	/* Kseq the thread belongs to */
+	struct krunq	*ke_runq;	/* Assiociated runqueue */
+#ifdef SMP
 	int		ke_cpu;		/* CPU that we have affinity for. */
-	int		ke_activated;
-	uint64_t	ke_timestamp;
-	uint64_t	ke_lastran;
-#ifdef SMP
-	int		ke_tocpu;
+	int		ke_wakeup_cpu;	/* CPU that has activated us. */
 #endif
+	int		ke_activated;	/* How is the thread activated. */
+	uint64_t	ke_timestamp;	/* Last timestamp dependent on state.*/
+	unsigned	ke_lastran;	/* Last timestamp the thread ran. */
+
 	/* The following variables are only used for pctcpu calculation */
 	int		ke_ltick;	/* Last tick that we were running on */
 	int		ke_ftick;	/* First tick that we were running on */
@@ -214,19 +216,14 @@
 #define ke_ksegrp		ke_thread->td_ksegrp
 
 /* flags kept in ke_flags */
-#define	KEF_ASSIGNED	0x0001		/* Thread is being migrated. */
-#define	KEF_BOUND	0x0002		/* Thread can not migrate. */
-#define	KEF_XFERABLE	0x0004		/* Thread was added as transferable. */
-#define	KEF_HOLD	0x0008		/* Thread is temporarily bound. */
-#define	KEF_REMOVED	0x0010		/* Thread was removed while ASSIGNED */
-#define	KEF_INTERNAL	0x0020		/* Thread added due to migration. */
-#define	KEF_PREEMPTED	0x0040		/* Thread was preempted. */
-#define KEF_MIGRATING	0x0080		/* Thread is migrating. */
-#define	KEF_SLEEP	0x0100		/* Thread did sleep. */
-#define	KEF_DIDRUN	0x2000		/* Thread actually ran. */
-#define	KEF_EXIT	0x4000		/* Thread is being killed. */
-#define KEF_NEXTRQ	0x8000		/* Thread should be in next queue. */
-#define KEF_FIRST_SLICE	0x10000		/* Thread has first time slice left. */
+#define	KEF_BOUND	0x0001		/* Thread can not migrate. */
+#define	KEF_PREEMPTED	0x0002		/* Thread was preempted. */
+#define KEF_MIGRATING	0x0004		/* Thread is migrating. */
+#define	KEF_SLEEP	0x0008		/* Thread did sleep. */
+#define	KEF_DIDRUN	0x0010		/* Thread actually ran. */
+#define	KEF_EXIT	0x0020		/* Thread is being killed. */
+#define KEF_NEXTRQ	0x0400		/* Thread should be in next queue. */
+#define KEF_FIRST_SLICE	0x0800		/* Thread has first time slice left. */
 
 struct kg_sched {
 	struct thread	*skg_last_assigned; /* (j) Last thread assigned to */
@@ -259,47 +256,16 @@
  * kseq - per processor runqs and statistics.
  */
 struct kseq {
+	struct krunq	*ksq_curr;		/* Current queue. */
+	struct krunq	*ksq_next;		/* Next timeshare queue. */
+	struct krunq	ksq_timeshare[2];	/* Run queues for !IDLE. */
 	struct krunq	ksq_idle;		/* Queue of IDLE threads. */
-	struct krunq	ksq_timeshare[2];	/* Run queues for !IDLE. */
-	struct krunq	*ksq_next;		/* Next timeshare queue. */
-	struct krunq	*ksq_curr;		/* Current queue. */
-	int		ksq_load_timeshare;	/* Load for timeshare. */
-	int		ksq_load_idle;
-	int		ksq_load;		/* Aggregate load. */
-	int		ksq_sysload;		/* For loadavg, !P_NOLOAD */
-	uint64_t	ksq_expired_timestamp;
-	uint64_t	ksq_last_timestamp;
-	signed char	ksq_best_expired_nice;
-#ifdef SMP
-	int			ksq_transferable;
-	LIST_ENTRY(kseq)	ksq_siblings;	/* Next in kseq group. */
-	struct kseq_group	*ksq_group;	/* Our processor group. */
-	struct thread		*ksq_migrated;
-	TAILQ_HEAD(,kse)	ksq_migrateq;
-	int			ksq_avgload;
-#endif
+	int		ksq_load;
+	uint64_t	ksq_last_timestamp;	/* Per-cpu last clock tick */
+	unsigned	ksq_expired_tick;	/* First expired tick */
+	signed char	ksq_expired_nice;	/* Lowest nice in nextq */
 };
 
-#ifdef SMP
-/*
- * kseq groups are groups of processors which can cheaply share threads. When
- * one processor in the group goes idle it will check the runqs of the other
- * processors in its group prior to halting and waiting for an interrupt.
- * These groups are suitable for SMT (Symetric Multi-Threading) and not NUMA.
- * In a NUMA environment we'd want an idle bitmap per group and a two tiered
- * load balancer.
- */
-struct kseq_group {
-	int		ksg_cpus;	/* Count of CPUs in this kseq group. */
-	cpumask_t	ksg_cpumask;	/* Mask of cpus in this group. */
-	cpumask_t	ksg_idlemask;	/* Idle cpus in this group. */
-	cpumask_t	ksg_mask;	/* Bit mask for first cpu. */
-	int		ksg_transferable;	/* Transferable load of this group. */
-	LIST_HEAD(, kseq)	ksg_members;	/* Linked list of all members. */
-	int		ksg_balance_tick;
-};
-#endif
-
 static struct kse kse0;
 static struct kg_sched kg_sched0;
 
@@ -307,33 +273,25 @@
 static int def_timeslice = 100;
 static int granularity = 10;
 static int realstathz;
+static int sched_tdcnt;
+static struct kseq kseq_global;
 
 /*
  * One kse queue per processor.
  */
 #ifdef SMP
-static cpumask_t kseq_idle;
-static int ksg_maxid;
-static struct kseq kseq_cpu[MAXCPU];
-static struct kseq_group kseq_groups[MAXCPU];
-static int balance_tick;
-static int balance_interval = 1;
-static int balance_interval_max = 32;
-static int balance_interval_min = 8;
-static int balance_busy_factor = 32;
-static int imbalance_pct = 25;
-static int imbalance_pct2 = 50;
-static int ignore_topology = 1;
+static struct kseq	kseq_cpu[MAXCPU];
 
 #define	KSEQ_SELF()	(&kseq_cpu[PCPU_GET(cpuid)])
 #define	KSEQ_CPU(x)	(&kseq_cpu[(x)])
 #define	KSEQ_ID(x)	((x) - kseq_cpu)
-#define	KSEQ_GROUP(x)	(&kseq_groups[(x)])
+
+static cpumask_t	cpu_sibling[MAXCPU];
+
 #else	/* !SMP */
-static struct kseq	kseq_cpu;
 
-#define	KSEQ_SELF()	(&kseq_cpu)
-#define	KSEQ_CPU(x)	(&kseq_cpu)
+#define	KSEQ_SELF()	(&kseq_global)
+#define	KSEQ_CPU(x)	(&kseq_global)
 #endif
 
 /* decay 95% of `p_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */
@@ -348,46 +306,72 @@
 
 static SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "Scheduler");
 
-SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "core", 0,
+SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "CORE", 0,
     "Scheduler name");
 
 #ifdef SMP
-SYSCTL_INT(_kern_sched, OID_AUTO, imbalance_pct, CTLFLAG_RW,
-    &imbalance_pct, 0, "");
+/* Enable forwarding of wakeups to all other cpus */
+SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, "Kernel SMP");
+
+static int runq_fuzz = 0;
+SYSCTL_INT(_kern_sched, OID_AUTO, runq_fuzz, CTLFLAG_RW, &runq_fuzz, 0, "");
+
+static int forward_wakeup_enabled = 1;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, enabled, CTLFLAG_RW,
+	   &forward_wakeup_enabled, 0,
+	   "Forwarding of wakeup to idle CPUs");
+
+static int forward_wakeups_requested = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, requested, CTLFLAG_RD,
+	   &forward_wakeups_requested, 0,
+	   "Requests for Forwarding of wakeup to idle CPUs");
+
+static int forward_wakeups_delivered = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, delivered, CTLFLAG_RD,
+	   &forward_wakeups_delivered, 0,
+	   "Completed Forwarding of wakeup to idle CPUs");
+
+static int forward_wakeup_use_mask = 1;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, usemask, CTLFLAG_RW,
+	   &forward_wakeup_use_mask, 0,
+	   "Use the mask of idle cpus");
 
-SYSCTL_INT(_kern_sched, OID_AUTO, imbalance_pct2, CTLFLAG_RW,
-    &imbalance_pct2, 0, "");
+static int forward_wakeup_use_loop = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, useloop, CTLFLAG_RW,
+	   &forward_wakeup_use_loop, 0,
+	   "Use a loop to find idle cpus");
 
-SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval_min, CTLFLAG_RW,
-    &balance_interval_min, 0, "");
+static int forward_wakeup_use_single = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, onecpu, CTLFLAG_RW,
+	   &forward_wakeup_use_single, 0,
+	   "Only signal one idle cpu");
 
-SYSCTL_INT(_kern_sched, OID_AUTO, balance_interval_max, CTLFLAG_RW,
-    &balance_interval_max, 0, "");
+static int forward_wakeup_use_htt = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, htt2, CTLFLAG_RW,
+	   &forward_wakeup_use_htt, 0,
+	   "account for htt");
 #endif
 
 static void slot_fill(struct ksegrp *);
 
-static void krunq_add(struct krunq *, struct kse *, int flags);
+static void krunq_add(struct krunq *, struct kse *);
 static struct kse *krunq_choose(struct krunq *);
 static void krunq_clrbit(struct krunq *rq, int pri);
 static int krunq_findbit(struct krunq *rq);
 static void krunq_init(struct krunq *);
 static void krunq_remove(struct krunq *, struct kse *);
-#ifdef SMP
-static struct kse *krunq_steal(struct krunq *rq, int my_cpu);
-#endif
 
 static struct kse * kseq_choose(struct kseq *);

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


More information about the p4-projects mailing list