svn commit: r357250 - head/sys/arm64/rockchip/clk

2020-01-29 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Wed Jan 29 08:46:35 2020
New Revision: 357250
URL: https://svnweb.freebsd.org/changeset/base/357250

Log:
  Add USB3 related clock definitions for Rockchip RK3328 SoC.
  
  Reviewed by:  manu

Modified:
  head/sys/arm64/rockchip/clk/rk3328_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3328_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3328_cru.cWed Jan 29 05:59:22 2020
(r357249)
+++ head/sys/arm64/rockchip/clk/rk3328_cru.cWed Jan 29 08:46:35 2020
(r357250)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
 
 /* GATES */
 
+#defineSCLK_USB3OTG_REF96
+#defineACLK_USB3OTG132
 #defineACLK_PERI   153
 #definePCLK_GPIO0  200
 #definePCLK_GPIO1  201
@@ -61,6 +63,9 @@ __FBSDID("$FreeBSD$");
 #definePCLK_I2C2   207
 #definePCLK_I2C3   208
 #definePCLK_TSADC  213
+#definePCLK_USB3PHY_OTG224
+#definePCLK_USB3PHY_PIPE   225
+#definePCLK_USB3_GRF   226
 #defineHCLK_SDMMC  317
 #defineHCLK_SDIO   318
 #defineHCLK_EMMC   319
@@ -76,6 +81,7 @@ static struct rk_cru_gate rk3328_gates[] = {
/* CRU_CLKGATE_CON4 */
CRU_GATE(0, "gpll_peri", "gpll", 0x210, 0)
CRU_GATE(0, "cpll_peri", "cpll", 0x210, 1)
+   CRU_GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0x210, 7)
 
/* CRU_CLKGATE_CON8 */
CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3)
@@ -98,13 +104,21 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0x240, 9)
CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0x240, 10)
 
+   /* CRU_CLKGATE_CON17 */
+   CRU_GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", 0x244, 2)
+
/* CRU_CLKGATE_CON19 */
CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0x24C, 0)
CRU_GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0x24C, 1)
CRU_GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0x24C, 2)
CRU_GATE(0, "hclk_peri_niu", "hclk_peri", 0x24C, 12)
CRU_GATE(0, "pclk_peri_niu", "hclk_peri", 0x24C, 13)
+   CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14)
CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15)
+
+   /* CRU_CLKGATE_CON28 */
+   CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1)
+   CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 
2)
 };
 
 /*
@@ -991,6 +1005,78 @@ static struct rk_clk_composite_def i2c3 = {
.flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+#defineSCLK_USB3_REF   72
+#defineSCLK_USB3_SUSPEND   73
+#defineSCLK_USB3PHY_REF94
+#defineSCLK_REF_USB3OTG95
+#defineSCLK_USB3OTG_SUSPEND97
+#defineSCLK_REF_USB3OTG_SRC98
+
+static const char *ref_usb3otg_parents[] = { "xin24m", "clk_usb3otg_ref" };
+
+static struct rk_clk_composite_def ref_usb3otg = {
+   .clkdef = {
+   .id = SCLK_REF_USB3OTG,
+   .name = "clk_ref_usb3otg",
+   .parent_names = ref_usb3otg_parents,
+   .parent_cnt = nitems(ref_usb3otg_parents),
+   },
+   .muxdiv_offset = 0x1B4,
+
+   .mux_shift = 8,
+   .mux_width = 1,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX,
+};
+
+static const char *usb3otg_suspend_parents[] = { "xin24m"/*, "clk_rtc32k" */};
+
+static struct rk_clk_composite_def usb3otg_suspend = {
+   .clkdef = {
+   .id = SCLK_USB3OTG_SUSPEND,
+   .name = "clk_usb3otg_suspend",
+   .parent_names = usb3otg_suspend_parents,
+   .parent_cnt = nitems(usb3otg_suspend_parents),
+   },
+   .muxdiv_offset = 0x184,
+
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 10,
+
+   /* CRU_CLKGATE_CON4 */
+   .gate_offset = 0x210,
+   .gate_shift = 8,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static const char *ref_usb3otg_src_parents[] = { "cpll", "gpll" };
+
+static struct rk_clk_composite_def ref_usb3otg_src = {
+   .clkdef = {
+   .id = SCLK_REF_USB3OTG_SRC,
+   .name = "clk_ref_usb3otg_src",
+   .parent_names = ref_usb3otg_src_parents,
+   .parent_cnt = nitems(ref_usb3otg_src_parents),
+   },
+   .muxdiv_offset = 0x1B4,
+
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON4 */
+   .gate_offset = 0x210,
+   .gate_shift = 9,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
 static struct rk_clk rk3328_clks[] = {
{
.type = RK3328_CLK_PLL,
@@ -1075,6 +1161,19 @@ static struct rk_clk rk3328

svn commit: r357252 - head/sys/arm64/rockchip

2020-01-29 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Wed Jan 29 09:36:59 2020
New Revision: 357252
URL: https://svnweb.freebsd.org/changeset/base/357252

Log:
  Enable USB3 support for Rockchip RK3328 SoC.
  
  Reviewed by:  manu

Modified:
  head/sys/arm64/rockchip/rk_dwc3.c

Modified: head/sys/arm64/rockchip/rk_dwc3.c
==
--- head/sys/arm64/rockchip/rk_dwc3.c   Wed Jan 29 09:33:40 2020
(r357251)
+++ head/sys/arm64/rockchip/rk_dwc3.c   Wed Jan 29 09:36:59 2020
(r357252)
@@ -54,8 +54,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+enum rk_dwc3_type {
+   RK3328 = 1,
+   RK3399,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "rockchip,rk3399-dwc3",   1 },
+   { "rockchip,rk3328-dwc3",   RK3328 },
+   { "rockchip,rk3399-dwc3",   RK3399 },
{ NULL, 0 }
 };
 
@@ -69,6 +75,7 @@ struct rk_dwc3_softc {
clk_t   clk_usb3;
clk_t   clk_grf;
hwreset_t   rst_usb3;
+   enum rk_dwc3_type   type;
 };
 
 static int
@@ -102,6 +109,7 @@ rk_dwc3_attach(device_t dev)
sc = device_get_softc(dev);
sc->dev = dev;
node = ofw_bus_get_node(dev);
+   sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
 
/* Mandatory clocks */
if (clk_get_by_ofw_name(dev, 0, "ref_clk", &sc->clk_ref) != 0) {
@@ -134,17 +142,18 @@ rk_dwc3_attach(device_t dev)
clk_get_name(sc->clk_bus));
return (ENXIO);
}
-   if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) {
-   device_printf(dev, "Cannot get grf_clk clock\n");
-   return (ENXIO);
+   if (sc->type == RK3399) {
+   if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) {
+   device_printf(dev, "Cannot get grf_clk clock\n");
+   return (ENXIO);
+   }
+   err = clk_enable(sc->clk_grf);
+   if (err != 0) {
+   device_printf(dev, "Could not enable clock %s\n",
+   clk_get_name(sc->clk_grf));
+   return (ENXIO);
+   }
}
-   err = clk_enable(sc->clk_grf);
-   if (err != 0) {
-   device_printf(dev, "Could not enable clock %s\n",
-   clk_get_name(sc->clk_grf));
-   return (ENXIO);
-   }
-
/* Optional clocks */
if (clk_get_by_ofw_name(dev, 0, "aclk_usb3_rksoc_axi_perf", 
&sc->clk_axi_perf) == 0) {
err = clk_enable(sc->clk_axi_perf);
___
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: r357253 - head/sys/vm

2020-01-29 Thread Konstantin Belousov
Author: kib
Date: Wed Jan 29 12:02:47 2020
New Revision: 357253
URL: https://svnweb.freebsd.org/changeset/base/357253

Log:
  Restore OOM logic on page fault after r357026.
  
  Right now OOM is initiated unconditionally on the page allocation
  failure, after the wait.
  
  Reported by:  Mark Millard 
  Reviewed by:  cy, markj
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D23409

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed Jan 29 09:36:59 2020(r357252)
+++ head/sys/vm/vm_fault.c  Wed Jan 29 12:02:47 2020(r357253)
@@ -1073,12 +1073,14 @@ vm_fault_allocate(struct faultstate *fs)
fs->oom < vm_pfault_oom_attempts) {
fs->oom++;
vm_waitpfault(dset, vm_pfault_oom_wait * hz);
+   } else  {
+   if (bootverbose)
+   printf(
+   "proc %d (%s) failed to alloc page on fault, starting OOM\n",
+   curproc->p_pid, curproc->p_comm);
+   vm_pageout_oom(VM_OOM_MEM_PF);
+   fs->oom = 0;
}
-   if (bootverbose)
-   printf(
-"proc %d (%s) failed to alloc page on fault, starting OOM\n",
-   curproc->p_pid, curproc->p_comm);
-   vm_pageout_oom(VM_OOM_MEM_PF);
return (KERN_RESOURCE_SHORTAGE);
}
fs->oom = 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: r357254 - in head/sys: dts/arm64/overlays modules/dtb/rockchip

