PERFORCE change 161384 for review

Marko Zec zec at FreeBSD.org
Thu Apr 30 14:31:58 UTC 2009


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

Change 161384 by zec at zec_amdx2 on 2009/04/30 14:31:30

	IFC @ 161380

Affected files ...

.. //depot/projects/vimage/src/share/man/man4/ng_hole.4#2 integrate
.. //depot/projects/vimage/src/share/man/man5/rc.conf.5#7 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/identcpu.c#15 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/mp_machdep.c#20 integrate
.. //depot/projects/vimage/src/sys/amd64/include/smp.h#8 integrate
.. //depot/projects/vimage/src/sys/amd64/include/specialreg.h#14 integrate
.. //depot/projects/vimage/src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c#3 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_misc.c#20 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_proto.h#20 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_syscall.h#20 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_syscalls.c#20 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_sysent.c#20 integrate
.. //depot/projects/vimage/src/sys/compat/freebsd32/syscalls.master#21 integrate
.. //depot/projects/vimage/src/sys/conf/files#64 integrate
.. //depot/projects/vimage/src/sys/dev/acpica/acpi.c#18 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-all.h#13 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-pci.c#13 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-pci.h#22 integrate
.. //depot/projects/vimage/src/sys/dev/ata/ata-sata.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/ata/chipsets/ata-ahci.c#9 integrate
.. //depot/projects/vimage/src/sys/dev/ata/chipsets/ata-ati.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/cxgb/cxgb_multiq.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/e1000/if_em.c#9 integrate
.. //depot/projects/vimage/src/sys/dev/e1000/if_em.h#4 integrate
.. //depot/projects/vimage/src/sys/dev/e1000/if_igb.c#8 integrate
.. //depot/projects/vimage/src/sys/dev/fb/creator.c#7 integrate
.. //depot/projects/vimage/src/sys/dev/mxge/if_mxge.c#16 integrate
.. //depot/projects/vimage/src/sys/dev/mxge/if_mxge_var.h#11 integrate
.. //depot/projects/vimage/src/sys/dev/rp/rp.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/rp/rp_pci.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/rp/rpreg.h#2 integrate
.. //depot/projects/vimage/src/sys/dev/xl/if_xl.c#4 integrate
.. //depot/projects/vimage/src/sys/i386/i386/identcpu.c#17 integrate
.. //depot/projects/vimage/src/sys/i386/i386/mp_machdep.c#19 integrate
.. //depot/projects/vimage/src/sys/i386/include/smp.h#10 integrate
.. //depot/projects/vimage/src/sys/i386/include/specialreg.h#13 integrate
.. //depot/projects/vimage/src/sys/kern/init_sysent.c#11 integrate
.. //depot/projects/vimage/src/sys/kern/kern_cpuset.c#7 integrate
.. //depot/projects/vimage/src/sys/kern/kern_jail.c#25 integrate
.. //depot/projects/vimage/src/sys/kern/kern_mib.c#18 integrate
.. //depot/projects/vimage/src/sys/kern/kern_osd.c#3 integrate
.. //depot/projects/vimage/src/sys/kern/kern_sysctl.c#21 integrate
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#85 integrate
.. //depot/projects/vimage/src/sys/kern/sched_ule.c#31 integrate
.. //depot/projects/vimage/src/sys/kern/subr_smp.c#15 integrate
.. //depot/projects/vimage/src/sys/kern/subr_witness.c#25 integrate
.. //depot/projects/vimage/src/sys/kern/syscalls.c#11 integrate
.. //depot/projects/vimage/src/sys/kern/syscalls.master#12 integrate
.. //depot/projects/vimage/src/sys/kern/systrace_args.c#10 integrate
.. //depot/projects/vimage/src/sys/kern/uipc_socket.c#31 integrate
.. //depot/projects/vimage/src/sys/net/bridgestp.c#19 integrate
.. //depot/projects/vimage/src/sys/net/flowtable.c#2 integrate
.. //depot/projects/vimage/src/sys/net/if.c#80 integrate
.. //depot/projects/vimage/src/sys/net/if_arcsubr.c#7 integrate
.. //depot/projects/vimage/src/sys/net/if_bridge.c#28 integrate
.. //depot/projects/vimage/src/sys/net/if_ef.c#13 integrate
.. //depot/projects/vimage/src/sys/net/if_gif.c#30 integrate
.. //depot/projects/vimage/src/sys/net/if_mib.c#15 integrate
.. //depot/projects/vimage/src/sys/net/if_var.h#34 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_ddb.c#21 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_freebsd.h#17 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_ht.c#13 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_ioctl.c#23 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_output.c#24 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_sta.c#10 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_superg.c#3 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_var.h#26 integrate
.. //depot/projects/vimage/src/sys/netinet/icmp6.h#5 integrate
.. //depot/projects/vimage/src/sys/netinet/igmp.c#36 integrate
.. //depot/projects/vimage/src/sys/netinet/in_mcast.c#27 integrate
.. //depot/projects/vimage/src/sys/netinet/in_pcb.c#55 integrate
.. //depot/projects/vimage/src/sys/netinet/in_pcb.h#32 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_carp.c#23 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_divert.c#31 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_fw.h#29 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_fw2.c#75 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_fw_pfil.c#21 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_input.c#55 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_ipsec.c#22 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_mroute.c#22 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_output.c#36 integrate
.. //depot/projects/vimage/src/sys/netinet/raw_ip.c#45 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#82 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_syncache.c#52 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_syncache.h#20 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_var.h#33 integrate
.. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#53 integrate
.. //depot/projects/vimage/src/sys/netinet/vinet.h#56 integrate
.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#43 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6.c#33 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6.h#10 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#38 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_mcast.c#1 branch
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#33 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#40 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_var.h#11 integrate
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#55 integrate
.. //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#23 integrate
.. //depot/projects/vimage/src/sys/netinet6/ip6_output.c#28 integrate
.. //depot/projects/vimage/src/sys/netinet6/ip6_var.h#20 integrate
.. //depot/projects/vimage/src/sys/netinet6/mld6.c#23 integrate
.. //depot/projects/vimage/src/sys/netinet6/mld6.h#1 branch
.. //depot/projects/vimage/src/sys/netinet6/mld6_var.h#3 integrate
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#49 integrate
.. //depot/projects/vimage/src/sys/netinet6/raw_ip6.c#39 integrate
.. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#41 integrate
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#35 integrate
.. //depot/projects/vimage/src/sys/netipsec/ipsec.c#46 integrate
.. //depot/projects/vimage/src/sys/netipsec/key.c#40 integrate
.. //depot/projects/vimage/src/sys/netipsec/key.h#3 integrate
.. //depot/projects/vimage/src/sys/sys/jail.h#11 integrate
.. //depot/projects/vimage/src/sys/sys/ktr.h#3 integrate
.. //depot/projects/vimage/src/sys/sys/osd.h#3 integrate
.. //depot/projects/vimage/src/sys/sys/param.h#50 integrate
.. //depot/projects/vimage/src/sys/sys/priv.h#14 integrate
.. //depot/projects/vimage/src/sys/sys/smp.h#6 integrate
.. //depot/projects/vimage/src/sys/sys/socketvar.h#13 integrate
.. //depot/projects/vimage/src/sys/sys/syscall.h#11 integrate
.. //depot/projects/vimage/src/sys/sys/syscall.mk#11 integrate
.. //depot/projects/vimage/src/sys/sys/syscallsubr.h#9 integrate
.. //depot/projects/vimage/src/sys/sys/sysctl.h#34 integrate
.. //depot/projects/vimage/src/sys/sys/sysproto.h#11 integrate
.. //depot/projects/vimage/src/sys/sys/vimage.h#89 integrate
.. //depot/projects/vimage/src/sys/ufs/ufs/dinode.h#2 integrate
.. //depot/projects/vimage/src/sys/ufs/ufs/inode.h#5 integrate
.. //depot/projects/vimage/src/sys/ufs/ufs/ufs_vnops.c#15 integrate
.. //depot/projects/vimage/src/sys/vm/swap_pager.c#19 integrate
.. //depot/projects/vimage/src/sys/vm/vm_pageout.c#15 integrate

