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

2016-05-22 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 06:52:42 2016
New Revision: 300479
URL: https://svnweb.freebsd.org/changeset/base/300479

Log:
  hyperv/hn: Use hyperv busdma(9) helper.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6444

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

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon May 23 06:35:11 
2016(r300478)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon May 23 06:52:42 
2016(r300479)
@@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include "hv_net_vsc.h"
 #include "hv_rndis.h"
 #include "hv_rndis_filter.h"
@@ -2171,18 +2172,6 @@ hn_check_iplen(const struct mbuf *m, int
 }
 
 static void
-hn_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
-   bus_addr_t *paddr = arg;
-
-   if (error)
-   return;
-
-   KASSERT(nseg == 1, ("too many segments %d!", nseg));
-   *paddr = segs->ds_addr;
-}
-
-static void
 hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
 {
struct sysctl_oid_list *child;
@@ -2472,7 +2461,7 @@ hn_create_tx_ring(struct hn_softc *sc, i
error = bus_dmamap_load(txr->hn_tx_rndis_dtag,
txd->rndis_msg_dmap,
txd->rndis_msg, HN_RNDIS_MSG_LEN,
-   hn_dma_map_paddr, &txd->rndis_msg_paddr,
+   hyperv_dma_map_paddr, &txd->rndis_msg_paddr,
BUS_DMA_NOWAIT);
if (error) {
device_printf(sc->hn_dev,
___
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: r300478 - in head/sys: conf dev/hyperv/include dev/hyperv/vmbus modules/hyperv/vmbus

2016-05-22 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 06:35:11 2016
New Revision: 300478
URL: https://svnweb.freebsd.org/changeset/base/300478

Log:
  hyperv: Add helpers for busdma(9) operation
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6443

Added:
  head/sys/dev/hyperv/include/hyperv_busdma.h   (contents, props changed)
  head/sys/dev/hyperv/vmbus/hyperv_busdma.c   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/vmbus/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Mon May 23 06:13:35 2016(r300477)
+++ head/sys/conf/files.amd64   Mon May 23 06:35:11 2016(r300478)
@@ -277,6 +277,7 @@ dev/hyperv/vmbus/hv_hv.c
optionalhyp
 dev/hyperv/vmbus/hv_et.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hv_vmbus_drv_freebsd.coptional
hyperv
+dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/amd64/hv_vector.S optionalhyperv
 dev/nfe/if_nfe.c   optionalnfe pci
 dev/ntb/if_ntb/if_ntb.coptionalif_ntb

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Mon May 23 06:13:35 2016(r300477)
+++ head/sys/conf/files.i386Mon May 23 06:35:11 2016(r300478)
@@ -252,6 +252,7 @@ dev/hyperv/vmbus/hv_hv.c
optionalhyp
 dev/hyperv/vmbus/hv_et.c   optionalhyperv
 dev/hyperv/vmbus/hv_ring_buffer.c  optionalhyperv
 dev/hyperv/vmbus/hv_vmbus_drv_freebsd.coptional
hyperv
+dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/i386/hv_vector.S  optionalhyperv
 dev/ichwd/ichwd.c  optional ichwd
 dev/if_ndis/if_ndis.c  optional ndis

Added: head/sys/dev/hyperv/include/hyperv_busdma.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/include/hyperv_busdma.h Mon May 23 06:35:11 2016
(r300478)
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2016 Microsoft Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _HYPERV_BUSDMA_H_
+#define _HYPERV_BUSDMA_H_
+
+struct hyperv_dma {
+   bus_addr_t  hv_paddr;
+   bus_dma_tag_t   hv_dtag;
+   bus_dmamap_thv_dmap;
+};
+
+void   hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg,
+   int error);
+void   *hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment,
+   bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma,
+   int flags);
+void   hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr);
+
+#endif /* !_HYPERV_BUSDMA_H_ */

Added: head/sys/dev/hyperv/vmbus/hyperv_busdma.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/vmbus/hyperv_busdma.c   Mon May 23 06:35:11 2016
(r300478)
@@ -0,0 +1,98 @@
+/*-
+ * Copyright (c) 2016 Microsoft Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modificati

svn commit: r300474 - head/sys/dev/siba

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 05:52:47 2016
New Revision: 300474
URL: https://svnweb.freebsd.org/changeset/base/300474

Log:
  [siba] update device ids.
  
  Tested:
  
  * BCM4322 11abgn, STA mode

Modified:
  head/sys/dev/siba/siba_bwn.c

Modified: head/sys/dev/siba/siba_bwn.c
==
--- head/sys/dev/siba/siba_bwn.cMon May 23 05:45:52 2016
(r300473)
+++ head/sys/dev/siba/siba_bwn.cMon May 23 05:52:47 2016
(r300474)
@@ -93,9 +93,9 @@ static const struct siba_dev {
{ PCI_VENDOR_BROADCOM, 0x4324,
  "Broadcom BCM4309 802.11a/b/g Wireless" },
{ PCI_VENDOR_BROADCOM, 0x4325, "Broadcom BCM4306 802.11b/g Wireless" },
-   { PCI_VENDOR_BROADCOM, 0x4328, "Broadcom BCM4321 802.11a/b/g Wireless" 
},
+   { PCI_VENDOR_BROADCOM, 0x4328, "Broadcom BCM4321 802.11a/b/g/n 
Wireless" },
{ PCI_VENDOR_BROADCOM, 0x4329, "Unknown" },
-   { PCI_VENDOR_BROADCOM, 0x432b, "Unknown" }
+   { PCI_VENDOR_BROADCOM, 0x432b, "Broadcom BCM4322 802.11a/b/g/n 
Wireless" }
 };
 
 intsiba_core_attach(struct siba_softc *);
___
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: r300455 - head/sys/dev/hyperv/vmbus

2016-05-22 Thread Sepherosa Ziehau
Author: sephe
Date: Mon May 23 05:11:38 2016
New Revision: 300455
URL: https://svnweb.freebsd.org/changeset/base/300455

Log:
  hyperv: Move guest id setup to early place
  
  And
  - Rework the guest id composition.
  - Nuke useless saved guest_id.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6430

Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 05:11:31 2016
(r300454)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Mon May 23 05:11:38 2016
(r300455)
@@ -50,6 +50,35 @@ __FBSDID("$FreeBSD$");
 
 #defineHYPERV_INTERFACE0x31237648  /* HV#1 */
 
+/*
+ * The guest OS needs to register the guest ID with the hypervisor.
+ * The guest ID is a 64 bit entity and the structure of this ID is
+ * specified in the Hyper-V specification:
+ *
+ * http://msdn.microsoft.com/en-us/library/windows/
+ * hardware/ff542653%28v=vs.85%29.aspx
+ *
+ * While the current guideline does not specify how FreeBSD guest ID(s)
+ * need to be generated, our plan is to publish the guidelines for
+ * FreeBSD and other guest operating systems that currently are hosted
+ * on Hyper-V. The implementation here conforms to this yet
+ * unpublished guidelines.
+ *
+ * Bit(s)
+ * 63- Indicates if the OS is Open Source or not; 1 is Open Source
+ * 62:56 - Os Type: FreeBSD is 0x02
+ * 55:48 - Distro specific identification
+ * 47:16 - FreeBSD kernel version number
+ * 15:0  - Distro specific identification
+ */
+#define HYPERV_GUESTID_OSS (0x1ULL << 63)
+#define HYPERV_GUESTID_FREEBSD (0x02ULL << 56)
+#define HYPERV_GUESTID(id) \
+   (HYPERV_GUESTID_OSS | HYPERV_GUESTID_FREEBSD |  \
+(((uint64_t)(((id) & 0xff) >> 16)) << 48) |\
+(((uint64_t)__FreeBSD_version) << 16) |\
+((uint64_t)((id) & 0x00)))
+
 static u_int hv_get_timecount(struct timecounter *tc);
 
 u_int  hyperv_features;
@@ -143,13 +172,6 @@ hv_vmbus_init(void) 
goto cleanup;
 
/*
-* Write our OS info
-*/
-   uint64_t os_guest_info = HV_FREEBSD_GUEST_ID;
-   wrmsr(HV_X64_MSR_GUEST_OS_ID, os_guest_info);
-   hv_vmbus_g_context.guest_id = os_guest_info;
-
-   /*
 * See if the hypercall page is already set
 */
hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL);
@@ -192,16 +214,13 @@ hv_vmbus_init(void) 
 void
 hv_vmbus_cleanup(void) 
 {
-   hv_vmbus_x64_msr_hypercall_contents hypercall_msr;
+   if (hv_vmbus_g_context.hypercall_page != NULL) {
+   hv_vmbus_x64_msr_hypercall_contents hypercall_msr;
 
-   if (hv_vmbus_g_context.guest_id == HV_FREEBSD_GUEST_ID) {
-   if (hv_vmbus_g_context.hypercall_page != NULL) {
hypercall_msr.as_uint64_t = 0;
-   wrmsr(HV_X64_MSR_HYPERCALL,
-   hypercall_msr.as_uint64_t);
+   wrmsr(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64_t);
free(hv_vmbus_g_context.hypercall_page, M_DEVBUF);
hv_vmbus_g_context.hypercall_page = NULL;
-   }
}
 }
 
@@ -508,6 +527,9 @@ hyperv_init(void *dummy __unused)
return;
}
 