2020-01-29 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Wed Jan 29 12:10:42 2020
New Revision: 357254
URL: https://svnweb.freebsd.org/changeset/base/357254

Log:
  Add an overlay for RK3328 USB3 node.
  It doesn't exist in mainline dts due to the issues related
  with detaching and reattaching USB3 devices as mentioned in
  https://patchwork.kernel.org/patch/10853381/
  In case of FreeBSD, as a temporary workaround "usbconfig reset"
  command can fix the problem.
  
  Reviewed by:  manu

Added:
  head/sys/dts/arm64/overlays/rk3328-dwc3.dtso   (contents, props changed)
Modified:
  head/sys/modules/dtb/rockchip/Makefile

Added: head/sys/dts/arm64/overlays/rk3328-dwc3.dtso
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dts/arm64/overlays/rk3328-dwc3.dtsoWed Jan 29 12:10:42 
2020(r357254)
@@ -0,0 +1,39 @@
+/dts-v1/;
+/plugin/;
+
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "rockchip,rk3328";
+};
+
+&{/} {
+   usbdrd3: usb@ff60 {
+   compatible = "rockchip,rk3328-dwc3";
+   clocks = <&cru SCLK_USB3OTG_REF>, <&cru SCLK_USB3OTG_SUSPEND>,
+<&cru ACLK_USB3OTG>;
+   clock-names = "ref_clk", "suspend_clk",
+ "bus_clk";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+   status = "okay";
+
+   usbdrd_dwc3: dwc3@ff60 {
+   compatible = "snps,dwc3";
+   reg = <0x0 0xff60 0x0 0x10>;
+   interrupts = ;
+   dr_mode = "host";
+   phy_type = "utmi_wide";
+   snps,dis_enblslpm_quirk;
+   snps,dis-u2-freeclk-exists-quirk;
+   snps,dis_u2_susphy_quirk;
+   snps,dis_u3_susphy_quirk;
+   snps,dis-del-phy-power-chg-quirk;
+   snps,dis-tx-ipgap-linecheck-quirk;
+   status = "okay";
+   };
+   };
+};

Modified: head/sys/modules/dtb/rockchip/Makefile
==
--- head/sys/modules/dtb/rockchip/Makefile  Wed Jan 29 12:02:47 2020
(r357253)
+++ head/sys/modules/dtb/rockchip/Makefile  Wed Jan 29 12:10:42 2020
(r357254)
@@ -7,4 +7,6 @@ DTS=\
rockchip/rk3328-rock64.dts \
rockchip/rk3399-rockpro64.dts
 
+DTSO=  rk3328-dwc3.dtso
+
 .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"


svn commit: r357255 - head/sys/riscv/include

2020-01-29 Thread Mitchell Horne
Author: mhorne
Date: Wed Jan 29 15:50:48 2020
New Revision: 357255
URL: https://svnweb.freebsd.org/changeset/base/357255

Log:
  Fix definition of SSTATUS_SD
  
  The SD bit is defined as the MSB of the sstatus register, meaning its
  position will vary depending on the CSR's length. Previously, there were
  two (unused) defines for this, for the 32 and 64-bit cases, but their
  definitions were swapped.
  
  Consolidate these into one define: SSTATUS_SD, and make the definition
  dependent on the value of __riscv_xlen.
  
  Reviewed by:  br
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D23402

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==
--- head/sys/riscv/include/riscvreg.h   Wed Jan 29 12:10:42 2020
(r357254)
+++ head/sys/riscv/include/riscvreg.h   Wed Jan 29 15:50:48 2020
(r357255)
@@ -72,8 +72,11 @@
 #defineSSTATUS_XS_SHIFT15
 #defineSSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
 #defineSSTATUS_SUM (1 << 18)
-#defineSSTATUS32_SD(1 << 63)
-#defineSSTATUS64_SD(1 << 31)
+#if __riscv_xlen == 64
+#defineSSTATUS_SD  (1 << 63)
+#else
+#defineSSTATUS_SD  (1 << 31)
+#endif
 
 #defineMSTATUS_UIE (1 << 0)
 #defineMSTATUS_SIE (1 << 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: r357256 - head/sys/dev/cadence

2020-01-29 Thread Mitchell Horne
Author: mhorne
Date: Wed Jan 29 15:58:19 2020
New Revision: 357256
URL: https://svnweb.freebsd.org/changeset/base/357256

Log:
  cgem: Add another compat string for the SiFive fu540
  
  Newer device trees use "sifive,fu540-c000-gem" instead of "cdns,macb".
  
  Reviewed by:  br, kp
  Differential Revision:https://reviews.freebsd.org/D23407

Modified:
  head/sys/dev/cadence/if_cgem.c

Modified: head/sys/dev/cadence/if_cgem.c
==
--- head/sys/dev/cadence/if_cgem.c  Wed Jan 29 15:50:48 2020
(r357255)
+++ head/sys/dev/cadence/if_cgem.c  Wed Jan 29 15:58:19 2020
(r357256)
@@ -99,9 +99,10 @@ __FBSDID("$FreeBSD$");
 CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
 
 static struct ofw_compat_data compat_data[] = {
-   { "cadence,gem",1 },
-   { "cdns,macb",  1 },
-   { NULL, 0 },
+   { "cadence,gem",1 },
+   { "cdns,macb",  1 },
+   { "sifive,fu540-c000-gem",  1 },
+   { NULL, 0 },
 };
 
 struct cgem_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: r357257 - head/release/packages

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 16:24:16 2020
New Revision: 357257
URL: https://svnweb.freebsd.org/changeset/base/357257

Log:
  pkgbase: kill off clibs.ucl and docs.ucl
  
  These are just direct copies of the template. If they don't exist but are
  attempted to be used, generate-ucl.sh will simply fallback to the template
  anyways. Let it do so to reduce potential maintenance burden.

Deleted:
  head/release/packages/clibs.ucl
  head/release/packages/docs.ucl
___
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: r357246 - head/tests/sys/sys

2020-01-29 Thread Li-Wen Hsu
On Wed, Jan 29, 2020 at 1:25 PM Conrad Meyer  wrote:
>
> Author: cem
> Date: Wed Jan 29 05:25:20 2020
> New Revision: 357246
> URL: https://svnweb.freebsd.org/changeset/base/357246
>
> Log:
>   qmath(3) test: Replace overcomplicated abomination with arc4random(3)
>
>   The horrific GENRAND construction bent over backwards to construct 64-bit
>   signed integers from the 31-bit output of random(3) for about 20 numbers per
>   test.  Reproducibility wasn't a goal: random(3) was seeded with
>   srandomdev(3).  Speed is not a factor for generating 20 integers with
>   arc4random(3).  Range is not a factor: all uses did not bound the range
>   beyond that of the full [INT64_MIN, INT64_MAX].  Just use arc4random(3).
>
>   Reported by:  Coverity
>   CIDs: 1404809, 1404817, 1404838, 1404840 and about 6x other
> identical reports of dubious code relating to the
> construction
>
> Modified:
>   head/tests/sys/sys/qmath_test.c

These two test cases are starting failing since this commit:
https://ci.freebsd.org/job/FreeBSD-head-amd64-test/14110/testReport/sys.sys/qmath_test/qsubi_s64q/
https://ci.freebsd.org/job/FreeBSD-head-amd64-test/14110/testReport/sys.sys/qmath_test/qsubq_s64q/

Can you help check them? Thanks!

Li-Wen
___
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: r357258 - in head/sys: conf dev/xilinx

2020-01-29 Thread Ruslan Bukin
Author: br
Date: Wed Jan 29 16:52:12 2020
New Revision: 357258
URL: https://svnweb.freebsd.org/changeset/base/357258

Log:
  Add driver for Xilinx XDMA PCIe Bridge found in the U.S. Government
  Furnished Equipment (GFE) riscv cores.
  
  GFE cores are synthesized on the Xilinx Virtex UltraScale+ FPGA VCU118
  Evaluation Kit.
  
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D23337

Added:
  head/sys/dev/xilinx/xlnx_pcib.c   (contents, props changed)
  head/sys/dev/xilinx/xlnx_pcib.h   (contents, props changed)
Modified:
  head/sys/conf/files.riscv

Modified: head/sys/conf/files.riscv
==
--- head/sys/conf/files.riscv   Wed Jan 29 16:24:16 2020(r357257)
+++ head/sys/conf/files.riscv   Wed Jan 29 16:52:12 2020(r357258)
@@ -14,6 +14,7 @@ dev/uart/uart_dev_lowrisc.c   optionaluart_lowrisc
 dev/xilinx/axi_quad_spi.c  optionalxilinx_spi
 dev/xilinx/axidma.coptionalaxidma xdma
 dev/xilinx/if_xae.coptionalxae
