PERFORCE change 629239 for review

John Baldwin jhb at FreeBSD.org
Sun Sep 8 15:02:52 UTC 2013


http://p4web.freebsd.org/@@629239?ac=10

Change 629239 by jhb at jhb_pippin on 2013/09/08 15:02:16

	IFC @626698

Affected files ...

.. //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#90 integrate
.. //depot/projects/smpng/sys/amd64/amd64/pmap.c#131 integrate
.. //depot/projects/smpng/sys/amd64/include/cpu.h#14 integrate
.. //depot/projects/smpng/sys/amd64/include/cpufunc.h#32 integrate
.. //depot/projects/smpng/sys/amd64/include/pcpu.h#22 integrate
.. //depot/projects/smpng/sys/amd64/vmm/intel/vmx.c#5 integrate
.. //depot/projects/smpng/sys/amd64/vmm/io/ppt.c#4 integrate
.. //depot/projects/smpng/sys/arm/broadcom/bcm2835/bcm2835_gpio.c#3 integrate
.. //depot/projects/smpng/sys/arm/broadcom/bcm2835/bcm2835_gpio.h#1 branch
.. //depot/projects/smpng/sys/arm/include/ieee.h#6 integrate
.. //depot/projects/smpng/sys/arm/include/sf_buf.h#5 integrate
.. //depot/projects/smpng/sys/cddl/dev/dtrace/dtrace_clone.c#4 integrate
.. //depot/projects/smpng/sys/conf/files#289 integrate
.. //depot/projects/smpng/sys/conf/files.mips#25 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/QNX_OCL.txt#3 delete
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/fil.c#28 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_auth.c#23 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_auth.h#9 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_compat.h#22 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_dns_pxy.c#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_dstlist.c#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_dstlist.h#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_fil.h#18 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c#17 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_frag.c#16 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_frag.h#10 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c#14 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_htable.c#6 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_htable.h#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_ipsec_pxy.c#5 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_irc_pxy.c#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_log.c#17 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_lookup.c#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_lookup.h#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_nat.c#21 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_nat.h#14 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_nat6.c#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_netbios_pxy.c#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_pool.c#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_pool.h#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_pptp_pxy.c#5 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_proxy.c#17 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_proxy.h#10 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c#9 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c#10 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_rpcb_pxy.c#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_rules.c#3 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_scan.c#5 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_scan.h#4 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_state.c#19 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_state.h#12 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_sync.c#7 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_sync.h#5 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ip_tftp_pxy.c#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ipf_rb.h#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/ipl.h#14 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/mlfk_ipl.c#16 integrate
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/radix_ipf.c#1 branch
.. //depot/projects/smpng/sys/contrib/ipfilter/netinet/radix_ipf.h#1 branch
.. //depot/projects/smpng/sys/dev/firewire/fwdev.c#32 integrate
.. //depot/projects/smpng/sys/dev/glxsb/glxsb.c#5 integrate
.. //depot/projects/smpng/sys/dev/hifn/hifn7751.c#33 integrate
.. //depot/projects/smpng/sys/dev/random/harvest.c#14 integrate
.. //depot/projects/smpng/sys/dev/random/hash.c#10 integrate
.. //depot/projects/smpng/sys/dev/random/hash.h#6 integrate
.. //depot/projects/smpng/sys/dev/random/probe.c#9 delete
.. //depot/projects/smpng/sys/dev/random/pseudo_rng.c#1 branch
.. //depot/projects/smpng/sys/dev/random/random_adaptors.c#2 integrate
.. //depot/projects/smpng/sys/dev/random/random_adaptors.h#2 integrate
.. //depot/projects/smpng/sys/dev/random/random_harvestq.c#1 branch
.. //depot/projects/smpng/sys/dev/random/random_harvestq.h#1 branch
.. //depot/projects/smpng/sys/dev/random/randomdev.c#35 integrate
.. //depot/projects/smpng/sys/dev/random/randomdev.h#9 integrate
.. //depot/projects/smpng/sys/dev/random/randomdev_soft.c#21 integrate
.. //depot/projects/smpng/sys/dev/random/randomdev_soft.h#5 integrate
.. //depot/projects/smpng/sys/dev/random/yarrow.c#17 integrate
.. //depot/projects/smpng/sys/dev/random/yarrow.h#5 integrate
.. //depot/projects/smpng/sys/dev/rndtest/rndtest.c#9 integrate
.. //depot/projects/smpng/sys/dev/safe/safe.c#20 integrate
.. //depot/projects/smpng/sys/dev/ubsec/ubsec.c#33 integrate
.. //depot/projects/smpng/sys/dev/usb/controller/xhci.c#13 integrate
.. //depot/projects/smpng/sys/dev/vkbd/vkbd.c#17 integrate
.. //depot/projects/smpng/sys/fs/ext2fs/ext2_htree.c#2 integrate
.. //depot/projects/smpng/sys/fs/ext2fs/ext2_lookup.c#10 integrate
.. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#150 integrate
.. //depot/projects/smpng/sys/i386/include/cpu.h#21 integrate
.. //depot/projects/smpng/sys/i386/include/pcpu.h#31 integrate
.. //depot/projects/smpng/sys/i386/include/smp.h#38 integrate
.. //depot/projects/smpng/sys/i386/xen/mp_machdep.c#30 integrate
.. //depot/projects/smpng/sys/kern/capabilities.conf#7 integrate
.. //depot/projects/smpng/sys/kern/kern_intr.c#116 integrate
.. //depot/projects/smpng/sys/kern/sched_ule.c#126 integrate
.. //depot/projects/smpng/sys/kern/subr_capability.c#2 integrate
.. //depot/projects/smpng/sys/kern/subr_prf.c#63 integrate
.. //depot/projects/smpng/sys/mips/atheros/ar71xx_gpio.c#9 integrate
.. //depot/projects/smpng/sys/mips/atheros/ar71xx_gpiovar.h#4 integrate
.. //depot/projects/smpng/sys/mips/cavium/octeon_rnd.c#3 integrate
.. //depot/projects/smpng/sys/mips/mips/bcopy.S#1 branch
.. //depot/projects/smpng/sys/mips/mips/support.S#11 integrate
.. //depot/projects/smpng/sys/mips/nlm/board.c#6 integrate
.. //depot/projects/smpng/sys/mips/nlm/board.h#5 integrate
.. //depot/projects/smpng/sys/mips/nlm/board_cpld.c#3 integrate
.. //depot/projects/smpng/sys/mips/nlm/dev/net/nae.c#4 integrate
.. //depot/projects/smpng/sys/mips/nlm/dev/net/xaui.c#3 integrate
.. //depot/projects/smpng/sys/mips/nlm/dev/net/xlpge.c#4 integrate
.. //depot/projects/smpng/sys/mips/nlm/dev/net/xlpge.h#3 integrate
.. //depot/projects/smpng/sys/mips/nlm/hal/nae.h#3 integrate
.. //depot/projects/smpng/sys/mips/nlm/hal/nlm_hal.c#4 integrate
.. //depot/projects/smpng/sys/mips/nlm/hal/sys.h#6 integrate
.. //depot/projects/smpng/sys/modules/ipfilter/Makefile#14 integrate
.. //depot/projects/smpng/sys/modules/random/Makefile#9 integrate
.. //depot/projects/smpng/sys/net/if_ethersubr.c#121 integrate
.. //depot/projects/smpng/sys/net/if_tap.c#62 integrate
.. //depot/projects/smpng/sys/net/if_tun.c#80 integrate
.. //depot/projects/smpng/sys/net/netisr.c#29 integrate
.. //depot/projects/smpng/sys/netgraph/ng_iface.c#49 integrate
.. //depot/projects/smpng/sys/netinet/sctp_indata.c#50 integrate
.. //depot/projects/smpng/sys/nlm/nlm_prot_impl.c#18 integrate
.. //depot/projects/smpng/sys/powerpc/ofw/ofw_cpu.c#5 integrate
.. //depot/projects/smpng/sys/security/audit/audit_pipe.c#21 integrate
.. //depot/projects/smpng/sys/sys/random.h#6 integrate
.. //depot/projects/smpng/sys/sys/systm.h#113 integrate
.. //depot/projects/smpng/sys/x86/xen/hvm.c#2 integrate
.. //depot/projects/smpng/sys/x86/xen/xen_intr.c#2 integrate
.. //depot/projects/smpng/sys/xen/xen_intr.h#6 integrate

