svn commit: r306224 - head/sys/kern

2016-09-22 Thread Mateusz Guzik
Author: mjg
Date: Fri Sep 23 04:45:11 2016
New Revision: 306224
URL: https://svnweb.freebsd.org/changeset/base/306224

Log:
  cache: get rid of the global lock
  
  Add a table of vnode locks and use them along with bucketlocks to provide
  concurrent modification support. The approach taken is to preserve the
  current behaviour of the namecache and just lock all relevant parts before
  any changes are made.
  
  Lookups still require the relevant bucket to be locked.
  
  Discussed with:   kib
  Tested by:pho

Modified:
  head/sys/kern/subr_witness.c
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cFri Sep 23 03:21:40 2016
(r306223)
+++ head/sys/kern/subr_witness.cFri Sep 23 04:45:11 2016
(r306224)
@@ -625,7 +625,7 @@ static struct witness_order_list_entry o
/*
 * VFS namecache
 */
-   { "ncglobal", _class_rw },
+   { "ncvn", _class_mtx_sleep },
{ "ncbuc", _class_rw },
{ "vnode interlock", _class_mtx_sleep },
{ "ncneg", _class_mtx_sleep },

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Sep 23 03:21:40 2016(r306223)
+++ head/sys/kern/vfs_cache.c   Fri Sep 23 04:45:11 2016(r306224)
@@ -151,21 +151,35 @@ structnamecache_ts {
  * name is located in the cache, it will be dropped.
  *
  * These locks are used (in the order in which they can be taken):
- * NAME TYPEROLE
- * cache_lock   rwlock  global, needed for all modifications
- * bucketlock   rwlock  for access to given hash bucket
- * ncneg_mtxmtx negative entry LRU management
+ * NAMETYPEROLE
+ * vnodelock   mtx vnode lists and v_cache_dd field protection
+ * bucketlock  rwlock  for access to given set of hash buckets
+ * ncneg_mtx   mtx negative entry LRU management
  *
- * A name -> vnode lookup can be safely performed by either locking cache_lock
- * or the relevant hash bucket.
+ * Additionally, ncneg_shrink_lock mtx is used to have at most one thread
+ * shrinking the LRU list.
  *
- * ".." and vnode -> name lookups require cache_lock.
+ * It is legal to take multiple vnodelock and bucketlock locks. The locking
+ * order is lower address first. Both are recursive.
  *
- * Modifications require both cache_lock and relevant bucketlock taken for
- * writing.
+ * "." lookups are lockless.
  *
- * Negative entry LRU management requires ncneg_mtx taken on top of either
- * cache_lock or bucketlock.
+ * ".." and vnode -> name lookups require vnodelock.
+ *
+ * name -> vnode lookup requires the relevant bucketlock to be held for 
reading.
+ *
+ * Insertions and removals of entries require involved vnodes and bucketlocks
+ * to be write-locked to prevent other threads from seeing the entry.
+ *
+ * Some lookups result in removal of the found entry (e.g. getting rid of a
+ * negative entry with the intent to create a positive one), which poses a
+ * problem when multiple threads reach the state. Similarly, two different
+ * threads can purge two different vnodes and try to remove the same name.
+ *
+ * If the already held vnode lock is lower than the second required lock, we
+ * can just take the other lock. However, in the opposite case, this could
+ * deadlock. As such, this is resolved by trylocking and if that fails 
unlocking
+ * the first node, locking everything in order and revalidating the state.
  */
 
 /*
@@ -196,15 +210,9 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor
 
 struct nchstatsnchstats;   /* cache effectiveness 
statistics */
 
-static struct rwlock cache_lock;
-RW_SYSINIT(vfscache, _lock, "ncglobal");
-
-#defineCACHE_TRY_WLOCK()   rw_try_wlock(_lock)
-#defineCACHE_UPGRADE_LOCK()rw_try_upgrade(_lock)
-#defineCACHE_RLOCK()   rw_rlock(_lock)
-#defineCACHE_RUNLOCK() rw_runlock(_lock)
-#defineCACHE_WLOCK()   rw_wlock(_lock)
-#defineCACHE_WUNLOCK() rw_wunlock(_lock)
+static struct mtx   ncneg_shrink_lock;
+MTX_SYSINIT(vfscache_shrink_neg, _shrink_lock, "Name Cache shrink neg",
+MTX_DEF);
 
 static struct mtx_padalign ncneg_mtx;
 MTX_SYSINIT(vfscache_neg, _mtx, "ncneg", MTX_DEF);
@@ -214,6 +222,19 @@ static struct rwlock_padalign  *bucketlo
 #defineHASH2BUCKETLOCK(hash) \
((struct rwlock *)([((hash) % numbucketlocks)]))
 
+static u_int   numvnodelocks;
+static struct mtx *vnodelocks;
+static inline struct mtx *
+VP2VNODELOCK(struct vnode *vp)
+{
+   struct mtx *vlp;
+
+   if (vp == NULL)
+   return (NULL);
+   vlp = [(((uintptr_t)(vp) >> 8) % numvnodelocks)];
+   return (vlp);
+}
+
 /*
  * UMA zones for the VFS cache.
  *
@@ -329,19 +350,49 @@ STATNODE_COUNTER(numfullpathfail2,
 "Number 

Re: svn commit: r306220 - head/sys/cddl/dev/systrace

2016-09-22 Thread Ngie Cooper
On Thu, Sep 22, 2016 at 4:22 PM, Mark Johnston  wrote:
> Author: markj
> Date: Thu Sep 22 23:22:53 2016
> New Revision: 306220
> URL: https://svnweb.freebsd.org/changeset/base/306220
>
> Log:
>   Re-check the systrace probe ID before calling dtrace_probe().
>
>   Otherwise there exists a narrow window during which a syscall probe can be
>   disabled and cause a concurrently-running thread to call dtrace_probe()
>   with an invalid probe ID.
>
>   Reported by:  ngie
>   MFC after:1 week
>   Sponsored by: Dell EMC Isilon

Thanks Mark :)!
___
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: r306220 - head/sys/cddl/dev/systrace

2016-09-22 Thread Mark Johnston
Author: markj
Date: Thu Sep 22 23:22:53 2016
New Revision: 306220
URL: https://svnweb.freebsd.org/changeset/base/306220

Log:
  Re-check the systrace probe ID before calling dtrace_probe().
  
  Otherwise there exists a narrow window during which a syscall probe can be
  disabled and cause a concurrently-running thread to call dtrace_probe()
  with an invalid probe ID.
  
  Reported by:  ngie
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/cddl/dev/systrace/systrace.c

Modified: head/sys/cddl/dev/systrace/systrace.c
==
--- head/sys/cddl/dev/systrace/systrace.c   Thu Sep 22 22:51:11 2016
(r306219)
+++ head/sys/cddl/dev/systrace/systrace.c   Thu Sep 22 23:22:53 2016
(r306220)
@@ -193,7 +193,8 @@ systrace_probe(struct syscall_args *sa, 
memset(uargs, 0, sizeof(uargs));
 
if (type == SYSTRACE_ENTRY) {
-   id = sa->callp->sy_entry;
+   if ((id = sa->callp->sy_entry) == DTRACE_IDNONE)
+   return;
 
if (sa->callp->sy_systrace_args_func != NULL)
/*
@@ -215,7 +216,8 @@ systrace_probe(struct syscall_args *sa, 
 */
curthread->t_dtrace_systrace_args = uargs;
} else {
-   id = sa->callp->sy_return;
+   if ((id = sa->callp->sy_return) == DTRACE_IDNONE)
+   return;
 
curthread->t_dtrace_systrace_args = NULL;
/* Set arg0 and arg1 as the return value of this syscall. */
___
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: r306219 - head/sys/dev/oce

2016-09-22 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Sep 22 22:51:11 2016
New Revision: 306219
URL: https://svnweb.freebsd.org/changeset/base/306219

Log:
  Update oce to version 11.0.50.0
  
  Submitted by: Venkat Duvvuru 

Added:
  head/sys/dev/oce/oce_user.h   (contents, props changed)
Modified:
  head/sys/dev/oce/oce_hw.c
  head/sys/dev/oce/oce_hw.h
  head/sys/dev/oce/oce_if.c
  head/sys/dev/oce/oce_if.h
  head/sys/dev/oce/oce_mbox.c
  head/sys/dev/oce/oce_queue.c
  head/sys/dev/oce/oce_sysctl.c

Modified: head/sys/dev/oce/oce_hw.c
==
--- head/sys/dev/oce/oce_hw.c   Thu Sep 22 21:34:35 2016(r306218)
+++ head/sys/dev/oce/oce_hw.c   Thu Sep 22 22:51:11 2016(r306219)
@@ -393,6 +393,11 @@ oce_create_nw_interface(POCE_SOFTC sc)
if (IS_SH(sc) || IS_XE201(sc))
capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST;
 
+if (sc->enable_hwlro) {
+capab_flags |= MBX_RX_IFACE_FLAGS_LRO;
+capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO;
+}
+
/* enable capabilities controlled via driver startup parameters */
if (is_rss_enabled(sc))
capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS;

Modified: head/sys/dev/oce/oce_hw.h
==
--- head/sys/dev/oce/oce_hw.h   Thu Sep 22 21:34:35 2016(r306218)
+++ head/sys/dev/oce/oce_hw.h   Thu Sep 22 22:51:11 2016(r306219)
@@ -111,6 +111,9 @@
 #definePD_MPU_MBOX_DB  0x0160
 #definePD_MQ_DB0x0140
 
+#define DB_OFFSET  0xc0
+#define DB_LRO_RQ_ID_MASK  0x7FF
+
 /* EQE completion types */
 #defineEQ_MINOR_CODE_COMPLETION0x00
 #defineEQ_MINOR_CODE_OTHER 0x01
@@ -180,6 +183,7 @@
 #define ASYNC_EVENT_GRP5   0x5
 #define ASYNC_EVENT_CODE_DEBUG 0x6
 #define ASYNC_EVENT_PVID_STATE 0x3
+#define ASYNC_EVENT_OS2BMC 0x5
 #define ASYNC_EVENT_DEBUG_QNQ  0x1
 #define ASYNC_EVENT_CODE_SLIPORT   0x11
 #define VLAN_VID_MASK  0x0FFF
@@ -722,6 +726,34 @@ struct oce_async_cqe_link_state {
} u0;
 };
 