+dev/xilinx/xlnx_pcib.c optionalpci fdt xlnx_pcib
 kern/kern_clocksource.cstandard
 kern/msi_if.m  standard
 kern/pic_if.m  standard

Added: head/sys/dev/xilinx/xlnx_pcib.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/xilinx/xlnx_pcib.c Wed Jan 29 16:52:12 2020
(r357258)
@@ -0,0 +1,794 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 Ruslan Bukin 
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "opt_platform.h"
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "xlnx_pcib.h"
+
+#include "ofw_bus_if.h"
+#include "msi_if.h"
+#include "pcib_if.h"
+#include "pic_if.h"
+
+#defineXLNX_PCIB_MAX_MSI   64
+
+static int xlnx_pcib_fdt_attach(device_t);
+static int xlnx_pcib_fdt_probe(device_t);
+static int xlnx_pcib_fdt_get_id(device_t, device_t, enum pci_id_type,
+uintptr_t *);
+static void xlnx_pcib_msi_mask(device_t dev, struct intr_irqsrc *isrc,
+bool mask);
+
+struct xlnx_pcib_softc {
+   struct generic_pcie_fdt_softc   fdt_sc;
+   struct resource *res[4];
+   struct mtx  mtx;
+   vm_offset_t msi_page;
+   struct xlnx_pcib_irqsrc *isrcs;
+   device_tdev;
+   void*intr_cookie[3];
+};
+
+static struct resource_spec xlnx_pcib_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  1,  RF_ACTIVE },
+   { SYS_RES_IRQ,  2,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+struct xlnx_pcib_irqsrc {
+   struct intr_irqsrc  isrc;
+   u_int   irq;
+#defineXLNX_IRQ_FLAG_USED  (1 << 0)
+   u_int   flags;
+};
+
+static void
+xlnx_pcib_clear_err_interrupts(struct generic_pcie_core_softc *s

svn commit: r357261 - in head: share/misc usr.bin/calendar/calendars

2020-01-29 Thread Alfredo Dal'Ava Junior
Author: alfredo
Date: Wed Jan 29 17:39:38 2020
New Revision: 357261
URL: https://svnweb.freebsd.org/changeset/base/357261

Log:
  Add myself (alfredo) to committers-src.dot and calendar.freebsd
  
  Approved by:  jhibbits (mentor)

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Wed Jan 29 17:01:02 2020
(r357260)
+++ head/share/misc/committers-src.dot  Wed Jan 29 17:39:38 2020
(r357261)
@@ -105,6 +105,7 @@ adrian [label="Adrian Chadd\nadr...@freebsd.org\n2000/
 ae [label="Andrey V. Elsukov\n...@freebsd.org\n2010/06/03"]
 akiyama [label="Shunsuke Akiyama\nakiy...@freebsd.org\n2000/06/19"]
 alc [label="Alan Cox\n...@freebsd.org\n1999/02/23"]
+alfredo [label="Alfredo Dal'Ava Junior\nalfr...@freebsd.org\n2020/01/27"]
 allanjude [label="Allan Jude\nallanj...@freebsd.org\n2015/07/30"]
 ambrisko [label="Doug Ambrisko\nambri...@freebsd.org\n2001/12/19"]
 anchie [label="Ana Kukec\nanc...@freebsd.org\n2010/04/14"]
@@ -613,6 +614,7 @@ jhb -> rpokala
 jhb -> arichardson
 jhb -> scottph
 
+jhibbits -> alfredo
 jhibbits -> bdragon
 jhibbits -> leitao
 jhibbits -> luporl

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdWed Jan 29 17:01:02 
2020(r357260)
+++ head/usr.bin/calendar/calendars/calendar.freebsdWed Jan 29 17:39:38 
2020(r357261)
@@ -324,6 +324,7 @@
 08/19  Chin-San Huang  born in Yi-Lan, Taiwan, Republic 
of China, 1979
 08/19  Pav Lucistnik  born in Kutna Hora, Czech Republic, 
1980
 08/20  Michael Heffner  born in Cleona, Pennsylvania, 
United States, 1981
+08/21  Alfredo Dal'Ava Junior  born in Pocos de Caldas, 
Minas Gerais, Brazil, 1981
 08/21  Jason A. Harmening  born in Fort Wayne, Indiana, 
United States, 1981
 08/22  Ilya Bakulin  born in Tbilisi, USSR, 1986
 08/24  Mark Linimon  born in Houston, Texas, United 
States, 1955
___
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: r357262 - head/sys/powerpc/powernv

2020-01-29 Thread Leandro Lupori
Author: luporl
Date: Wed Jan 29 18:13:44 2020
New Revision: 357262
URL: https://svnweb.freebsd.org/changeset/base/357262

Log:
  [PPC64] Fix NUMA on POWER8
  
  On some POWER8 machines, 'ibm,associativity' property may have 6
  cells, which would overflow the 5 cells buffer being used.
  There was also an issue with the "check if node is root" part,
  that have been fixed too.
  
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D23414

Modified:
  head/sys/powerpc/powernv/platform_powernv.c

Modified: head/sys/powerpc/powernv/platform_powernv.c
==
--- head/sys/powerpc/powernv/platform_powernv.c Wed Jan 29 17:39:38 2020
(r357261)
+++ head/sys/powerpc/powernv/platform_powernv.c Wed Jan 29 18:13:44 2020
(r357262)
@@ -517,17 +517,20 @@ powernv_node_numa_domain(platform_t platform, phandle_
cell_t associativity[5];
int i, res;
 
-   res = OF_getproplen(node, "ibm,associativity");
+   res = OF_getencprop(node, "ibm,associativity",
+   associativity, sizeof(associativity));
 
-   /* If already at the root, use default domain. */
-   if (res == 0)
-   return (0);
-   else if (res < 0)
-   /* If this node doesn't have associativity, check its parent. */
-   return (powernv_node_numa_domain(platform, OF_parent(node)));
-
-   OF_getencprop(node, "ibm,associativity",
-   associativity, res);
+   /*
+* If this node doesn't have associativity, or if there are not
+* enough elements in it, check its parent.
+*/
+   if (res < (int)(sizeof(cell_t) * (platform_associativity + 1))) {
+   node = OF_parent(node);
+   /* If already at the root, use default domain. */
+   if (node == 0)
+   return (0);
+   return (powernv_node_numa_domain(platform, node));
+   }
 
for (i = 0; i < numa_max_domain; i++) {
if (numa_domains[i] == associativity[platform_associativity])
___
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: r357253 - head/sys/vm

2020-01-29 Thread Jeff Roberson

Thank you,
Jeff

On Wed, 29 Jan 2020, Konstantin Belousov wrote:


Author: kib
Date: Wed Jan 29 12:02:47 2020
New Revision: 357253
URL: https://svnweb.freebsd.org/changeset/base/357253

Log:
 Restore OOM logic on page fault after r357026.

 Right now OOM is initiated unconditionally on the page allocation
 failure, after the wait.

 Reported by:   Mark Millard 
 Reviewed by:   cy, markj
 Sponsored by:  The FreeBSD Foundation
 Differential revision: https://reviews.freebsd.org/D23409

Modified:
 head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed Jan 29 09:36:59 2020(r357252)
+++ head/sys/vm/vm_fault.c  Wed Jan 29 12:02:47 2020(r357253)
@@ -1073,12 +1073,14 @@ vm_fault_allocate(struct faultstate *fs)
fs->oom < vm_pfault_oom_attempts) {
fs->oom++;
vm_waitpfault(dset, vm_pfault_oom_wait * hz);
+   } else  {
+   if (bootverbose)
+   printf(
+   "proc %d (%s) failed to alloc page on fault, starting OOM\n",
+   curproc->p_pid, curproc->p_comm);
+   vm_pageout_oom(VM_OOM_MEM_PF);
+   fs->oom = 0;
}
-   if (bootverbose)
-   printf(
-"proc %d (%s) failed to alloc page on fault, starting OOM\n",
-   curproc->p_pid, curproc->p_comm);
-   vm_pageout_oom(VM_OOM_MEM_PF);
return (KERN_RESOURCE_SHORTAGE);
}
fs->oom = 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: r357263 - head/sys/net

2020-01-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Jan 29 18:41:35 2020
New Revision: 357263
URL: https://svnweb.freebsd.org/changeset/base/357263

Log:
  Plug parent iface refcount leak on .X vlan creation.
  
  PR:   kern/242270
  Submitted by: Andrew Boyer 
  MFC after:2 weeks

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Wed Jan 29 18:13:44 2020(r357262)
+++ head/sys/net/if_vlan.c  Wed Jan 29 18:41:35 2020(r357263)
@@ -963,10 +963,14 @@ vlan_clone_match_ethervid(const char *name, int *vidp)
 static int
 vlan_clone_match(struct if_clone *ifc, const char *name)
 {
+   struct ifnet *ifp;
const char *cp;
 
-   if (vlan_clone_match_ethervid(name, NULL) != NULL)
+   ifp = vlan_clone_match_ethervid(name, NULL);
+   if (ifp != NULL) {
+   if_rele(ifp);
return (1);
+   }
 
if (strncmp(vlanname, name, strlen(vlanname)) != 0)
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357264 - in head: etc/mtree release/packages secure/caroot

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 18:47:08 2020
New Revision: 357264
URL: https://svnweb.freebsd.org/changeset/base/357264

Log:
  pkgbase: fix caroot packaging and add post-install script
  
  The original intention for caroot was to be packaged separately, perhaps so
  that users can have a more/less conservative upgrade policy for this
  separated from the rest of base.
  
  secure/caroot/Makefile doesn't have anything interesting to package, but its
  subdirectories might. Move the PACKAGE= to Makefile.inc so both blacklisted
  and trusted get packaged consistently into the correct one rather than the
  default -utilities. Also tag the directories for package=caroot, as they
  could also be empty; blacklisted is empty by default, but trusted is not.
  
  Add a post-install script to do certctl rehash, along with a note should we
  eventually come up with a way to detect that files have been added or
  removed that requires a rehash.
  
  -caroot gets a dependency on -utilities, as that's where we provide certctl
  at the moment. We can perhaps reconsider this and put certctl into this
  package in the future, but there are some bits within -utilities that
  unconditionally invoke certctl so let's hold off for now.
  
  Reviewed by:  manu (earlier version, before -utilities dep added)
  Differential Revision:https://reviews.freebsd.org/D23352

Added:
  head/release/packages/caroot.ucl   (contents, props changed)
  head/secure/caroot/Makefile.inc   (contents, props changed)
Modified:
  head/etc/mtree/BSD.usr.dist
  head/release/packages/generate-ucl.sh
  head/secure/caroot/Makefile

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Wed Jan 29 18:41:35 2020(r357263)
+++ head/etc/mtree/BSD.usr.dist Wed Jan 29 18:47:08 2020(r357264)
@@ -201,9 +201,9 @@
 ..
 ..
 certs
-blacklisted
+blacklisted tags=package=caroot
 ..
-trusted
+trusted tags=package=caroot
 ..
 ..
 dict

Added: head/release/packages/caroot.ucl
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/packages/caroot.uclWed Jan 29 18:47:08 2020
(r357264)
@@ -0,0 +1,31 @@
+#
+# $FreeBSD$
+#
+
+name = "FreeBSD-%PKGNAME%"
+origin = "base"
+version = "%VERSION%"
+comment = "%COMMENT%"
+categories = [ base ]
+maintainer = "r...@freebsd.org"
+www = "https://www.FreeBSD.org";
+prefix = "/"
+licenselogic = "single"
+licenses = [ BSD2CLAUSE ]
+desc = 

svn commit: r357265 - head/sys/conf

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 18:50:55 2020
New Revision: 357265
URL: https://svnweb.freebsd.org/changeset/base/357265

Log:
  kmod build: start generating opt_global.h, include it
  
  For untied module builds, we'll generate opt_foo headers if they're included
  in SRCS. However, options that would normally be represented in opt_global.h
  aren't properly represented.
  
  Start generating opt_global.h with #define VIMAGE for !mips since it's
  almost universally a project default and right now kmods must hack it in
  themselves in order to be properly compiled for the default kernel. For
  example, ^/sys/modules/pf/Makefile
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D23345

Modified:
  head/sys/conf/config.mk
  head/sys/conf/kmod.mk

Modified: head/sys/conf/config.mk
==
--- head/sys/conf/config.mk Wed Jan 29 18:47:08 2020(r357264)
+++ head/sys/conf/config.mk Wed Jan 29 18:50:55 2020(r357265)
@@ -8,6 +8,10 @@
 # the code here when they all produce identical results
 # (or should)
 .if !defined(KERNBUILDDIR)
+opt_global.h:
+.if ${MACHINE} != "mips"
+   @echo "#define VIMAGE 1" > ${.TARGET}
+.endif
 opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
 .if ${MK_INET_SUPPORT} != "no"

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Wed Jan 29 18:47:08 2020(r357264)
+++ head/sys/conf/kmod.mk   Wed Jan 29 18:50:55 2020(r357265)
@@ -106,6 +106,9 @@ NOSTDINC=   -nostdinc
 CFLAGS:=   ${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*}
 .if defined(KERNBUILDDIR)
 CFLAGS+=   -DHAVE_KERNEL_OPTION_HEADERS -include 
${KERNBUILDDIR}/opt_global.h
+.else
+SRCS+= opt_global.h
+CFLAGS+=   -include ${.OBJDIR}/opt_global.h
 .endif
 
 # Add -I paths for system headers.  Individual module makefiles don't
___
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: r357266 - head/sys/conf

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 18:54:21 2020
New Revision: 357266
URL: https://svnweb.freebsd.org/changeset/base/357266

Log:
  mips: unbreak module builds after r357265
  
  Touch opt_global.h to make sure it exists...
  
  Pointy hat:   kevans

Modified:
  head/sys/conf/config.mk

Modified: head/sys/conf/config.mk
==
--- head/sys/conf/config.mk Wed Jan 29 18:50:55 2020(r357265)
+++ head/sys/conf/config.mk Wed Jan 29 18:54:21 2020(r357266)
@@ -9,8 +9,9 @@
 # (or should)
 .if !defined(KERNBUILDDIR)
 opt_global.h:
+   touch ${.TARGET}
 .if ${MACHINE} != "mips"
-   @echo "#define VIMAGE 1" > ${.TARGET}
+   @echo "#define VIMAGE 1" >> ${.TARGET}
 .endif
 opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
___
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: r357268 - head/usr.bin/procstat

2020-01-29 Thread Dimitry Andric
Author: dim
Date: Wed Jan 29 21:06:22 2020
New Revision: 357268
URL: https://svnweb.freebsd.org/changeset/base/357268

Log:
  Merge r357260 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in procstat:
  
  usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; 
statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
  xo_close_container(name);
  ^
  usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
  } else
^
  
  The intent was to group the xo_close_container() call to the previous
  snprintf() call.
  
  MFC after:3 days

Modified:
  head/usr.bin/procstat/procstat_sigs.c
Directory Properties:
  head/   (props changed)

Modified: head/usr.bin/procstat/procstat_sigs.c
==
--- head/usr.bin/procstat/procstat_sigs.c   Wed Jan 29 20:56:31 2020
(r357267)
+++ head/usr.bin/procstat/procstat_sigs.c   Wed Jan 29 21:06:22 2020
(r357268)
@@ -74,9 +74,10 @@ procstat_close_signame(int sig)
for (i = 0; name[i] != 0; i++)
name[i] = toupper(name[i]);
xo_close_container(name);
-   } else
+   } else {
snprintf(name, 12, "%d", sig);
xo_close_container(name);
+   }
 }
 
 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: r357269 - head/usr.bin/tip/tip