Differences ...

==== //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#90 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 255217 2013-09-04 23:31:29Z kib $");
+__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 255331 2013-09-06 22:17:02Z gibbs $");
 
 #include "opt_cpu.h"
 #include "opt_ddb.h"
@@ -69,6 +69,7 @@
 #include <machine/smp.h>
 #include <machine/specialreg.h>
 #include <machine/tss.h>
+#include <machine/cpu.h>
 
 #ifdef XENHVM
 #include <xen/hvm.h>
@@ -125,6 +126,11 @@
 static u_long *ipi_hardclock_counts[MAXCPU];
 #endif
 
+/* Default cpu_ops implementation. */
+struct cpu_ops cpu_ops = {
+	.ipi_vectored = lapic_ipi_vectored
+};
+
 extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32);
 
 extern int pmap_pcid_enabled;
@@ -1125,7 +1131,7 @@
 		if (old_pending)
 			return;
 	}
-	lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+	cpu_ops.ipi_vectored(ipi, cpu_apic_ids[cpu]);
 }
 
 /*
@@ -1395,7 +1401,7 @@
 		CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus);
 
 	CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
-	lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
+	cpu_ops.ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
 }
 
 int

==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#131 (text+ko) ====

@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/amd64/pmap.c 255312 2013-09-06 16:53:48Z kib $");
+__FBSDID("$FreeBSD: head/sys/amd64/amd64/pmap.c 255331 2013-09-06 22:17:02Z gibbs $");
 
 /*
  *	Manages physical address maps.
@@ -254,30 +254,6 @@
     0, "Is TLB Context ID enabled ?");
 int invpcid_works = 0;
 
-/*
- * Perform the guaranteed invalidation of all TLB entries.  This
- * includes the global entries, and entries in all PCIDs, not only the
- * current context.  The function works both on non-PCID CPUs and CPUs
- * with the PCID turned off or on.  See IA-32 SDM Vol. 3a 4.10.4.1
- * Operations that Invalidate TLBs and Paging-Structure Caches.
- */
-static __inline void
-invltlb_globpcid(void)
-{
-	uint64_t cr4;
-
-	cr4 = rcr4();
-	load_cr4(cr4 & ~CR4_PGE);
-	/*
-	 * Although preemption at this point could be detrimental to
-	 * performance, it would not lead to an error.  PG_G is simply
-	 * ignored if CR4.PGE is clear.  Moreover, in case this block
-	 * is re-entered, the load_cr4() either above or below will
-	 * modify CR4.PGE flushing the TLB.
-	 */
-	load_cr4(cr4 | CR4_PGE);
-}
-
 static int
 pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS)
 {

==== //depot/projects/smpng/sys/amd64/include/cpu.h#14 (text+ko) ====

@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)cpu.h	5.4 (Berkeley) 5/9/91
- * $FreeBSD: head/sys/amd64/include/cpu.h 253750 2013-07-28 18:44:17Z avg $
+ * $FreeBSD: head/sys/amd64/include/cpu.h 255331 2013-09-06 22:17:02Z gibbs $
  */
 
 #ifndef _MACHINE_CPU_H_
