Re: svn commit: r277179 - in head/sys: dev/usb kern sys

2015-01-14 Thread Hans Petter Selasky

On 01/14/15 18:57, Andrey V. Elsukov wrote:

On 14.01.2015 17:04, Hans Petter Selasky wrote:

Author: hselasky
Date: Wed Jan 14 14:04:29 2015
New Revision: 277179
URL: https://svnweb.freebsd.org/changeset/base/277179

Log:
   Add a kernel function to delist our kernel character devices, so that
   the device name can be re-used right away in case we are destroying
   the character devices in the background.

   MFC after:   4 days
   Reported by: dchagin@

Modified:
   head/sys/dev/usb/usb_device.c
   head/sys/kern/kern_conf.c
   head/sys/sys/conf.h

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Wed Jan 14 13:03:03 2015
(r277178)
+++ head/sys/dev/usb/usb_device.c   Wed Jan 14 14:04:29 2015
(r277179)
@@ -2019,7 +2019,10 @@ usb_destroy_dev(struct usb_fs_privdata *
usb_destroy_dev_sync(pd);
return;
}
-   
+
+   /* make sure we can re-use the device name */
+   delist_dev(pd-cdev);
+
USB_BUS_LOCK(bus);
LIST_INSERT_HEAD(bus-pd_cleanup_list, pd, pd_next);
/* get cleanup going */

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Wed Jan 14 13:03:03 2015(r277178)
+++ head/sys/kern/kern_conf.c   Wed Jan 14 14:04:29 2015(r277179)
@@ -1114,6 +1114,23 @@ destroy_devl(struct cdev *dev)
}
  }

+static void
+delist_dev_locked(struct cdev *dev)
+{
+   struct cdev *child;
+   devfs_destroy(dev);
+   LIST_FOREACH(child, dev-si_children, si_siblings)
+   delist_dev_locked(child);
+}


It looks a bit strange. First you call destroy(dev), then you are trying
enumerate its children. It is ok?



Hi,

Maybe you misread dev_destroy() with devfs_destroy(). devfs_destroy() 
only clears a flag bit, so that the devfs system does no longer show the 
device and the duplicate device check done when you create a new 
character device is not seeing the yet-to-be destroyed device. It should 
be OK from what I can see and have tested.


--HPS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277201 - head/contrib/compiler-rt/lib/sanitizer_common

2015-01-14 Thread Dimitry Andric
Author: dim
Date: Wed Jan 14 22:37:11 2015
New Revision: 277201
URL: https://svnweb.freebsd.org/changeset/base/277201

Log:
  Remove the netinet/ip_compat.h include from one of the newly added
  sanitizer sources.  It is apparently unnecessary, and causes trouble for
  people using WITHOUT_IPFILTER.
  
  Reported by:  Pawel Biernacki pawel.bierna...@gmail.com, Kurt Lidl 
l...@pix.net

Modified:
  
head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc

Modified: 
head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
==
--- 
head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
Wed Jan 14 22:16:07 2015(r277200)
+++ 
head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
Wed Jan 14 22:37:11 2015(r277201)
@@ -97,7 +97,6 @@
 # include sys/link_elf.h
 # include netinet/ip_mroute.h
 # include netinet/in.h
-# include netinet/ip_compat.h
 # include net/ethernet.h
 # include net/ppp_defs.h
 # include glob.h
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277163 - head/sys/dev/cardbus

2015-01-14 Thread Warner Losh

 On Jan 14, 2015, at 8:32 AM, Justin Hibbits chmeeed...@gmail.com wrote:
 
 On Wed, 14 Jan 2015 09:23:05 -0500
 John Baldwin j...@freebsd.org wrote:
 
 On 1/14/15 12:41 AM, Warner Losh wrote:
 Author: imp
 Date: Wed Jan 14 05:41:31 2015
 New Revision: 277163
 URL: https://svnweb.freebsd.org/changeset/base/277163
 
 Log:
  Add a rather obnoxious warning if you don't have NEW_PCIB defined
  since it's a total crap shoot if things will work.
 
 Should we just make it a #error instead?  (Some day I hope to have
 NEW_PCIB enabled by default and remove the old code.  Will take a
 while to get there for the generic PCI code, but cardbus is probably
 only used on x86 so that would be fine.)
 
 
 Also powerpc, but NEW_PCIB is default there as well.

PowerPC doesn’t seem to defined the bus number resources.

Warner



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r277203 - in head/sys: kern sys

2015-01-14 Thread Robert Watson
Author: rwatson
Date: Wed Jan 14 23:44:00 2015
New Revision: 277203
URL: https://svnweb.freebsd.org/changeset/base/277203

Log:
  In order to support ongoing work to implement variable-size mbufs, and
  more generally make it easier to extend 'struct mbuf in the future', make
  a number of changes to the data structure:
  
  - As we anticipate embedding mbufs headers within variable-size regions of
memory in the future, change the definitions of byte arrays embedded in
mbufs to be of size [0] rather than [MLEN] and [MHLEN].  In fact, the
cxgbe driver already uses 'struct mbuf' on the front of other storage
sizes, but we would like the global mbuf allocator do be able to do this
as well.
  
  - Fold 'struct m_hdr' into 'struct mbuf' itself, eliminating a set of
macros that aliased 'mh_foo' field names to 'm_foo' names such as
'm_next'.  These present a particular problem as we would like to add
new mbuf-header fields -- e.g., 'm_size' -- that, if similarly named via
macros, would introduce collisions with many other variable names in the
kernel.
  
  - Rename 'struct m_ext' to 'struct struct_m_ext' so that we can add
compile-time assertions without bumping into the still-extant 'm_ext'
macro.
  
  - Remove the MSIZE compile-time assertion for 'struct mbuf', but add new
assertions for alignment of embedded data arrays (64-bit alignment even
on 32-bit platforms), and for the sizes the mbuf header, packet header,
and m_ext structure.
  
  - Document that these assertions exist in comments in mbuf.h.
  
  This change is not intended to cause (non-trivial) behavioural
  differences, but is a precursor to further mbuf-allocator work.
  
  Differential Revision:https://reviews.freebsd.org/D1483
  Reviewed by:  bz, gnn, np, glebius (go ahead, I trust you)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Wed Jan 14 23:34:00 2015(r277202)
+++ head/sys/kern/uipc_mbuf.c   Wed Jan 14 23:44:00 2015(r277203)
@@ -88,11 +88,38 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, m_defrag
  * Ensure the correct size of various mbuf parameters.  It could be off due
  * to compiler-induced padding and alignment artifacts.
  */