2020-01-29 Thread Dimitry Andric
Author: dim
Date: Wed Jan 29 21:07:46 2020
New Revision: 357269
URL: https://svnweb.freebsd.org/changeset/base/357269

Log:
  Merge r357267 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in tip:
  
  usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not 
part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (gch == EOF)
  ^
  usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
  } else if (!cumode && gch == character(value(FORCE)))
^
  
  The intent was to have the EOF check grouped with the getchar() call
  just above it.  This was accidentally introduced in r354624.
  
  MFC after:3 days

Modified:
  head/usr.bin/tip/tip/tip.c
Directory Properties:
  head/   (props changed)

Modified: head/usr.bin/tip/tip/tip.c
==
--- head/usr.bin/tip/tip/tip.c  Wed Jan 29 21:06:22 2020(r357268)
+++ head/usr.bin/tip/tip/tip.c  Wed Jan 29 21:07:46 2020(r357269)
@@ -423,11 +423,12 @@ tipin(void)
if (boolean(value(HALFDUPLEX)))
printf("\r\n");
continue;
-   } else if (!cumode && gch == character(value(FORCE)))
+   } else if (!cumode && gch == character(value(FORCE))) {
gch = getchar();
if (gch == EOF)
return;
gch = gch & STRIP_PAR;
+   }
bol = any(gch, value(EOL));
if (boolean(value(RAISE)) && islower(gch))
gch = toupper(gch);
___
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: r357272 - head/usr.sbin/bsnmpd/modules/snmp_bridge