+   /* Write guest id */
+   wrmsr(HV_X64_MSR_GUEST_OS_ID, HYPERV_GUESTID(0));
+
if (hyperv_features & HV_FEATURE_MSR_TIME_REFCNT) {
/* Register virtual timecount */
tc_init(&hv_timecounter);

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 05:11:31 2016
(r300454)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon May 23 05:11:38 2016
(r300455)
@@ -198,7 +198,6 @@ enum {
 #define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t)
 
 typedef struct {
-   uint64_tguest_id;
void*   hypercall_page;
hv_bool_uint8_t syn_ic_initialized;
 
@@ -763,44 +762,6 @@ void   hv_et_intr(struct trapframe*);
 /* Wait for device creation */
 void   vmbus_scan(void);
 
-/*
- * The guest OS needs to register the guest ID with the hypervisor.
- * The guest ID is a 64 bit entity and the structure of this ID is
- * specified in the Hyper-V specification:
- *
- * http://msdn.microsoft.com/en-us/library/windows/
- * hardware/ff542653%28v=vs.85%29.aspx
- *
- * While the current guideline does not specify how FreeBSD guest ID(s)
- * need to be generated, our plan is to publish the guidelines for
- * FreeBSD and other guest operating systems that currently are hosted
- * on Hyper-V. The implementation here conforms to this yet
- * unpublished guidelines.
- *
- *

Re: svn commit: r298946 - head/usr.sbin/bsdinstall/scripts

2016-05-22 Thread Allan Jude
On 2016-05-23 00:49, Allan Jude wrote:
> On 2016-05-02 17:40, Andriy Voskoboinyk wrote:
>> Author: avos
>> Date: Mon May  2 21:40:34 2016
>> New Revision: 298946
>> URL: https://svnweb.freebsd.org/changeset/base/298946
>>
>> Log:
>>   bsdinstall: fix static address assignment for protected wireless networks.
>>   
>>   Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword)
>>   from ifconfig parameters.
>>   
>>   PR:169199
>>
>> Modified:
>>   head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
>>
>> Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
>> ==
>> --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4  Mon May  2 21:23:05 
>> 2016(r298945)
>> +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4  Mon May  2 21:40:34 
>> 2016(r298946)
>> @@ -84,7 +84,7 @@ retval=$?
>>  
>>  if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
>>  . $BSDINSTALL_TMPETC/._rc.conf.net
>> -ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
>> +ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"`
>>  if [ "$defaultrouter" ]; then
>>  route delete -inet default
>>  route add -inet default $defaultrouter
>>
> 
> This breaks static assignment of IP addresses to wired interfaces:
> 
> sed: first RE may not be empty
> 
> 

I wrote this patch for the issue. Unless you see a better way to do it?


-- 
Allan Jude
Index: usr.sbin/bsdinstall/scripts/netconfig_ipv4
===
--- usr.sbin/bsdinstall/scripts/netconfig_ipv4  (revision 300436)
+++ usr.sbin/bsdinstall/scripts/netconfig_ipv4  (working copy)
@@ -84,7 +84,11 @@
 
 if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
. $BSDINSTALL_TMPETC/._rc.conf.net
-   ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"`
+   if [ -n "$2" ]; then
+   ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed 
"s|$2||"`
+   else
+   ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
+   fi
if [ "$defaultrouter" ]; then
route delete -inet default
route add -inet default $defaultrouter
___
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: r298946 - head/usr.sbin/bsdinstall/scripts

2016-05-22 Thread Allan Jude
On 2016-05-02 17:40, Andriy Voskoboinyk wrote:
> Author: avos
> Date: Mon May  2 21:40:34 2016
> New Revision: 298946
> URL: https://svnweb.freebsd.org/changeset/base/298946
> 
> Log:
>   bsdinstall: fix static address assignment for protected wireless networks.
>   
>   Filter out IFCONFIG_PREFIX variable (which may contain WPA keyword)
>   from ifconfig parameters.
>   
>   PR: 169199
> 
> Modified:
>   head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
> 
> Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
> ==
> --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4   Mon May  2 21:23:05 
> 2016(r298945)
> +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4   Mon May  2 21:40:34 
> 2016(r298946)
> @@ -84,7 +84,7 @@ retval=$?
>  
>  if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
>   . $BSDINSTALL_TMPETC/._rc.conf.net
> - ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
> + ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"`
>   if [ "$defaultrouter" ]; then
>   route delete -inet default
>   route add -inet default $defaultrouter
> 

This breaks static assignment of IP addresses to wired interfaces:

sed: first RE may not be empty


-- 
Allan Jude
___
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: r300448 - head/sys/gnu/dev/bwn/phy_n

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 04:17:27 2016
New Revision: 300448
URL: https://svnweb.freebsd.org/changeset/base/300448

Log:
  [bwn] convert another PHY-N workaround to the freebsd bwn format.
  
  These were hidden behind an #ifdef that we weren't setting.
  
  I don't have the hardware in question to check.

Modified:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Mon May 23 04:07:41 
2016(r300447)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Mon May 23 04:17:27 
2016(r300448)
@@ -6635,16 +6635,12 @@ bwn_nphy_op_prepare_structs(struct bwn_m
if (mac->mac_phy.rev >= 2 &&
(siba_sprom_get_bf2_lo(sc->sc_dev) & 
BWN_BFL2_TXPWRCTRL_EN)) {
nphy->txpwrctrl = true;
-#ifdef CONFIG_BWN_SSB
-   if (dev->dev->bus_type == BWN_BUS_SSB &&
-   dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) {
-   struct pci_dev *pdev =
-   dev->dev->sdev->bus->host_pci;
-   if (pdev->device == 0x4328 ||
-   pdev->device == 0x432a)
+   if (bwn_is_bus_siba(mac) &&
+   (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI)) {
+   if ((siba_get_pci_device(sc->sc_dev) == 0x4328) 
||
+   (siba_get_pci_device(sc->sc_dev) == 0x432a))
nphy->pwg_gain_5ghz = true;
}
-#endif
} else if (siba_sprom_get_bf2_lo(sc->sc_dev) & 
BWN_BFL2_5G_PWRGAIN) {
nphy->pwg_gain_5ghz = true;
}
___
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: r300447 - head

2016-05-22 Thread Ian Lepore
Author: ian
Date: Mon May 23 04:07:41 2016
New Revision: 300447
URL: https://svnweb.freebsd.org/changeset/base/300447

Log:
  Add a note on how to update a self-hosted armv6hf system to the entry
  describing the armv6hf->armv6 change.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Mon May 23 03:51:15 2016(r300446)
+++ head/UPDATING   Mon May 23 04:07:41 2016(r300447)
@@ -45,6 +45,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
and packages may fail or need manual intervention to run. New
packages will be needed.
 
+   To update an existing self-hosted armv6hf system, you must add
+   TARGET_ARCH=armv6 on the make command line for both the build 
+   and the install steps.
+
 20160510:
Kernel modules compiled outside of a kernel build now default to
installing to /boot/modules instead of /boot/kernel.  Many kernel
___
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: r300446 - head/sys/dev/nvram2env

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 03:51:15 2016
New Revision: 300446
URL: https://svnweb.freebsd.org/changeset/base/300446

Log:
  [nvram2env] fix nvram2env to scan all of memory, not 1/4th
  
  The variable "size" stores number of words (4bytes). But the loop over
  memory uses size as number of bytes to scan memory. As result it fetches
  only 1/4th of memory.
  
  This patch solves this problem and nvram2env fetches all NVRAM variables.
  
  Test plan:
  
  Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory
  
  * Add "device nvram2env" into kernel configuration
  * Specify hints: base is mandatory (according to nvram2env(4))
  
  hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with
  flags = 0x4)
  
  * Build & load kernel with bootverbose
  
  Actual result: only part of nvram variables are found
  Expected result: all variables are found
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6466

Modified:
  head/sys/dev/nvram2env/nvram2env.c

Modified: head/sys/dev/nvram2env/nvram2env.c
==
--- head/sys/dev/nvram2env/nvram2env.c  Mon May 23 03:47:44 2016
(r300445)
+++ head/sys/dev/nvram2env/nvram2env.c  Mon May 23 03:51:15 2016
(r300446)
@@ -193,10 +193,12 @@ static uint32_t read_4(struct nvram2env_
 static int
 nvram2env_attach(device_t dev)
 {
-   struct nvram2env_softc * sc = device_get_softc(dev);
-   struct nvram * nv;
+   struct nvram2env_softc  *sc;
+   struct nvram*nv;
char *pair, *value, *assign;
-   uint32_t sig, size, i;
+   uint32_t sig, size, i, *tmp;
+
+   sc = device_get_softc(dev);
 
if (sc->bst == 0 || sc->addr == 0)
return (ENXIO);
@@ -217,16 +219,22 @@ nvram2env_attach(device_t dev)
if (sig == sc->sig || (sc->flags & NVRAM_FLAGS_UBOOT))
{
 
-   /* align and shift size to 32bit size*/
+   /* align size to 32bit size*/
size += 3;
-   size >>= 2;
+   size &= ~3;
 
-   nv = malloc(size<<2, M_DEVBUF, M_WAITOK | M_ZERO);
+   nv = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
if (!nv)
return (ENOMEM);
+   /* set tmp pointer to begin of NVRAM */
+   tmp = (uint32_t *) nv;
 
-   for (i = 0; i < size; i ++)
-   ((uint32_t *)nv)[i] = read_4(sc, i<<2);
+   /* use read_4 to swap bytes if it's required */
+   for (i = 0; i < size; i += 4) {
+   *tmp = read_4(sc, i);
+   tmp++;
+   }
+   /* now tmp pointer is end of NVRAM */
 
if (sc->flags & NVRAM_FLAGS_BROADCOM) {
device_printf(dev, "sig = %#x\n",  nv->sig);
@@ -246,49 +254,47 @@ nvram2env_attach(device_t dev)
else
pair = (char*)nv+4;
 
-   for ( ; 
-   (u_int32_t)pair < ((u_int32_t)nv + size - 4); 
-   pair = pair + strlen(pair) + 1 + strlen(value) + 1 ) {
+   /* iterate over buffer till end. tmp points to end of NVRAM */
+   for ( ; pair < (char*)tmp; 
+   pair += strlen(pair) + strlen(value) + 2 ) {
 
-   if (pair && strlen(pair)) {
+   if (!pair || (strlen(pair) == 0))
+   break;
 
-#if 0
-   printf("ENV: %s\n", pair);
-#endif
-   /* hint.nvram.0. */
-   assign = strchr(pair,'=');
-   assign[0] = '\0';
-   value = assign+1;
+   /* hint.nvram.0. */
+   assign = strchr(pair,'=');
+   assign[0] = '\0';
+   value = assign+1;
 #if 1
-   if (bootverbose)
-   printf("ENV: %s=%s\n", pair, value);
+   if (bootverbose)
+   printf("ENV: %s=%s\n", pair, value);
+#else
+   printf("ENV: %s\n", pair);
 #endif
-   kern_setenv(pair, value);
+   kern_setenv(pair, value);
 
-   if (strcasecmp(pair, "WAN_MAC_ADDR") == 0) {
-   /* Alias for MAC address of eth0 */
-   if (bootverbose)
-   printf("ENV: aliasing "
-   "WAN_MAC_ADDR to ethaddr"
-   " = %s\n",  value);
-   kern_setenv("ethaddr", value);
-   }
-

svn commit: r300445 - in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/siba dev/bhnd/soc modules/bhnd/bhndb

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 03:47:44 2016
New Revision: 300445
URL: https://svnweb.freebsd.org/changeset/base/300445

Log:
  [bhnd] Add support for querying the attachment type of the bhnd bus.
  
  This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let
  chipc make a coarse-grained determination as to whether UART, SPI, etc
  drivers ought to be attached, and on fullmac devices, whether a real
  CPU driver ought to be skipped for the ARM core, etc.
  
  Tested:
  
  * BCM4331 (BHND)
  * BCM4312 (SIBA)
  
  Submitted by: Landon Fuller 
  Differential Revision:https://reviews.freebsd.org/D6492

Added:
  head/sys/dev/bhnd/bhndb/bhnd_bhndb.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_types.h
  head/sys/dev/bhnd/bhndb/bhndb.h
  head/sys/dev/bhnd/siba/siba_bhndb.c
  head/sys/dev/bhnd/soc/bhnd_soc.c
  head/sys/modules/bhnd/bhndb/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon May 23 03:46:36 2016(r300444)
+++ head/sys/conf/files Mon May 23 03:47:44 2016(r300445)
@@ -1125,6 +1125,7 @@ dev/bge/if_bge.c  optional bge
 dev/bhnd/bhnd.coptional bhndbus | bhnd
 dev/bhnd/bhnd_subr.c   optional bhndbus | bhnd
 dev/bhnd/bhnd_bus_if.m optional bhndbus | bhnd
+dev/bhnd/bhndb/bhnd_bhndb.coptional bhndbus | bhndb
 dev/bhnd/bhndb/bhndb.c optional bhndbus | bhndb
 dev/bhnd/bhndb/bhndb_bus_if.m  optional bhndbus | bhndb
 dev/bhnd/bhndb/bhndb_hwdata.c  optional bhndbus | bhndb

Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c
==
--- head/sys/dev/bhnd/bcma/bcma_bhndb.c Mon May 23 03:46:36 2016
(r300444)
+++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Mon May 23 03:47:44 2016
(r300445)
@@ -166,20 +166,6 @@ bcma_bhndb_resume_child(device_t dev, de
return (0);
 }
 
-static int
-bcma_bhndb_read_board_info(device_t dev, device_t child,
-struct bhnd_board_info *info)
-{
-   int error;
-
-   /* Initialize with NVRAM-derived values */
-   if ((error = bhnd_bus_generic_read_board_info(dev, child, info)))
-   return (error);
-
-   /* Let the bridge fill in any additional data */
-   return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info));
-}
-
 static device_method_t bcma_bhndb_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, bcma_bhndb_probe),
@@ -189,14 +175,11 @@ static device_method_t bcma_bhndb_method
DEVMETHOD(bus_suspend_child,bcma_bhndb_suspend_child),
DEVMETHOD(bus_resume_child, bcma_bhndb_resume_child),
 
-   /* BHND interface */
-   DEVMETHOD(bhnd_bus_read_board_info, bcma_bhndb_read_board_info),
-
DEVMETHOD_END
 };
 
-DEFINE_CLASS_1(bhnd, bcma_bhndb_driver, bcma_bhndb_methods,
-sizeof(struct bcma_softc), bcma_driver);
+DEFINE_CLASS_2(bhnd, bcma_bhndb_driver, bcma_bhndb_methods,
+sizeof(struct bcma_softc), bhnd_bhndb_driver, bcma_driver);
 
 DRIVER_MODULE(bcma_bhndb, bhndb, bcma_bhndb_driver, bhnd_devclass, NULL, NULL);
  

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hMon May 23 03:46:36 2016(r300444)
+++ head/sys/dev/bhnd/bhnd.hMon May 23 03:47:44 2016(r300445)
@@ -561,6 +561,21 @@ bhnd_get_chipid(device_t dev) {
 };
 
 /**
+ * Return the BHND attachment type of the parent bhnd bus.
+ *
+ * @param dev A bhnd bus child device.
+ *
+ * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter,
+ * such as a WiFi chipset.
+ * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock,
+ * CPU, etc) to a directly attached native host.
+ */
+static inline bhnd_attach_type
+bhnd_get_attach_type (device_t dev) {
+   return (BHND_BUS_GET_ATTACH_TYPE(device_get_parent(dev), dev));
+}
+
+/**
  * Attempt to read the BHND board identification from the bhnd bus.
  *
  * This relies on NVRAM access, and will fail if a valid NVRAM device cannot

Modified: head/sys/dev/bhnd/bhnd_bus_if.m
==
--- head/sys/dev/bhnd/bhnd_bus_if.m Mon May 23 03:46:36 2016
(r300444)
+++ head/sys/dev/bhnd/bhnd_bus_if.m Mon May 23 03:47:44 2016
(r300445)
@@ -55,6 +55,12 @@ CODE {
panic("bhnd_bus_get_chipid unimplemented");
}
 
+   static bhnd_attach_type
+   bhnd_bus_null_get_attach_type(device_t dev, device_t child)
+   {
+   panic("bhnd_bus_get_attach_type unimplemented");
+   }
+
static int
bhnd_bus_nu

svn commit: r300444 - head/sys/dev/ixl

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 03:46:36 2016
New Revision: 300444
URL: https://svnweb.freebsd.org/changeset/base/300444

Log:
  [ixl] fix build for RSS.
  
  Untested.

Modified:
  head/sys/dev/ixl/if_ixl.c

Modified: head/sys/dev/ixl/if_ixl.c
==
--- head/sys/dev/ixl/if_ixl.c   Mon May 23 03:29:43 2016(r300443)
+++ head/sys/dev/ixl/if_ixl.c   Mon May 23 03:46:36 2016(r300444)
@@ -2264,6 +2264,10 @@ ixl_setup_queue_tqs(struct ixl_vsi *vsi)
 {
struct ixl_queue *que = vsi->queues;
device_t dev = vsi->dev;
+#ifdef RSS
+   cpuset_t cpu_mask;
+   int cpu_id;
+#endif
 
/* Create queue tasks and start queue taskqueues */
for (int i = 0; i < vsi->num_queues; i++, que++) {
@@ -2272,6 +2276,7 @@ ixl_setup_queue_tqs(struct ixl_vsi *vsi)
que->tq = taskqueue_create_fast("ixl_que", M_NOWAIT,
taskqueue_thread_enqueue, &que->tq);
 #ifdef RSS
+   cpu_id = rss_getcpu(i % rss_getnumbuckets());
CPU_SETOF(cpu_id, &cpu_mask);
taskqueue_start_threads_cpuset(&que->tq, 1, PI_NET,
&cpu_mask, "%s (bucket %d)",
@@ -2355,9 +2360,6 @@ ixl_setup_queue_msix(struct ixl_vsi *vsi
struct  ixl_queue *que = vsi->queues;
struct  tx_ring  *txr;
int error, rid, vector = 1;
-#ifdef RSS
-   cpuset_t cpu_mask;
-#endif
 
/* Queue interrupt vector numbers start at 1 (adminq intr is 0) */
for (int i = 0; i < vsi->num_queues; i++, vector++, que++) {
___
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: r300443 - head/sys/sys

2016-05-22 Thread Adrian Chadd
Author: adrian
Date: Mon May 23 03:29:43 2016
New Revision: 300443
URL: https://svnweb.freebsd.org/changeset/base/300443

Log:
  [bhnd] Fix DEFINE_CLASS_(2|3) multiple inheritance support.
  
  This diff updates DEFINE_CLASS_2/_3 to support the specification of class
  name separately from the class variable name, bringing them into sync
  with their API documentation, as well as the behavior of DEFINE_CLASS_0/_1.
  
  Nothing in the tree currently uses the _2/_3 variants, and I can't
  find any references to the API outside of commits to the kobj.h
  header itself; given the limitation that currently exists, I'd
  be surprised if they've ever been used.
  
  Submitted by: Landon Fuller 
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D6491

Modified:
  head/sys/sys/kobj.h

Modified: head/sys/sys/kobj.h
==
--- head/sys/sys/kobj.h Mon May 23 01:01:23 2016(r300442)
+++ head/sys/sys/kobj.h Mon May 23 03:29:43 2016(r300443)
@@ -146,13 +146,13 @@ struct kobj_class classvar = {
\
  * DEFINE_CLASS_2(foo, foo_class, foo_methods, sizeof(foo_softc),
  *   bar, baz);
  */
-#define DEFINE_CLASS_2(name, methods, size,\
+#define DEFINE_CLASS_2(name, classvar, methods, size,  \
   base1, base2)\
\
 static kobj_class_t name ## _baseclasses[] =   \
{ &base1,   \
  &base2, NULL };   \
-struct kobj_class name ## _class = {   \
+struct kobj_class classvar = { \
#name, methods, size, name ## _baseclasses  \
 }
 
@@ -162,14 +162,14 @@ struct kobj_class name ## _class = {  
\
  * DEFINE_CLASS_3(foo, foo_class, foo_methods, sizeof(foo_softc),
  *   bar, baz, foobar);
  */
-#define DEFINE_CLASS_3(name, methods, size,\
+#define DEFINE_CLASS_3(name, classvar, methods, size,  \
   base1, base2, base3) \
\
 static kobj_class_t name ## _baseclasses[] =   \
{ &base1,   \
  &base2,   \
  &base3, NULL };   \
-struct kobj_class name ## _class = {   \
+struct kobj_class classvar = { \
#name, methods, size, name ## _baseclasses  \
 }
 
___
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: r300442 - head/bin/sh

2016-05-22 Thread Don Lewis
Author: truckman
Date: Mon May 23 01:01:23 2016
New Revision: 300442
URL: https://svnweb.freebsd.org/changeset/base/300442

Log:
  Hopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh.
  
  Replace the magic constant 127 in the loop interation count with
  "PROMPTLEN - 1".
  
  gethostname() is not guaranteed to NUL terminate the destination
  string if it is too short. Decrease the length passed to gethostname()
  by one, and add a NUL at the end of the buffer to make sure the
  following loop to find the end of the name properly terminates.
  
  The default: case is the likely cause of Coverity CID 1008328.  If
  i is 126 at the top of the loop interation where the default case
  is triggered, i will be incremented to 127 by the default case,
  then incremented to 128 at the top of the loop before being compared
  to 127 (PROMPTLENT - 1) and terminating the loop. Then the NUL
  termination code after the loop will write to ps[128].  Fix by
  checking for overflow before incrementing the index and storing the
  second character in the buffer.
  
  These fixes are not guaranteed to satisfy Coverity. The code that
  increments i in the 'h'/'H' and 'w'/'W' cases may be beyond its
  capability to analyze, but the code appears to be safe.
  
  Reported by:  Coverity
  CID:  1008328
  Reviewed by:  jilles, cem
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6482

Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cMon May 23 00:58:52 2016(r300441)
+++ head/bin/sh/parser.cMon May 23 01:01:23 2016(r300442)
@@ -1998,7 +1998,7 @@ getprompt(void *unused __unused)
/*
 * Format prompt string.
 */
-   for (i = 0; (i < 127) && (*fmt != '\0'); i++, fmt++)
+   for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++)
if (*fmt == '\\')
switch (*++fmt) {
 
@@ -2011,7 +2011,8 @@ getprompt(void *unused __unused)
case 'h':
case 'H':
ps[i] = '\0';
-   gethostname(&ps[i], PROMPTLEN - i);
+   gethostname(&ps[i], PROMPTLEN - i - 1);
+   ps[PROMPTLEN - 1] = '\0';
/* Skip to end of hostname. */
trim = (*fmt == 'h') ? '.' : '\0';
while ((ps[i] != '\0') && (ps[i] != trim))
@@ -2061,8 +2062,9 @@ getprompt(void *unused __unused)
 * Emit unrecognized formats verbatim.
 */
default:
-   ps[i++] = '\\';
-   ps[i] = *fmt;
+   ps[i] = '\\';
+   if (i < PROMPTLEN - 1)
+   ps[++i] = *fmt;
break;
}
else
___
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: r300440 - head/sys/vm

2016-05-22 Thread Konstantin Belousov
Author: kib
Date: Sun May 22 23:28:23 2016
New Revision: 300440
URL: https://svnweb.freebsd.org/changeset/base/300440

Log:
  Mark swap-related proc sysctls as not requiring Giant.
  
  Reviewed by:  alc (as part of larger patch)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSun May 22 23:25:01 2016(r300439)
+++ head/sys/vm/swap_pager.cSun May 22 23:28:23 2016(r300440)
@@ -325,8 +325,9 @@ static int nsw_wcount_async_max;/* assig
 static int nsw_cluster_max;/* maximum VOP I/O allowed  */
 
 static int sysctl_swap_async_max(SYSCTL_HANDLER_ARGS);
-SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW,
-NULL, 0, sysctl_swap_async_max, "I", "Maximum running async swap ops");
+SYSCTL_PROC(_vm, OID_AUTO, swap_async_max, CTLTYPE_INT | CTLFLAG_RW |
+CTLFLAG_MPSAFE, NULL, 0, sysctl_swap_async_max, "I",
+"Maximum running async swap ops");
 
 static struct swblock **swhash;
 static int swhash_mask;
@@ -2356,7 +2357,8 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS)
 
 SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0,
 "Number of swap devices");
-SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD, sysctl_vm_swap_info,
+SYSCTL_NODE(_vm, OID_AUTO, swap_info, CTLFLAG_RD | CTLFLAG_MPSAFE,
+sysctl_vm_swap_info,
 "Swap statistics by device");
 
 /*
___
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: r300439 - head/sys/vm

2016-05-22 Thread Konstantin Belousov
Author: kib
Date: Sun May 22 23:25:01 2016
New Revision: 300439
URL: https://svnweb.freebsd.org/changeset/base/300439

Log:
  Replace hand-made exclusive lock, protecting against parallel
  swapon/swapoff invocations, with sx.
  
  Reviewed by:  alc (as part of larger patch)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSun May 22 21:31:20 2016(r300438)
+++ head/sys/vm/swap_pager.cSun May 22 23:25:01 2016(r300439)
@@ -152,7 +152,7 @@ static TAILQ_HEAD(, swdevt) swtailq = TA
 static struct swdevt *swdevhd; /* Allocate from here next */
 static int nswapdev;   /* Number of swap devices */
 int swap_pager_avail;
-static int swdev_syscall_active = 0; /* serialize swap(on|off) */
+static struct sx swdev_syscall_lock;   /* serialize swap(on|off) */
 
 static vm_ooffset_t swap_total;
 SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0,
@@ -487,6 +487,7 @@ swap_pager_init(void)
TAILQ_INIT(&swap_pager_object_list[i]);
mtx_init(&sw_alloc_mtx, "swap_pager list", NULL, MTX_DEF);
mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF);
+   sx_init(&swdev_syscall_lock, "swsysc");
 
/*
 * Device Stripe, in PAGE_SIZE'd blocks
@@ -1664,7 +1665,7 @@ swap_pager_swapoff(struct swdevt *sp)
struct swblock *swap;
int i, j, retries;
 
-   GIANT_REQUIRED;
+   sx_assert(&swdev_syscall_lock, SA_XLOCKED);
 
retries = 0;
 full_rescan:
@@ -2005,10 +2006,7 @@ sys_swapon(struct thread *td, struct swa
if (error)
return (error);
 
-   mtx_lock(&Giant);
-   while (swdev_syscall_active)
-   tsleep(&swdev_syscall_active, PUSER - 1, "swpon", 0);
-   swdev_syscall_active = 1;
+   sx_xlock(&swdev_syscall_lock);
 
/*
 * Swap metadata may not fit in the KVM if we have physical
@@ -2043,9 +2041,7 @@ sys_swapon(struct thread *td, struct swa
if (error)
vrele(vp);
 done:
-   swdev_syscall_active = 0;
-   wakeup_one(&swdev_syscall_active);
-   mtx_unlock(&Giant);
+   sx_xunlock(&swdev_syscall_lock);
return (error);
 }
 
@@ -2175,10 +2171,7 @@ sys_swapoff(struct thread *td, struct sw
if (error)
return (error);
 
-   mtx_lock(&Giant);
-   while (swdev_syscall_active)
-   tsleep(&swdev_syscall_active, PUSER - 1, "swpoff", 0);
-   swdev_syscall_active = 1;
+   sx_xlock(&swdev_syscall_lock);
 
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name,
td);
@@ -2200,9 +2193,7 @@ sys_swapoff(struct thread *td, struct sw
}
error = swapoff_one(sp, td->td_ucred);
 done:
-   swdev_syscall_active = 0;
-   wakeup_one(&swdev_syscall_active);
-   mtx_unlock(&Giant);
+   sx_xunlock(&swdev_syscall_lock);
return (error);
 }
 
@@ -2214,7 +2205,7 @@ swapoff_one(struct swdevt *sp, struct uc
int error;
 #endif
 
-   mtx_assert(&Giant, MA_OWNED);
+   sx_assert(&swdev_syscall_lock, SA_XLOCKED);
 #ifdef MAC
(void) vn_lock(sp->sw_vp, LK_EXCLUSIVE | LK_RETRY);
error = mac_system_check_swapoff(cred, sp->sw_vp);
@@ -2276,10 +2267,7 @@ swapoff_all(void)
const char *devname;
int error;
 
-   mtx_lock(&Giant);
-   while (swdev_syscall_active)
-   tsleep(&swdev_syscall_active, PUSER - 1, "swpoff", 0);
-   swdev_syscall_active = 1;
+   sx_xlock(&swdev_syscall_lock);
 
mtx_lock(&sw_dev_mtx);
TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) {
@@ -2299,9 +2287,7 @@ swapoff_all(void)
}
mtx_unlock(&sw_dev_mtx);
 
-   swdev_syscall_active = 0;
-   wakeup_one(&swdev_syscall_active);
-   mtx_unlock(&Giant);
+   sx_xunlock(&swdev_syscall_lock);
 }
 
 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: r300438 - head/share/mk

2016-05-22 Thread Ian Lepore
Author: ian
Date: Sun May 22 21:31:20 2016
New Revision: 300438
URL: https://svnweb.freebsd.org/changeset/base/300438

Log:
  Restore the translation of armv6hf->arm when generating MACHINE_CPUARCH.
  It turns out we need to leave this in place for a while so that people
  running self-hosting armv6hf systems can do the builds necessary to update
  to armv6 (which is now hardfloat by default).

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkSun May 22 20:44:11 2016(r300437)
+++ head/share/mk/sys.mkSun May 22 21:31:20 2016(r300438)
@@ -13,7 +13,7 @@ unix  ?=  We run FreeBSD, not UNIX.
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/}
+MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/}
 .endif
 
 
___
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: r300436 - head/usr.sbin/bsdinstall/scripts

2016-05-22 Thread Allan Jude
Author: allanjude
Date: Sun May 22 20:31:52 2016
New Revision: 300436
URL: https://svnweb.freebsd.org/changeset/base/300436

Log:
  bsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT
  
  In this configuration, a separate bootpool is not required.
  This allows ZFS Boot Environments to be used with GELI encrypted ZFS pools.
  
  Support for GPT+EFI+GELI is planned for the future.
  
  Tested by: Joseph Mingrone, HardenedBSD
  Relnotes: yes
  Sponsored by: ScaleEngine Inc.
  Differential Revision:https://reviews.freebsd.org/D5869

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 20:17:55 2016
(r300435)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 20:31:52 2016
(r300436)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #-
-# Copyright (c) 2013-2015 Allan Jude
+# Copyright (c) 2013-2016 Allan Jude
 # Copyright (c) 2013-2015 Devin Teske
 # All rights reserved.
 #
@@ -189,8 +189,10 @@ CHMOD_MODE='chmod %s "%s"'
 DD_WITH_OPTIONS='dd if="%s" of="%s" %s'
 ECHO_APPEND='echo "%s" >> "%s"'
 GELI_ATTACH='geli attach -j - -k "%s" "%s"'
+GELI_ATTACH_NOKEY='geli attach -j - "%s"'
 GELI_DETACH_F='geli detach -f "%s"'
 GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 
"%s"'
+GELI_PASSWORD_GELIBOOT_INIT='geli init -bg -e %s -J - -l 256 -s 4096 "%s"'
 GPART_ADD_ALIGN='gpart add %s -t %s "%s"'
 GPART_ADD_ALIGN_INDEX='gpart add %s -i %s -t %s "%s"'
 GPART_ADD_ALIGN_INDEX_WITH_SIZE='gpart add %s -i %s -t %s -s %s "%s"'
@@ -205,6 +207,7 @@ GPART_SET_ACTIVE='gpart set -a active -i
 GPART_SET_LENOVOFIX='gpart set -a lenovofix "%s"'
 GPART_SET_PMBR_ACTIVE='gpart set -a active "%s"'
 GRAID_DELETE='graid delete "%s"'
+KLDLOAD='kldload %s'
 LN_SF='ln -sf "%s" "%s"'
 MKDIR_P='mkdir -p "%s"'
 MOUNT_TYPE='mount -t %s "%s" "%s"'
@@ -755,21 +758,6 @@ zfs_create_diskpart()
esac
 
#
-   # Enable boot pool if encryption is desired
-   #
-   [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
-
-   #
-   # ZFSBOOT_BOOT_POOL and BIOS+UEFI boot type are incompatible
-   #
-   if [ "$ZFSBOOT_BOOT_POOL" -a "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then
-   f_dprintf "$funcname: ZFSBOOT_BOOT_POOL is incompatible with 
BIOS+UEFI boot type"
-   msg_error="$msg_error: $funcname" f_show_err \
-   "ZFSBOOT_BOOT_POOL is incompatible with BIOS+UEFI boot 
type"
-   return $FAILURE
-   fi
-
-   #
# Destroy whatever partition layout is currently on disk.
# NOTE: `-F' required to destroy if partitions still exist.
# NOTE: Failure is ok here, blank disk will have nothing to destroy.
@@ -821,9 +809,14 @@ zfs_create_diskpart()
fi
 
#
-   # 2. Add small freebsd-boot or efi partition
+   # 2. Add small freebsd-boot and/or efi partition
#
if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o "$ZFSBOOT_BOOT_TYPE" = 
"BIOS+UEFI" ]; then
+   #
+   # Enable boot pool if encryption is desired
+   #
+   [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
+
f_eval_catch $funcname gpart \
 "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
 "$align_small" efiboot$index efi 800k 
$disk ||
@@ -916,6 +909,10 @@ zfs_create_diskpart()
 
MBR) f_dprintf "$funcname: Creating MBR layout..."
#
+   # Enable boot pool if encryption is desired
+   #
+   [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
+   #
# 1. Create MBR layout (no labels)
#
f_eval_catch $funcname gpart "$GPART_CREATE" mbr $disk ||
@@ -1190,6 +1187,10 @@ zfs_create_boot()
# Create the geli(8) GEOMS
#
if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
+   #
+   # Load the AES-NI kernel module to accelerate encryption
+   #
+   f_eval_catch -d $funcname kldload "$KLDLOAD" "aesni"
# Prompt user for password (twice)
if ! msg_enter_new_password="$msg_geli_password" \
f_dialog_input_password
@@ -1203,27 +1204,51 @@ zfs_create_boot()
for disk in $disks; do
f_dialog_info "$msg_geli_setup" \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
-   if ! echo "$pw_password" | f_eval_catch \
-   $funcname geli "$GELI_PASSWORD_INIT" \
-   "$bootpool/boot/$disk$targetpart.eli" \
-   AES-XTS "$bootpool/$zroot_key" \
-  

svn commit: r300435 - head/gnu/usr.bin/grep

2016-05-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sun May 22 20:17:55 2016
New Revision: 300435
URL: https://svnweb.freebsd.org/changeset/base/300435

Log:
  gnugrep: Update the configuration.
  
  The only effect is that it will use our native iconv(3).
  
  Relnotes: yes

Modified:
  head/gnu/usr.bin/grep/config.h

Modified: head/gnu/usr.bin/grep/config.h
==
--- head/gnu/usr.bin/grep/config.h  Sun May 22 20:12:07 2016
(r300434)
+++ head/gnu/usr.bin/grep/config.h  Sun May 22 20:17:55 2016
(r300435)
@@ -98,7 +98,7 @@
 #define HAVE_GETUID 1
 
 /* Define if you have the iconv() function. */
-/* #undef HAVE_ICONV */
+#define HAVE_ICONV 1
 
 /* Define if  exists, doesn't clash with , and
declares uintmax_t. */
@@ -260,7 +260,7 @@
 /* #undef HAVE___ARGZ_STRINGIFY */
 
 /* Define as const if the declaration of iconv() needs const. */
-/* #undef ICONV_CONST */
+#define ICONV_CONST 
 
 /* Name of package */
 #define PACKAGE "grep"
___
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: r300434 - head/sys/dev/urtwn

2016-05-22 Thread Andriy Voskoboinyk
Author: avos
Date: Sun May 22 20:12:07 2016
New Revision: 300434
URL: https://svnweb.freebsd.org/changeset/base/300434

Log:
  urtwn: cleanup some unused code in urtwn_tx_data().
  
  - Drop unused 'subtype' variable.
  - Remove obsolete comment (hardware crypto support was added in r292175).

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Sun May 22 19:43:40 2016
(r300433)
+++ head/sys/dev/urtwn/if_urtwn.c   Sun May 22 20:12:07 2016
(r300434)
@@ -2838,17 +2838,13 @@ urtwn_tx_data(struct urtwn_softc *sc, st
struct ieee80211_channel *chan;
struct ieee80211_frame *wh;
struct r92c_tx_desc *txd;
-   uint8_t macid, raid, rate, ridx, subtype, type, tid, qos, qsel;
+   uint8_t macid, raid, rate, ridx, type, tid, qos, qsel;
int hasqos, ismcast;
 
URTWN_ASSERT_LOCKED(sc);
 
-   /*
-* Software crypto.
-*/
wh = mtod(m, struct ieee80211_frame *);
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
-   subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
hasqos = IEEE80211_QOS_HAS_SEQ(wh);
ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
 
___
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: r300433 - head/sys/dev/urtwn

2016-05-22 Thread Andriy Voskoboinyk

RTL8192CUS


RTL8188CUS of course.
___
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: r300433 - head/sys/dev/urtwn

2016-05-22 Thread Andriy Voskoboinyk
Author: avos
Date: Sun May 22 19:43:40 2016
New Revision: 300433
URL: https://svnweb.freebsd.org/changeset/base/300433

Log:
  urtwn: setup per-frame retry limit.
  
  Override global retry limit (which is set in R92C_RL) via per-frame
  TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps).
  
  Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]).