-CTASSERT(sizeof(struct mbuf) == MSIZE);
 CTASSERT(MSIZE - offsetof(struct mbuf, m_dat) == MLEN);
 CTASSERT(MSIZE - offsetof(struct mbuf, m_pktdat) == MHLEN);
 
 /*
+ * mbuf data storage should be 64-bit aligned regardless of architectural
+ * pointer size; check this is the case with and without a packet header.
+ */
+CTASSERT(offsetof(struct mbuf, m_dat) % 8 == 0);
+CTASSERT(offsetof(struct mbuf, m_pktdat) % 8 == 0);
+
+/*
+ * While the specific values here don't matter too much (i.e., +/- a few
+ * words), we do want to ensure that changes to these values are carefully
+ * reasoned about and properly documented.  This is especially the case as
+ * network-protocol and device-driver modules encode these layouts, and must
+ * be recompiled if the structures change.  Check these values at compile time
+ * against the ones documented in comments in mbuf.h.
+ *
+ * NB: Possibly they should be documented there via #define's and not just
+ * comments.
+ */
+#if defined(__LP64__)
+CTASSERT(offsetof(struct mbuf, m_dat) == 32);
+CTASSERT(sizeof(struct pkthdr) == 56);
+CTASSERT(sizeof(struct struct_m_ext) == 48);
+#else
+CTASSERT(offsetof(struct mbuf, m_dat) == 24);
+CTASSERT(sizeof(struct pkthdr) == 48);
+CTASSERT(sizeof(struct struct_m_ext) == 28);
+#endif
+
+/*
  * m_get2() allocates minimum mbuf that would fit size argument.
  */
 struct mbuf *

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Wed Jan 14 23:34:00 2015(r277202)
+++ head/sys/sys/mbuf.h Wed Jan 14 23:44:00 2015(r277203)
@@ -60,9 +60,15 @@
  * MLEN is data length in a normal mbuf.
  * MHLEN is data length in an mbuf with pktheader.
  * MINCLSIZE is a smallest amount of data that should be put into cluster.
+ *
+ * Compile-time assertions in uipc_mbuf.c test these values to ensure that
+ * they are sensible.
  */
-#defineMLEN((int)(MSIZE - sizeof(struct m_hdr)))
-#defineMHLEN   ((int)(MLEN - sizeof(struct pkthdr)))
+struct mbuf;
+#defineMHSIZE  offsetof(struct mbuf, M_dat.M_databuf)
+#defineMPKTHSIZE   offsetof(struct mbuf, 
M_dat.MH.MH_dat.MH_databuf)
+#defineMLEN((int)(MSIZE - MHSIZE))
+#defineMHLEN   ((int)(MSIZE - MPKTHSIZE))
 #defineMINCLSIZE   (MHLEN + 1)
 
 #ifdef _KERNEL
