svn commit: r277378 - head/sys/dev/ofw

2015-01-19 Thread Andrew Turner
Author: andrew
Date: Mon Jan 19 11:06:56 2015
New Revision: 277378
URL: https://svnweb.freebsd.org/changeset/base/277378

Log:
  Make the clock-frequency property optional as it may not be present on FDT
  systems.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ofw/ofw_cpu.c

Modified: head/sys/dev/ofw/ofw_cpu.c
==
--- head/sys/dev/ofw/ofw_cpu.c  Mon Jan 19 11:02:23 2015(r277377)
+++ head/sys/dev/ofw/ofw_cpu.c  Mon Jan 19 11:06:56 2015(r277378)
@@ -1,7 +1,11 @@
 /*-
  * Copyright (C) 2009 Nathan Whitehorn
+ * Copyright (C) 2015 The FreeBSD Foundation
  * All rights reserved.
  *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -193,10 +197,11 @@ ofw_cpu_attach(device_t dev)
}
sc->sc_cpu_pcpu = pcpu_find(cell);
if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) < 0) {
-   device_printf(dev, "missing 'clock-frequency' property\n");
-   return (ENXIO);
-   }
-   sc->sc_nominal_mhz = cell / 100; /* convert to MHz */
+   if (bootverbose)
+   device_printf(dev,
+   "missing 'clock-frequency' property\n");
+   } else
+   sc->sc_nominal_mhz = cell / 100; /* convert to MHz */
 
bus_generic_probe(dev);
return (bus_generic_attach(dev));
@@ -214,8 +219,11 @@ ofw_cpu_read_ivar(device_t dev, device_t
*result = (uintptr_t)sc->sc_cpu_pcpu;
return (0);
case CPU_IVAR_NOMINAL_MHZ:
-   *result = (uintptr_t)sc->sc_nominal_mhz;
-   return (0);
+   if (sc->sc_nominal_mhz > 0) {
+   *result = (uintptr_t)sc->sc_nominal_mhz;
+   return (0);
+   }
+   break;
}
 