Differences ...

==== //depot/projects/vimage/src/share/man/man4/ng_hole.4#2 (text+ko) ====

@@ -32,7 +32,7 @@
 .\"
 .\" Author: Archie Cobbs <archie at FreeBSD.org>
 .\"
-.\" $FreeBSD: src/share/man/man4/ng_hole.4,v 1.12 2005/02/05 11:31:31 ru Exp $
+.\" $FreeBSD: src/share/man/man4/ng_hole.4,v 1.13 2009/04/30 10:01:13 maxim Exp $
 .\" $Whistle: ng_hole.8,v 1.4 1999/01/25 23:46:26 archie Exp $
 .\"
 .Dd May 19, 2004
@@ -58,20 +58,20 @@
 This node type supports the generic control messages, plus the
 following:
 .Bl -tag -width indent
-.It Dv NGM_BPF_GET_STATS
+.It Dv NGM_HOLE_GET_STATS
 This command takes an
 .Tn ASCII
 string argument, the hook name, and returns the statistics
 associated with the hook as a
 .Vt "struct ng_hole_hookstat" .
-.It Dv NGM_BPF_CLR_STATS
+.It Dv NGM_HOLE_CLR_STATS
 This command takes an
 .Tn ASCII
 string argument, the hook name, and clears the statistics
 associated with the hook.