@@ -54,6 +54,17 @@
 #define	TRAPF_PC(framep)	((framep)->tf_rip)
 
 #ifdef _KERNEL
+/*
+ * Struct containing pointers to CPU management functions whose
+ * implementation is run time selectable.  Selection can be made,
+ * for example, based on detection of a particular CPU variant or
+ * hypervisor environment.
+ */
+struct cpu_ops {
+	void (*ipi_vectored)(u_int, int);
+};
+
+extern struct	cpu_ops cpu_ops;
 extern char	btext[];
 extern char	etext[];
 

==== //depot/projects/smpng/sys/amd64/include/cpufunc.h#32 (text+ko) ====

@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/include/cpufunc.h 255058 2013-08-30 07:42:38Z kib $
+ * $FreeBSD: head/sys/amd64/include/cpufunc.h 255331 2013-09-06 22:17:02Z gibbs $
  */
 
 /*
@@ -463,6 +463,34 @@
 	load_cr3(rcr3());
 }
 
+#ifndef CR4_PGE
+#define	CR4_PGE	0x00000080	/* Page global enable */
+#endif
+
+/*
+ * Perform the guaranteed invalidation of all TLB entries.  This
+ * includes the global entries, and entries in all PCIDs, not only the
+ * current context.  The function works both on non-PCID CPUs and CPUs
+ * with the PCID turned off or on.  See IA-32 SDM Vol. 3a 4.10.4.1
+ * Operations that Invalidate TLBs and Paging-Structure Caches.
+ */
+static __inline void
+invltlb_globpcid(void)
+{
+	uint64_t cr4;
+
+	cr4 = rcr4();
+	load_cr4(cr4 & ~CR4_PGE);
+	/*
+	 * Although preemption at this point could be detrimental to
+	 * performance, it would not lead to an error.  PG_G is simply
+	 * ignored if CR4.PGE is clear.  Moreover, in case this block
+	 * is re-entered, the load_cr4() either above or below will
+	 * modify CR4.PGE flushing the TLB.
+	 */
+	load_cr4(cr4 | CR4_PGE);
+}
+
 /*
  * TLB flush for an individual page (even if it has PG_G).
  * Only works on 486+ CPUs (i386 does not have PG_G).

==== //depot/projects/smpng/sys/amd64/include/pcpu.h#22 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/include/pcpu.h 255217 2013-09-04 23:31:29Z kib $
+ * $FreeBSD: head/sys/amd64/include/pcpu.h 255331 2013-09-06 22:17:02Z gibbs $
  */
 
 #ifndef _MACHINE_PCPU_H_