return (ENOENT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277380 - head/sys/netinet

2015-01-19 Thread Michael Tuexen
Author: tuexen
Date: Mon Jan 19 11:52:08 2015
New Revision: 277380
URL: https://svnweb.freebsd.org/changeset/base/277380

Log:
  Code cleanup.
  
  Reported by:  Coverity
  CID:  749578
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_timer.c

Modified: head/sys/netinet/sctp_timer.c
==
--- head/sys/netinet/sctp_timer.c   Mon Jan 19 11:07:29 2015
(r277379)
+++ head/sys/netinet/sctp_timer.c   Mon Jan 19 11:52:08 2015
(r277380)
@@ -337,7 +337,7 @@ sctp_find_alternate_net(struct sctp_tcb 
return (NULL);
}
}
-   do {
+   for (;;) {
alt = TAILQ_NEXT(mnet, sctp_next);
if (alt == NULL) {
once++;
@@ -356,7 +356,6 @@ sctp_find_alternate_net(struct sctp_tcb 
}
alt->src_addr_selected = 0;
}
-   /* sa_ignore NO_NULL_CHK */
if (((alt->dest_state & SCTP_ADDR_REACHABLE) == 
SCTP_ADDR_REACHABLE) &&
(alt->ro.ro_rt != NULL) &&
(!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) {
@@ -364,14 +363,14 @@ sctp_find_alternate_net(struct sctp_tcb 
break;
}
mnet = alt;
-   } while (alt != NULL);
+   }
 
if (alt == NULL) {
/* Case where NO insv network exists (dormant state) */
/* we rotate destinations */
once = 0;
mnet = net;
-   do {
+   for (;;) {
if (mnet == NULL) {
return (TAILQ_FIRST(&stcb->asoc.nets));
}
@@ -382,15 +381,17 @@ sctp_find_alternate_net(struct sctp_tcb 
break;
}
alt = TAILQ_FIRST(&stcb->asoc.nets);
+   if (alt == NULL) {
+   break;
+   }
}
-   /* sa_ignore NO_NULL_CHK */
if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) &&
(alt != net)) {
/* Found an alternate address */
break;
}
mnet = alt;
-   } while (alt != NULL);
+   }
}
if (alt == NULL) {
return (net);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277385 - head/sys/cam

2015-01-19 Thread Alexander Motin
Author: mav
Date: Mon Jan 19 15:52:32 2015
New Revision: 277385
URL: https://svnweb.freebsd.org/changeset/base/277385

Log:
  Remove extra mtx_unlock().
  
  Submitted by: Dmitry Luhtionov 
  MFC after:1 week

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Mon Jan 19 15:35:19 2015(r277384)
+++ head/sys/cam/cam_xpt.c  Mon Jan 19 15:52:32 2015(r277385)
@@ -893,7 +893,6 @@ xpt_init(void *dummy)
if ((status = xpt_create_path(&path, NULL, CAM_XPT_PATH_ID,
  CAM_TARGET_WILDCARD,
  CAM_LUN_WILDCARD)) != CAM_REQ_CMP) {
-   mtx_unlock(&xsoftc.xpt_lock);
printf("xpt_init: xpt_create_path failed with status %#x,"
   " failing attach\n", status);
return (EINVAL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277390 - head/sys/fs/devfs

2015-01-19 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 19 17:24:52 2015
New Revision: 277390
URL: https://svnweb.freebsd.org/changeset/base/277390

Log:
  Ignore devfs directory entries for devices either being destroyed or
  delisted.  The check is racy.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Mon Jan 19 17:02:30 2015
(r277389)
+++ head/sys/fs/devfs/devfs_devs.c  Mon Jan 19 17:24:52 2015
(r277390)
@@ -192,6 +192,16 @@ devfs_find(struct devfs_dirent *dd, cons
continue;
if (type != 0 && type != de->de_dirent->d_type)
continue;
+
+   /*
+* The race with finding non-active name is not
+* completely closed by the check, but it is similar
+* to the devfs_allocv() in making it unlikely enough.
+*/
+   if (de->de_dirent->d_type == DT_CHR &&
+   (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+   continue;
+
if (bcmp(name, de->de_dirent->d_name, namelen) != 0)
continue;
break;

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Mon Jan 19 17:02:30 2015
(r277389)
+++ head/sys/fs/devfs/devfs_vnops.c Mon Jan 19 17:24:52 2015
(r277390)
@@ -1045,6 +1045,9 @@ devfs_mknod(struct vop_mknod_args *ap)
TAILQ_FOREACH(de, &dd->de_dlist, de_list) {
if (cnp->cn_namelen != de->de_dirent->d_namlen)
continue;
+   if (de->de_dirent->d_type == DT_CHR &&
+   (de->de_cdp->cdp_flags & CDP_ACTIVE) == 0)
+   continue;
if (bcmp(cnp->cn_nameptr, de->de_dirent->d_name,
de->de_dirent->d_namlen) != 0)
continue;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277391 - in head/sys: fs/devfs kern

2015-01-19 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 19 17:36:52 2015
New Revision: 277391
URL: https://svnweb.freebsd.org/changeset/base/277391

Log:
  Stop enforcing additional reference on all cdevs, which was introduced
  in r277199.  Acquire the neccessary reference in delist_dev_locked()
  and inform destroy_devl() about it using CDP_UNREF_DTR flag.
  
  Fix some style nits, add asserts.
  
  Discussed with:   hselasky
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/devfs/devfs_int.h
  head/sys/kern/kern_conf.c

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Mon Jan 19 17:24:52 2015
(r277390)
+++ head/sys/fs/devfs/devfs_devs.c  Mon Jan 19 17:36:52 2015
(r277391)
@@ -137,12 +137,6 @@ devfs_alloc(int flags)
vfs_timestamp(&ts);
cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
cdev->si_cred = NULL;
-   /*
-* Avoid race with dev_rel() by setting the initial
-* reference count to 1. This last reference is taken
-* by the destroy_dev() function.
-*/
-   cdev->si_refcount = 1;
 
return (cdev);
 }

Modified: head/sys/fs/devfs/devfs_int.h
==
--- head/sys/fs/devfs/devfs_int.h   Mon Jan 19 17:24:52 2015
(r277390)
+++ head/sys/fs/devfs/devfs_int.h   Mon Jan 19 17:36:52 2015
(r277391)
@@ -56,6 +56,7 @@ struct cdev_priv {
u_int   cdp_flags;
 #define CDP_ACTIVE (1 << 0)
 #define CDP_SCHED_DTR  (1 << 1)
+#defineCDP_UNREF_DTR   (1 << 2)
 
u_int   cdp_inuse;
u_int   cdp_maxdirent;

Modified: head/sys/kern/kern_conf.c
==
--- head/sys/kern/kern_conf.c   Mon Jan 19 17:24:52 2015(r277390)
+++ head/sys/kern/kern_conf.c   Mon Jan 19 17:36:52 2015(r277391)
@@ -116,6 +116,8 @@ dev_free_devlocked(struct cdev *cdev)
 
mtx_assert(&devmtx, MA_OWNED);
cdp = cdev2priv(cdev);
+   KASSERT((cdp->cdp_flags & CDP_UNREF_DTR) == 0,
+   ("destroy_dev() was not called after delist_dev(%p)", cdev));
TAILQ_INSERT_HEAD(&cdevp_free_list, cdp, cdp_list);
 }
 
@@ -1035,6 +1037,7 @@ destroy_devl(struct cdev *dev)
 {
struct cdevsw *csw;
struct cdev_privdata *p;
+   struct cdev_priv *cdp;
 
mtx_assert(&devmtx, MA_OWNED);
KASSERT(dev->si_flags & SI_NAMED,
@@ -1043,7 +1046,18 @@ destroy_devl(struct cdev *dev)
("WARNING: Driver mistake: destroy_dev on eternal %d\n",
 dev2unit(dev)));
 
-   devfs_destroy(dev);
+   cdp = cdev2priv(dev);
+   if ((cdp->cdp_flags & CDP_UNREF_DTR) == 0) {
+   /*
+* Avoid race with dev_rel(), e.g. from the populate
+* loop.  If CDP_UNREF_DTR flag is set, the reference
+* to be dropped at the end of destroy_devl() was
+* already taken by delist_dev_locked().
+*/
+   dev_refl(dev);
+
+   devfs_destroy(dev);
+   }
 
/* Remove name marking */
dev->si_flags &= ~SI_NAMED;
@@ -1103,19 +1117,27 @@ destroy_devl(struct cdev *dev)
}
}
dev->si_flags &= ~SI_ALIAS;
-   dev->si_refcount--; /* Avoid race with dev_rel() */
+   cdp->cdp_flags &= ~CDP_UNREF_DTR;
+   dev->si_refcount--;
 
-   if (dev->si_refcount > 0) {
+   if (dev->si_refcount > 0)
LIST_INSERT_HEAD(&dead_cdevsw.d_devs, dev, si_list);
-   } else {
+   else
dev_free_devlocked(dev);
-   }
 }
 
 static void
 delist_dev_locked(struct cdev *dev)
 {
+   struct cdev_priv *cdp;
struct cdev *child;
+
+   mtx_assert(&devmtx, MA_OWNED);
+   cdp = cdev2priv(dev);
+   if ((cdp->cdp_flags & CDP_UNREF_DTR) != 0)
+   return;
+   cdp->cdp_flags |= CDP_UNREF_DTR;
+   dev_refl(dev);
devfs_destroy(dev);
LIST_FOREACH(child, &dev->si_children, si_siblings)
delist_dev_locked(child);
@@ -1124,6 +1146,7 @@ delist_dev_locked(struct cdev *dev)
 void
 delist_dev(struct cdev *dev)
 {
+
dev_lock();
delist_dev_locked(dev);
dev_unlock();
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277392 - in head/sys/powerpc: aim powerpc

2015-01-19 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jan 19 17:58:01 2015
New Revision: 277392
URL: https://svnweb.freebsd.org/changeset/base/277392

Log:
  Add some initial infrastructure for relocating the kernel in place.
  
  MFC after:2 months
  Differential revision:D1554

Modified:
  head/sys/powerpc/aim/locore64.S
  head/sys/powerpc/powerpc/elf64_machdep.c

Modified: head/sys/powerpc/aim/locore64.S
==
--- head/sys/powerpc/aim/locore64.S Mon Jan 19 17:36:52 2015
(r277391)
+++ head/sys/powerpc/aim/locore64.S Mon Jan 19 17:58:01 2015
(r277392)
@@ -121,13 +121,33 @@ ASENTRY_NOPROF(__start)
.align 3
 0: nop
bl  1f
-   .llong  __tocbase + 0x8000
+   .llong  __tocbase + 0x8000 - .
 1: mflr%r2
-   ld  %r2,0(%r2)
+   ld  %r1,0(%r2)
+   add %r2,%r1,%r2
 
/* Set up the stack pointer */
ld  %r1,TOC_REF(tmpstk)(%r2)
-   addi%r1,%r1,TMPSTKSZ-48
+   addi%r1,%r1,TMPSTKSZ-96
+
+   /* Relocate kernel */
+   std %r3,48(%r1)
+   std %r4,56(%r1)
+   std %r5,64(%r1)
+   std %r6,72(%r1)
+   bl  1f
+   .llong _DYNAMIC-.
+1: mflr%r3
+   ld  %r4,0(%r3)
+   add %r3,%r4,%r3
+   ld  %r4,-0x8000(%r2) /* First TOC entry is TOC base */
+   subf%r4,%r4,%r2 /* Subtract from real TOC base to get base */
+   bl  elf_reloc_self
+   nop
+   ld  %r3,48(%r1)
+   ld  %r4,56(%r1)
+   ld  %r5,64(%r1)
+   ld  %r6,72(%r1)
 
/* Switch to 64-bit mode */
mfmsr   %r9

Modified: head/sys/powerpc/powerpc/elf64_machdep.c
==
--- head/sys/powerpc/powerpc/elf64_machdep.cMon Jan 19 17:36:52 2015
(r277391)
+++ head/sys/powerpc/powerpc/elf64_machdep.cMon Jan 19 17:58:01 2015
(r277392)
@@ -119,6 +119,8 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
(sysinit_cfunc_t) elf64_insert_brand_entry,
&freebsd_brand_oinfo);
 
+void elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase);
+
 void
 elf64_dump_thread(struct thread *td, void *dst, size_t *off)
 {
@@ -198,6 +200,37 @@ elf_reloc_internal(linker_file_t lf, Elf
return(0);
 }
 
+void
+elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase)
+{
+   Elf_Rela *rela = 0, *relalim;
+   Elf_Addr relasz = 0;
+   Elf_Addr *where;
+
+   /*
+* Extract the rela/relasz values from the dynamic section
+*/
+   for (; dynp->d_tag != DT_NULL; dynp++) {
+   switch (dynp->d_tag) {
+   case DT_RELA:
+   rela = (Elf_Rela *)(relocbase+dynp->d_un.d_ptr);
+   break;
+   case DT_RELASZ:
+   relasz = dynp->d_un.d_val;
+   break;
+   }
+   }
+
+   /*
+* Relocate these values
+*/
+   relalim = (Elf_Rela *)((caddr_t)rela + relasz);
+   for (; rela < relalim; rela++) {
+   where = (Elf_Addr *)(relocbase + rela->r_offset);
+   *where = (Elf_Addr)(relocbase + rela->r_addend);
+   }
+}
+
 int
 elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
 elf_lookup_fn lookup)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277396 - head/sys/ofed/include/linux

2015-01-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan 19 20:39:48 2015
New Revision: 277396
URL: https://svnweb.freebsd.org/changeset/base/277396

Log:
  Add more functions to the Linux kernel compatibility layer. Add some
  missing includes which are needed when the header files are not
  included in a particular order.
  
  MFC after:1 month
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/ofed/include/linux/bitops.h
  head/sys/ofed/include/linux/cache.h
  head/sys/ofed/include/linux/dma-mapping.h
  head/sys/ofed/include/linux/etherdevice.h
  head/sys/ofed/include/linux/gfp.h
  head/sys/ofed/include/linux/io.h
  head/sys/ofed/include/linux/kernel.h
  head/sys/ofed/include/linux/ktime.h
  head/sys/ofed/include/linux/slab.h

Modified: head/sys/ofed/include/linux/bitops.h
==
--- head/sys/ofed/include/linux/bitops.hMon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/bitops.hMon Jan 19 20:39:48 2015
(r277396)
@@ -288,9 +288,15 @@ bitmap_empty(unsigned long *addr, int si
 
 #defineNBLONG  (NBBY * sizeof(long))
 
+#define__set_bit(i, a) 
\
+atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG))
+
 #defineset_bit(i, a)   
\
 atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG))
 
