svn commit: r347088 - head/sys/compat/linuxkpi/common/src

2019-05-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sat May  4 09:30:03 2019
New Revision: 347088
URL: https://svnweb.freebsd.org/changeset/base/347088

Log:
  Fix regression issue after r346645 in the LinuxKPI.
  Properly handle error case when mapping DMA address fails.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May  4 09:28:11 
2019(r347087)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May  4 09:30:03 
2019(r347088)
@@ -480,10 +480,15 @@ linux_dma_alloc_coherent(struct device *dev, size_t si
align = PAGE_SIZE << get_order(size);
mem = (void *)kmem_alloc_contig(size, flag, 0, high, align, 0,
VM_MEMATTR_DEFAULT);
-   if (mem)
+   if (mem != NULL) {
*dma_handle = linux_dma_map_phys(dev, vtophys(mem), size);
-   else
+   if (*dma_handle == 0) {
+   kmem_free((vm_offset_t)mem, size);
+   mem = NULL;
+   }
+   } else {
*dma_handle = 0;
+   }
return (mem);
 }
 
___
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: r347089 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-05-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sat May  4 09:47:01 2019
New Revision: 347089
URL: https://svnweb.freebsd.org/changeset/base/347089

Log:
  Fix regression issue after r346645 in the LinuxKPI.
  
  The S/G list must be mapped AS-IS without any optimisations.
  This also implies that sg_dma_len() must be equal to sg->length.
  Many Linux drivers assume this and this fixes some DRM issues.
  
  Put the BUS DMA map pointer into the scatter-gather list to
  allow multiple mappings on the same physical memory address.
  
  The FreeBSD version has been bumped to force recompilation of
  external kernel modules.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
  head/sys/compat/linuxkpi/common/src/linux_pci.c
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
==
--- head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Sat May  4 
09:30:03 2019(r347088)
+++ head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Sat May  4 
09:47:01 2019(r347089)
@@ -36,6 +36,7 @@
 #include 
 #include 
 