Modified:
  head/sys/dev/urtwn/if_urtwn.c
  head/sys/dev/urtwn/if_urtwnreg.h

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Sun May 22 19:25:53 2016
(r300432)
+++ head/sys/dev/urtwn/if_urtwn.c   Sun May 22 19:43:40 2016
(r300433)
@@ -2838,7 +2838,7 @@ urtwn_tx_data(struct urtwn_softc *sc, st
struct ieee80211_channel *chan;
struct ieee80211_frame *wh;
struct r92c_tx_desc *txd;
-   uint8_t macid, raid, rate, ridx, subtype, type, tid, qsel;
+   uint8_t macid, raid, rate, ridx, subtype, type, tid, qos, qsel;
int hasqos, ismcast;
 
URTWN_ASSERT_LOCKED(sc);
@@ -2854,10 +2854,12 @@ urtwn_tx_data(struct urtwn_softc *sc, st
 
/* Select TX ring for this frame. */
if (hasqos) {
-   tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0];
-   tid &= IEEE80211_QOS_TID;
-   } else
+   qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0];
+   tid = qos & IEEE80211_QOS_TID;
+   } else {
+   qos = 0;
tid = 0;
+   }
 
chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ?
ni->ni_chan : ic->ic_curchan;
@@ -2923,6 +2925,14 @@ urtwn_tx_data(struct urtwn_softc *sc, st
txd->txdw0 |= htole32(R92C_TXDW0_BMCAST);
 
if (!ismcast) {
+   /* Unicast frame, check if an ACK is expected. */
+   if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) !=
+   IEEE80211_QOS_ACKPOLICY_NOACK) {
+   txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA);
+   txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT,
+   tp->maxretry));
+   }
+
if (sc->chip & URTWN_CHIP_88E) {
struct urtwn_node *un = URTWN_NODE(ni);
macid = un->id;
@@ -3102,6 +3112,11 @@ urtwn_tx_raw(struct urtwn_softc *sc, str
if (IEEE80211_IS_MULTICAST(wh->i_addr1))
txd->txdw0 |= htole32(R92C_TXDW0_BMCAST);
 
+   if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) {
+   txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA);
+   txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT,
+   params->ibp_try0));
+   }
if (params->ibp_flags & IEEE80211_BPF_RTS)
txd->txdw4 |= htole32(R92C_TXDW4_RTSEN);
if (params->ibp_flags & IEEE80211_BPF_CTS)