+#define__clear_bit(i, a)   
\
+atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % 
NBLONG))
+
 #defineclear_bit(i, a) 
\
 atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % 
NBLONG))
 

Modified: head/sys/ofed/include/linux/cache.h
==
--- head/sys/ofed/include/linux/cache.h Mon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/cache.h Mon Jan 19 20:39:48 2015
(r277396)
@@ -30,8 +30,7 @@
 #ifndef_LINUX_CACHE_H_
 #define _LINUX_CACHE_H_
 
-
 #definecache_line_size()   CACHE_LINE_SIZE
-
+#defineL1_CACHE_BYTES  CACHE_LINE_SIZE
 
 #endif /* _LINUX_CACHE_H_ */

Modified: head/sys/ofed/include/linux/dma-mapping.h
==
--- head/sys/ofed/include/linux/dma-mapping.h   Mon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/dma-mapping.h   Mon Jan 19 20:39:48 2015
(r277396)
@@ -139,6 +139,14 @@ dma_alloc_coherent(struct device *dev, s
*dma_handle = 0;
return (mem);
 }
+
+static inline void *
+dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+gfp_t flag)
+{
+
+   return (dma_alloc_coherent(dev, size, dma_handle, flag | __GFP_ZERO));
+}

 static inline void
 dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,

Modified: head/sys/ofed/include/linux/etherdevice.h
==
--- head/sys/ofed/include/linux/etherdevice.h   Mon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/etherdevice.h   Mon Jan 19 20:39:48 2015
(r277396)
@@ -89,6 +89,9 @@ static inline bool is_valid_ether_addr(c
 return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
 }
 
-
+static inline void ether_addr_copy(u8 *dst, const u8 *src)
+{
+   memcpy(dst, src, 6);
+}
 
 #endif /* _LINUX_ETHERDEVICE */

Modified: head/sys/ofed/include/linux/gfp.h
==
--- head/sys/ofed/include/linux/gfp.h   Mon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/gfp.h   Mon Jan 19 20:39:48 2015
(r277396)
@@ -30,6 +30,8 @@
 #ifndef_LINUX_GFP_H_
 #define_LINUX_GFP_H_
 
+#include 
+#include 
 #include 
 #include 
 

Modified: head/sys/ofed/include/linux/io.h
==
--- head/sys/ofed/include/linux/io.hMon Jan 19 18:42:10 2015
(r277395)
+++ head/sys/ofed/include/linux/io.hMon Jan 19 20:39:48 2015
(r277396)
@@ -31,6 +31,7 @@
 #define_LINUX_IO_H_
 
 #include 
+#include 
 
 static inline uint32_t
 __raw_readl(const volatile void *addr)
@@ -89,6 +90,20 @@ writew(uint16_t b, void *addr)
 *(volatile uint16_t *)addr = b;
 }
 
+#undef ioread32be
+static inline uint32_t
+ioread32be(const volatile void *addr)
+{
+   return be32toh(*(const volatile uint32_t *)addr);
+}
+
+#undef iowrite32be
+static inline void
+iowrite32be(uint32_t v, volatile void *addr)
+{
+   *(volatile uint32_t *)addr = htobe32(v);
+}
+
 void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
 #defineiorema

svn commit: r277402 - in head/sys: contrib/rdma/krping dev/cxgb/ulp/iw_cxgb dev/cxgbe/iw_cxgbe ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ofed/dri...

2015-01-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan 19 21:53:00 2015
New Revision: 277402
URL: https://svnweb.freebsd.org/changeset/base/277402

Log:
  Add missing linuxapi module dependencies and always use the FreeBSD
  "MODULE_VERSION" macro definition. Remove the redefinition of the
  "MODULE_VERSION" macro from the Linux kernel compatibility API.
  
  MFC after:1 month
  Reported by:  np@
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/contrib/rdma/krping/krping.c
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c
  head/sys/dev/cxgbe/iw_cxgbe/device.c
  head/sys/ofed/drivers/infiniband/core/device.c
  head/sys/ofed/drivers/infiniband/hw/mlx4/main.c
  head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  head/sys/ofed/drivers/net/mlx4/en_main.c
  head/sys/ofed/drivers/net/mlx4/main.c
  head/sys/ofed/include/linux/module.h