@@ -87,23 +93,6 @@ struct mb_args {
 #endif /* _KERNEL */
 
 /*
- * Header present at the beginning of every mbuf.
- * Size ILP32: 24
- *  LP64: 32
- */
-struct m_hdr {
-   struct mbuf

svn commit: r277199 - in head/sys: fs/devfs kern

2015-01-14 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 14 22:07:13 2015
New Revision: 277199
URL: https://svnweb.freebsd.org/changeset/base/277199

Log:
  Avoid race with dev_rel() when using the recently added
  delist_dev() function. Make sure the character device structure
  doesn't go away until the end of the destroy_dev() function due to
  concurrently running cleanup code inside devfs_populate().
  
  MFC after:1 week
  Reported by:  dchagin@

Modified:
  head/sys/fs/devfs/devfs_devs.c
  head/sys/kern/kern_conf.c

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Wed Jan 14 22:05:57 2015
(r277198)
+++ head/sys/fs/devfs/devfs_devs.c  Wed Jan 14 22:07:13 2015
(r277199)
@@ -137,6 +137,12 @@ devfs_alloc(int flags)
vfs_timestamp(ts);
cdev-si_atime = cdev-si_mtime = cdev-si_ctime = ts;
cdev-si_cred = NULL;
+   /*
+* Avoid race with dev_rel() by setting the initial
+* reference count to 1. This last reference is taken
+* by the destroy_dev() function.
+*/
+   cdev-si_refcount = 1;
 
return (cdev);
 }

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Wed Jan 14 22:05:57 2015(r277198)
+++ head/sys/kern/kern_conf.c   Wed Jan 14 22:07:13 2015(r277199)
@@ -1048,8 +1048,6 @@ destroy_devl(struct cdev *dev)
/* Remove name marking */
dev-si_flags = ~SI_NAMED;
 
-   dev-si_refcount++; /* Avoid race with dev_rel() */
-
/* If we are a child, remove us from the parents list */
if (dev-si_flags  SI_CHILD) {
LIST_REMOVE(dev, si_siblings);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277205 - in head: sys/boot/common sys/sys usr.sbin/kldxref

2015-01-14 Thread Warner Losh
Author: imp
Date: Thu Jan 15 00:46:30 2015
New Revision: 277205
URL: https://svnweb.freebsd.org/changeset/base/277205

Log:
  Reserve and ignore the a new module metadata type MDT_PNP_INFO for
  associating an optional PNP hint table with this module. In the
  future, when these are added, these changes will silently ignore the
  new type they would otherwise warn about. It will always be safe to
  ignore this data. Get this into the builds today for some future
  proofing.
  
  MFC After: 3 days

Modified:
  head/sys/boot/common/load_elf_obj.c
  head/sys/sys/module.h
  head/usr.sbin/kldxref/kldxref.c

Modified: head/sys/boot/common/load_elf_obj.c
==
--- head/sys/boot/common/load_elf_obj.c Thu Jan 15 00:42:06 2015
(r277204)
+++ head/sys/boot/common/load_elf_obj.c Thu Jan 15 00:46:30 2015
(r277205)
@@ -416,6 +416,7 @@ __elfN(obj_parse_modmetadata)(struct pre
modcnt++;
break;
case MDT_MODULE:
+   case MDT_PNP_INFO:
break;
default:
printf(unknown type %d\n, md.md_type);

Modified: head/sys/sys/module.h
==
--- head/sys/sys/module.h   Thu Jan 15 00:42:06 2015(r277204)
+++ head/sys/sys/module.h   Thu Jan 15 00:46:30 2015(r277205)
@@ -35,6 +35,7 @@
 #defineMDT_DEPEND  1   /* argument is a module name */
 #defineMDT_MODULE  2   /* module declaration */
 #defineMDT_VERSION 3   /* module version(s) */
+#defineMDT_PNP_INFO4   /* Plug and play hints record */
 
 #defineMDT_STRUCT_VERSION  1   /* version of metadata 
structure */
 #defineMDT_SETNAME modmetadata_set

Modified: head/usr.sbin/kldxref/kldxref.c
==
--- head/usr.sbin/kldxref/kldxref.c Thu Jan 15 00:42:06 2015
(r277204)
+++ head/usr.sbin/kldxref/kldxref.c Thu Jan 15 00:46:30 2015
(r277205)
@@ -172,6 +172,10 @@ parse_entry(struct mod_metadata *md, con
record_string(kldname);
}
break;
+   case MDT_PNP_INFO:
+   if (dflag) {
+   printf(  pnp info for bus %s\n, cval);
+   }
default:
warnx(unknown metadata record %d in file %s, md-md_type, 
kldname);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277208 - head/sys/boot/fdt/dts/arm

2015-01-14 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Jan 15 01:20:56 2015
New Revision: 277208
URL: https://svnweb.freebsd.org/changeset/base/277208

Log:
  Fix the PMIC node name to match the PMIC i2c address.
  
  Remove an extra blank line.
  
  No functional changes.
  
  MFC after:3 days

Modified:
  head/sys/boot/fdt/dts/arm/beaglebone-black.dts

Modified: head/sys/boot/fdt/dts/arm/beaglebone-black.dts
==
--- head/sys/boot/fdt/dts/arm/beaglebone-black.dts  Thu Jan 15 01:05:05 
2015(r277207)
+++ head/sys/boot/fdt/dts/arm/beaglebone-black.dts  Thu Jan 15 01:20:56 
2015(r277208)
@@ -144,10 +144,9 @@
status = okay;
non-removable;
};
-
  
i2c@44e0b000 {
-   pmic@24 {
+   pmic@48 {
compatible = ti,am335x-pmic;
reg = 0x48;
};
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277206 - head/sys/arm/broadcom/bcm2835

2015-01-14 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Jan 15 00:48:53 2015
New Revision: 277206
URL: https://svnweb.freebsd.org/changeset/base/277206

Log:
  Catch a few cases where we need to release memory resources on errors.
  
  Place parentheses around variables in macros.
  
  MFC after:3 days

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
  head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Thu Jan 15 00:46:30 2015
(r277205)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Thu Jan 15 00:48:53 2015
(r277206)
@@ -252,6 +252,7 @@ bcm_bsc_attach(device_t dev)
}
if (i == nitems(bcm_bsc_pins)) {
device_printf(dev, only bsc0 and bsc1 are supported\n);
+   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc-sc_mem_res);
return (ENXIO);
}
 
@@ -262,6 +263,7 @@ bcm_bsc_attach(device_t dev)
gpio = devclass_get_device(devclass_find(gpio), 0);
if (!gpio) {
device_printf(dev, cannot find gpio0\n);
+   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc-sc_mem_res);
return (ENXIO);
}
bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].sda, BCM_GPIO_ALT0);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h  Thu Jan 15 00:46:30 
2015(r277205)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h  Thu Jan 15 00:48:53 
2015(r277206)
@@ -58,9 +58,9 @@ struct bcm_bsc_softc {
 #defineBCM_I2C_ERROR   0x04
 
 #defineBCM_BSC_WRITE(_sc, _off, _val)  \
-bus_space_write_4(_sc-sc_bst, _sc-sc_bsh, _off, _val)
+bus_space_write_4((_sc)-sc_bst, (_sc)-sc_bsh, _off, _val)
 #defineBCM_BSC_READ(_sc, _off) \
-bus_space_read_4(_sc-sc_bst, _sc-sc_bsh, _off)
+bus_space_read_4((_sc)-sc_bst, (_sc)-sc_bsh, _off)
 
 #defineBCM_BSC_LOCK(_sc)   \
 mtx_lock((_sc)-sc_mtx)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277202 - head/contrib/ntp/ntpd

2015-01-14 Thread Hiren Panchasara
Author: hiren
Date: Wed Jan 14 23:34:00 2015
New Revision: 277202
URL: https://svnweb.freebsd.org/changeset/base/277202

Log:
  ntpd tries to bind to IPv6 interfaces in 'tentative' state and fails as IPv6 
is
  actually disabled. Fix it by making ntpd ignore such interfaces.
  
  Submitted by: ume
  Reviewed by:  bz, gnn
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D1527

Modified:
  head/contrib/ntp/ntpd/ntp_io.c

Modified: head/contrib/ntp/ntpd/ntp_io.c
==
--- head/contrib/ntp/ntpd/ntp_io.c  Wed Jan 14 22:37:11 2015
(r277201)
+++ head/contrib/ntp/ntpd/ntp_io.c  Wed Jan 14 23:34:00 2015
(r277202)
@@ -1176,12 +1176,13 @@ set_wildcard_reuse(int family, int on)
 
 #ifdef INCLUDE_IPV6_SUPPORT
 static isc_boolean_t
-is_anycast(struct sockaddr *sa, char *name)
+is_not_bindable(struct sockaddr *sa, char *name)
 {
-#if defined(SIOCGIFAFLAG_IN6)  defined(IN6_IFF_ANYCAST)
+#if defined(SIOCGIFAFLAG_IN6)  \
+  (defined(IN6_IFF_ANYCAST) || defined(IN6_IFF_NOTREADY))
struct in6_ifreq ifr6;
int fd;
-   u_int32_t flags6;
+   u_int32_t flags6, exclude = 0;
 
if (sa-sa_family != AF_INET6)
return ISC_FALSE;
@@ -1197,9 +1198,15 @@ is_anycast(struct sockaddr *sa, char *na
}
close(fd);
flags6 = ifr6.ifr_ifru.ifru_flags6;
-   if ((flags6  IN6_IFF_ANYCAST) != 0)
+#if defined(IN6_IFF_ANYCAST)
+   exclude |= IN6_IFF_ANYCAST;
+#endif /* !IN6_IFF_ANYCAST */
+#if defined(IN6_IFF_NOTREADY)
+   exclude |= IN6_IFF_NOTREADY;
+#endif /* !IN6_IFF_NOTREADY */
+   if ((flags6  exclude) != 0)
return ISC_TRUE;
-#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */
+#endif /* !SIOCGIFAFLAG_IN6 || !(IN6_IFF_ANYCAST  IN6_IFF_NOTREADY) */
return ISC_FALSE;
 }
 #endif /* !INCLUDE_IPV6_SUPPORT */
@@ -1344,7 +1351,7 @@ update_interfaces(
continue;
 
 #ifdef INCLUDE_IPV6_SUPPORT
-   if (is_anycast((struct sockaddr *)interface.sin, isc_if.name))
+   if (is_not_bindable((struct sockaddr *)interface.sin, 
isc_if.name))
continue;
 #endif /* !INCLUDE_IPV6_SUPPORT */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277207 - head/sys/arm/broadcom/bcm2835

2015-01-14 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Jan 15 01:05:05 2015
New Revision: 277207
URL: https://svnweb.freebsd.org/changeset/base/277207

Log:
  Fix the C - K temperature conversion for the dev.cpu.0.temperature sysctl.
  
  Previous code was discarding the last digit.
  
  Remove the unused temperature conversion macros.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Thu Jan 15 00:48:53 
2015(r277206)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Thu Jan 15 01:05:05 
2015(r277207)
@@ -64,8 +64,6 @@ __FBSDID($FreeBSD$);
 #define MHZ2HZ(freq) ((freq) * (1000 * 1000))
 #define OFFSET2MVOLT(val) (1200 + ((val) * 25))
 #define MVOLT2OFFSET(val) (((val) - 1200) / 25)
-#define RAW2K(temp) (((temp) + 273150) / 1000)
-#define K2RAW(temp) (((temp) * 1000) - 273150)
 
 #define DEFAULT_ARM_FREQUENCY   700
 #define DEFAULT_CORE_FREQUENCY  250
@@ -77,6 +75,7 @@ __FBSDID($FreeBSD$);
 #define MSG_ERROR-9
 #define MHZSTEP 100
 #define HZSTEP(MHZ2HZ(MHZSTEP))
+#defineTZ_ZEROC2732
 
 #define VC_LOCK(sc) do {   \
sema_wait(vc_sema);\
@@ -1215,7 +1214,7 @@ sysctl_bcm2835_devcpu_temperature(SYSCTL
return (EIO);
 
/* 1/1000 celsius (raw) to 1/10 kelvin */
-   val = RAW2K(val) * 10;
+   val = val / 100 + TZ_ZEROC;
 
err = sysctl_handle_int(oidp, val, 0, req);
if (err || !req-newptr) /* error || read request */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277199 - in head/sys: fs/devfs kern

2015-01-14 Thread Konstantin Belousov
On Wed, Jan 14, 2015 at 10:07:13PM +, Hans Petter Selasky wrote:
 Author: hselasky
 Date: Wed Jan 14 22:07:13 2015
 New Revision: 277199
 URL: https://svnweb.freebsd.org/changeset/base/277199
 
 Log:
   Avoid race with dev_rel() when using the recently added
   delist_dev() function. Make sure the character device structure
   doesn't go away until the end of the destroy_dev() function due to
   concurrently running cleanup code inside devfs_populate().
   
   MFC after:  1 week
   Reported by:dchagin@
 
 Modified:
   head/sys/fs/devfs/devfs_devs.c
   head/sys/kern/kern_conf.c
 
 Modified: head/sys/fs/devfs/devfs_devs.c
 ==
 --- head/sys/fs/devfs/devfs_devs.cWed Jan 14 22:05:57 2015
 (r277198)
 +++ head/sys/fs/devfs/devfs_devs.cWed Jan 14 22:07:13 2015
 (r277199)
 @@ -137,6 +137,12 @@ devfs_alloc(int flags)
   vfs_timestamp(ts);
   cdev-si_atime = cdev-si_mtime = cdev-si_ctime = ts;
   cdev-si_cred = NULL;
 + /*
 +  * Avoid race with dev_rel() by setting the initial
 +  * reference count to 1. This last reference is taken
 +  * by the destroy_dev() function.
 +  */
 + cdev-si_refcount = 1;
This is wrong.  Not all devices are destroyed with destroy_dev().
dev_rel() must be allowed to clean up allocated device.

That said, I do not understand what race you are trying to solve.
Freeing of the accessible cdev memory cannot happen in parallel while
dev_mtx is owned.

Please do not commit (to devfs) without seeking for the review first.
  
   return (cdev);
  }
 
 Modified: head/sys/kern/kern_conf.c
 ==
 --- head/sys/kern/kern_conf.c Wed Jan 14 22:05:57 2015(r277198)
 +++ head/sys/kern/kern_conf.c Wed Jan 14 22:07:13 2015(r277199)
 @@ -1048,8 +1048,6 @@ destroy_devl(struct cdev *dev)
   /* Remove name marking */
   dev-si_flags = ~SI_NAMED;
  
 - dev-si_refcount++; /* Avoid race with dev_rel() */
 -
   /* If we are a child, remove us from the parents list */
   if (dev-si_flags  SI_CHILD) {
   LIST_REMOVE(dev, si_siblings);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277209 - head/sys/arm/ti/cpsw

2015-01-14 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Jan 15 02:22:52 2015
New Revision: 277209
URL: https://svnweb.freebsd.org/changeset/base/277209

Log:
  Fix cpsw(4) after r277203 which folded 'struct m_hdr' into 'struct mbuf'.
  While in theory this should have been a transparent change (and was for all
  other drivers), cpsw(4) never used the proper accessor macros in a few
  places but spelt the indirect m_hdr.mh_* out itself.  Convert those to
  use m_len and m_data and unbreak the driver build.

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Thu Jan 15 01:20:56 2015
(r277208)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Thu Jan 15 02:22:52 2015
(r277209)
@@ -396,9 +396,9 @@ cpsw_dump_slot(struct cpsw_softc *sc, st
printf(\n);
if (slot-mbuf) {
printf(  Ether:  %14D\n,
-   (char *)(slot-mbuf-m_hdr.mh_data),  );
+   (char *)(slot-mbuf-m_data),  );
printf(  Packet: %16D\n,
-   (char *)(slot-mbuf-m_hdr.mh_data) + 14,  );
+   (char *)(slot-mbuf-m_data) + 14,  );
}
 }
 
@@ -611,7 +611,7 @@ cpsw_attach(device_t dev)
 
/* Allocate the null mbuf and pre-sync it. */
sc-null_mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
-   memset(sc-null_mbuf-m_hdr.mh_data, 0, sc-null_mbuf-m_ext.ext_size);
+   memset(sc-null_mbuf-m_data, 0, sc-null_mbuf-m_ext.ext_size);
bus_dmamap_create(sc-mbuf_dtag, 0, sc-null_mbuf_dmamap);
bus_dmamap_load_mbuf_sg(sc-mbuf_dtag, sc-null_mbuf_dmamap,
sc-null_mbuf, segs, nsegs, BUS_DMA_NOWAIT);
@@ -1292,8 +1292,8 @@ cpsw_rx_dequeue(struct cpsw_softc *sc)
/* Set up mbuf */
/* TODO: track SOP/EOP bits to assemble a full mbuf
   out of received fragments. */
-   slot-mbuf-m_hdr.mh_data += bd.bufoff;
-   slot-mbuf-m_hdr.mh_len = bd.pktlen - 4;
+   slot-mbuf-m_data += bd.bufoff;
+   slot-mbuf-m_len = bd.pktlen - 4;
slot-mbuf-m_pkthdr.len = bd.pktlen - 4;
slot-mbuf-m_flags |= M_PKTHDR;
slot-mbuf-m_pkthdr.rcvif = ifp;
@@ -1461,7 +1461,7 @@ cpsw_tx_enqueue(struct cpsw_softc *sc)
bus_dmamap_unload(sc-mbuf_dtag, slot-dmamap);
if (padlen  0) /* May as well add padding. */
m_append(slot-mbuf, padlen,
-   sc-null_mbuf-m_hdr.mh_data);
+   sc-null_mbuf-m_data);
m0 = m_defrag(slot-mbuf, M_NOWAIT);
if (m0 == NULL) {
if_printf(sc-ifp,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277163 - head/sys/dev/cardbus

2015-01-14 Thread Justin Hibbits
On Wed, 14 Jan 2015 09:23:05 -0500
John Baldwin j...@freebsd.org wrote:

 On 1/14/15 12:41 AM, Warner Losh wrote:
  Author: imp
  Date: Wed Jan 14 05:41:31 2015
  New Revision: 277163
  URL: https://svnweb.freebsd.org/changeset/base/277163
  
  Log:
Add a rather obnoxious warning if you don't have NEW_PCIB defined
since it's a total crap shoot if things will work.
 
 Should we just make it a #error instead?  (Some day I hope to have
 NEW_PCIB enabled by default and remove the old code.  Will take a
 while to get there for the generic PCI code, but cardbus is probably
 only used on x86 so that would be fine.)
 

Also powerpc, but NEW_PCIB is default there as well.

- Justin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277163 - head/sys/dev/cardbus

2015-01-14 Thread John Baldwin
On 1/14/15 12:41 AM, Warner Losh wrote:
 Author: imp
 Date: Wed Jan 14 05:41:31 2015
 New Revision: 277163
 URL: https://svnweb.freebsd.org/changeset/base/277163
 
 Log:
   Add a rather obnoxious warning if you don't have NEW_PCIB defined
   since it's a total crap shoot if things will work.

Should we just make it a #error instead?  (Some day I hope to have
NEW_PCIB enabled by default and remove the old code.  Will take a while
to get there for the generic PCI code, but cardbus is probably only used
on x86 so that would be fine.)

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277181 - head/contrib/elftoolchain/elfcopy