-.It Dv NGM_BPF_GETCLR_STATS
+.It Dv NGM_HOLE_GETCLR_STATS
 This command is identical to
-.Dv NGM_BPF_GET_STATS ,
+.Dv NGM_HOLE_GET_STATS ,
 except that the statistics are also atomically cleared.
 .El
 .Sh SHUTDOWN

==== //depot/projects/vimage/src/share/man/man5/rc.conf.5#7 (text+ko) ====

@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.358 2009/04/24 06:44:58 maxim Exp $
+.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.359 2009/04/28 09:45:32 ru Exp $
 .\"
-.Dd January 27, 2009
+.Dd April 10, 2009
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -3402,6 +3402,13 @@
 .Dq Li YES
 by default for every jail in
 .Va jail_list .
+.It Va jail_exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_exec_start
 .Pq Vt str
 Unset by default.
@@ -3416,12 +3423,33 @@
 .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
 for every jail in
 .Va jail_list .
+.It Va jail_exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_exec_stop
 Unset by default.
 When set, use as default value for
 .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
 for every jail in
 .Va jail_list .
+.It Va jail_exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+for every jail in
+.Va jail_list .
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir
 .Pq Vt str
 Unset by default.
@@ -3537,27 +3565,68 @@
 mount the process file system inside jail
 .Ar jname
 at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start
 .Pq Vt str
 Set to
 .Dq Li /bin/sh /etc/rc
 by default.
-This is the command executed at jail startup.
+This is the command executed in a jail at jail startup.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
 .Pq Vt str
 Unset by default.
 This is the command run as
 .Ar N Ns
 th command
+in a jail
 after jail startup, where
 .Ar N
 is 1, 2, and so on.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
 .Pq Vt str
 Set to
 .Dq Li /bin/sh /etc/rc.shutdown
 by default.
-This is the command executed at jail shutdown.
+This is the command executed in a jail at jail shutdown.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
 .It Va jail_set_hostname_allow
 .Pq Vt bool
 If set to

==== //depot/projects/vimage/src/sys/amd64/amd64/identcpu.c#15 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.171 2009/01/22 21:04:46 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.172 2009/04/29 06:54:40 jeff Exp $");
 
 #include "opt_cpu.h"
 
@@ -106,10 +106,7 @@
 	{ CENTAUR_VENDOR_ID,	CPU_VENDOR_CENTAUR },	/* CentaurHauls */
 };
 
-int cpu_cores;
-int cpu_logical;
 
-
 extern int pq_l2size;
 extern int pq_l2nways;
 