Modified: head/sys/contrib/rdma/krping/krping.c
==
--- head/sys/contrib/rdma/krping/krping.c   Mon Jan 19 21:47:18 2015
(r277401)
+++ head/sys/contrib/rdma/krping/krping.c   Mon Jan 19 21:53:00 2015
(r277402)
@@ -60,6 +60,8 @@ extern int krping_debug;
 MODULE_AUTHOR("Steve Wise");
 MODULE_DESCRIPTION("RDMA ping client/server");
 MODULE_LICENSE("Dual BSD/GPL");
+MODULE_VERSION(krping, 1);
+MODULE_DEPEND(krping, linuxapi, 1, 1, 1);
 
 static __inline uint64_t
 get_cycles(void)

Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c
==
--- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Mon Jan 19 21:47:18 2015
(r277401)
+++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Mon Jan 19 21:53:00 2015
(r277402)
@@ -251,9 +251,6 @@ iwch_mod_unload(void)
 }
 #endif /* TCP_OFFLOAD */
 
-#undef MODULE_VERSION
-#include 
-
 static int
 iwch_modevent(module_t mod, int cmd, void *arg)
 {
@@ -299,3 +296,5 @@ MODULE_DEPEND(t3_tom, cxgbc, 1, 1, 1);
 MODULE_DEPEND(iw_cxgb, toecore, 1, 1, 1);
 MODULE_DEPEND(iw_cxgb, t3_tom, 1, 1, 1);
 MODULE_DEPEND(iw_cxgb, ibcore, 1, 1, 1);
+MODULE_DEPEND(iw_cxgb, linuxapi, 1, 1, 1);
+

Modified: head/sys/dev/cxgbe/iw_cxgbe/device.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/device.cMon Jan 19 21:47:18 2015
(r277401)
+++ head/sys/dev/cxgbe/iw_cxgbe/device.cMon Jan 19 21:53:00 2015
(r277402)
@@ -321,8 +321,6 @@ c4iw_mod_unload(void)
 }
 
 #endif