@@ -33,15 +33,6 @@
 #error "sys/cdefs.h is a prerequisite for this file"
 #endif
 
-#if defined(XEN) || defined(XENHVM)
-#ifndef NR_VIRQS
-#define	NR_VIRQS	24
-#endif
-#ifndef NR_IPIS
-#define	NR_IPIS		2
-#endif
-#endif
-
 /*
  * The SMP parts are setup in pmap.c and locore.s for the BSP, and
  * mp_machdep.c sets up the data for the AP's to "see" when they awake.

==== //depot/projects/smpng/sys/amd64/vmm/intel/vmx.c#5 (text+ko) ====

@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 253909 2013-08-03 03:16:42Z grehan $
+ * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 255343 2013-09-07 05:30:34Z neel $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 253909 2013-08-03 03:16:42Z grehan $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 255343 2013-09-07 05:30:34Z neel $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -138,8 +138,6 @@
 SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr4_zeros_mask, CTLFLAG_RD,
 	     &cr4_zeros_mask, 0, NULL);
 
-static volatile u_int nextvpid;
-
 static int vmx_no_patmsr;
 
 static int vmx_initialized;
@@ -172,6 +170,11 @@
 /* statistics */
 static VMM_STAT_INTEL(VMEXIT_HLT_IGNORED, "number of times hlt was ignored");
 
+static struct unrhdr *vpid_unr;
+static u_int vpid_alloc_failed;
+SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, CTLFLAG_RD,
+	    &vpid_alloc_failed, 0, NULL);
+
 #ifdef KTR
 static const char *
 exit_reason_to_str(int reason)
@@ -382,6 +385,88 @@
 }
 
 static void