+/* OS2BMC async event */
+struct oce_async_evt_grp5_os2bmc {
+   union {
+   struct {
+   uint32_t lrn_enable:1;
+   uint32_t lrn_disable:1;
+   uint32_t mgmt_enable:1;
+   uint32_t mgmt_disable:1;
+   uint32_t rsvd0:12;
+   uint32_t vlan_tag:16;
+   uint32_t arp_filter:1;
+   uint32_t dhcp_client_filt:1;
+   uint32_t dhcp_server_filt:1;
+   uint32_t net_bios_filt:1;
+   uint32_t rsvd1:3;
+   uint32_t bcast_filt:1;
+   uint32_t ipv6_nbr_filt:1;
+   uint32_t ipv6_ra_filt:1;
+   uint32_t ipv6_ras_filt:1;
+   uint32_t rsvd2[4];
+   uint32_t mcast_filt:1;
+   uint32_t rsvd3:16;
+   uint32_t evt_tag;
+   uint32_t dword3;
+   } s;
+   uint32_t dword[4];
+   } u;
+};
 
 /* PVID aync event */
 struct oce_async_event_grp5_pvid_state {
@@ -1396,7 +1428,7 @@ typedef union oce_cq_ctx_u {
uint32_t dw5rsvd3:1;
uint32_t eventable:1;
/* dw6 */
-   uint32_t eq_id:8;
+   uint32_t eq_id:16;
uint32_t dw6rsvd1:15;
uint32_t armed:1;
/* dw7 */
@@ -2403,8 +2435,8 @@ struct oce_nic_hdr_wqe {
uint32_t tcpcs:1;
uint32_t udpcs:1;
uint32_t ipcs:1;
-   uint32_t rsvd3:1;
-   uint32_t rsvd2:1;
+   uint32_t mgmt:1;
+   uint32_t lso6:1;
uint32_t forward:1;
uint32_t crc:1;
uint32_t event:1;
@@ -2426,8 +2458,8 @@ struct oce_nic_hdr_wqe {
uint32_t event:1;
uint32_t crc:1;
uint32_t forward:1;
-   uint32_t rsvd2:1;
-   uint32_t rsvd3:1;
+   uint32_t lso6:1;
+   uint32_t mgmt:1;
uint32_t ipcs:1;
uint32_t udpcs:1;
uint32_t tcpcs:1;
@@ -3010,6 +3042,53 @@ struct oce_rxf_stats_v0 {
uint32_t rsvd1[6];
 };
 
+struct oce_port_rxf_stats_v2 {
+uint32_t rsvd0[10];
+uint32_t roce_bytes_received_lsd;
+uint32_t roce_bytes_received_msd;
+uint32_t rsvd1[5];
+uint32_t 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
Thanks, I was able to reproduce that :)
I attached the patch. Could you please confirm that it fix the problem?

Thank you and sorry for inconveniences,
Mariusz

On 22 September 2016 at 18:11, Ruslan Bukin  wrote:
> I have just tested this with MIPS64EL and the result is the same.
> So you can try both EL or EB
>
> e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
>> Hi
>>
>> It reports nothing. Yes I use qemu:
>> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
>> -kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel 
>> -hda /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net 
>> nic -net user -m 2048M -redir tcp:4022::22
>>
>> Ruslan
>>
>> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
>> > I tested it on the mips for Malta kernel and it's works fine. I will
>> > try to do it on mips64, are you using qemu to test it?
>> > What is ctrl + t reporting you?
>> >
>> >
>> > On 22 September 2016 at 16:56, Ruslan Bukin  
>> > wrote:
>> > > May be. The next line should be
>> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
>> > >
>> > > but it hangs before this line
>> > >
>> > > Ruslan
>> > >
>> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
>> > >> Hi Ruslan,
>> > >>
>> > >> Does it hang on some network script?
>> > >>
>> > >> Thanks,
>> > >> Mariusz
>> > >>
>> > >>
>> > >> On 22 September 2016 at 16:34, Ruslan Bukin  
>> > >> wrote:
>> > >> > Hi Mariusz
>> > >> >
>> > >> > my MIPS64EB kernel stops booting with this
>> > >> >
>> > >> > somewhere here:
>> > >> > [...]
>> > >> > Starting file system checks:
>> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
>> > >> > blocks, 0.0% fragmentation)
>> > >> > Mounting local filesystems:.
>> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
>> > >> > random: unblocking device.
>> > >> >
>> > >> > any idea ? (should I rebuild something?)
>> > >> >
>> > >> > thanks!
>> > >> >
>> > >> > Ruslan
>> > >> >
>> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> > >> >> Author: oshogbo
>> > >> >> Date: Thu Sep 22 09:58:46 2016
>> > >> >> New Revision: 306174
>> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
>> > >> >>
>> > >> >> Log:
>> > >> >>   capsicum: propagate rights on accept(2)
>> > >> >>
>> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
>> > >> >> rights from
>> > >> >>   the listening socket.
>> > >> >>
>> > >> >>   PR: 201052
>> > >> >>   Reviewed by:emaste, jonathan
>> > >> >>   Discussed with: many
>> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
>> > >> >>
>> > >> >> Modified:
>> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
>> > >> >>   head/sys/compat/linux/linux_socket.c
>> > >> >>   head/sys/kern/kern_sendfile.c
>> > >> >>   head/sys/kern/uipc_syscalls.c
>> > >> >>   head/sys/netinet/sctp_syscalls.c
>> > >> >>   head/sys/sys/socketvar.h
>> > >> >>
>> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> > >> >> ==
>> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
>> > >> >> 2016(r306173)
>> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
>> > >> >> 2016(r306174)
>> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>> > >> >>   int error;
>> > >> >>
>> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
>> > >> >> NULL);
>> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
>> > >> >> NULL, NULL);
>> > >> >>   if (error != 0)
>> > >> >>   return (error);
>> > >> >>   so = fp->f_data;
>> > >> >>
>> > >> >> Modified: head/sys/compat/linux/linux_socket.c
>> > >> >> ==
>> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
>> > >> >> 2016(r306173)
>> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
>> > >> >> 2016(r306174)
>> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
>> > >> >> sockaddr_in))
>> > >> >>   return (EINVAL);
>> > >> >>   if (error == EINVAL) {
>> > >> >> - error1 = getsock_cap(td, s, , , 
>> > >> >> NULL);
>> > >> >> + error1 = getsock_cap(td, s, , , 
>> > >> >> NULL, NULL);
>> > >> >>   if (error1 != 0)
>> > >> >>   return (error1);
>> > >> 

svn commit: r306218 - in head: share/man/man4 sys/dev/amdsbwd sys/dev/intpm

2016-09-22 Thread Andriy Gapon
Author: avg
Date: Thu Sep 22 21:34:35 2016
New Revision: 306218
URL: https://svnweb.freebsd.org/changeset/base/306218

Log:
  amdsbwd, intpm: unify bits specific to AMD chipsets (FCHs, southbridges)
  
  AMD chipsets have proprietary mechanisms for dicovering resources.
  Those resources are not discoverable via plug-and-play mechanisms
  like PCI configuration registers or ACPI.
  For this reason a chipset-specific knowledge of proprietary registers
  is required.
  
  At present there are two FreeBSD drivers that require the proprietary
  resource discovery.  One is amdsbwd which is a driver for the watchdog
  timer in the AMD chipsets.  The other is intpm SMBus driver when it
  attaches to the newer AMD chipsets where the resources of the SMBus HBA
  are not described in the regular PCI way.
  
  In both cases the resources are discovered by accessing AMD PMIO space.
  Thus, many definitions are shared between the two drivers.
  This change puts those defintions into a common header file.
  
  As an added benefit, intpm driver now supports newest FCHs built into
  AMD processors of Family 15h, models 70h-7Fh and Family 16h, models
  30h-3Fh.
  
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D8004

Added:
  head/sys/dev/amdsbwd/amd_chipset.h   (contents, props changed)
Modified:
  head/share/man/man4/intpm.4
  head/sys/dev/amdsbwd/amdsbwd.c
  head/sys/dev/intpm/intpm.c

Modified: head/share/man/man4/intpm.4
==
--- head/share/man/man4/intpm.4 Thu Sep 22 21:23:28 2016(r306217)
+++ head/share/man/man4/intpm.4 Thu Sep 22 21:34:35 2016(r306218)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2016
+.Dd September 22, 2016
 .Dt INTPM 4
 .Os
 .Sh NAME
@@ -59,7 +59,9 @@ AMD SB600/7x0/8x0/9x0 southbridges
 .It
 AMD Axx/Hudson/Bolton FCHs
 .It
-AMD FCH integrated into Family 16h Models 00h-0Fh Processors
+AMD FCH integrated into Family 15h Models 60h-6Fh, 70h-7Fh Processors
+.It
+AMD FCH integrated into Family 16h Models 00h-0Fh, 30h-3Fh Processors
 .El
 .Sh SEE ALSO
 .Xr amdpm 4 ,

Added: head/sys/dev/amdsbwd/amd_chipset.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/amdsbwd/amd_chipset.h  Thu Sep 22 21:34:35 2016
(r306218)
@@ -0,0 +1,139 @@
+/*-
+ * Copyright (c) 2016 Andriy Gapon 
+ * 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, 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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$
+ */
+
+/*
+ * The following registers, bits and magic values are defined in Register
+ * Reference Guide documents for SB600, SB7x0, SB8x0, SB9x0 southbridges and
+ * various versions of Fusion Controller Hubs (FCHs).  FCHs integrated into
+ * CPUs are documented in BIOS and Kernel Development Guide documents for
+ * the corresponding processor families.
+ *
+ * At present there are three classes of supported chipsets:
+ * - SB600 and S7x0 southbridges where the SMBus controller device has
+ *   a PCI Device ID of 0x43851002 and a revision less than 0x40
+ * - SB8x0, SB9x0 southbridges and FCHs where the SMBus controller device has
+ *   a PCI Device ID of 0x43851002 and a revision greater than or equal to 0x40
+ *   or the controller has an ID of 0x780b1022 and a revision less than 0x41
+ * - FCHs where the SMBus controller device has a PCI Device ID of 0x780b1022
+ *   and a revision greater than or equal to 0x41
+ * The register definitions are compatible within the classes and may be
+ * incompatible accross them.
+ * So far there is no public documentation for "KERNCZ" FCH where the SMBus
+ * controller has a PCI 

svn commit: r306216 - head/sys/dev/cxgbe

2016-09-22 Thread Navdeep Parhar
Author: np
Date: Thu Sep 22 21:19:25 2016
New Revision: 306216
URL: https://svnweb.freebsd.org/changeset/base/306216

Log:
  cxgbe(4): Fix the output of the "tids" sysctl on T6.

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Sep 22 21:16:54 2016
(r306215)
+++ head/sys/dev/cxgbe/t4_main.cThu Sep 22 21:19:25 2016
(r306216)
@@ -7237,7 +7237,12 @@ sysctl_tids(SYSCTL_HANDLER_ARGS)
 
if (t->ntids) {
if (t4_read_reg(sc, A_LE_DB_CONFIG) & F_HASHEN) {
-   uint32_t b = t4_read_reg(sc, A_LE_DB_SERVER_INDEX) / 4;
+   uint32_t b;
+
+   if (chip_id(sc) <= CHELSIO_T5)
+   b = t4_read_reg(sc, A_LE_DB_SERVER_INDEX) / 4;
+   else
+   b = t4_read_reg(sc, A_LE_DB_SRVR_START_INDEX);
 
if (b) {
sbuf_printf(sb, "TID range: 0-%u, %u-%u", b - 1,
___
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: r306212 - head/sys/kern

2016-09-22 Thread Gleb Smirnoff
Author: glebius
Date: Thu Sep 22 20:34:44 2016
New Revision: 306212
URL: https://svnweb.freebsd.org/changeset/base/306212

Log:
  Fix regression from r297400, which truncates headers in case of low socket
  buffer and put a small optimization for low socket buffer case:
  
  - Do not hack uio_resid, and let m_uiotombuf() properly take care of it. This
fixes truncation of headers at low buffer.
  - If headers ate all the space, jump right to the end of the cycle, to
avoid doing single page I/O and allocating zero length mbuf.
  - Clear hdr_uio only if space is positive, which indicates that all uio
was copied in.
  
  Reviewed by:  pluknet, jtl, emax, rrs, lstewart, emax, gallatin, scottl

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Thu Sep 22 19:16:08 2016
(r306211)
+++ head/sys/kern/kern_sendfile.c   Thu Sep 22 20:34:44 2016
(r306212)
@@ -656,10 +656,18 @@ retry_space:
if (hdr_uio != NULL && hdr_uio->uio_resid > 0) {
hdr_uio->uio_td = td;
hdr_uio->uio_rw = UIO_WRITE;
-   hdr_uio->uio_resid = min(hdr_uio->uio_resid, space);
-   mh = m_uiotombuf(hdr_uio, M_WAITOK, 0, 0, 0);
+   mh = m_uiotombuf(hdr_uio, M_WAITOK, space, 0, 0);
hdrlen = m_length(mh, );
space -= hdrlen;
+   /*
+* If header consumed all the socket buffer space,
+* don't waste CPU cycles and jump to the end.
+*/
+   if (space == 0) {
+   sfio = NULL;
+   nios = 0;
+   goto prepend_header;
+   }
hdr_uio = NULL;
}
 
@@ -806,6 +814,7 @@ retry_space:
 
/* Prepend header, if any. */
if (hdrlen) {
+prepend_header:
mhtail->m_next = m;
m = mh;
mh = NULL;
___
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: r303562 - head/sys/kern

2016-09-22 Thread Mateusz Guzik
On Thu, Sep 22, 2016 at 08:35:50PM +0200, Oliver Pinter wrote:
> Hi!
> 
> On Sun, Jul 31, 2016 at 12:21 AM, Mateusz Guzik  wrote:
> > Author: mjg
> > Date: Sat Jul 30 22:21:48 2016
> > New Revision: 303562
> > URL: https://svnweb.freebsd.org/changeset/base/303562
> >
> > Log:
> >   rwlock: s/READER/WRITER/ in wlock lockstat annotation
> >
> > Modified:
> >   head/sys/kern/kern_rwlock.c
> >
> > Modified: head/sys/kern/kern_rwlock.c
> 
> Do you plan to MFC this to 10-STABLE? Seems like, it's "affected" too.

I have no intentions in merging this in isolation. It is largely
cosmetic anyway.

However, I have various changes (including pending ones) which I may end
up merging if that happens, this will also get in.

-- 
Mateusz Guzik 
___
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: r306209 - in head/sys/amd64: amd64 include

2016-09-22 Thread Warner Losh
Author: imp
Date: Thu Sep 22 19:04:51 2016
New Revision: 306209
URL: https://svnweb.freebsd.org/changeset/base/306209

Log:
  Change the efi_get_table interface to a void ** so we can return the
  pointer by dereferencing the pointer.
  
  Reviewed by: kib@
  MFC After: 2 weeks
  Sponsored by: Netflix, Inc

Modified:
  head/sys/amd64/amd64/efirt.c
  head/sys/amd64/include/efi.h

Modified: head/sys/amd64/amd64/efirt.c
==
--- head/sys/amd64/amd64/efirt.cThu Sep 22 19:04:08 2016
(r306208)
+++ head/sys/amd64/amd64/efirt.cThu Sep 22 19:04:51 2016
(r306209)
@@ -405,7 +405,7 @@ efi_uninit(void)
 }
 
 int