-#undef MODULE_VERSION
-#include 
 
 /*
  * t4_tom won't load on kernels without TCP_OFFLOAD and this module's 
dependency
@@ -366,4 +364,5 @@ MODULE_VERSION(iw_cxgbe, 1);
 MODULE_DEPEND(iw_cxgbe, t4nex, 1, 1, 1);
 MODULE_DEPEND(iw_cxgbe, t4_tom, 1, 1, 1);
 MODULE_DEPEND(iw_cxgbe, ibcore, 1, 1, 1);
+MODULE_DEPEND(iw_cxgbe, linuxapi, 1, 1, 1);
 DECLARE_MODULE(iw_cxgbe, c4iw_mod_data, SI_SUB_EXEC, SI_ORDER_ANY);

Modified: head/sys/ofed/drivers/infiniband/core/device.c
==
--- head/sys/ofed/drivers/infiniband/core/device.c  Mon Jan 19 21:47:18 
2015(r277401)
+++ head/sys/ofed/drivers/infiniband/core/device.c  Mon Jan 19 21:53:00 
2015(r277402)
@@ -754,8 +754,6 @@ static void __exit ib_core_cleanup(void)
 module_init(ib_core_init);
 module_exit(ib_core_cleanup);
 
-#undef MODULE_VERSION
-#include 
 static int
 ibcore_evhand(module_t mod, int event, void *arg)
 {

Modified: head/sys/ofed/drivers/infiniband/hw/mlx4/main.c
==
--- head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Mon Jan 19 21:47:18 
2015(r277401)
+++ head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Mon Jan 19 21:53:00 
2015(r277402)
@@ -67,7 +67,9 @@
 MODULE_AUTHOR("Roland Dreier");
 MODULE_DESCRIPTION("Mellanox ConnectX HCA InfiniBand driver");
 MODULE_LICENSE("Dual BSD/GPL");
+#ifdef __linux__
 MODULE_VERSION(DRV_VERSION);
+#endif
 
 int mlx4_ib_sm_guid_assign = 1;
 
@@ -2404,8 +2406,6 @@ static void __exit mlx4_ib_cleanup(void)
 module_init_order(mlx4_ib_init, SI_ORDER_MIDDLE);
 module_exit(mlx4_ib_cleanup);
 
-#undef MODULE_VERSION
-#include 
 static int
 mlx4ib_evhand(module_t mod, int event, void *arg)
 {

Modified: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c
==
--- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c  Mon Jan 19 
21:47:18 2015(r277401)
+++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c  Mon Jan 19 
21:53:00 2015(r277402)
@@ -47,7 +47,9 @@
 MODULE_AUTHOR("Roland Dreier");
 MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
 MODULE_LICENSE("Dual BSD/GPL");
-MODULE_VERSION(DRV_VERSION);
+MODULE_VERSION(mthca, 1);
+MODULE_DEPEND(mthca, linuxapi, 1, 1, 1);
+MODULE_DEPEND(mthca, ibcore, 1, 1, 1);
 
 #ifdef

Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Adrian Chadd
Hi,

Would you please check what the results of this are with CPU specific
callwheels?

I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
enabled. But all the callwheels are now back on clock(0) and so is the
lock contention. :(

Thanks,



-adrian


On 15 January 2015 at 07:32, Hans Petter Selasky  wrote:
> Author: hselasky
> Date: Thu Jan 15 15:32:30 2015
> New Revision: 277213
> URL: https://svnweb.freebsd.org/changeset/base/277213
>
> Log:
>   Major callout subsystem cleanup and rewrite:
>   - Close a migration race where callout_reset() failed to set the
> CALLOUT_ACTIVE flag.
>   - Callout callback functions are now allowed to be protected by
> spinlocks.
>   - Switching the callout CPU number cannot always be done on a
> per-callout basis. See the updated timeout(9) manual page for more
> information.
>   - The timeout(9) manual page has been updated to reflect how all the
> functions inside the callout API are working. The manual page has
> been made function oriented to make it easier to deduce how each of
> the functions making up the callout API are working without having
> to first read the whole manual page. Group all functions into a
> handful of sections which should give a quick top-level overview
> when the different functions should be used.
>   - The CALLOUT_SHAREDLOCK flag and its functionality has been removed
> to reduce the complexity in the callout code and to avoid problems
> about atomically stopping callouts via callout_stop(). If someone
> needs it, it can be re-added. From my quick grep there are no
> CALLOUT_SHAREDLOCK clients in the kernel.
>   - A new callout API function named "callout_drain_async()" has been
> added. See the updated timeout(9) manual page for a complete
> description.
>   - Update the callout clients in the "kern/" folder to use the callout
> API properly, like cv_timedwait(). Previously there was some custom
> sleepqueue code in the callout subsystem, which has been removed,
> because we now allow callouts to be protected by spinlocks. This
> allows us to tear down the callout like done with regular mutexes,
> and a "td_slpmutex" has been added to "struct thread" to atomically
> teardown the "td_slpcallout". Further the "TDF_TIMOFAIL" and
> "SWT_SLEEPQTIMO" states can now be completely removed. Currently
> they are marked as available and will be cleaned up in a follow up
> commit.
>   - Bump the __FreeBSD_version to indicate kernel modules need
> recompilation.
>   - There has been several reports that this patch "seems to squash a
> serious bug leading to a callout timeout and panic".
>
>   Kernel build testing: all architectures were built
>   MFC after:2 weeks
>   Differential Revision:https://reviews.freebsd.org/D1438
>   Sponsored by: Mellanox Technologies
>   Reviewed by:  jhb, adrian, sbruno and emaste
>
> Modified:
>   head/share/man/man9/Makefile
>   head/share/man/man9/timeout.9
>   head/sys/kern/init_main.c
>   head/sys/kern/kern_condvar.c
>   head/sys/kern/kern_lock.c
>   head/sys/kern/kern_switch.c
>   head/sys/kern/kern_synch.c
>   head/sys/kern/kern_thread.c
>   head/sys/kern/kern_timeout.c
>   head/sys/kern/subr_sleepqueue.c
>   head/sys/ofed/include/linux/completion.h
>   head/sys/sys/_callout.h
>   head/sys/sys/callout.h
>   head/sys/sys/param.h
>   head/sys/sys/proc.h
>
> Modified: head/share/man/man9/Makefile
> ==
> --- head/share/man/man9/MakefileThu Jan 15 14:47:48 2015
> (r277212)
> +++ head/share/man/man9/MakefileThu Jan 15 15:32:30 2015
> (r277213)
> @@ -1570,6 +1570,7 @@ MLINKS+=timeout.9 callout.9 \
> timeout.9 callout_active.9 \
> timeout.9 callout_deactivate.9 \
> timeout.9 callout_drain.9 \
> +   timeout.9 callout_drain_async.9 \
> timeout.9 callout_handle_init.9 \
> timeout.9 callout_init.9 \
> timeout.9 callout_init_mtx.9 \
>
> Modified: head/share/man/man9/timeout.9
> ==
> --- head/share/man/man9/timeout.9   Thu Jan 15 14:47:48 2015
> (r277212)
> +++ head/share/man/man9/timeout.9   Thu Jan 15 15:32:30 2015
> (r277213)
> @@ -29,13 +29,14 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd October 8, 2014
> +.Dd January 14, 2015
>  .Dt TIMEOUT 9
>  .Os
>  .Sh NAME
>  .Nm callout_active ,
>  .Nm callout_deactivate ,
>  .Nm callout_drain ,
> +.Nm callout_drain_async ,
>  .Nm callout_handle_init ,
>  .Nm callout_init ,
>  .Nm callout_init_mtx ,
> @@ -63,279 +64,232 @@
>  .In sys/systm.h
>  .Bd -literal
>  typedef void timeout_t (void *);
> +typedef void callout_func_t (void *);
>  .Ed
> -.Ft int
> -.Fn callout_active "struct callout *c"
> -.Ft void
> -.Fn callo

Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Adrian Chadd
Yeah, it looks like you set c_cpu to timeout_cpu in
_callout_init_locked(), but then you only handle the case of the CPU
being changed in certain circumstances. You aren't handling the CPU
being initialised when the callout is first added.

And, callout_restart_async() calls callout_lock(), which calls
CC_LOCK() on the callout CPU, which initially is zero. Then, it never
seems to be 'moved' into the correct CPU, even though it's being
called with a CPU id.

So, if I am reading this all correctly, you aren't really handling
multi CPU callwheels at all. ;)

In my instance, I'm seeing quite a lot of lock contention between the
userland threads, the network RX threads and the clock thread, all
contending on a single callout wheel being used for TCP timers. One of
the early goals for fixing up the RSS stuff in -HEAD was to make
per-CPU (Well, per-RSS-bucket really) TCP timers not contend with the
NIC RX processing path, and now it does. :(



-adrian


On 19 January 2015 at 13:59, Adrian Chadd  wrote:
> Hi,
>
> Would you please check what the results of this are with CPU specific
> callwheels?
>
> I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
> ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
> enabled. But all the callwheels are now back on clock(0) and so is the
> lock contention. :(
>
> Thanks,
>
>
>
> -adrian
>
>
> On 15 January 2015 at 07:32, Hans Petter Selasky  wrote:
>> Author: hselasky
>> Date: Thu Jan 15 15:32:30 2015
>> New Revision: 277213
>> URL: https://svnweb.freebsd.org/changeset/base/277213
>>
>> Log:
>>   Major callout subsystem cleanup and rewrite:
>>   - Close a migration race where callout_reset() failed to set the
>> CALLOUT_ACTIVE flag.
>>   - Callout callback functions are now allowed to be protected by
>> spinlocks.
>>   - Switching the callout CPU number cannot always be done on a
>> per-callout basis. See the updated timeout(9) manual page for more
>> information.
>>   - The timeout(9) manual page has been updated to reflect how all the
>> functions inside the callout API are working. The manual page has
>> been made function oriented to make it easier to deduce how each of
>> the functions making up the callout API are working without having
>> to first read the whole manual page. Group all functions into a
>> handful of sections which should give a quick top-level overview
>> when the different functions should be used.
>>   - The CALLOUT_SHAREDLOCK flag and its functionality has been removed
>> to reduce the complexity in the callout code and to avoid problems
>> about atomically stopping callouts via callout_stop(). If someone
>> needs it, it can be re-added. From my quick grep there are no
>> CALLOUT_SHAREDLOCK clients in the kernel.
>>   - A new callout API function named "callout_drain_async()" has been
>> added. See the updated timeout(9) manual page for a complete
>> description.
>>   - Update the callout clients in the "kern/" folder to use the callout
>> API properly, like cv_timedwait(). Previously there was some custom
>> sleepqueue code in the callout subsystem, which has been removed,
>> because we now allow callouts to be protected by spinlocks. This
>> allows us to tear down the callout like done with regular mutexes,
>> and a "td_slpmutex" has been added to "struct thread" to atomically
>> teardown the "td_slpcallout". Further the "TDF_TIMOFAIL" and
>> "SWT_SLEEPQTIMO" states can now be completely removed. Currently
>> they are marked as available and will be cleaned up in a follow up
>> commit.
>>   - Bump the __FreeBSD_version to indicate kernel modules need
>> recompilation.
>>   - There has been several reports that this patch "seems to squash a
>> serious bug leading to a callout timeout and panic".
>>
>>   Kernel build testing: all architectures were built
>>   MFC after:2 weeks
>>   Differential Revision:https://reviews.freebsd.org/D1438
>>   Sponsored by: Mellanox Technologies
>>   Reviewed by:  jhb, adrian, sbruno and emaste
>>
>> Modified:
>>   head/share/man/man9/Makefile
>>   head/share/man/man9/timeout.9
>>   head/sys/kern/init_main.c
>>   head/sys/kern/kern_condvar.c
>>   head/sys/kern/kern_lock.c
>>   head/sys/kern/kern_switch.c
>>   head/sys/kern/kern_synch.c
>>   head/sys/kern/kern_thread.c
>>   head/sys/kern/kern_timeout.c
>>   head/sys/kern/subr_sleepqueue.c
>>   head/sys/ofed/include/linux/completion.h
>>   head/sys/sys/_callout.h
>>   head/sys/sys/callout.h
>>   head/sys/sys/param.h
>>   head/sys/sys/proc.h
>>
>> Modified: head/share/man/man9/Makefile
>> ==
>> --- head/share/man/man9/MakefileThu Jan 15 14:47:48 2015
>> (r277212)
>> +++ head/share/man/man9/MakefileThu Jan 15 15:32:30 2015
>> (r277213)
>> @@ -1570,6 +1570,7 @@ MLINKS+=timeout.9 callout.9 \
>>  

svn commit: r277405 - head/sys/arm/ti/am335x

2015-01-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 20 02:24:08 2015
New Revision: 277405
URL: https://svnweb.freebsd.org/changeset/base/277405

Log:
  Properly clear IRQ status in order to fix "Spurious IRQ" message from AINT.
  
  This register is not documented in TRM but that's what linux driver does

Modified:
  head/sys/arm/ti/am335x/am335x_lcd.c

Modified: head/sys/arm/ti/am335x/am335x_lcd.c
==
--- head/sys/arm/ti/am335x/am335x_lcd.c Mon Jan 19 22:18:00 2015
(r277404)
+++ head/sys/arm/ti/am335x/am335x_lcd.c Tue Jan 20 02:24:08 2015
(r277405)
@@ -150,6 +150,7 @@ __FBSDID("$FreeBSD$");
 #defineIRQ_SYNC_LOST   (1 << 2)
 #defineIRQ_RASTER_DONE (1 << 1)
 #defineIRQ_FRAME_DONE  (1 << 0)
+#defineLCD_END_OF_INT_IND  0x68
 #defineLCD_CLKC_ENABLE 0x6C
 #defineCLKC_ENABLE_DMA (1 << 2)
 #defineCLKC_ENABLE_LDID(1 << 1)
@@ -397,6 +398,8 @@ am335x_lcd_intr(void *arg)
if (reg & IRQ_ACB) {
/* TODO: Handle ACB */
}
+
+   LCD_WRITE4(sc, LCD_END_OF_INT_IND, 0);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277406 - in head/sys: kern sys x86/x86