2015-01-14 Thread Ed Maste
Author: emaste
Date: Wed Jan 14 14:49:58 2015
New Revision: 277181
URL: https://svnweb.freebsd.org/changeset/base/277181

Log:
  elfcopy: Avoid divide-by-0 on section alignment 0
  
  According to ELF ABI, alignment 0 and 1 has the same meaning: the
  section has no alignment constraints.
  
  PR:   196715
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/elfcopy/sections.c

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==
--- head/contrib/elftoolchain/elfcopy/sections.cWed Jan 14 14:49:05 
2015(r277180)
+++ head/contrib/elftoolchain/elfcopy/sections.cWed Jan 14 14:49:58 
2015(r277181)
@@ -777,6 +777,8 @@ resync_sections(struct elfcopy *ecp)
continue;
 
/* Align section offset. */
+   if (s-align == 0)
+   s-align = 1;
if (off = s-off) {
if (!s-loadable)
s-off = roundup(off, s-align);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277199 - in head/sys: fs/devfs kern

2015-01-14 Thread Hans Petter Selasky

On 01/15/15 04:31, Konstantin Belousov wrote:

On Wed, Jan 14, 2015 at 10:07:13PM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Wed Jan 14 22:07:13 2015
New Revision: 277199
URL: https://svnweb.freebsd.org/changeset/base/277199

Log:
   Avoid race with dev_rel() when using the recently added
   delist_dev() function. Make sure the character device structure
   doesn't go away until the end of the destroy_dev() function due to
   concurrently running cleanup code inside devfs_populate().

   MFC after:   1 week
   Reported by: dchagin@

Modified:
   head/sys/fs/devfs/devfs_devs.c
   head/sys/kern/kern_conf.c

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Wed Jan 14 22:05:57 2015
(r277198)
+++ head/sys/fs/devfs/devfs_devs.c  Wed Jan 14 22:07:13 2015
(r277199)
@@ -137,6 +137,12 @@ devfs_alloc(int flags)
vfs_timestamp(ts);
cdev-si_atime = cdev-si_mtime = cdev-si_ctime = ts;
cdev-si_cred = NULL;
+   /*
+* Avoid race with dev_rel() by setting the initial
+* reference count to 1. This last reference is taken
+* by the destroy_dev() function.
+*/
+   cdev-si_refcount = 1;

This is wrong.  Not all devices are destroyed with destroy_dev().
dev_rel() must be allowed to clean up allocated device.

That said, I do not understand what race you are trying to solve.
Freeing of the accessible cdev memory cannot happen in parallel while
dev_mtx is owned.

Please do not commit (to devfs) without seeking for the review first.


Hi Konstantin,

From my analysis there are basically three ways for a cdev to die:

1) Through dev_free_devlocked()
2) Through destroy_devl() which then later calls dev_free_devlocked()
3) Through destroy_dev_sched() which really is a wrapper around 
destroy_devl().