-efi_get_table(struct uuid *uuid, void *ptr)
+efi_get_table(struct uuid *uuid, void **ptr)
 {
struct efi_cfgtbl *ct;
u_long count;
@@ -416,7 +416,7 @@ efi_get_table(struct uuid *uuid, void *p
ct = efi_cfgtbl;
while (count--) {
if (!bcmp(>ct_uuid, uuid, sizeof(*uuid))) {
-   ptr = (void *)PHYS_TO_DMAP(ct->ct_data);
+   *ptr = (void *)PHYS_TO_DMAP(ct->ct_data);
return (0);
}
ct++;

Modified: head/sys/amd64/include/efi.h
==
--- head/sys/amd64/include/efi.hThu Sep 22 19:04:08 2016
(r306208)
+++ head/sys/amd64/include/efi.hThu Sep 22 19:04:51 2016
(r306209)
@@ -43,7 +43,7 @@
 struct uuid;
 struct efi_tm;
 
-int efi_get_table(struct uuid *uuid, void *ptr);
+int efi_get_table(struct uuid *uuid, void **ptr);
 int efi_get_time(struct efi_tm *tm);
 int efi_get_time_locked(struct efi_tm *tm);
 int efi_reset_system(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: r306206 - head/sys/dev/cxgbe

2016-09-22 Thread Navdeep Parhar
Author: np
Date: Thu Sep 22 18:47:07 2016
New Revision: 306206
URL: https://svnweb.freebsd.org/changeset/base/306206

Log:
  cxgbe(4): Catch up with the different layout of WHOAMI in T6.
  
  Note that the code moved below t4_prep_adapter() as part of this change
  because now it needs a working chip_id().

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Sep 22 18:45:25 2016
(r306205)
+++ head/sys/dev/cxgbe/t4_main.cThu Sep 22 18:47:07 2016
(r306206)
@@ -812,15 +812,6 @@ t4_attach(device_t dev)
if (rc != 0)
goto done; /* error message displayed already */
 
-   /*
-* This is the real PF# to which we're attaching.  Works from within PCI
-* passthrough environments too, where pci_get_function() could return a
-* different PF# depending on the passthrough configuration.  We need to
-* use the real PF# in all our communication with the firmware.
-*/
-   sc->pf = G_SOURCEPF(t4_read_reg(sc, A_PL_WHOAMI));
-   sc->mbox = sc->pf;
-
memset(sc->chan_map, 0xff, sizeof(sc->chan_map));
 
/* Prepare the adapter for operation. */
@@ -832,6 +823,16 @@ t4_attach(device_t dev)
goto done;
}
 
+   /*
+* This is the real PF# to which we're attaching.  Works from within PCI
+* passthrough environments too, where pci_get_function() could return a
+* different PF# depending on the passthrough configuration.  We need to
+* use the real PF# in all our communication with the firmware.
+*/
+   j = t4_read_reg(sc, A_PL_WHOAMI);
+   sc->pf = chip_id(sc) <= CHELSIO_T5 ? G_SOURCEPF(j) : G_T6_SOURCEPF(j);
+   sc->mbox = sc->pf;
+
t4_init_devnames(sc);
if (sc->names == NULL) {
rc = ENOTSUP;
___
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: r306205 - in head/sys/dev/usb: . serial

2016-09-22 Thread Luiz Otavio O Souza
Author: loos
Date: Thu Sep 22 18:45:25 2016
New Revision: 306205
URL: https://svnweb.freebsd.org/changeset/base/306205

Log:
  Add the ID for the Huawei ME909S LTE modem.
  
  Submitted by: svenauhagen at github
  MFC after:3 days
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Thu Sep 22 18:31:50 2016
(r306204)
+++ head/sys/dev/usb/serial/u3g.c   Thu Sep 22 18:45:25 2016
(r306205)
@@ -312,6 +312,7 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI),
U3G_DEV(HUAWEI, E392, U3GINIT_HUAWEISCSI),
U3G_DEV(HUAWEI, ME909U, U3GINIT_HUAWEISCSI2),
+   U3G_DEV(HUAWEI, ME909S, U3GINIT_HUAWEISCSI2),
U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI),
U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI),
U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Sep 22 18:31:50 2016(r306204)
+++ head/sys/dev/usb/usbdevsThu Sep 22 18:45:25 2016(r306205)
@@ -2431,6 +2431,7 @@ product HUAWEI E3272_INIT 0x155b  LTE mod
 product HUAWEI ME909U  0x1573  LTE modem
 product HUAWEI R215_INIT   0x1582  LTE modem initial
 product HUAWEI R2150x1588  LTE modem
+product HUAWEI ME909S  0x15c1  LTE modem
 product HUAWEI ETS2055 0x1803  CDMA modem
 product HUAWEI E1730x1c05  3G modem
 product HUAWEI E173_INIT   0x1c0b  3G modem initial
___
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: r303562 - head/sys/kern

2016-09-22 Thread Oliver Pinter
Hi!

On Sun, Jul 31, 2016 at 12:21 AM, Mateusz Guzik  wrote:
> Author: mjg
> Date: Sat Jul 30 22:21:48 2016
> New Revision: 303562
> URL: https://svnweb.freebsd.org/changeset/base/303562
>
> Log:
>   rwlock: s/READER/WRITER/ in wlock lockstat annotation
>
> Modified:
>   head/sys/kern/kern_rwlock.c
>
> Modified: head/sys/kern/kern_rwlock.c

Do you plan to MFC this to 10-STABLE? Seems like, it's "affected" too.

> ==
> --- head/sys/kern/kern_rwlock.c Sat Jul 30 21:06:59 2016(r303561)
> +++ head/sys/kern/kern_rwlock.c Sat Jul 30 22:21:48 2016(r303562)
> @@ -920,7 +920,7 @@ __rw_wlock_hard(volatile uintptr_t *c, u
> /* Record only the loops spinning and not sleeping. */
> if (spin_cnt > sleep_cnt)
> LOCKSTAT_RECORD4(rw__spin, rw, all_time - sleep_time,
> -   LOCKSTAT_READER, (state & RW_LOCK_READ) == 0,
> +   LOCKSTAT_WRITER, (state & RW_LOCK_READ) == 0,
> (state & RW_LOCK_READ) == 0 ? 0 : RW_READERS(state));
>  #endif
> LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(rw__acquire, rw, contested,
> ___
> 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-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: r303753 - head/sys/amd64/amd64

2016-09-22 Thread Oliver Pinter
Hi!

Do you plan to MFC this change to 10-STABLE?

On Thu, Aug 4, 2016 at 7:55 PM, John Baldwin  wrote:
> Author: jhb
> Date: Thu Aug  4 17:55:23 2016
> New Revision: 303753
> URL: https://svnweb.freebsd.org/changeset/base/303753
>
> Log:
>   Don't permit mappings of invalid physical addresses on amd64 via /dev/mem.
>
>   Discussed with:   kib
>
> Modified:
>   head/sys/amd64/amd64/mem.c
>
> Modified: head/sys/amd64/amd64/mem.c
> ==
> --- head/sys/amd64/amd64/mem.c  Thu Aug  4 17:46:07 2016(r303752)
> +++ head/sys/amd64/amd64/mem.c  Thu Aug  4 17:55:23 2016(r303753)
> @@ -168,9 +168,11 @@ int
>  memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
>  int prot __unused, vm_memattr_t *memattr __unused)
>  {
> -   if (dev2unit(dev) == CDEV_MINOR_MEM)
> +   if (dev2unit(dev) == CDEV_MINOR_MEM) {
> +   if (offset >= (1ULL << cpu_maxphyaddr))
> +   return (-1);
> *paddr = offset;
> -   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
> +   } else if (dev2unit(dev) == CDEV_MINOR_KMEM)
> *paddr = vtophys(offset);
> /* else panic! */
> return (0);
> ___
> 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-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: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
I have just tested this with MIPS64EL and the result is the same.
So you can try both EL or EB

e.g. make -j16 TARGET=mips TARGET_ARCH=mips64el KERNCONF=MALTA64 buildkernel

Ruslan

On Thu, Sep 22, 2016 at 03:21:53PM +, Ruslan Bukin wrote:
> Hi
> 
> It reports nothing. Yes I use qemu:
> /home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
> -kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
> /home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net nic 
> -net user -m 2048M -redir tcp:4022::22
> 
> Ruslan
> 
> On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> > I tested it on the mips for Malta kernel and it's works fine. I will
> > try to do it on mips64, are you using qemu to test it?
> > What is ctrl + t reporting you?
> > 
> > 
> > On 22 September 2016 at 16:56, Ruslan Bukin  
> > wrote:
> > > May be. The next line should be
> > > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> > >
> > > but it hangs before this line
> > >
> > > Ruslan
> > >
> > > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> > >> Hi Ruslan,
> > >>
> > >> Does it hang on some network script?
> > >>
> > >> Thanks,
> > >> Mariusz
> > >>
> > >>
> > >> On 22 September 2016 at 16:34, Ruslan Bukin  
> > >> wrote:
> > >> > Hi Mariusz
> > >> >
> > >> > my MIPS64EB kernel stops booting with this
> > >> >
> > >> > somewhere here:
> > >> > [...]
> > >> > Starting file system checks:
> > >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> > >> > blocks, 0.0% fragmentation)
> > >> > Mounting local filesystems:.
> > >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> > >> > random: unblocking device.
> > >> >
> > >> > any idea ? (should I rebuild something?)
> > >> >
> > >> > thanks!
> > >> >
> > >> > Ruslan
> > >> >
> > >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> > >> >> Author: oshogbo
> > >> >> Date: Thu Sep 22 09:58:46 2016
> > >> >> New Revision: 306174
> > >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> > >> >>
> > >> >> Log:
> > >> >>   capsicum: propagate rights on accept(2)
> > >> >>
> > >> >>   Descriptor returned by accept(2) should inherits capabilities 
> > >> >> rights from
> > >> >>   the listening socket.
> > >> >>
> > >> >>   PR: 201052
> > >> >>   Reviewed by:emaste, jonathan
> > >> >>   Discussed with: many
> > >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> > >> >>
> > >> >> Modified:
> > >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> > >> >>   head/sys/compat/linux/linux_socket.c
> > >> >>   head/sys/kern/kern_sendfile.c
> > >> >>   head/sys/kern/uipc_syscalls.c
> > >> >>   head/sys/netinet/sctp_syscalls.c
> > >> >>   head/sys/sys/socketvar.h
> > >> >>
> > >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> > >> >> ==
> > >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 
> > >> >> 2016(r306173)
> > >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 
> > >> >> 2016(r306174)
> > >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> > >> >>   int error;
> > >> >>
> > >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> > >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> > >> >> NULL);
> > >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , 
> > >> >> NULL, NULL);
> > >> >>   if (error != 0)
> > >> >>   return (error);
> > >> >>   so = fp->f_data;
> > >> >>
> > >> >> Modified: head/sys/compat/linux/linux_socket.c
> > >> >> ==
> > >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 
> > >> >> 2016(r306173)
> > >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 
> > >> >> 2016(r306174)
> > >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> > >> >>   if (error == EFAULT && namelen != sizeof(struct 
> > >> >> sockaddr_in))
> > >> >>   return (EINVAL);
> > >> >>   if (error == EINVAL) {
> > >> >> - error1 = getsock_cap(td, s, , , NULL);
> > >> >> + error1 = getsock_cap(td, s, , , NULL, 
> > >> >> NULL);
> > >> >>   if (error1 != 0)
> > >> >>   return (error1);
> > >> >>   so = fp->f_data;
> > >> >>
> > >> >> Modified: head/sys/kern/kern_sendfile.c
> > >> >> ==
> > >> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> > >> >> (r306173)
> > >> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> > 

svn commit: r306199 - head/lib/libc/locale

2016-09-22 Thread Warner Losh
Author: imp
Date: Thu Sep 22 16:05:19 2016
New Revision: 306199
URL: https://svnweb.freebsd.org/changeset/base/306199

Log:
  Revert svn:mergeinfo added inadvertantly in last commit r306197

Modified:
Directory Properties:
  head/lib/libc/locale/ascii.c   (props changed)
___
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: r306197 - in head: lib/libc/locale sys/gnu/dts/arm sys/gnu/dts/include/dt-bindings/clock sys/gnu/dts/include/dt-bindings/dma sys/gnu/dts/include/dt-bindings/gpio sys/gnu/dts/include/dt-...

2016-09-22 Thread Warner Losh
Author: imp
Date: Thu Sep 22 15:17:36 2016
New Revision: 306197
URL: https://svnweb.freebsd.org/changeset/base/306197

Log:
  Revert and redo r306083.
  
  Update the device tree source files to a Linux 4.7-RC.
  
  The dts tree currently can't be merged w/o specific revisions.
  
  Note: due to a stupid bug in the commit checking script, I couldn't
  just remove the svn:keyword tag from the new files, I had to add
  fbsd:nokeywords to all the files (including ones that didn't need it)

Added:
 - copied from r303380, vendor/device-tree/dist/include/dt-bindings/iio/adc/
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/iio/adi,ad5592r.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/media/tvp5150.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/memory/mt8173-larb-port.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7779-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7790-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7791-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7793-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7794-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/r8a7795-sysc.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/rk3368-power.h
 - copied unchanged from r303380, 
vendor/device-tree/dist/include/dt-bindings/power/rk3399-power.h
Directory Properties:
  head/sys/gnu/dts/include/dt-bindings/iio/adc/   (props changed)
  head/sys/gnu/dts/include/dt-bindings/iio/adi,ad5592r.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/media/tvp5150.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/memory/mt8173-larb-port.h   (props 
changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7779-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7790-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7791-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7793-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7794-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/r8a7795-sysc.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/rk3368-power.h   (props changed)
  head/sys/gnu/dts/include/dt-bindings/power/rk3399-power.h   (props changed)
Replaced:
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am335x-baltos-ir2110.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am335x-baltos-ir3220.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am335x-baltos.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am335x-icev2.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am572x-idk.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am57xx-commercial-grade.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am57xx-idk-common.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/am57xx-industrial-grade.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb-11mp-revb.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb-11mp.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb-a9mp.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb-mp.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-eb.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-pba8.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-pbx-a9.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/arm-realview-pbx.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/artpec6-devboard.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/artpec6.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/aspeed-ast2500-evb.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/aspeed-bmc-opp-palmetto.dts
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/aspeed-g4.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/aspeed-g5.dtsi
 - copied unchanged from r303380, 
vendor/device-tree/dist/src/arm/bcm2835-rpi-a.dts
 - copied unchanged from r303380, 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
Hi

It reports nothing. Yes I use qemu:
/home/rb743/dev/qemu/qemu/build1/mips64-softmmu/qemu-system-mips64 -M malta 
-kernel ~/obj/mips.mips64/home/rb743/dev/freebsd-mips/sys/MALTA64/kernel -hda 
/home/rb743/world-mips64eb/mips64eb.img -nographic -smp 1 -cpu 5kf -net nic 
-net user -m 2048M -redir tcp:4022::22

Ruslan

On Thu, Sep 22, 2016 at 05:11:07PM +0200, Mariusz Zaborski wrote:
> I tested it on the mips for Malta kernel and it's works fine. I will
> try to do it on mips64, are you using qemu to test it?
> What is ctrl + t reporting you?
> 
> 
> On 22 September 2016 at 16:56, Ruslan Bukin  wrote:
> > May be. The next line should be
> > /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
> >
> > but it hangs before this line
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> >> Hi Ruslan,
> >>
> >> Does it hang on some network script?
> >>
> >> Thanks,
> >> Mariusz
> >>
> >>
> >> On 22 September 2016 at 16:34, Ruslan Bukin  
> >> wrote:
> >> > Hi Mariusz
> >> >
> >> > my MIPS64EB kernel stops booting with this
> >> >
> >> > somewhere here:
> >> > [...]
> >> > Starting file system checks:
> >> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> >> > blocks, 0.0% fragmentation)
> >> > Mounting local filesystems:.
> >> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> >> > random: unblocking device.
> >> >
> >> > any idea ? (should I rebuild something?)
> >> >
> >> > thanks!
> >> >
> >> > Ruslan
> >> >
> >> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> >> Author: oshogbo
> >> >> Date: Thu Sep 22 09:58:46 2016
> >> >> New Revision: 306174
> >> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >> >>
> >> >> Log:
> >> >>   capsicum: propagate rights on accept(2)
> >> >>
> >> >>   Descriptor returned by accept(2) should inherits capabilities rights 
> >> >> from
> >> >>   the listening socket.
> >> >>
> >> >>   PR: 201052
> >> >>   Reviewed by:emaste, jonathan
> >> >>   Discussed with: many
> >> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >> >>
> >> >> Modified:
> >> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >> >>   head/sys/compat/linux/linux_socket.c
> >> >>   head/sys/kern/kern_sendfile.c
> >> >>   head/sys/kern/uipc_syscalls.c
> >> >>   head/sys/netinet/sctp_syscalls.c
> >> >>   head/sys/sys/socketvar.h
> >> >>
> >> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> >> ==
> >> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016  
> >> >>   (r306173)
> >> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016  
> >> >>   (r306174)
> >> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >> >>   int error;
> >> >>
> >> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> >> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
> >> >> NULL);
> >> >>   if (error != 0)
> >> >>   return (error);
> >> >>   so = fp->f_data;
> >> >>
> >> >> Modified: head/sys/compat/linux/linux_socket.c
> >> >> ==
> >> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016  
> >> >>   (r306173)
> >> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016  
> >> >>   (r306174)
> >> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >> >>   if (error == EFAULT && namelen != sizeof(struct 
> >> >> sockaddr_in))
> >> >>   return (EINVAL);
> >> >>   if (error == EINVAL) {
> >> >> - error1 = getsock_cap(td, s, , , NULL);
> >> >> + error1 = getsock_cap(td, s, , , NULL, 
> >> >> NULL);
> >> >>   if (error1 != 0)
> >> >>   return (error1);
> >> >>   so = fp->f_data;
> >> >>
> >> >> Modified: head/sys/kern/kern_sendfile.c
> >> >> ==
> >> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> >> >> (r306173)
> >> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> >> >> (r306174)
> >> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
> >> >>* The socket must be a stream socket and connected.
> >> >>*/
> >> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> >> >> - sock_fp, NULL);
> >> >> + sock_fp, NULL, NULL);
> >> >>   if (error != 0)
> >> >>   return (error);
> >> >>   *so = (*sock_fp)->f_data;
> >> >>
> >> >> Modified: head/sys/kern/uipc_syscalls.c
> >> >> 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
I tested it on the mips for Malta kernel and it's works fine. I will
try to do it on mips64, are you using qemu to test it?
What is ctrl + t reporting you?