2015-01-19 Thread Neel Natu
Author: neel
Date: Tue Jan 20 03:54:30 2015
New Revision: 277406
URL: https://svnweb.freebsd.org/changeset/base/277406

Log:
  Update the vdso timehands only via tc_windup().
  
  Prior to this change CLOCK_MONOTONIC could go backwards when the timecounter
  hardware was changed via 'sysctl kern.timecounter.hardware'. This happened
  because the vdso timehands update was missing the special treatment in
  tc_windup() when changing timecounters.
  
  Reviewed by:  kib

Modified:
  head/sys/kern/kern_tc.c
  head/sys/kern/subr_dummy_vdso_tc.c
  head/sys/sys/vdso.h
  head/sys/x86/x86/tsc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Tue Jan 20 02:24:08 2015(r277405)
+++ head/sys/kern/kern_tc.c Tue Jan 20 03:54:30 2015(r277406)
@@ -1424,7 +1424,15 @@ sysctl_kern_timecounter_hardware(SYSCTL_
(void)newtc->tc_get_timecount(newtc);
 
timecounter = newtc;
-   timekeep_push_vdso();
+
+   /*
+* The vdso timehands update is deferred until the next
+* 'tc_windup()'.
+*
+* This is prudent given that 'timekeep_push_vdso()' does not
+* use any locking and that it can be called in hard interrupt
+* context via 'tc_windup()'.
+*/
return (0);
}
return (EINVAL);
@@ -1982,7 +1990,6 @@ sysctl_fast_gettime(SYSCTL_HANDLER_ARGS)
if (error != 0)
return (error);
vdso_th_enable = old_vdso_th_enable;
-   timekeep_push_vdso();
return (0);
 }
 SYSCTL_PROC(_kern_timecounter, OID_AUTO, fast_gettime,
@@ -2002,7 +2009,7 @@ tc_fill_vdso_timehands(struct vdso_timeh
vdso_th->th_counter_mask = th->th_counter->tc_counter_mask;
vdso_th->th_offset = th->th_offset;
vdso_th->th_boottime = boottimebin;
-   enabled = cpu_fill_vdso_timehands(vdso_th);
+   enabled = cpu_fill_vdso_timehands(vdso_th, th->th_counter);
if (!vdso_th_enable)
enabled = 0;
return (enabled);
@@ -2024,7 +2031,7 @@ tc_fill_vdso_timehands32(struct vdso_tim
*(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac;
vdso_th32->th_boottime.sec = boottimebin.sec;
*(uint64_t *)&vdso_th32->th_boottime.frac[0] = boottimebin.frac;
-   enabled = cpu_fill_vdso_timehands32(vdso_th32);
+   enabled = cpu_fill_vdso_timehands32(vdso_th32, th->th_counter);
if (!vdso_th_enable)
enabled = 0;
return (enabled);

Modified: head/sys/kern/subr_dummy_vdso_tc.c
==
--- head/sys/kern/subr_dummy_vdso_tc.c  Tue Jan 20 02:24:08 2015
(r277405)
+++ head/sys/kern/subr_dummy_vdso_tc.c  Tue Jan 20 03:54:30 2015
(r277406)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 uint32_t
-cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th)
+cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc)
 {
 
return (0);
@@ -41,7 +41,8 @@ cpu_fill_vdso_timehands(struct vdso_time
 
 #ifdef COMPAT_FREEBSD32
 uint32_t
-cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32)
+cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32,
+struct timecounter *tc)
 {
 
return (0);

Modified: head/sys/sys/vdso.h
==
--- head/sys/sys/vdso.h Tue Jan 20 02:24:08 2015(r277405)
+++ head/sys/sys/vdso.h Tue Jan 20 03:54:30 2015(r277406)
@@ -69,6 +69,8 @@ int __vdso_gettimekeep(struct vdso_timek
 
 #ifdef _KERNEL
 
+struct timecounter;
+
 void timekeep_push_vdso(void);
 
 uint32_t tc_fill_vdso_timehands(struct vdso_timehands *vdso_th);
@@ -81,7 +83,8 @@ uint32_t tc_fill_vdso_timehands(struct v
  * global sysctl enable override is handled by machine-independed code
  * after cpu_fill_vdso_timehands() call is made.
  */
-uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th);
+uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th,
+struct timecounter *tc);
 
 #defineVDSO_TH_NUM 4
 
@@ -110,7 +113,8 @@ struct vdso_timekeep32 {
 };
 
 uint32_t tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32);
-uint32_t cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32);
+uint32_t cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32,
+struct timecounter *tc);
 
 #endif
 #endif

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Tue Jan 20 02:24:08 2015(r277405)
+++ head/sys/x86/x86/tsc.c  Tue Jan 20 03:54:30 2015(r277406)
@@ -720,21 +720,22 @@ tsc_get_timecount_low_mfence(struct time
 }
 
 uint32_t
-cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th)
+cpu_fill

Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

On 01/19/15 22:59, Adrian Chadd wrote:

Hi,

Would you please check what the results of this are with CPU specific
callwheels?

