svn commit: r297287 - head/sys/net80211

2016-03-26 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Mar 26 08:59:56 2016
New Revision: 297287
URL: https://svnweb.freebsd.org/changeset/base/297287

Log:
  net80211: fix panic for DWDS vaps
  
  Since r248069, TX IC lock must obtained before calling ieee80211_encap()
  and/or ieee80211_parent_xmitpkt().
  
  Tested with: Intel 3945BG.

Modified:
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_wds.c
==
--- head/sys/net80211/ieee80211_wds.c   Sat Mar 26 06:59:01 2016
(r297286)
+++ head/sys/net80211/ieee80211_wds.c   Sat Mar 26 08:59:56 2016
(r297287)
@@ -288,9 +288,11 @@ ieee80211_dwds_mcast(struct ieee80211vap
/*
 * Encapsulate the packet in prep for transmission.
 */
+   IEEE80211_TX_LOCK(ic);
mcopy = ieee80211_encap(vap, ni, mcopy);
if (mcopy == NULL) {
/* NB: stat+msg handled in ieee80211_encap */
+   IEEE80211_TX_UNLOCK(ic);
ieee80211_free_node(ni);
continue;
}
@@ -298,6 +300,7 @@ ieee80211_dwds_mcast(struct ieee80211vap
mcopy->m_pkthdr.rcvif = (void *) ni;
 
err = ieee80211_parent_xmitpkt(ic, mcopy);
+   IEEE80211_TX_UNLOCK(ic);
if (!err) {
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297288 - head/sys/arm/nvidia

2016-03-26 Thread Michal Meloun
Author: mmel
Date: Sat Mar 26 10:09:28 2016
New Revision: 297288
URL: https://svnweb.freebsd.org/changeset/base/297288

Log:
  TEGRA: Fixes for UART driver:
   - add mising 'or' in tegra_uart_attach()
 Pointed by: kan
   - fix indentation of tegra_softc
   - remove forgoten debug printf

Modified:
  head/sys/arm/nvidia/tegra_uart.c

Modified: head/sys/arm/nvidia/tegra_uart.c
==
--- head/sys/arm/nvidia/tegra_uart.cSat Mar 26 08:59:56 2016
(r297287)
+++ head/sys/arm/nvidia/tegra_uart.cSat Mar 26 10:09:28 2016
(r297288)
@@ -60,8 +60,8 @@ __FBSDID("$FreeBSD$");
  * High-level UART interface.
  */
 struct tegra_softc {
-   struct ns8250_softc ns8250_base;
-   clk_t   clk;
+   struct ns8250_softc ns8250_base;
+   clk_t   clk;
hwreset_t   reset;
 };
 
@@ -82,7 +82,7 @@ tegra_uart_attach(struct uart_softc *sc)
ns8250->ier_rxbits = 0x1d;
ns8250->ier_mask = 0xc0;
ns8250->ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask;
-   ns8250->ier = ns8250->ier_rxbits;
+   ns8250->ier |= ns8250->ier_rxbits;
uart_setreg(bas, REG_IER, ns8250->ier);
uart_barrier(bas);
return (0);
@@ -217,7 +217,6 @@ tegra_uart_probe(device_t dev)
device_printf(dev, "Cannot enable UART clock: %d\n", rv);
return (ENXIO);
}
-   device_printf(dev, "got UART clock: %lld\n", freq);
return (uart_bus_probe(dev, shift, (int)freq, 0, 0));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297289 - head/share/misc

2016-03-26 Thread Baptiste Daroussin
Author: bapt
Date: Sat Mar 26 11:13:17 2016
New Revision: 297289
URL: https://svnweb.freebsd.org/changeset/base/297289

Log:
  Update pci_vendors database to 2016-02-27
  
  MFC after:1 week

Modified:
  head/share/misc/pci_vendors

Modified: head/share/misc/pci_vendors
==
--- head/share/misc/pci_vendors Sat Mar 26 10:09:28 2016(r297288)
+++ head/share/misc/pci_vendors Sat Mar 26 11:13:17 2016(r297289)
@@ -3,11 +3,11 @@
 #
 #  List of PCI ID's
 #
-#  Version: 2015.07.31
-#  Date:2015-07-31 03:15:02
+#  Version: 2016.02.27
+#  Date:2016-02-27 03:15:01
 #
-#  Maintained by Martin Mares  and other volunteers from the
-#  PCI ID Project at http://pci-ids.ucw.cz/.
+#  Maintained by Albert Pool, Martin Mares, and other volunteers from
+#  the PCI ID Project at http://pci-ids.ucw.cz/.
 #
 #  New data are always welcome, especially if they are accurate. If you 
have
 #  anything to contribute, please follow the instructions at the web site.
@@ -23,6 +23,7 @@
 #  device  device_name <-- single tab
 #  subvendor subdevice  subsystem_name <-- two tabs
 
+0001  SafeNet (wrong ID)
 0010  Allied Telesis, Inc (Wrong ID)
 # This is a relabelled RTL-8139
8139  AT-2500TX V3 Ethernet
@@ -287,6 +288,10 @@
0050  SAS1064 PCI-X Fusion-MPT SAS
1028 1f04  SAS 5/E
1028 1f09  SAS 5i/R
+   0052  MegaRAID SAS-3 3216/3224 [Cutlass]
+   0053  MegaRAID SAS-3 3216/3224 [Cutlass]
+   1000 9350  MegaRAID SAS 9341-16i
+   1000 9351  MegaRAID SAS 9341-24i
0054  SAS1068 PCI-X Fusion-MPT SAS
1028 1f04  SAS 5/E Adapter Controller
1028 1f05  SAS 5/i Adapter Controller
@@ -364,6 +369,7 @@
1028 1f4c  PERC H330 Mini (for blades)
1028 1f4d  PERC H330 Embedded (for monolithic)
1054 306a  SAS 3004 iMR ROMB
+   1d49 04db  ServeRAID M1210 SAS/SATA Controller
0060  MegaRAID SAS 1078
1000 1006  MegaRAID SAS ELP
1000 100a  MegaRAID SAS 8708ELP
@@ -482,6 +488,8 @@
0085  SAS2208 PCI-Express Fusion-MPT SAS-2
0086  SAS2308 PCI-Express Fusion-MPT SAS-2
0087  SAS2308 PCI-Express Fusion-MPT SAS-2
+   1000 3020  9207-8i SAS2.1 HBA
+   1000 3040  9207-8e SAS2.1 HBA
1590 0044  H220i
008f  53c875J
1092 8000  FirePort 40 SCSI Controller
@@ -494,6 +502,21 @@
0097  SAS3008 PCI-Express Fusion-MPT SAS-3
1028 1f45  12GB/s HBA internal
1028 1f46  12Gbps HBA
+   00c0  SAS3324 PCI-Express Fusion-MPT SAS-3
+   00c1  SAS3324 PCI-Express Fusion-MPT SAS-3
+   00c2  SAS3324 PCI-Express Fusion-MPT SAS-3
+   00c3  SAS3324 PCI-Express Fusion-MPT SAS-3
+   00c4  SAS3224 PCI-Express Fusion-MPT SAS-3
+   00c5  SAS3316 PCI-Express Fusion-MPT SAS-3
+   00c6  SAS3316 PCI-Express Fusion-MPT SAS-3
+   00c7  SAS3316 PCI-Express Fusion-MPT SAS-3
+   00c8  SAS3316 PCI-Express Fusion-MPT SAS-3
+   00c9  SAS3216 PCI-Express Fusion-MPT SAS-3
+   00ce  MegaRAID SAS-3 3316 [Intruder]
+   1000 9371  MegaRAID SAS 9361-16i
+   1000 9390  MegaRAID SAS 9380-8i8e
+   00cf  MegaRAID SAS-3 3324 [Intruder]
+   1000 9370  MegaRAID SAS 9361-24i
0407  MegaRAID
1000 0530  MegaRAID 530 SCSI 320-0X RAID Controller
1000 0531  MegaRAID 531 SCSI 320-4X RAID Controller
@@ -1260,7 +1283,7 @@
5652  RV410/M26 [Mobility Radeon X700]
5653  RV410/M26 [Mobility Radeon X700]
1025 0080  Aspire 5024WLMi
-   103c 0940  HP Compaq NW8240 Mobile Workstation
+   103c 0940  Compaq NW8240 Mobile Workstation
5654  264VT [Mach64 VT]
1002 5654  Mach64VT Reference
5655  264VT3 [Mach64 VT3]
@@ -1515,6 +1538,12 @@
1462 3271  Radeon R9 360 OEM
1682 7360  Radeon R7 360
6660  Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330]
+   1028 05ea  Radeon HD 8670M
+   1028 06bf  Radeon R5 M335
+   103c 1970  Radeon HD 8670M
+   103c 80be  Radeon R5 M330
+   103c 8136  Radeon R5 M330
+   17aa 3804  Radeon R5 M330
17aa 3809  Radeon R5 M330
17aa 390c  Radeon R5 M330
6663  Sun PRO [Radeon HD 8570A/8570M]
@@ -2075,6 +2104,7 @@
1458 228c  R9 290X WindForce 3X
1458 228d  R9 290X WindForce 3X OC
1458 2290  R9 290X WindForce 3X
+   1458 22c1  Grenada PRO [Radeon R9 390]
1462 3070  R9 290X Lightning
1462 3071  R9 290X Lightning
1462 3072  R9 290X Lightning LE
@@ -21

svn commit: r297290 - head/usr.sbin/pw

2016-03-26 Thread Baptiste Daroussin
Author: bapt
Date: Sat Mar 26 11:41:35 2016
New Revision: 297290
URL: https://svnweb.freebsd.org/changeset/base/297290

Log:
  Remove some unneeded headers
  
  Found by 'include-what-you-use'

Modified:
  head/usr.sbin/pw/cpdir.c
  head/usr.sbin/pw/pw_user.c
  head/usr.sbin/pw/pw_utils.c
  head/usr.sbin/pw/pw_vpw.c

Modified: head/usr.sbin/pw/cpdir.c
==
--- head/usr.sbin/pw/cpdir.cSat Mar 26 11:13:17 2016(r297289)
+++ head/usr.sbin/pw/cpdir.cSat Mar 26 11:41:35 2016(r297290)
@@ -37,7 +37,6 @@ static const char rcsid[] =
 #include 
 
 #include "pw.h"
-#include "pwupd.h"
 
 void
 copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Sat Mar 26 11:13:17 2016(r297289)
+++ head/usr.sbin/pw/pw_user.c  Sat Mar 26 11:41:35 2016(r297290)
@@ -31,8 +31,6 @@ static const char rcsid[] =
 #endif /* not lint */
 
 #include 
-#include 
-#include 
 #include 
 
 #include 

Modified: head/usr.sbin/pw/pw_utils.c
==
--- head/usr.sbin/pw/pw_utils.c Sat Mar 26 11:13:17 2016(r297289)
+++ head/usr.sbin/pw/pw_utils.c Sat Mar 26 11:41:35 2016(r297290)
@@ -27,13 +27,10 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
 #include 
 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/usr.sbin/pw/pw_vpw.c
==
--- head/usr.sbin/pw/pw_vpw.c   Sat Mar 26 11:13:17 2016(r297289)
+++ head/usr.sbin/pw/pw_vpw.c   Sat Mar 26 11:41:35 2016(r297290)
@@ -37,7 +37,6 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "pwupd.h"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297291 - head/usr.sbin/sesutil

2016-03-26 Thread Baptiste Daroussin
Author: bapt
Date: Sat Mar 26 12:11:46 2016
New Revision: 297291
URL: https://svnweb.freebsd.org/changeset/base/297291

Log:
  Cleanup headers
  
  Found by: include-what-you-use

Modified:
  head/usr.sbin/sesutil/eltsub.c
  head/usr.sbin/sesutil/sesutil.c

Modified: head/usr.sbin/sesutil/eltsub.c
==
--- head/usr.sbin/sesutil/eltsub.c  Sat Mar 26 11:41:35 2016
(r297290)
+++ head/usr.sbin/sesutil/eltsub.c  Sat Mar 26 12:11:46 2016
(r297291)
@@ -37,13 +37,9 @@
 #include 
 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 
 #include "eltsub.h"

Modified: head/usr.sbin/sesutil/sesutil.c
==
--- head/usr.sbin/sesutil/sesutil.c Sat Mar 26 11:41:35 2016
(r297290)
+++ head/usr.sbin/sesutil/sesutil.c Sat Mar 26 12:11:46 2016
(r297291)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 
 #include "eltsub.h"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297292 - head/sys/arm/arm

2016-03-26 Thread Michal Meloun
Author: mmel
Date: Sat Mar 26 12:19:27 2016
New Revision: 297292
URL: https://svnweb.freebsd.org/changeset/base/297292

Log:
  ARM: Fix bug introduced in r297286.
   - don't put command line without guard to kernel environment.
   - kernel environment delivered from ubldr must have absolute precedence.

Modified:
  head/sys/arm/arm/machdep.c

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sat Mar 26 12:11:46 2016(r297291)
+++ head/sys/arm/arm/machdep.c  Sat Mar 26 12:19:27 2016(r297292)
@@ -1049,13 +1049,10 @@ cmdline_set_env(char *cmdline, const cha
/* Test and remove guard. */
if (guard != NULL && guard[0] != '\0') {
guard_len  =  strlen(guard);
-   if (strncasecmp(cmdline, guard, guard_len) != 0){
-   init_static_kenv(cmdline, 0);
+   if (strncasecmp(cmdline, guard, guard_len) != 0)
return;
-
-   cmdline += guard_len;
-   size -= guard_len;
-   }
+   cmdline += guard_len;
+   size -= guard_len;
}
 
/* Skip leading spaces. */
@@ -1833,7 +1830,7 @@ initarm(struct arm_boot_params *abp)
panic("OF_init failed with the found device tree");
 
 #if defined(LINUX_BOOT_ABI)
-   if (fdt_get_chosen_bootargs(linux_command_line,
+   if (loader_envp == NULL && fdt_get_chosen_bootargs(linux_command_line,
LBABI_MAX_COMMAND_LINE) == 0)
cmdline_set_env(linux_command_line, CMDLINE_GUARD);
 #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"


Re: svn commit: r297284 - in head/sys/arm: arm at91 conf include

2016-03-26 Thread Oliver Pinter
Hi Michal!

Is there any chance to add similar workaround to arm64 kernel too?
There are some arm64 devices without UEFI for example Odroid C2 and
Beelink Mini MX...

Thanks,
Oliver


On Sat, Mar 26, 2016 at 7:55 AM, Michal Meloun  wrote:
> Author: mmel
> Date: Sat Mar 26 06:55:55 2016
> New Revision: 297284
> URL: https://svnweb.freebsd.org/changeset/base/297284
>
> Log:
>   ARM: Teach LINUX_BOOT_ABI to recognize DT blob.
>   This allow us to boot FreeBSD kernel (using uImage encapsulation) directly
>   from U-boot using 'bootm' command or by Android fastboot loader.
>   For now, kernel uImage must be marked as Linux, but we can add support for
>   FreeBSD into U-Boot later.
>
> Modified:
>   head/sys/arm/arm/machdep.c
>   head/sys/arm/at91/board_tsc4370.c
>   head/sys/arm/conf/TEGRA124
>   head/sys/arm/include/machdep.h
>
> Modified: head/sys/arm/arm/machdep.c
> ==
> --- head/sys/arm/arm/machdep.c  Sat Mar 26 03:46:12 2016(r297283)
> +++ head/sys/arm/arm/machdep.c  Sat Mar 26 06:55:55 2016(r297284)
> @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>
>  #ifdef FDT
> +#include 
>  #include 
>  #include 
>  #endif
> @@ -959,7 +960,8 @@ makectx(struct trapframe *tf, struct pcb
>   * Fake up a boot descriptor table
>   */
>  vm_offset_t
> -fake_preload_metadata(struct arm_boot_params *abp __unused)
> +fake_preload_metadata(struct arm_boot_params *abp __unused, void *dtb_ptr,
> +size_t dtb_size)
>  {
>  #ifdef DDB
> vm_offset_t zstart = 0, zend = 0;
> @@ -997,6 +999,16 @@ fake_preload_metadata(struct arm_boot_pa
> } else
>  #endif
> lastaddr = (vm_offset_t)&end;
> +   if (dtb_ptr != NULL) {
> +   /* Copy DTB to KVA space and insert it into module chain. */
> +   lastaddr = roundup(lastaddr, sizeof(int));
> +   fake_preload[i++] = MODINFO_METADATA | MODINFOMD_DTBP;
> +   fake_preload[i++] = sizeof(uint32_t);
> +   fake_preload[i++] = (uint32_t)lastaddr;
> +   memmove((void *)lastaddr, dtb_ptr, dtb_size);
> +   lastaddr += dtb_size;
> +   lastaddr = roundup(lastaddr, sizeof(int));
> +   }
> fake_preload[i++] = 0;
> fake_preload[i] = 0;
> preload_metadata = (void *)fake_preload;
> @@ -1023,20 +1035,35 @@ linux_parse_boot_param(struct arm_boot_p
> struct arm_lbabi_tag *walker;
> uint32_t revision;
> uint64_t serial;
> +#ifdef FDT
> +   struct fdt_header *dtb_ptr;
> +   uint32_t dtb_size;
> +#endif
>
> /*
>  * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2
>  * is atags or dtb pointer.  If all of these aren't satisfied,
> -* then punt.
> +* then punt. Unfortunately, it looks like DT enabled kernels
> +* doesn't uses board type and U-Boot delivers 0 in r1 for them.
>  */
> -   if (!(abp->abp_r0 == 0 && abp->abp_r1 != 0 && abp->abp_r2 != 0))
> -   return 0;
> +   if (abp->abp_r0 != 0 || abp->abp_r2 == 0)
> +   return (0);
> +#ifdef FDT
> +   /* Test if r2 point to valid DTB. */
> +   dtb_ptr = (struct fdt_header *)abp->abp_r2;
> +   if (fdt_check_header(dtb_ptr) == 0) {
> +   dtb_size = fdt_totalsize(dtb_ptr);
> +   return (fake_preload_metadata(abp, dtb_ptr, dtb_size));
> +   }
> +#endif
> +   /* Old, ATAG based boot must have board type set. */
> +   if (abp->abp_r1 == 0)
> +   return (0);
>
> board_id = abp->abp_r1;
> walker = (struct arm_lbabi_tag *)
> (abp->abp_r2 + KERNVIRTADDR - abp->abp_physaddr);
>
> -   /* xxx - Need to also look for binary device tree */
> if (ATAG_TAG(walker) != ATAG_CORE)
> return 0;
>
> @@ -1077,7 +1104,7 @@ linux_parse_boot_param(struct arm_boot_p
>
> init_static_kenv(NULL, 0);
>
> -   return fake_preload_metadata(abp);
> +   return fake_preload_metadata(abp, NULL, 0);
>  }
>  #endif
>
> @@ -1135,7 +1162,7 @@ default_parse_boot_param(struct arm_boot
> return lastaddr;
>  #endif
> /* Fall back to hardcoded metadata. */
> -   lastaddr = fake_preload_metadata(abp);
> +   lastaddr = fake_preload_metadata(abp, NULL, 0);
>
> return lastaddr;
>  }
>
> Modified: head/sys/arm/at91/board_tsc4370.c
> ==
> --- head/sys/arm/at91/board_tsc4370.c   Sat Mar 26 03:46:12 2016
> (r297283)
> +++ head/sys/arm/at91/board_tsc4370.c   Sat Mar 26 06:55:55 2016
> (r297284)
> @@ -601,7 +601,7 @@ parse_boot_param(struct arm_boot_params
> inkernel_bootinfo = *(struct tsc_bootinfo *)(abp->abp_r1);
> }
>
> -   return fake_preload_metadata(abp);
> +   return fake_preload_metadata(abp, NULL, 0);
>  }
>
>  ARM_BOARD(NONE, "TSC4370 Controlle

Re: svn commit: r297284 - in head/sys/arm: arm at91 conf include

2016-03-26 Thread Andrew Turner
On Sat, 26 Mar 2016 15:07:55 +0100
Oliver Pinter  wrote:

> Hi Michal!
> 
> Is there any chance to add similar workaround to arm64 kernel too?
> There are some arm64 devices without UEFI for example Odroid C2 and
> Beelink Mini MX...

No, for these you should port loader, either use loader.efi with the
EFI support in U-Boot, use the port of ubldr, or write something new.

Andrew
___
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: r297293 - head/sys/boot/geli

2016-03-26 Thread Allan Jude
Author: allanjude
Date: Sat Mar 26 15:39:48 2016
New Revision: 297293
URL: https://svnweb.freebsd.org/changeset/base/297293

Log:
  Do not prompt for GELI passphrase is encrypted with keys only
  
  PR:   208251
  Submitted by: Fabian Keil 
  Sponsored by: ScaleEngine Inc.

Modified:
  head/sys/boot/geli/geliboot.c

Modified: head/sys/boot/geli/geliboot.c
==
--- head/sys/boot/geli/geliboot.c   Sat Mar 26 12:19:27 2016
(r297292)
+++ head/sys/boot/geli/geliboot.c   Sat Mar 26 15:39:48 2016
(r297293)
@@ -94,6 +94,11 @@ geli_taste(int read_func(void *vdev, voi
/* Disk is not GELI boot device, skip it */
return (1);
}
+   if (md.md_iterations < 0) {
+   /* XXX TODO: Support loading key files */
+   /* Disk does not have a passphrase, skip it */
+   return (1);
+   }
geli_e = malloc(sizeof(struct geli_entry));
if (geli_e == NULL)
return (2);
@@ -137,7 +142,10 @@ geli_attach(struct dsk *dskp, const char
/*
 * Prepare Derived-Key from the user passphrase.
 */
-   if (geli_e->md.md_iterations == 0) {
+   if (geli_e->md.md_iterations < 0) {
+   /* XXX TODO: Support loading key files */
+   return (1);
+   } else if (geli_e->md.md_iterations == 0) {
g_eli_crypto_hmac_update(&ctx, geli_e->md.md_salt,
sizeof(geli_e->md.md_salt));
g_eli_crypto_hmac_update(&ctx, passphrase,
___
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: r297294 - head/contrib/llvm/lib/Target/X86

2016-03-26 Thread Dimitry Andric
Author: dim
Date: Sat Mar 26 17:38:15 2016
New Revision: 297294
URL: https://svnweb.freebsd.org/changeset/base/297294

Log:
  Pull in r264465 from upstream llvm trunk (by David Majnemer):
  
[X86] Emit a proper ADJCALLSTACKDOWN in EmitLoweredTLSAddr
  
We forgot to add the second machine operand to our ADJCALLSTACKDOWN,
resulting in crashes in PEI.
  
This fixes PR27071.
  
  This should fix an assertion failure during buildworld, when using -Os,
  and targeting either i386 directly, or building the 32-bit libraries on
  amd64.
  
  Reported by:  Eric Camachat 

Modified:
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp

Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppSat Mar 26 
15:39:48 2016(r297293)
+++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppSat Mar 26 
17:38:15 2016(r297294)
@@ -22242,7 +22242,7 @@ X86TargetLowering::EmitLoweredTLSAddr(Ma
   // Emit CALLSEQ_START right before the instruction.
   unsigned AdjStackDown = TII.getCallFrameSetupOpcode();
   MachineInstrBuilder CallseqStart =
-BuildMI(MF, DL, TII.get(AdjStackDown)).addImm(0);
+BuildMI(MF, DL, TII.get(AdjStackDown)).addImm(0).addImm(0);
   BB->insert(MachineBasicBlock::iterator(MI), CallseqStart);
 
   // Emit CALLSEQ_END right after the instruction.
___
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: r297039 - head/sys/x86/x86

2016-03-26 Thread Konstantin Belousov
On Sat, Mar 26, 2016 at 03:17:43AM +1100, Bruce Evans wrote:
> This uses the i8254.
Well, this is the part which I do not like most.  It is ridiculous
to calibrate relatively high-quality CPU oscillator with 8245 timer,
which often fed from separate, low-quality crystal which currently
selected by cost and exists only for legacy purposes.  At least
some hypervisors start offering modes where old ISA peripherals
are not emulated, and I suspect that hardware would start do the
same.  Quite possible, some variants of SoCs already do this.

More, we do not have any hooks to recalibrate our thought about
TSC frequency during normal runtime.  Often, system does have very
precise measurement of the timecounter drift due to ntp/ptp.

> xdel() is a specialized version of i8254 DELAY()
> with getit() inline.  It returns the initial and final values of the
> i8254 counter.  It doesn't handle interrupts or any other source of
> large clock jitter.  What it measures more precisely is the measurement
> overhead.  This is normally 2-5 usec.  With a timer frequency of about
> 1 MHz, a 5 usec error is about 5 ppm.  Compensating for this reduces
> the error to below 1 ppm if there are no interrupts,
> 
> tsc_calibrate() calls xdel() twice to determine the measurement overhead.
> It should be called one more time to warm up the cache.
> 
> In other kernels, I use the following version using DELAY() which is
> good enough if DELAY() works and is not delayed by interrupts
> 
> X diff -c2 ./x86/x86/tsc.c~ ./x86/x86/tsc.c
> X *** ./x86/x86/tsc.c~Sun Feb 14 21:56:28 2016
> X --- ./x86/x86/tsc.c Sun Feb 14 22:01:46 2016
> X ***
> X *** 240,244 
> X   {
> X u_int regs[4];
> X !   uint64_t tsc1, tsc2;
> X 
> X if (cpu_high >= 6) {
> X --- 240,244 
> X   {
> X u_int regs[4];
> X !   uint64_t tsc1, tsc2, tsc3;
> X 
> X if (cpu_high >= 6) {
> X ***
> X *** 306,313 
> X if (bootverbose)
> X printf("Calibrating TSC clock ... ");
> X tsc1 = rdtsc();
> X !   DELAY(100);
> X tsc2 = rdtsc();
> X !   tsc_freq = tsc2 - tsc1;
> X if (bootverbose)
> X printf("TSC clock: %ju Hz\n", (intmax_t)tsc_freq);
> X --- 306,316 
> X if (bootverbose)
> X printf("Calibrating TSC clock ... ");
> X +   DELAY(1000);
> X tsc1 = rdtsc();
> X !   DELAY(1000);
> X tsc2 = rdtsc();
> X !   DELAY(100);
> X !   tsc3 = rdtsc();
> X !   tsc_freq = tsc3 - tsc2 - (tsc2 - tsc1);
> X if (bootverbose)
> X printf("TSC clock: %ju Hz\n", (intmax_t)tsc_freq);
> 
> See also kern_tc.c:cpu_tick_calibrate().  This is quite accurate after
> fixing its bugs.  It gets accuracy by timing over 16 seconds instead of
> 1 and by using a timecounter which is assumed to be accurate.
> 
> See also tsccalib/tsccalib.c in my home directory on freefall.  This
> is a refined version of the above.  It uses the time returned by
> clock_gettime() as a reference.  It compensates for interrupts and
> runs for long enough to get the specified accuracy.  If you only want
> a low accuracy like 1 ppm, this takes 1.8 msec on freefall (this depends
> a lot on the speed of clock_gettime(2) -- 1.8 msec is with the fast
> TSC timecounter in libc).
> 
> The worst case for all of these methods is if the i8254 is the only
> timer.  Then tsccalib takes much longer to get an accurate calibration
> because the error reading the timer is about its access time which is
> very large for the i8254.  The i8254 otherwise works perfectly for
> calibration provided its wrapping is always detected.
> 
> > Below is the patch to implement calibration of the ipi_wait() busy loop.
> > On my sandybridge 3.4Ghz, I get the message
> > LAPIC: ipi_wait() us multiplier 37 (r 128652089678 tsc 3392383992)
> 
> This seems OK, but it might belong closer to DELAY().
> 
> > ...
> > +   counter = lapic_ipi_wait_mult * delay;
> > +   for (i = 0; i < counter; i++) {
> > if ((lapic_read_icr_lo() & APIC_DELSTAT_MASK) ==
> > APIC_DELSTAT_IDLE)
> > return (1);
> > -   DELAY(1);
> > +   ia32_pause();
> > }
> 
> This part is basically DELAY() implemented as a simple loop with a
> callback in the loop.  I don't like callbacks and prefer direct code
> like the above.  The direct code is basically DELAY() implemented as
> a simple loop and cloned to add a simple check on very iteration.
I thought about callback interface to DELAY().  We already have
something quite close imported from Linux, see
sys/dev/drm2/i915/intel_drv.h:_intel_wait_for and _wait_for
macros.  But this is for different change as well.

I will wait some time for John opinion on the patch.

> 
> If an error factor of 10 or so is acceptable, then the simple loop
> is good enough for DELAY() too.  Or DELAY() can do:
> 
>   while (n > 1000)
>   recalibrate_every_millisecond_while_reducing_n();
>   /*
>* We can't reasonably get better accuracy tha

svn commit: r297295 - head/sys/arm/allwinner

2016-03-26 Thread Andrew Turner
Author: andrew
Date: Sat Mar 26 17:49:46 2016
New Revision: 297295
URL: https://svnweb.freebsd.org/changeset/base/297295

Log:
  Only define the platform methods for the Allwinner platforms we are
  building for.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/allwinner_machdep.c

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Sat Mar 26 17:38:15 2016
(r297294)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Sat Mar 26 17:49:46 2016
(r297295)
@@ -140,6 +140,7 @@ cpu_reset()
while (1);
 }
 
+#if defined(SOC_ALLWINNER_A10)
 static platform_method_t a10_methods[] = {
PLATFORMMETHOD(platform_attach, a10_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -147,7 +148,10 @@ static platform_method_t a10_methods[] =
 
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
+#endif
 
+#if defined(SOC_ALLWINNER_A20)
 static platform_method_t a20_methods[] = {
PLATFORMMETHOD(platform_attach, a20_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -159,7 +163,10 @@ static platform_method_t a20_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
+#endif
 
+#if defined(SOC_ALLWINNER_A31)
 static platform_method_t a31_methods[] = {
PLATFORMMETHOD(platform_attach, a31_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -171,7 +178,10 @@ static platform_method_t a31_methods[] =
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
+#endif
 
+#if defined(SOC_ALLWINNER_A31S)
 static platform_method_t a31s_methods[] = {
PLATFORMMETHOD(platform_attach, a31s_attach),
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
@@ -183,6 +193,8 @@ static platform_method_t a31s_methods[] 
 #endif
PLATFORMMETHOD_END,
 };
+FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
+#endif
 
 u_int
 allwinner_soc_type(void)
@@ -195,8 +207,3 @@ allwinner_soc_family(void)
 {
return (soc_family);
 }
-
-FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
-FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
-FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
-FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
___
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: r297296 - head/sys/compat/linux

2016-03-26 Thread Dmitry Chagin
Author: dchagin
Date: Sat Mar 26 19:15:23 2016
New Revision: 297296
URL: https://svnweb.freebsd.org/changeset/base/297296

Log:
  Implement O_NONBLOCK flag via fcntl(F_SETFL) for eventfd object.
  
  MFC after:1 week

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

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sat Mar 26 17:49:46 2016
(r297295)
+++ head/sys/compat/linux/linux_event.c Sat Mar 26 19:15:23 2016
(r297296)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -871,8 +872,24 @@ static int
 eventfd_ioctl(struct file *fp, u_long cmd, void *data,
struct ucred *active_cred, struct thread *td)
 {
+   struct eventfd *efd;
 
-   return (ENXIO);
+   efd = fp->f_data;
+   if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
+   return (EINVAL);
+
+   switch (cmd)
+   {
+   case FIONBIO:
+   if (*(int *)data)
+   efd->efd_flags |= LINUX_O_NONBLOCK;
+   else
+   efd->efd_flags &= ~LINUX_O_NONBLOCK;
+   case FIOASYNC:
+   return (0);
+   default:
+   return (ENXIO);
+   }
 }
 
 /*ARGSUSED*/
___
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: r297297 - head/sys/compat/linux

2016-03-26 Thread Dmitry Chagin
Author: dchagin
Date: Sat Mar 26 19:16:53 2016
New Revision: 297297
URL: https://svnweb.freebsd.org/changeset/base/297297

Log:
  When write(2) on eventfd object fails with the error EAGAIN do not return
  the number of bytes written.
  
  MFC after:1 week

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

Modified: head/sys/compat/linux/linux_event.c
==
--- head/sys/compat/linux/linux_event.c Sat Mar 26 19:15:23 2016
(r297296)
+++ head/sys/compat/linux/linux_event.c Sat Mar 26 19:16:53 2016
(r297297)
@@ -751,6 +751,8 @@ retry:
if (UINT64_MAX - efd->efd_count <= count) {
if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
mtx_unlock(&efd->efd_lock);
+   /* Do not not return the number of bytes written */
+   uio->uio_resid += sizeof(eventfd_t);
return (EAGAIN);
}
error = mtx_sleep(&efd->efd_count, &efd->efd_lock,
___
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: r297039 - head/sys/x86/x86

2016-03-26 Thread Bruce Evans

On Sat, 26 Mar 2016, Konstantin Belousov wrote:


On Sat, Mar 26, 2016 at 03:17:43AM +1100, Bruce Evans wrote:

This uses the i8254.

Well, this is the part which I do not like most.  It is ridiculous
to calibrate relatively high-quality CPU oscillator with 8245 timer,
which often fed from separate, low-quality crystal which currently
selected by cost and exists only for legacy purposes.  At least


I haven't seen a single (hardware) system since I started measuring
this 15-20 yeas ago on which the i8524 is not fed from the same clock
as the TSC.  Normally there is a PLL that can derives hundreds of
different frequencies from the same clock.  One is fed to the i8254,
one to the ACPI timer and one to the CPU clock/TSC.


some hypervisors start offering modes where old ISA peripherals
are not emulated, and I suspect that hardware would start do the
same.  Quite possible, some variants of SoCs already do this.


Bug in these hypervisors.  A slow clock like the i8254 is much easier
to emulate than a fast one.  It is impossible to emulate real time on
a non-real-time system anyway, so almost all calibration code is likely
to break in inverse proportion to its accuracy on real hardware.


More, we do not have any hooks to recalibrate our thought about
TSC frequency during normal runtime.  Often, system does have very
precise measurement of the timecounter drift due to ntp/ptp.


cpu_tick_calibrate() does exactly this (if the ticker is the TSC).

My version has a precise (~1-10 usec) measurement of the timecounter drift
relative to the RTC (or vice-versa).  This is used some time after
exit from ddb to fix up the timecounter.  This depends on RTC seconds
interrupts being perfectly periodic with low (or at least measurable)
latency.  This should be used to fix up the timecounter after suspend/
resume.  An error of 1-10 usec is good enough for an ntpd server, but
the current ACPI error in resume is not good enough for an nptd client.


xdel() is a specialized version of i8254 DELAY()
with getit() inline.  It returns the initial and final values of the


It can use any readable timer, but only the i8254 is easy to use and
available on all (non-broken) x86 systems.  Just the
ifdefs/configuratation to use another timer would be very complicated.
Using the cputicker or timecounter read functions doesn't quite work
because these functions have unknown internals which might involve
unusable timing or lockimg.

Bruce
___
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: r297298 - in head/sys: dev/netmap kern

2016-03-26 Thread Navdeep Parhar
Author: np
Date: Sat Mar 26 23:39:53 2016
New Revision: 297298
URL: https://svnweb.freebsd.org/changeset/base/297298

Log:
  Plug leak in m_unshare.
  
  m_unshare passes on the source mbuf's flags as-is to m_getcl and this
  results in a leak if the flags include M_NOFREE.  The fix is to clear
  the bits not listed in M_COPYALL before calling m_getcl.  M_RDONLY
  should probably be filtered out too but that's outside the scope of this
  fix.
  
  Add assertions in the zone_mbuf and zone_pack ctors to catch similar
  bugs.
  
  Update netmap_get_mbuf to not pass M_NOFREE to m_getcl.  It's not clear
  what the original code was trying to do but it's likely incorrect.
  Updated code is no different functionally but it avoids the newly added
  assertions.
  
  Reviewed by:  gnn@
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D5698

Modified:
  head/sys/dev/netmap/netmap_generic.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/uipc_mbuf.c

Modified: head/sys/dev/netmap/netmap_generic.c
==
--- head/sys/dev/netmap/netmap_generic.cSat Mar 26 19:16:53 2016
(r297297)
+++ head/sys/dev/netmap/netmap_generic.cSat Mar 26 23:39:53 2016
(r297298)
@@ -129,8 +129,9 @@ static inline struct mbuf *
 netmap_get_mbuf(int len)
 {
struct mbuf *m;
-   m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR | M_NOFREE);
+   m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
if (m) {
+   m->m_flags |= M_NOFREE; /* XXXNP: Almost certainly incorrect. */
m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save
m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor;
m->m_ext.ext_type = EXT_EXTREF;

Modified: head/sys/kern/kern_mbuf.c
==
--- head/sys/kern/kern_mbuf.c   Sat Mar 26 19:16:53 2016(r297297)
+++ head/sys/kern/kern_mbuf.c   Sat Mar 26 23:39:53 2016(r297298)
@@ -424,6 +424,7 @@ mb_ctor_mbuf(void *mem, int size, void *
 
m = (struct mbuf *)mem;
flags = args->flags;
+   MPASS((flags & M_NOFREE) == 0);
 
error = m_init(m, how, type, flags);
 
@@ -572,6 +573,7 @@ mb_ctor_pack(void *mem, int size, void *
args = (struct mb_args *)arg;
flags = args->flags;
type = args->type;
+   MPASS((flags & M_NOFREE) == 0);
 
 #ifdef INVARIANTS
trash_ctor(m->m_ext.ext_buf, MCLBYTES, arg, how);

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Sat Mar 26 19:16:53 2016(r297297)
+++ head/sys/kern/uipc_mbuf.c   Sat Mar 26 23:39:53 2016(r297298)
@@ -1670,7 +1670,7 @@ m_unshare(struct mbuf *m0, int how)
 * don't know how to break up the non-contiguous memory when
 * doing DMA.
 */
-   n = m_getcl(how, m->m_type, m->m_flags);
+   n = m_getcl(how, m->m_type, m->m_flags & M_COPYFLAGS);
if (n == NULL) {
m_freem(m0);
return (NULL);
@@ -1700,7 +1700,7 @@ m_unshare(struct mbuf *m0, int how)
break;
off += cc;
 
-   n = m_getcl(how, m->m_type, m->m_flags);
+   n = m_getcl(how, m->m_type, m->m_flags & M_COPYFLAGS);
if (n == NULL) {
m_freem(mfirst);
m_freem(m0);
___
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: r297299 - in head: contrib/libcxxrt lib/libcxxrt

2016-03-26 Thread Dimitry Andric
Author: dim
Date: Sun Mar 27 00:37:54 2016
New Revision: 297299
URL: https://svnweb.freebsd.org/changeset/base/297299

Log:
  Compile libcxxrt as C++11, since it is only really used in combination
  with libc++, which is also C++11.  Also change one _Static_assert (which
  is really C11) back into static_assert, like upstream.
  
  This should help when compiling libcxxrt with newer versions of gcc,
  which refuse to recognize any form of static assertions, if not
  compiling for C++11 or higher.
  
  While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++
  headers outside the source tree.

Modified:
  head/contrib/libcxxrt/guard.cc
  head/lib/libcxxrt/Makefile

Modified: head/contrib/libcxxrt/guard.cc
==
--- head/contrib/libcxxrt/guard.cc  Sat Mar 26 23:39:53 2016
(r297298)
+++ head/contrib/libcxxrt/guard.cc  Sun Mar 27 00:37:54 2016
(r297299)
@@ -101,7 +101,7 @@ typedef struct {
uint32_t init_half;
uint32_t lock_half;
 } guard_t;
-_Static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
+static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
 static const uint32_t LOCKED = 1;
 static const uint32_t INITIALISED = static_cast(1) << 24;
 #  endif

Modified: head/lib/libcxxrt/Makefile
==
--- head/lib/libcxxrt/Makefile  Sat Mar 26 23:39:53 2016(r297298)
+++ head/lib/libcxxrt/Makefile  Sun Mar 27 00:37:54 2016(r297299)
@@ -20,7 +20,10 @@ SRCS+=   libelftc_dem_gnu3.c\
guard.cc
 
 WARNS= 0
-CFLAGS+=   -I${SRCDIR}
+CFLAGS+=   -I${SRCDIR} -nostdinc++
+.if empty(CXXFLAGS:M-std=*)
+CXXFLAGS+= -std=c++11
+.endif
 VERSION_MAP=   ${.CURDIR}/Version.map
 
 .include 
___
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"