On 22 September 2016 at 16:56, Ruslan Bukin  wrote:
> May be. The next line should be
> /etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
>
> but it hangs before this line
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
>> Hi Ruslan,
>>
>> Does it hang on some network script?
>>
>> Thanks,
>> Mariusz
>>
>>
>> On 22 September 2016 at 16:34, Ruslan Bukin  
>> wrote:
>> > Hi Mariusz
>> >
>> > my MIPS64EB kernel stops booting with this
>> >
>> > somewhere here:
>> > [...]
>> > Starting file system checks:
>> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
>> > blocks, 0.0% fragmentation)
>> > Mounting local filesystems:.
>> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
>> > random: unblocking device.
>> >
>> > any idea ? (should I rebuild something?)
>> >
>> > thanks!
>> >
>> > Ruslan
>> >
>> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> >> Author: oshogbo
>> >> Date: Thu Sep 22 09:58:46 2016
>> >> New Revision: 306174
>> >> URL: https://svnweb.freebsd.org/changeset/base/306174
>> >>
>> >> Log:
>> >>   capsicum: propagate rights on accept(2)
>> >>
>> >>   Descriptor returned by accept(2) should inherits capabilities rights 
>> >> from
>> >>   the listening socket.
>> >>
>> >>   PR: 201052
>> >>   Reviewed by:emaste, jonathan
>> >>   Discussed with: many
>> >>   Differential Revision:  https://reviews.freebsd.org/D7724
>> >>
>> >> Modified:
>> >>   head/sys/compat/cloudabi/cloudabi_sock.c
>> >>   head/sys/compat/linux/linux_socket.c
>> >>   head/sys/kern/kern_sendfile.c
>> >>   head/sys/kern/uipc_syscalls.c
>> >>   head/sys/netinet/sctp_syscalls.c
>> >>   head/sys/sys/socketvar.h
>> >>
>> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> >> ==
>> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>> >>   int error;
>> >>
>> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
>> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
>> >> NULL);
>> >>   if (error != 0)
>> >>   return (error);
>> >>   so = fp->f_data;
>> >>
>> >> Modified: head/sys/compat/linux/linux_socket.c
>> >> ==
>> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>> >>   if (error == EFAULT && namelen != sizeof(struct 
>> >> sockaddr_in))
>> >>   return (EINVAL);
>> >>   if (error == EINVAL) {
>> >> - error1 = getsock_cap(td, s, , , NULL);
>> >> + error1 = getsock_cap(td, s, , , NULL, 
>> >> NULL);
>> >>   if (error1 != 0)
>> >>   return (error1);
>> >>   so = fp->f_data;
>> >>
>> >> Modified: head/sys/kern/kern_sendfile.c
>> >> ==
>> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
>> >>* The socket must be a stream socket and connected.
>> >>*/
>> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
>> >> - sock_fp, NULL);
>> >> + sock_fp, NULL, NULL);
>> >>   if (error != 0)
>> >>   return (error);
>> >>   *so = (*sock_fp)->f_data;
>> >>
>> >> Modified: head/sys/kern/uipc_syscalls.c
>> >> ==
>> >> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
>> >> (r306173)
>> >> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
>> >> (r306174)
>> >> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>> >>  /*
>> >>   * Convert a user file descriptor to a kernel file entry and check if 
>> >> required
>> >>   * capability rights are present.
>> >> + * If required copy of current set of capability rights is returned.
>> >>   * A reference on the file entry is held upon returning.
>> >>   */
>> >>  int
>> >>  

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
May be. The next line should be
/etc/rc: WARNING: $hostname is not set -- see rc.conf(5).

but it hangs before this line

Ruslan