I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
enabled. But all the callwheels are now back on clock(0) and so is the
lock contention. :(

Thanks,



Hi,

Like stated in the manual page, callout_reset_curcpu/on() does not work 
with MPSAFE callouts any more!


You need to use callout_init_{mtx,rm,rw} and remove the custom locking 
inside the callback in the TCP stack to get it working like before!


Thank you!

--HPS

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

On 01/19/15 23:22, Adrian Chadd wrote:

In my instance, I'm seeing quite a lot of lock contention between the
userland threads, the network RX threads and the clock thread, all
contending on a single callout wheel being used for TCP timers. One of
the early goals for fixing up the RSS stuff in -HEAD was to make
per-CPU (Well, per-RSS-bucket really) TCP timers not contend with the
NIC RX processing path, and now it does.:(


man 9 callout

--HPS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Adrian Chadd
On 19 January 2015 at 20:30, Hans Petter Selasky  wrote:
> On 01/19/15 22:59, Adrian Chadd wrote:
>>
>> Hi,
>>
>> Would you please check what the results of this are with CPU specific
>> callwheels?
>>
>> I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
>> ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
>> enabled. But all the callwheels are now back on clock(0) and so is the
>> lock contention. :(
>>
>> Thanks,
>>
>
> Hi,
>
> Like stated in the manual page, callout_reset_curcpu/on() does not work with
> MPSAFE callouts any more!

Hm!

How many places in the kernel did you leave like this? :P

I mean, I'm glad to have stuff be forced to be cleaned up, but you
didn't even leave a KASSERT or a debug warning that something
unsupported is being done. I'm sure I'm not going to be the first
person to be caught out like this.

> You need to use callout_init_{mtx,rm,rw} and remove the custom locking
> inside the callback in the TCP stack to get it working like before!

Would you please give me a hand with this? I've sunk a lot of (unpaid,
personal) spare time into getting the RSS stuff into shape and now a
lot of it just plainly doesn't do anything. :(



-adrian
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

On 01/20/15 06:04, Adrian Chadd wrote:

On 19 January 2015 at 20:30, Hans Petter Selasky  wrote:

On 01/19/15 22:59, Adrian Chadd wrote:


Hi,

Would you please check what the results of this are with CPU specific
callwheels?

I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
enabled. But all the callwheels are now back on clock(0) and so is the
lock contention. :(

Thanks,



Hi,

Like stated in the manual page, callout_reset_curcpu/on() does not work with
MPSAFE callouts any more!


Hm!



Hi Adrian,


How many places in the kernel did you leave like this? :P


:-)



I mean, I'm glad to have stuff be forced to be cleaned up, but you
didn't even leave a KASSERT or a debug warning that something
unsupported is being done. I'm sure I'm not going to be the first
person to be caught out like this.


MPSAFE is still valid and fully useable and can be used with 
callout_reset_curcpu/on(), but the callout CPU will remain at zero.

There is no need for a KASSERT() yet.




You need to use callout_init_{mtx,rm,rw} and remove the custom locking
inside the callback in the TCP stack to get it working like before!


Would you please give me a hand with this? I've sunk a lot of (unpaid,
personal) spare time into getting the RSS stuff into shape and now a
lot of it just plainly doesn't do anything. :(


I'll send you a patch in an hours time from now for 11-current. This 
should be fairly trivial and then you can test and review it!


--HPS

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Adrian Chadd
On 19 January 2015 at 21:20, Hans Petter Selasky  wrote:
> On 01/20/15 06:04, Adrian Chadd wrote:
>>
>> On 19 January 2015 at 20:30, Hans Petter Selasky  wrote:
>>>
>>> On 01/19/15 22:59, Adrian Chadd wrote:


 Hi,

 Would you please check what the results of this are with CPU specific
 callwheels?

 I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
 ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
 enabled. But all the callwheels are now back on clock(0) and so is the
 lock contention. :(

 Thanks,

>>>
>>> Hi,
>>>
>>> Like stated in the manual page, callout_reset_curcpu/on() does not work
>>> with
>>> MPSAFE callouts any more!
>>
>>
>> Hm!
>>
>
> Hi Adrian,
>
>> How many places in the kernel did you leave like this? :P
>
>
> :-)
>
>>
>> I mean, I'm glad to have stuff be forced to be cleaned up, but you
>> didn't even leave a KASSERT or a debug warning that something
>> unsupported is being done. I'm sure I'm not going to be the first
>> person to be caught out like this.
>
>
> MPSAFE is still valid and fully useable and can be used with
> callout_reset_curcpu/on(), but the callout CPU will remain at zero.
> There is no need for a KASSERT() yet.

Right, but people won't know that their callout won't be scheduled on
the CPU they've asked for and there's no way to get notified of that.
So something debug-y may be useful, even to make it easy to track down
situations where sometimes it succeeds and sometimes it fails (because
well, there's lots of places in the kernel where locking is ..
suboptimal.)


>>
>>> You need to use callout_init_{mtx,rm,rw} and remove the custom locking
>>> inside the callback in the TCP stack to get it working like before!
>>
>>
>> Would you please give me a hand with this? I've sunk a lot of (unpaid,
>> personal) spare time into getting the RSS stuff into shape and now a
>> lot of it just plainly doesn't do anything. :(
>
>
> I'll send you a patch in an hours time from now for 11-current. This should
> be fairly trivial and then you can test and review it!

Sweet, thanks. I'l test it, but anything that changes the locking to
TCP is going to need a more thorough review. The "there be dragons"
disclaimer is appropriate. :)


-adrian
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277411 - head/sys/powerpc/aim

2015-01-19 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Jan 20 05:28:03 2015
New Revision: 277411
URL: https://svnweb.freebsd.org/changeset/base/277411

Log:
  Zero BSS explicitly if not started by loader(8). Add a check for the magic
  values that ePAPR-compliant loaders (like skiboot) put in the register
  loader uses for the metadata pointer to avoid confusing them.

Modified:
  head/sys/powerpc/aim/machdep.c

Modified: head/sys/powerpc/aim/machdep.c
==
--- head/sys/powerpc/aim/machdep.c  Tue Jan 20 05:14:07 2015
(r277410)
+++ head/sys/powerpc/aim/machdep.c  Tue Jan 20 05:28:03 2015
(r277411)
@@ -224,6 +224,10 @@ cpu_startup(void *dummy)
 }
 
 extern vm_offset_t __startkernel, __endkernel;
+extern unsigned char   __bss_start[];
+extern unsigned char   __sbss_start[];
+extern unsigned char   __sbss_end[];
+extern unsigned char   _end[];
 
 #ifndef __powerpc64__
 /* Bits for running on 64-bit systems in 32-bit mode. */