+vpid_free(int vpid)
+{
+	if (vpid < 0 || vpid > 0xffff)
+		panic("vpid_free: invalid vpid %d", vpid);
+
+	/*
+	 * VPIDs [0,VM_MAXCPU] are special and are not allocated from
+	 * the unit number allocator.
+	 */
+
+	if (vpid > VM_MAXCPU)
+		free_unr(vpid_unr, vpid);
+}
+
+static void
+vpid_alloc(uint16_t *vpid, int num)
+{
+	int i, x;
+
+	if (num <= 0 || num > VM_MAXCPU)
+		panic("invalid number of vpids requested: %d", num);
+
+	/*
+	 * If the "enable vpid" execution control is not enabled then the
+	 * VPID is required to be 0 for all vcpus.
+	 */
+	if ((procbased_ctls2 & PROCBASED2_ENABLE_VPID) == 0) {
+		for (i = 0; i < num; i++)
+			vpid[i] = 0;
+		return;
+	}
+
+	/*
+	 * Allocate a unique VPID for each vcpu from the unit number allocator.
+	 */
+	for (i = 0; i < num; i++) {
+		x = alloc_unr(vpid_unr);
+		if (x == -1)
+			break;
+		else
+			vpid[i] = x;
+	}
+
+	if (i < num) {
+		atomic_add_int(&vpid_alloc_failed, 1);
+
+		/*
+		 * If the unit number allocator does not have enough unique
+		 * VPIDs then we need to allocate from the [1,VM_MAXCPU] range.
+		 *
+		 * These VPIDs are not be unique across VMs but this does not
+		 * affect correctness because the combined mappings are also
+		 * tagged with the EP4TA which is unique for each VM.
+		 *
+		 * It is still sub-optimal because the invvpid will invalidate
+		 * combined mappings for a particular VPID across all EP4TAs.
+		 */
+		while (i-- > 0)
+			vpid_free(vpid[i]);
+
+		for (i = 0; i < num; i++)
+			vpid[i] = i + 1;
+	}
+}
+
+static void
+vpid_init(void)
+{
+	/*
+	 * VPID 0 is required when the "enable VPID" execution control is
+	 * disabled.
+	 *
+	 * VPIDs [1,VM_MAXCPU] are used as the "overflow namespace" when the
+	 * unit number allocator does not have sufficient unique VPIDs to
+	 * satisfy the allocation.
+	 *
+	 * The remaining VPIDs are managed by the unit number allocator.
+	 */
+	vpid_unr = new_unrhdr(VM_MAXCPU + 1, 0xffff, NULL);
+}
+
+static void
 msr_save_area_init(struct msr_entry *g_area, int *g_count)
 {
 	int cnt;
@@ -422,6 +507,11 @@
 vmx_cleanup(void)
 {
 
+	if (vpid_unr != NULL) {
+		delete_unrhdr(vpid_unr);
+		vpid_unr = NULL;
+	}
+
 	smp_rendezvous(NULL, vmx_disable, NULL, NULL);
 
 	return (0);
@@ -607,6 +697,8 @@
 	cr4_ones_mask = fixed0 & fixed1;
 	cr4_zeros_mask = ~fixed0 & ~fixed1;
 
+	vpid_init();
+
 	/* enable VMX operation */
 	smp_rendezvous(NULL, vmx_enable, NULL, NULL);
 
@@ -615,37 +707,6 @@
 	return (0);
 }
 
-/*
- * If this processor does not support VPIDs then simply return 0.
- *
- * Otherwise generate the next value of VPID to use. Any value is alright
- * as long as it is non-zero.
- *
- * We always execute in VMX non-root context with EPT enabled. Thus all
- * combined mappings are tagged with the (EP4TA, VPID, PCID) tuple. This
- * in turn means that multiple VMs can share the same VPID as long as
- * they have distinct EPT page tables.
- *
- * XXX
- * We should optimize this so that it returns VPIDs that are not in
- * use. Then we will not unnecessarily invalidate mappings in
- * vmx_set_pcpu_defaults() just because two or more vcpus happen to
- * use the same 'vpid'.
- */
-static uint16_t
-vmx_vpid(void)
-{
-	uint16_t vpid = 0;
-
-	if ((procbased_ctls2 & PROCBASED2_ENABLE_VPID) != 0) {
-		do {
-			vpid = atomic_fetchadd_int(&nextvpid, 1);
-		} while (vpid == 0);
-	}
-
-	return (vpid);
-}
-
 static int
 vmx_setup_cr_shadow(int which, struct vmcs *vmcs, uint32_t initial)
 {
@@ -681,7 +742,7 @@
 static void *
 vmx_vminit(struct vm *vm)
 {
-	uint16_t vpid;
+	uint16_t vpid[VM_MAXCPU];
 	int i, error, guest_msr_count;
 	struct vmx *vmx;
 
@@ -744,6 +805,8 @@
 	if (!vmx_no_patmsr && guest_msr_rw(vmx, MSR_PAT))
 		panic("vmx_vminit: error setting guest pat msr access");
 
+	vpid_alloc(vpid, VM_MAXCPU);
+
 	for (i = 0; i < VM_MAXCPU; i++) {
 		vmx->vmcs[i].identifier = vmx_revision();
 		error = vmclear(&vmx->vmcs[i]);
@@ -752,8 +815,6 @@
 			      error, i);
 		}
 
-		vpid = vmx_vpid();
-
 		error = vmcs_set_defaults(&vmx->vmcs[i],
 					  (u_long)vmx_longjmp,
 					  (u_long)&vmx->ctx[i],
@@ -763,7 +824,7 @@
 					  procbased_ctls2,
 					  exit_ctls, entry_ctls,
 					  vtophys(vmx->msr_bitmap),
-					  vpid);
+					  vpid[i]);
 
 		if (error != 0)
 			panic("vmx_vminit: vmcs_set_defaults error %d", error);
@@ -772,7 +833,7 @@
 		vmx->cap[i].proc_ctls = procbased_ctls;
 
 		vmx->state[i].lastcpu = -1;
-		vmx->state[i].vpid = vpid;
+		vmx->state[i].vpid = vpid[i];
 
 		msr_save_area_init(vmx->guest_msrs[i], &guest_msr_count);
 
@@ -1580,9 +1641,12 @@
 static void
 vmx_vmcleanup(void *arg)
 {
-	int error;
+	int i, error;
 	struct vmx *vmx = arg;
 
+	for (i = 0; i < VM_MAXCPU; i++)
+		vpid_free(vmx->state[i].vpid);
+
 	/*
 	 * XXXSMP we also need to clear the VMCS active on the other vcpus.
 	 */

==== //depot/projects/smpng/sys/amd64/vmm/io/ppt.c#4 (text+ko) ====

@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/io/ppt.c 246686 2013-02-11 20:36:07Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/io/ppt.c 255342 2013-09-07 03:33:36Z grehan $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/ppt.c 246686 2013-02-11 20:36:07Z neel $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/ppt.c 255342 2013-09-07 03:33:36Z grehan $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -568,7 +568,7 @@
 			return (ENXIO);
 	
 		ppt->msix.arg[idx].pptdev = ppt;
-		ppt->msix.arg[idx].vec = msg;
+		ppt->msix.arg[idx].vec = msg & 0xFF;
 		ppt->msix.arg[idx].vcpu = (addr >> 12) & 0xFF;
 	
 		/* Setup the MSI-X interrupt */

==== //depot/projects/smpng/sys/arm/broadcom/bcm2835/bcm2835_gpio.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  *
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 249449 2013-04-13 21:21:13Z dim $");
+__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c 255370 2013-09-07 18:48:15Z loos $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,6 +52,8 @@
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
 
+#include <arm/broadcom/bcm2835/bcm2835_gpio.h>
+
 #include "gpio_if.h"
 
 #undef	DEBUG
@@ -87,17 +89,6 @@
 	struct bcm_gpio_sysctl	sc_sysctl[BCM_GPIO_PINS];
 };
 
-enum bcm_gpio_fsel {
-	BCM_GPIO_INPUT,
-	BCM_GPIO_OUTPUT,
-	BCM_GPIO_ALT5,
-	BCM_GPIO_ALT4,
-	BCM_GPIO_ALT0,
-	BCM_GPIO_ALT1,
-	BCM_GPIO_ALT2,
-	BCM_GPIO_ALT3,
-};
-
 enum bcm_gpio_pud {
 	BCM_GPIO_NONE,
 	BCM_GPIO_PULLDOWN,
@@ -257,6 +248,32 @@
 	BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0);
 }
 