On Thu, Sep 22, 2016 at 04:39:16PM +0200, Mariusz Zaborski wrote:
> Hi Ruslan,
> 
> Does it hang on some network script?
> 
> Thanks,
> Mariusz
> 
> 
> On 22 September 2016 at 16:34, Ruslan Bukin  wrote:
> > Hi Mariusz
> >
> > my MIPS64EB kernel stops booting with this
> >
> > somewhere here:
> > [...]
> > Starting file system checks:
> > /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 
> > blocks, 0.0% fragmentation)
> > Mounting local filesystems:.
> > ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> > random: unblocking device.
> >
> > any idea ? (should I rebuild something?)
> >
> > thanks!
> >
> > Ruslan
> >
> > On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> >> Author: oshogbo
> >> Date: Thu Sep 22 09:58:46 2016
> >> New Revision: 306174
> >> URL: https://svnweb.freebsd.org/changeset/base/306174
> >>
> >> Log:
> >>   capsicum: propagate rights on accept(2)
> >>
> >>   Descriptor returned by accept(2) should inherits capabilities rights from
> >>   the listening socket.
> >>
> >>   PR: 201052
> >>   Reviewed by:emaste, jonathan
> >>   Discussed with: many
> >>   Differential Revision:  https://reviews.freebsd.org/D7724
> >>
> >> Modified:
> >>   head/sys/compat/cloudabi/cloudabi_sock.c
> >>   head/sys/compat/linux/linux_socket.c
> >>   head/sys/kern/kern_sendfile.c
> >>   head/sys/kern/uipc_syscalls.c
> >>   head/sys/netinet/sctp_syscalls.c
> >>   head/sys/sys/socketvar.h
> >>
> >> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> >> ==
> >> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016 
> >>(r306173)
> >> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016 
> >>(r306174)
> >> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
> >>   int error;
> >>
> >>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> >> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> >> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
> >> NULL);
> >>   if (error != 0)
> >>   return (error);
> >>   so = fp->f_data;
> >>
> >> Modified: head/sys/compat/linux/linux_socket.c
> >> ==
> >> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016 
> >>(r306173)
> >> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016 
> >>(r306174)
> >> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
> >>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
> >>   return (EINVAL);
> >>   if (error == EINVAL) {
> >> - error1 = getsock_cap(td, s, , , NULL);
> >> + error1 = getsock_cap(td, s, , , NULL, 
> >> NULL);
> >>   if (error1 != 0)
> >>   return (error1);
> >>   so = fp->f_data;
> >>
> >> Modified: head/sys/kern/kern_sendfile.c
> >> ==
> >> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> >> (r306173)
> >> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> >> (r306174)
> >> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
> >>* The socket must be a stream socket and connected.
> >>*/
> >>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> >> - sock_fp, NULL);
> >> + sock_fp, NULL, NULL);
> >>   if (error != 0)
> >>   return (error);
> >>   *so = (*sock_fp)->f_data;
> >>
> >> Modified: head/sys/kern/uipc_syscalls.c
> >> ==
> >> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
> >> (r306173)
> >> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
> >> (r306174)
> >> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
> >>  /*
> >>   * Convert a user file descriptor to a kernel file entry and check if 
> >> required
> >>   * capability rights are present.
> >> + * If required copy of current set of capability rights is returned.
> >>   * A reference on the file entry is held upon returning.
> >>   */
> >>  int
> >>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
> >> -struct file **fpp, u_int *fflagp)
> >> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
> >>  {
> >>   struct file *fp;
> >>   int error;
> >>
> >> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
> >> + error = fget_cap(td, fd, rightsp, , havecapsp);
> >>   

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
Hi Ruslan,

Does it hang on some network script?

Thanks,
Mariusz


On 22 September 2016 at 16:34, Ruslan Bukin  wrote:
> Hi Mariusz
>
> my MIPS64EB kernel stops booting with this
>
> somewhere here:
> [...]
> Starting file system checks:
> /dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 blocks, 
> 0.0% fragmentation)
> Mounting local filesystems:.
> ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> random: unblocking device.
>
> any idea ? (should I rebuild something?)
>
> thanks!
>
> Ruslan
>
> On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
>> Author: oshogbo
>> Date: Thu Sep 22 09:58:46 2016
>> New Revision: 306174
>> URL: https://svnweb.freebsd.org/changeset/base/306174
>>
>> Log:
>>   capsicum: propagate rights on accept(2)
>>
>>   Descriptor returned by accept(2) should inherits capabilities rights from
>>   the listening socket.
>>
>>   PR: 201052
>>   Reviewed by:emaste, jonathan
>>   Discussed with: many
>>   Differential Revision:  https://reviews.freebsd.org/D7724
>>
>> Modified:
>>   head/sys/compat/cloudabi/cloudabi_sock.c
>>   head/sys/compat/linux/linux_socket.c
>>   head/sys/kern/kern_sendfile.c
>>   head/sys/kern/uipc_syscalls.c
>>   head/sys/netinet/sctp_syscalls.c
>>   head/sys/sys/socketvar.h
>>
>> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
>> ==
>> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016   
>>  (r306173)
>> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016   
>>  (r306174)
>> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>>   int error;
>>
>>   error = getsock_cap(td, uap->sock, cap_rights_init(,
>> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
>> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, 
>> NULL);
>>   if (error != 0)
>>   return (error);
>>   so = fp->f_data;
>>
>> Modified: head/sys/compat/linux/linux_socket.c
>> ==
>> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016   
>>  (r306173)
>> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016   
>>  (r306174)
>> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
>>   return (EINVAL);
>>   if (error == EINVAL) {
>> - error1 = getsock_cap(td, s, , , NULL);
>> + error1 = getsock_cap(td, s, , , NULL, NULL);
>>   if (error1 != 0)
>>   return (error1);
>>   so = fp->f_data;
>>
>> Modified: head/sys/kern/kern_sendfile.c
>> ==
>> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
>> (r306173)
>> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
>> (r306174)
>> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int
>>* The socket must be a stream socket and connected.
>>*/
>>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
>> - sock_fp, NULL);
>> + sock_fp, NULL, NULL);
>>   if (error != 0)
>>   return (error);
>>   *so = (*sock_fp)->f_data;
>>
>> Modified: head/sys/kern/uipc_syscalls.c
>> ==
>> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
>> (r306173)
>> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
>> (r306174)
>> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>>  /*
>>   * Convert a user file descriptor to a kernel file entry and check if 
>> required
>>   * capability rights are present.
>> + * If required copy of current set of capability rights is returned.
>>   * A reference on the file entry is held upon returning.
>>   */
>>  int
>>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
>> -struct file **fpp, u_int *fflagp)
>> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
>>  {
>>   struct file *fp;
>>   int error;
>>
>> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
>> + error = fget_cap(td, fd, rightsp, , havecapsp);
>>   if (error != 0)
>>   return (error);
>>   if (fp->f_type != DTYPE_SOCKET) {
>>   fdrop(fp, td);
>> + if (havecapsp != NULL)
>> + filecaps_free(havecapsp);
>>   return (ENOTSOCK);
>>   }
>>   if (fflagp != NULL)
>> @@ -188,7 +191,7 @@ kern_bindat(struct thread *td, int dirfd
>>   AUDIT_ARG_FD(fd);
>>   AUDIT_ARG_SOCKADDR(td, dirfd, sa);
>>   error = 

Re: svn commit: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Ruslan Bukin
Hi Mariusz

my MIPS64EB kernel stops booting with this

somewhere here:
[...]
Starting file system checks:
/dev/ada0: 20369 files, 794696 used, 7573573 free (933 frags, 946580 blocks, 
0.0% fragmentation)
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
random: unblocking device.

any idea ? (should I rebuild something?)

thanks!

Ruslan

On Thu, Sep 22, 2016 at 09:58:46AM +, Mariusz Zaborski wrote:
> Author: oshogbo
> Date: Thu Sep 22 09:58:46 2016
> New Revision: 306174
> URL: https://svnweb.freebsd.org/changeset/base/306174
> 
> Log:
>   capsicum: propagate rights on accept(2)
>   
>   Descriptor returned by accept(2) should inherits capabilities rights from
>   the listening socket.
>   
>   PR: 201052
>   Reviewed by:emaste, jonathan
>   Discussed with: many
>   Differential Revision:  https://reviews.freebsd.org/D7724
> 
> Modified:
>   head/sys/compat/cloudabi/cloudabi_sock.c
>   head/sys/compat/linux/linux_socket.c
>   head/sys/kern/kern_sendfile.c
>   head/sys/kern/uipc_syscalls.c
>   head/sys/netinet/sctp_syscalls.c
>   head/sys/sys/socketvar.h
> 
> Modified: head/sys/compat/cloudabi/cloudabi_sock.c
> ==
> --- head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/compat/cloudabi/cloudabi_sock.c  Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
>   int error;
>  
>   error = getsock_cap(td, uap->sock, cap_rights_init(,
> - CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
> + CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, NULL);
>   if (error != 0)
>   return (error);
>   so = fp->f_data;
> 
> Modified: head/sys/compat/linux/linux_socket.c
> ==
> --- head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/compat/linux/linux_socket.c  Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
>   if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
>   return (EINVAL);
>   if (error == EINVAL) {
> - error1 = getsock_cap(td, s, , , NULL);
> + error1 = getsock_cap(td, s, , , NULL, NULL);
>   if (error1 != 0)
>   return (error1);
>   so = fp->f_data;
> 
> Modified: head/sys/kern/kern_sendfile.c
> ==
> --- head/sys/kern/kern_sendfile.c Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/kern/kern_sendfile.c Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int 
>* The socket must be a stream socket and connected.
>*/
>   error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
> - sock_fp, NULL);
> + sock_fp, NULL, NULL);
>   if (error != 0)
>   return (error);
>   *so = (*sock_fp)->f_data;
> 
> Modified: head/sys/kern/uipc_syscalls.c
> ==
> --- head/sys/kern/uipc_syscalls.c Thu Sep 22 09:33:22 2016
> (r306173)
> +++ head/sys/kern/uipc_syscalls.c Thu Sep 22 09:58:46 2016
> (r306174)
> @@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
>  /*
>   * Convert a user file descriptor to a kernel file entry and check if 
> required
>   * capability rights are present.
> + * If required copy of current set of capability rights is returned.
>   * A reference on the file entry is held upon returning.
>   */
>  int
>  getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
> -struct file **fpp, u_int *fflagp)
> +struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
>  {
>   struct file *fp;
>   int error;
>  
> - error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
> + error = fget_cap(td, fd, rightsp, , havecapsp);
>   if (error != 0)
>   return (error);
>   if (fp->f_type != DTYPE_SOCKET) {
>   fdrop(fp, td);
> + if (havecapsp != NULL)
> + filecaps_free(havecapsp);
>   return (ENOTSOCK);
>   }
>   if (fflagp != NULL)
> @@ -188,7 +191,7 @@ kern_bindat(struct thread *td, int dirfd
>   AUDIT_ARG_FD(fd);
>   AUDIT_ARG_SOCKADDR(td, dirfd, sa);
>   error = getsock_cap(td, fd, cap_rights_init(, CAP_BIND),
> - , NULL);
> + , NULL, NULL);
>   if (error != 0)
>   return (error);
>   so = fp->f_data;
> @@ -235,7 +238,7 @@ sys_listen(struct thread *td, struct lis
>  
>   AUDIT_ARG_FD(uap->s);
>   error = 

svn commit: r306194 - head/share/man/man9

2016-09-22 Thread Gavin Atkinson
Author: gavin
Date: Thu Sep 22 13:59:27 2016
New Revision: 306194
URL: https://svnweb.freebsd.org/changeset/base/306194

Log:
  Whitespace commit (literally): Add a missing space.
  
  Sponsored by: EuroBSDCon 2016 Devsummit, Belgrade, Serbia.

Modified:
  head/share/man/man9/owll.9

Modified: head/share/man/man9/owll.9
==
--- head/share/man/man9/owll.9  Thu Sep 22 13:27:44 2016(r306193)
+++ head/share/man/man9/owll.9  Thu Sep 22 13:59:27 2016(r306194)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2015
+.Dd September 22, 2016
 .Dt OWLL 9
 .Os
 .Sh NAME
@@ -52,7 +52,7 @@ Semiconductor 1-Wire from upper layers o
 .Fn OWLL_WRITE_ONE
 and
 .Fn OWLL_WRITE_ZERO
-writes a one bitor a zero bit respectively on the 1-Wire bus.
+writes a one bit or a zero bit respectively on the 1-Wire bus.
 .Pp
 .Fn OWLL_READ_DATA
 reads one bit from the 1-Wire bus.
___
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: r306193 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bio crypto/openssl/crypto/bn c...

2016-09-22 Thread Jung-uk Kim
Author: jkim
Date: Thu Sep 22 13:27:44 2016
New Revision: 306193
URL: https://svnweb.freebsd.org/changeset/base/306193

Log:
  Merge OpenSSL 1.0.2i.

Added:
  head/crypto/openssl/doc/crypto/d2i_PrivateKey.pod
 - copied unchanged from r306189, 
vendor-crypto/openssl/dist/doc/crypto/d2i_PrivateKey.pod
  head/crypto/openssl/ssl/bad_dtls_test.c
 - copied unchanged from r306189, 
vendor-crypto/openssl/dist/ssl/bad_dtls_test.c
  head/crypto/openssl/ssl/dtlstest.c
 - copied unchanged from r306189, vendor-crypto/openssl/dist/ssl/dtlstest.c
  head/secure/lib/libcrypto/man/d2i_PrivateKey.3   (contents, props changed)
Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/CONTRIBUTING
  head/crypto/openssl/Configure
  head/crypto/openssl/Makefile
  head/crypto/openssl/Makefile.org
  head/crypto/openssl/Makefile.shared
  head/crypto/openssl/NEWS
  head/crypto/openssl/README
  head/crypto/openssl/apps/CA.pl
  head/crypto/openssl/apps/CA.pl.in
  head/crypto/openssl/apps/apps.c
  head/crypto/openssl/apps/apps.h
  head/crypto/openssl/apps/ca.c
  head/crypto/openssl/apps/dgst.c
  head/crypto/openssl/apps/enc.c
  head/crypto/openssl/apps/passwd.c
  head/crypto/openssl/apps/pkcs12.c
  head/crypto/openssl/apps/req.c
  head/crypto/openssl/apps/s_apps.h
  head/crypto/openssl/apps/s_cb.c
  head/crypto/openssl/apps/s_client.c
  head/crypto/openssl/apps/s_server.c
  head/crypto/openssl/apps/speed.c
  head/crypto/openssl/apps/srp.c
  head/crypto/openssl/apps/verify.c
  head/crypto/openssl/apps/x509.c
  head/crypto/openssl/crypto/LPdir_unix.c
  head/crypto/openssl/crypto/aes/asm/bsaes-armv7.pl
  head/crypto/openssl/crypto/asn1/a_bytes.c
  head/crypto/openssl/crypto/asn1/a_object.c
  head/crypto/openssl/crypto/asn1/a_set.c
  head/crypto/openssl/crypto/asn1/a_strex.c
  head/crypto/openssl/crypto/asn1/a_strnid.c
  head/crypto/openssl/crypto/asn1/ameth_lib.c
  head/crypto/openssl/crypto/asn1/asn1_lib.c
  head/crypto/openssl/crypto/asn1/asn_mime.c
  head/crypto/openssl/crypto/asn1/bio_asn1.c
  head/crypto/openssl/crypto/asn1/bio_ndef.c
  head/crypto/openssl/crypto/asn1/charmap.pl
  head/crypto/openssl/crypto/asn1/d2i_pr.c
  head/crypto/openssl/crypto/asn1/f_enum.c
  head/crypto/openssl/crypto/asn1/f_int.c
  head/crypto/openssl/crypto/asn1/f_string.c
  head/crypto/openssl/crypto/asn1/i2d_pr.c
  head/crypto/openssl/crypto/asn1/p5_pbe.c
  head/crypto/openssl/crypto/asn1/p5_pbev2.c
  head/crypto/openssl/crypto/asn1/t_req.c
  head/crypto/openssl/crypto/asn1/tasn_dec.c
  head/crypto/openssl/crypto/asn1/tasn_enc.c
  head/crypto/openssl/crypto/asn1/tasn_prn.c
  head/crypto/openssl/crypto/asn1/tasn_utl.c
  head/crypto/openssl/crypto/asn1/x_bignum.c
  head/crypto/openssl/crypto/asn1/x_name.c
  head/crypto/openssl/crypto/asn1/x_x509.c
  head/crypto/openssl/crypto/bio/b_print.c
  head/crypto/openssl/crypto/bio/bf_nbio.c
  head/crypto/openssl/crypto/bio/bio.h
  head/crypto/openssl/crypto/bio/bss_bio.c
  head/crypto/openssl/crypto/bio/bss_file.c
  head/crypto/openssl/crypto/bio/bss_rtcp.c
  head/crypto/openssl/crypto/bn/asm/x86-mont.pl
  head/crypto/openssl/crypto/bn/asm/x86_64-gcc.c
  head/crypto/openssl/crypto/bn/asm/x86_64-mont.pl
  head/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
  head/crypto/openssl/crypto/bn/bn.h
  head/crypto/openssl/crypto/bn/bn_div.c
  head/crypto/openssl/crypto/bn/bn_lib.c
  head/crypto/openssl/crypto/bn/bn_print.c
  head/crypto/openssl/crypto/bn/bn_rand.c
  head/crypto/openssl/crypto/bn/bn_word.c
  head/crypto/openssl/crypto/bn/bntest.c
  head/crypto/openssl/crypto/cms/cms_enc.c
  head/crypto/openssl/crypto/cms/cms_ess.c
  head/crypto/openssl/crypto/cms/cms_lib.c
  head/crypto/openssl/crypto/cms/cms_pwri.c
  head/crypto/openssl/crypto/comp/comp.h
  head/crypto/openssl/crypto/conf/conf_def.h
  head/crypto/openssl/crypto/conf/conf_mod.c
  head/crypto/openssl/crypto/conf/keysets.pl
  head/crypto/openssl/crypto/des/asm/dest4-sparcv9.pl
  head/crypto/openssl/crypto/des/des.c
  head/crypto/openssl/crypto/des/enc_writ.c
  head/crypto/openssl/crypto/dh/dh_ameth.c
  head/crypto/openssl/crypto/dsa/dsa_ameth.c
  head/crypto/openssl/crypto/dsa/dsa_gen.c
  head/crypto/openssl/crypto/dsa/dsa_ossl.c
  head/crypto/openssl/crypto/ec/Makefile
  head/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl
  head/crypto/openssl/crypto/ec/ec_ameth.c
  head/crypto/openssl/crypto/ec/ec_key.c
  head/crypto/openssl/crypto/ec/ecp_nistz256.c
  head/crypto/openssl/crypto/engine/eng_cryptodev.c
  head/crypto/openssl/crypto/evp/bio_enc.c
  head/crypto/openssl/crypto/evp/bio_ok.c
  head/crypto/openssl/crypto/evp/c_all.c
  head/crypto/openssl/crypto/evp/digest.c
  head/crypto/openssl/crypto/evp/e_rc4_hmac_md5.c
  head/crypto/openssl/crypto/evp/e_seed.c
  head/crypto/openssl/crypto/evp/evp_enc.c
  head/crypto/openssl/crypto/evp/evp_test.c
  head/crypto/openssl/crypto/evp/openbsd_hw.c
  head/crypto/openssl/crypto/evp/p_lib.c
  head/crypto/openssl/crypto/evp/pmeth_gn.c
  head/crypto/openssl/crypto/evp/pmeth_lib.c
  

Re: svn commit: r306162 - in head/sys/arm: arm include

2016-09-22 Thread Ed Schouten
Hi Kostik,

2016-09-22 11:28 GMT+02:00 Konstantin Belousov :
> What do you mean about 'possibility to switch between TLS areas in
> usermode' ? On x86, kernel switches %fs/%gs bases on the context
> switches. There is, indeed, a way to turn off this functionality, but it
> is somewhat unobvious, I have to admit.

On x86 I've solved this by not letting apps have ownership over
%fs/%gs. Instead, they simply assume that they point to some valid
piece of memory. They can only use %fs:0. That way we now effectively
have the ability to adjust TLS from userspace on all architectures
freely.

This feature is already used extensively by the userspace emulator,
where you can run CloudABI executables on unmodified operating
systems. You can even run an emulator inside of an emulator inside of
an emulator. Not useful, but a good demonstration/test.

Another thing this could be useful for is that it allows us to
implement something like a simple truss(1) that doesn't depend on
kernel-level tracing facilities, but merely captures system call
invocations inside the process itself.

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r306188 - head/tests/sys/geom/class/eli

2016-09-22 Thread Ruslan Bukin
Author: br
Date: Thu Sep 22 12:53:11 2016
New Revision: 306188
URL: https://svnweb.freebsd.org/changeset/base/306188

Log:
  Use bsdlabel as we don't have hardlink disklabel -> bsdlabel
  on some platforms.
  
  Reviewed by:  ngie
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D7968

Modified:
  head/tests/sys/geom/class/eli/resize_test.sh

Modified: head/tests/sys/geom/class/eli/resize_test.sh
==
--- head/tests/sys/geom/class/eli/resize_test.shThu Sep 22 12:48:01 
2016(r306187)
+++ head/tests/sys/geom/class/eli/resize_test.shThu Sep 22 12:53:11 
2016(r306188)
@@ -18,7 +18,7 @@ setsize() {
 {
echo a: $(($partszMB * $BLKS_PER_MB)) 0 4.2BSD 1024 8192
echo c: $(($unitszMB * $BLKS_PER_MB)) 0 unused 0 0
-} | disklabel -R $md /dev/stdin
+} | bsdlabel -R $md /dev/stdin
 }
 
 # Initialise
___
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: r306187 - head/sys/mips/mips

2016-09-22 Thread Ruslan Bukin
Author: br
Date: Thu Sep 22 12:48:01 2016
New Revision: 306187
URL: https://svnweb.freebsd.org/changeset/base/306187

Log:
  Set the standard freebsd brand note for ELF binaries on MIPS,
  so binaries now get correct osreldate.
  
  Reviewed by:  jhb
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D7899

Modified:
  head/sys/mips/mips/elf_machdep.c
  head/sys/mips/mips/freebsd32_machdep.c

Modified: head/sys/mips/mips/elf_machdep.c
==
--- head/sys/mips/mips/elf_machdep.cThu Sep 22 12:41:53 2016
(r306186)
+++ head/sys/mips/mips/elf_machdep.cThu Sep 22 12:48:01 2016
(r306187)
@@ -92,7 +92,8 @@ static Elf64_Brandinfo freebsd_brand_inf
.interp_path= "/libexec/ld-elf.so.1",
.sysvec = _freebsd_sysvec,
.interp_newpath = NULL,
-   .flags  = 0
+   .brand_note = _freebsd_brandnote,
+   .flags  = BI_BRAND_NOTE
 };
 
 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY,
@@ -147,7 +148,8 @@ static Elf32_Brandinfo freebsd_brand_inf
.interp_path= "/libexec/ld-elf.so.1",
.sysvec = _freebsd_sysvec,
.interp_newpath = NULL,
-   .flags  = 0
+   .brand_note = _freebsd_brandnote,
+   .flags  = BI_BRAND_NOTE
 };
 
 SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,