Modified: head/sys/dev/urtwn/if_urtwnreg.h
==
--- head/sys/dev/urtwn/if_urtwnreg.hSun May 22 19:25:53 2016
(r300432)
+++ head/sys/dev/urtwn/if_urtwnreg.hSun May 22 19:43:40 2016
(r300433)
@@ -1198,6 +1198,9 @@ struct r92c_tx_desc {
 #define R92C_TXDW5_DATARATE_M  0x003f
 #define R92C_TXDW5_DATARATE_S  0
 #define R92C_TXDW5_SGI 0x0040
+#define R92C_TXDW5_RTY_LMT_ENA 0x0002
+#define R92C_TXDW5_RTY_LMT_M   0x00fc
+#define R92C_TXDW5_RTY_LMT_S   18
 #define R92C_TXDW5_AGGNUM_M0xff00
 #define R92C_TXDW5_AGGNUM_S24
 
___
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: r300432 - head/sys/vm

2016-05-22 Thread Konstantin Belousov
Author: kib
Date: Sun May 22 19:25:53 2016
New Revision: 300432
URL: https://svnweb.freebsd.org/changeset/base/300432

Log:
  Remove false claim.  Giant is dropped by mi_startup() before passing
  the control to swapper.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/vm/vm_glue.c

Modified: head/sys/vm/vm_glue.c
==
--- head/sys/vm/vm_glue.c   Sun May 22 19:08:29 2016(r300431)
+++ head/sys/vm/vm_glue.c   Sun May 22 19:25:53 2016(r300432)
@@ -731,8 +731,6 @@ faultin(p)
  * This swapin algorithm attempts to swap-in processes only if there
  * is enough space for them.  Of course, if a process waits for a long
  * time, it will be swapped in anyway.
- *
- * Giant is held on entry.
  */
 void
 swapper(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"


Re: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

2016-05-22 Thread Justin Hibbits
On May 22, 2016 13:51, "Ravi Pokala"  wrote:
>
> -Original Message-
> From:  on behalf of Luiz Otavio O Souza

> Date: 2016-05-22, Sunday at 06:58
> To: , , <
svn-src-head@freebsd.org>
> Subject: svn commit: r300421 - in head/sys: arm/allwinner
arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica
dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac
>
> >Author: loos
> >Date: Sun May 22 13:58:32 2016
> >New Revision: 300421
> >URL: https://svnweb.freebsd.org/changeset/base/300421
> >
> >Log:
> >  Fix the deciKelvin to Celsius conversion in kernel.
> >
> >  After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as
0C
> >  reference and as result, the temperature read in sysctl(8) now exibits
a
> >  +0.1C difference.
>
> Out of morbid curiosity, why do these things report in deciKelvin anyway?
Are there sensors we support out there which report native Kelvin, or that
report sub-degree precision?
>
> Thanks,
>
> Ravi (rpokala@)
>

There are many i2c sensors which report in sub-degree centigrade. Though
some of them are in 1/8 (or other power of 2) degree precision, not 1/10.

- Justin
___
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: r300431 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 19:08:29 2016
New Revision: 300431
URL: https://svnweb.freebsd.org/changeset/base/300431

Log:
  Convert proto family in both directions. The linux and native values for
  local and inet are identical, but for inet6 values differ.
  
  PR:   155040
  Reported by:  Simon Walton
  MFC after:2 week

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun May 22 19:06:38 2016
(r300430)
+++ head/sys/compat/linux/linux_socket.cSun May 22 19:08:29 2016
(r300431)
@@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *a
 {
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
-   int error;
+   int error, bdom;
 
if ((error = copyin(arg, &sa, sa_len)))
return (error);
 
-   *(u_short *)&sa = sa.sa_family;
+   bdom = bsd_to_linux_domain(sa.sa_family);
+   if (bdom == -1)
+   return (EAFNOSUPPORT);
+
+   *(u_short *)&sa = bdom;
return (copyout(&sa, arg, sa_len));
 }
 
@@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *a
 {
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
-   int error;
+   int error, bdom;
 
if ((error = copyin(arg, &sa, sa_len)))
return (error);
 
-   sa.sa_family = *(sa_family_t *)&sa;
+   bdom = linux_to_bsd_domain(*(sa_family_t *)&sa);
+   if (bdom == -1)
+   return (EAFNOSUPPORT);
+
+   sa.sa_family = bdom;
sa.sa_len = len;
return (copyout(&sa, arg, sa_len));
 }
___
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: r300430 - head/usr.sbin/rpc.yppasswdd

2016-05-22 Thread Garrett Cooper
Author: ngie
Date: Sun May 22 19:06:38 2016
New Revision: 300430
URL: https://svnweb.freebsd.org/changeset/base/300430

Log:
  Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on 
each line
  
  As a positive side-effect, this eliminates the double semicolons reported by 
Coverity:
  the macro contained a trailing semicolon, in addition to the semicolon placed 
on
  each line where EXPAND(..) was called.
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 1194269
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c

Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
==
--- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c  Sun May 22 19:04:34 
2016(r300429)
+++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c  Sun May 22 19:06:38 
2016(r300430)
@@ -103,7 +103,10 @@ copy_yp_pass(char *p, int x, int m)
}
 
t = buf;
-#define EXPAND(e)   e = t; while ((*t++ = *p++));
+#define EXPAND(e) do { \
+   e = t; \
+   while ((*t++ = *p++)); \
+} while (0)
 EXPAND(yp_password.pw_name);
