svn commit: r308011 - head/sys/dev/hyperv/netvsc

2016-10-27 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 05:56:23 2016
New Revision: 308011
URL: https://svnweb.freebsd.org/changeset/base/308011

Log:
  hyperv/hn: Rename cleaned up NVS header file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8353

Added:
  head/sys/dev/hyperv/netvsc/hn_nvs.h
 - copied unchanged from r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h
Deleted:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c

Copied: head/sys/dev/hyperv/netvsc/hn_nvs.h (from r308010, 
head/sys/dev/hyperv/netvsc/hv_net_vsc.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/netvsc/hn_nvs.h Fri Oct 28 05:56:23 2016
(r308011, copy of r308010, head/sys/dev/hyperv/netvsc/hv_net_vsc.h)
@@ -0,0 +1,106 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2010-2012 Citrix Inc.
+ * Copyright (c) 2012 NetApp Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _HN_NVS_H_
+#define _HN_NVS_H_
+
+struct hn_nvs_sendctx;
+struct vmbus_channel;
+struct hn_softc;
+
+typedef void   (*hn_nvs_sent_t)
+   (struct hn_nvs_sendctx *, struct hn_softc *,
+struct vmbus_channel *, const void *, int);
+
+struct hn_nvs_sendctx {
+   hn_nvs_sent_t   hn_cb;
+   void*hn_cbarg;
+};
+
+#define HN_NVS_SENDCTX_INITIALIZER(cb, cbarg)  \
+{  \
+   .hn_cb  = cb,   \
+   .hn_cbarg   = cbarg \
+}
+
+static __inline void
+hn_nvs_sendctx_init(struct hn_nvs_sendctx *sndc, hn_nvs_sent_t cb, void *cbarg)
+{
+
+   sndc->hn_cb = cb;
+   sndc->hn_cbarg = cbarg;
+}
+
+static __inline int
+hn_nvs_send(struct vmbus_channel *chan, uint16_t flags,
+void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc)
+{
+
+   return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags,
+   nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc));
+}
+
+static __inline int
+hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int 
sglen,
+void *nvs_msg, int nvs_msglen, struct hn_nvs_sendctx *sndc)
+{
+
+   return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen,
+   (uint64_t)(uintptr_t)sndc));
+}
+
+static __inline int
+hn_nvs_send_rndis_sglist(struct vmbus_channel *chan, uint32_t rndis_mtype,
+struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt)
+{
+   struct hn_nvs_rndis rndis;
+
+   rndis.nvs_type = HN_NVS_TYPE_RNDIS;
+   rndis.nvs_rndis_mtype = rndis_mtype;
+   rndis.nvs_chim_idx = HN_NVS_CHIM_IDX_INVALID;
+   rndis.nvs_chim_sz = 0;
+
+   return (hn_nvs_send_sglist(chan, gpa, gpa_cnt,
+   , sizeof(rndis), sndc));
+}
+
+inthn_nvs_attach(struct hn_softc *sc, int mtu);
+void   hn_nvs_detach(struct hn_softc *sc);
+inthn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch);
+void   hn_nvs_sent_xact(struct hn_nvs_sendctx *sndc,
+   struct hn_softc *sc, struct vmbus_channel *chan,
+   const void *data, int dlen);
+inthn_nvs_send_rndis_ctrl(struct vmbus_channel *chan,
+   struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa,
+   int gpa_cnt);
+
+extern struct hn_nvs_sendctx   hn_nvs_sendctx_none;
+
+#endif  /* !_HN_NVS_H_ */

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c

svn commit: r308010 - head/sys/dev/hyperv/netvsc

2016-10-27 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Oct 28 05:31:34 2016
New Revision: 308010
URL: https://svnweb.freebsd.org/changeset/base/308010

Log:
  hyperv/hn: Change header guardian; in preparation for the upcoming rename.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8352

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 28 03:54:19 2016
(r308009)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 28 05:31:34 2016
(r308010)
@@ -28,8 +28,8 @@
  * $FreeBSD$
  */
 
