PERFORCE change 60924 for review

Julian Elischer julian at FreeBSD.org
Fri Sep 3 00:56:56 PDT 2004


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

Change 60924 by julian at julian_ref on 2004/09/03 07:56:28

	IFC at 60923

Affected files ...

.. //depot/projects/nsched/sys/conf/NOTES#17 integrate
.. //depot/projects/nsched/sys/dev/ata/ata-chipset.c#11 integrate
.. //depot/projects/nsched/sys/dev/ata/ata-pci.h#4 integrate
.. //depot/projects/nsched/sys/fs/autofs/autofs_vnops.c#3 integrate
.. //depot/projects/nsched/sys/kern/kern_fork.c#11 integrate
.. //depot/projects/nsched/sys/kern/sched_4bsd.c#33 integrate
.. //depot/projects/nsched/sys/kern/subr_smp.c#8 integrate
.. //depot/projects/nsched/sys/kern/sysv_shm.c#6 integrate
.. //depot/projects/nsched/sys/kern/vfs_aio.c#5 integrate
.. //depot/projects/nsched/sys/net/netisr.c#5 integrate
.. //depot/projects/nsched/sys/sys/smp.h#5 integrate
.. //depot/projects/nsched/sys/vm/vm_fault.c#6 integrate
.. //depot/projects/nsched/sys/vm/vm_glue.c#7 integrate
.. //depot/projects/nsched/sys/vm/vm_map.c#9 integrate

Differences ...

==== //depot/projects/nsched/sys/conf/NOTES#17 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1274 2004/09/02 22:21:51 scottl Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1275 2004/09/03 06:32:11 ru Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -229,8 +229,8 @@
 options 	MUTEX_PROFILING
 # Set the number of buffers and the hash size.  The hash size MUST be larger
 # than the number of buffers.  Hash size should be prime.
-options		MPROF_BUFFERS="1536"
-options		MPROF_HASH_SIZE="1543"
+options 	MPROF_BUFFERS="1536"
+options 	MPROF_HASH_SIZE="1543"
 
 # Profiling for internal hash tables.
 options 	SLEEPQUEUE_PROFILING
@@ -639,7 +639,7 @@
 options 	IPFIREWALL_VERBOSE	#enable logging to syslogd(8)
 options 	IPFIREWALL_VERBOSE_LIMIT=100	#limit verbosity
 options 	IPFIREWALL_DEFAULT_TO_ACCEPT	#allow everything by default
-options		IPFIREWALL_FORWARD	#packet destination changes
+options 	IPFIREWALL_FORWARD	#packet destination changes
 options 	IPV6FIREWALL		#firewall for IPv6
 options 	IPV6FIREWALL_VERBOSE
 options 	IPV6FIREWALL_VERBOSE_LIMIT=100
@@ -744,7 +744,7 @@
 options 	NFSCLIENT		#Network File System client
 
 # The rest are optional:
-options		AUTOFS			#Auto File System
+options 	AUTOFS			#Auto File System
 options 	CD9660			#ISO 9660 filesystem
 options 	FDESCFS			#File descriptor filesystem
 options 	HPFS			#OS/2 File system
@@ -1333,14 +1333,14 @@
 options 	AHC_TMODE_ENABLE
 
 # Compile in Aic7xxx Debugging code.
-options		AHC_DEBUG
+options 	AHC_DEBUG
 
 # Aic7xxx driver debugging options. See sys/dev/aic7xxx/aic7xxx.h
-options		AHC_DEBUG_OPTS
+options 	AHC_DEBUG_OPTS
 
 # Print register bitfields in debug output.  Adds ~128k to driver
 # See ahc(4).
-options		AHC_REG_PRETTY_PRINT
+options 	AHC_REG_PRETTY_PRINT
 
 # Compile in aic79xx debugging code.
 options 	AHD_DEBUG
@@ -1352,7 +1352,7 @@
 options 	AHD_REG_PRETTY_PRINT
 
 # Bitmap of units to enable targetmode operations.
-options		AHD_TMODE_ENABLE
+options 	AHD_TMODE_ENABLE
 
 # The adw driver will attempt to use memory mapped I/O for all PCI
 # controllers that have it configured only if this option is set.
@@ -2480,7 +2480,7 @@
 options 	KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack
 
 # Adaptec Array Controller driver options