@@ -195,7 +192,6 @@
 	    cpu_vendor_id == CPU_VENDOR_CENTAUR) {
 		printf("  Stepping = %u", cpu_id & 0xf);
 		if (cpu_high > 0) {
-			u_int cmp = 1, htt = 1;
 
 			/*
 			 * Here we should probably set up flags indicating
@@ -400,28 +396,6 @@
 			if (tsc_is_invariant)
 				printf("\n  TSC: P-state invariant");
 
-			/*
-			 * If this CPU supports HTT or CMP then mention the
-			 * number of physical/logical cores it contains.
-			 */
-			if (cpu_feature & CPUID_HTT)
-				htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-			if (cpu_vendor_id == CPU_VENDOR_AMD &&
-			    (amd_feature2 & AMDID2_CMP))
-				cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-			else if (cpu_vendor_id == CPU_VENDOR_INTEL &&
-			    (cpu_high >= 4)) {
-				cpuid_count(4, 0, regs);
-				if ((regs[0] & 0x1f) != 0)
-					cmp = ((regs[0] >> 26) & 0x3f) + 1;
-			}
-			cpu_cores = cmp;
-			cpu_logical = htt / cmp;
-			if (cmp > 1)
-				printf("\n  Cores per package: %d", cmp);
-			if ((htt / cmp) > 1)
-				printf("\n  Logical CPUs per core: %d",
-				    cpu_logical);
 		}
 	}
 	/* Avoid ugly blank lines: only print newline when we have to. */

==== //depot/projects/vimage/src/sys/amd64/amd64/mp_machdep.c#20 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.303 2009/04/22 21:40:37 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.304 2009/04/29 06:54:40 jeff Exp $");
 
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
@@ -160,6 +160,8 @@
 static volatile u_int cpu_ipi_pending[MAXCPU];
 
 static u_int boot_address;
+static int cpu_logical;
+static int cpu_cores;
 
 static void	assign_cpu_ids(void);
 static void	set_interrupt_apic_ids(void);
@@ -181,13 +183,142 @@
 		mem_range_softc.mr_op->initAP(&mem_range_softc);
 }
 