In the case of direct free through #1, the reference count is ignored 
and it doesn't matter if it is one or zero. Only in the case of 
destruction through destroy_dev() it matters.


Like the comment says in destroy_devl():

/* Avoid race with dev_rel() */

The problem is that the cdev-si_refcount is zero when the initial
devfs_create() is called. Then one ref is made. When we clear the 
CDP_ACTIVE flag in devfs_destroy() it instructs a !parallel! running 
process to destroy all the FS related structures and the reference count 
goes back to zero when the cdp is removed from the cdevp_list. Then 
the cdev is freed too early. This happens because destroy_devl() is 
dropping the dev_lock() to sleep waiting for pending references.


Do you see something else?

--HPS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2015-01-14 Thread Alexander Motin
Author: mav
Date: Wed Jan 14 16:22:00 2015
New Revision: 277185
URL: https://svnweb.freebsd.org/changeset/base/277185

Log:
  Fix overflow bug from r248577, turning 30s TRIM timeout into ~4s.
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Wed Jan 
14 15:45:18 2015(r277184)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Wed Jan 
14 16:22:00 2015(r277185)
@@ -440,7 +440,7 @@ trim_map_vdev_commit(spa_t *spa, zio_t *
if (tm == NULL)
return;
 
-   timelimit = gethrtime() - trim_timeout * NANOSEC;
+   timelimit = gethrtime() - (hrtime_t)trim_timeout * NANOSEC;
if (vd-vdev_isl2cache) {
txgsafe = UINT64_MAX;
txgtarget = UINT64_MAX;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277179 - in head/sys: dev/usb kern sys

2015-01-14 Thread Andrey V. Elsukov
On 14.01.2015 17:04, Hans Petter Selasky wrote:
 Author: hselasky
 Date: Wed Jan 14 14:04:29 2015
 New Revision: 277179
 URL: https://svnweb.freebsd.org/changeset/base/277179
 
 Log:
   Add a kernel function to delist our kernel character devices, so that
   the device name can be re-used right away in case we are destroying
   the character devices in the background.
   
   MFC after:  4 days
   Reported by:dchagin@
 
 Modified:
   head/sys/dev/usb/usb_device.c
   head/sys/kern/kern_conf.c
   head/sys/sys/conf.h
 
 Modified: head/sys/dev/usb/usb_device.c
 ==
 --- head/sys/dev/usb/usb_device.c Wed Jan 14 13:03:03 2015
 (r277178)
 +++ head/sys/dev/usb/usb_device.c Wed Jan 14 14:04:29 2015
 (r277179)
 @@ -2019,7 +2019,10 @@ usb_destroy_dev(struct usb_fs_privdata *
   usb_destroy_dev_sync(pd);
   return;
   }
 - 
 +
 + /* make sure we can re-use the device name */
 + delist_dev(pd-cdev);
 +
   USB_BUS_LOCK(bus);
   LIST_INSERT_HEAD(bus-pd_cleanup_list, pd, pd_next);
   /* get cleanup going */
 
 Modified: head/sys/kern/kern_conf.c
 ==
 --- head/sys/kern/kern_conf.c Wed Jan 14 13:03:03 2015(r277178)
 +++ head/sys/kern/kern_conf.c Wed Jan 14 14:04:29 2015(r277179)
 @@ -1114,6 +1114,23 @@ destroy_devl(struct cdev *dev)
   }
  }
  
 +static void
 +delist_dev_locked(struct cdev *dev)
 +{
 + struct cdev *child;
 + devfs_destroy(dev);
 + LIST_FOREACH(child, dev-si_children, si_siblings)
 + delist_dev_locked(child);
 +}

It looks a bit strange. First you call destroy(dev), then you are trying
enumerate its children. It is ok?

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


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

2015-01-14 Thread Alexander Motin
Author: mav
Date: Wed Jan 14 09:39:57 2015
New Revision: 277169
URL: https://svnweb.freebsd.org/changeset/base/277169

Log:
  Reimplement TRIM throttling added in r248577.
  
  Previous throttling implementation approached problem from the wrong side.
  It significantly limited useful delaying of TRIM requests and aggregation
  potential, while not so much controlled TRIM burstiness under heavy load.
  
  With this change random 4K write benchmarks (probably the worst case for
  TRIM) show me IOPS increase by 20%, average latency reduction by 30%, peak
  TRIM bursts reduction by 3 times and same peak TRIM map size (memory usage).
  
  Also the new logic does not force map size down so heavily, really allowing
  to keep deleted data for 32 TXG or 30 seconds under moderate load.  It was
  practically impossible with old throttling logic, which pushed map down to
  only 64 segments.
  
  Reviewed by:  smh
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Wed Jan 
14 07:18:51 2015(r277168)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c  Wed Jan 
14 09:39:57 2015(r277169)
@@ -40,17 +40,20 @@
 #defineTRIM_ZIO_END(vd, offset, size)  (offset +   \
P2ROUNDUP(size, 1ULL  vd-vdev_top-vdev_ashift))
 
-#define TRIM_MAP_SINC(tm, size)\
-   atomic_add_64((tm)-tm_bytes, (size))
+/* Maximal segment size for ATA TRIM. */
+#define TRIM_MAP_SIZE_FACTOR   (512  16)
 