Modified: head/sys/mips/mips/freebsd32_machdep.c
==
--- head/sys/mips/mips/freebsd32_machdep.c  Thu Sep 22 12:41:53 2016
(r306186)
+++ head/sys/mips/mips/freebsd32_machdep.c  Thu Sep 22 12:48:01 2016
(r306187)
@@ -117,7 +117,8 @@ static Elf32_Brandinfo freebsd_brand_inf
.interp_path= "/libexec/ld-elf.so.1",
.sysvec = _freebsd_sysvec,
.interp_newpath = "/libexec/ld-elf32.so.1",
-   .flags  = 0
+   .brand_note = _freebsd_brandnote,
+   .flags  = BI_BRAND_NOTE
 };
 
 SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
___
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: r306186 - head/sys/kern

2016-09-22 Thread Ruslan Bukin
Author: br
Date: Thu Sep 22 12:41:53 2016
New Revision: 306186
URL: https://svnweb.freebsd.org/changeset/base/306186

Log:
  Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
  
  sooptcopyin() checks if size of data provided by user is <= than we can
  accept, else it strips down the size. On bigendian platforms we have to
  move pointer as well so we copy the actual data.
  
  Reviewed by:  gnn
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D7980

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Thu Sep 22 12:08:26 2016(r306185)
+++ head/sys/kern/uipc_socket.c Thu Sep 22 12:41:53 2016(r306186)
@@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void *
 */
if ((valsize = sopt->sopt_valsize) < minlen)
return EINVAL;
-   if (valsize > len)
+   if (valsize > len) {
+#if _BYTE_ORDER == _BIG_ENDIAN
+   sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + (valsize 
- len));
+#endif
sopt->sopt_valsize = valsize = len;
+   }
 
if (sopt->sopt_td != NULL)
return (copyin(sopt->sopt_val, buf, valsize));
___
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: r306185 - in head: share/man/man4 sys/modules sys/modules/cloudabi32

2016-09-22 Thread Ed Schouten
Author: ed
Date: Thu Sep 22 12:08:26 2016
New Revision: 306185
URL: https://svnweb.freebsd.org/changeset/base/306185

Log:
  Make the cloudabi32 kernel module available on ARMv6.
  
  Now that all of the necessary bits for ARMv6 support for CloudABI have
  been checked in, let's hook the kernel module up to the build and
  document its existence.

Modified:
  head/share/man/man4/cloudabi.4
  head/sys/modules/Makefile
  head/sys/modules/cloudabi32/Makefile

Modified: head/share/man/man4/cloudabi.4
==
--- head/share/man/man4/cloudabi.4  Thu Sep 22 11:54:20 2016
(r306184)
+++ head/share/man/man4/cloudabi.4  Thu Sep 22 12:08:26 2016
(r306185)
@@ -22,7 +22,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd August 24, 2016
+.Dd September 22, 2016
 .Dt CLOUDABI 4
 .Os
 .Sh NAME
@@ -84,7 +84,7 @@ module can be loaded on any architecture
 .Fx ,
 the
 .Nm cloudabi32
-module is only available on i386 and amd64.
+module is only available on amd64, armv6 and i386.
 The same holds for the
 .Nm cloudabi64
 module,

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Thu Sep 22 11:54:20 2016(r306184)
+++ head/sys/modules/Makefile   Thu Sep 22 12:08:26 2016(r306185)
@@ -768,7 +768,8 @@ _epic=  epic
 _igb=  igb
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "armv6" || \
+ ${MACHINE_CPUARCH} == "i386")
 _cloudabi32=   cloudabi32
 .endif
 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"

Modified: head/sys/modules/cloudabi32/Makefile
==
--- head/sys/modules/cloudabi32/MakefileThu Sep 22 11:54:20 2016
(r306184)
+++ head/sys/modules/cloudabi32/MakefileThu Sep 22 12:08:26 2016
(r306185)
@@ -14,14 +14,18 @@ SRCS=   cloudabi32_fd.c cloudabi32_module.
 OBJS=  cloudabi32_vdso_blob.o
 CLEANFILES=cloudabi32_vdso.o
 
-.if ${MACHINE_CPUARCH} == "i386"
-VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686.S
-OUTPUT_TARGET=elf32-i386-freebsd
-BINARY_ARCHITECTURE=aarch32
-.elif ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64"
 VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S
 OUTPUT_TARGET=elf64-x86-64-freebsd
 BINARY_ARCHITECTURE=i386
+.elif ${MACHINE_ARCH} == "armv6"
+VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_armv6.S
+OUTPUT_TARGET=elf32-littlearm
+BINARY_ARCHITECTURE=arm
+.elif ${MACHINE_CPUARCH} == "i386"
+VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686.S
+OUTPUT_TARGET=elf32-i386-freebsd
+BINARY_ARCHITECTURE=i386
 .endif
 
 cloudabi32_vdso.o: ${VDSO_SRCS}
___
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: r306184 - head/sys/kern

2016-09-22 Thread Mariusz Zaborski
Author: oshogbo
Date: Thu Sep 22 11:54:20 2016
New Revision: 306184
URL: https://svnweb.freebsd.org/changeset/base/306184