+void
+bcm_gpio_set_alternate(device_t dev, uint32_t pin, uint32_t nfunc)
+{
+	struct bcm_gpio_softc *sc;
+	int i;
+
+	sc = device_get_softc(dev);
+	BCM_GPIO_LOCK(sc);
+
+	/* Disable pull-up or pull-down on pin. */
+	bcm_gpio_set_pud(sc, pin, BCM_GPIO_NONE);
+
+	/* And now set the pin function. */
+	bcm_gpio_set_function(sc, pin, nfunc);
+
+	/* Update the pin flags. */
+	for (i = 0; i < sc->sc_gpio_npins; i++) {
+		if (sc->sc_gpio_pins[i].gp_pin == pin)
+			break;
+	}
+	if (i < sc->sc_gpio_npins)
+		sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(nfunc);
+
+        BCM_GPIO_UNLOCK(sc);
+}
+
 static void
 bcm_gpio_pin_configure(struct bcm_gpio_softc *sc, struct gpio_pin *pin,
     unsigned int flags)
@@ -535,7 +552,7 @@
 	struct bcm_gpio_softc *sc;
 	struct bcm_gpio_sysctl *sc_sysctl;
 	uint32_t nfunc;
-	int i, error;
+	int error;
 
 	sc_sysctl = arg1;
 	sc = sc_sysctl->sc;
@@ -552,24 +569,9 @@
 	if (bcm_gpio_str_func(buf, &nfunc) != 0)
 		return (EINVAL);
 
-	BCM_GPIO_LOCK(sc);
-
-	/* Disable pull-up or pull-down on pin. */
-	bcm_gpio_set_pud(sc, sc_sysctl->pin, BCM_GPIO_NONE);
-
-	/* And now set the pin function. */
-	bcm_gpio_set_function(sc, sc_sysctl->pin, nfunc);
-
-	/* Update the pin flags. */
-	for (i = 0; i < sc->sc_gpio_npins; i++) {
-		if (sc->sc_gpio_pins[i].gp_pin == sc_sysctl->pin)
-			break;
-	}
-	if (i < sc->sc_gpio_npins)
-		sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(nfunc);
+	/* Update the pin alternate function. */
+	bcm_gpio_set_alternate(sc->sc_dev, sc_sysctl->pin, nfunc);
 
-	BCM_GPIO_UNLOCK(sc);
-
 	return (0);
 }
 
@@ -729,7 +731,7 @@
 		goto fail;
 
 	/* Initialize the software controlled pins. */