2020-01-29 Thread Dimitry Andric
Author: dim
Date: Wed Jan 29 21:41:45 2020
New Revision: 357272
URL: https://svnweb.freebsd.org/changeset/base/357272

Log:
  Merge r357271 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0 in bsnmpd:
  
  usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping 
comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
  begemotBridgeStpPortEnable_enabled ||
  ~~~^~
  
  Work around it by casting the enum values to the type of val->v.integer.
  
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
Directory Properties:
  head/   (props changed)

Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c  Wed Jan 29 
21:40:35 2020(r357271)
+++ head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c  Wed Jan 29 
21:41:45 2020(r357272)
@@ -1232,9 +1232,9 @@ op_begemot_stp_port(struct snmp_context *ctx, struct s
 
case LEAF_begemotBridgeStpPortEnable:
if (val->v.integer !=
-   begemotBridgeStpPortEnable_enabled ||
+   (int32_t)begemotBridgeStpPortEnable_enabled ||
val->v.integer !=
-   begemotBridgeStpPortEnable_disabled)
+   (int32_t)begemotBridgeStpPortEnable_disabled)
return (SNMP_ERR_WRONG_VALUE);
 
ctx->scratch->int1 = bp->enable;
___
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: r357273 - head/tests/sys/sys

2020-01-29 Thread Conrad Meyer
Author: cem
Date: Wed Jan 29 22:37:01 2020
New Revision: 357273
URL: https://svnweb.freebsd.org/changeset/base/357273

Log:
  Revert r357246
  
  I have no idea what this code is trying to do, leave it be.
  
  Reported by:  lwhsu

Modified:
  head/tests/sys/sys/qmath_test.c

Modified: head/tests/sys/sys/qmath_test.c
==
--- head/tests/sys/sys/qmath_test.c Wed Jan 29 21:41:45 2020
(r357272)
+++ head/tests/sys/sys/qmath_test.c Wed Jan 29 22:37:01 2020
(r357273)
@@ -47,7 +47,25 @@
 #defineQTEST_QITRUNC(q, iv) ((iv) >> Q_RPSHFT(q))
 #defineQTEST_FFACTOR 32.0
 
-#defineGENRAND(a)  arc4random_buf((a), sizeof(*(a)))
+#definebitsperrand 31
+#defineGENRAND(a, lb, ub)  
\
+({ \
+   int _rembits;   \
+   do {\
+   _rembits = Q_BITSPERBASEUP(ub) + Q_LTZ(lb); \
+   *(a) = (__typeof(*(a)))0;   \
+   while (_rembits > 0) {  \
+   *(a) |= (((uint64_t)random()) & \
+   ((1ULL << (_rembits > bitsperrand ? \
+   bitsperrand : _rembits)) - 1)); \
+   *(a) <<= (_rembits - (_rembits > bitsperrand ?  \
+   bitsperrand : _rembits));   \
+   _rembits -= bitsperrand;\
+   }   \
+   *(a) += lb; \
+   } while (*(a) < (lb) || (uint64_t)*(a) > (ub)); \
+   *(a);   \
+})
 
 /*
  * Smoke tests for basic qmath operations, such as initialization
@@ -195,9 +213,11 @@ ATF_TC_BODY(qmulq_s64q, tc)
 #endif
int error;
 
+   srandomdev();
+
for (int i = 0; i < 10;) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
 
/*
 * XXX: We cheat a bit, to stand any chance of multiplying
@@ -258,9 +278,12 @@ ATF_TC_BODY(qdivq_s64q, tc)
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/240219";);
 
+
+   srandomdev();
+
for (int i = 0; i < 10; i++) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
/*
 * XXXLAS: Until Qmath handles precision normalisation, only
 * test with equal precision.
@@ -301,9 +324,11 @@ ATF_TC_BODY(qaddq_s64q, tc)
double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
int error;
 
+   srandomdev();
+
for (int i = 0; i < 10;) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
/*
 * XXXLAS: Until Qmath handles precision normalisation, only
 * test with equal precision.
@@ -347,9 +372,11 @@ ATF_TC_BODY(qsubq_s64q, tc)
double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
int error;
 
+   srandomdev();
+
for (int i = 0; i < 10; i++) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
/*
 * XXXLAS: Until Qmath handles precision normalisation, only
 * test with equal precision.
@@ -391,9 +418,11 @@ ATF_TC_BODY(qfraci_s64q, tc)
int64_t a_int, b_int;
int error;
 
+   srandomdev();
+
for (int i = 0; i < 10;) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
/*
 * XXXLAS: Until Qmath handles precision normalisation, only
 * test with equal precision.
@@ -436,9 +465,11 @@ ATF_TC_BODY(qmuli_s64q, tc)
int64_t a_int, b_int;
int error;
 
+   srandomdev();
+
for (int i = 0; i < 10;) {
-   GENRAND(&a_s64q);
-   GENRAND(&b_s64q);
+   GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
+   GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
/*
 * XXXLAS: U

Re: svn commit: r357246 - head/tests/sys/sys

2020-01-29 Thread Conrad Meyer
Hi Li-Wen,

Thanks for the report.  I went ahead and reverted it in r357273.

Best,
Conrad

On Wed, Jan 29, 2020 at 8:47 AM Li-Wen Hsu  wrote:
>
> On Wed, Jan 29, 2020 at 1:25 PM Conrad Meyer  wrote:
> >
> > Author: cem
> > Date: Wed Jan 29 05:25:20 2020
> > New Revision: 357246
> > URL: https://svnweb.freebsd.org/changeset/base/357246
> >
> > Log:
> >   qmath(3) test: Replace overcomplicated abomination with arc4random(3)
> >
> >   The horrific GENRAND construction bent over backwards to construct 64-bit
> >   signed integers from the 31-bit output of random(3) for about 20 numbers 
> > per
> >   test.  Reproducibility wasn't a goal: random(3) was seeded with
> >   srandomdev(3).  Speed is not a factor for generating 20 integers with
> >   arc4random(3).  Range is not a factor: all uses did not bound the range
> >   beyond that of the full [INT64_MIN, INT64_MAX].  Just use arc4random(3).
> >
> >   Reported by:  Coverity
> >   CIDs: 1404809, 1404817, 1404838, 1404840 and about 6x other
> > identical reports of dubious code relating to the
> > construction
> >
> > Modified:
> >   head/tests/sys/sys/qmath_test.c
>
> These two test cases are starting failing since this commit:
> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/14110/testReport/sys.sys/qmath_test/qsubi_s64q/
> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/14110/testReport/sys.sys/qmath_test/qsubq_s64q/
>
> Can you help check them? Thanks!
>
> Li-Wen
___
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: r357274 - head/sys/conf

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 22:40:13 2020
New Revision: 357274
URL: https://svnweb.freebsd.org/changeset/base/357274

Log:
  config.mk: #define MAC as well
  
  MAC is also almost universally a default; every GENERIC includes it, and
  it's std.armv[67]. mips is again the oddball here with it only being
  included in ERL/OCTEON1.
  
  The only module currently working around this one is mac_veriexec, but it
  looks like nothing it builds actually uses the MAC definition. Downstream
  consumers enabling MAC in mips using mac_veriexec may be advised to do
  something differently here in config.mk.

Modified:
  head/sys/conf/config.mk

Modified: head/sys/conf/config.mk
==
--- head/sys/conf/config.mk Wed Jan 29 22:37:01 2020(r357273)
+++ head/sys/conf/config.mk Wed Jan 29 22:40:13 2020(r357274)
@@ -12,6 +12,7 @@ opt_global.h:
touch ${.TARGET}
 .if ${MACHINE} != "mips"
@echo "#define VIMAGE 1" >> ${.TARGET}
+   @echo "#define MAC 1" >> ${.TARGET}
 .endif
 opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
___
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: r357275 - in head/sys/modules: if_lagg if_vlan

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Wed Jan 29 22:43:56 2020
New Revision: 357275
URL: https://svnweb.freebsd.org/changeset/base/357275

Log:
  modules: adding some missing opt_* dependencies
  
  if_vlan grew a dependency on opt_inet6.h in r356993
  if_lagg and if_vlan both grew a dependency on opt_kern_tls.h in r351522
  
  This is needed for standalone module builds of these guys.

Modified:
  head/sys/modules/if_lagg/Makefile
  head/sys/modules/if_vlan/Makefile

Modified: head/sys/modules/if_lagg/Makefile
==
--- head/sys/modules/if_lagg/Makefile   Wed Jan 29 22:40:13 2020
(r357274)
+++ head/sys/modules/if_lagg/Makefile   Wed Jan 29 22:43:56 2020
(r357275)
@@ -2,6 +2,7 @@
 
 .PATH: ${SRCTOP}/sys/net
 KMOD=  if_lagg
-SRCS=  if_lagg.c ieee8023ad_lacp.c opt_inet.h opt_inet6.h opt_ratelimit.h
+SRCS=  if_lagg.c ieee8023ad_lacp.c opt_inet.h opt_inet6.h opt_kern_tls.h
+SRCS+= opt_ratelimit.h
 
 .include 

Modified: head/sys/modules/if_vlan/Makefile
==
--- head/sys/modules/if_vlan/Makefile   Wed Jan 29 22:40:13 2020
(r357274)
+++ head/sys/modules/if_vlan/Makefile   Wed Jan 29 22:43:56 2020
(r357275)
@@ -4,6 +4,6 @@
 
 KMOD=  if_vlan
 SRCS=  if_vlan.c
-SRCS+= opt_inet.h opt_vlan.h opt_ratelimit.h
+SRCS+= opt_inet.h opt_inet6.h opt_kern_tls.h opt_vlan.h opt_ratelimit.h
 
 .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"


svn commit: r357276 - head/sys/netinet

2020-01-29 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 29 22:48:18 2020
New Revision: 357276
URL: https://svnweb.freebsd.org/changeset/base/357276

Log:
  Fix missing NET_EPOCH_ENTER() when compiled with TCP_OFFLOAD.
  
  Reported by:  Coverity
  CID:  1413162

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Wed Jan 29 22:43:56 2020
(r357275)
+++ head/sys/netinet/tcp_usrreq.c   Wed Jan 29 22:48:18 2020
(r357276)
@@ -911,12 +911,12 @@ tcp_usr_rcvd(struct socket *so, int flags)
if (IS_FASTOPEN(tp->t_flags) &&
(tp->t_state == TCPS_SYN_RECEIVED))
goto out;
+   NET_EPOCH_ENTER(et);
 #ifdef TCP_OFFLOAD
if (tp->t_flags & TF_TOE)
tcp_offload_rcvd(tp);
else
 #endif
-   NET_EPOCH_ENTER(et);
tp->t_fb->tfb_tcp_output(tp);
NET_EPOCH_EXIT(et);
 out:
___
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: r357279 - head/sys/kern

2020-01-29 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jan 30 00:18:00 2020
New Revision: 357279
URL: https://svnweb.freebsd.org/changeset/base/357279

Log:
  Fix text format definition for kern.maxvnodes, vfs.wantfreevnodes.  This
  is a regression from r356642, r356645.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Jan 29 22:57:54 2020(r357278)
+++ head/sys/kern/vfs_subr.cThu Jan 30 00:18:00 2020(r357279)
@@ -360,7 +360,7 @@ sysctl_maxvnodes(SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes,
 CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, sysctl_maxvnodes,
-"UL", "Target for maximum number of vnodes");
+"LU", "Target for maximum number of vnodes");
 
 static int
 sysctl_wantfreevnodes(SYSCTL_HANDLER_ARGS)
@@ -384,7 +384,7 @@ sysctl_wantfreevnodes(SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC(_vfs, OID_AUTO, wantfreevnodes,
 CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, 
sysctl_wantfreevnodes,
-"UL", "Target for minimum number of \"free\" vnodes");
+"LU", "Target for minimum number of \"free\" vnodes");
 
 SYSCTL_ULONG(_kern, OID_AUTO, minvnodes, CTLFLAG_RW,
 &wantfreevnodes, 0, "Old name for vfs.wantfreevnodes (legacy)");
___
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: r357280 - head/sys/kern

2020-01-29 Thread Mateusz Guzik
Author: mjg
Date: Thu Jan 30 02:12:52 2020
New Revision: 357280
URL: https://svnweb.freebsd.org/changeset/base/357280

Log:
  vfs: unlazy before dooming the vnode
  
  With this change having the listmtx lock held postpones dooming the vnode.
  Use this fact to simplify iteration over the lazy list. It also allows
  filters to safely access ->v_data.
  
  Reviewed by:  kib (early version)
  Differential Revision:https://reviews.freebsd.org/D23397

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Jan 30 00:18:00 2020(r357279)
+++ head/sys/kern/vfs_subr.cThu Jan 30 02:12:52 2020(r357280)
@@ -1805,20 +1805,13 @@ delmntque(struct vnode *vp)
 {
struct mount *mp;
 
+   VNPASS((vp->v_mflag & VMP_LAZYLIST) == 0, vp);
+
mp = vp->v_mount;
if (mp == NULL)
return;
MNT_ILOCK(mp);
VI_LOCK(vp);
-   if (vp->v_mflag & VMP_LAZYLIST) {
-   mtx_lock(&mp->mnt_listmtx);
-   if (vp->v_mflag & VMP_LAZYLIST) {
-   vp->v_mflag &= ~VMP_LAZYLIST;
-   TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist);
-   mp->mnt_lazyvnodelistsize--;
-   }
-   mtx_unlock(&mp->mnt_listmtx);
-   }
vp->v_mount = NULL;
VI_UNLOCK(vp);
VNASSERT(mp->mnt_nvnodelistsize > 0, vp,
@@ -3079,6 +3072,11 @@ vlazy(struct vnode *vp)
 
if ((vp->v_mflag & VMP_LAZYLIST) != 0)
return;
+   /*
+* We may get here for inactive routines after the vnode got doomed.
+*/
+   if (VN_IS_DOOMED(vp))
+   return;
mp = vp->v_mount;
mtx_lock(&mp->mnt_listmtx);
if ((vp->v_mflag & VMP_LAZYLIST) == 0) {
@@ -3089,7 +3087,31 @@ vlazy(struct vnode *vp)
mtx_unlock(&mp->mnt_listmtx);
 }
 