-options		AAC_DEBUG	# Debugging levels:
+options 	AAC_DEBUG	# Debugging levels:
 				# 0 - quiet, only emit warnings
 				# 1 - noisy, emit major function
 				#     points and things done

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

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.84 2004/09/01 12:15:44 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.85 2004/09/03 07:37:53 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -493,7 +493,7 @@
     if (ata_setup_interrupt(dev))
 	return ENXIO;
 
-    /* set prefetch, postwrite */
+    /* disable/set prefetch, postwrite */
     if (ctlr->chip->cfg2 & AMDBUG)
 	pci_write_config(dev, 0x41, pci_read_config(dev, 0x41, 1) & 0x0f, 1);
     else
@@ -828,11 +828,11 @@
      { ATA_I82801DB,   0, 0, 0x00, ATA_UDMA5, "Intel ICH4" },
      { ATA_I82801DB_1, 0, 0, 0x00, ATA_UDMA5, "Intel ICH4" },
      { ATA_I82801EB,   0, 0, 0x00, ATA_UDMA5, "Intel ICH5" },
-     { ATA_I82801EB_1, 0, 0, 0x00, ATA_SA150, "Intel ICH5" },
-     { ATA_I82801EB_2, 0, 0, 0x00, ATA_SA150, "Intel ICH5" },
+     { ATA_I82801EB_S1,0, 0, 0x00, ATA_SA150, "Intel ICH5" },
+     { ATA_I82801EB_R1,0, 0, 0x00, ATA_SA150, "Intel ICH5" },
      { ATA_I6300ESB,   0, 0, 0x00, ATA_UDMA5, "Intel 6300ESB" },
-     { ATA_I6300ESB_1, 0, 0, 0x00, ATA_SA150, "Intel 6300ESB" },
-     { ATA_I6300ESB_2, 0, 0, 0x00, ATA_SA150, "Intel 6300ESB" },
+     { ATA_I6300ESB_S1,0, 0, 0x00, ATA_SA150, "Intel 6300ESB" },
+     { ATA_I6300ESB_R1,0, 0, 0x00, ATA_SA150, "Intel 6300ESB" },
      { 0, 0, 0, 0, 0, 0}};
     char buffer[64]; 
 
@@ -1105,9 +1105,13 @@
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     struct ata_chip_id *idx;
     static struct ata_chip_id ids[] =