-#define TRIM_MAP_SDEC(tm, size)\
-   atomic_add_64((tm)-tm_bytes, -(size))
+#define TRIM_MAP_SEGS(size)(1 + (size) / TRIM_MAP_SIZE_FACTOR)
 
-#define TRIM_MAP_QINC(tm)  \
-   atomic_inc_64((tm)-tm_pending);   \
-
-#define TRIM_MAP_QDEC(tm)  \
-   atomic_dec_64((tm)-tm_pending);
+#define TRIM_MAP_ADD(tm, ts)   do {\
+   list_insert_tail((tm)-tm_head, (ts)); \
+   (tm)-tm_pending += TRIM_MAP_SEGS((ts)-ts_end - (ts)-ts_start); \
+} while (0)
+
+#define TRIM_MAP_REM(tm, ts)   do {\
+   list_remove((tm)-tm_head, (ts));  \
+   (tm)-tm_pending -= TRIM_MAP_SEGS((ts)-ts_end - (ts)-ts_start); \
+} while (0)
 
 typedef struct trim_map {
list_t  tm_head;/* List of segments sorted by 
txg. */
@@ -60,7 +63,6 @@ typedef struct trim_map {
list_t  tm_pending_writes;  /* Writes blocked on in-flight 
frees. */
kmutex_ttm_lock;
uint64_ttm_pending; /* Count of pending TRIMs. */
-   uint64_ttm_bytes;   /* Total size in bytes of 
queued TRIMs. */
 } trim_map_t;
 
 typedef struct trim_seg {
@@ -74,13 +76,10 @@ typedef struct trim_seg {
 
 extern boolean_t zfs_trim_enabled;
 
-static u_int trim_txg_delay = 32;
-static u_int trim_timeout = 30;
-static u_int trim_max_interval = 1;
-/* Limit outstanding TRIMs to 2G (max size for a single TRIM request) */
-static uint64_t trim_vdev_max_bytes = 2147483648;
-/* Limit outstanding TRIMs to 64 (max ranges for a single TRIM request) */ 
-static u_int trim_vdev_max_pending = 64;
+static u_int trim_txg_delay = 32;  /* Keep deleted data up to 32 TXG */
+static u_int trim_timeout = 30;/* Keep deleted data up to 30s 
*/
+static u_int trim_max_interval = 1;/* 1s delays between TRIMs */
+static u_int trim_vdev_max_pending = 1; /* Keep up to 10K segments */
 
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_NODE(_vfs_zfs, OID_AUTO, trim, CTLFLAG_RD, 0, ZFS TRIM);
@@ -94,9 +93,6 @@ SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, max
 Maximum interval between TRIM queue processing (seconds));
 
 SYSCTL_DECL(_vfs_zfs_vdev);
-SYSCTL_QUAD(_vfs_zfs_vdev, OID_AUTO, trim_max_bytes, CTLFLAG_RWTUN,
-trim_vdev_max_bytes, 0,
-Maximum pending TRIM bytes for a vdev);
 SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, trim_max_pending, CTLFLAG_RWTUN,
 trim_vdev_max_pending, 0,
 Maximum pending TRIM segments for a vdev);
@@ -189,10 +185,8 @@ trim_map_destroy(vdev_t *vd)
mutex_enter(tm-tm_lock);
while ((ts = list_head(tm-tm_head)) != NULL) {
avl_remove(tm-tm_queued_frees, ts);
-   list_remove(tm-tm_head, ts);
+   TRIM_MAP_REM(tm, ts);
kmem_free(ts, sizeof (*ts));
-   TRIM_MAP_SDEC(tm, ts-ts_end - ts-ts_start);
-   TRIM_MAP_QDEC(tm);
}
mutex_exit(tm-tm_lock);
 
@@ -237,40 +231,34 @@ trim_map_segment_add(trim_map_t *tm, uin
merge_after = (ts_after != NULL  

svn commit: r277179 - in head/sys: dev/usb kern sys

2015-01-14 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 14 14:04:29 2015
New Revision: 277179
URL: https://svnweb.freebsd.org/changeset/base/277179

Log:
  Add a kernel function to delist our kernel character devices, so that
  the device name can be re-used right away in case we are destroying
  the character devices in the background.
  
  MFC after:4 days
  Reported by:  dchagin@

Modified:
  head/sys/dev/usb/usb_device.c
  head/sys/kern/kern_conf.c
  head/sys/sys/conf.h

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Wed Jan 14 13:03:03 2015
(r277178)
+++ head/sys/dev/usb/usb_device.c   Wed Jan 14 14:04:29 2015
(r277179)
@@ -2019,7 +2019,10 @@ usb_destroy_dev(struct usb_fs_privdata *
usb_destroy_dev_sync(pd);
return;
}
-   
+
+   /* make sure we can re-use the device name */
+   delist_dev(pd-cdev);
+
USB_BUS_LOCK(bus);
LIST_INSERT_HEAD(bus-pd_cleanup_list, pd, pd_next);
/* get cleanup going */

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Wed Jan 14 13:03:03 2015(r277178)
+++ head/sys/kern/kern_conf.c   Wed Jan 14 14:04:29 2015(r277179)
@@ -1114,6 +1114,23 @@ destroy_devl(struct cdev *dev)
}
 }
 
+static void
+delist_dev_locked(struct cdev *dev)
+{
+   struct cdev *child;
+   devfs_destroy(dev);
+   LIST_FOREACH(child, dev-si_children, si_siblings)
+   delist_dev_locked(child);
+}
+
+void
+delist_dev(struct cdev *dev)
+{
+   dev_lock();
+   delist_dev_locked(dev);
+   dev_unlock();
+}
+
 void
 destroy_dev(struct cdev *dev)
 {

Modified: head/sys/sys/conf.h
==
--- head/sys/sys/conf.h Wed Jan 14 13:03:03 2015(r277178)
+++ head/sys/sys/conf.h Wed Jan 14 14:04:29 2015(r277179)
@@ -245,6 +245,7 @@ void clone_cleanup(struct clonedevs **);
 int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev 
**dev, int extra);
 
 intcount_dev(struct cdev *_dev);
+void   delist_dev(struct cdev *_dev);
 void   destroy_dev(struct cdev *_dev);
 intdestroy_dev_sched(struct cdev *dev);
 intdestroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277172 - head/usr.sbin/fstyp

2015-01-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jan 14 11:26:03 2015
New Revision: 277172
URL: https://svnweb.freebsd.org/changeset/base/277172

Log:
  Improve wording.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/fstyp/fstyp.8

Modified: head/usr.sbin/fstyp/fstyp.8
==
--- head/usr.sbin/fstyp/fstyp.8 Wed Jan 14 11:18:45 2015(r277171)
+++ head/usr.sbin/fstyp/fstyp.8 Wed Jan 14 11:26:03 2015(r277172)
@@ -27,7 +27,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd December 6, 2014
+.Dd January 14, 2015
 .Dt FSTYP 8
 .Os
 .Sh NAME
@@ -58,9 +58,9 @@ is built specifically to detect filesyst
 .Xr file 1
 in several ways.
 The output is machine-parsable, filesystem labels are supported,
-and only filesystems are identified.
-Security is improved with
-.Xr capsicum 4 .
+the utility runs sandboxed using
+.Xr capsicum 4 ,
+and does not try to recognize any file format other than filesystems.
 .Pp
 These options are available:
 .Bl -tag -width .Fl l
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277175 - head/share/man/man7

2015-01-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jan 14 11:53:41 2015
New Revision: 277175
URL: https://svnweb.freebsd.org/changeset/base/277175

Log:
  Mention /net in hier(7).
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man7/hier.7

Modified: head/share/man/man7/hier.7
==
--- head/share/man/man7/hier.7  Wed Jan 14 11:31:31 2015(r277174)
+++ head/share/man/man7/hier.7  Wed Jan 14 11:53:41 2015(r277175)
@@ -28,7 +28,7 @@
 .\@(#)hier.7  8.1 (Berkeley) 6/5/93
 .\ $FreeBSD$
 .\
-.Dd November 10, 2014
+.Dd January 14, 2015
 .Dt HIER 7
 .Os
 .Sh NAME
@@ -159,6 +159,10 @@ floppy disks
 .It Pa /mnt/
 empty directory commonly used by
 system administrators as a temporary mount point
+.It Pa /net/
+automounted NFS shares;
+see
+.Xr auto_master 5
 .It Pa /proc/
 process file system;
 see
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277171 - head/etc

2015-01-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jan 14 11:18:45 2015
New Revision: 277171
URL: https://svnweb.freebsd.org/changeset/base/277171

Log:
  Use newly added GEOM notifications to discard autofs caches.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/etc/devd.conf

Modified: head/etc/devd.conf
==
--- head/etc/devd.conf  Wed Jan 14 11:15:57 2015(r277170)
+++ head/etc/devd.conf  Wed Jan 14 11:18:45 2015(r277171)
@@ -318,16 +318,11 @@ notify 0 {
action  /usr/local/etc/rc.d/postgresql restart;
 };
 
-# Discard autofs caches, useful for the -media special map.  The one
-# second delay is for GEOM to finish tasting.
-#
-# XXX: We should probably have a devctl(4) event that fires after GEOM
-#  tasting.
-#
+# Discard autofs caches, useful for the -media special map.
 notify 100 {
-   match system DEVFS;
-   match cdev (da|mmcsd)[0-9]+;
-   action sleep 1  /usr/sbin/automount -c;
+   match system GEOM;
+   match subsystem DEV;
+   action /usr/sbin/automount -c;
 };
 
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277170 - in head: sbin/devd sys/geom

2015-01-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jan 14 11:15:57 2015
New Revision: 277170
URL: https://svnweb.freebsd.org/changeset/base/277170

Log:
  Add devd(8) notifications for creation and destruction of GEOM devices.
  
  Differential Revision:https://reviews.freebsd.org/D1211
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/devd/devd.conf.5
  head/sys/geom/geom_dev.c

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Wed Jan 14 09:39:57 2015(r277169)
+++ head/sbin/devd/devd.conf.5  Wed Jan 14 11:15:57 2015(r277170)
@@ -41,7 +41,7 @@
 .\ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 .\ SOFTWARE.
 .\
-.Dd February 22, 2013
+.Dd January 14, 2015
 .Dt DEVD.CONF 5
 .Os
 .Sh NAME
@@ -370,6 +370,33 @@ node is destroyed.
 .El
 .El
 .Pp
+.It Li GEOM
+Events related to the
+.Xr geom 4
+framework.
+The difference compared to
+.Li DEVFS
+is that
+.Li GEOM
+only includes disk-like devices.
+.Bl -tag -width .Sy Subsystem -compact
+.It Sy Subsystem
+.It Li DEV
+.Bl -tag -width .Li MEDIACHANGE -compact
+.It Sy Type
+.It Li CREATE
+A
+.Xr geom 4
+device node is created.
+.It Li DESTROY
+A
+.Xr geom 4
+device node is destroyed.
+.It Li MEDIACHANGE
+Physical media has changed.
+.El
+.El
+.Pp
 .It Li USB
 Events related to the USB subsystem.
 .Bl -tag -width .Sy Subsystem -compact

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cWed Jan 14 09:39:57 2015(r277169)
+++ head/sys/geom/geom_dev.cWed Jan 14 11:15:57 2015(r277170)
@@ -169,12 +169,15 @@ g_dev_destroy(void *arg, int flags __unu
struct g_consumer *cp;
struct g_geom *gp;
struct g_dev_softc *sc;
+   char buf[SPECNAMELEN + 6];
 
g_topology_assert();
cp = arg;
gp = cp-geom;
sc = cp-private;
g_trace(G_T_TOPOLOGY, g_dev_destroy(%p(%s)), cp, gp-name);
+   snprintf(buf, sizeof(buf), cdev=%s, gp-name);
+   devctl_notify_f(GEOM, DEV, DESTROY, buf, M_WAITOK);
if (cp-acr  0 || cp-acw  0 || cp-ace  0)
g_access(cp, -cp-acr, -cp-acw, -cp-ace);
g_detach(cp);
@@ -209,11 +212,14 @@ g_dev_attrchanged(struct g_consumer *cp,
dev = sc-sc_dev;
snprintf(buf, sizeof(buf), cdev=%s, dev-si_name);
devctl_notify_f(DEVFS, CDEV, MEDIACHANGE, buf, M_WAITOK);
+   devctl_notify_f(GEOM, DEV, MEDIACHANGE, buf, M_WAITOK);
dev = sc-sc_alias;
if (dev != NULL) {
snprintf(buf, sizeof(buf), cdev=%s, dev-si_name);
devctl_notify_f(DEVFS, CDEV, MEDIACHANGE, buf,
M_WAITOK);
+   devctl_notify_f(GEOM, DEV, MEDIACHANGE, buf,
+   M_WAITOK);
}
return;
}
@@ -269,7 +275,7 @@ g_dev_taste(struct g_class *mp, struct g
struct g_dev_softc *sc;
int error, len;
struct cdev *dev, *adev;
-   char buf[64], *val;
+   char buf[SPECNAMELEN + 6], *val;
 
g_trace(G_T_TOPOLOGY, dev_taste(%s,%s), mp-name, pp-name);
g_topology_assert();
@@ -326,6 +332,8 @@ g_dev_taste(struct g_class *mp, struct g
}
 
g_dev_attrchanged(cp, GEOM::physpath);
+   snprintf(buf, sizeof(buf), cdev=%s, gp-name);
+   devctl_notify_f(GEOM, DEV, CREATE, buf, M_WAITOK);
 
return (gp);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277177 - in head: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin usr.sbin/pmcstudy

2015-01-14 Thread Randall Stewart
Author: rrs
Date: Wed Jan 14 12:46:58 2015
New Revision: 277177
URL: https://svnweb.freebsd.org/changeset/base/277177

Log:
  Update the hwpmc driver to have the new type HASWELL_XEON. Also
  go back through HASWELL, IVY_BRIDGE, IVY_BRIDGE_XEON and SANDY_BRIDGE
  to straighten out all the missing PMCs. We also add a new pmc tool
  pmcstudy, this allows one to run the various formulas from
  the documents Using Intel Vtune Amplifier XE on XXX Generation platforms for
  IB/SB and Haswell. The tool also allows one to postulate your own
  formulas with any of the various PMC's. At some point I will enahance
  this to work with Brendan Gregg's flame-graphs so we can flamegraph
  various PMC interactions. Note the manual page also needs some
  work (lots of work) but gnn has committed to help me with that ;-)
  Reviewed by: gnn
  MFC after:1 month
  Sponsored by: Netflix Inc.

Added:
  head/usr.sbin/pmcstudy/
  head/usr.sbin/pmcstudy/Makefile   (contents, props changed)
  head/usr.sbin/pmcstudy/eval_expr.c   (contents, props changed)
  head/usr.sbin/pmcstudy/eval_expr.h   (contents, props changed)
  head/usr.sbin/pmcstudy/pmcstudy.1   (contents, props changed)
  head/usr.sbin/pmcstudy/pmcstudy.c   (contents, props changed)
Modified:
  head/lib/libpmc/libpmc.c
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/dev/hwpmc/hwpmc_logging.c
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/dev/hwpmc/hwpmc_piv.c
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_x86.c
  head/sys/dev/hwpmc/pmc_events.h
  head/sys/sys/pmc.h
  head/usr.sbin/Makefile

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cWed Jan 14 12:46:38 2015(r277176)
+++ head/lib/libpmc/libpmc.cWed Jan 14 12:46:58 2015(r277177)
@@ -200,6 +200,12 @@ static const struct pmc_event_descr hasw
__PMC_EV_ALIAS_HASWELL()
 };
 
+static const struct pmc_event_descr haswell_xeon_event_table[] =
+{
+   __PMC_EV_ALIAS_HASWELL_XEON()
+};
+
+
 static const struct pmc_event_descr ivybridge_event_table[] =
 {
__PMC_EV_ALIAS_IVYBRIDGE()
@@ -267,6 +273,7 @@ PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOF
 PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
+PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, 
PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, 
PMC_CLASS_TSC);
 PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
@@ -312,6 +319,7 @@ PMC_CLASS_TABLE_DESC(core2, IAP, core2, 
 PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap);
 PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap);
 PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap);
+PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell, iap);
 PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap);
 PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap);
 PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap);
@@ -626,6 +634,8 @@ static struct pmc_event_alias core2_alia
 #define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf
 #define haswell_aliasescore2_aliases
 #define haswell_aliases_without_iafcore2_aliases_without_iaf
+#define haswell_xeon_aliases   core2_aliases
+#define haswell_xeon_aliases_without_iaf   core2_aliases_without_iaf
 #define ivybridge_aliases  core2_aliases
 #define ivybridge_aliases_without_iaf  core2_aliases_without_iaf
 #define ivybridge_xeon_aliases core2_aliases
@@ -896,7 +906,8 @@ iap_allocate_pmc(enum pmc_event pe, char
n = pmc_parse_mask(iap_rsp_mask_sb_sbx_ib, p, 
rsp);
} else
return (-1);
-   } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL) {
+   } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL ||
+   cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL_XEON) {
if (KWPREFIXMATCH(p, IAP_KW_RSP =)) {
n = pmc_parse_mask(iap_rsp_mask_haswell, p, 
rsp);
} else
@@ -2788,6 +2799,10 @@ pmc_event_names_of_class(enum pmc_class 
ev = haswell_event_table;
count = PMC_EVENT_TABLE_SIZE(haswell);
break;
+   case PMC_CPU_INTEL_HASWELL_XEON:
+   ev = haswell_xeon_event_table;
+   count = PMC_EVENT_TABLE_SIZE(haswell_xeon);
+   break;
case 

svn commit: r277176 - head/sys/dev/mii

2015-01-14 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 14 12:46:38 2015
New Revision: 277176
URL: https://svnweb.freebsd.org/changeset/base/277176

Log:
  Clean some dead code.

Modified:
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/mii_physubr.c
  head/sys/dev/mii/miivar.h

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Wed Jan 14 11:53:41 2015(r277175)
+++ head/sys/dev/mii/mii.c  Wed Jan 14 12:46:38 2015(r277176)
@@ -612,18 +612,6 @@ mii_pollstat(struct mii_data *mii)
}
 }
 