yp_password.pw_fields |= _PWF_NAME;
 EXPAND(yp_password.pw_passwd);
___
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: r300429 - head/sys/sys

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 19:04:34 2016
New Revision: 300429
URL: https://svnweb.freebsd.org/changeset/base/300429

Log:
  Remove a now unused global declaration of some sysentvec struct.
  
  MFC after:2 week

Modified:
  head/sys/sys/sysent.h

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Sun May 22 18:20:45 2016(r300428)
+++ head/sys/sys/sysent.h   Sun May 22 19:04:34 2016(r300429)
@@ -155,8 +155,6 @@ struct sysentvec {
 
 #ifdef _KERNEL
 extern struct sysentvec aout_sysvec;
-extern struct sysentvec elf_freebsd_sysvec;
-extern struct sysentvec null_sysvec;
 extern struct sysent sysent[];
 extern const char *syscallnames[];
 
___
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: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

2016-05-22 Thread Ravi Pokala
-Original Message-
From:  on behalf of Luiz Otavio O Souza 

Date: 2016-05-22, Sunday at 06:58
To: , , 

Subject: svn commit: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 
arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp 
dev/iicbus powerpc/powermac

>Author: loos
>Date: Sun May 22 13:58:32 2016
>New Revision: 300421
>URL: https://svnweb.freebsd.org/changeset/base/300421
>
>Log:
>  Fix the deciKelvin to Celsius conversion in kernel.
>  
>  After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
>  reference and as result, the temperature read in sysctl(8) now exibits a
>  +0.1C difference.

Out of morbid curiosity, why do these things report in deciKelvin anyway? Are 
there sensors we support out there which report native Kelvin, or that report 
sub-degree precision?

Thanks,

Ravi (rpokala@)


___
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: r300428 - head/usr.bin/kdump

2016-05-22 Thread Garrett Cooper
Author: ngie
Date: Sun May 22 18:20:45 2016
New Revision: 300428
URL: https://svnweb.freebsd.org/changeset/base/300428

Log:
  Fix humanized decoding of struct stat with respect to .st_mtim
  
  st_mtim was being incorrectly described as "stime=", not "mtime=". This was
  introduced with the original feature commit (r176471).
  
  MFC after: 1 week
  PR: 209699
  Submitted by: naddy
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Sun May 22 18:16:25 2016(r300427)
+++ head/usr.bin/kdump/kdump.c  Sun May 22 18:20:45 2016(r300428)
@@ -1688,7 +1688,7 @@ ktrstat(struct stat *statp)
printf(".%09ld, ", statp->st_atim.tv_nsec);
else
printf(", ");
-   printf("stime=");
+   printf("mtime=");
if (resolv == 0)
printf("%jd", (intmax_t)statp->st_mtim.tv_sec);
else {
___
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: r300427 - in head/sys/fs: cd9660 udf

2016-05-22 Thread Konstantin Belousov
Author: kib
Date: Sun May 22 18:16:25 2016
New Revision: 300427
URL: https://svnweb.freebsd.org/changeset/base/300427

Log:
  Remove drop/reacquire of Giant around geom calls for cd9660 and udf.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/cd9660/cd9660_vfsops.c
  head/sys/fs/udf/udf_vfsops.c

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==
--- head/sys/fs/cd9660/cd9660_vfsops.c  Sun May 22 18:16:04 2016
(r300426)
+++ head/sys/fs/cd9660/cd9660_vfsops.c  Sun May 22 18:16:25 2016
(r300427)
@@ -226,11 +226,9 @@ iso_mountfs(devvp, mp)
 
dev = devvp->v_rdev;
dev_ref(dev);
-   DROP_GIANT();
g_topology_lock();
error = g_vfs_open(devvp, &cp, "cd9660", 0);
g_topology_unlock();
-   PICKUP_GIANT();
VOP_UNLOCK(devvp, 0);
if (error)
goto out;
@@ -481,11 +479,9 @@ out:
if (supbp != NULL)
brelse(supbp);
if (cp != NULL) {
-   DROP_GIANT();
g_topology_lock();
g_vfs_close(cp);
g_topology_unlock();
-   PICKUP_GIANT();
}
if (isomp) {
free(isomp, M_ISOFSMNT);
@@ -519,11 +515,9 @@ cd9660_unmount(mp, mntflags)
if (isomp->im_l2d)
cd9660_iconv->close(isomp->im_l2d);
}
-   DROP_GIANT();
g_topology_lock();
g_vfs_close(isomp->im_cp);
g_topology_unlock();
-   PICKUP_GIANT();
vrele(isomp->im_devvp);
dev_rel(isomp->im_dev);
free(isomp, M_ISOFSMNT);

Modified: head/sys/fs/udf/udf_vfsops.c
==
--- head/sys/fs/udf/udf_vfsops.cSun May 22 18:16:04 2016
(r300426)
+++ head/sys/fs/udf/udf_vfsops.cSun May 22 18:16:25 2016
(r300427)
@@ -325,11 +325,9 @@ udf_mountfs(struct vnode *devvp, struct 
 
dev = devvp->v_rdev;
dev_ref(dev);
-   DROP_GIANT();
g_topology_lock();
error = g_vfs_open(devvp, &cp, "udf", 0);
g_topology_unlock();
-   PICKUP_GIANT();
VOP_UNLOCK(devvp, 0);
if (error)
goto bail;
@@ -500,11 +498,9 @@ bail:
if (bp != NULL)
brelse(bp);
if (cp != NULL) {
-   DROP_GIANT();
g_topology_lock();
g_vfs_close(cp);
g_topology_unlock();
-   PICKUP_GIANT();
}
dev_rel(dev);
return error;
@@ -533,11 +529,9 @@ udf_unmount(struct mount *mp, int mntfla
 #endif
}
 
-   DROP_GIANT();
g_topology_lock();
g_vfs_close(udfmp->im_cp);
g_topology_unlock();
-   PICKUP_GIANT();
vrele(udfmp->im_devvp);
dev_rel(udfmp->im_dev);
 
___
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: r300425 - head/usr.sbin/bsdinstall/scripts

2016-05-22 Thread Allan Jude
Author: allanjude
Date: Sun May 22 16:24:21 2016
New Revision: 300425
URL: https://svnweb.freebsd.org/changeset/base/300425

Log:
  Fix default ZFS layout to work better by default with sysutils/beadm
  
  The root file system is mounted early via vfs.root.mountfrom.
  The canmount=noauto property only affects the zfs rc.d script.
  This ensures that the 'default' BE is not mounted overtop of another BE when
  one is selected from the beastie menu
  
  Sponsored by: ScaleEngine Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 15:22:45 2016
(r300424)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 16:24:21 2016
(r300425)
@@ -143,7 +143,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA
 
# Boot Environment [BE] root and default boot dataset
/$ZFSBOOT_BEROOT_NAME   mountpoint=none
-   /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME  mountpoint=/
+   /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME  
mountpoint=/,canmount=noauto
 
# Compress /tmp, allow exec but not setuid
/tmpmountpoint=/tmp,exec=on,setuid=off
___
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: r300424 - head/sys/dev/cpuctl

2016-05-22 Thread Andrey A. Chernov
Author: ache
Date: Sun May 22 15:22:45 2016
New Revision: 300424
URL: https://svnweb.freebsd.org/changeset/base/300424

Log:
  Improve panic message by specifying on which cpu it really is.

Modified:
  head/sys/dev/cpuctl/cpuctl.c

Modified: head/sys/dev/cpuctl/cpuctl.c
==
--- head/sys/dev/cpuctl/cpuctl.cSun May 22 14:31:20 2016
(r300423)
+++ head/sys/dev/cpuctl/cpuctl.cSun May 22 15:22:45 2016
(r300424)
@@ -126,7 +126,7 @@ set_cpu(int cpu, struct thread *td)
sched_bind(td, cpu);
thread_unlock(td);
KASSERT(td->td_oncpu == cpu,
-   ("[cpuctl,%d]: cannot bind to target cpu %d", __LINE__, cpu));
+   ("[cpuctl,%d]: cannot bind to target cpu %d on cpu %d", __LINE__, 
cpu, td->td_oncpu));
 }
 
 static 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: r300423 - in head/sys: fs/ext2fs ufs/ffs

2016-05-22 Thread Kevin Lo
Author: kevlo
Date: Sun May 22 14:31:20 2016
New Revision: 300423
URL: https://svnweb.freebsd.org/changeset/base/300423

Log:
  arc4random() returns 0 to (2**32)−1, use an alternative to initialize
  i_gen if it's zero rather than a divide by 2.
  
  With inputs from  delphij, mckusick, rmacklem
  
  Reviewed by:  mckusick

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==
--- head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:13:20 2016
(r300422)
+++ head/sys/fs/ext2fs/ext2_alloc.c Sun May 22 14:31:20 2016
(r300423)
@@ -408,7 +408,8 @@ ext2_valloc(struct vnode *pvp, int mode,
/*
 * Set up a new generation number for this inode.
 */
-   ip->i_gen = arc4random();
+   while (ip->i_gen == 0 || ++ip->i_gen == 0)
+   ip->i_gen = arc4random();
 
vfs_timestamp(&ts);
ip->i_birthtime = ts.tv_sec;

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cSun May 22 14:13:20 2016
(r300422)
+++ head/sys/fs/ext2fs/ext2_vfsops.cSun May 22 14:31:20 2016
(r300423)
@@ -998,7 +998,8 @@ ext2_vget(struct mount *mp, ino_t ino, i
 * already have one. This should only happen on old filesystems.
 */
if (ip->i_gen == 0) {
-   ip->i_gen = random() + 1;
+   while (ip->i_gen == 0)
+   ip->i_gen = arc4random();
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
ip->i_flag |= IN_MODIFIED;
}

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cSun May 22 14:13:20 2016
(r300422)
+++ head/sys/ufs/ffs/ffs_alloc.cSun May 22 14:31:20 2016
(r300423)
@@ -1102,8 +1102,8 @@ dup_alloc:
/*
 * Set up a new generation number for this inode.
 */
-   if (ip->i_gen == 0 || ++ip->i_gen == 0)
-   ip->i_gen = arc4random() / 2 + 1;
+   while (ip->i_gen == 0 || ++ip->i_gen == 0)
+   ip->i_gen = arc4random();
DIP_SET(ip, i_gen, ip->i_gen);
if (fs->fs_magic == FS_UFS2_MAGIC) {
vfs_timestamp(&ts);
@@ -2080,7 +2080,8 @@ gotit:
bzero(ibp->b_data, (int)fs->fs_bsize);
dp2 = (struct ufs2_dinode *)(ibp->b_data);
for (i = 0; i < INOPB(fs); i++) {
-   dp2->di_gen = arc4random() / 2 + 1;
+   while (dp2->di_gen == 0)
+   dp2->di_gen = arc4random();
dp2++;
}
/*

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==
--- head/sys/ufs/ffs/ffs_vfsops.c   Sun May 22 14:13:20 2016
(r300422)
+++ head/sys/ufs/ffs/ffs_vfsops.c   Sun May 22 14:31:20 2016
(r300423)
@@ -1768,7 +1768,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
 * already have one. This should only happen on old filesystems.
 */
if (ip->i_gen == 0) {
-   ip->i_gen = arc4random() / 2 + 1;
+   while (ip->i_gen == 0)
+   ip->i_gen = arc4random();
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
ip->i_flag |= IN_MODIFIED;
DIP_SET(ip, i_gen, ip->i_gen);
___
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: r300422 - head/sys/compat/ndis

2016-05-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sun May 22 14:13:20 2016
New Revision: 300422
URL: https://svnweb.freebsd.org/changeset/base/300422

Log:
  ndis(4):  Undo unneeded workarounds in ndis' rand().
  
  - Revert the change for seed(0) in r300384. I misunderstood the standard
  and while our random() implementation in libkern may be improved, it
  handles the seed(0) case fine.
  
  Pointed out by:   bde, ache

Modified:
  head/sys/compat/ndis/subr_ntoskrnl.c

Modified: head/sys/compat/ndis/subr_ntoskrnl.c
==
--- head/sys/compat/ndis/subr_ntoskrnl.cSun May 22 13:58:32 2016
(r300421)
+++ head/sys/compat/ndis/subr_ntoskrnl.cSun May 22 14:13:20 2016
(r300422)
@@ -3196,8 +3196,6 @@ static void
 srand(unsigned int seed)
 {
 
-   if (seed == 0)
-   seed = 1;
srandom(seed);
 }
 
___
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: r300421 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/mv dev/acpi_support dev/acpica dev/amdtemp dev/coretemp dev/iicbus powerpc/powermac

2016-05-22 Thread Luiz Otavio O Souza
Author: loos
Date: Sun May 22 13:58:32 2016
New Revision: 300421
URL: https://svnweb.freebsd.org/changeset/base/300421

Log:
  Fix the deciKelvin to Celsius conversion in kernel.
  
  After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
  reference and as result, the temperature read in sysctl(8) now exibits a
  +0.1C difference.
  
  This commit fix the kernel references to match the reference value used in
  sysctl(8) after r285994.
  
  Sponsored by: Rubicon Communications (Netgate)

Modified:
  head/sys/arm/allwinner/axp209.c
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
  head/sys/arm/freescale/imx/imx6_anatop.c
  head/sys/arm/mv/mv_ts.c
  head/sys/dev/acpi_support/acpi_asus_wmi.c
  head/sys/dev/acpi_support/acpi_ibm.c
  head/sys/dev/acpi_support/atk0110.c
  head/sys/dev/acpica/acpi_thermal.c
  head/sys/dev/amdtemp/amdtemp.c
  head/sys/dev/coretemp/coretemp.c
  head/sys/dev/iicbus/ds3231reg.h
  head/sys/dev/iicbus/lm75.c
  head/sys/powerpc/powermac/powermac_thermal.h
  head/sys/powerpc/powermac/smu.c
  head/sys/powerpc/powermac/smusat.c

Modified: head/sys/arm/allwinner/axp209.c
==
--- head/sys/arm/allwinner/axp209.c Sun May 22 13:32:45 2016
(r300420)
+++ head/sys/arm/allwinner/axp209.c Sun May 22 13:58:32 2016
(r300421)
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
 #defineAXP209_TEMPMON_L(a) ((a) & 0xf)
 #defineAXP209_TEMPMON_MIN  1447/* -144.7C */
 
-#defineAXP209_0C_TO_K  2732
+#defineAXP209_0C_TO_K  2731
 
 struct axp209_softc {
uint32_taddr;

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun May 22 13:32:45 
2016(r300420)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sun May 22 13:58:32 
2016(r300421)
@@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$");
 #defineMSG_ERROR -9
 #defineMHZSTEP  100
 #defineHZSTEP (MHZ2HZ(MHZSTEP))
-#defineTZ_ZEROC2732
+#defineTZ_ZEROC2731
 
 #define VC_LOCK(sc) do {   \
sema_wait(&vc_sema);\

Modified: head/sys/arm/freescale/imx/imx6_anatop.c
==
--- head/sys/arm/freescale/imx/imx6_anatop.cSun May 22 13:32:45 2016
(r300420)
+++ head/sys/arm/freescale/imx/imx6_anatop.cSun May 22 13:58:32 2016
(r300421)
@@ -139,7 +139,7 @@ static struct oppt {
  */
 static uint32_t imx6_ocotp_mhz_tab[] = {792, 852, 996, 1200};
 
-#defineTZ_ZEROC2732/* deci-Kelvin <-> deci-Celcius offset. 
*/
+#defineTZ_ZEROC2731/* deci-Kelvin <-> deci-Celcius offset. 
*/
 
 uint32_t
 imx6_anatop_read_4(bus_size_t offset)

Modified: head/sys/arm/mv/mv_ts.c
==
--- head/sys/arm/mv/mv_ts.c Sun May 22 13:32:45 2016(r300420)
+++ head/sys/arm/mv/mv_ts.c Sun May 22 13:58:32 2016(r300421)
@@ -80,7 +80,7 @@ ts_probe(device_t dev)
 #defineMV_TEMP_SENS_OFFS   10
 #defineMV_TEMP_SENS_MASK   0x1ff
 #defineMV_TEMP_SENS_READ_MAX   16
-#defineTZ_ZEROC2732
+#defineTZ_ZEROC2731
 #defineMV_TEMP_CONVERT(x)  322 - x) * 10) / 13625) + 
TZ_ZEROC)
 
 /*

Modified: head/sys/dev/acpi_support/acpi_asus_wmi.c
==
--- head/sys/dev/acpi_support/acpi_asus_wmi.c   Sun May 22 13:32:45 2016
(r300420)
+++ head/sys/dev/acpi_support/acpi_asus_wmi.c   Sun May 22 13:58:32 2016
(r300421)
@@ -498,7 +498,7 @@ acpi_asus_wmi_sysctl_get(struct acpi_asu
 
switch(dev_id) {
case ASUS_WMI_DEVID_THERMAL_CTRL:
-   val = (val - 2732 + 5) / 10;
+   val = (val - 2731 + 5) / 10;
break;
case ASUS_WMI_DEVID_PROCESSOR_STATE:
case ASUS_WMI_DEVID_FAN_CTRL:

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==
--- head/sys/dev/acpi_support/acpi_ibm.cSun May 22 13:32:45 2016
(r300420)
+++ head/sys/dev/acpi_support/acpi_ibm.cSun May 22 13:58:32 2016
(r300421)
@@ -941,7 +941,7 @@ acpi_ibm_thermal_sysctl(SYSCTL_HANDLER_A
temp[i] = -1;
else if (sc->thermal_updt_supported)
/* Temperature is reported in tenth of Kelvin */
-   temp[i] = (temp[i] - 2732 + 5) / 10;
+   temp[i] = (temp[i] - 2731 + 5) / 10;
}
 
error = sysctl_handle_opaque(oidp, &temp

svn commit: r300420 - head/lib/libc/sys

2016-05-22 Thread Jilles Tjoelker
Author: jilles
Date: Sun May 22 13:32:45 2016
New Revision: 300420
URL: https://svnweb.freebsd.org/changeset/base/300420

Log:
  vfork(2): Mention some risks of calling vfork() from application code.
  
  MFC after:1 week

Modified:
  head/lib/libc/sys/vfork.2

Modified: head/lib/libc/sys/vfork.2
==
--- head/lib/libc/sys/vfork.2   Sun May 22 13:10:48 2016(r300419)
+++ head/lib/libc/sys/vfork.2   Sun May 22 13:32:45 2016(r300420)
@@ -28,7 +28,7 @@
 .\" @(#)vfork.28.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 6, 2015
+.Dd May 22, 2016
 .Dt VFORK 2
 .Os
 .Sh NAME
@@ -41,11 +41,20 @@
 .Ft pid_t
 .Fn vfork void
 .Sh DESCRIPTION
+.Bf -symbolic
+Since this function is hard to use correctly from application software,
+it is recommended to use
+.Xr posix_spawn 3
+or
+.Xr fork 2
+instead.
+.Ef
+.Pp
 The
 .Fn vfork
 system call
 can be used to create new processes without fully copying the address
-space of the old process, which is horrendously inefficient in a paged
+space of the old process, which is inefficient in a paged
 environment.
 It is useful when the purpose of
 .Xr fork 2
@@ -56,13 +65,15 @@ The
 system call
 differs from
 .Xr fork 2
-in that the child borrows the parent's memory and thread of
-control until a call to
+in that the child borrows the parent process's address space and the
+calling thread's stack
+until a call to
 .Xr execve 2
 or an exit (either by a call to
 .Xr _exit 2
 or abnormally).
-The parent process is suspended while the child is using its resources.
+The calling thread is suspended while the child is using its resources.
+Other threads continue to run.
 .Pp
 The
 .Fn vfork
@@ -70,17 +81,21 @@ system call
 returns 0 in the child's context and (later) the pid of the child in
 the parent's context.
 .Pp
-The
-.Fn vfork
-system call
-can normally be used just like
-.Xr fork 2 .
-It does not work, however, to return while running in the child's context
+Many problems can occur when replacing
+.Xr fork 2
+with
+.Fn vfork .
+For example, it does not work to return while running in the child's context
 from the procedure that called
 .Fn vfork
 since the eventual return from
 .Fn vfork
 would then return to a no longer existent stack frame.
+Also, changing process state which is partially implemented in user space
+such as signal handlers with
+.Xr libthr 3
+will corrupt the parent's state.
+.Pp
 Be careful, also, to call
 .Xr _exit 2
 rather than
@@ -106,7 +121,8 @@ Same as for
 .Xr rfork 2 ,
 .Xr sigaction 2 ,
 .Xr wait 2 ,
-.Xr exit 3
+.Xr exit 3 ,
+.Xr posix_spawn 3
 .Sh HISTORY
 The
 .Fn vfork
___
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: r300419 - head/sys/kern

2016-05-22 Thread Baptiste Daroussin
Author: bapt
Date: Sun May 22 13:10:48 2016
New Revision: 300419
URL: https://svnweb.freebsd.org/changeset/base/300419

Log:
  Fix typo introduced by me (not the submitter) when fixing typos

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun May 22 13:04:45 2016(r300418)
+++ head/sys/kern/uipc_socket.c Sun May 22 13:10:48 2016(r300419)
@@ -1164,7 +1164,7 @@ sosend_dgram(struct socket *so, struct s
}
/*
 * XXX all the SBS_CANTSENDMORE checks previously done could be out
-* of date.  We could have recived a reset packet in an interrupt or
+* of date.  We could have received a reset packet in an interrupt or
 * maybe we slept while doing page faults in uiomove() etc.  We could
 * probably recheck again inside the locking protection here, but
 * there are probably other places that this also happens.  We must
___
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: r300418 - head/sys/kern

2016-05-22 Thread Baptiste Daroussin
Author: bapt
Date: Sun May 22 13:04:45 2016
New Revision: 300418
URL: https://svnweb.freebsd.org/changeset/base/300418

Log:
  Fix typos in the comments
  
  Submitted by: cipherwraith...@gmail.com (via github)

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun May 22 12:59:07 2016(r300417)
+++ head/sys/kern/uipc_socket.c Sun May 22 13:04:45 2016(r300418)
@@ -550,7 +550,7 @@ SYSCTL_INT(_regression, OID_AUTO, sonewc
 /*
  * When an attempt at a new connection is noted on a socket which accepts
  * connections, sonewconn is called.  If the connection is possible (subject
- * to space constraints, etc.) then we allocate a new structure, propoerly
+ * to space constraints, etc.) then we allocate a new structure, properly
  * linked into the data structure of the original socket, and return this.
  * Connstatus may be 0, or SS_ISCONFIRMING, or SS_ISCONNECTED.
  *
@@ -1164,7 +1164,7 @@ sosend_dgram(struct socket *so, struct s
}
/*
 * XXX all the SBS_CANTSENDMORE checks previously done could be out
-* of date.  We could have received a reset packet in an interrupt or
+* of date.  We could have recived a reset packet in an interrupt or
 * maybe we slept while doing page faults in uiomove() etc.  We could
 * probably recheck again inside the locking protection here, but
 * there are probably other places that this also happens.  We must
@@ -2711,7 +2711,7 @@ sooptcopyout(struct sockopt *sopt, const
 * that we always tell the user precisely how much we copied, rather
 * than something useful like the total amount we had available for
 * her.  Note that this interface is not idempotent; the entire
-* answer must generated ahead of time.
+* answer must be generated ahead of time.
 */
valsize = min(len, sopt->sopt_valsize);
sopt->sopt_valsize = 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: r300417 - head/usr.sbin/bsdinstall/scripts

2016-05-22 Thread Baptiste Daroussin
Author: bapt
Date: Sun May 22 12:59:07 2016
New Revision: 300417
URL: https://svnweb.freebsd.org/changeset/base/300417

Log:
  Fix typo in comments for the zfsboot script
  
  Submitted by: Colby Swandale  (via github)

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 12:49:08 2016
(r300416)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSun May 22 12:59:07 2016
(r300417)
@@ -55,7 +55,7 @@ f_include $BSDCFG_SHARE/variable.subr
 : ${ZFSBOOT_BEROOT_NAME:=ROOT}
 
 #
-# Default name for the primany boot environment
+# Default name for the primary boot environment
 #
 : ${ZFSBOOT_BOOTFS_NAME:=default}
 
___
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: r300416 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:49:08 2016
New Revision: 300416
URL: https://svnweb.freebsd.org/changeset/base/300416

Log:
  Add a missing errno translation for SO_ERROR optname.
  
  PR:   135458
  Reported by:  Stefan Schmidt @ stadtbuch.de
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun May 22 12:46:34 2016
(r300415)
+++ head/sys/compat/linux/linux_socket.cSun May 22 12:49:08 2016
(r300416)
@@ -1608,10 +1608,10 @@ linux_getsockopt(struct thread *td, stru
} */ bsd_args;
l_timeval linux_tv;
struct timeval tv;
-   socklen_t tv_len, xulen;
+   socklen_t tv_len, xulen, len;
struct xucred xu;
struct l_ucred lxu;
-   int error, name;
+   int error, name, newval;
 
bsd_args.s = args->s;
bsd_args.level = linux_to_bsd_sockopt_level(args->level);
@@ -1650,6 +1650,15 @@ linux_getsockopt(struct thread *td, stru
return (copyout(&lxu, PTRIN(args->optval), 
sizeof(lxu)));
/* NOTREACHED */
break;
+   case SO_ERROR:
+   len = sizeof(newval);
+   error = kern_getsockopt(td, args->s, bsd_args.level,
+   name, &newval, UIO_SYSSPACE, &len);
+   if (error)
+   return (error);
+   newval = -SV_ABI_ERRNO(td->td_proc, newval);
+   return (copyout(&newval, PTRIN(args->optval), len));
+   /* NOTREACHED */
default:
break;
}
___
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: r300415 - in head/sys: amd64/amd64 i386/i386 powerpc/powerpc sparc64/sparc64 sys

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:46:34 2016
New Revision: 300415
URL: https://svnweb.freebsd.org/changeset/base/300415

Log:
  Add macro to convert errno and use it when appropriate.
  
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/powerpc/powerpc/exec_machdep.c
  head/sys/sparc64/sparc64/vm_machdep.c
  head/sys/sys/sysent.h

Modified: head/sys/amd64/amd64/vm_machdep.c
==
--- head/sys/amd64/amd64/vm_machdep.c   Sun May 22 12:37:40 2016
(r300414)
+++ head/sys/amd64/amd64/vm_machdep.c   Sun May 22 12:46:34 2016
(r300415)
@@ -414,13 +414,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_rax = error;
+   td->td_frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_rflags |= PSL_C;
break;
}

Modified: head/sys/i386/i386/vm_machdep.c
==
--- head/sys/i386/i386/vm_machdep.c Sun May 22 12:37:40 2016
(r300414)
+++ head/sys/i386/i386/vm_machdep.c Sun May 22 12:46:34 2016
(r300415)
@@ -451,13 +451,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_eax = error;
+   td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_eflags |= PSL_C;
break;
}

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Sun May 22 12:37:40 2016
(r300414)
+++ head/sys/powerpc/powerpc/exec_machdep.c Sun May 22 12:46:34 2016
(r300415)
@@ -908,11 +908,7 @@ cpu_set_syscall_retval(struct thread *td
tf->srr0 -= 4;
break;
default:
-   if (p->p_sysent->sv_errsize) {
-   error = (error < p->p_sysent->sv_errsize) ?
-   p->p_sysent->sv_errtbl[error] : -1;
-   }
-   tf->fixreg[FIRSTARG] = error;
+   tf->fixreg[FIRSTARG] = SV_ABI_ERRNO(p, error);
tf->cr |= 0x1000;   /* Set summary overflow */
break;
}

Modified: head/sys/sparc64/sparc64/vm_machdep.c
==
--- head/sys/sparc64/sparc64/vm_machdep.c   Sun May 22 12:37:40 2016
(r300414)
+++ head/sys/sparc64/sparc64/vm_machdep.c   Sun May 22 12:46:34 2016
(r300415)
@@ -167,13 +167,7 @@ cpu_set_syscall_retval(struct thread *td
break;
 
default:
-   if (td->td_proc->p_sysent->sv_errsize) {
-   if (error >= td->td_proc->p_sysent->sv_errsize)
-   error = -1; /* XXX */
-   else
-   error = td->td_proc->p_sysent->sv_errtbl[error];
-   }
-   td->td_frame->tf_out[0] = error;
+   td->td_frame->tf_out[0] = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_tstate |= TSTATE_XCC_C;
break;
}

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Sun May 22 12:37:40 2016(r300414)
+++ head/sys/sys/sysent.h   Sun May 22 12:46:34 2016(r300415)
@@ -141,6 +141,8 @@ struct sysentvec {
 #defineSV_TIMEKEEP 0x04
 
 #defineSV_ABI_MASK 0xff
+#defineSV_ABI_ERRNO(p, e)  ((p)->p_sysent->sv_errsize <= 0 ? e :   
\
+   ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e]))
 #defineSV_PROC_FLAG(p, x)  ((p)->p_sysent->sv_flags & (x))
 #defineSV_PROC_ABI(p)  ((p)->p_sysent->sv_flags & SV_ABI_MASK)
 #defineSV_CURPROC_FLAG(x)  SV_PROC_FLAG(curproc, x)
___
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: r300414 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:37:40 2016
New Revision: 300414
URL: https://svnweb.freebsd.org/changeset/base/300414

Log:
  For future use move futex timeout code to the separate function and
  switch to the high resolution sbintime_t.
  
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_futex.c

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Sun May 22 12:35:50 2016
(r300413)
+++ head/sys/compat/linux/linux_futex.c Sun May 22 12:37:40 2016
(r300414)
@@ -109,7 +109,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_get, 
 LIN_SDT_PROBE_DEFINE0(futex, futex_get, error);
 LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int");
 LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *",
-"struct waiting_proc **", "int");
+"struct waiting_proc **", "struct timespec *");
 LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *",
 "struct waiting_proc *", "uint32_t *", "uint32_t");
 LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *",
