From owner-p4-projects@FreeBSD.ORG Thu Apr 30 14:08:32 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9027A1065676; Thu, 30 Apr 2009 14:08:32 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 366021065672 for ; Thu, 30 Apr 2009 14:08:32 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 237EE8FC12 for ; Thu, 30 Apr 2009 14:08:32 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n3UE8VNl012587 for ; Thu, 30 Apr 2009 14:08:31 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n3UE8Vei012585 for perforce@freebsd.org; Thu, 30 Apr 2009 14:08:31 GMT (envelope-from zec@fer.hr) Date: Thu, 30 Apr 2009 14:08:31 GMT Message-Id: <200904301408.n3UE8Vei012585@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 161381 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2009 14:08:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=161381 Change 161381 by zec@zec_amdx2 on 2009/04/30 14:08:04 IFC @ 161380 Affected files ... .. //depot/projects/vimage-commit/src/sys/amd64/amd64/identcpu.c#5 integrate .. //depot/projects/vimage-commit/src/sys/amd64/amd64/mp_machdep.c#9 integrate .. //depot/projects/vimage-commit/src/sys/amd64/include/smp.h#5 integrate .. //depot/projects/vimage-commit/src/sys/amd64/include/specialreg.h#6 integrate .. //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c#4 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_misc.c#7 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_proto.h#8 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_syscall.h#8 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_syscalls.c#8 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_sysent.c#8 integrate .. //depot/projects/vimage-commit/src/sys/compat/freebsd32/syscalls.master#8 integrate .. //depot/projects/vimage-commit/src/sys/conf/files#22 integrate .. //depot/projects/vimage-commit/src/sys/dev/acpica/acpi.c#8 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/ata-all.h#6 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/ata-pci.c#7 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/ata-pci.h#7 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/ata-sata.c#4 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/chipsets/ata-ahci.c#4 integrate .. //depot/projects/vimage-commit/src/sys/dev/ata/chipsets/ata-ati.c#2 integrate .. //depot/projects/vimage-commit/src/sys/dev/cxgb/cxgb_multiq.c#5 integrate .. //depot/projects/vimage-commit/src/sys/dev/e1000/if_em.c#10 integrate .. //depot/projects/vimage-commit/src/sys/dev/e1000/if_em.h#5 integrate .. //depot/projects/vimage-commit/src/sys/dev/e1000/if_igb.c#8 integrate .. //depot/projects/vimage-commit/src/sys/dev/fb/creator.c#4 integrate .. //depot/projects/vimage-commit/src/sys/dev/mxge/if_mxge.c#6 integrate .. //depot/projects/vimage-commit/src/sys/dev/mxge/if_mxge_var.h#6 integrate .. //depot/projects/vimage-commit/src/sys/dev/rp/rp.c#3 integrate .. //depot/projects/vimage-commit/src/sys/dev/rp/rp_pci.c#3 integrate .. //depot/projects/vimage-commit/src/sys/dev/rp/rpreg.h#3 integrate .. //depot/projects/vimage-commit/src/sys/dev/xl/if_xl.c#5 integrate .. //depot/projects/vimage-commit/src/sys/i386/i386/identcpu.c#5 integrate .. //depot/projects/vimage-commit/src/sys/i386/i386/mp_machdep.c#8 integrate .. //depot/projects/vimage-commit/src/sys/i386/include/smp.h#4 integrate .. //depot/projects/vimage-commit/src/sys/i386/include/specialreg.h#6 integrate .. //depot/projects/vimage-commit/src/sys/kern/init_sysent.c#5 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_cpuset.c#7 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_jail.c#12 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_mib.c#11 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_osd.c#3 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_sysctl.c#8 integrate .. //depot/projects/vimage-commit/src/sys/kern/kern_vimage.c#12 integrate .. //depot/projects/vimage-commit/src/sys/kern/sched_ule.c#6 integrate .. //depot/projects/vimage-commit/src/sys/kern/subr_smp.c#6 integrate .. //depot/projects/vimage-commit/src/sys/kern/subr_witness.c#7 integrate .. //depot/projects/vimage-commit/src/sys/kern/syscalls.c#5 integrate .. //depot/projects/vimage-commit/src/sys/kern/syscalls.master#5 integrate .. //depot/projects/vimage-commit/src/sys/kern/systrace_args.c#5 integrate .. //depot/projects/vimage-commit/src/sys/kern/uipc_socket.c#10 integrate .. //depot/projects/vimage-commit/src/sys/net/bridgestp.c#8 integrate .. //depot/projects/vimage-commit/src/sys/net/flowtable.c#2 integrate .. //depot/projects/vimage-commit/src/sys/net/if.c#22 integrate .. //depot/projects/vimage-commit/src/sys/net/if_arcsubr.c#6 integrate .. //depot/projects/vimage-commit/src/sys/net/if_bridge.c#9 integrate .. //depot/projects/vimage-commit/src/sys/net/if_ef.c#7 integrate .. //depot/projects/vimage-commit/src/sys/net/if_gif.c#14 integrate .. //depot/projects/vimage-commit/src/sys/net/if_mib.c#12 integrate .. //depot/projects/vimage-commit/src/sys/net/if_var.h#14 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_ddb.c#10 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_freebsd.h#7 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_ht.c#6 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_ioctl.c#10 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_output.c#11 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_sta.c#8 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_superg.c#3 integrate .. //depot/projects/vimage-commit/src/sys/net80211/ieee80211_var.h#11 integrate .. //depot/projects/vimage-commit/src/sys/netinet/icmp6.h#5 integrate .. //depot/projects/vimage-commit/src/sys/netinet/igmp.c#18 integrate .. //depot/projects/vimage-commit/src/sys/netinet/in_mcast.c#16 integrate .. //depot/projects/vimage-commit/src/sys/netinet/in_pcb.c#15 integrate .. //depot/projects/vimage-commit/src/sys/netinet/in_pcb.h#12 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_carp.c#12 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_divert.c#14 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_fw.h#11 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_fw2.c#16 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_fw_pfil.c#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_input.c#17 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_ipsec.c#11 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_mroute.c#14 integrate .. //depot/projects/vimage-commit/src/sys/netinet/ip_output.c#15 integrate .. //depot/projects/vimage-commit/src/sys/netinet/raw_ip.c#15 integrate .. //depot/projects/vimage-commit/src/sys/netinet/tcp_subr.c#20 integrate .. //depot/projects/vimage-commit/src/sys/netinet/tcp_syncache.c#19 integrate .. //depot/projects/vimage-commit/src/sys/netinet/tcp_syncache.h#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet/tcp_var.h#11 integrate .. //depot/projects/vimage-commit/src/sys/netinet/udp_usrreq.c#16 integrate .. //depot/projects/vimage-commit/src/sys/netinet/vinet.h#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/icmp6.c#15 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6.c#12 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6.h#5 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6_ifattach.c#13 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6_mcast.c#1 branch .. //depot/projects/vimage-commit/src/sys/netinet6/in6_pcb.c#12 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6_proto.c#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/in6_var.h#6 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/ip6_input.c#16 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/ip6_mroute.c#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/ip6_output.c#10 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/ip6_var.h#8 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/mld6.c#11 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/mld6.h#1 branch .. //depot/projects/vimage-commit/src/sys/netinet6/mld6_var.h#3 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/nd6.c#15 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/raw_ip6.c#13 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/udp6_usrreq.c#12 integrate .. //depot/projects/vimage-commit/src/sys/netinet6/vinet6.h#6 integrate .. //depot/projects/vimage-commit/src/sys/netipsec/ipsec.c#18 integrate .. //depot/projects/vimage-commit/src/sys/netipsec/key.c#14 integrate .. //depot/projects/vimage-commit/src/sys/netipsec/key.h#4 integrate .. //depot/projects/vimage-commit/src/sys/sys/jail.h#7 integrate .. //depot/projects/vimage-commit/src/sys/sys/ktr.h#4 integrate .. //depot/projects/vimage-commit/src/sys/sys/osd.h#3 integrate .. //depot/projects/vimage-commit/src/sys/sys/param.h#19 integrate .. //depot/projects/vimage-commit/src/sys/sys/priv.h#7 integrate .. //depot/projects/vimage-commit/src/sys/sys/smp.h#4 integrate .. //depot/projects/vimage-commit/src/sys/sys/socketvar.h#7 integrate .. //depot/projects/vimage-commit/src/sys/sys/syscall.h#5 integrate .. //depot/projects/vimage-commit/src/sys/sys/syscall.mk#5 integrate .. //depot/projects/vimage-commit/src/sys/sys/syscallsubr.h#5 integrate .. //depot/projects/vimage-commit/src/sys/sys/sysctl.h#10 integrate .. //depot/projects/vimage-commit/src/sys/sys/sysproto.h#5 integrate .. //depot/projects/vimage-commit/src/sys/sys/vimage.h#16 integrate .. //depot/projects/vimage-commit/src/sys/ufs/ufs/dinode.h#3 integrate .. //depot/projects/vimage-commit/src/sys/ufs/ufs/inode.h#5 integrate .. //depot/projects/vimage-commit/src/sys/ufs/ufs/ufs_vnops.c#7 integrate .. //depot/projects/vimage-commit/src/sys/vm/swap_pager.c#9 integrate .. //depot/projects/vimage-commit/src/sys/vm/vm_pageout.c#6 integrate Differences ... ==== //depot/projects/vimage-commit/src/sys/amd64/amd64/identcpu.c#5 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include -__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-commit/src/sys/amd64/amd64/mp_machdep.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__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-commit/src/sys/amd64/include/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/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-commit/src/sys/amd64/include/specialreg.h#6 (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-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__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 #include @@ -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-commit/src/sys/compat/freebsd32/freebsd32_misc.c#7 (text+ko) ==== @@ -25,9 +25,11 @@ */ #include -__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 #include @@ -76,6 +78,10 @@ #include #include +#ifdef INET +#include +#endif + #include #include #include @@ -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-commit/src/sys/compat/freebsd32/freebsd32_proto.h#8 (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 *)]; char times_l_[PADL_(struct timeval *)]; struct timeval * times; char times_r_[PADR_(struct timeval *)]; }; +struct freebsd32_jail_get_args { + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; + char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; +struct freebsd32_jail_set_args { + char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; + char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); @@ -524,6 +534,8 @@ int freebsd32_fexecve(struct thread *, struct freebsd32_fexecve_args *); int freebsd32_fstatat(struct thread *, struct freebsd32_fstatat_args *); int freebsd32_futimesat(struct thread *, struct freebsd32_futimesat_args *); +int freebsd32_jail_get(struct thread *, struct freebsd32_jail_get_args *); +int freebsd32_jail_set(struct thread *, struct freebsd32_jail_set_args *); #ifdef COMPAT_43 @@ -751,6 +763,8 @@ #define FREEBSD32_SYS_AUE_freebsd32_fexecve AUE_FEXECVE #define FREEBSD32_SYS_AUE_freebsd32_fstatat AUE_FSTATAT #define FREEBSD32_SYS_AUE_freebsd32_futimesat AUE_FUTIMESAT +#define FREEBSD32_SYS_AUE_freebsd32_jail_get AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_jail_set AUE_NULL #undef PAD_ #undef PADL_ ==== //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_syscall.h#8 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.98 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_syscall.h,v 1.99 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 */ #define FREEBSD32_SYS_syscall 0 @@ -368,4 +368,7 @@ #define FREEBSD32_SYS_symlinkat 502 #define FREEBSD32_SYS_unlinkat 503 #define FREEBSD32_SYS_posix_openpt 504 -#define FREEBSD32_SYS_MAXSYSCALL 506 +#define FREEBSD32_SYS_freebsd32_jail_get 506 +#define FREEBSD32_SYS_freebsd32_jail_set 507 +#define FREEBSD32_SYS_jail_remove 508 +#define FREEBSD32_SYS_MAXSYSCALL 509 ==== //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_syscalls.c#8 (text+ko) ==== @@ -2,8 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.89 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_syscalls.c,v 1.90 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 */ const char *freebsd32_syscallnames[] = { @@ -513,4 +513,7 @@ "unlinkat", /* 503 = unlinkat */ "posix_openpt", /* 504 = posix_openpt */ "#505", /* 505 = gssd_syscall */ + "freebsd32_jail_get", /* 506 = freebsd32_jail_get */ + "freebsd32_jail_set", /* 507 = freebsd32_jail_set */ + "jail_remove", /* 508 = jail_remove */ }; ==== //depot/projects/vimage-commit/src/sys/compat/freebsd32/freebsd32_sysent.c#8 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,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_sysent.c,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 */ #include "opt_compat.h" @@ -544,4 +544,7 @@ { AS(unlinkat_args), (sy_call_t *)unlinkat, AUE_UNLINKAT, NULL, 0, 0 }, /* 503 = unlinkat */ { AS(posix_openpt_args), (sy_call_t *)posix_openpt, AUE_POSIX_OPENPT, NULL, 0, 0 }, /* 504 = posix_openpt */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 505 = gssd_syscall */ + { AS(freebsd32_jail_get_args), (sy_call_t *)freebsd32_jail_get, AUE_NULL, NULL, 0, 0 }, /* 506 = freebsd32_jail_get */ + { AS(freebsd32_jail_set_args), (sy_call_t *)freebsd32_jail_set, AUE_NULL, NULL, 0, 0 }, /* 507 = freebsd32_jail_set */ + { AS(jail_remove_args), (sy_call_t *)jail_remove, AUE_NULL, NULL, 0, 0 }, /* 508 = jail_remove */ }; ==== //depot/projects/vimage-commit/src/sys/compat/freebsd32/syscalls.master#8 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.114 2009/04/01 13:11:50 kib Exp $ + $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.115 2009/04/29 21:14:15 jamie Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; from: src/sys/kern/syscalls.master 1.107 ; @@ -870,3 +870,8 @@ 504 AUE_POSIX_OPENPT NOPROTO { int posix_openpt(int flags); } ; 505 is initialised by the kgssapi code, if present. 505 AUE_NULL UNIMPL gssd_syscall +506 AUE_NULL STD { int freebsd32_jail_get(struct iovec32 *iovp, \ + unsigned int iovcnt, int flags); } +507 AUE_NULL STD { int freebsd32_jail_set(struct iovec32 *iovp, \ + unsigned int iovcnt, int flags); } +508 AUE_NULL NOPROTO { int jail_remove(int jid); } ==== //depot/projects/vimage-commit/src/sys/conf/files#22 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1394 2009/04/23 11:51:53 rwatson Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1395 2009/04/29 19:19:13 bms Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -2381,6 +2381,7 @@ netinet6/in6_cksum.c optional inet6 netinet6/in6_gif.c optional gif inet6 netinet6/in6_ifattach.c optional inet6 +netinet6/in6_mcast.c optional inet6 netinet6/in6_pcb.c optional inet6 netinet6/in6_proto.c optional inet6 netinet6/in6_rmx.c optional inet6 ==== //depot/projects/vimage-commit/src/sys/dev/acpica/acpi.c#8 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.257 2009/03/23 22:12:33 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.258 2009/04/28 11:56:54 avg Exp $"); #include "opt_acpi.h" #include @@ -2482,6 +2482,18 @@ ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); + if (state < ACPI_STATE_S1 || state > ACPI_STATE_S5) + return_ACPI_STATUS (AE_BAD_PARAMETER); + + if (state == ACPI_STATE_S5) { + /* + * Shut down cleanly and power off. This will call us back through the + * shutdown handlers. + */ + shutdown_nice(RB_POWEROFF); + return_ACPI_STATUS (AE_OK); + } + /* Re-entry once we're suspending is not allowed. */ status = acpi_sleep_disable(sc); if (ACPI_FAILURE(status)) { @@ -2502,92 +2514,74 @@ mtx_lock(&Giant); slp_state = ACPI_SS_NONE; - switch (state) { - case ACPI_STATE_S1: - case ACPI_STATE_S2: >>> TRUNCATED FOR MAIL (1000 lines) <<<