+/*
+ * This routine is only meant to be called from vgonel prior to dooming
+ * the vnode.
+ */
 static void
+vunlazy_gone(struct vnode *vp)
+{
+   struct mount *mp;
+
+   ASSERT_VOP_ELOCKED(vp, __func__);
+   ASSERT_VI_LOCKED(vp, __func__);
+   VNPASS(!VN_IS_DOOMED(vp), vp);
+
+   if (vp->v_mflag & VMP_LAZYLIST) {
+   mp = vp->v_mount;
+   mtx_lock(&mp->mnt_listmtx);
+   VNPASS(vp->v_mflag & VMP_LAZYLIST, vp);
+   vp->v_mflag &= ~VMP_LAZYLIST;
+   TAILQ_REMOVE(&mp->mnt_lazyvnodelist, vp, v_lazylist);
+   mp->mnt_lazyvnodelistsize--;
+   mtx_unlock(&mp->mnt_listmtx);
+   }
+}
+
+static void
 vdefer_inactive(struct vnode *vp)
 {
 
@@ -3808,6 +3830,7 @@ vgonel(struct vnode *vp)
 */
if (vp->v_irflag & VIRF_DOOMED)
return;
+   vunlazy_gone(vp);
vp->v_irflag |= VIRF_DOOMED;
 
/*
@@ -6221,8 +6244,6 @@ static bool
 mnt_vnode_next_lazy_relock(struct vnode *mvp, struct mount *mp,
 struct vnode *vp)
 {
-   const struct vnode *tmp;
-   bool held, ret;
 
VNASSERT(mvp->v_mount == mp && mvp->v_type == VMARKER &&
TAILQ_NEXT(mvp, v_lazylist) != NULL, mvp,
@@ -6232,65 +6253,37 @@ mnt_vnode_next_lazy_relock(struct vnode *mvp, struct m
ASSERT_VI_UNLOCKED(vp, __func__);
mtx_assert(&mp->mnt_listmtx, MA_OWNED);
 
-   ret = false;
-
TAILQ_REMOVE(&mp->mnt_lazyvnodelist, mvp, v_lazylist);
TAILQ_INSERT_BEFORE(vp, mvp, v_lazylist);
 
-   /*
-* Use a hold to prevent vp from disappearing while the mount vnode
-* list lock is dropped and reacquired.  Normally a hold would be
-* acquired with vhold(), but that might try to acquire the vnode
-* interlock, which would be a LOR with the mount vnode list lock.
-*/
-   held = refcount_acquire_if_not_zero(&vp->v_holdcnt);
+   vholdnz(vp);
mtx_unlock(&mp->mnt_listmtx);
-   if (!held)
-   goto abort;
VI_LOCK(vp);
-   if (!refcount_release_if_not_last(&vp->v_holdcnt)) {
-   vdropl(vp);
-   goto abort;
+   if (VN_IS_DOOMED(vp)) {
+   VNPASS((vp->v_mflag & VMP_LAZYLIST) == 0, vp);
+   goto out_lost;
}
-   mtx_lock(&mp->mnt_listmtx);
-
+   VNPASS(vp->v_mflag & VMP_LAZYLIST, vp);
/*
-* Determine whether the vnode is still the next one after the marker,
-* excepting any other markers.  If the vnode has not been doomed by
-* vgone() then the hold should have ensured that it remained on the
-* lazy list.  If it has been doomed but is still on the lazy list,
-* don't abort, but rather skip over it (avoid spinning on doomed
-* vnodes).
+* Since we had a period with no locks held we may be the last
+* remaining user, in which case there is nothing to do.
 */
-   tmp = mvp;
-   do {
- 

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

2020-01-29 Thread Mateusz Guzik
Author: mjg
Date: Thu Jan 30 02:14:10 2020
New Revision: 357281
URL: https://svnweb.freebsd.org/changeset/base/357281

Log:
  zfs: use VOP_NEED_INACTIVE
  
  Big thanks to Greg V for testing previous verions of the patch.
  
  Differential Revision:https://reviews.freebsd.org/D22130

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 
30 02:12:52 2020(r357280)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 
30 02:14:10 2020(r357281)
@@ -5314,6 +5314,29 @@ zfs_freebsd_inactive(ap)
 }
 
 static int
+zfs_freebsd_need_inactive(ap)
+   struct vop_need_inactive_args /* {
+   struct vnode *a_vp;
+   struct thread *a_td;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+   znode_t *zp = VTOZ(vp);
+   zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+   int need;
+
+   if (vn_need_pageq_flush(vp))
+   return (1);
+
+   if (!rw_tryenter(&zfsvfs->z_teardown_inactive_lock, RW_READER))
+   return (1);
+   need = (zp->z_sa_hdl == NULL || zp->z_unlinked || zp->z_atime_dirty);
+   rw_exit(&zfsvfs->z_teardown_inactive_lock);
+
+   return (need);
+}
+
+static int
 zfs_freebsd_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
@@ -5949,6 +5972,7 @@ struct vop_vector zfs_shareops;
 struct vop_vector zfs_vnodeops = {
.vop_default =  &default_vnodeops,
.vop_inactive = zfs_freebsd_inactive,
+   .vop_need_inactive =zfs_freebsd_need_inactive,
.vop_reclaim =  zfs_freebsd_reclaim,
.vop_access =   zfs_freebsd_access,
.vop_allocate = VOP_EINVAL,
___
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: r357282 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2020-01-29 Thread Mateusz Guzik
Author: mjg
Date: Thu Jan 30 02:16:17 2020
New Revision: 357282
URL: https://svnweb.freebsd.org/changeset/base/357282

Log:
  zfs: fix spurious lock contention during path lookup
  
  ZFS tracks if anything denies VEXEC to allow for a quick check for the
  common case of path traversal. Use it.
  
  Differential Revision:https://reviews.freebsd.org/D4

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h   Thu Jan 
30 02:14:10 2020(r357281)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h   Thu Jan 
30 02:16:17 2020(r357282)
@@ -214,7 +214,10 @@ void zfs_oldace_byteswap(ace_t *, int);
 void zfs_ace_byteswap(void *, size_t, boolean_t);
 extern boolean_t zfs_has_access(struct znode *zp, cred_t *cr);
 extern int zfs_zaccess(struct znode *, int, int, boolean_t, cred_t *);
+#ifdef illumos
 int zfs_fastaccesschk_execute(struct znode *, cred_t *);
+#endif
+int zfs_freebsd_fastaccesschk_execute(struct vnode *, cred_t *);
 extern int zfs_zaccess_rwx(struct znode *, mode_t, int, cred_t *);
 extern int zfs_zaccess_unix(struct znode *, mode_t, cred_t *);
 extern int zfs_acl_access(struct znode *, int, cred_t *);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c   Thu Jan 
30 02:14:10 2020(r357281)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c   Thu Jan 
30 02:16:17 2020(r357282)
@@ -2299,7 +2299,41 @@ zfs_zaccess_append(znode_t *zp, uint32_t *working_mode
check_privs, B_FALSE, cr));
 }
 
+/*
+ * Check if VEXEC is allowed.
+ *
+ * This routine is based on zfs_fastaccesschk_execute which has slowpath
+ * calling zfs_zaccess. This would be incorrect on FreeBSD (see
+ * zfs_freebsd_access for the difference). Thus this variant let's the
+ * caller handle the slowpath (if necessary).
+ *
+ * We only check for ZFS_NO_EXECS_DENIED and fail early. This routine can
+ * be extended to cover more cases, but the flag covers the majority.
+ */
 int
+zfs_freebsd_fastaccesschk_execute(struct vnode *vp, cred_t *cr)
+{
+   boolean_t is_attr;
+   znode_t *zdp = VTOZ(vp);
+
+   ASSERT_VOP_LOCKED(vp, __func__);
+
+   if (zdp->z_pflags & ZFS_AV_QUARANTINED)
+   return (1);
+
+   is_attr = ((zdp->z_pflags & ZFS_XATTR) &&
+   (ZTOV(zdp)->v_type == VDIR));
+   if (is_attr)
+   return (1);
+
+   if (zdp->z_pflags & ZFS_NO_EXECS_DENIED)
+   return (0);
+
+   return (1);
+}
+
+#ifdef illumos
+int
 zfs_fastaccesschk_execute(znode_t *zdp, cred_t *cr)
 {
boolean_t owner = B_FALSE;
@@ -2365,6 +2399,7 @@ slow:
ZFS_EXIT(zdp->z_zfsvfs);
return (error);
 }
+#endif
 
 /*
  * Determine whether Access should be granted/denied.

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 
30 02:14:10 2020(r357281)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 
30 02:16:17 2020(r357282)
@@ -4858,6 +4858,11 @@ zfs_freebsd_access(ap)
accmode_t accmode;
int error = 0;
 
+   if (ap->a_accmode == VEXEC) {
+   if (zfs_freebsd_fastaccesschk_execute(ap->a_vp, ap->a_cred) == 
0)
+   return (0);
+   }
+
/*
 * ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND,
 */
___
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: r357283 - head/release/packages

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Thu Jan 30 03:01:00 2020
New Revision: 357283
URL: https://svnweb.freebsd.org/changeset/base/357283

Log:
  pkgbase: generate dependencies in generate-ucl.sh
  
  This cuts out a large chunk of duplicated *.ucl files that just needed
  dependencies tacked on, and gives generate-ucl.sh some leeway in case a
  future pkg may need more than one dependency.
  
  Run-through to determine which ones could simply be removed done with for i
  in *.ucl; do diff -U3 template.ucl ${i}; done | less and inspecting for any
  differences beyond just adding deps at the end. The remaining ucl files are
  basically all differently-licensed, require scripts, or are marked vital.
  
  I've opted to remove %PKGDEPS% entirely without regard for third-party ucl,
  as pkgbase is not yet considered production. However, I do not hold a strong
  position on this and there is approximately 0 chance it will return.
  
  clibs should have been added previously in generate-ucl.sh as one that
  doesn't have any dependencies, but do so now that we would otherwise be
  tacking on the runtime dependency.
  
  Reviewed by:  manu, bapt (earlier version)
  Differential Revision:https://reviews.freebsd.org/D23415

Deleted:
  head/release/packages/acct.ucl
  head/release/packages/acpi.ucl
  head/release/packages/amd.ucl
  head/release/packages/apm.ucl
  head/release/packages/at.ucl
  head/release/packages/autofs.ucl
  head/release/packages/bhyve.ucl
  head/release/packages/bluetooth.ucl
  head/release/packages/bsdinstall.ucl
  head/release/packages/bsnmp.ucl
  head/release/packages/dma.ucl
  head/release/packages/ee.ucl
  head/release/packages/hostapd.ucl
  head/release/packages/jail-debug.ucl
  head/release/packages/jail-development.ucl
  head/release/packages/jail-lib32-debug.ucl
  head/release/packages/jail-lib32-development.ucl
  head/release/packages/jail-lib32-profile.ucl
  head/release/packages/jail-lib32.ucl
  head/release/packages/jail-profile.ucl
  head/release/packages/rcmds.ucl
  head/release/packages/runtime-debug.ucl
  head/release/packages/runtime-development.ucl
  head/release/packages/runtime-lib32.ucl
  head/release/packages/runtime-manuals.ucl
  head/release/packages/runtime-profile.ucl
  head/release/packages/syscons.ucl
  head/release/packages/tests.ucl
  head/release/packages/vi.ucl
  head/release/packages/wpa.ucl
Modified:
  head/release/packages/binutils.ucl
  head/release/packages/caroot.ucl
  head/release/packages/clang.ucl
  head/release/packages/gdb.ucl
  head/release/packages/generate-ucl.sh
  head/release/packages/groff.ucl
  head/release/packages/jail.ucl
  head/release/packages/lld.ucl
  head/release/packages/lldb.ucl
  head/release/packages/runtime.ucl
  head/release/packages/ssh.ucl
  head/release/packages/svn.ucl
  head/release/packages/unbound.ucl

Modified: head/release/packages/binutils.ucl
==
--- head/release/packages/binutils.ucl  Thu Jan 30 02:16:17 2020
(r357282)
+++ head/release/packages/binutils.ucl  Thu Jan 30 03:01:00 2020
(r357283)
@@ -15,10 +15,4 @@ licenses = [ GPLv2 ]
 desc = <> ${uclfile}
+deps: {
+   FreeBSD-${pkgdeps}: {
+   origin: "base",
+   version: "${PKG_VERSION}"
+   }
+}
+EOF
+   fi
cap_arg="$( make -f ${srctree}/share/mk/bsd.endian.mk -VCAP_MKDB_ENDIAN 
)"
sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/${origname}/" \
-e "s/%COMMENT%/${comment}/" \
-e "s/%DESC%/${desc}/" \
-e "s/%CAP_MKDB_ENDIAN%/${cap_arg}/g" \
-   -e "s/%PKGDEPS%/${pkgdeps}/" \
${uclfile}
return 0
 }