@@ -128,7 +128,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_reque
 "struct waiting_proc *", "uint32_t");
 LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int");
 LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *",
-"struct waiting_proc **", "int", "uint32_t");
+"struct waiting_proc **", "struct timespec *", "uint32_t");
 LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int");
 LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int");
 LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *",
@@ -142,7 +142,6 @@ LIN_SDT_PROBE_DEFINE1(futex, futex_atomi
 LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *",
 "struct linux_sys_futex_args *");
 LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch);
-LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, itimerfix_error, "int");
 LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int");
 LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use);
 LIN_SDT_PROBE_DEFINE3(futex, linux_sys_futex, debug_wait, "uint32_t *",
@@ -257,10 +256,12 @@ static void futex_put(struct futex *, st
 static int futex_get0(uint32_t *, struct futex **f, uint32_t);
 static int futex_get(uint32_t *, struct waiting_proc **, struct futex **,
 uint32_t);
-static int futex_sleep(struct futex *, struct waiting_proc *, int);
+static int futex_sleep(struct futex *, struct waiting_proc *, struct timespec 
*);
 static int futex_wake(struct futex *, int, uint32_t);
 static int futex_requeue(struct futex *, int, struct futex *, int);
-static int futex_wait(struct futex *, struct waiting_proc *, int,
+static int futex_copyin_timeout(int, struct l_timespec *, int,
+struct timespec *);
+static int futex_wait(struct futex *, struct waiting_proc *, struct timespec *,
 uint32_t);
 static void futex_lock(struct futex *);
 static void futex_unlock(struct futex *);
@@ -278,6 +279,34 @@ int futex_andl(int oparg, uint32_t *uadd
 int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
 
 
+static int
+futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt,
+struct timespec *ts)
+{
+   struct l_timespec lts;
+   struct timespec kts;
+   int error;
+
+   error = copyin(luts, tv_nsec < 0 || ts->tv_nsec >= 10)
+   return (EINVAL);
+
+   if (clockrt) {
+   nanotime(&kts);
+   timespecsub(ts, &kts);
+   } else if (op == LINUX_FUTEX_WAIT_BITSET) {
+   nanouptime(&kts);
+   timespecsub(ts, &kts);
+   }
+   return (error);
+}
+
 static void
 futex_put(struct futex *f, struct waiting_proc *wp)
 {
@@ -471,15 +500,35 @@ futex_unlock(struct futex *f)
 }
 
 static int
-futex_sleep(struct futex *f, struct waiting_proc *wp, int timeout)
+futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts)
 {
+   struct timespec uts;
+   sbintime_t sbt, prec, tmp;
+   time_t over;
int error;
 
FUTEX_ASSERT_LOCKED(f);
-   LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, timeout);
-   LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %d ref %d",
-   f->f_uaddr, wp, timeout, f->f_refcount);
-   error = mtx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout);
+   if (ts != NULL) {
+   uts = *ts;
+   if (uts.tv_sec > INT32_MAX / 2) {
+   over = uts.tv_sec - INT32_MAX / 2;
+   uts.tv_sec -= over;
+   }
+   tmp = tstosbt(uts);
+   if (TIMESEL(&sbt, tmp))
+   sbt += tc_tick_sbt;
+   sbt += tmp;
+  

svn commit: r300413 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:35:50 2016
New Revision: 300413
URL: https://svnweb.freebsd.org/changeset/base/300413

Log:
  Due to lack the priority propagation feature replace sx by mutex. WIth this
  commit NPTL tests are ends in 1 minute faster.
  
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_futex.c

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Sun May 22 12:28:55 2016
(r300412)
+++ head/sys/compat/linux/linux_futex.c Sun May 22 12:35:50 2016
(r300413)
@@ -54,9 +54,10 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
 #include 
 #include 
 #include 
-#include 
 #include 
 
+#include 
+
 #ifdef COMPAT_LINUX32
 #include 
 #include 
@@ -196,7 +197,7 @@ struct waiting_proc {
 };
 
 struct futex {
-   struct sx   f_lck;
+   struct mtx  f_lck;
uint32_t*f_uaddr;   /* user-supplied value, for debug */
struct umtx_key f_key;
uint32_tf_refcount;
@@ -207,20 +208,22 @@ struct futex {
 
 struct futex_list futex_list;
 
-#define FUTEX_LOCK(f)  sx_xlock(&(f)->f_lck)
-#define FUTEX_UNLOCK(f)sx_xunlock(&(f)->f_lck)
+#define FUTEX_LOCK(f)  mtx_lock(&(f)->f_lck)
+#define FUTEX_LOCKED(f)mtx_owned(&(f)->f_lck)
+#define FUTEX_UNLOCK(f)mtx_unlock(&(f)->f_lck)
 #define FUTEX_INIT(f)  do { \
-   sx_init_flags(&(f)->f_lck, "ftlk", \
-   SX_DUPOK); \
+   mtx_init(&(f)->f_lck, "ftlk", NULL, \
+   MTX_DUPOK); \
LIN_SDT_PROBE1(futex, futex, create, \
&(f)->f_lck); \
} while (0)
 #define FUTEX_DESTROY(f)   do { \
LIN_SDT_PROBE1(futex, futex, destroy, \
&(f)->f_lck); \
-   sx_destroy(&(f)->f_lck); \
+   mtx_destroy(&(f)->f_lck); \
} while (0)
-#define FUTEX_ASSERT_LOCKED(f) sx_assert(&(f)->f_lck, SA_XLOCKED)
+#define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED)
+#define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED)
 
 struct mtx futex_mtx;  /* protects the futex list */
 #define FUTEXES_LOCK   do { \
@@ -239,6 +242,7 @@ struct mtx futex_mtx;   /* protects the 
 #define FUTEX_DONTCREATE   0x2 /* don't create futex if not exists */
 #define FUTEX_DONTEXISTS   0x4 /* return EINVAL if futex exists */
 #defineFUTEX_SHARED0x8 /* shared futex */
+#defineFUTEX_DONTLOCK  0x10/* don't lock futex */
 
 /* wp_flags */
 #define FUTEX_WP_REQUEUED  0x1 /* wp requeued - wp moved from wp_list
@@ -258,6 +262,8 @@ static int futex_wake(struct futex *, in
 static int futex_requeue(struct futex *, int, struct futex *, int);
 static int futex_wait(struct futex *, struct waiting_proc *, int,
 uint32_t);
+static void futex_lock(struct futex *);
+static void futex_unlock(struct futex *);
 static int futex_atomic_op(struct thread *, int, uint32_t *);
 static int handle_futex_death(struct linux_emuldata *, uint32_t *,
 unsigned int);
@@ -277,7 +283,6 @@ futex_put(struct futex *f, struct waitin
 {
LIN_SDT_PROBE2(futex, futex_put, entry, f, wp);
 
-   FUTEX_ASSERT_LOCKED(f);
if (wp != NULL) {
if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0)
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
@@ -288,7 +293,8 @@ futex_put(struct futex *f, struct waitin
if (--f->f_refcount == 0) {
LIST_REMOVE(f, f_list);
FUTEXES_UNLOCK;
-   FUTEX_UNLOCK(f);
+   if (FUTEX_LOCKED(f))
+   futex_unlock(f);
 
LIN_SDT_PROBE3(futex, futex_put, destroy, f->f_uaddr,
f->f_refcount, f->f_key.shared);
@@ -307,7 +313,8 @@ futex_put(struct futex *f, struct waitin
LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d",
f->f_uaddr, f->f_refcount, f->f_key.shared);
FUTEXES_UNLOCK;
-   FUTEX_UNLOCK(f);
+   if (FUTEX_LOCKED(f))
+   futex_unlock(f);
 
LIN_SDT_PROBE0(futex, futex_put, return);
 }
@@ -335,7 +342,8 @@ retry:
LIST_FOREACH(f, &futex_list, f_list) {
if (umtx_key_match(&f->f_key, &key)) {
if (tmpf != NULL) {
-   FUTEX_UNLOCK(tmpf);
+   if (FUTEX_LOCKED(tmpf))
+   futex_unlock(tmpf);
FUTEX_DESTROY(tmpf);
free(tmpf, M_FUTEX);
 

svn commit: r300412 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:28:55 2016
New Revision: 300412
URL: https://svnweb.freebsd.org/changeset/base/300412

Log:
  Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
  while here.
  
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_futex.c

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Sun May 22 12:26:03 2016
(r300411)
+++ head/sys/compat/linux/linux_futex.c Sun May 22 12:28:55 2016
(r300412)
@@ -1,7 +1,9 @@
 /* $NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $ */
 
 /*-
- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ * Copyright (c) 2009-2016 Dmitry Chagin
+ * Copyright (c) 2005 Emmanuel Dreyfus
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -604,7 +606,7 @@ futex_atomic_op(struct thread *td, int e
 
LIN_SDT_PROBE4(futex, futex_atomic_op, decoded_op, op, cmp, oparg,
cmparg);
-   
+
/* XXX: Linux verifies access here and returns EFAULT */
LIN_SDT_PROBE0(futex, futex_atomic_op, missing_access_check);
 
@@ -996,7 +998,6 @@ linux_sys_futex(struct thread *td, struc
return (ENOSYS);
 
case LINUX_FUTEX_REQUEUE:
-
/*
 * Glibc does not use this operation since version 2.3.3,
 * as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
___
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: r300411 - head/sys/compat/linux

2016-05-22 Thread Dmitry Chagin
Author: dchagin
Date: Sun May 22 12:26:03 2016
New Revision: 300411
URL: https://svnweb.freebsd.org/changeset/base/300411

Log:
  Minor style(9) cleanup, no functional changes.
  
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_file.c

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Sun May 22 11:42:34 2016
(r300410)
+++ head/sys/compat/linux/linux_file.c  Sun May 22 12:26:03 2016
(r300411)
@@ -69,108 +69,106 @@ __FBSDID("$FreeBSD$");
 int
 linux_creat(struct thread *td, struct linux_creat_args *args)
 {
-char *path;
-int error;
-
-LCONVPATHEXIST(td, args->path, &path);
+   char *path;
+   int error;
 
+   LCONVPATHEXIST(td, args->path, &path);
 #ifdef DEBUG
if (ldebug(creat))
printf(ARGS(creat, "%s, %d"), path, args->mode);
 #endif
-error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
-   O_WRONLY | O_CREAT | O_TRUNC, args->mode);
-LFREEPATH(path);
-return (error);
+   error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
+   O_WRONLY | O_CREAT | O_TRUNC, args->mode);
+   LFREEPATH(path);
+   return (error);
 }
 
 
 static int
 linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int 
mode)
 {
-cap_rights_t rights;
-struct proc *p = td->td_proc;
-struct file *fp;
-int fd;
-int bsd_flags, error;
-
-bsd_flags = 0;
-switch (l_flags & LINUX_O_ACCMODE) {
-case LINUX_O_WRONLY:
-   bsd_flags |= O_WRONLY;
-   break;
-case LINUX_O_RDWR:
-   bsd_flags |= O_RDWR;
-   break;
-default:
-   bsd_flags |= O_RDONLY;
-}
-if (l_flags & LINUX_O_NDELAY)
-   bsd_flags |= O_NONBLOCK;
-if (l_flags & LINUX_O_APPEND)
-   bsd_flags |= O_APPEND;
-if (l_flags & LINUX_O_SYNC)
-   bsd_flags |= O_FSYNC;
-if (l_flags & LINUX_O_NONBLOCK)
-   bsd_flags |= O_NONBLOCK;
-if (l_flags & LINUX_FASYNC)
-   bsd_flags |= O_ASYNC;
-if (l_flags & LINUX_O_CREAT)
-   bsd_flags |= O_CREAT;
-if (l_flags & LINUX_O_TRUNC)
-   bsd_flags |= O_TRUNC;
-if (l_flags & LINUX_O_EXCL)
-   bsd_flags |= O_EXCL;
-if (l_flags & LINUX_O_NOCTTY)
-   bsd_flags |= O_NOCTTY;
-if (l_flags & LINUX_O_DIRECT)
-   bsd_flags |= O_DIRECT;
-if (l_flags & LINUX_O_NOFOLLOW)
-   bsd_flags |= O_NOFOLLOW;
-if (l_flags & LINUX_O_DIRECTORY)
-   bsd_flags |= O_DIRECTORY;
-/* XXX LINUX_O_NOATIME: unable to be easily implemented. */
-
-error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
-if (error != 0)
-   goto done;
-
-if (bsd_flags & O_NOCTTY)
-   goto done;
-
-/*
- * XXX In between kern_open() and fget(), another process
- * having the same filedesc could use that fd without
- * checking below.
- */
-fd = td->td_retval[0];
-if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) {
-   if (fp->f_type != DTYPE_VNODE) {
-   fdrop(fp, td);
-   goto done;
-   }
-   sx_slock(&proctree_lock);
-   PROC_LOCK(p);
-   if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
-   PROC_UNLOCK(p);
-   sx_sunlock(&proctree_lock);
-   /* XXXPJD: Verify if TIOCSCTTY is allowed. */
-   (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
-   td->td_ucred, td);
-   } else {
-   PROC_UNLOCK(p);
-   sx_sunlock(&proctree_lock);
-   }
-   fdrop(fp, td);
-}
+   cap_rights_t rights;
+   struct proc *p = td->td_proc;
+   struct file *fp;
+   int fd;
+   int bsd_flags, error;
+
+   bsd_flags = 0;
+   switch (l_flags & LINUX_O_ACCMODE) {
+   case LINUX_O_WRONLY:
+   bsd_flags |= O_WRONLY;
+   break;
+   case LINUX_O_RDWR:
+   bsd_flags |= O_RDWR;
+   break;
+   default:
+   bsd_flags |= O_RDONLY;
+   }
+   if (l_flags & LINUX_O_NDELAY)
+   bsd_flags |= O_NONBLOCK;
+   if (l_flags & LINUX_O_APPEND)
+   bsd_flags |= O_APPEND;
+   if (l_flags & LINUX_O_SYNC)
+   bsd_flags |= O_FSYNC;
+   if (l_flags & LINUX_O_NONBLOCK)
+   bsd_flags |= O_NONBLOCK;
+   if (l_flags & LINUX_FASYNC)
+   bsd_flags |= O_ASYNC;
+   if (l_flags & LINUX_O_CREAT)
+   bsd_flags |= O_CREAT;
+   if (l_flags & LINUX_O_TRUNC)
+   bsd_flags |= O_TRUNC;
+   if (l_flags & LINUX_O_EXCL)
+   bsd_flags |= O_EXCL;
+   if (l_flags & LINUX_O_NOCTTY)
+   bsd_flags |= O_NOCTTY;
+   if (l_flags & LINUX_O_DIRECT)
+   bsd_flags |= O_DIRECT;
+   if (l_flags & LINUX_O_NOFOLLOW)
+   bsd_flags |= O_NOFOLLOW

svn commit: r300410 - head/sys/arm/mv

2016-05-22 Thread Svatopluk Kraus
Author: skra
Date: Sun May 22 11:42:34 2016
New Revision: 300410
URL: https://svnweb.freebsd.org/changeset/base/300410

Log:
  INTRNG - implement pic_post_filter method. This method is fundamental
  one and must always be implemented for a PIC. There is no default for
  it intentionally.

Modified:
  head/sys/arm/mv/mpic.c

Modified: head/sys/arm/mv/mpic.c
==
--- head/sys/arm/mv/mpic.c  Sun May 22 09:59:43 2016(r300409)
+++ head/sys/arm/mv/mpic.c  Sun May 22 11:42:34 2016(r300410)
@@ -368,6 +368,11 @@ mpic_post_ithread(device_t dev, struct i
 
mpic_enable_intr(dev, isrc);
 }
+
+static void
+mpic_post_filter(device_t dev, struct intr_irqsrc *isrc)
+{
+}
 #endif
 
 static device_method_t mv_mpic_methods[] = {
@@ -378,6 +383,7 @@ static device_method_t mv_mpic_methods[]
DEVMETHOD(pic_disable_intr, mpic_disable_intr),
DEVMETHOD(pic_enable_intr,  mpic_enable_intr),
DEVMETHOD(pic_map_intr, mpic_map_intr),
+   DEVMETHOD(pic_post_filter,  mpic_post_filter),
DEVMETHOD(pic_post_ithread, mpic_post_ithread),
DEVMETHOD(pic_pre_ithread,  mpic_pre_ithread),
 #endif
___
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: r300409 - head/sys/arm/freescale/imx

2016-05-22 Thread Svatopluk Kraus
Author: skra
Date: Sun May 22 09:59:43 2016
New Revision: 300409
URL: https://svnweb.freebsd.org/changeset/base/300409

Log:
  Fix some format strings to make them either correct or uniform.
  No functional change.

Modified:
  head/sys/arm/freescale/imx/imx_gpio.c

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Sun May 22 08:43:36 2016
(r300408)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Sun May 22 09:59:43 2016
(r300409)
@@ -179,14 +179,14 @@ gpio_pic_map_fdt(device_t dev, u_int nce
 */
 
if (ncells != 2) {
-   device_printf(sc->dev, "Invalid #interrupt-cells");
+   device_printf(sc->dev, "Invalid #interrupt-cells\n");
return (EINVAL);
}
 
irq = cells[0];
tripol = cells[1];
if (irq >= sc->gpio_npins) {
-   device_printf(sc->dev, "Invalid interrupt number %d", irq);
+   device_printf(sc->dev, "Invalid interrupt number %u\n", irq);
return (EINVAL);
}
switch (tripol) {
@@ -207,7 +207,7 @@ gpio_pic_map_fdt(device_t dev, u_int nce
pol  = INTR_POLARITY_LOW;
break;
default:
-   device_printf(sc->dev, "unsupported trigger/polarity 0x%2x\n",
+   device_printf(sc->dev, "Unsupported trigger/polarity 0x%2x\n",
tripol);
return (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: r300406 - head/lib/csu/aarch64

2016-05-22 Thread Andrew Turner
Author: andrew
Date: Sun May 22 08:20:30 2016
New Revision: 300406
URL: https://svnweb.freebsd.org/changeset/base/300406

Log:
  Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
  no longer needed.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/lib/csu/aarch64/crt1.c

Modified: head/lib/csu/aarch64/crt1.c
==
--- head/lib/csu/aarch64/crt1.c Sun May 22 07:50:10 2016(r300405)
+++ head/lib/csu/aarch64/crt1.c Sun May 22 08:20:30 2016(r300406)
@@ -71,17 +71,8 @@ __start(int argc, char *argv[], char *en
 
if (&_DYNAMIC != NULL)
atexit(cleanup);
-   else {
-   /*
-* Hack to resolve _end so we read the correct symbol.
-* Without this it will resolve to the copy in the library
-* that firsts requests it. We should fix the toolchain,
-* however this is is needed until this can take place.
-*/
-   *(volatile long *)&_end;
-
+   else
_init_tls();
-   }
 
 #ifdef GCRT
atexit(_mcleanup);
___
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: r300332 - in head/sys: amd64/amd64 i386/i386

2016-05-22 Thread Konstantin Belousov
On Sat, May 21, 2016 at 06:29:50PM -0700, Chris Torek wrote:
> On the other hand, since most C compilers don't bother to trap
> signed integer overflow, but some can, signed integers may behave
> just as badly.  :-)
> 
> Overall I personally find the rules simpler for unsigned integers
> (occasionally surprising, but predictable and provable behavior in
> the mod-2^k ring) than for signed integers (occasionally
> surprising, possible trap on overflow, possible nonsense on
> overflow, unpredictable and hence unprovable in general).
> 
> The ANSI C folks in 1989 made a mess with the "value preserving"
> rules where unsigned integers become signed integers if the
> widened type is capable of representing all the values of the
> narrower type, but become wider unsigned integers if the widened
> type is not capable of representing all these values.
The biggest mess in ANSI C is that STD left signed arithmetic undefined
on overflow for 2-complement machines. It might be too bold, but IMO
significant number, if not all, programmers have a model of signed
integer operations on the typical modern real-machine (x86 or riscs)
where signed op is done by bit-preserving convertion to unsigned and
then doing unsigned op.

It is quite possible that standard authors did not even considered that
a practically useful compiler could do this differently. The hole was
used by one of the compilers to get ever important additional .5% in an
artifical benchmarks. Unfortunately gcc went the same route, adopting
both undef behaviour claim and colored error messages.

We use -fwrapv for kernel.
___
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"