@@ -272,9 +276,6 @@ powerpc_init(vm_offset_t fdt, vm_offset_
trap_offset = 0;
cacheline_warn = 0;
 
-   /* Store boot environment state */
-   OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry);
-
/* First guess at start/end kernel positions */
startkernel = __startkernel;
endkernel = __endkernel;
@@ -289,6 +290,10 @@ powerpc_init(vm_offset_t fdt, vm_offset_
mdp = NULL;
 #endif
 
+   /* Check for ePAPR loader, which puts a magic value into r6 */
+   if (mdp == (void *)0x65504150)
+   mdp = NULL;
+
/*
 * Parse metadata if present and fetch parameters.  Must be done
 * before console is inited so cninit gets the right value of
@@ -308,8 +313,14 @@ powerpc_init(vm_offset_t fdt, vm_offset_
db_fetch_ksymtab(ksym_start, ksym_end);
 #endif
}
+   } else {
+   bzero(__sbss_start, __sbss_end - __sbss_start);
+   bzero(__bss_start, _end - __bss_start);
}
 
+   /* Store boot environment state */
+   OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry);
+
/*
 * Init params/tunables that can be overridden by the loader
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277412 - head/sys/powerpc/ofw

2015-01-19 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Tue Jan 20 05:44:21 2015
New Revision: 277412
URL: https://svnweb.freebsd.org/changeset/base/277412

Log:
  Remove space in the FDT reservation map from the available memory regions
  in ofw_mem_regions(). This function is actually MI and should move to
  dev/ofw at some point in the near future so that ARM and MIPS can use the
  same code.

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Tue Jan 20 05:28:03 2015
(r277411)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Tue Jan 20 05:44:21 2015
(r277412)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -211,12 +212,89 @@ parse_ofw_memory(phandle_t node, const c
return (sz);
 }
 
+static int
+excise_fdt_reserved(struct mem_region *avail, int asz)
+{
+   struct {
+   uint64_t address;
+   uint64_t size;
+   } fdtmap[16];
+   ssize_t fdtmapsize;
+   phandle_t chosen;
+   int i, j, k;
+
+   chosen = OF_finddevice("/chosen");
+   fdtmapsize = OF_getprop(chosen, "fdtmemreserv", fdtmap, sizeof(fdtmap));
+
+   for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) {
+   fdtmap[j].address = be64toh(fdtmap[j].address);
+   fdtmap[j].size = be64toh(fdtmap[j].size);
+   }
+
+   for (i = 0; i < asz; i++) {
+   for (j = 0; j < fdtmapsize/sizeof(fdtmap[0]); j++) {
+   /*
+* Case 1: Exclusion region encloses complete
+* available entry. Drop it and move on.
+*/
+   if (fdtmap[j].address <= avail[i].mr_start &&
+   fdtmap[j].address + fdtmap[j].size >=
+   avail[i].mr_start + avail[i].mr_size) {
+   for (k = i+1; k < asz; k++)
+   avail[k-1] = avail[k];
+   asz--;
+   i--; /* Repeat some entries */
+   continue;
+   }
+
+   /*
+* Case 2: Exclusion region starts in available entry.
+* Trim it to where the entry begins and append
+* a new available entry with the region after
+* the excluded region, if any.
+*/
+   if (fdtmap[j].address >= avail[i].mr_start &&
+   fdtmap[j].address < avail[i].mr_start +
+   avail[i].mr_size) {
+   if (fdtmap[j].address + fdtmap[j].size < 
+   avail[i].mr_start + avail[i].mr_size) {
+   avail[asz].mr_start =
+   roundup2(fdtmap[j].address +
+   fdtmap[j].size, PAGE_SIZE);
+   avail[asz].mr_size = avail[i].mr_start +
+avail[i].mr_size -
+avail[asz].mr_start;
+   asz++;
+   }
+
+   avail[i].mr_size =
+   rounddown2(fdtmap[j].address, PAGE_MASK) -
+   avail[i].mr_start;
+   }
+
+   /*
+* Case 3: Exclusion region ends in available entry.
+* Move start point to where the exclusion zone ends.
+* The case of a contained exclusion zone has already
+* been caught in case 2.
+*/
+   if (fdtmap[j].address + fdtmap[j].size >=
+   avail[i].mr_start && fdtmap[j].address +
+   fdtmap[j].size < avail[i].mr_start +
+   avail[i].mr_size) {
+   avail[i].mr_start =
+   roundup2(fdtmap[j].address + 
fdtmap[j].size,PAGE_MASK);
+   }
+   }
+   }
+
+   return (asz);
+}
+
 /*
  * This is called during powerpc_init, before the system is really initialized.
  * It shall provide the total and the available regions of RAM.
- * Both lists must have a zero-size entry as terminator.
- * The available regions need not take the kernel into account, but needs
- * to provide space for two additional entry beyond the terminating one.
+ * The available regions need not take the kernel into account.
  */
 void
 ofw_mem_regions(struct mem_region *memp, int *memsz,
@@ -236,7 +314,8

Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

Hi,

Have a look here:

https://reviews.freebsd.org/D1563

Give me a hand and test and review this patch properly!

--HPS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

On 01/20/15 06:22, Adrian Chadd wrote:

Sweet, thanks. I'l test it, but anything that changes the locking to
TCP is going to need a more thorough review. The "there be dragons"
disclaimer is appropriate.:)


No changes in locking - simply some minor code reordering.

--HPS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Konstantin Belousov
On Tue, Jan 20, 2015 at 05:30:25AM +0100, Hans Petter Selasky wrote:
> On 01/19/15 22:59, Adrian Chadd wrote:
> > Hi,
> >
> > Would you please check what the results of this are with CPU specific
> > callwheels?
> >
> > I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
> > ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
> > enabled. But all the callwheels are now back on clock(0) and so is the
> > lock contention. :(
> >
> > Thanks,
> >
> 
> Hi,
> 
> Like stated in the manual page, callout_reset_curcpu/on() does not work 
> with MPSAFE callouts any more!
I.e. you 'fixed' some undeterminate bugs in callout migration by not
doing migration at all anymore.

> 
> You need to use callout_init_{mtx,rm,rw} and remove the custom locking 
> inside the callback in the TCP stack to get it working like before!

No, you need to do this, if you think that whole callout KPI must be
rototiled.  It is up to the person who modifies the KPI, to ensure that
existing code is not broken.

As I understand, currently we are back to the one-cpu callouts.
Do other people consider this situation acceptable ?
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-19 Thread Hans Petter Selasky

On 01/20/15 08:51, Konstantin Belousov wrote:

On Tue, Jan 20, 2015 at 05:30:25AM +0100, Hans Petter Selasky wrote:

On 01/19/15 22:59, Adrian Chadd wrote:

Hi,

Would you please check what the results of this are with CPU specific
callwheels?

I'm doing some 10+ gig traffic testing on -HEAD with RSS enabled (on
ixgbe) and with this setup, the per-CPU TCP callwheel stuff is
enabled. But all the callwheels are now back on clock(0) and so is the
lock contention. :(

Thanks,



Hi,

Like stated in the manual page, callout_reset_curcpu/on() does not work
with MPSAFE callouts any more!

I.e. you 'fixed' some undeterminate bugs in callout migration by not
doing migration at all anymore.



You need to use callout_init_{mtx,rm,rw} and remove the custom locking
inside the callback in the TCP stack to get it working like before!


No, you need to do this, if you think that whole callout KPI must be
rototiled.  It is up to the person who modifies the KPI, to ensure that
existing code is not broken.

As I understand, currently we are back to the one-cpu callouts.
Do other people consider this situation acceptable ?



Hi Konstantin,

Please read the callout 9 manual page first.

--HPS

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"