-	for (i = 0, j = 0; j < BCM_GPIO_PINS - 1; j++) {
+	for (i = 0, j = 0; j < BCM_GPIO_PINS; j++) {
 		if (bcm_gpio_pin_is_ro(sc, j))
 			continue;
 		snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME,

==== //depot/projects/smpng/sys/arm/include/ieee.h#6 (text+ko) ====

@@ -39,7 +39,7 @@
  *
  *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
  *
- * $FreeBSD: head/sys/arm/include/ieee.h 236992 2012-06-13 05:02:51Z imp $
+ * $FreeBSD: head/sys/arm/include/ieee.h 255361 2013-09-07 14:04:10Z andrew $
  *
  */
 
@@ -91,7 +91,7 @@
 #define	DBL_EXPBITS	11
 #define	DBL_FRACBITS	52
 
-#if defined(__VFP_FP__)
+#if defined(__VFP_FP__) || defined(__ARM_EABI__)
 #define	_IEEE_WORD_ORDER	_BYTE_ORDER
 #else
 #define	_IEEE_WORD_ORDER	_BIG_ENDIAN

==== //depot/projects/smpng/sys/arm/include/sf_buf.h#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/arm/include/sf_buf.h 255318 2013-09-06 17:44:13Z glebius $
+ * $FreeBSD: head/sys/arm/include/sf_buf.h 255352 2013-09-07 07:56:55Z glebius $
  */
 
 #ifndef _MACHINE_SF_BUF_H_
@@ -40,9 +40,6 @@
 
 struct sf_buf;
 
-struct sf_buf *	sf_buf_alloc(struct vm_page *m, int flags);
-void sf_buf_free(struct sf_buf *sf);
-
 static __inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)
 {
@@ -82,4 +79,8 @@
 }
 
 #endif
+
+struct sf_buf *	sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
+
 #endif /* !_MACHINE_SF_BUF_H_ */

==== //depot/projects/smpng/sys/cddl/dev/dtrace/dtrace_clone.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * $FreeBSD: head/sys/cddl/dev/dtrace/dtrace_clone.c 183381 2008-09-26 14:19:52Z ed $
+ * $FreeBSD: head/sys/cddl/dev/dtrace/dtrace_clone.c 255359 2013-09-07 13:45:44Z davide $
  *
  */
 
@@ -52,10 +52,6 @@
 	/* Clone the device to the new minor number. */
 	if (clone_create(&dtrace_clones, &dtrace_cdevsw, &u, dev, 0) != 0)
 		/* Create the /dev/dtrace/dtraceNN entry. */
-		*dev = make_dev_cred(&dtrace_cdevsw, u, cred,
+		*dev = make_dev_credf(MAKEDEV_REF, &dtrace_cdevsw, u, cred,
 		     UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace%d", u);
-	if (*dev != NULL) {
-		dev_ref(*dev);
-		(*dev)->si_flags |= SI_CHEAPCLONE;
-	}
 }

==== //depot/projects/smpng/sys/conf/files#289 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/conf/files 255219 2013-09-05 00:09:56Z pjd $
+# $FreeBSD: head/sys/conf/files 255362 2013-09-07 14:15:13Z markm $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -483,6 +483,16 @@
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/ipfilter/netinet/ip_nat6.c optional ipfilter inet \
+	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/ipfilter/netinet/ip_rules.c optional ipfilter inet \
+	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/ipfilter/netinet/ip_scan.c optional ipfilter inet \
+	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/ipfilter/netinet/ip_dstlist.c optional ipfilter inet \
+	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/ipfilter/netinet/radix_ipf.c optional ipfilter inet \
+	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/libfdt/fdt.c		optional fdt
 contrib/libfdt/fdt_ro.c		optional fdt
 contrib/libfdt/fdt_rw.c		optional fdt
@@ -2032,8 +2042,9 @@
 	clean		"rt2860.fw"
 dev/random/harvest.c		standard
 dev/random/hash.c		optional random
-dev/random/probe.c		optional random
+dev/random/pseudo_rng.c		standard
 dev/random/random_adaptors.c	standard
+dev/random/random_harvestq.c	standard
 dev/random/randomdev.c		optional random
 dev/random/randomdev_soft.c	optional random
 dev/random/yarrow.c		optional random

==== //depot/projects/smpng/sys/conf/files.mips#25 (text+ko) ====

@@ -1,7 +1,7 @@
 # This file tells config what files go into building a kernel,
 # files marked standard are always included.
 #
-# $FreeBSD: head/sys/conf/files.mips 255290 2013-09-06 05:38:20Z glebius $
+# $FreeBSD: head/sys/conf/files.mips 255367 2013-09-07 16:31:30Z jchandra $
 #
 
 # Arch dependent files
@@ -38,6 +38,7 @@
 mips/mips/stdatomic.c			standard \
 	compile-with "${NORMAL_C:N-Wmissing-prototypes}"
 mips/mips/support.S			standard
+mips/mips/bcopy.S			standard
 mips/mips/swtch.S			standard
 mips/mips/sys_machdep.c			standard
 mips/mips/tlb.c				standard

==== //depot/projects/smpng/sys/contrib/ipfilter/netinet/fil.c#28 (text+ko) ====

@@ -1,9 +1,14 @@
-/*	$FreeBSD: head/sys/contrib/ipfilter/netinet/fil.c 241546 2012-10-14 15:03:06Z glebius $	*/
+/*	$FreeBSD: head/sys/contrib/ipfilter/netinet/fil.c 255355 2013-09-07 09:47:18Z glebius $	*/
 
 /*
- * Copyright (C) 1993-2003 by Darren Reed.
+ * Copyright (C) 2012 by Darren Reed.
  *
  * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * Copyright 2008 Sun Microsystems.
+ *
+ * $Id$
+ *
  */
 #if defined(KERNEL) || defined(_KERNEL)
 # undef KERNEL
@@ -15,15 +20,6 @@
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/time.h>
-#if defined(__NetBSD__)
-# if (NetBSD >= 199905) && !defined(IPFILTER_LKM) && defined(_KERNEL)
-#  if (__NetBSD_Version__ < 301000000)
-#   include "opt_ipfilter_log.h"
-#  else
-#   include "opt_ipfilter.h"
-#  endif
-# endif
-#endif
 #if defined(_KERNEL) && defined(__FreeBSD_version) && \
     (__FreeBSD_version >= 220000)
 # if (__FreeBSD_version >= 400000)
@@ -82,23 +78,9 @@
 #ifdef sun
 # include <net/af.h>
 #endif
-#if !defined(_KERNEL) && (defined(__FreeBSD__) || defined(SOLARIS2))
-# if (__FreeBSD_version >= 504000)
-#  undef _RADIX_H_
-# endif
-# include "radix_ipf.h"
-#endif
-#ifdef __osf__
-# include "radix_ipf.h"
-#else
-# include <net/route.h>
-#endif
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
-#if !defined(linux)
-# include <netinet/ip_var.h>
-#endif
 #if defined(__sgi) && defined(IFF_DRVRLOCK) /* IRIX 6 */
 # include <sys/hashing.h>
 # include <netinet/in_var.h>
@@ -121,7 +103,6 @@
 #  include <netinet6/in6_var.h>
 # endif
 #endif
-#include <netinet/tcpip.h>
 #include "netinet/ip_fil.h"
 #include "netinet/ip_nat.h"
 #include "netinet/ip_frag.h"
@@ -131,9 +112,8 @@
 #ifdef IPFILTER_SCAN
 # include "netinet/ip_scan.h"
 #endif
-#ifdef IPFILTER_SYNC
-# include "netinet/ip_sync.h"
-#endif
+#include "netinet/ip_sync.h"
+#include "netinet/ip_lookup.h"
 #include "netinet/ip_pool.h"
 #include "netinet/ip_htable.h"
 #ifdef IPFILTER_COMPILED
@@ -144,120 +124,103 @@
 #endif
 #if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
 # include <sys/malloc.h>
-# if defined(_KERNEL) && !defined(IPFILTER_LKM)
-#  include "opt_ipfilter.h"
-# endif
 #endif
 #include "netinet/ipl.h"
+
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000)
+# include <sys/callout.h>
+extern struct callout ipf_slowtimer_ch;
+#endif
+#if defined(__OpenBSD__)
+# include <sys/timeout.h>
+extern struct timeout ipf_slowtimer_ch;
+#endif
 /* END OF INCLUDES */
 
-#include <machine/in_cksum.h>
-
 #if !defined(lint)
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
-static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/fil.c 241546 2012-10-14 15:03:06Z glebius $";
+static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/fil.c 255355 2013-09-07 09:47:18Z glebius $";
 /* static const char rcsid[] = "@(#)$Id: fil.c,v 2.243.2.125 2007/10/10 09:27:20 darrenr Exp $"; */
 #endif
 
 #ifndef	_KERNEL
 # include "ipf.h"
 # include "ipt.h"
-# include "bpf-ipf.h"
 extern	int	opts;
+extern	int	blockreason;
 #endif /* _KERNEL */
 
+#define	LBUMP(x)	softc->x++
+#define	LBUMPD(x, y)	do { softc->x.y++; DT(y); } while (0)
 
-fr_info_t	frcache[2][8];
-struct	filterstats frstats[2];
-struct	frentry	*ipfilter[2][2] = { { NULL, NULL }, { NULL, NULL } },
-		*ipfilter6[2][2] = { { NULL, NULL }, { NULL, NULL } },
-		*ipacct6[2][2] = { { NULL, NULL }, { NULL, NULL } },
-		*ipacct[2][2] = { { NULL, NULL }, { NULL, NULL } },
-		*ipnatrules[2][2] = { { NULL, NULL }, { NULL, NULL } };
-struct	frgroup *ipfgroups[IPL_LOGSIZE][2];
-char	ipfilter_version[] = IPL_VERSION;
-int	fr_refcnt = 0;
-/*
- * For fr_running:
- * 0 == loading, 1 = running, -1 = disabled, -2 = unloading
- */
-int	fr_running = 0;
-int	fr_flags = IPF_LOGGING;
-int	fr_active = 0;
-int	fr_control_forwarding = 0;
-int	fr_update_ipid = 0;
-u_short	fr_ip_id = 0;
-int	fr_chksrc = 0;	/* causes a system crash if enabled */
-int	fr_minttl = 4;
-int	fr_icmpminfragmtu = 68;
-u_long	fr_frouteok[2] = {0, 0};
-u_long	fr_userifqs = 0;
-u_long	fr_badcoalesces[2] = {0, 0};
-u_char	ipf_iss_secret[32];
-#if defined(IPFILTER_DEFAULT_BLOCK)

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


More information about the p4-projects mailing list