-/*
- * Inform the PHYs that the interface is down.
- */
-void
-mii_down(struct mii_data *mii)
-{
-   struct mii_softc *child;
-
-   LIST_FOREACH(child, mii-mii_phys, mii_list)
-   mii_phy_down(child);
-}
-
 static unsigned char
 mii_bitreverse(unsigned char x)
 {

Modified: head/sys/dev/mii/mii_physubr.c
==
--- head/sys/dev/mii/mii_physubr.c  Wed Jan 14 11:53:41 2015
(r277175)
+++ head/sys/dev/mii/mii_physubr.c  Wed Jan 14 12:46:38 2015
(r277176)
@@ -279,12 +279,6 @@ mii_phy_reset(struct mii_softc *sc)
 }
 
 void
-mii_phy_down(struct mii_softc *sc)
-{
-
-}
-
-void
 mii_phy_update(struct mii_softc *sc, int cmd)
 {
struct mii_data *mii = sc-mii_pdata;
@@ -479,7 +473,6 @@ mii_phy_detach(device_t dev)
struct mii_softc *sc;
 
sc = device_get_softc(dev);
-   mii_phy_down(sc);
sc-mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return (0);

Modified: head/sys/dev/mii/miivar.h
==
--- head/sys/dev/mii/miivar.h   Wed Jan 14 11:53:41 2015(r277175)
+++ head/sys/dev/mii/miivar.h   Wed Jan 14 12:46:38 2015(r277176)
@@ -235,7 +235,6 @@ extern driver_t miibus_driver;
 
 intmii_attach(device_t, device_t *, if_t, ifm_change_cb_t,
ifm_stat_cb_t, int, int, int, int);
-void   mii_down(struct mii_data *);
 intmii_mediachg(struct mii_data *);
 void   mii_tick(struct mii_data *);
 void   mii_pollstat(struct mii_data *);
@@ -243,7 +242,6 @@ voidmii_phy_add_media(struct mii_softc 
 
 intmii_phy_auto(struct mii_softc *);
 intmii_phy_detach(device_t dev);
-void   mii_phy_down(struct mii_softc *);
 u_int  mii_phy_flowstatus(struct mii_softc *);
 void   mii_phy_reset(struct mii_softc *);
 void   mii_phy_setmedia(struct mii_softc *sc);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277178 - head/sys/sys

2015-01-14 Thread Ed Schouten
Author: ed
Date: Wed Jan 14 13:03:03 2015
New Revision: 277178
URL: https://svnweb.freebsd.org/changeset/base/277178

Log:
  Make sure CAP_BINDAT and CAP_CONNECTAT are part of CAP_ALL0.
  
  This makes sure that file descriptors of opened directories will
  actually get these capabilities. Without this change, bindat() and
  connectat() don't seem to work for me.
  
  MFC after:2 weeks
  Reviewed by:  rwatson, pjd

Modified:
  head/sys/sys/capsicum.h

Modified: head/sys/sys/capsicum.h
==
--- head/sys/sys/capsicum.h Wed Jan 14 12:46:58 2015(r277177)
+++ head/sys/sys/capsicum.h Wed Jan 14 13:03:03 2015(r277178)
@@ -206,10 +206,10 @@
 CAP_SETSOCKOPT | CAP_SHUTDOWN)
 
 /* All used bits for index 0. */
-#defineCAP_ALL0CAPRIGHT(0, 0x007FULL)
+#defineCAP_ALL0CAPRIGHT(0, 0x01FFULL)
 
 /* Available bits for index 0. */
-#defineCAP_UNUSED0_40  CAPRIGHT(0, 0x0080ULL)
+#defineCAP_UNUSED0_42  CAPRIGHT(0, 0x0200ULL)
 /* ... */
 #defineCAP_UNUSED0_57  CAPRIGHT(0, 0x0100ULL)
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org