Log:
  fd: simplify fgetvp_rights by using fget_cap_locked
  
  Reviewed by:  mjg

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cThu Sep 22 10:58:19 2016
(r306183)
+++ head/sys/kern/kern_descrip.cThu Sep 22 11:54:20 2016
(r306184)
@@ -2781,30 +2781,31 @@ fgetvp_rights(struct thread *td, int fd,
 struct filecaps *havecaps, struct vnode **vpp)
 {
struct filedesc *fdp;
+   struct filecaps caps;
struct file *fp;
-#ifdef CAPABILITIES
int error;
-#endif
 
fdp = td->td_proc->p_fd;
-   fp = fget_locked(fdp, fd);
-   if (fp == NULL || fp->f_ops == )
-   return (EBADF);
-
-#ifdef CAPABILITIES
-   error = cap_check(cap_rights(fdp, fd), needrightsp);
+   error = fget_cap_locked(fdp, fd, needrightsp, , );
if (error != 0)
return (error);
-#endif
-
-   if (fp->f_vnode == NULL)
-   return (EINVAL);
+   if (fp->f_ops == ) {
+   error = EBADF;
+   goto out;
+   }
+   if (fp->f_vnode == NULL) {
+   error = EINVAL;
+   goto out;
+   }
 
+   *havecaps = caps;
*vpp = fp->f_vnode;
vref(*vpp);
-   filecaps_copy(>fd_ofiles[fd].fde_caps, havecaps, true);
 
return (0);
+out:
+   filecaps_free();
+   return (error);
 }
 
 int
___
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: r306174 - in head/sys: compat/cloudabi compat/linux kern netinet sys

2016-09-22 Thread Mariusz Zaborski
Author: oshogbo
Date: Thu Sep 22 09:58:46 2016
New Revision: 306174
URL: https://svnweb.freebsd.org/changeset/base/306174

Log:
  capsicum: propagate rights on accept(2)
  
  Descriptor returned by accept(2) should inherits capabilities rights from
  the listening socket.
  
  PR:   201052
  Reviewed by:  emaste, jonathan
  Discussed with:   many
  Differential Revision:https://reviews.freebsd.org/D7724

Modified:
  head/sys/compat/cloudabi/cloudabi_sock.c
  head/sys/compat/linux/linux_socket.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/uipc_syscalls.c
  head/sys/netinet/sctp_syscalls.c
  head/sys/sys/socketvar.h

Modified: head/sys/compat/cloudabi/cloudabi_sock.c
==
--- head/sys/compat/cloudabi/cloudabi_sock.cThu Sep 22 09:33:22 2016
(r306173)
+++ head/sys/compat/cloudabi/cloudabi_sock.cThu Sep 22 09:58:46 2016
(r306174)
@@ -210,7 +210,7 @@ cloudabi_sys_sock_stat_get(struct thread
int error;
 
error = getsock_cap(td, uap->sock, cap_rights_init(,
-   CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL);
+   CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), , NULL, NULL);
if (error != 0)
return (error);
so = fp->f_data;

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cThu Sep 22 09:33:22 2016
(r306173)
+++ head/sys/compat/linux/linux_socket.cThu Sep 22 09:58:46 2016
(r306174)
@@ -855,7 +855,7 @@ linux_accept_common(struct thread *td, i
if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
return (EINVAL);
if (error == EINVAL) {
-   error1 = getsock_cap(td, s, , , NULL);
+   error1 = getsock_cap(td, s, , , NULL, NULL);
if (error1 != 0)
return (error1);
so = fp->f_data;

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Thu Sep 22 09:33:22 2016
(r306173)
+++ head/sys/kern/kern_sendfile.c   Thu Sep 22 09:58:46 2016
(r306174)
@@ -502,7 +502,7 @@ sendfile_getsock(struct thread *td, int 
 * The socket must be a stream socket and connected.
 */
error = getsock_cap(td, s, cap_rights_init(, CAP_SEND),
-   sock_fp, NULL);
+   sock_fp, NULL, NULL);
if (error != 0)
return (error);
*so = (*sock_fp)->f_data;

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Thu Sep 22 09:33:22 2016
(r306173)
+++ head/sys/kern/uipc_syscalls.c   Thu Sep 22 09:58:46 2016
(r306174)
@@ -89,20 +89,23 @@ static int sockargs(struct mbuf **, char
 /*
  * Convert a user file descriptor to a kernel file entry and check if required
  * capability rights are present.
+ * If required copy of current set of capability rights is returned.
  * A reference on the file entry is held upon returning.
  */
 int
 getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
-struct file **fpp, u_int *fflagp)
+struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
 {
struct file *fp;
int error;
 
-   error = fget_unlocked(td->td_proc->p_fd, fd, rightsp, , NULL);
+   error = fget_cap(td, fd, rightsp, , havecapsp);
if (error != 0)
return (error);
if (fp->f_type != DTYPE_SOCKET) {
fdrop(fp, td);
+   if (havecapsp != NULL)
+   filecaps_free(havecapsp);
return (ENOTSOCK);
}
if (fflagp != NULL)
@@ -188,7 +191,7 @@ kern_bindat(struct thread *td, int dirfd
AUDIT_ARG_FD(fd);
AUDIT_ARG_SOCKADDR(td, dirfd, sa);
error = getsock_cap(td, fd, cap_rights_init(, CAP_BIND),
-   , NULL);
+   , NULL, NULL);
if (error != 0)
return (error);
so = fp->f_data;
@@ -235,7 +238,7 @@ sys_listen(struct thread *td, struct lis
 
AUDIT_ARG_FD(uap->s);
error = getsock_cap(td, uap->s, cap_rights_init(, CAP_LISTEN),
-   , NULL);
+   , NULL, NULL);
if (error == 0) {
so = fp->f_data;
 #ifdef MAC
@@ -308,6 +311,7 @@ kern_accept4(struct thread *td, int s, s
struct file *headfp, *nfp = NULL;
struct sockaddr *sa = NULL;
struct socket *head, *so;
+   struct filecaps fcaps;
cap_rights_t rights;
u_int fflag;
pid_t pgid;
@@ -318,7 +322,7 @@ kern_accept4(struct thread *td, int s, s
 
AUDIT_ARG_FD(s);
error = 

svn commit: r306173 - head/sys/dev/usb

2016-09-22 Thread Kevin Lo
Author: kevlo
Date: Thu Sep 22 09:33:22 2016
New Revision: 306173
URL: https://svnweb.freebsd.org/changeset/base/306173

Log:
  Add TP-Link Archer T4U.
  It will be used by the updated rtwn(4) / urtwn(4) driver.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Sep 22 09:14:04 2016(r306172)
+++ head/sys/dev/usb/usbdevsThu Sep 22 09:33:22 2016(r306173)
@@ -739,6 +739,7 @@ vendor VIALABS  0x2109  VIA Labs
 vendor ERICSSON0x2282  Ericsson
 vendor MOTOROLA2   0x22b8  Motorola
 vendor WETELECOM   0x22de  WeTelecom
+vendor TPLINK  0x2357  TP-Link
 vendor WESTMOUNTAIN0x2405  West Mountain Radio
 vendor TRIPPLITE   0x2478  Tripp-Lite
 vendor HIROSE  0x2631  Hirose Electric
@@ -4472,6 +4473,9 @@ product TOSHIBA G450  0x0d45  G450 modem
 product TOSHIBA HSDPA  0x1302  G450 modem
 product TOSHIBA TRANSMEMORY0x6545  USB ThumbDrive
 
+/* TP-Link products */
+product TPLINK T4U 0x0101  Archer T4U
+
 /* Trek Technology products */
 product TREK THUMBDRIVE0x  ThumbDrive
 product TREK MEMKEY0x  IBM USB Memory Key
___
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: r306162 - in head/sys/arm: arm include

2016-09-22 Thread Konstantin Belousov
On Thu, Sep 22, 2016 at 08:15:00AM +, Ed Schouten wrote:
> Author: ed
> Date: Thu Sep 22 08:14:59 2016
> New Revision: 306162
> URL: https://svnweb.freebsd.org/changeset/base/306162
> 
> Log:
>   Make it possible to safely use TPIDRURW from userspace.
>   
>   On amd64, arm64 and i386, we have the possibility to switch between TLS
>   areas in userspace. The nice thing about this is that it makes it easier
>   to do light-weight threading, if we ever feel like doing that. On armv6,
>   let's go into the same direction by making it possible to safely use the
>   TPIDRURW register, which is intended for this purpose.

What do you mean about 'possibility to switch between TLS areas in
usermode' ? On x86, kernel switches %fs/%gs bases on the context
switches. There is, indeed, a way to turn off this functionality, but it
is somewhat unobvious, I have to admit.

E.g. on Ivy+, RDFSBASE/RDGSBASE work.  WRFSBASE/WRGSBASE are enabled,
but they are de-facto not functional, since next context switch overrides
the base, in default setup.
___
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: r306162 - in head/sys/arm: arm include

2016-09-22 Thread Ed Schouten
Author: ed
Date: Thu Sep 22 08:14:59 2016
New Revision: 306162
URL: https://svnweb.freebsd.org/changeset/base/306162

Log:
  Make it possible to safely use TPIDRURW from userspace.
  
  On amd64, arm64 and i386, we have the possibility to switch between TLS
  areas in userspace. The nice thing about this is that it makes it easier
  to do light-weight threading, if we ever feel like doing that. On armv6,
  let's go into the same direction by making it possible to safely use the
  TPIDRURW register, which is intended for this purpose.
  
  Clean up the ARMv6 code to remove md_tp entirely. Simply add a dedicated
  field to the PCB to hold the value of TPIDRURW across context switches,
  like we do for any other register. As userspace currently uses the
  read-only TPIDRURO register, simply ensure that we keep both values in
  sync where possible. The system calls for modifying the read-only
  register will simply write the intended value into both registers, so
  that it lazily ends up in the PCB during the next context switch.
  
  Reviewed by:  https://reviews.freebsd.org/D7951
  Approved by:  andrew
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D7951

Modified:
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/swtch-v6.S
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/include/frame.h
  head/sys/arm/include/pcpu.h
  head/sys/arm/include/proc.h

Modified: head/sys/arm/arm/genassym.c
==
--- head/sys/arm/arm/genassym.c Thu Sep 22 07:55:07 2016(r306161)
+++ head/sys/arm/arm/genassym.c Thu Sep 22 08:14:59 2016(r306162)
@@ -81,6 +81,9 @@ ASSYM(PCB_R12, offsetof(struct pcb, pcb_
 ASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp));
 ASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr));
 ASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc));
+#if __ARM_ARCH >= 6
+ASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw));
+#endif
 
 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
@@ -100,8 +103,8 @@ ASSYM(TD_FLAGS, offsetof(struct thread, 
 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
 ASSYM(TD_MD, offsetof(struct thread, td_md));
 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
-ASSYM(MD_TP, offsetof(struct mdthread, md_tp));
 #if __ARM_ARCH < 6
+ASSYM(MD_TP, offsetof(struct mdthread, md_tp));
 ASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start));
 ASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end));
 #endif