+struct bus_dmamap;
 struct scatterlist {
unsigned long page_link;
 #defineSG_PAGE_LINK_CHAIN  0x1UL
@@ -44,7 +45,7 @@ struct scatterlist {
unsigned int offset;
unsigned int length;
dma_addr_t dma_address;
-   unsigned int dma_length;
+   struct bus_dmamap *dma_map; /* FreeBSD specific */
 };
 
 CTASSERT((sizeof(struct scatterlist) & SG_PAGE_LINK_MASK) == 0);
@@ -79,7 +80,7 @@ struct sg_page_iter {
((struct scatterlist *) ((sg)->page_link & ~SG_PAGE_LINK_MASK))
 
 #definesg_dma_address(sg)  (sg)->dma_address
-#definesg_dma_len(sg)  (sg)->dma_length
+#definesg_dma_len(sg)  (sg)->length
 
 #definefor_each_sg_page(sgl, iter, nents, pgoffset)
\
for (_sg_iter_init(sgl, iter, nents, pgoffset); \

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May  4 09:30:03 
2019(r347088)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May  4 09:47:01 
2019(r347089)
@@ -562,70 +562,39 @@ linux_dma_map_sg_attrs(struct device *dev, struct scat
 enum dma_data_direction dir, struct dma_attrs *attrs)
 {
struct linux_dma_priv *priv;
-   struct linux_dma_obj *obj;
-   struct scatterlist *dma_sg, *sg;
-   int dma_nents, error, nseg;
-   size_t seg_len;
-   vm_paddr_t seg_phys, prev_phys_end;
+   struct scatterlist *sg;
+   int i, nseg;
bus_dma_segment_t seg;
 
priv = dev->dma_priv;
 
-   obj = uma_zalloc(linux_dma_obj_zone, 0);
-
DMA_PRIV_LOCK(priv);
-   if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) {
+
+   /* create common DMA map in the first S/G entry */
+   if (bus_dmamap_create(priv->dmat, 0, &sgl->dma_map) != 0) {
DMA_PRIV_UNLOCK(priv);
-   uma_zfree(linux_dma_obj_zone, obj);
return (0);
}
 
-   sg = sgl;
-   dma_sg = sg;
-   dma_nents = 0;
-
-   while (nents > 0) {
-   seg_phys = sg_phys(sg);
-   seg_len = sg->length;
-   while (--nents > 0) {
-   prev_phys_end = sg_phys(sg) + sg->length;
-   sg = sg_next(sg);
-   if (prev_phys_end != sg_phys(sg))
-   break;
-   seg_len += sg->length;
-   }
-
+   /* load all S/G list entries */
+   for_each_sg(sgl, sg, nents, i) {
nseg = -1;
-   if (_bus_dmamap_load_phys(priv->dmat, obj->dmamap,
-   seg_phys, seg_len, BUS_DMA_NOWAIT,
+   if (_bus_dmamap_load_phys(priv->dmat, sgl->dma_map,
+   sg_phys(sg), sg->length, BUS_DMA_NOWAIT,
&seg, &nseg) != 0) {
-   bus_dmamap_unload(priv->dmat, obj->dmamap);
-   bus_dmamap_destroy(priv->dmat, obj->dmamap);
+   bus_dmamap_unload(priv->dmat, sgl->dma_map);
+   bus_dmamap_destroy(priv->dmat, sgl->dma_map);
DMA_PRIV_UNLOCK(priv);
-   uma_zfree(linux_dma_obj_zone, obj);
return (0);
}
-   KASSERT(++nseg == 1, ("More than one segment (nseg=%d)", nseg));
+   KASSERT(nseg == 0,
+   ("More than one segment (nseg=%d)", nseg + 1));
 
-   sg_dma_address(dma_sg) = seg.ds_addr;
-   sg_dma_len(dma_sg) = seg.ds_len;
-
-   dma_sg = sg_next(dma_sg);
-   dma_nents++;
-}
-
-   obj->dma_addr = sg_

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

2019-05-04 Thread Ganbold Tsagaankhuu
Author: ganbold
Date: Sat May  4 10:48:44 2019
New Revision: 347097
URL: https://svnweb.freebsd.org/changeset/base/347097

Log:
  Add emmc clock definitions for Rockchip RK3399 SoC.

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

Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3399_cru.cSat May  4 10:38:54 2019
(r347096)
+++ head/sys/arm64/rockchip/clk/rk3399_cru.cSat May  4 10:48:44 2019
(r347097)
@@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$");
 
 /* GATES */
 
+#defineACLK_EMMC_CORE  241
+#defineACLK_EMMC_NOC   242
+#defineACLK_EMMC_GRF   243
 #definePCLK_GPIO2  336
 #definePCLK_GPIO3  337
 #definePCLK_GPIO4  338
@@ -80,6 +83,10 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(0, "cpll_aclk_perihp_src", "cpll", 0x314, 0)
CRU_GATE(0, "gpll_aclk_perihp_src", "gpll", 0x314, 1)
 
+   /* CRU_CLKGATE_CON6 */
+   CRU_GATE(0, "gpll_aclk_emmc_src", "gpll", 0x318, 12)
+   CRU_GATE(0, "cpll_aclk_emmc_src", "cpll", 0x318, 13)
+
/* CRU_CLKGATE_CON7 */
CRU_GATE(0, "gpll_aclk_perilp0_src", "gpll", 0x31C, 0)
CRU_GATE(0, "cpll_aclk_perilp0_src", "cpll", 0x31C, 1)
@@ -101,6 +108,11 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_alive", 0x37c, 4)
CRU_GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_alive", 0x37c, 5)
 
+   /* CRU_CLKGATE_CON32 */
+   CRU_GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", 0x380, 8)
+   CRU_GATE(ACLK_EMMC_NOC, "aclk_emmc_noc", "aclk_emmc", 0x380, 9)
+   CRU_GATE(ACLK_EMMC_GRF, "aclk_emmcgrf", "aclk_emmc", 0x380, 10)
+
/* CRU_CLKGATE_CON33 */
CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0x384, 8)
 };
@@ -1443,6 +1455,60 @@ static struct rk_clk_composite_def sclk_sdmmc = {
.flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+/*
+ * emmc
+ */
+
+#defineSCLK_EMMC   78
+
+static const char *sclk_emmc_parents[] = {"cpll", "gpll", "npll"};
+
+static struct rk_clk_composite_def sclk_emmc = {
+   .clkdef = {
+   .id = SCLK_EMMC,
+   .name = "sclk_emmc",
+   .parent_names = sclk_emmc_parents,
+   .parent_cnt = nitems(sclk_emmc_parents),
+   },
+
+   .muxdiv_offset = 0x158,
+   .mux_shift = 8,
+   .mux_width = 3,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   .gate_offset = 0x318,
+   .gate_shift = 14,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+#defineACLK_EMMC   240
+
+static const char *aclk_emmc_parents[] = {
+   "cpll_aclk_emmc_src",
+   "gpll_aclk_emmc_src"
+};
+
+static struct rk_clk_composite_def aclk_emmc = {
+   .clkdef = {
+   .id = ACLK_EMMC,
+   .name = "aclk_emmc",
+   .parent_names = aclk_emmc_parents,
+   .parent_cnt = nitems(aclk_emmc_parents),
+   },
+
+   .muxdiv_offset = 0x154,
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 5,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX,
+};
+
 static struct rk_clk rk3399_clks[] = {
{
.type = RK3399_CLK_PLL,
@@ -1550,6 +1616,15 @@ static struct rk_clk rk3399_clks[] = {
{
.type = RK_CLK_COMPOSITE,
.clk.composite = &sclk_sdmmc,
+   },
+
+   {
+   .type = RK_CLK_COMPOSITE,
+   .clk.composite = &sclk_emmc,
+   },
+   {
+   .type = RK_CLK_COMPOSITE,
+   .clk.composite = &aclk_emmc,
},
 };
 
___
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: r347127 - head/sys/powerpc/mpc85xx

2019-05-04 Thread Justin Hibbits
Author: jhibbits
Date: Sat May  4 16:24:43 2019
New Revision: 347127
URL: https://svnweb.freebsd.org/changeset/base/347127

Log:
  powerpc/mpc85xx: Attach MPC85xx PCI bus and root complex at the right pass
  
  No signifcant change, just matches other PCI attachments, attaching at
  BUS_PASS_BUS.
  
  MFC after:2 weeks

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c
  head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Sat May  4 13:58:45 2019
(r347126)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Sat May  4 16:24:43 2019
(r347127)
@@ -225,7 +225,8 @@ static devclass_t fsl_pcib_devclass;
 
 DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods,
 sizeof(struct fsl_pcib_softc), ofw_pci_driver);
-DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
+EARLY_DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0,
+BUS_PASS_BUS);
 
 static int
 fsl_pcib_err_intr(void *v)

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c Sat May  4 13:58:45 2019
(r347126)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx_pcib.c Sat May  4 16:24:43 2019
(r347127)
@@ -103,4 +103,5 @@ static device_method_t fsl_pcib_rc_methods[] = {
 static devclass_t fsl_pcib_rc_devclass;
 DEFINE_CLASS_1(pcib, fsl_pcib_rc_driver, fsl_pcib_rc_methods,
 sizeof(struct fsl_pcib_softc), ofw_pcib_pci_driver);
-DRIVER_MODULE(rcpcib, pci, fsl_pcib_rc_driver, fsl_pcib_rc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(rcpcib, pci, fsl_pcib_rc_driver, fsl_pcib_rc_devclass, 0, 
0,
+BUS_PASS_BUS);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r347129 - in head/sys: amd64/include i386/include x86/x86

2019-05-04 Thread Conrad Meyer
Author: cem
Date: Sat May  4 17:35:13 2019
New Revision: 347129
URL: https://svnweb.freebsd.org/changeset/base/347129

Log:
  x86: Define pc_monitorbuf as a logical structure
  
  Rather than just accessing it via pointer cast.
  
  No functional change intended.
  
  Discussed with:   kib (earlier version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20135

Modified:
  head/sys/amd64/include/pcpu.h
  head/sys/i386/include/pcpu.h
  head/sys/x86/x86/cpu_machdep.c

Modified: head/sys/amd64/include/pcpu.h
==
--- head/sys/amd64/include/pcpu.h   Sat May  4 16:27:58 2019
(r347128)
+++ head/sys/amd64/include/pcpu.h   Sat May  4 17:35:13 2019
(r347129)
@@ -36,6 +36,13 @@
 #endif
 
 #definePC_PTI_STACK_SZ 16
+
+struct monitorbuf {
+   int idle_state; /* Used by cpu_idle_mwait. */
+   char padding[128 - (1 * sizeof(int))];
+};
+_Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line");
+
 /*
  * The SMP parts are setup in pmap.c and locore.s for the BSP, and
  * mp_machdep.c sets up the data for the AP's to "see" when they awake.
@@ -44,7 +51,7 @@
  * other processors"
  */
 #definePCPU_MD_FIELDS  
\
-   charpc_monitorbuf[128] __aligned(128); /* cache line */ \
+   struct monitorbuf pc_monitorbuf __aligned(128); /* cache line */\
struct  pcpu *pc_prvspace;  /* Self-reference */\
struct  pmap *pc_curpmap;   \
struct  amd64tss *pc_tssp;  /* TSS segment active on CPU */ \

Modified: head/sys/i386/include/pcpu.h
==
--- head/sys/i386/include/pcpu.hSat May  4 16:27:58 2019
(r347128)
+++ head/sys/i386/include/pcpu.hSat May  4 17:35:13 2019
(r347129)
@@ -41,6 +41,12 @@
 #include 
 #include 
 
+struct monitorbuf {
+   int idle_state; /* Used by cpu_idle_mwait. */
+   char padding[128 - (1 * sizeof(int))];
+};
+_Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line");
+
 /*
  * The SMP parts are setup in pmap.c and machdep.c for the BSP, and
  * pmap.c and mp_machdep.c sets up the data for the AP's to "see" when
@@ -50,7 +56,7 @@
  */
 
 #definePCPU_MD_FIELDS  
\
-   charpc_monitorbuf[128] __aligned(128); /* cache line */ \
+   struct monitorbuf pc_monitorbuf __aligned(128); /* cache line */\
struct  pcpu *pc_prvspace;  /* Self-reference */\
struct  pmap *pc_curpmap;   \
struct  segment_descriptor pc_common_tssd;  \

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  Sat May  4 16:27:58 2019
(r347128)
+++ head/sys/x86/x86/cpu_machdep.c  Sat May  4 17:35:13 2019
(r347129)
@@ -164,7 +164,7 @@ acpi_cpu_idle_mwait(uint32_t mwait_hint)
 * but all Intel CPUs provide hardware coordination.
 */
 
-   state = (int *)PCPU_PTR(monitorbuf);
+   state = &PCPU_PTR(monitorbuf)->idle_state;
KASSERT(atomic_load_int(state) == STATE_SLEEPING,
("cpu_mwait_cx: wrong monitorbuf state"));
atomic_store_int(state, STATE_MWAIT);
@@ -422,7 +422,7 @@ cpu_idle_acpi(sbintime_t sbt)
 {
int *state;
 
-   state = (int *)PCPU_PTR(monitorbuf);
+   state = &PCPU_PTR(monitorbuf)->idle_state;
atomic_store_int(state, STATE_SLEEPING);
 
/* See comments in cpu_idle_hlt(). */
@@ -441,7 +441,7 @@ cpu_idle_hlt(sbintime_t sbt)
 {
int *state;
 
-   state = (int *)PCPU_PTR(monitorbuf);
+   state = &PCPU_PTR(monitorbuf)->idle_state;
atomic_store_int(state, STATE_SLEEPING);
 
/*
@@ -473,7 +473,7 @@ cpu_idle_mwait(sbintime_t sbt)
 {
int *state;
 
-   state = (int *)PCPU_PTR(monitorbuf);
+   state = &PCPU_PTR(monitorbuf)->idle_state;
atomic_store_int(state, STATE_MWAIT);
 
/* See comments in cpu_idle_hlt(). */
@@ -498,7 +498,7 @@ cpu_idle_spin(sbintime_t sbt)
int *state;
int i;
 
-   state = (int *)PCPU_PTR(monitorbuf);
+   state = &PCPU_PTR(monitorbuf)->idle_state;
atomic_store_int(state, STATE_RUNNING);
 
/*
@@ -598,9 +598,11 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_apl31, CTLFLAG_RW,
 int
 cpu_idle_wakeup(int cpu)
 {
+   struct monitorbuf *mb;
int *state;
 
-   state = (int *)pcpu_find(cpu)->pc_monitorbuf;
+   mb = &pcpu_find(cpu)->pc_monitorbuf;
+   state = &mb->idle_state;
switch (atomic_load_int(state)) {
case STATE_SLEEPING:
return (0);

svn commit: r347130 - head/sys/ufs/ufs

2019-05-04 Thread Kirk McKusick
Author: mckusick
Date: Sat May  4 18:00:57 2019
New Revision: 347130
URL: https://svnweb.freebsd.org/changeset/base/347130

Log:
  Zero out the file directory entry metadata to reduce disk
  scavenging disclosure.
  
  Submitted by: David G. Lawrence 
  MFC after:1 week

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

Modified: head/sys/ufs/ufs/ufs_lookup.c
==
--- head/sys/ufs/ufs/ufs_lookup.c   Sat May  4 17:35:13 2019
(r347129)
+++ head/sys/ufs/ufs/ufs_lookup.c   Sat May  4 18:00:57 2019
(r347130)
@@ -1218,16 +1218,21 @@ ufs_dirremove(dvp, ip, flags, isrmdir)
if (ip && rep->d_ino != ip->i_number)
panic("ufs_dirremove: ip %ju does not match dirent ino %ju\n",
(uintmax_t)ip->i_number, (uintmax_t)rep->d_ino);
-   if (dp->i_count == 0) {
+   /*
+* Zero out the file directory entry metadata to reduce disk
+* scavenging disclosure.
+*/
+   bzero(&rep->d_name[0], rep->d_namlen);
+   rep->d_namlen = 0;
+   rep->d_type = 0;
+   rep->d_ino = 0;
+
+   if (dp->i_count != 0) {
/*
-* First entry in block: set d_ino to zero.
-*/
-   ep->d_ino = 0;
-   } else {
-   /*
 * Collapse new free space into previous entry.
 */
ep->d_reclen += rep->d_reclen;
+   rep->d_reclen = 0;
}
 #ifdef UFS_DIRHASH
if (dp->i_dirhash != NULL)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r347131 - head/sys/kern

2019-05-04 Thread Mateusz Guzik
Author: mjg
Date: Sat May  4 19:04:17 2019
New Revision: 347131
URL: https://svnweb.freebsd.org/changeset/base/347131

Log:
  Annotate nprocs with __exclusive_cache_line
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Sat May  4 18:00:57 2019(r347130)
+++ head/sys/kern/kern_fork.c   Sat May  4 19:04:17 2019(r347131)
@@ -185,7 +185,7 @@ sys_rfork(struct thread *td, struct rfork_args *uap)
return (error);
 }
 
-intnprocs = 1; /* process 0 */
+int __exclusive_cache_line nprocs = 1; /* process 0 */
 intlastpid = 0;
 SYSCTL_INT(_kern, OID_AUTO, lastpid, CTLFLAG_RD, &lastpid, 0,
 "Last used PID");
___
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: r347132 - head/sys/kern

2019-05-04 Thread Mateusz Guzik
Author: mjg
Date: Sat May  4 19:05:30 2019
New Revision: 347132
URL: https://svnweb.freebsd.org/changeset/base/347132

Log:
  sysv: get rid of fork/exit hooks if the code is compiled in
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/sysv_ipc.c
  head/sys/kern/sysv_shm.c

Modified: head/sys/kern/sysv_ipc.c
==
--- head/sys/kern/sysv_ipc.cSat May  4 19:04:17 2019(r347131)
+++ head/sys/kern/sysv_ipc.cSat May  4 19:05:30 2019(r347132)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifndef SYSVSHM
 void (*shmfork_hook)(struct proc *, struct proc *) = NULL;
 void (*shmexit_hook)(struct vmspace *) = NULL;
 
@@ -73,6 +74,7 @@ shmexit(struct vmspace *vm)
shmexit_hook(vm);
return;
 }
+#endif
 
 /*
  * Check for IPC permission.

Modified: head/sys/kern/sysv_shm.c
==
--- head/sys/kern/sysv_shm.cSat May  4 19:04:17 2019(r347131)
+++ head/sys/kern/sysv_shm.cSat May  4 19:05:30 2019(r347132)
@@ -137,8 +137,10 @@ static void shmrealloc(void);
 static int shminit(void);
 static int sysvshm_modload(struct module *, int, void *);
 static int shmunload(void);
+#ifndef SYSVSHM
 static void shmexit_myhook(struct vmspace *vm);
 static void shmfork_myhook(struct proc *p1, struct proc *p2);
+#endif
 static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS);
 static void shm_remove(struct shmid_kernel *, int);
 static struct prison *shm_find_prison(struct ucred *);
@@ -810,8 +812,13 @@ sys_shmget(struct thread *td, struct shmget_args *uap)
return (error);
 }
 
+#ifdef SYSVSHM
+void
+shmfork(struct proc *p1, struct proc *p2)
+#else
 static void
 shmfork_myhook(struct proc *p1, struct proc *p2)
+#endif
 {
struct shmmap_state *shmmap_s;
size_t size;
@@ -834,8 +841,13 @@ shmfork_myhook(struct proc *p1, struct proc *p2)
SYSVSHM_UNLOCK();
 }
 
+#ifdef SYSVSHM
+void
+shmexit(struct vmspace *vm)
+#else
 static void
 shmexit_myhook(struct vmspace *vm)
+#endif
 {
struct shmmap_state *base, *shm;
int i;
@@ -956,8 +968,10 @@ shminit(void)
shm_nused = 0;
shm_committed = 0;
sx_init(&sysvshmsx, "sysvshmsx");
+#ifndef SYSVSHM
shmexit_hook = &shmexit_myhook;
shmfork_hook = &shmfork_myhook;
+#endif
 
/* Set current prisons according to their allow.sysvipc. */
shm_prison_slot = osd_jail_register(NULL, methods);
@@ -1021,8 +1035,10 @@ shmunload(void)
vm_object_deallocate(shmsegs[i].object);
}
free(shmsegs, M_SHM);
+#ifndef SYSVSHM
shmexit_hook = NULL;
shmfork_hook = NULL;
+#endif
sx_destroy(&sysvshmsx);
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: r347133 - head/sys/arm64/arm64

2019-05-04 Thread Konstantin Belousov
Author: kib
Date: Sat May  4 19:40:30 2019
New Revision: 347133
URL: https://svnweb.freebsd.org/changeset/base/347133

Log:
  arm64: Properly restore PAN when done with userspace access in casueword.
  
  Approved by:  andrew
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/arm64/arm64/support.S

Modified: head/sys/arm64/arm64/support.S
==
--- head/sys/arm64/arm64/support.S  Sat May  4 19:05:30 2019
(r347132)
+++ head/sys/arm64/arm64/support.S  Sat May  4 19:40:30 2019
(r347133)
@@ -64,8 +64,8 @@ ENTRY(casueword32)
b.ne2f  /* Not equal, exit */
stxrw5, w3, [x0]/* Store the new data */
cbnzw5, 1b  /* Retry on failure */
-   EXIT_USER_ACCESS(w6)
-2: SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
+2: EXIT_USER_ACCESS(w6)
+   SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
str w4, [x2]/* Store the read data */
mov x0, #0  /* Success */
ret /* Return */
@@ -86,8 +86,8 @@ ENTRY(casueword)
b.ne2f  /* Not equal, exit */
stxrw5, x3, [x0]/* Store the new data */
cbnzw5, 1b  /* Retry on failure */
-   EXIT_USER_ACCESS(w6)
-2: SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
+2: EXIT_USER_ACCESS(w6)
+   SET_FAULT_HANDLER(xzr, x5)  /* Reset the fault handler */
str x4, [x2]/* Store the read data */
mov x0, #0  /* Success */
ret /* Return */
___
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: r347134 - in head/sys: amd64/include i386/include kern x86/include x86/x86

2019-05-04 Thread Conrad Meyer
Author: cem
Date: Sat May  4 20:34:26 2019
New Revision: 347134
URL: https://svnweb.freebsd.org/changeset/base/347134

Log:
  x86: Implement MWAIT support for stopping a CPU
  
  IPI_STOP is used after panic or when ddb is entered manually.  MONITOR/
  MWAIT allows CPUs that support the feature to sleep in a low power way
  instead of spinning.  Something similar is already used at idle.
  
  It is perhaps especially useful in oversubscribed VM environments, and is
  safe to use even if the panic/ddb thread is not the BSP.  (Except in the
  presence of MWAIT errata, which are detected automatically on platforms with
  known wakeup problems.)
  
  It can be tuned/sysctled with "machdep.stop_mwait," which defaults to 0
  (off).  This commit also introduces the tunable
  "machdep.mwait_cpustop_broken," which defaults to 0, unless the CPU has
  known errata, but may be set to "1" in loader.conf to signal that mwait
  wakeup is broken on CPUs FreeBSD does not yet know about.
  
  Unfortunately, Bhyve doesn't yet support MONITOR extensions, so this doesn't
  help bhyve hypervisors running FreeBSD guests.
  
  Submitted by:   Anton Rang  (earlier version)
  Reviewed by:  kib
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20135

Modified:
  head/sys/amd64/include/pcpu.h
  head/sys/i386/include/pcpu.h
  head/sys/kern/subr_smp.c
  head/sys/x86/include/x86_smp.h
  head/sys/x86/x86/cpu_machdep.c
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/include/pcpu.h
==
--- head/sys/amd64/include/pcpu.h   Sat May  4 19:40:30 2019
(r347133)
+++ head/sys/amd64/include/pcpu.h   Sat May  4 20:34:26 2019
(r347134)
@@ -39,7 +39,8 @@
 
 struct monitorbuf {
int idle_state; /* Used by cpu_idle_mwait. */
-   char padding[128 - (1 * sizeof(int))];
+   int stop_state; /* Used by cpustop_handler. */
+   char padding[128 - (2 * sizeof(int))];
 };
 _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line");
 
@@ -89,6 +90,9 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c
 #definePC_DBREG_CMD_LOAD   1
 
 #ifdef _KERNEL
+
+#define MONITOR_STOPSTATE_RUNNING  0
+#define MONITOR_STOPSTATE_STOPPED  1
 
 #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF)
 

Modified: head/sys/i386/include/pcpu.h
==
--- head/sys/i386/include/pcpu.hSat May  4 19:40:30 2019
(r347133)
+++ head/sys/i386/include/pcpu.hSat May  4 20:34:26 2019
(r347134)
@@ -43,7 +43,8 @@
 
 struct monitorbuf {
int idle_state; /* Used by cpu_idle_mwait. */
-   char padding[128 - (1 * sizeof(int))];
+   int stop_state; /* Used by cpustop_handler. */
+   char padding[128 - (2 * sizeof(int))];
 };
 _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line");
 
@@ -89,6 +90,9 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x c
char__pad[3610]
 
 #ifdef _KERNEL
+
+#define MONITOR_STOPSTATE_RUNNING  0
+#define MONITOR_STOPSTATE_STOPPED  1
 
 #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF)
 

Modified: head/sys/kern/subr_smp.c
==
--- head/sys/kern/subr_smp.cSat May  4 19:40:30 2019(r347133)
+++ head/sys/kern/subr_smp.cSat May  4 20:34:26 2019(r347134)
@@ -351,42 +351,68 @@ generic_restart_cpus(cpuset_t map, u_int type)
 #endif
volatile cpuset_t *cpus;
 
-   KASSERT(type == IPI_STOP || type == IPI_STOP_HARD
 #if X86
-   || type == IPI_SUSPEND
-#endif
-   , ("%s: invalid stop type", __func__));
+   KASSERT(type == IPI_STOP || type == IPI_STOP_HARD
+   || type == IPI_SUSPEND, ("%s: invalid stop type", __func__));
 
if (!smp_started)
return (0);
 
CTR1(KTR_SMP, "restart_cpus(%s)", cpusetobj_strprint(cpusetbuf, &map));
 
-#if X86
if (type == IPI_SUSPEND)
cpus = &resuming_cpus;
else
-#endif
cpus = &stopped_cpus;
 
/* signal other cpus to restart */
-#if X86
if (type == IPI_SUSPEND)
CPU_COPY_STORE_REL(&map, &toresume_cpus);
else
-#endif
CPU_COPY_STORE_REL(&map, &started_cpus);
 
-#if X86
+   /*
+* Wake up any CPUs stopped with MWAIT.  From MI code we can't tell if
+* MONITOR/MWAIT is enabled, but the potentially redundant writes are
+* relatively inexpensive.
+*/
+   if (type == IPI_STOP) {
+   struct monitorbuf *mb;
+   u_int id;
+
+   CPU_FOREACH(id) {
+   if (!CPU_ISSET(id, &map))
+   continue;
+
+   mb = &pcpu_find(id)->pc_monitorbuf;
+   atomic_store_int

svn commit: r347139 - in head/contrib/sqlite3: . tea tea/generic

2019-05-04 Thread Cy Schubert
Author: cy
Date: Sun May  5 04:14:17 2019
New Revision: 347139
URL: https://svnweb.freebsd.org/changeset/base/347139

Log:
  MFV r347136:
  
  Update sqlite3-3.27.2 (3270200) --> sqlite3-3.28.0 (328)
  
  MFC after:3 days
  Security: CVE-2019-9937, CVE-2019-9936

Modified:
  head/contrib/sqlite3/Makefile.msc
  head/contrib/sqlite3/configure
  head/contrib/sqlite3/configure.ac
  head/contrib/sqlite3/shell.c
  head/contrib/sqlite3/sqlite3.c
  head/contrib/sqlite3/sqlite3.h
  head/contrib/sqlite3/sqlite3ext.h
  head/contrib/sqlite3/tea/configure
  head/contrib/sqlite3/tea/configure.ac
  head/contrib/sqlite3/tea/generic/tclsqlite3.c
Directory Properties:
  head/contrib/sqlite3/   (props changed)

Modified: head/contrib/sqlite3/Makefile.msc
==
--- head/contrib/sqlite3/Makefile.msc   Sun May  5 00:21:56 2019
(r347138)
+++ head/contrib/sqlite3/Makefile.msc   Sun May  5 04:14:17 2019
(r347139)
@@ -433,9 +433,9 @@ UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
 # will run on the platform that is doing the build.
 #
 !IF $(USE_FULLWARN)!=0
-BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
+BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
 !ELSE
-BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
+BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
 !ENDIF
 
 # Check if assembly code listings should be generated for the source
@@ -808,7 +808,7 @@ BCC = $(BCC) -Zi
 # Command line prefixes for compiling code, compiling resources,
 # linking, etc.
 #
-LTCOMPILE = $(TCC) -Fo$@
+LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
 LTRCOMPILE = $(RCC) -r
 LTLIB = lib.exe
 LTLINK = $(TCC) -Fe$@
@@ -826,6 +826,11 @@ LTLIBS = $(LTLIBS) rpcrt4.lib
 !IFDEF PLATFORM
 LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
 LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
+!ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
+"$(VISUALSTUDIOVERSION)"=="14.0" || \
+"$(VISUALSTUDIOVERSION)"=="15.0"
+LTLINKOPTS = /NOLOGO /MACHINE:x86
+LTLIBOPTS = /NOLOGO /MACHINE:x86
 !ELSE
 LTLINKOPTS = /NOLOGO
 LTLIBOPTS = /NOLOGO

Modified: head/contrib/sqlite3/configure
==
--- head/contrib/sqlite3/configure  Sun May  5 00:21:56 2019
(r347138)
+++ head/contrib/sqlite3/configure  Sun May  5 04:14:17 2019
(r347139)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sqlite 3.27.2.
+# Generated by GNU Autoconf 2.69 for sqlite 3.28.0.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.27.2'
-PACKAGE_STRING='sqlite 3.27.2'
+PACKAGE_VERSION='3.28.0'
+PACKAGE_STRING='sqlite 3.28.0'
 PACKAGE_BUGREPORT='http://www.sqlite.org'
 PACKAGE_URL=''
 
@@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sqlite 3.27.2 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.28.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1412,7 +1412,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of sqlite 3.27.2:";;
+ short | recursive ) echo "Configuration of sqlite 3.28.0:";;
esac
   cat <<\_ACEOF
 
@@ -1537,7 +1537,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.27.2
+sqlite configure 3.28.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sqlite $as_me 3.27.2, which was
+It was created by sqlite $as_me 3.28.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2818,7 +2818,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='sqlite'
- VERSION='3.27.2'
+ VERSION='3.28.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sqlite $as_me 3.27.2, which was
+This file was extended by sqlite $as_me 3.28.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -14495,7 +14495,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/&/g'`"
 ac_cs_version="\\
-sqlite config.status 3.27.2
+sqlite config.status 3.28.0
 configured by $0, generat

svn commit: r347140 - in head/sys/dev/ath: . ath_rate/amrr ath_rate/onoe ath_rate/sample

2019-05-04 Thread Adrian Chadd
Author: adrian
Date: Sun May  5 04:56:37 2019
New Revision: 347140
URL: https://svnweb.freebsd.org/changeset/base/347140

Log:
  [ath] [ath_rate] Fix ANI calibration during non-ACTIVE states; start poking 
at rate control
  
  These are some fun issues I've found with my upstairs wifi link at such a 
ridiculous
  low signal level (like, < 5dB.)
  
  * Add per-station tx/rx rssi statistics, in potential preparation to use that
in the RX rate control.
  
  * Call the rate control on each received frame to let it potentially use
it as a hint for what rates to potentially use.  It's a no-op right now.
  
  * Do ANI calibration during scan as well. The ath_newstate() call was 
disabling the
ANI timer and only re-enabling it during transitions to _RUN.  This has the
unfortunate side-effect that if ANI deafened the NIC because of interference
and it disassociated, it wouldn't be reset and the scan would never hear 
beacons.
  
  The ANI configuration is stored at least globally on some HALs and per-channel
  on others.  Because of this a NIC reset wouldn't help; the ANI parameters 
would
  simply be programmed back in.
  
  Now, I have a feeling I also need to do this during AUTH/ASSOC too and maybe,
  if I'm feeling clever, I need to reset the ANI parameters on a given channel
  during a transition through INIT or if the VAP is destroyed/re-created.
  However for now this gets me out of the immediate weeds with connectivity
  upstairs (and thus I /can/ commit); I'll keep chipping away at tidying this
  stuff up in subsequent commits.
  
  Tested:
  
  * AR9344 (Wasp), 2G STA mode

Modified:
  head/sys/dev/ath/ath_rate/amrr/amrr.c
  head/sys/dev/ath/ath_rate/onoe/onoe.c
  head/sys/dev/ath/ath_rate/sample/sample.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_tx_edma.c
  head/sys/dev/ath/if_athrate.h
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c
==
--- head/sys/dev/ath/ath_rate/amrr/amrr.c   Sun May  5 04:14:17 2019
(r347139)
+++ head/sys/dev/ath/ath_rate/amrr/amrr.c   Sun May  5 04:56:37 2019
(r347140)
@@ -196,6 +196,11 @@ ath_rate_newassoc(struct ath_softc *sc, struct ath_nod
ath_rate_ctl_start(sc, &an->an_node);
 }
 
+void
+ath_rate_update_rx_rssi(struct ath_softc *sc, struct ath_node *an, int rssi)
+{
+}
+
 static void 
 node_reset(struct amrr_node *amn)
 {

Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c
==
--- head/sys/dev/ath/ath_rate/onoe/onoe.c   Sun May  5 04:14:17 2019
(r347139)
+++ head/sys/dev/ath/ath_rate/onoe/onoe.c   Sun May  5 04:56:37 2019
(r347140)
@@ -189,6 +189,12 @@ ath_rate_newassoc(struct ath_softc *sc, struct ath_nod
ath_rate_ctl_start(sc, &an->an_node);
 }
 
+void
+ath_rate_update_rx_rssi(struct ath_softc *sc, struct ath_node *an, int rssi)
+{
+}
+
+
 static void
 ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
 {

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==
--- head/sys/dev/ath/ath_rate/sample/sample.c   Sun May  5 04:14:17 2019
(r347139)
+++ head/sys/dev/ath/ath_rate/sample/sample.c   Sun May  5 04:56:37 2019
(r347140)
@@ -1019,6 +1019,12 @@ ath_rate_newassoc(struct ath_softc *sc, struct ath_nod
ath_rate_ctl_reset(sc, &an->an_node);
 }
 
+void
+ath_rate_update_rx_rssi(struct ath_softc *sc, struct ath_node *an, int rssi)
+{
+}
+
+
 static const struct txschedule *mrr_schedules[IEEE80211_MODE_MAX+2] = {
NULL,   /* IEEE80211_MODE_AUTO */
series_11a, /* IEEE80211_MODE_11A */

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sun May  5 04:14:17 2019(r347139)
+++ head/sys/dev/ath/if_ath.c   Sun May  5 04:56:37 2019(r347140)
@@ -3882,6 +3882,10 @@ ath_node_alloc(struct ieee80211vap *vap, const uint8_t
/* XXX setup ath_tid */
ath_tx_tid_init(sc, an);
 
+   an->an_node_stats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
+   an->an_node_stats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
+   an->an_node_stats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
+
DPRINTF(sc, ATH_DEBUG_NODE, "%s: %6D: an %p\n", __func__, mac, ":", an);
return &an->an_node;
 }
@@ -4493,6 +4497,8 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *
sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi,
ts->ts_rssi);
+   ATH_RSSI_LPF(ATH_NODE(ni)->an_node_stats.ns_avgtxrssi,
+   ts->ts_rssi);
}
ATH_TXQ_UNLOCK(txq);
 

svn commit: r347141 - head/sys/dev/ath/ath_rate/sample

2019-05-04 Thread Adrian Chadd
Author: adrian
Date: Sun May  5 06:32:40 2019
New Revision: 347141
URL: https://svnweb.freebsd.org/changeset/base/347141

Log:
  [ath_rate_sample] Have the final attempted rate in 11n modes to be the lowest 
one.
  
  Right now ath_rate_sample has a fixed rate schedule, rather than the 
minstrel_ht
  style "best, good, most reliable" triplet.  So, if higher rates are tried then
  it'll not fail back to a lower MCS rate in that transmission schedule.
  
  This means that in low SNR situations it'll not easily drop to MCS0 unless 
enough
  transmissions occur to allow rate control to eventually decide to drop; and if
  it's TCP traffic it'll get slowed down because of packet loss.
  
  It's worse for 2-stream and 3-stream rates; it doesn't ever fall back to lower
  stream rates, and these higher stream rates required higher SNR to work.
  
  So instead let's (for now?) have each of the 11n transmit rates use MCS0 as
  the last attempt. ath_rate_sample will quickly see that rate succeeds more
  and will move to it much quicker.
  
  Testing:
  
  * AR9344 (Wasp) - 2G STA mode

Modified:
  head/sys/dev/ath/ath_rate/sample/tx_schedules.h

Modified: head/sys/dev/ath/ath_rate/sample/tx_schedules.h
==
--- head/sys/dev/ath/ath_rate/sample/tx_schedules.h Sun May  5 04:56:37 
2019(r347140)
+++ head/sys/dev/ath/ath_rate/sample/tx_schedules.h Sun May  5 06:32:40 
2019(r347141)
@@ -172,30 +172,30 @@ static const struct txschedule series_11ng[] = {
{ 4,NG1(  26), 3,NG1(19.5), 4,NG1( 6.5), 2,NG1(6.5) },  /*  26Mb/s */
{ 4,NG1(  39), 3,NG1(  26), 4,NG1(19.5), 2,NG1(6.5) },  /*  39Mb/s */
{ 4,NG1(  52), 3,NG1(  39), 4,NG1(  26), 2,NG1(6.5) },  /*  52Mb/s */
-   { 4,NG1(58.5), 3,NG1(  52), 4,NG1(  39), 2,NG1( 13) },  /*58.5Mb/s */
-   { 4,NG1(  65), 3,NG1(58.5), 4,NG1(  52), 2,NG1( 13) },  /*  65Mb/s */
+   { 4,NG1(58.5), 3,NG1(  52), 4,NG1(  39), 2,NG1(6.5) },  /*58.5Mb/s */
+   { 4,NG1(  65), 3,NG1(58.5), 4,NG1(  52), 2,NG1(6.5) },  /*  65Mb/s */
 
/* 2 stream rates */
 
-   { 3,NG2(  13), 3,NG2(  13), 0,NG2(  13), 0,NG2( 13) },  /*  13Mb/s */
-   { 4,NG2(  26), 3,NG2(  13), 4,NG2(  13), 0,NG2( 13) },  /*  26Mb/s */
-   { 4,NG2(  39), 3,NG2(  26), 4,NG2(  13), 2,NG2( 13) },  /*  39Mb/s */
-   { 4,NG2(  52), 3,NG2(  39), 4,NG2(  26), 2,NG2( 13) },  /*  52Mb/s */
-   { 4,NG2(  78), 3,NG2(  52), 4,NG2(  39), 2,NG2( 13) },  /*  78Mb/s */
-   { 4,NG2( 104), 3,NG2(  78), 4,NG2(  52), 2,NG2( 13) },  /* 104Mb/s */
-   { 4,NG2( 117), 3,NG2( 104), 4,NG2(  78), 2,NG2( 26) },  /* 117Mb/s */
-   { 4,NG2( 130), 3,NG2( 117), 4,NG2( 104), 2,NG2( 26) },  /* 130Mb/s */
+   { 3,NG2(  13), 3,NG1(6.5), 0,NG2(  13), 0,NG2( 13) },  /*  13Mb/s */
+   { 4,NG2(  26), 3,NG2(  13), 4,NG1(6.5), 0,NG2( 13) },  /*  26Mb/s */
+   { 4,NG2(  39), 3,NG2(  26), 4,NG2(  13), 2,NG1(6.5) },  /*  39Mb/s */
+   { 4,NG2(  52), 3,NG2(  39), 4,NG2(  26), 2,NG1(6.5) },  /*  52Mb/s */
+   { 4,NG2(  78), 3,NG2(  52), 4,NG2(  39), 2,NG1(6.5) },  /*  78Mb/s */
+   { 4,NG2( 104), 3,NG2(  78), 4,NG2(  52), 2,NG1(6.5) },  /* 104Mb/s */
+   { 4,NG2( 117), 3,NG2( 104), 4,NG2(  78), 2,NG1(6.5) },  /* 117Mb/s */
+   { 4,NG2( 130), 3,NG2( 117), 4,NG2( 104), 2,NG1(6.5) },  /* 130Mb/s */
 
/* 3 stream rates */
 
-   { 3,NG3(19.5), 3,NG3(19.5), 0,NG3(19.5), 0,NG3(19.5) },  /*  19Mb/s */
-   { 3,NG3(  39), 3,NG3(19.5), 0,NG3(19.5), 0,NG3(19.5) },  /*  39Mb/s */
-   { 3,NG3(58.5), 3,NG3(  39), 0,NG3(19.5), 0,NG3(19.5) },  /*  58Mb/s */
-   { 3,NG3(  78), 3,NG3(58.5), 0,NG3(  39), 0,NG3(19.5) },  /*  78Mb/s */
-   { 3,NG3( 117), 3,NG3(  78), 0,NG3(58.5), 0,NG3(19.5) },  /* 117Mb/s */
-   { 3,NG3( 156), 3,NG3( 117), 0,NG3(  78), 0,NG3(19.5) },  /*  156Mb/s */
-   { 3,NG3(175.5), 3,NG3( 156), 0,NG3( 117), 0,NG3(  39) },  /*  175Mb/s */
-   { 3,NG3( 195), 3,NG3( 195), 0,NG3( 156), 0,NG3(58.5) },  /* 195Mb/s */
+   { 3,NG3(19.5), 3,NG1(6.5), 0,NG3(19.5), 0,NG3(19.5) },  /*  19Mb/s */
+   { 3,NG3(  39), 3,NG3(19.5), 4,NG1(6.5), 0,NG3(19.5) },  /*  39Mb/s */
+   { 3,NG3(58.5), 3,NG3(  39), 4,NG1(6.5), 0,NG3(19.5) },  /*  58Mb/s */
+   { 3,NG3(  78), 3,NG3(58.5), 4,NG1(6.5), 0,NG3(19.5) },  /*  78Mb/s */
+   { 3,NG3( 117), 3,NG3(  78), 4,NG1(6.5), 0,NG3(19.5) },  /* 117Mb/s */
+   { 3,NG3( 156), 3,NG3( 117), 4,NG1(6.5), 0,NG3(19.5) },  /*  156Mb/s */
+   { 3,NG3(175.5), 3,NG3( 156), 4,NG1(6.5), 0,NG3(  39) },  /*  175Mb/s */
+   { 3,NG3( 195), 3,NG3( 195), 4,NG1(6.5), 0,NG3(58.5) },  /* 195Mb/s */
 
 };
 #undef G
___
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: r347142 - head/stand/common

2019-05-04 Thread Toomas Soome
Author: tsoome
Date: Sun May  5 06:38:47 2019
New Revision: 347142
URL: https://svnweb.freebsd.org/changeset/base/347142

Log:
  loader: validate sectorsize argument in disk_open()
  
  The bug and patch is reported against 11.2, but it is good idea to have
  the check in place for all versions.
  
  PR:   236585
  Submitted by: j...@feith.com
  Reported by:  j...@feith.com
  MFC after:1 day

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cSun May  5 06:32:40 2019(r347141)
+++ head/stand/common/disk.cSun May  5 06:38:47 2019(r347142)
@@ -221,6 +221,10 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
struct ptable_entry part;
int rc, slice, partition;
 
+   if (sectorsize == 0) {
+   DPRINTF("unknown sector size");
+   return (ENXIO);
+   }
rc = 0;
od = (struct open_disk *)malloc(sizeof(struct open_disk));
if (od == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"