-    {{ ATA_NFORCE1, 0, AMDNVIDIA, NVIDIA|AMDBUG, ATA_UDMA5, "nVidia nForce" },
-     { ATA_NFORCE2, 0, AMDNVIDIA, NVIDIA|AMDBUG, ATA_UDMA6, "nVidia nForce2" },
-     { ATA_NFORCE3, 0, AMDNVIDIA, NVIDIA,	 ATA_UDMA6, "nVidia nForce3" },
+    {{ ATA_NFORCE1,     0, AMDNVIDIA, NVIDIA, ATA_UDMA5, "nVidia nForce" },
+     { ATA_NFORCE2,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2" },
+     { ATA_NFORCE2_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia MCP" },
+     { ATA_NFORCE3,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3" },
+     { ATA_NFORCE3_PRO, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 Pro" },
+     { ATA_NFORCE3_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 MCP" },
+     { ATA_NFORCE4,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce4" },
      { 0, 0, 0, 0, 0, 0}};
     char buffer[64];
 
@@ -1129,11 +1133,8 @@
     if (ata_setup_interrupt(dev))
 	return ENXIO;
 
-    /* set prefetch, postwrite */
-    if (ctlr->chip->cfg2 & AMDBUG) 
-	pci_write_config(dev, 0x51, pci_read_config(dev, 0x51, 1) & 0x0f, 1);
-    else
-	pci_write_config(dev, 0x51, pci_read_config(dev, 0x51, 1) | 0xf0, 1);
+    /* disable prefetch, postwrite */
+    pci_write_config(dev, 0x51, pci_read_config(dev, 0x51, 1) & 0x0f, 1);
 
     ctlr->setmode = ata_via_family_setmode;
     return 0;
@@ -2373,7 +2374,7 @@
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     struct ata_chip_id *idx;
     static struct ata_chip_id ids[] =
-    {{ ATA_SIS964_1,0x00, SISSATA,   0, ATA_SA150, "SiS 964" }, /* south */
+    {{ ATA_SIS964_S,0x00, SISSATA,   0, ATA_SA150, "SiS 964" }, /* south */
      { ATA_SIS964,  0x00, SIS133NEW, 0, ATA_UDMA6, "SiS 964" }, /* south */
      { ATA_SIS963,  0x00, SIS133NEW, 0, ATA_UDMA6, "SiS 963" }, /* south */
      { ATA_SIS962,  0x00, SIS133NEW, 0, ATA_UDMA6, "SiS 962" }, /* south */

==== //depot/projects/nsched/sys/dev/ata/ata-pci.h#4 (text+ko) ====

@@ -25,7 +25,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-pci.h,v 1.32 2004/06/15 11:02:09 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-pci.h,v 1.33 2004/09/03 07:37:53 sos Exp $
  */
 
 /* structure holding chipset config info */
@@ -117,11 +117,11 @@
 #define ATA_I82801DB		0x24cb8086
 #define ATA_I82801DB_1		0x24ca8086
 #define ATA_I82801EB		0x24db8086
-#define ATA_I82801EB_1		0x24d18086
-#define ATA_I82801EB_2		0x24df8086
+#define ATA_I82801EB_S1		0x24d18086
+#define ATA_I82801EB_R1		0x24df8086
 #define ATA_I6300ESB		0x25a28086
-#define ATA_I6300ESB_1		0x25a38086
-#define ATA_I6300ESB_2		0x25b08086
+#define ATA_I6300ESB_S1		0x25a38086
+#define ATA_I6300ESB_R1		0x25b08086
 
 #define ATA_NATIONAL_ID		0x100b
 #define ATA_SC1100		0x0502100b
@@ -129,7 +129,18 @@
 #define ATA_NVIDIA_ID		0x10de
 #define ATA_NFORCE1		0x01bc10de
 #define ATA_NFORCE2		0x006510de
+#define ATA_NFORCE2_MCP		0x008510de
 #define ATA_NFORCE3		0x00d510de
+#define ATA_NFORCE3_PRO		0x00e510de
+#define ATA_NFORCE3_PRO_S1	0x00e310de
+#define ATA_NFORCE3_PRO_S2	0x00ee10de
+#define ATA_NFORCE3_MCP		0x003510de
+#define ATA_NFORCE3_MCP_S1	0x003610de
+#define ATA_NFORCE3_MCP_S2	0x003e10de
+#define ATA_NFORCE4		0x005310de
+#define ATA_NFORCE4_S1		0x005410de
+#define ATA_NFORCE4_S2		0x005510de
+
 
 #define ATA_PROMISE_ID		0x105a
 #define ATA_PDC20246		0x4d33105a
@@ -220,7 +231,7 @@
 #define ATA_SIS962		0x09621039
 #define ATA_SIS963		0x09631039
 #define ATA_SIS964		0x09641039
-#define ATA_SIS964_1		0x01801039
+#define ATA_SIS964_S		0x01801039
 
 #define ATA_VIA_ID		0x1106
 #define ATA_VIA82C571		0x05711106

==== //depot/projects/nsched/sys/fs/autofs/autofs_vnops.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/fs/autofs/autofs_vnops.c,v 1.2 2004/09/02 20:44:55 alfred Exp $
+ * $FreeBSD: src/sys/fs/autofs/autofs_vnops.c,v 1.3 2004/09/03 02:45:36 scottl Exp $
  * $Id: autofs_vnops.c,v 1.21 2004/08/31 08:49:56 bright Exp $
  */
 #include <sys/param.h>
@@ -590,7 +590,7 @@
 	while ((char *)dp < ((char *)dents) + dlen) {
 		len = _GENERIC_DIRSIZ(dp);
 		reclen = dp->d_reclen;
-		DP(("dp->d_reclen %d _GENERIC_DIRSIZ %d drem %d dlen %d\n",
+		DP(("dp->d_reclen %d _GENERIC_DIRSIZ %zd drem %zd dlen %zd\n",
 			dp->d_reclen, len, drem, dlen));
 		DP(("entry: %s\n", dp->d_name));
 		/* record past the end of our buffer? */
@@ -622,7 +622,7 @@
 		drem -= reclen;	/* less data remaining */
 
 	}
-	DP(("drem %d dlen %d\n", drem, dlen));
+	DP(("drem %zd dlen %zd\n", drem, dlen));
 	*dlenp = dlen;
 	*dentsp = dents;
 	return (error);

==== //depot/projects/nsched/sys/kern/kern_fork.c#11 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.236 2004/09/01 02:11:27 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.237 2004/09/03 05:11:32 alc Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_mac.h"
@@ -218,9 +218,7 @@
 	 * certain parts of a process from itself.
 	 */
 	if ((flags & RFPROC) == 0) {
-		mtx_lock(&Giant);
 		vm_forkproc(td, NULL, NULL, flags);
-		mtx_unlock(&Giant);
 
 		/*
 		 * Close all file descriptors.
@@ -659,27 +657,25 @@
 	 * Finish creating the child process.  It will return via a different
 	 * execution path later.  (ie: directly into user mode)
 	 */
-	mtx_lock(&Giant);
 	vm_forkproc(td, p2, td2, flags);
 
 	if (flags == (RFFDG | RFPROC)) {
-		cnt.v_forks++;
-		cnt.v_forkpages += p2->p_vmspace->vm_dsize +
-		    p2->p_vmspace->vm_ssize;
+		atomic_add_int(&cnt.v_forks, 1);
+		atomic_add_int(&cnt.v_forkpages, p2->p_vmspace->vm_dsize +
+		    p2->p_vmspace->vm_ssize);
 	} else if (flags == (RFFDG | RFPROC | RFPPWAIT | RFMEM)) {
-		cnt.v_vforks++;
-		cnt.v_vforkpages += p2->p_vmspace->vm_dsize +
-		    p2->p_vmspace->vm_ssize;
+		atomic_add_int(&cnt.v_vforks, 1);
+		atomic_add_int(&cnt.v_vforkpages, p2->p_vmspace->vm_dsize +
+		    p2->p_vmspace->vm_ssize);
 	} else if (p1 == &proc0) {
-		cnt.v_kthreads++;
-		cnt.v_kthreadpages += p2->p_vmspace->vm_dsize +
-		    p2->p_vmspace->vm_ssize;
+		atomic_add_int(&cnt.v_kthreads, 1);
+		atomic_add_int(&cnt.v_kthreadpages, p2->p_vmspace->vm_dsize +
+		    p2->p_vmspace->vm_ssize);
 	} else {
-		cnt.v_rforks++;
-		cnt.v_rforkpages += p2->p_vmspace->vm_dsize +
-		    p2->p_vmspace->vm_ssize;
+		atomic_add_int(&cnt.v_rforks, 1);
+		atomic_add_int(&cnt.v_rforkpages, p2->p_vmspace->vm_dsize +
+		    p2->p_vmspace->vm_ssize);
 	}
-	mtx_unlock(&Giant);
 
 	/*
 	 * Both processes are set up, now check if any loadable modules want

==== //depot/projects/nsched/sys/kern/sched_4bsd.c#33 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.52 2004/09/01 06:42:01 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.53 2004/09/03 07:42:31 julian Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,6 +151,7 @@
 static void	maybe_resched(struct thread *td);
 static void	updatepri(struct ksegrp *kg);
 static void	resetpriority(struct ksegrp *kg);
+static int	forward_wakeup(int  cpunum);
 
 static struct kproc_desc sched_kp = {
         "schedcpu",
@@ -210,6 +211,44 @@
     0, sizeof sched_quantum, sysctl_kern_quantum, "I",
     "Roundrobin scheduling quantum in microseconds");
 
+/* Enable forwarding of wakeups to all other cpus */
+SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, "Kernel SMP");
+
+static int forward_wakeup_enabled = 0;
+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 = 0;
+SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, usemask, CTLFLAG_RW,
+	   &forward_wakeup_use_mask, 0,
+	   "Use the mask of idle cpus");
+
+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");
+
+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");
+
+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");
+
 /*
  * Arrange to reschedule if necessary, taking the priorities and
  * schedulers into account.
@@ -762,6 +801,93 @@
 	setrunqueue(td, SRQ_BORING);
 }
 
+/* enable HTT_2 if you have a 2-way HTT cpu.*/
+static int
+forward_wakeup(int  cpunum)
+{
+	cpumask_t map, me, dontuse;
+	cpumask_t map2;
+	struct pcpu *pc;
+	cpumask_t id, map3;
+
+	mtx_assert(&sched_lock, MA_OWNED);
+
+	CTR0(KTR_SMP, "forward_wakeup()");
+
+	if ((!forward_wakeup_enabled) ||
+	     (forward_wakeup_use_mask == 0 && forward_wakeup_use_loop == 0))
+		return (0);
+	if (!smp_started || cold || panicstr)
+		return (0);
+
+	forward_wakeups_requested++;
+
+/*
+ * check the idle mask we received against what we calculated before
+ * in the old version.
+ */
+	me = PCPU_GET(cpumask);
+	/* 
+	 * don't bother if we should be doing it ourself..
+	 */
+	if ((me & idle_cpus_mask) && (cpunum == NOCPU || me == (1 << cpunum)))
+		return (0);
+
+	dontuse = me | stopped_cpus | hlt_cpus_mask;
+	map3 = 0;
+	if (forward_wakeup_use_loop) {
+		SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
+			id = pc->pc_cpumask;
+			if ( (id & dontuse) == 0 &&
+			    pc->pc_curthread == pc->pc_idlethread) {
+				map3 |= id;
+			}
+		}
+	}
+
+	if (forward_wakeup_use_mask) {
+		map = 0;
+		map = idle_cpus_mask & ~dontuse;
+
+		/* If they are both on, compare and use loop if different */
+		if (forward_wakeup_use_loop) {
+			if (map != map3) {
+				printf("map (%02X) != map3 (%02X)\n",
+						map, map3);
+				map = map3;
+			}
+		}
+	} else {
+		map = map3;
+	}
+	/* If we only allow a specific CPU, then mask off all the others */
+	if (cpunum != NOCPU) {
+		KASSERT((cpunum <= mp_maxcpus),("forward_wakeup: bad cpunum."));
+		map &= (1 << cpunum);
+	} else {
+		/* Try choose an idle die. */
+		if (forward_wakeup_use_htt) {
+			map2 =  (map & (map >> 1)) & 0x5555;
+			if (map2) {
+				map = map2;
+			}
+		}
+
+		/* set only one bit */ 
+		if (forward_wakeup_use_single) {
+			map = map & ((~map) + 1);
+		}
+	}
+	if (map) {
+		forward_wakeups_delivered++;
+		ipi_selected(map, IPI_AST);
+		return (1);
+	}
+	if (cpunum == NOCPU)
+		printf("forward_wakeup: Idle processor not found\n");
+	return (0);
+}
+
 void
 sched_add(struct thread *td, int flags)
 {

==== //depot/projects/nsched/sys/kern/subr_smp.c#8 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_smp.c,v 1.192 2004/09/01 18:05:43 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_smp.c,v 1.193 2004/09/03 07:42:31 julian Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,7 +60,7 @@
 
 void (*cpustop_restartfunc)(void);
 #endif
-/* amazingly enough this is used in non SMP code XXX BUG! */
+/* This is used in modules that need to work in both SMP and UP. */
 cpumask_t all_cpus;
 
 int mp_ncpus;
@@ -102,46 +102,6 @@
 	   &forward_roundrobin_enabled, 0,
 	   "Forwarding of roundrobin to all other CPUs");
 
-#ifdef SCHED_4BSD
-/* Enable forwarding of wakeups to all other cpus */
-SYSCTL_NODE(_kern_smp, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, "Kernel SMP");
-
-static int forward_wakeup_enabled = 0;
-SYSCTL_INT(_kern_smp_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_smp_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_smp_ipiwakeup, OID_AUTO, delivered, CTLFLAG_RD,
-	   &forward_wakeups_delivered, 0,
-	   "Completed Forwarding of wakeup to idle CPUs");
-
-static int forward_wakeup_use_mask = 0;
-SYSCTL_INT(_kern_smp_ipiwakeup, OID_AUTO, usemask, CTLFLAG_RW,
-	   &forward_wakeup_use_mask, 0,
-	   "Use the mask of idle cpus");
-
-static int forward_wakeup_use_loop = 0;
-SYSCTL_INT(_kern_smp_ipiwakeup, OID_AUTO, useloop, CTLFLAG_RW,
-	   &forward_wakeup_use_loop, 0,
-	   "Use a loop to find idle cpus");
-
-static int forward_wakeup_use_single = 0;
-SYSCTL_INT(_kern_smp_ipiwakeup, OID_AUTO, onecpu, CTLFLAG_RW,
-	   &forward_wakeup_use_single, 0,
-	   "Only signal one idle cpu");
-
-static int forward_wakeup_use_htt = 0;
-SYSCTL_INT(_kern_smp_ipiwakeup, OID_AUTO, htt2, CTLFLAG_RW,
-	   &forward_wakeup_use_htt, 0,
-	   "account for htt");
-
-#endif /* SCHED_4BSD */
 /* Variables needed for SMP rendezvous. */
 static void (*smp_rv_setup_func)(void *arg);
 static void (*smp_rv_action_func)(void *arg);
@@ -249,95 +209,6 @@
 	ipi_selected(map, IPI_AST);
 }
 
-#ifdef SCHED_4BSD
-/* enable HTT_2 if you have a 2-way HTT cpu.*/
-int
-forward_wakeup(int  cpunum)
-{
-	cpumask_t map, me, dontuse;
-	cpumask_t map2;
-	struct pcpu *pc;
-	cpumask_t id, map3;
-
-	mtx_assert(&sched_lock, MA_OWNED);
-
-	CTR0(KTR_SMP, "forward_wakeup()");
-
-	if ((!forward_wakeup_enabled) ||
-	     (forward_wakeup_use_mask == 0 && forward_wakeup_use_loop == 0))
-		return (0);
-	if (!smp_started || cold || panicstr)
-		return (0);
-
-	forward_wakeups_requested++;
-
-/*
- * check the idle mask we received against what we calculated before
- * in the old version.
- */
-	me = PCPU_GET(cpumask);
-	/* 
-	 * don't bother if we should be doing it ourself..
-	 */
-	if ((me & idle_cpus_mask) && (cpunum == NOCPU || me == (1 << cpunum)))
-		return (0);
-
-	dontuse = me | stopped_cpus | hlt_cpus_mask;
-	map3 = 0;
-	if (forward_wakeup_use_loop) {
-		SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
-			id = pc->pc_cpumask;
-			if ( (id & dontuse) == 0 &&
-			    pc->pc_curthread == pc->pc_idlethread) {
-				map3 |= id;
-			}
-		}
-	}
-
-	if (forward_wakeup_use_mask) {
-		map = 0;
-		map = idle_cpus_mask & ~dontuse;
-
-		/* If they are both on, compare and use loop if different */
-		if (forward_wakeup_use_loop) {
-			if (map != map3) {
-				printf("map (%02X) != map3 (%02X)\n",
-						map, map3);
-				map = map3;
-			}
-		}
-	} else {
-		map = map3;
-	}
-	/* If we only allow a specific CPU, then mask off all the others */
-	if (cpunum != NOCPU) {
-		KASSERT((cpunum <= mp_maxcpus),("forward_wakeup: bad cpunum."));
-		map &= (1 << cpunum);
-	} else {
-		/* Try choose an idle die. */
-		if (forward_wakeup_use_htt) {
-			map2 =  (map & (map >> 1)) & 0x5555;
-			if (map2) {
-				map = map2;
-			}
-		}
-
-		/* set only one bit */ 
-		if (forward_wakeup_use_single) {
-			map = map & ((~map) + 1);
-		}
-	}
-	if (map) {
-		forward_wakeups_delivered++;
-		ipi_selected(map, IPI_AST);
-		return (1);
-	}
-	if (cpunum == NOCPU)
-		printf("forward_wakeup: Idle processor not found\n");
-	return (0);
-}
-#endif /* SCHED_4BSD */
-
 /*
  * When called the executing CPU will send an IPI to all other CPUs
  *  requesting that they halt execution.

==== //depot/projects/nsched/sys/kern/sysv_shm.c#6 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sysv_shm.c,v 1.96 2004/07/28 06:45:13 kan Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sysv_shm.c,v 1.97 2004/09/03 05:11:32 alc Exp $");
 
 #include "opt_compat.h"
 #include "opt_sysvipc.h"
@@ -806,6 +806,7 @@
 	size_t size;
 	int i;
 
+	mtx_lock(&Giant);
 	size = shminfo.shmseg * sizeof(struct shmmap_state);
 	shmmap_s = malloc(size, M_SHM, M_WAITOK);
 	bcopy(p1->p_vmspace->vm_shm, shmmap_s, size);
@@ -813,6 +814,7 @@
 	for (i = 0; i < shminfo.shmseg; i++, shmmap_s++)
 		if (shmmap_s->shmid != -1)
 			shmsegs[IPCID_TO_IX(shmmap_s->shmid)].shm_nattch++;
+	mtx_unlock(&Giant);
 }
 
 static void

==== //depot/projects/nsched/sys/kern/vfs_aio.c#5 (text+ko) ====

@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.174 2004/08/15 06:24:41 jmg Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.175 2004/09/03 03:19:14 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,6 +61,8 @@
 
 #include "opt_vfs_aio.h"
 
+NET_NEEDS_GIANT("aio");
+
 /*
  * Counter for allocating reference ids to new jobs.  Wrapped to 1 on
  * overflow.

==== //depot/projects/nsched/sys/net/netisr.c#5 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/net/netisr.c,v 1.13 2004/08/28 19:27:25 rwatson Exp $
+ * $FreeBSD: src/sys/net/netisr.c,v 1.14 2004/09/03 01:37:02 rwatson Exp $
  */
 
 #include "opt_net.h"
@@ -84,7 +84,7 @@
 static void *net_ih;
 
 /*
- * Note all network code is currently capable of running MPSAFE; however,
+ * Not all network code is currently capable of running MPSAFE; however,
  * most of it is.  Since those sections that are not are generally optional
  * components not shipped with default kernels, we provide a basic way to
  * determine whether MPSAFE operation is permitted: based on a default of

==== //depot/projects/nsched/sys/sys/smp.h#5 (text+ko) ====

@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/sys/smp.h,v 1.80 2004/09/01 06:42:02 julian Exp $
+ * $FreeBSD: src/sys/sys/smp.h,v 1.81 2004/09/03 07:42:31 julian Exp $
  */
 
 #ifndef _SYS_SMP_H_
@@ -96,7 +96,6 @@
 
 void	forward_signal(struct thread *);
 void	forward_roundrobin(void);
-int	forward_wakeup(int cpunum);
 int	restart_cpus(cpumask_t);
 int	stop_cpus(cpumask_t);
 void	smp_rendezvous_action(void);

==== //depot/projects/nsched/sys/vm/vm_fault.c#6 (text+ko) ====

@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.195 2004/09/01 19:18:59 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.196 2004/09/03 05:11:32 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1026,9 +1026,13 @@
 	 * read-only sections.
 	 */
 	for (va = start; va < end; va += PAGE_SIZE) {
+		if (map->system_map)
+			mtx_lock(&Giant);
 		rv = vm_fault(map, va,
 		    user_wire ? VM_PROT_READ : VM_PROT_READ | VM_PROT_WRITE,
 		    user_wire ? VM_FAULT_USER_WIRE : VM_FAULT_CHANGE_WIRING);
+		if (map->system_map)
+			mtx_unlock(&Giant);
 		if (rv) {
 			if (va != start)
 				vm_fault_unwire(map, start, va, fictitious);

==== //depot/projects/nsched/sys/vm/vm_glue.c#7 (text+ko) ====

@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_glue.c,v 1.202 2004/07/30 20:31:02 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_glue.c,v 1.203 2004/09/03 05:11:32 alc Exp $");
 
 #include "opt_vm.h"
 #include "opt_kstack_pages.h"
@@ -619,8 +619,6 @@
 {
 	struct proc *p1 = td->td_proc;
 
-	GIANT_REQUIRED;
-
 	if ((flags & RFPROC) == 0) {
 		/*
 		 * Divorce the memory, if it is shared, essentially

==== //depot/projects/nsched/sys/vm/vm_map.c#9 (text+ko) ====

@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.360 2004/08/16 06:16:12 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.361 2004/09/03 05:11:32 alc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2482,8 +2482,6 @@
 	vm_map_entry_t new_entry;
 	vm_object_t object;
 
-	GIANT_REQUIRED;
-
 	vm_map_lock(old_map);
 
 	vm2 = vmspace_alloc(old_map->min_offset, old_map->max_offset);
@@ -2942,7 +2940,6 @@
 	struct vmspace *oldvmspace = p->p_vmspace;
 	struct vmspace *newvmspace;
 
-	GIANT_REQUIRED;
 	if (oldvmspace->vm_refcnt == 1)
 		return;
 	newvmspace = vmspace_fork(oldvmspace);


More information about the p4-projects mailing list