-struct cpu_group *
-cpu_topo(void)
+static void
+topo_probe_0xb(void)
+{
+	int logical;
+	int p[4];
+	int bits;
+	int type;
+	int cnt;
+	int i;
+	int x;
+
+	/* We only support two levels for now. */
+	for (i = 0; i < 3; i++) {
+		cpuid_count(0x0B, i, p);
+		bits = p[0] & 0x1f;
+		logical = p[1] &= 0xffff;
+		type = (p[2] >> 8) & 0xff;
+		if (type == 0 || logical == 0)
+			break;
+		for (cnt = 0, x = 0; x <= MAX_APIC_ID; x++) {
+			if (!cpu_info[x].cpu_present ||
+			    cpu_info[x].cpu_disabled)
+				continue;
+			if (x >> bits == boot_cpu_id >> bits)
+				cnt++;
+		}
+		if (type == CPUID_TYPE_SMT)
+			cpu_logical = cnt;
+		else if (type == CPUID_TYPE_CORE)
+			cpu_cores = cnt;
+	}
+	if (cpu_logical == 0)
+		cpu_logical = 1;
+	cpu_cores /= cpu_logical;
+}
+
+static void
+topo_probe_0x4(void)
+{
+	u_int threads_per_cache, p[4];
+	u_int htt, cmp;
+	int i;
+
+	htt = cmp = 1;
+	/*
+	 * If this CPU supports HTT or CMP then mention the
+	 * number of physical/logical cores it contains.
+	 */
+	if (cpu_feature & CPUID_HTT)
+		htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+	if (cpu_vendor_id == CPU_VENDOR_AMD && (amd_feature2 & AMDID2_CMP))
+		cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
+	else if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_high >= 4)) {
+		cpuid_count(4, 0, p);
+		if ((p[0] & 0x1f) != 0)
+			cmp = ((p[0] >> 26) & 0x3f) + 1;
+	}
+	cpu_cores = cmp;
+	cpu_logical = htt / cmp;
+
+	/* Setup the initial logical CPUs info. */
+	if (cpu_feature & CPUID_HTT)
+		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
+
+	/*
+	 * Work out if hyperthreading is *really* enabled.  This
+	 * is made really ugly by the fact that processors lie: Dual
+	 * core processors claim to be hyperthreaded even when they're
+	 * not, presumably because they want to be treated the same
+	 * way as HTT with respect to per-cpu software licensing.
+	 * At the time of writing (May 12, 2005) the only hyperthreaded
+	 * cpus are from Intel, and Intel's dual-core processors can be
+	 * identified via the "deterministic cache parameters" cpuid
+	 * calls.
+	 */
+	/*
+	 * First determine if this is an Intel processor which claims
+	 * to have hyperthreading support.
+	 */
+	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
+		/*
+		 * If the "deterministic cache parameters" cpuid calls
+		 * are available, use them.
+		 */
+		if (cpu_high >= 4) {
+			/* Ask the processor about the L1 cache. */
+			for (i = 0; i < 1; i++) {
+				cpuid_count(4, i, p);
+				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
+				if (hyperthreading_cpus < threads_per_cache)
+					hyperthreading_cpus = threads_per_cache;
+				if ((p[0] & 0x1f) == 0)
+					break;
+			}
+		}
+
+		/*
+		 * If the deterministic cache parameters are not
+		 * available, or if no caches were reported to exist,
+		 * just accept what the HTT flag indicated.
+		 */
+		if (hyperthreading_cpus == 0)
+			hyperthreading_cpus = logical_cpus;
+	}
+}
+
+static void
+topo_probe(void)
 {
+
+	logical_cpus = logical_cpus_mask = 0;
+	if (cpu_high >= 0xb)
+		topo_probe_0xb();
+	else if (cpu_high)
+		topo_probe_0x4();
 	if (cpu_cores == 0)
-		cpu_cores = 1;
+		cpu_cores = mp_ncpus;
 	if (cpu_logical == 0)
 		cpu_logical = 1;
+}
+
+struct cpu_group *
+cpu_topo(void)
+{
+	int cg_flags;
+
+	/*
+	 * Determine whether any threading flags are
+	 * necessry.
+	 */
+	if (cpu_logical > 1 && hyperthreading_cpus)
+		cg_flags = CG_FLAG_HTT;
+	else if (cpu_logical > 1)
+		cg_flags = CG_FLAG_SMT;
+	else
+		cg_flags = 0;
 	if (mp_ncpus % (cpu_cores * cpu_logical) != 0) {
 		printf("WARNING: Non-uniform processors.\n");
 		printf("WARNING: Using suboptimal topology.\n");
@@ -202,17 +333,17 @@
 	 * Only HTT no multi-core.
 	 */
 	if (cpu_logical > 1 && cpu_cores == 1)
-		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+		return (smp_topo_1level(CG_SHARE_L1, cpu_logical, cg_flags));
 	/*
 	 * Only multi-core no HTT.
 	 */
 	if (cpu_cores > 1 && cpu_logical == 1)
-		return (smp_topo_1level(CG_SHARE_NONE, cpu_cores, 0));
+		return (smp_topo_1level(CG_SHARE_L2, cpu_cores, cg_flags));
 	/*
 	 * Both HTT and multi-core.
 	 */
-	return (smp_topo_2level(CG_SHARE_NONE, cpu_cores,
-	    CG_SHARE_L1, cpu_logical, CG_FLAG_HTT));
+	return (smp_topo_2level(CG_SHARE_L2, cpu_cores,
+	    CG_SHARE_L1, cpu_logical, cg_flags));
 }
 
 /*
@@ -318,7 +449,6 @@
 cpu_mp_start(void)
 {
 	int i;
-	u_int threads_per_cache, p[4];
 
 	/* Initialize the logical ID to APIC ID table. */
 	for (i = 0; i < MAXCPU; i++) {
@@ -355,52 +485,9 @@
 		KASSERT(boot_cpu_id == PCPU_GET(apic_id),
 		    ("BSP's APIC ID doesn't match boot_cpu_id"));
 
-	/* Setup the initial logical CPUs info. */
-	logical_cpus = logical_cpus_mask = 0;
-	if (cpu_feature & CPUID_HTT)
-		logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-
-	/*
-	 * Work out if hyperthreading is *really* enabled.  This
-	 * is made really ugly by the fact that processors lie: Dual
-	 * core processors claim to be hyperthreaded even when they're
-	 * not, presumably because they want to be treated the same
-	 * way as HTT with respect to per-cpu software licensing.
-	 * At the time of writing (May 12, 2005) the only hyperthreaded
-	 * cpus are from Intel, and Intel's dual-core processors can be
-	 * identified via the "deterministic cache parameters" cpuid
-	 * calls.
-	 */
-	/*
-	 * First determine if this is an Intel processor which claims
-	 * to have hyperthreading support.
-	 */
-	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
-		/*
-		 * If the "deterministic cache parameters" cpuid calls
-		 * are available, use them.
-		 */
-		if (cpu_high >= 4) {
-			/* Ask the processor about the L1 cache. */
-			for (i = 0; i < 1; i++) {
-				cpuid_count(4, i, p);
-				threads_per_cache = ((p[0] & 0x3ffc000) >> 14) + 1;
-				if (hyperthreading_cpus < threads_per_cache)
-					hyperthreading_cpus = threads_per_cache;
-				if ((p[0] & 0x1f) == 0)
-					break;
-			}
-		}
+	/* Probe logical/physical core configuration. */
+	topo_probe();
 
-		/*
-		 * If the deterministic cache parameters are not
-		 * available, or if no caches were reported to exist,
-		 * just accept what the HTT flag indicated.
-		 */
-		if (hyperthreading_cpus == 0)
-			hyperthreading_cpus = logical_cpus;
-	}
-
 	assign_cpu_ids();
 
 	/* Start each Application Processor */
@@ -419,6 +506,14 @@
 	const char *hyperthread;
 	int i;
 
+	printf("FreeBSD/SMP: %d package(s) x %d core(s)",
+	    mp_ncpus / (cpu_cores * cpu_logical), cpu_cores);
+	if (hyperthreading_cpus > 1)
+	    printf(" x %d HTT threads", cpu_logical);
+	else if (cpu_logical > 1)
+	    printf(" x %d SMT threads", cpu_logical);
+	printf("\n");
+
 	/* List active CPUs first. */
 	printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id);
 	for (i = 1; i < mp_ncpus; i++) {

==== //depot/projects/vimage/src/sys/amd64/include/smp.h#8 (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/amd64/include/smp.h,v 1.94 2009/03/17 00:48:11 jkim Exp $
+ * $FreeBSD: src/sys/amd64/include/smp.h,v 1.95 2009/04/29 06:54:40 jeff Exp $
  *
  */
 
@@ -36,10 +36,6 @@
 extern struct pcb		stoppcbs[];
 extern int			cpu_apic_ids[];
 
-/* global data in identcpu.c */
-extern int			cpu_cores;
-extern int			cpu_logical;
-
 /* IPI handlers */
 inthand_t
 	IDTVEC(invltlb),	/* TLB shootdowns - global */

==== //depot/projects/vimage/src/sys/amd64/include/specialreg.h#14 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)specialreg.h	7.1 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.53 2009/01/12 19:17:35 jkim Exp $
+ * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.54 2009/04/29 06:54:40 jeff Exp $
  */
 
 #ifndef _MACHINE_SPECIALREG_H_
@@ -183,6 +183,13 @@
 #define	CPUID_HTT_CORES		0x00ff0000
 #define	CPUID_LOCAL_APIC_ID	0xff000000
 
+/* 
+ * CPUID instruction 0xb ebx info.
+ */
+#define	CPUID_TYPE_INVAL	0
+#define	CPUID_TYPE_SMT		1
+#define	CPUID_TYPE_CORE		2
+
 /*
  * AMD extended function 8000_0007h edx info
  */

==== //depot/projects/vimage/src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c,v 1.3 2008/11/17 20:49:29 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c,v 1.4 2009/04/29 21:14:15 jamie Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -233,7 +233,7 @@
 zone_sysinit(void *arg __unused)
 {
 
-	zone_slot = osd_jail_register(zone_destroy);
+	zone_slot = osd_jail_register(zone_destroy, NULL);
 }
 
 static void

==== //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_misc.c#20 (text+ko) ====

@@ -25,9 +25,11 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.88 2009/03/27 13:13:59 jamie Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.89 2009/04/29 21:14:15 jamie Exp $");
 
 #include "opt_compat.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -76,6 +78,10 @@
 #include <sys/sem.h>
 #include <sys/shm.h>
 
+#ifdef INET
+#include <netinet/in.h>
+#endif
+
 #include <vm/vm.h>
 #include <vm/vm_kern.h>
 #include <vm/vm_param.h>
@@ -106,6 +112,8 @@
 CTASSERT(sizeof(struct stat32) == 96);
 CTASSERT(sizeof(struct sigaction32) == 24);
 
+extern int jail_max_af_ips;
+
 static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
 static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
 
@@ -2036,9 +2044,17 @@
 int
 freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap)
 {
+	struct iovec optiov[10];
+	struct uio opt;
+	char *u_path, *u_hostname, *u_name;
+#ifdef INET
+	struct in_addr *u_ip4;
+#endif
+#ifdef INET6
+	struct in6_addr *u_ip6;
+#endif
 	uint32_t version;
 	int error;
-	struct jail j;
 
 	error = copyin(uap->jail, &version, sizeof(uint32_t));
 	if (error)
@@ -2050,14 +2066,45 @@
 		/* FreeBSD single IPv4 jails. */
 		struct jail32_v0 j32_v0;
 
-		bzero(&j, sizeof(struct jail));
 		error = copyin(uap->jail, &j32_v0, sizeof(struct jail32_v0));
 		if (error)
 			return (error);
-		CP(j32_v0, j, version);
-		PTRIN_CP(j32_v0, j, path);
-		PTRIN_CP(j32_v0, j, hostname);
-		j.ip4s = j32_v0.ip_number;
+		u_path = malloc(MAXPATHLEN + MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error = copyinstr(PTRIN(j32_v0.path), u_path, MAXPATHLEN,
+		    &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(PTRIN(j32_v0.hostname), u_hostname,
+		    MAXHOSTNAMELEN, &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = &j32_v0.ip_number;
+		j32_v0.ip_number = htonl(j32_v0.ip_number);
+		optiov[opt.uio_iovcnt].iov_len = sizeof(j32_v0.ip_number);
+		opt.uio_iovcnt++;
+#endif
 		break;
 	}
 
@@ -2072,18 +2119,109 @@
 	{
 		/* FreeBSD multi-IPv4/IPv6,noIP jails. */
 		struct jail32 j32;
+		size_t tmplen;
 
 		error = copyin(uap->jail, &j32, sizeof(struct jail32));
 		if (error)
 			return (error);
-		CP(j32, j, version);
-		PTRIN_CP(j32, j, path);
-		PTRIN_CP(j32, j, hostname);
-		PTRIN_CP(j32, j, jailname);
-		CP(j32, j, ip4s);
-		CP(j32, j, ip6s);
-		PTRIN_CP(j32, j, ip4);
-		PTRIN_CP(j32, j, ip6);
+		tmplen = MAXPATHLEN + MAXHOSTNAMELEN + MAXHOSTNAMELEN;
+#ifdef INET
+		if (j32.ip4s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j32.ip4s * sizeof(struct in_addr);
+#else
+		if (j32.ip4s > 0)
+			return (EINVAL);
+#endif
+#ifdef INET6
+		if (j32.ip6s > jail_max_af_ips)
+			return (EINVAL);
+		tmplen += j32.ip6s * sizeof(struct in6_addr);
+#else
+		if (j32.ip6s > 0)
+			return (EINVAL);
+#endif
+		u_path = malloc(tmplen, M_TEMP, M_WAITOK);
+		u_hostname = u_path + MAXPATHLEN;
+		u_name = u_hostname + MAXHOSTNAMELEN;
+#ifdef INET
+		u_ip4 =  (struct in_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#ifdef INET6
+#ifdef INET
+		u_ip6 = (struct in6_addr *)(u_ip4 + j32.ip4s);
+#else
+		u_ip6 = (struct in6_addr *)(u_name + MAXHOSTNAMELEN);
+#endif
+#endif
+		opt.uio_iov = optiov;
+		opt.uio_iovcnt = 4;
+		opt.uio_offset = -1;
+		opt.uio_resid = -1;
+		opt.uio_segflg = UIO_SYSSPACE;
+		opt.uio_rw = UIO_READ;
+		opt.uio_td = td;
+		optiov[0].iov_base = "path";
+		optiov[0].iov_len = sizeof("path");
+		optiov[1].iov_base = u_path;
+		error = copyinstr(PTRIN(j32.path), u_path, MAXPATHLEN,
+		    &optiov[1].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		optiov[2].iov_base = "host.hostname";
+		optiov[2].iov_len = sizeof("host.hostname");
+		optiov[3].iov_base = u_hostname;
+		error = copyinstr(PTRIN(j32.hostname), u_hostname,
+		    MAXHOSTNAMELEN, &optiov[3].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		if (PTRIN(j32.jailname) != NULL) {
+			optiov[opt.uio_iovcnt].iov_base = "name";
+			optiov[opt.uio_iovcnt].iov_len = sizeof("name");
+			opt.uio_iovcnt++;
+			optiov[opt.uio_iovcnt].iov_base = u_name;
+			error = copyinstr(PTRIN(j32.jailname), u_name,
+			    MAXHOSTNAMELEN, &optiov[opt.uio_iovcnt].iov_len);
+			if (error) {
+				free(u_path, M_TEMP);
+				return (error);
+			}
+			opt.uio_iovcnt++;
+		}
+#ifdef INET
+		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip4;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j32.ip4s * sizeof(struct in_addr);
+		error = copyin(PTRIN(j32.ip4), u_ip4,
+		    optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		opt.uio_iovcnt++;
+#endif
+#ifdef INET6
+		optiov[opt.uio_iovcnt].iov_base = "ip6.addr";
+		optiov[opt.uio_iovcnt].iov_len = sizeof("ip6.addr");
+		opt.uio_iovcnt++;
+		optiov[opt.uio_iovcnt].iov_base = u_ip6;
+		optiov[opt.uio_iovcnt].iov_len =
+		    j32.ip6s * sizeof(struct in6_addr);
+		error = copyin(PTRIN(j32.ip6), u_ip6,
+		    optiov[opt.uio_iovcnt].iov_len);
+		if (error) {
+			free(u_path, M_TEMP);
+			return (error);
+		}
+		opt.uio_iovcnt++;
+#endif
 		break;
 	}
 
@@ -2091,7 +2229,54 @@
 		/* Sci-Fi jails are not supported, sorry. */
 		return (EINVAL);
 	}
-	return (kern_jail(td, &j));
+	error = kern_jail_set(td, &opt, JAIL_CREATE | JAIL_ATTACH);
+	free(u_path, M_TEMP);
+	return (error);
+}
+
+int
+freebsd32_jail_set(struct thread *td, struct freebsd32_jail_set_args *uap)
+{
+	struct uio *auio;
+	int error;
+
+	/* Check that we have an even number of iovecs. */
+	if (uap->iovcnt & 1)
+		return (EINVAL);
+
+	error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	error = kern_jail_set(td, auio, uap->flags);
+	free(auio, M_IOV);
+	return (error);
+}
+
+int
+freebsd32_jail_get(struct thread *td, struct freebsd32_jail_get_args *uap)
+{
+	struct iovec32 iov32;
+	struct uio *auio;
+	int error, i;
+
+	/* Check that we have an even number of iovecs. */
+	if (uap->iovcnt & 1)
+		return (EINVAL);
+
+	error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	error = kern_jail_get(td, auio, uap->flags);
+	if (error == 0)
+		for (i = 0; i < uap->iovcnt; i++) {
+			PTROUT_CP(auio->uio_iov[i], iov32, iov_base);
+			CP(auio->uio_iov[i], iov32, iov_len);
+			error = copyout(&iov32, uap->iovp + i, sizeof(iov32));
+			if (error != 0)
+				break;
+		}
+	free(auio, M_IOV);
+	return (error);
 }
 
 int

==== //depot/projects/vimage/src/sys/compat/freebsd32/freebsd32_proto.h#20 (text+ko) ====

@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.99 2009/04/01 13:12:40 kib Exp $
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 190621 2009-04-01 13:11:50Z kib 
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.100 2009/04/29 21:50:13 jamie Exp $
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 2009-04-29 21:14:15Z jamie 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -443,6 +443,16 @@
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];

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


More information about the p4-projects mailing list