Modified: head/sys/arm/arm/swtch-v6.S
==
--- head/sys/arm/arm/swtch-v6.S Thu Sep 22 07:55:07 2016(r306161)
+++ head/sys/arm/arm/swtch-v6.S Thu Sep 22 08:14:59 2016(r306162)
@@ -291,6 +291,8 @@ ENTRY(cpu_switch)
ldr r3, [r0, #(TD_PCB)]
add r3, #(PCB_R4)
stmia   r3, {r4-r12, sp, lr, pc}
+   mrc CP15_TPIDRURW(r4)
+   str r4, [r3, #(PCB_TPIDRURW - PCB_R4)]
 
 #ifdef INVARIANTS
cmp r1, #0  /* new thread? */
@@ -437,9 +439,6 @@ sw1:
cmp r3, r6
beq 1b
 #endif
-   /* Set the new tls */
-   ldr r0, [r11, #(TD_MD + MD_TP)]
-   mcr CP15_TPIDRURO(r0)   /* write tls thread reg 2 */
 
/* We have a new curthread now so make a note it */
str r11, [r8, #PC_CURTHREAD]
@@ -452,7 +451,14 @@ sw1:
 * Restore all saved registers and return. Note that some saved
 * registers can be changed when either cpu_fork(), cpu_copy_thread(),
 * cpu_fork_kthread_handler(), or makectx() was called.
-*/
+*
+* The value of TPIDRURW is also written into TPIDRURO, as
+* userspace still uses TPIDRURO, modifying it through
+* sysarch(ARM_SET_TP, addr).
+*/
+   ldr r3, [r7, #PCB_TPIDRURW]
+   mcr CP15_TPIDRURW(r3)   /* write tls thread reg 2 */
+   mcr CP15_TPIDRURO(r3)   /* write tls thread reg 3 */
add r3, r7, #PCB_R4
ldmia   r3, {r4-r12, sp, pc}
 

Modified: head/sys/arm/arm/sys_machdep.c
==
--- head/sys/arm/arm/sys_machdep.c  Thu Sep 22 07:55:07 2016
(r306161)
+++ head/sys/arm/arm/sys_machdep.c  Thu Sep 22 08:14:59 2016
(r306162)
@@ -166,10 +166,10 @@ static int
 arm32_set_tp(struct thread *td, void *args)
 {
 
-   td->td_md.md_tp = (register_t)args;
 #if __ARM_ARCH >= 6
set_tls(args);
 #else
+   td->td_md.md_tp = (register_t)args;
*(register_t *)ARM_TP_ADDRESS = (register_t)args;
 #endif
return (0);
@@ -180,7 +180,7 @@ arm32_get_tp(struct thread *td, void *ar
 {
 
 #if __ARM_ARCH >= 6
-   td->td_retval[0] = td->td_md.md_tp;
+   td->td_retval[0] = (register_t)get_tls();
 #else
td->td_retval[0] = *(register_t 

svn commit: r306161 - head/usr.sbin/diskinfo

2016-09-22 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Sep 22 07:55:07 2016
New Revision: 306161
URL: https://svnweb.freebsd.org/changeset/base/306161

Log:
  Small tweaks to the diskinfo(8) manual page, to make it more consistent
  with others.
  
  MFC after:1 month

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

Modified: head/usr.sbin/diskinfo/diskinfo.8
==
--- head/usr.sbin/diskinfo/diskinfo.8   Thu Sep 22 07:33:43 2016
(r306160)
+++ head/usr.sbin/diskinfo/diskinfo.8   Thu Sep 22 07:55:07 2016
(r306161)
@@ -44,35 +44,34 @@ The
 utility prints out information about a disk device,
 and optionally runs a naive performance test on the device.
 .Pp
+The following options are available:
+.Bl -tag -width ".Fl v"
+.It Fl v
+Print fields one per line with a descriptive comment.
+.It Fl c
+Perform a simple measurement of the I/O read command overhead.
+.It Fl i
+Perform a simple IOPS benchmark.
+.It Fl t
+Perform a simple and rather naive benchmark of the disks seek
+and transfer performance.
+.El
+.Pp
 If given no arguments, the output will be a single line per specified device
 with the following fields: device name, sectorsize, media size in bytes,
 media size in sectors, stripe size, stripe offset, firmware cylinders,
 firmware heads, and firmware sectors.
 The last three fields are only present if the information is available.
-.Pp
-If given the
-.Fl v
-option, the fields will be printed one per line with a descriptive comment.
-.Pp
-The
-.Fl c
-option triggers a simple measurement of the I/O read command overhead.
-.Pp
-The
-.Fl i
-option triggers a simple IOPS benchmark.
-.Pp
-The
-.Fl t
-option triggers a simple and rather naive benchmark of the disks seek
-and transfer performance.
 .Sh HISTORY
 The
 .Nm
 command appeared in
 .Fx 5.1 .
 .Sh AUTHORS
-.An Poul-Henning Kamp
+The
+.Nm
+utility was written by
+.An Poul-Henning Kamp Aq Mt p...@freebsd.org .
 .Sh BUGS
 There are in order of increasing severity: lies,
 damn lies, statistics, and computer benchmarks.
___
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: r306160 - head/usr.sbin/diskinfo

2016-09-22 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Sep 22 07:33:43 2016
New Revision: 306160
URL: https://svnweb.freebsd.org/changeset/base/306160

Log:
  Add "diskinfo -i", a simple aio-based IOPS benchmark.
  
  MFC after:1 month

Modified:
  head/usr.sbin/diskinfo/diskinfo.8
  head/usr.sbin/diskinfo/diskinfo.c

Modified: head/usr.sbin/diskinfo/diskinfo.8
==
--- head/usr.sbin/diskinfo/diskinfo.8   Thu Sep 22 06:24:40 2016
(r306159)
+++ head/usr.sbin/diskinfo/diskinfo.8   Thu Sep 22 07:33:43 2016
(r306160)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 9, 2004
+.Dd September 22, 2016
 .Dt DISKINFO 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nd get information about disk device
 .Sh SYNOPSIS
 .Nm
-.Op Fl ctv
+.Op Fl citv
 .Ar disk ...
 .Sh DESCRIPTION
 The
@@ -59,6 +59,10 @@ The
 option triggers a simple measurement of the I/O read command overhead.
 .Pp
 The
+.Fl i
+option triggers a simple IOPS benchmark.
+.Pp
+The
 .Fl t
 option triggers a simple and rather naive benchmark of the disks seek
 and transfer performance.

Modified: head/usr.sbin/diskinfo/diskinfo.c
==
--- head/usr.sbin/diskinfo/diskinfo.c   Thu Sep 22 06:24:40 2016
(r306159)
+++ head/usr.sbin/diskinfo/diskinfo.c   Thu Sep 22 07:33:43 2016
(r306160)
@@ -40,22 +40,26 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#defineNAIO128
+
 static void
 usage(void)
 {
-   fprintf(stderr, "usage: diskinfo [-ctv] disk ...\n");
+   fprintf(stderr, "usage: diskinfo [-citv] disk ...\n");
exit (1);
 }
 
-static int opt_c, opt_t, opt_v;
+static int opt_c, opt_i, opt_t, opt_v;
 
 static void speeddisk(int fd, off_t mediasize, u_int sectorsize);
 static void commandtime(int fd, off_t mediasize, u_int sectorsize);
+static void iopsbench(int fd, off_t mediasize, u_int sectorsize);
 static int zonecheck(int fd, uint32_t *zone_mode, char *zone_str,
 size_t zone_str_len);
 
@@ -70,12 +74,16 @@ main(int argc, char **argv)
u_int   sectorsize, fwsectors, fwheads, zoned = 0;
uint32_t zone_mode;
 
-   while ((ch = getopt(argc, argv, "ctv")) != -1) {
+   while ((ch = getopt(argc, argv, "citv")) != -1) {
switch (ch) {
case 'c':
opt_c = 1;
opt_v = 1;
break;
+   case 'i':
+   opt_i = 1;
+   opt_v = 1;
+   break;
case 't':
opt_t = 1;
opt_v = 1;
@@ -188,6 +196,8 @@ main(int argc, char **argv)
commandtime(fd, mediasize, sectorsize);
if (opt_t)
speeddisk(fd, mediasize, sectorsize);
+   if (opt_i)
+   iopsbench(fd, mediasize, sectorsize);
 out:
close(fd);
}
@@ -270,6 +280,16 @@ TR(double count)
 }
 
 static void
+TI(double count)
+{
+   double dt;
+
+   dt = delta_t();
+   printf("%8.0f ops in  %10.6f sec = %8.0f IOPS\n",
+   count, dt, count / dt);
+}
+
+static void
 speeddisk(int fd, off_t mediasize, u_int sectorsize)
 {
int bulk, i;
@@ -418,6 +438,91 @@ commandtime(int fd, off_t mediasize, u_i
return;
 }
 
+static void
+iops(int fd, off_t mediasize, u_int sectorsize)
+{
+   struct aiocb aios[NAIO], *aiop;
+   ssize_t ret;
+   off_t sectorcount;
+   int error, i, queued, completed;
+
+   sectorcount = mediasize / sectorsize;
+
+   for (i = 0; i < NAIO; i++) {
+   aiop = &(aios[i]);
+   bzero(aiop, sizeof(*aiop));
+   aiop->aio_buf = malloc(sectorsize);
+   if (aiop->aio_buf == NULL)
+   err(1, "malloc");
+   }
+
+   T0();
+   for (i = 0; i < NAIO; i++) {
+   aiop = &(aios[i]);
+
+   aiop->aio_fildes = fd;
+   aiop->aio_offset = (random() % (sectorcount)) * sectorsize;
+   aiop->aio_nbytes = sectorsize;
+
+   error = aio_read(aiop);
+   if (error != 0)
+   err(1, "aio_read");
+   }
+
+   queued = i;
+   completed = 0;
+
+   for (;;) {
+   ret = aio_waitcomplete(, NULL);
+   if (ret < 0)
+   err(1, "aio_waitcomplete");
+   if (ret != (ssize_t)sectorsize)
+   errx(1, "short read");
+
+   completed++;
+
+   if (delta_t() < 3.0) {
+   aiop->aio_fildes = fd;
+   aiop->aio_offset = (random() % (sectorcount)) * 
sectorsize;
+   aiop->aio_nbytes = sectorsize;
+
+   error = aio_read(aiop);
+   if (error != 0)
+   

svn commit: r306159 - in head/sys/boot: efi/libefi i386/libi386 ofw/libofw powerpc/kboot powerpc/ps3 uboot/lib

2016-09-22 Thread Stephen J. Kiernan
Author: stevek
Date: Thu Sep 22 06:24:40 2016
New Revision: 306159
URL: https://svnweb.freebsd.org/changeset/base/306159

Log:
  The getsecs() function is implemented in platform- and bootfw-specific
  files and, in a number of these places, there were problems with how they
  were declared.
  
  Some used int return instead of time_t. On some architectures the bit
  width of time_t did not naturally fit into an integer and could lead to
  some unexpected behavior. (For example, 32-bit ARM builds uses a 64-bit
  time_t.)
  
  Make sure the function prototypes always specify void for the argument
  list when they do not have any arguemnts, otherwise some compilers can
  complain about the prototype.
  
  Reported by:  Kevin Zheng
  Reviewed by:  sjg
  Approved by:  sjg (mentor)
  Obtained from:Juniper Networks, Inc.
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D7463

Modified:
  head/sys/boot/efi/libefi/time.c
  head/sys/boot/efi/libefi/time_event.c
  head/sys/boot/i386/libi386/pxe.c
  head/sys/boot/ofw/libofw/ofw_time.c
  head/sys/boot/powerpc/kboot/main.c
  head/sys/boot/powerpc/ps3/main.c
  head/sys/boot/uboot/lib/time.c

Modified: head/sys/boot/efi/libefi/time.c
==
--- head/sys/boot/efi/libefi/time.c Thu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/efi/libefi/time.c Thu Sep 22 06:24:40 2016
(r306159)
@@ -228,7 +228,7 @@ time(time_t *tloc)
 }
 
 time_t
-getsecs()
+getsecs(void)
 {
 return time(0);
 }

Modified: head/sys/boot/efi/libefi/time_event.c
==
--- head/sys/boot/efi/libefi/time_event.c   Thu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/efi/libefi/time_event.c   Thu Sep 22 06:24:40 2016
(r306159)
@@ -76,7 +76,7 @@ time(time_t *tloc)
 }
 
 time_t
-getsecs()
+getsecs(void)
 {
 return time(0);
 }

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cThu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/i386/libi386/pxe.cThu Sep 22 06:24:40 2016
(r306159)
@@ -586,7 +586,7 @@ bangpxe_call(int func)
 
 
 time_t
-getsecs()
+getsecs(void)
 {
time_t n = 0;
time();

Modified: head/sys/boot/ofw/libofw/ofw_time.c
==
--- head/sys/boot/ofw/libofw/ofw_time.c Thu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/ofw/libofw/ofw_time.c Thu Sep 22 06:24:40 2016
(r306159)
@@ -41,8 +41,8 @@ time(time_t *tloc)
return secs;
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
time_t  n = 0;
time();

Modified: head/sys/boot/powerpc/kboot/main.c
==
--- head/sys/boot/powerpc/kboot/main.c  Thu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/powerpc/kboot/main.c  Thu Sep 22 06:24:40 2016
(r306159)
@@ -151,8 +151,8 @@ delay(int usecs)
} while (t < ti + usecs);
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
struct host_timeval tv;
host_gettimeofday(, NULL);

Modified: head/sys/boot/powerpc/ps3/main.c
==
--- head/sys/boot/powerpc/ps3/main.cThu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/powerpc/ps3/main.cThu Sep 22 06:24:40 2016
(r306159)
@@ -179,10 +179,10 @@ delay(int usecs)
tb = mftb();
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
-   return ((mftb() - basetb)*ns_per_tick/10);
+   return ((time_t)((mftb() - basetb)*ns_per_tick/10));
 }
 
 time_t

Modified: head/sys/boot/uboot/lib/time.c
==
--- head/sys/boot/uboot/lib/time.c  Thu Sep 22 04:50:03 2016
(r306158)
+++ head/sys/boot/uboot/lib/time.c  Thu Sep 22 06:24:40 2016
(r306159)
@@ -47,7 +47,7 @@ time(time_t *tloc)
return (secs);
 }
 
-int
+time_t
 getsecs(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"