-#ifndef __HV_NET_VSC_H__
-#define __HV_NET_VSC_H__
+#ifndef _HN_NVS_H_
+#define _HN_NVS_H_
 
 struct hn_nvs_sendctx;
 struct vmbus_channel;
@@ -103,4 +103,4 @@ int hn_nvs_send_rndis_ctrl(struct vmbus
 
 extern struct hn_nvs_sendctx   hn_nvs_sendctx_none;
 
-#endif  /* __HV_NET_VSC_H__ */
+#endif  /* !_HN_NVS_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308008 - head/sys/net80211

2016-10-27 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 28 02:10:07 2016
New Revision: 308008
URL: https://svnweb.freebsd.org/changeset/base/308008

Log:
  [net80211] add comments!

Modified:
  head/sys/net80211/ieee80211_scan.c

Modified: head/sys/net80211/ieee80211_scan.c
==
--- head/sys/net80211/ieee80211_scan.c  Fri Oct 28 02:09:45 2016
(r308007)
+++ head/sys/net80211/ieee80211_scan.c  Fri Oct 28 02:10:07 2016
(r308008)
@@ -443,6 +443,9 @@ ieee80211_cancel_scan(struct ieee80211va
 
 /*
  * Cancel any scan currently going on.
+ *
+ * This is called during normal 802.11 data path to cancel
+ * a scan so a newly arrived normal data packet can be sent.
  */
 void
 ieee80211_cancel_anyscan(struct ieee80211vap *vap)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308007 - head/sys/net80211

2016-10-27 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 28 02:09:45 2016
New Revision: 308007
URL: https://svnweb.freebsd.org/changeset/base/308007

Log:
  [net80211] don't abort a background scan upon reception of a single packet.
  
  Full offload drivers don't need this behaviour - they do it in firmware.

Modified:
  head/sys/net80211/ieee80211_scan_sw.c

Modified: head/sys/net80211/ieee80211_scan_sw.c
==
--- head/sys/net80211/ieee80211_scan_sw.c   Fri Oct 28 00:04:04 2016
(r308006)
+++ head/sys/net80211/ieee80211_scan_sw.c   Fri Oct 28 02:09:45 2016
(r308007)
@@ -467,6 +467,11 @@ ieee80211_swscan_cancel_scan(struct ieee
 static void
 ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap)
 {
+
+   /* XXX for now - just don't do this per packet. */
+   if (vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD)
+   return;
+
cancel_scan(vap, 1, __func__);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308006 - in head/contrib/llvm/projects/libunwind: include src

2016-10-27 Thread Ed Maste
Author: emaste
Date: Fri Oct 28 00:04:04 2016
New Revision: 308006
URL: https://svnweb.freebsd.org/changeset/base/308006

Log:
  libunwind: consistently add \n to log and trace messages
  
  Previously most messages included a newline in the string, but a few of
  them were missing. Fix these and simplify by just adding the newline in
  the _LIBUNWIND_LOG macro itself.
  
  While here correct 'libuwind' typo (missing 'n').
  
  Upstream LLVM libunwind commits r280086 and r280103.

Modified:
  head/contrib/llvm/projects/libunwind/include/libunwind.h
  head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp
  head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp
  head/contrib/llvm/projects/libunwind/src/EHHeaderParser.hpp
  head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp
  head/contrib/llvm/projects/libunwind/src/Unwind-sjlj.c
  head/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp
  head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c
  head/contrib/llvm/projects/libunwind/src/UnwindLevel1.c
  head/contrib/llvm/projects/libunwind/src/config.h
  head/contrib/llvm/projects/libunwind/src/libunwind.cpp

Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h
==
--- head/contrib/llvm/projects/libunwind/include/libunwind.hThu Oct 27 
21:31:56 2016(r308005)
+++ head/contrib/llvm/projects/libunwind/include/libunwind.hFri Oct 28 
00:04:04 2016(r308006)
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //
-// Compatible with libuwind API documented at:
+// Compatible with libunwind API documented at:
 //   http://www.nongnu.org/libunwind/man/libunwind(3).html
 //
 
//===--===//
@@ -120,7 +120,7 @@ extern int unw_init_remote_thread(unw_cu
 #endif /* UNW_REMOTE */
 
 /*
- * traditional libuwind "remote" API
+ * traditional libunwind "remote" API
  *   NOT IMPLEMENTED on Mac OS X
  *
  * extern int   unw_init_remote(unw_cursor_t*, unw_addr_space_t,

Modified: head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp
==
--- head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp   Thu Oct 27 
21:31:56 2016(r308005)
+++ head/contrib/llvm/projects/libunwind/src/AddressSpace.hpp   Fri Oct 28 
00:04:04 2016(r308006)
@@ -374,7 +374,7 @@ inline bool LocalAddressSpace::findUnwin
   (_Unwind_Ptr) targetAddr, );
   info.arm_section_length = (uintptr_t)length;
  #endif
-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x\n",
+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
  info.arm_section, info.arm_section_length);
   if (info.arm_section && info.arm_section_length)
 return true;

Modified: head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hpp
==
--- head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hppThu Oct 
27 21:31:56 2016(r308005)
+++ head/contrib/llvm/projects/libunwind/src/CompactUnwinder.hppFri Oct 
28 00:04:04 2016(r308006)
@@ -105,7 +105,7 @@ int CompactUnwinder_x86::stepWithComp
 default:
   (void)functionStart;
   _LIBUNWIND_DEBUG_LOG("bad register for EBP frame, encoding=%08X for  "
-   "function starting at 0x%X\n",
+   "function starting at 0x%X",
 compactEncoding, functionStart);
   _LIBUNWIND_ABORT("invalid compact unwind encoding");
 }
@@ -224,7 +224,7 @@ int CompactUnwinder_x86::stepWithComp
   break;
 default:
   _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for "
-   "function starting at 0x%X\n",
+   "function starting at 0x%X",
encoding, functionStart);
   _LIBUNWIND_ABORT("invalid compact unwind encoding");
 }
@@ -336,7 +336,7 @@ int CompactUnwinder_x86_64::stepWithC
 default:
   (void)functionStart;
   _LIBUNWIND_DEBUG_LOG("bad register for RBP frame, encoding=%08X for "
-   "function starting at 0x%llX\n",
+   "function starting at 0x%llX",
 compactEncoding, functionStart);
   _LIBUNWIND_ABORT("invalid compact unwind encoding");
 }
@@ -455,7 +455,7 @@ int CompactUnwinder_x86_64::stepWithC
   break;
 default:
   _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for "
-   "function starting at 0x%llX\n",
+   "function starting at 0x%llX",
 encoding, functionStart);
   _LIBUNWIND_ABORT("invalid compact unwind encoding");
 }

Modified: 

svn commit: r308005 - head/sys/x86/cpufreq

2016-10-27 Thread John Baldwin
Author: jhb
Date: Thu Oct 27 21:31:56 2016
New Revision: 308005
URL: https://svnweb.freebsd.org/changeset/base/308005

Log:
  Add powerd(8) support for several families of AMD CPUs.
  
  Use the same logic to calculate the nominal CPU frequency from the P-state
  MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10.
  Family 0x14 was included in the original patch in the PR but I left that
  out as the BIOS writer's guide for family 0x14 CPUs show a different layout
  for the relevant MSR and include a different formulate for calculating the
  frequency.
  
  While here, simplify a few expressions and print out the family of
  unsupported CPUs in hex rather than decimal.
  
  PR:   212020
  Submitted by: Anthony Jenkins 
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D7587

Modified:
  head/sys/x86/cpufreq/hwpstate.c

Modified: head/sys/x86/cpufreq/hwpstate.c
==
--- head/sys/x86/cpufreq/hwpstate.c Thu Oct 27 21:23:14 2016
(r308004)
+++ head/sys/x86/cpufreq/hwpstate.c Thu Oct 27 21:31:56 2016
(r308005)
@@ -408,25 +408,27 @@ hwpstate_get_info_from_msr(device_t dev)
hwpstate_set = sc->hwpstate_settings;
for (i = 0; i < sc->cfnum; i++) {
msr = rdmsr(MSR_AMD_10H_11H_CONFIG + i);
-   if ((msr & ((uint64_t)1 << 63)) != ((uint64_t)1 << 63)) {
+   if ((msr & ((uint64_t)1 << 63)) == 0) {
HWPSTATE_DEBUG(dev, "msr is not valid.\n");
return (ENXIO);
}
did = AMD_10H_11H_CUR_DID(msr);
fid = AMD_10H_11H_CUR_FID(msr);
+
+   /* Convert fid/did to frequency. */
switch(family) {
case 0x11:
-   /* fid/did to frequency */
-   hwpstate_set[i].freq = 100 * (fid + 0x08) / (1 << did);
+   hwpstate_set[i].freq = (100 * (fid + 0x08)) >> did;
break;
case 0x10:
-   /* fid/did to frequency */
-   hwpstate_set[i].freq = 100 * (fid + 0x10) / (1 << did);
+   case 0x12:
+   case 0x15:
+   case 0x16:
+   hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did;
break;
default:
-   HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family %d 
CPU's are not implemented yet. sorry.\n", family);
+   HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family 
0x%02x CPU's are not implemented yet. sorry.\n", family);
return (ENXIO);
-   break;
}
hwpstate_set[i].pstate_id = i;
/* There was volts calculation, but deleted it. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308004 - in head/sys: amd64/amd64 i386/i386 x86/include

2016-10-27 Thread John Baldwin
Author: jhb
Date: Thu Oct 27 21:23:14 2016
New Revision: 308004
URL: https://svnweb.freebsd.org/changeset/base/308004

Log:
  MFamd64: Add bounds checks on addresses used with /dev/mem.
  
  Reject attempts to read from or memory map offsets in /dev/mem that are
  beyond the maximum-supported physical address of the current CPU.
  
  Reviewed by:  kib
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D7408

Modified:
  head/sys/amd64/amd64/mem.c
  head/sys/i386/i386/mem.c
  head/sys/x86/include/x86_var.h

Modified: head/sys/amd64/amd64/mem.c
==
--- head/sys/amd64/amd64/mem.c  Thu Oct 27 18:46:52 2016(r308003)
+++ head/sys/amd64/amd64/mem.c  Thu Oct 27 21:23:14 2016(r308004)
@@ -140,7 +140,7 @@ memrw(struct cdev *dev, struct uio *uio,
error = uiomove((void *)vd, c, uio);
break;
}
-   if (v >= (1ULL << cpu_maxphyaddr)) {
+   if (v > cpu_getmaxphyaddr()) {
error = EFAULT;
break;
}
@@ -169,7 +169,7 @@ memmmap(struct cdev *dev, vm_ooffset_t o
 int prot __unused, vm_memattr_t *memattr __unused)
 {
if (dev2unit(dev) == CDEV_MINOR_MEM) {
-   if (offset >= (1ULL << cpu_maxphyaddr))
+   if (offset > cpu_getmaxphyaddr())
return (-1);
*paddr = offset;
return (0);

Modified: head/sys/i386/i386/mem.c
==
--- head/sys/i386/i386/mem.cThu Oct 27 18:46:52 2016(r308003)
+++ head/sys/i386/i386/mem.cThu Oct 27 21:23:14 2016(r308004)
@@ -108,8 +108,11 @@ memrw(struct cdev *dev, struct uio *uio,
continue;
}
if (dev2unit(dev) == CDEV_MINOR_MEM) {
-   pa = uio->uio_offset;
-   pa &= ~PAGE_MASK;
+   if (uio->uio_offset > cpu_getmaxphyaddr()) {
+   error = EFAULT;
+   break;
+   }
+   pa = trunc_page(uio->uio_offset);
} else {
/*
 * Extract the physical page since the mapping may
@@ -162,6 +165,8 @@ memmmap(struct cdev *dev, vm_ooffset_t o
 int prot __unused, vm_memattr_t *memattr __unused)
 {
if (dev2unit(dev) == CDEV_MINOR_MEM) {
+   if (offset > cpu_getmaxphyaddr())
+   return (-1);
*paddr = offset;
return (0);
}

Modified: head/sys/x86/include/x86_var.h
==
--- head/sys/x86/include/x86_var.h  Thu Oct 27 18:46:52 2016
(r308003)
+++ head/sys/x86/include/x86_var.h  Thu Oct 27 21:23:14 2016
(r308004)
@@ -94,6 +94,20 @@ struct   trapframe;
  */
 typedef void alias_for_inthand_t(void);
 
+/*
+ * Returns the maximum physical address that can be used with the
+ * current system.
+ */
+static __inline vm_paddr_t
+cpu_getmaxphyaddr(void)
+{
+#if defined(__i386__) && !defined(PAE)
+   return (0x);
+#else
+   return ((1ULL << cpu_maxphyaddr) - 1);
+#endif
+}
+
 void   *alloc_fpusave(int flags);
 void   busdma_swi(void);
 bool   cpu_mwait_usable(void);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308003 - head/share/mk

2016-10-27 Thread Dimitry Andric
Author: dim
Date: Thu Oct 27 18:46:52 2016
New Revision: 308003
URL: https://svnweb.freebsd.org/changeset/base/308003

Log:
  Revert r307823 (Use upstream suffixes for LLVM IR) for now.  It causes a
  number of ports to fail, which use bmake, and use .ll file extensions
  (usually for for C++-based lex input).
  
  Reported by:  antoine

Modified:
  head/share/mk/bsd.suffixes.mk
  head/share/mk/sys.mk

Modified: head/share/mk/bsd.suffixes.mk
==
--- head/share/mk/bsd.suffixes.mk   Thu Oct 27 15:51:39 2016
(r308002)
+++ head/share/mk/bsd.suffixes.mk   Thu Oct 27 18:46:52 2016
(r308003)
@@ -20,10 +20,10 @@
${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
 
-.c.bc:
+.c.bco:
${CC} -emit-llvm ${IR_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 
-.c.ll:
+.c.llo:
${CC} -emit-llvm ${IR_CFLAGS} -S ${.IMPSRC} -o ${.TARGET}
 
 .cc .cpp .cxx .C:
@@ -32,10 +32,10 @@
 .cc.o .cpp.o .cxx.o .C.o:
${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 
-.cc.bc .cpp.bc .cxx.bc .C.bc:
+.cc.bco .cpp.bco .cxx.bco .C.bco:
${CXX} -emit-llvm ${IR_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 
-.cc.ll .cpp.ll .cxx.ll .C.ll:
+.cc.llo .cpp.llo .cxx.llo .C.llo:
${CXX} -emit-llvm ${IR_CXXFLAGS} -S ${.IMPSRC} -o ${.TARGET}
 
 .m.o:

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkThu Oct 27 15:51:39 2016(r308002)
+++ head/share/mk/sys.mkThu Oct 27 18:46:52 2016(r308003)
@@ -121,7 +121,7 @@ META_MODE?= normal
 .if defined(%POSIX)
 .SUFFIXES: .o .c .y .l .a .sh .f
 .else
-.SUFFIXES: .out .a .ln .o .bc .ll .c .cc .cpp .cxx .C .m .F .f .e .r .y .l 
.S .asm .s .cl .p .h .sh
+.SUFFIXES: .out .a .ln .o .bco .llo .c .cc .cpp .cxx .C .m .F .f .e .r .y 
.l .S .asm .s .cl .p .h .sh
 .endif
 
 AR ?=  ar
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307936 - head/sys/amd64/amd64

2016-10-27 Thread Tijl Coosemans
On Wed, 26 Oct 2016 16:25:50 +0300 Konstantin Belousov  
wrote:
> On Tue, Oct 25, 2016 at 09:26:00PM +0200, Tijl Coosemans wrote:
>> On Tue, 25 Oct 2016 17:13:46 + (UTC) Gleb Smirnoff  
>> wrote:  
>>> Author: glebius
>>> Date: Tue Oct 25 17:13:46 2016
>>> New Revision: 307936
>>> URL: https://svnweb.freebsd.org/changeset/base/307936
>>> 
>>> Log:
>>>   The argument validation in r296956 was not enough to close all possible
>>>   overflows in sysarch(2).
>>>   
>>>   Submitted by: Kun Yang 
>>>   Patch by: kib
>>>   Security: SA-16:15
>>> 
>>> Modified:
>>>   head/sys/amd64/amd64/sys_machdep.c  
>> 
>> This patch and r296956 need to be applied to i386 too, don't they?  
> I do not think so.  The amd64 bug is that I thought that the overflow
> checks were not needed, which appeared to be not true.
> 
> i386_set_ldt(), which is the i386 version of amd64_set_ldt(), already
> contained the comparisions of largest_ld with pldt->ldt_len etc.
> 
> Still, independend look at the i386 (and amd64 version as well) is more
> than welcomed, so please read the code yourself.

It looks ok to me.  i386 checks kargs.largs.num > MAX_LD early in sysarch
so start + num cannot overflow.  On amd64 this check was removed in
https://svnweb.freebsd.org/base?view=revision=217543
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308001 - head/lib/libgcc_eh

2016-10-27 Thread Ed Maste
Author: emaste
Date: Thu Oct 27 14:21:54 2016
New Revision: 308001
URL: https://svnweb.freebsd.org/changeset/base/308001

Log:
  libgcc_eh/libgcc_s: apply hidden visibility only to static libs

Modified:
  head/lib/libgcc_eh/Makefile.inc

Modified: head/lib/libgcc_eh/Makefile.inc
==
--- head/lib/libgcc_eh/Makefile.inc Thu Oct 27 09:46:22 2016
(r308000)
+++ head/lib/libgcc_eh/Makefile.inc Thu Oct 27 14:21:54 2016
(r308001)
@@ -4,7 +4,7 @@ COMPILERRTDIR=  ${SRCTOP}/contrib/compile
 UNWINDINCDIR=  ${SRCTOP}/contrib/llvm/projects/libunwind/include
 UNWINDSRCDIR=  ${SRCTOP}/contrib/llvm/projects/libunwind/src
 
-CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
+STATIC_CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
 
 .PATH: ${COMPILERRTDIR}/lib/builtins
 .PATH: ${UNWINDSRCDIR}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308000 - in head/sys: dev/netmap net

2016-10-27 Thread Luigi Rizzo
Author: luigi
Date: Thu Oct 27 09:46:22 2016
New Revision: 308000
URL: https://svnweb.freebsd.org/changeset/base/308000

Log:
  Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
  - use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range
(thanks to RedHat)
  - export memory pool information through PCI registers
  - improve mechanism for configuring passthrough on different hypervisors
  Code is from Vincenzo Maffione as a follow up to his GSOC work.

Modified:
  head/sys/dev/netmap/if_ptnet.c
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_freebsd.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_mem2.c
  head/sys/dev/netmap/netmap_mem2.h
  head/sys/dev/netmap/netmap_pt.c
  head/sys/dev/netmap/netmap_vale.c
  head/sys/net/netmap.h
  head/sys/net/netmap_virt.h

Modified: head/sys/dev/netmap/if_ptnet.c
==
--- head/sys/dev/netmap/if_ptnet.c  Thu Oct 27 09:11:36 2016
(r307999)
+++ head/sys/dev/netmap/if_ptnet.c  Thu Oct 27 09:46:22 2016
(r308000)
@@ -291,7 +291,7 @@ static inline void ptnet_kick(struct ptn
 static int
 ptnet_attach(device_t dev)
 {
-   uint32_t ptfeatures = PTNETMAP_F_BASE;
+   uint32_t ptfeatures = 0;
unsigned int num_rx_rings, num_tx_rings;
struct netmap_adapter na_arg;
unsigned int nifp_offset;
@@ -315,19 +315,12 @@ ptnet_attach(device_t dev)
return (ENXIO);
}
 
-   /* Check if we are supported by the hypervisor. If not,
-* bail out immediately. */
+   /* Negotiate features with the hypervisor. */
if (ptnet_vnet_hdr) {
ptfeatures |= PTNETMAP_F_VNET_HDR;
}
bus_write_4(sc->iomem, PTNET_IO_PTFEAT, ptfeatures); /* wanted */
ptfeatures = bus_read_4(sc->iomem, PTNET_IO_PTFEAT); /* acked */
-   if (!(ptfeatures & PTNETMAP_F_BASE)) {
-   device_printf(dev, "Hypervisor does not support netmap "
-  "passthorugh\n");
-   err = ENXIO;
-   goto err_path;
-   }
sc->ptfeatures = ptfeatures;
 
/* Allocate CSB and carry out CSB allocation protocol (CSBBAH first,
@@ -474,7 +467,8 @@ ptnet_attach(device_t dev)
na_arg.nm_txsync = ptnet_nm_txsync;
na_arg.nm_rxsync = ptnet_nm_rxsync;
 
-   netmap_pt_guest_attach(_arg, sc->csb, nifp_offset, ptnet_nm_ptctl);
+   netmap_pt_guest_attach(_arg, sc->csb, nifp_offset,
+bus_read_4(sc->iomem, PTNET_IO_HOSTMEMID));
 
/* Now a netmap adapter for this ifp has been allocated, and it
 * can be accessed through NA(ifp). We also have to initialize the CSB
@@ -1082,13 +1076,12 @@ static uint32_t
 ptnet_nm_ptctl(if_t ifp, uint32_t cmd)
 {
struct ptnet_softc *sc = if_getsoftc(ifp);
-   int ret;
-
+   /*
+* Write a command and read back error status,
+* with zero meaning success.
+*/
bus_write_4(sc->iomem, PTNET_IO_PTCTL, cmd);
-   ret = bus_read_4(sc->iomem, PTNET_IO_PTSTS);
-   device_printf(sc->dev, "PTCTL %u, ret %u\n", cmd, ret);
-
-   return ret;
+   return bus_read_4(sc->iomem, PTNET_IO_PTCTL);
 }
 
 static int
@@ -1196,7 +1189,7 @@ ptnet_nm_register(struct netmap_adapter 
 
/* Make sure the host adapter passed through is ready
 * for txsync/rxsync. */
-   ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_REGIF);
+   ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_CREATE);
if (ret) {
return ret;
}
@@ -1246,7 +1239,7 @@ ptnet_nm_register(struct netmap_adapter 
}
 
if (sc->ptna->backend_regifs == 0) {
-   ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_UNREGIF);
+   ret = ptnet_nm_ptctl(ifp, PTNETMAP_PTCTL_DELETE);
}
}
 

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cThu Oct 27 09:11:36 2016
(r307999)
+++ head/sys/dev/netmap/netmap.cThu Oct 27 09:46:22 2016
(r308000)
@@ -2186,7 +2186,11 @@ netmap_ioctl(struct netmap_priv_d *priv,
break;
 
case NIOCREGIF:
-   /* possibly attach/detach NIC and VALE switch */
+   /*
+* If nmr->nr_cmd is not zero, this NIOCREGIF is not really
+* a regif operation, but a different one, specified by the
+* value of nmr->nr_cmd.
+*/
i = nmr->nr_cmd;
if (i == NETMAP_BDG_ATTACH || i == NETMAP_BDG_DETACH
|| i == NETMAP_BDG_VNET_HDR
@@ -2194,12 +2198,15 @@ netmap_ioctl(struct netmap_priv_d *priv,
 

svn commit: r307994 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-10-27 Thread Andriy Gapon
Author: avg
Date: Thu Oct 27 07:38:07 2016
New Revision: 307994
URL: https://svnweb.freebsd.org/changeset/base/307994

Log:
  3746 ZRLs are racy
  
  illumos/illumos-gate@260af64db74a52d64de8c6c5f67dd0a71d228ca5
  
https://github.com/illumos/illumos-gate/commit/260af64db74a52d64de8c6c5f67dd0a71d228ca5
  
  https://www.illumos.org/issues/3746
From the original change log:
It was possible for a reference to be added even with the lock held, and
for references added just after a lock release to be lost.
This bug was also independently found and reported in wesunsolve.net
issues 6985013 6995524.
In zrl_add(), always use an atomic operation to update the refcount.
The mutex in the ZRL only guarantees that wakeups occur for waiters on the
lock. It offers no protection against concurrent updates of the refcount.
The only refcount transition that is safe to perform without an atomic
operation is from ZRL_LOCKED back to 0, since this can only be performed
by the thread which has the ZRL locked.
  
  Authored by: Will Andrews 
  Reviewed by: Boris Protopopov 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Yuri Pankov 
  Reviewed by: Justin T. Gibbs 
  Approved by: Matt Ahrens 
  Author: Youzhong Yang 
  PR:   204037
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.cThu Oct 
27 07:11:31 2016(r307993)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.cThu Oct 
27 07:38:07 2016(r307994)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, 2015 by Delphix. All rights reserved.
+ * Copyright 2016 The MathWorks, Inc. All rights reserved.
  */
 
 /*
@@ -71,37 +72,32 @@ zrl_destroy(zrlock_t *zrl)
 void
 zrl_add_impl(zrlock_t *zrl, const char *zc)
 {
-   uint32_t n = (uint32_t)zrl->zr_refcount;
-
-   while (n != ZRL_LOCKED) {
-   uint32_t cas = atomic_cas_32(
-   (uint32_t *)>zr_refcount, n, n + 1);
-   if (cas == n) {
-   ASSERT3S((int32_t)n, >=, 0);
-#ifdef ZFS_DEBUG
-   if (zrl->zr_owner == curthread) {
-   DTRACE_PROBE2(zrlock__reentry,
-   zrlock_t *, zrl, uint32_t, n);
-   }
-   zrl->zr_owner = curthread;
-   zrl->zr_caller = zc;
+   for (;;) {
+   uint32_t n = (uint32_t)zrl->zr_refcount;
+   while (n != ZRL_LOCKED) {
+   uint32_t cas = atomic_cas_32(
+   (uint32_t *)>zr_refcount, n, n + 1);
+   if (cas == n) {
+   ASSERT3S((int32_t)n, >=, 0);
+#ifdef ZFS_DEBUG
+   if (zrl->zr_owner == curthread) {
+   DTRACE_PROBE2(zrlock__reentry,
+   zrlock_t *, zrl, uint32_t, n);
+   }
+   zrl->zr_owner = curthread;
+   zrl->zr_caller = zc;
 #endif
-   return;
+   return;
+   }
+   n = cas;
}
-   n = cas;
-   }
 
-   mutex_enter(>zr_mtx);
-   while (zrl->zr_refcount == ZRL_LOCKED) {
-   cv_wait(>zr_cv, >zr_mtx);
+   mutex_enter(>zr_mtx);
+   while (zrl->zr_refcount == ZRL_LOCKED) {
+   cv_wait(>zr_cv, >zr_mtx);
+   }
+   mutex_exit(>zr_mtx);
}
-   ASSERT3S(zrl->zr_refcount, >=, 0);
-   zrl->zr_refcount++;
-#ifdef ZFS_DEBUG
-   zrl->zr_owner = curthread;
-   zrl->zr_caller = zc;
-#endif
-   mutex_exit(>zr_mtx);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"