Modified: head/release/packages/groff.ucl
==
--- head/release/packages/groff.ucl Thu Jan 30 02:16:17 2020
(r357282)
+++ head/release/packages/groff.ucl Thu Jan 30 03:01:00 2020
(r357283)
@@ -15,10 +15,4 @@ licenses = [ GPLv2 ]
 desc = 

svn commit: r357284 - in head: include lib/libc/stdio

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Thu Jan 30 03:31:16 2020
New Revision: 357284
URL: https://svnweb.freebsd.org/changeset/base/357284

Log:
  stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite
  
  fflush_unlocked is currently desired in ports by sysutils/metalog, and
  redefined as the locked fflush.
  
  fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
  currently desired in ports by devel/elfutils, and redefined as the locked
  fputs, fread, and fwrite respectively.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D23336

Modified:
  head/include/stdio.h
  head/lib/libc/stdio/Makefile.inc
  head/lib/libc/stdio/Symbol.map
  head/lib/libc/stdio/fflush.3
  head/lib/libc/stdio/fflush.c
  head/lib/libc/stdio/fputc.c
  head/lib/libc/stdio/fputs.3
  head/lib/libc/stdio/fputs.c
  head/lib/libc/stdio/fread.3
  head/lib/libc/stdio/fread.c
  head/lib/libc/stdio/fwrite.c
  head/lib/libc/stdio/putc.3

Modified: head/include/stdio.h
==
--- head/include/stdio.hThu Jan 30 03:01:00 2020(r357283)
+++ head/include/stdio.hThu Jan 30 03:31:16 2020(r357284)
@@ -346,7 +346,12 @@ int putchar_unlocked(int);
 voidclearerr_unlocked(FILE *);
 int feof_unlocked(FILE *);
 int ferror_unlocked(FILE *);
+int fflush_unlocked(FILE *);
 int fileno_unlocked(FILE *);
+int fputs_unlocked(const char * __restrict, FILE * __restrict);
+size_t  fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict);
+size_t  fwrite_unlocked(const void * __restrict, size_t, size_t,
+FILE * __restrict);
 #endif
 
 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
@@ -507,10 +512,11 @@ extern int __isthreaded;
  * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
  * B.8.2.7 for the rationale behind the *_unlocked() macros.
  */
+#defineclearerr_unlocked(p)__sclearerr(p)
 #definefeof_unlocked(p)__sfeof(p)
 #defineferror_unlocked(p)  __sferror(p)
-#defineclearerr_unlocked(p)__sclearerr(p)
 #definefileno_unlocked(p)  __sfileno(p)
+#definefputc_unlocked(s, p)__sputc(s, p)
 #endif
 #if __POSIX_VISIBLE >= 199506
 #definegetc_unlocked(fp)   __sgetc(fp)

Modified: head/lib/libc/stdio/Makefile.inc
==
--- head/lib/libc/stdio/Makefile.incThu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/Makefile.incThu Jan 30 03:31:16 2020
(r357284)
@@ -48,13 +48,17 @@ MLINKS+=ferror.3 ferror_unlocked.3 \
ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \
ferror.3 feof.3 ferror.3 feof_unlocked.3 \
ferror.3 fileno.3 ferror.3 fileno_unlocked.3
-MLINKS+=fflush.3 fpurge.3
+MLINKS+=fflush.3 fflush_unlocked.3 \
+   fflush.3 fpurge.3
 MLINKS+=fgets.3 gets.3
 MLINKS+=fgets.3 gets_s.3
 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
 MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3
-MLINKS+=fputs.3 puts.3
-MLINKS+=fread.3 fwrite.3
+MLINKS+=fputs.3 fputs_unlocked.3 \
+   fputs.3 puts.3
+MLINKS+=fread.3 fread_unlocked.3 \
+   fread.3 fwrite.3 \
+   fread.3 fwrite_unlocked.3
 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
fseek.3 ftello.3 fseek.3 rewind.3
 MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3

Modified: head/lib/libc/stdio/Symbol.map
==
--- head/lib/libc/stdio/Symbol.map  Thu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/Symbol.map  Thu Jan 30 03:31:16 2020
(r357284)
@@ -172,6 +172,10 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+   fflush_unlocked;
+   fputs_unlocked;
+   fread_unlocked;
+   fwrite_unlocked;
mkostempsat;
 };
 

Modified: head/lib/libc/stdio/fflush.3
==
--- head/lib/libc/stdio/fflush.3Thu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/fflush.3Thu Jan 30 03:31:16 2020
(r357284)
@@ -32,11 +32,12 @@
 .\" @(#)fflush.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd December 25, 2017
+.Dd January 23, 2020
 .Dt FFLUSH 3
 .Os
 .Sh NAME
 .Nm fflush ,
+.Nm fflush_unlocked ,
 .Nm fpurge
 .Nd flush a stream
 .Sh LIBRARY
@@ -46,6 +47,8 @@
 .Ft int
 .Fn fflush "FILE *stream"
 .Ft int
+.Fn fflush_unlocked "FILE *stream"
+.Ft int
 .Fn fpurge "FILE *stream"
 .Sh DESCRIPTION
 The function
@@ -63,6 +66,16 @@ argument is
 flushes
 .Em all
 open output streams.
+.Pp
+The
+.Fn fflush_unlocked
+function is equivalent to
+.Fn fflush ,
+except that the caller is responsible for locking the stream with
+.Xr flockfile 3
+before calling it.
+This function may be used to avoid the overhead of locking the stre

svn commit: r357285 - head/sys/kern

2020-01-29 Thread Mateusz Guzik
Author: mjg
Date: Thu Jan 30 04:59:08 2020
New Revision: 357285
URL: https://svnweb.freebsd.org/changeset/base/357285

Log:
  vfs: assert that doomed vnodes don't need to call vm_object_page_clean
  
  ... after the optional inactive processing.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Jan 30 03:31:16 2020(r357284)
+++ head/sys/kern/vfs_subr.cThu Jan 30 04:59:08 2020(r357285)
@@ -3863,6 +3863,7 @@ vgonel(struct vnode *vp)
vinactivef(vp);
VI_UNLOCK(vp);
}
+   VNPASS(!vn_need_pageq_flush(vp), vp);
if (vp->v_type == VSOCK)
vfs_unp_reclaim(vp);
 
@@ -4994,7 +4995,7 @@ vn_need_pageq_flush(struct vnode *vp)
struct vm_object *obj;
int need;
 
-   MPASS(mtx_owned(VI_MTX(vp)));
+   VNPASS(VN_IS_DOOMED(vp) || mtx_owned(VI_MTX(vp)), vp);
need = 0;
if ((obj = vp->v_object) != NULL && (vp->v_vflag & VV_NOSYNC) == 0 &&
vm_object_mightbedirty(obj))
___
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: r357286 - head/sys/ufs/ufs

2020-01-29 Thread Mateusz Guzik
Author: mjg
Date: Thu Jan 30 05:37:35 2020
New Revision: 357286
URL: https://svnweb.freebsd.org/changeset/base/357286

Log:
  ufs: add the missing vn_need_pageq_flush call to ufs_need_inactive

Modified:
  head/sys/ufs/ufs/ufs_inode.c

Modified: head/sys/ufs/ufs/ufs_inode.c
==
--- head/sys/ufs/ufs/ufs_inode.cThu Jan 30 04:59:08 2020
(r357285)
+++ head/sys/ufs/ufs/ufs_inode.cThu Jan 30 05:37:35 2020
(r357286)
@@ -77,6 +77,8 @@ ufs_need_inactive(ap)
ip = VTOI(vp);
if (UFS_RDONLY(ip))
return (0);
+   if (vn_need_pageq_flush(vp))
+   return (1);
if (ip->i_mode == 0 ||  ip->i_nlink <= 0 ||
(ip->i_effnlink == 0 && DOINGSOFTDEP(vp)) ||
(ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED |
___
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"