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

2017-08-08 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Aug  9 05:59:45 2017
New Revision: 322299
URL: https://svnweb.freebsd.org/changeset/base/322299

Log:
  hyperv/hn: Implement transparent mode network VF.
  
  How network VF works with hn(4) on Hyper-V in transparent mode:
  
  - Each network VF has a cooresponding hn(4).
  - The network VF and the it's cooresponding hn(4) have the same hardware
address.
  - Once the network VF is attached, the cooresponding hn(4) waits several
seconds to make sure that the network VF attach routing completes, then:
o  Set the intersection of the network VF's if_capabilities and the
   cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s
   if_capabilities.  And adjust the cooresponding hn(4) if_capable and
   if_hwassist accordingly. (*)
o  Make sure that the cooresponding hn(4)'s TSO parameters meet the
   constraints posed by both the network VF and the cooresponding hn(4).
   (*)
o  The network VF's if_input is overridden.  The overriding if_input
   changes the input packet's rcvif to the cooreponding hn(4).  The
   network layers are tricked into thinking that all packets are
   neceived by the cooresponding hn(4).
o  If the cooresponding hn(4) was brought up, bring up the network VF.
   The transmission dispatched to the cooresponding hn(4) are
   redispatched to the network VF.
o  Bringing down the cooresponding hn(4) also brings down the network
   VF.
o  All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to
   the network VF; the cooresponding hn(4) changes its internal state
   if necessary.
o  The media status of the cooresponding hn(4) solely relies on the
   network VF.
o  If there are multicast filters on the cooresponding hn(4), allmulti
   will be enabled on the network VF. (**)
  - Once the network VF is detached.  Undo all damages did to the
cooresponding hn(4) in the above item.
  
  NOTE:
  No operation should be issued directly to the network VF, if the
  network VF transparent mode is enabled.  The network VF transparent mode
  can be enabled by setting tunable hw.hn.vf_transparent to 1.  The network
  VF transparent mode is _not_ enabled by default, as of this commit.
  
  The benefit of the network VF transparent mode is that the network VF
  attachment and detachment are transparent to all network layers; e.g. live
  migration detaches and reattaches the network VF.
  
  The major drawbacks of the network VF transparent mode:
  - The netmap(4) support is lost, even if the VF supports it.
  - ALTQ does not work, since if_start method cannot be properly supported.
  
  (*)
  These decisions were made so that things will not be messed up too much
  during the transition period.
  
  (**)
  This does _not_ need to go through the fancy multicast filter management
  stuffs like what vlan(4) has, at least currently:
  - As of this write, multicast does not work in Azure.
  - As of this write, multicast packets go through the cooresponding hn(4).
  
  MFC after:3 days
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D11803

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c
  head/sys/dev/hyperv/netvsc/if_hnreg.h
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Wed Aug  9 05:21:57 2017
(r322298)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Wed Aug  9 05:59:45 2017
(r322299)
@@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$");
 
 #define HN_VFMAP_SIZE_DEF  8
 
+#define HN_XPNT_VF_ATTWAIT_MIN 2   /* seconds */
+
 /* YYY should get it from the underlying channel */
 #define HN_TX_DESC_CNT 512
 
@@ -263,6 +265,7 @@ static void hn_ifnet_event(void *, struct 
ifnet *, i
 static voidhn_ifaddr_event(void *, struct ifnet *);
 static voidhn_ifnet_attevent(void *, struct ifnet *);
 static voidhn_ifnet_detevent(void *, struct ifnet *);
+static voidhn_ifnet_lnkevent(void *, struct ifnet *, int);
 
 static boolhn_ismyvf(const struct hn_softc *,
const struct ifnet *);
@@ -270,6 +273,15 @@ static voidhn_rxvf_change(struct 
hn_softc *,
struct ifnet *, bool);
 static voidhn_rxvf_set(struct hn_softc *, struct ifnet *);
 static voidhn_rxvf_set_task(void *, int);
+static voidhn_xpnt_vf_input(struct ifnet *, struct mbuf *);
+static int hn_xpnt_vf_iocsetflags(struct hn_softc *);
+static int hn_xpnt_vf_iocsetcaps(struct hn_softc *,
+   struct ifreq *);
+static voidhn_xpnt_vf_saveifflags(st

svn commit: r322298 - head

2017-08-08 Thread Kirk McKusick
Author: mckusick
Date: Wed Aug  9 05:21:57 2017
New Revision: 322298
URL: https://svnweb.freebsd.org/changeset/base/322298

Log:
  Add an entry to UPDATING for r322297 which restores the ability
  of fsck to automatically find alternate superblocks when the
  standard one is trashed or unavailable.
  
  MFC after: 2 weeks
  Differential Revision: https://reviews.freebsd.org/D11589

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Aug  9 05:17:21 2017(r322297)
+++ head/UPDATING   Wed Aug  9 05:21:57 2017(r322298)
@@ -51,6 +51,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 ** SPECIAL WARNING: **
 
+20170808:
+   Since the switch to GPT disk labels, fsck for UFS/FFS has been
+   unable to automatically find alternate superblocks. As of r322297,
+   the information needed to find alternate superblocks has been
+   moved to the end of the area reserved for the boot block.
+   Filesystems created with a newfs of this vintage or later
+   will create the recovery information. If you have a filesystem
+   created prior to this change and wish to have a recovery block
+   created for your filesystem, you can do so by running fsck in
+   forground mode (i.e., do not use the -p or -y options). As it
+   starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS''
+   to which you should answer yes.
+
 20170728:
As of r321665, an NFSv4 server configuration that services
Kerberos mounts or clients that do not support the uid/gid in
___
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: r322297 - in head: sbin/fsck_ffs sbin/newfs sys/ufs/ffs

2017-08-08 Thread Kirk McKusick
Author: mckusick
Date: Wed Aug  9 05:17:21 2017
New Revision: 322297
URL: https://svnweb.freebsd.org/changeset/base/322297

Log:
  Since the switch to GPT disk labels, fsck for UFS/FFS has been
  unable to automatically find alternate superblocks. This checkin
  places the information needed to find alternate superblocks to the
  end of the area reserved for the boot block.
  
  Filesystems created with a newfs of this vintage or later will
  create the recovery information. If you have a filesystem created
  prior to this change and wish to have a recovery block created for
  your filesystem, you can do so by running fsck in forground mode
  (i.e., do not use the -p or -y options). As it starts, fsck will
  ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' to which you should
  answer yes.
  
  Discussed with: kib, imp
  MFC after: 2 weeks
  Differential Revision: https://reviews.freebsd.org/D11589

Modified:
  head/sbin/fsck_ffs/setup.c
  head/sbin/newfs/mkfs.c
  head/sys/ufs/ffs/fs.h

Modified: head/sbin/fsck_ffs/setup.c
==
--- head/sbin/fsck_ffs/setup.c  Wed Aug  9 04:23:04 2017(r322296)
+++ head/sbin/fsck_ffs/setup.c  Wed Aug  9 05:17:21 2017(r322297)
@@ -58,6 +58,10 @@ struct bufarea asblk;
 #define altsblock (*asblk.b_un.b_fs)
 #define POWEROF2(num)  (((num) & ((num) - 1)) == 0)
 
+static int calcsb(char *dev, int devfd, struct fs *fs);
+static void saverecovery(int readfd, int writefd);
+static int chkrecovery(int devfd);
+
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
@@ -66,9 +70,10 @@ struct bufarea asblk;
 int
 setup(char *dev)
 {
-   long asked, i, j;
+   long cg, asked, i, j;
long bmapsize;
struct stat statb;
+   struct fs proto;
size_t size;
 
havesb = 0;
@@ -173,10 +178,28 @@ setup(char *dev)
 */
if (readsb(1) == 0) {
skipclean = 0;
-   if (bflag || preen)
+   if (bflag || preen || calcsb(dev, fsreadfd, &proto) == 0)
return(0);
-   /* Looking for alternates is hard punt for now but retain 
structure */
-   return (0);
+   if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0)
+   return (0);
+   for (cg = 0; cg < proto.fs_ncg; cg++) {
+   bflag = fsbtodb(&proto, cgsblock(&proto, cg));
+   if (readsb(0) != 0)
+   break;
+   }
+   if (cg >= proto.fs_ncg) {
+   printf("%s %s\n%s %s\n%s %s\n",
+   "SEARCH FOR ALTERNATE SUPER-BLOCK",
+   "FAILED. YOU MUST USE THE",
+   "-b OPTION TO FSCK TO SPECIFY THE",
+   "LOCATION OF AN ALTERNATE",
+   "SUPER-BLOCK TO SUPPLY NEEDED",
+   "INFORMATION; SEE fsck_ffs(8).");
+   bflag = 0;
+   return(0);
+   }
+   pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag);
+   bflag = 0;
}
if (skipclean && ckclean && sblock.fs_clean) {
pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
@@ -213,6 +236,10 @@ setup(char *dev)
memmove(&altsblock, &sblock, (size_t)sblock.fs_sbsize);
flush(fswritefd, &asblk);
}
+   if (preen == 0 && yflag == 0 && sblock.fs_magic == FS_UFS2_MAGIC &&
+   fswritefd != -1 && chkrecovery(fsreadfd) == 0 &&
+   reply("SAVE DATA TO FIND ALTERNATE SUPERBLOCKS") != 0)
+   saverecovery(fsreadfd, fswritefd);
/*
 * read in the summary info.
 */
@@ -427,4 +454,74 @@ sblock_init(void)
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
errx(EEXIT, "cannot allocate space for superblock");
dev_bsize = secsize = DEV_BSIZE;
+}
+
+/*
+ * Calculate a prototype superblock based on information in the boot area.
+ * When done the cgsblock macro can be calculated and the fs_ncg field
+ * can be used. Do NOT attempt to use other macros without verifying that
+ * their needed information is available!
+ */
+static int
+calcsb(char *dev, int devfd, struct fs *fs)
+{
+   struct fsrecovery fsr;
+
+   /*
+* We need fragments-per-group and the partition-size.
+*
+* Newfs stores these details at the end of the boot block area
+* at the start of the filesystem partition. If they have been
+* overwritten by a boot block, we fail. But usually they are
+* there and we can use them.
+*/
+   if (blread(devfd, (char *)&fsr,
+   (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) ||
+   fsr.fsr_magic != FS_UFS2_MAGIC)
+   ret

svn commit: r322296 - in head/sys: kern sparc64/sparc64 vm

2017-08-08 Thread Alan Cox
Author: alc
Date: Wed Aug  9 04:23:04 2017
New Revision: 322296
URL: https://svnweb.freebsd.org/changeset/base/322296

Log:
  Introduce vm_page_grab_pages(), which is intended to replace loops calling
  vm_page_grab() on consecutive page indices.  Besides simplifying the code
  in the caller, vm_page_grab_pages() allows for batching optimizations.
  For example, the current implementation replaces calls to vm_page_lookup()
  on consecutive page indices by cheaper calls to vm_page_next().
  
  Reviewed by:  kib, markj
  Tested by:pho (an earlier version)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D11926

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/vm/vm_glue.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Aug  9 01:31:05 2017(r322295)
+++ head/sys/kern/vfs_bio.c Wed Aug  9 04:23:04 2017(r322296)
@@ -2735,7 +2735,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 */
obj = bp->b_bufobj->bo_object;
VM_OBJECT_WLOCK(obj);
-   while (bp->b_npages < desiredpages) {
+   if (bp->b_npages < desiredpages) {
/*
 * We must allocate system pages since blocking
 * here could interfere with paging I/O, no
@@ -2746,14 +2746,12 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int 
 * deadlocks once allocbuf() is called after
 * pages are vfs_busy_pages().
 */
-   m = vm_page_grab(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages,
-   VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM |
-   VM_ALLOC_WIRED | VM_ALLOC_IGN_SBUSY |
-   VM_ALLOC_COUNT(desiredpages - bp->b_npages));
-   if (m->valid == 0)
-   bp->b_flags &= ~B_CACHE;
-   bp->b_pages[bp->b_npages] = m;
-   ++bp->b_npages;
+   vm_page_grab_pages(obj,
+   OFF_TO_IDX(bp->b_offset) + bp->b_npages,
+   VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY |
+   VM_ALLOC_NOBUSY | VM_ALLOC_WIRED,
+   &bp->b_pages[bp->b_npages], desiredpages - bp->b_npages);
+   bp->b_npages = desiredpages;
}
 
/*

Modified: head/sys/sparc64/sparc64/pmap.c
==
--- head/sys/sparc64/sparc64/pmap.c Wed Aug  9 01:31:05 2017
(r322295)
+++ head/sys/sparc64/sparc64/pmap.c Wed Aug  9 04:23:04 2017
(r322296)
@@ -1226,7 +1226,6 @@ int
 pmap_pinit(pmap_t pm)
 {
vm_page_t ma[TSB_PAGES];
-   vm_page_t m;
int i;
 
/*
@@ -1249,14 +1248,11 @@ pmap_pinit(pmap_t pm)
CPU_ZERO(&pm->pm_active);
 
VM_OBJECT_WLOCK(pm->pm_tsb_obj);
-   for (i = 0; i < TSB_PAGES; i++) {
-   m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY |
-   VM_ALLOC_WIRED | VM_ALLOC_ZERO);
-   m->valid = VM_PAGE_BITS_ALL;
-   m->md.pmap = pm;
-   ma[i] = m;
-   }
+   vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL |
+   VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES);
VM_OBJECT_WUNLOCK(pm->pm_tsb_obj);
+   for (i = 0; i < TSB_PAGES; i++)
+   ma[i]->md.pmap = pm;
pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES);
 
bzero(&pm->pm_stats, sizeof(pm->pm_stats));

Modified: head/sys/vm/vm_glue.c
==
--- head/sys/vm/vm_glue.c   Wed Aug  9 01:31:05 2017(r322295)
+++ head/sys/vm/vm_glue.c   Wed Aug  9 04:23:04 2017(r322296)
@@ -322,7 +322,7 @@ vm_thread_new(struct thread *td, int pages)
 {
vm_object_t ksobj;
vm_offset_t ks;
-   vm_page_t m, ma[KSTACK_MAX_PAGES];
+   vm_page_t ma[KSTACK_MAX_PAGES];
struct kstack_cache_entry *ks_ce;
int i;
 
@@ -391,15 +391,10 @@ vm_thread_new(struct thread *td, int pages)
 * page of stack.
 */
VM_OBJECT_WLOCK(ksobj);
-   for (i = 0; i < pages; i++) {
-   /*
-* Get a kernel stack page.
-*/
-   m = vm_page_grab(ksobj, i, VM_ALLOC_NOBUSY |
-   VM_ALLOC_NORMAL | VM_ALLOC_WIRED);
-   ma[i] = m;
-   m->valid = VM_PAGE_BITS_ALL;
-   }
+   vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY |
+   VM_ALLOC_WIRED, ma, pages);
+   for (i = 0; i < pages; i++)
+   ma[i]->valid = VM_PAGE_BITS_ALL;
VM_OBJECT_WUNLOCK(ksobj);
pmap_qenter(ks, ma, pages);
return (1);
@@ -573,9 +568,8 @@ vm_thread_swapin(struct thread *td)
pages = td->td_kstack_pages;
  

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

2017-08-08 Thread Dexuan Cui via svn-src-head
Hi jkim,
The patch breaks FreeBSD VM on Hyper-V.

identify_hypervisor() is moved from identify_cpu() to an earlier place, but the 
global 
variable cpu_feature2 used by the function is still initialized in 
identify_cpu().

I'm not sure about the background of your patch. Can you please have a look?

Thanks,
-- Dexuan

> -Original Message-
> From: owner-src-committ...@freebsd.org [mailto:owner-src-
> committ...@freebsd.org] On Behalf Of Jung-uk Kim
> Sent: Friday, August 4, 2017 23:57
> To: src-committ...@freebsd.org; svn-src-...@freebsd.org; svn-src-
> h...@freebsd.org
> Subject: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386
> x86/include x86/x86
> 
> Author: jkim
> Date: Sat Aug  5 06:56:46 2017
> New Revision: 322076
> URL:
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsvnweb.fr
> eebsd.org%2Fchangeset%2Fbase%2F322076&data=02%7C01%7Cdecui%40micr
> osoft.com%7C5a826235e08b415fc3cb08d4dbcf2b80%7C72f988bf86f141af91ab
> 2d7cd011db47%7C1%7C0%7C636375130217192047&sdata=%2BcZhlr%2B2zX5S
> S1eA32fWMpzckNHOQlGz8UHLXCaUN0s%3D&reserved=0
> 
> Log:
>   Detect hypervisors early.  We used to set lower hz on hypervisors by default
>   but it was broken since r273800 (and r278522, its MFC to stable/10) because
>   identify_cpu() is called too late, i.e., after init_param1().
> 
>   MFC after:  3 days
> 
> Modified:
>   head/sys/amd64/amd64/machdep.c
>   head/sys/i386/i386/machdep.c
>   head/sys/x86/include/x86_var.h
>   head/sys/x86/x86/identcpu.c
> 
> Modified: head/sys/amd64/amd64/machdep.c
> =
> =
> --- head/sys/amd64/amd64/machdep.cSat Aug  5 06:46:06 2017
>   (r322075)
> +++ head/sys/amd64/amd64/machdep.cSat Aug  5 06:56:46 2017
>   (r322076)
> @@ -1537,6 +1537,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
> 
>   kmdp = init_ops.parse_preload_data(modulep);
> 
> + identify_hypervisor();
> +
>   /* Init basic tunables, hz etc */
>   init_param1();
> 
> 
> Modified: head/sys/i386/i386/machdep.c
> =
> =
> --- head/sys/i386/i386/machdep.c  Sat Aug  5 06:46:06 2017
>   (r322075)
> +++ head/sys/i386/i386/machdep.c  Sat Aug  5 06:56:46 2017
>   (r322076)
> @@ -2185,6 +2185,8 @@ init386(int first)
>   else
>   init_static_kenv(NULL, 0);
> 
> + identify_hypervisor();
> +
>   /* Init basic tunables, hz etc */
>   init_param1();
> 
> 
> Modified: head/sys/x86/include/x86_var.h
> =
> =
> --- head/sys/x86/include/x86_var.hSat Aug  5 06:46:06 2017
>   (r322075)
> +++ head/sys/x86/include/x86_var.hSat Aug  5 06:56:46 2017
>   (r322076)
> @@ -116,6 +116,7 @@ void  cpu_setregs(void);
>  void dump_add_page(vm_paddr_t);
>  void dump_drop_page(vm_paddr_t);
>  void identify_cpu(void);
> +void identify_hypervisor(void);
>  void initializecpu(void);
>  void initializecpucache(void);
>  bool fix_cpuid(void);
> 
> Modified: head/sys/x86/x86/identcpu.c
> =
> =
> --- head/sys/x86/x86/identcpu.c   Sat Aug  5 06:46:06 2017
> (r322075)
> +++ head/sys/x86/x86/identcpu.c   Sat Aug  5 06:56:46 2017
>   (r322076)
> @@ -1252,7 +1252,7 @@ static const char *const vm_pnames[] = {
>   NULL
>  };
> 
> -static void
> +void
>  identify_hypervisor(void)
>  {
>   u_int regs[4];
> @@ -1403,7 +1403,6 @@ identify_cpu(void)
>   cpu_feature2 = regs[2];
>  #endif
> 
> - identify_hypervisor();
>   cpu_vendor_id = find_cpu_vendor_id();
> 
>   if (fix_cpuid()) {

___
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: r322295 - head/sys/boot/fdt/dts/arm

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 01:31:05 2017
New Revision: 322295
URL: https://svnweb.freebsd.org/changeset/base/322295

Log:
  Update pl310 node in Armada 38x DTS to match the one used in Linux
  
  Since the cache controller nodes fixup is added to the platform code,
  this patch aligns it to the Linux device tree representation.
  
  Submitted by: Patryk Duda 
  Reviewed by: cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11884

Modified:
  head/sys/boot/fdt/dts/arm/armada-38x.dtsi

Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi
==
--- head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Wed Aug  9 01:25:47 2017
(r322294)
+++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Wed Aug  9 01:31:05 2017
(r322295)
@@ -177,7 +177,10 @@
reg = <0x8000 0x1000>;
cache-unified;
cache-level = <2>;
-   arm,io-coherent;
+   arm,double-linefill-incr = <1>;
+   arm,double-linefill-wrap = <0>;
+   arm,double-linefill = <1>;
+   prefetch-data = <1>;
};
 
scu@c000 {
___
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: r322293 - head/bin/df

2017-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  9 01:24:52 2017
New Revision: 322293
URL: https://svnweb.freebsd.org/changeset/base/322293

Log:
  df(1): Add --si as an alias for -H
  
  Reviewed by:  cem (earlier version), emaste
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D11749

Modified:
  head/bin/df/df.1
  head/bin/df/df.c

Modified: head/bin/df/df.1
==
--- head/bin/df/df.1Wed Aug  9 01:20:53 2017(r322292)
+++ head/bin/df/df.1Wed Aug  9 01:24:52 2017(r322293)
@@ -29,7 +29,7 @@
 .\" @(#)df.1   8.3 (Berkeley) 5/8/95
 .\" $FreeBSD$
 .\"
-.Dd December 1, 2015
+.Dd August 8, 2017
 .Dt DF 1
 .Os
 .Sh NAME
@@ -97,7 +97,7 @@ output.
 Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
 Pebibyte (based on powers of 1024) in order to reduce the number of
 digits to four or fewer.
-.It Fl H
+.It Fl H , Fl Fl si
 .Dq Human-readable
 output.
 Use unit suffixes: Byte, Kilobyte, Megabyte,

Modified: head/bin/df/df.c
==
--- head/bin/df/df.cWed Aug  9 01:20:53 2017(r322292)
+++ head/bin/df/df.cWed Aug  9 01:24:52 2017(r322293)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 #include 
+#include 
 #include 
 #include 
 #ifdef MOUNT_CHAR_DEVS
@@ -107,6 +108,12 @@ static int thousands;
 static struct  ufs_args mdev;
 #endif
 
+static const struct option long_options[] =
+{
+   { "si", no_argument, NULL, 'H' },
+   { NULL, no_argument, NULL, 0 },
+};
+
 int
 main(int argc, char *argv[])
 {
@@ -142,7 +149,8 @@ main(int argc, char *argv[])
if (argc < 0)
exit(1);
 
-   while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
+   while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
+   NULL)) != -1)
switch (ch) {
case 'a':
aflag = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322294 - head/sys/arm/mv/armada38x

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 01:25:47 2017
New Revision: 322294
URL: https://svnweb.freebsd.org/changeset/base/322294

Log:
  Enable pl310 coherent operation in platform init for Armada 38x
  
  Updating PL310 sotfware context sc_io_coherent field in
  platform_pl310_init() routine for Armada 38x helps to avoid
  using 'arm,io-coherent' property, which is by default not present
  in the device tree node in Linux.
  
  This way another step for DT unification between two operating
  systems is done. The improvemnt will also work after enabling
  PLATFORM for Marvell ARMv7 SoCs.
  
  Reviewed by: andrew, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11883

Modified:
  head/sys/arm/mv/armada38x/armada38x_pl310.c

Modified: head/sys/arm/mv/armada38x/armada38x_pl310.c
==
--- head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug  9 01:24:52 2017
(r322293)
+++ head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug  9 01:25:47 2017
(r322294)
@@ -57,6 +57,9 @@ platform_pl310_init(struct pl310_softc *sc)
pl310_write4(sc, PL310_PREFETCH_CTRL, PREFETCH_CTRL_DL |
PREFETCH_CTRL_DATA_PREFETCH | PREFETCH_CTRL_INCR_DL |
PREFETCH_CTRL_DL_ON_WRAP);
+
+   /* Disable L2 cache sync for IO coherent operation */
+   sc->sc_io_coherent = true;
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322292 - head/sys/boot/fdt/dts/arm

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 01:20:53 2017
New Revision: 322292
URL: https://svnweb.freebsd.org/changeset/base/322292

Log:
  Remove clock-frequency properties from Armada 38x timer nodes
  
  Since the timers' base frequency setting is added to the platform code,
  this patch removes clock-frequency properties from global
  and twd timers, aligning both to the Linux device tree.
  
  Submitted by: Patryk Duda 
  Reviewed by: cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11882

Modified:
  head/sys/boot/fdt/dts/arm/armada-38x.dtsi

Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi
==
--- head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Wed Aug  9 01:19:19 2017
(r322291)
+++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Wed Aug  9 01:20:53 2017
(r322292)
@@ -189,7 +189,6 @@
compatible = "arm,cortex-a9-global-timer";
reg = <0xc200 0x20>;
interrupts = ;
-   clock-frequency = <8>;
clocks = <&coreclk 2>;
};
 
@@ -197,7 +196,6 @@
compatible = "arm,cortex-a9-twd-timer";
reg = <0xc600 0x20>;
interrupts = ;
-   clock-frequency = <8>;
clocks = <&coreclk 2>;
};
 
___
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: r322291 - in head/usr.bin/du: . tests

2017-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  9 01:19:19 2017
New Revision: 322291
URL: https://svnweb.freebsd.org/changeset/base/322291

Log:
  du(1): Add --si option to display in terms of powers of 1000
  
  Reviewed by:  cem (earlier version), emaste
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D11748

Modified:
  head/usr.bin/du/du.1
  head/usr.bin/du/du.c
  head/usr.bin/du/tests/du_test.sh

Modified: head/usr.bin/du/du.1
==
--- head/usr.bin/du/du.1Wed Aug  9 01:14:29 2017(r322290)
+++ head/usr.bin/du/du.1Wed Aug  9 01:19:19 2017(r322291)
@@ -28,7 +28,7 @@
 .\"@(#)du.18.2 (Berkeley) 4/1/94
 .\" $FreeBSD$
 .\"
-.Dd November 4, 2012
+.Dd August 8, 2017
 .Dt DU 1
 .Os
 .Sh NAME
@@ -63,9 +63,10 @@ Calculate block counts in
 .Ar blocksize
 byte blocks.
 This is different from the
-.Fl h, k, m
+.Fl h, k, m,
+.Fl Fl si
 and
-.Fl  g
+.Fl g
 options or setting
 .Ev BLOCKSIZE
 and gives an estimate of how much space the examined file hierarchy would
@@ -101,7 +102,7 @@ Display block counts in 1073741824-byte (1 GiB) blocks
 .Dq Human-readable
 output.
 Use unit suffixes: Byte, Kilobyte, Megabyte,
-Gigabyte, Terabyte and Petabyte.
+Gigabyte, Terabyte and Petabyte based on powers of 1024.
 .It Fl k
 Display block counts in 1024-byte (1 kiB) blocks.
 .It Fl l
@@ -131,6 +132,11 @@ This option exists solely for conformance with
 Display an entry for each specified file.
 (Equivalent to
 .Fl d Li 0 )
+.It Fl Fl si
+.Dq Human-readable
+output.
+Use unit suffixes: Byte, Kilobyte, Megabyte,
+Gigabyte, Terabyte and Petabyte based on powers of 1000.
 .It Fl t Ar threshold
 Display only entries for which size exceeds
 .Ar threshold .
@@ -166,9 +172,9 @@ options override each other and the command's actions 
 by the last one specified.
 .Pp
 The
-.Fl h, k
+.Fl h, k, m
 and
-.Fl m
+.Fl Fl si
 options all override each other; the last one specified determines
 the block counts used.
 .Sh ENVIRONMENT
@@ -177,17 +183,17 @@ the block counts used.
 If the environment variable
 .Ev BLOCKSIZE
 is set, and the
-.Fl h, k
+.Fl h, k, m
 or
-.Fl m
+.Fl Fl si
 options are not specified, the block counts will be displayed in units of
 that block size.
 If
 .Ev BLOCKSIZE
 is not set, and the
-.Fl h, k
+.Fl h, k, m
 or
-.Fl m
+.Fl Fl si
 options are not specified, the block counts will be displayed in 512-byte
 blocks.
 .El

Modified: head/usr.bin/du/du.c
==
--- head/usr.bin/du/du.cWed Aug  9 01:14:29 2017(r322290)
+++ head/usr.bin/du/du.cWed Aug  9 01:19:19 2017(r322291)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#define SI_OPT (CHAR_MAX + 1)
+
+#define UNITS_21
+#define UNITS_SI   2
+
 static SLIST_HEAD(ignhead, ignentry) ignores;
 struct ignentry {
char*mask;
@@ -75,10 +81,16 @@ static int  ignorep(FTSENT *);
 static voidsiginfo(int __unused);
 
 static int nodumpflag = 0;
-static int Aflag;
+static int Aflag, hflag;
 static longblocksize, cblocksize;
 static volatile sig_atomic_t info;
 
+static const struct option long_options[] =
+{
+   { "si", no_argument, NULL, SI_OPT },
+   { NULL, no_argument, NULL, 0 },
+};
+
 int
 main(int argc, char *argv[])
 {
@@ -89,14 +101,13 @@ main(int argc, char *argv[])
int ftsoptions;
int depth;
int Hflag, Lflag, aflag, sflag, dflag, cflag;
-   int hflag, lflag, ch, notused, rval;
+   int lflag, ch, notused, rval;
char**save;
static char dot[] = ".";
 
setlocale(LC_ALL, "");
 
-   Hflag = Lflag = aflag = sflag = dflag = cflag = hflag =
-   lflag = Aflag = 0;
+   Hflag = Lflag = aflag = sflag = dflag = cflag = lflag = Aflag = 0;
 
save = argv;
ftsoptions = FTS_PHYSICAL;
@@ -108,7 +119,8 @@ main(int argc, char *argv[])
depth = INT_MAX;
SLIST_INIT(&ignores);
 
-   while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1)
+   while ((ch = getopt_long(argc, argv, "+AB:HI:LPasd:cghklmnrt:x",
+   long_options, NULL)) != -1)
switch (ch) {
case 'A':
Aflag = 1;
@@ -160,7 +172,7 @@ main(int argc, char *argv[])
blocksize = 1073741824;
break;
case 'h':
-   hflag = 1;
+   hflag = UNITS_2;
break;
case 'k':
hflag = 0;
@@ -189,6 +201,9 @@ main(int argc, char *argv[])
case 'x':
ftsoptions |= F

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

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 01:14:29 2017
New Revision: 322290
URL: https://svnweb.freebsd.org/changeset/base/322290

Log:
  Dynamically configure timers' base frequency for Armada 38x
  
  Instead of using 'clock-frequency' device tree property for global/twd
  mpcore timers of Armada 38x SoCs, set it in platform_late_init stage
  with arm_tmr_change_frequency() function.
  
  Reviewed by: cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11881

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

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cWed Aug  9 01:06:40 2017
(r322289)
+++ head/sys/arm/mv/mv_machdep.cWed Aug  9 01:14:29 2017
(r322290)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -294,6 +295,9 @@ platform_late_init(void)
 #endif
 
 #if defined(SOC_MV_ARMADA38X)
+   /* Configure timers' base frequency */
+   arm_tmr_change_frequency(get_cpu_freq() / 2);
+
/*
 * Workaround for Marvell Armada38X family HW issue
 * between Cortex-A9 CPUs and on-chip devices that may
___
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: r322289 - head/sys/dev/ofw

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 01:06:40 2017
New Revision: 322289
URL: https://svnweb.freebsd.org/changeset/base/322289

Log:
  Enable using ofw_bus_find_compatible in early platform code
  
  Before this patch function ofw_bus_find_compatible was using
  memory allocations in order to find compatible node and the property's
  length. This way there was always a suited buffer for property,
  however this approach had also disadvantages - ofw_bus_find_compatible
  couldn't be used when malloc is not available, e.g. during fdt fixup stage.
  
  In order to remove the usage limitation of ofw_bus_find_compatible(),
  this patch modifies the function to use ofw_bus_node_is_compatible()
  (instead of the one without _int suffix), which uses a fixed
  buffer on stack instead of dynamic allocations.
  
  Submitted by: Patryk Duda 
  Reviewed by: nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11880

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

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Wed Aug  9 01:04:36 2017
(r322288)
+++ head/sys/dev/ofw/ofw_bus_subr.c Wed Aug  9 01:06:40 2017
(r322289)
@@ -720,22 +720,14 @@ phandle_t
 ofw_bus_find_compatible(phandle_t node, const char *onecompat)
 {
phandle_t child, ret;
-   void *compat;
-   int len;
 
/*
 * Traverse all children of 'start' node, and find first with
 * matching 'compatible' property.
 */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
-   len = OF_getprop_alloc(child, "compatible", 1, &compat);
-   if (len >= 0) {
-   ret = ofw_bus_node_is_compatible_int(compat, len,
-   onecompat);
-   free(compat, M_OFWPROP);
-   if (ret != 0)
-   return (child);
-   }
+   if (ofw_bus_node_is_compatible(child, onecompat) != 0)
+   return (child);
 
ret = ofw_bus_find_compatible(child, onecompat);
if (ret != 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: r322288 - head/lib/libc/regex

2017-08-08 Thread Kyle Evans
Author: kevans
Date: Wed Aug  9 01:04:36 2017
New Revision: 322288
URL: https://svnweb.freebsd.org/changeset/base/322288

Log:
  regex(3): Refactor fast/slow stepping bits in the matching engine
  
  Adding features for matching is fairly straightforward, but this requires
  some duplication because of this fast/slow setup. They can be fairly
  trivially combined into a single walk(), so do it to make future additions
  less error prone.
  
  Reviewed by:  cem (earlier version), emaste, pfg
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D11233

Modified:
  head/lib/libc/regex/engine.c

Modified: head/lib/libc/regex/engine.c
==
--- head/lib/libc/regex/engine.cWed Aug  9 00:56:29 2017
(r322287)
+++ head/lib/libc/regex/engine.cWed Aug  9 01:04:36 2017
(r322288)
@@ -36,6 +36,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 /*
  * The matching engine and friends.  This file is #included by regexec.c
  * after suitable #defines of a variety of macros used herein, so that
@@ -45,8 +47,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef SNAMES
 #definematcher smatcher
-#definefastsfast
-#defineslowsslow
+#definewalkswalk
 #definedissect sdissect
 #definebackref sbackref
 #definestepsstep
@@ -56,8 +57,7 @@ __FBSDID("$FreeBSD$");
 #endif
 #ifdef LNAMES
 #definematcher lmatcher
-#definefastlfast
-#defineslowlslow
+#definewalklwalk
 #definedissect ldissect
 #definebackref lbackref
 #definesteplstep
@@ -67,8 +67,7 @@ __FBSDID("$FreeBSD$");
 #endif
 #ifdef MNAMES
 #definematcher mmatcher
-#definefastmfast
-#defineslowmslow
+#definewalkmwalk
 #definedissect mdissect
 #definebackref mbackref
 #definestepmstep
@@ -104,8 +103,7 @@ extern "C" {
 static int matcher(struct re_guts *g, const char *string, size_t nmatch, 
regmatch_t pmatch[], int eflags);
 static const char *dissect(struct match *m, const char *start, const char 
*stop, sopno startst, sopno stopst);
 static const char *backref(struct match *m, const char *start, const char 
*stop, sopno startst, sopno stopst, sopno lev, int);
-static const char *fast(struct match *m, const char *start, const char *stop, 
sopno startst, sopno stopst);
-static const char *slow(struct match *m, const char *start, const char *stop, 
sopno startst, sopno stopst);
+static const char *walk(struct match *m, const char *start, const char *stop, 
sopno startst, sopno stopst, bool fast);
 static states step(struct re_guts *g, sopno start, sopno stop, states bef, 
wint_t ch, states aft);
 #define MAX_RECURSION  100
 #defineBOL (OUT-1)
@@ -251,7 +249,7 @@ matcher(struct re_guts *g,
 
/* this loop does only one repetition except for backrefs */
for (;;) {
-   endp = fast(m, start, stop, gf, gl);
+   endp = walk(m, start, stop, gf, gl, true);
if (endp == NULL) { /* a miss */
if (m->pmatch != NULL)
free((char *)m->pmatch);
@@ -267,7 +265,7 @@ matcher(struct re_guts *g,
assert(m->coldp != NULL);
for (;;) {
NOTE("finding start");
-   endp = slow(m, m->coldp, stop, gf, gl);
+   endp = walk(m, m->coldp, stop, gf, gl, false);
if (endp != NULL)
break;
assert(m->coldp < m->endp);
@@ -312,7 +310,7 @@ matcher(struct re_guts *g,
if (dp != NULL || endp <= m->coldp)
break;  /* defeat */
NOTE("backoff");
-   endp = slow(m, m->coldp, endp-1, gf, gl);
+   endp = walk(m, m->coldp, endp-1, gf, gl, false);
if (endp == NULL)
break;  /* defeat */
/* try it on a shorter possibility */
@@ -430,10 +428,10 @@ dissect(struct match *m,
stp = stop;
for (;;) {
/* how long could this one be? */
-   rest = slow(m, sp, stp, ss, es);
+   rest = walk(m, sp, stp, ss, es, false);
assert(rest != NULL);   /* it did match */
/* could the rest match the rest? */
-   tail = slow(m, rest, stop, es, stopst);
+   tail = walk(m, rest, stop, es, stopst, false);
if (tail == stop)
break;  /* yes! */
/* no -

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

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 00:56:29 2017
New Revision: 322287
URL: https://svnweb.freebsd.org/changeset/base/322287

Log:
  Add support for "compatible" parameter in ofw_fdt_fixup
  
  Sometimes it's convenient to provide fixup to many boards
  that use the same SoC family (eg. Marvell Armada 38x).
  Instead of putting multiple entries in fdt_fixup_table,
  use one entry which refers to all boards with given SoC.
  
  Submitted by: Patryk Duda 
  Reviewed by: nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11878

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

Modified: head/sys/dev/ofw/ofw_fdt.c
==
--- head/sys/dev/ofw/ofw_fdt.c  Wed Aug  9 00:51:45 2017(r322286)
+++ head/sys/dev/ofw/ofw_fdt.c  Wed Aug  9 00:56:29 2017(r322287)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "ofw_if.h"
 
@@ -450,7 +451,15 @@ ofw_fdt_fixup(ofw_t ofw)
for (i = 0; fdt_fixup_table[i].model != NULL; i++) {
if (strncmp(model, fdt_fixup_table[i].model,
FDT_MODEL_LEN) != 0)
-   continue;
+   /*
+* Sometimes it's convenient to provide one
+* fixup entry that refers to many boards.
+* To handle this case, simply check if model
+* is compatible parameter
+*/
+   if(!ofw_bus_node_is_compatible(root,
+   fdt_fixup_table[i].model))
+   continue;
 
if (fdt_fixup_table[i].handler != NULL)
(*fdt_fixup_table[i].handler)(root);
___
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: r322286 - head/sys/boot/fdt/dts/arm

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 00:51:45 2017
New Revision: 322286
URL: https://svnweb.freebsd.org/changeset/base/322286

Log:
  Restore original /soc ranges on Marvell Armada 38x boards
  
  Because fdt_get_ranges can process now multiple 'ranges' entries,
  restoring the ranges from original Linux device trees is possible.
  
  Submitted by: Patryk Duda 
  Reviewed by: cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11877

Modified:
  head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts
  head/sys/boot/fdt/dts/arm/armada-388-gp.dts
  head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi

Modified: head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts
==
--- head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts  Wed Aug  9 00:45:25 
2017(r322285)
+++ head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts  Wed Aug  9 00:51:45 
2017(r322286)
@@ -60,7 +60,11 @@
};
 
soc {
-   ranges = ;
+   ranges = ;
 
internal-regs {
i2c0: i2c@11000 {

Modified: head/sys/boot/fdt/dts/arm/armada-388-gp.dts
==
--- head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug  9 00:45:25 2017
(r322285)
+++ head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug  9 00:51:45 2017
(r322286)
@@ -59,7 +59,11 @@
};
 
soc {
-   ranges = ;
+   ranges = ;
 
internal-regs {
crypto@9 {

Modified: head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi
==
--- head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug  9 
00:45:25 2017(r322285)
+++ head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug  9 
00:51:45 2017(r322286)
@@ -57,7 +57,11 @@
};
 
soc {
-   ranges = ;
+   ranges = ;
 
internal-regs {
ethernet@7 {
___
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: r322285 - head/sys/dev/fdt

2017-08-08 Thread Marcin Wojtas
Author: mw
Date: Wed Aug  9 00:45:25 2017
New Revision: 322285
URL: https://svnweb.freebsd.org/changeset/base/322285

Log:
  Enable parsing simple-bus 'ranges' with multiple entries
  
  This patch makes possible to boot with up to 8 ranges in soc.
  Dynamic allocation cannot be used, because ftd_get_ranges
  function is called early, when malloc is not available.
  
  Change is required for the alignment of Marvell Armada 38x
  device trees present in sys/gnu/dts/arm - originally
  the platform has 6 entries in simple-bus 'ranges'.
  
  Submitted by: Patryk Duda 
  Reviewed by: manu, nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11876

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Tue Aug  8 23:55:38 2017
(r322284)
+++ head/sys/dev/fdt/fdt_common.c   Wed Aug  9 00:45:25 2017
(r322285)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #define FDT_TYPE_LEN   64
 
 #define FDT_REG_CELLS  4
+#define FDT_RANGES_SIZE 48
 
 SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD, 0, "Flattened Device Tree");
 
@@ -149,7 +150,7 @@ fdt_get_range_by_busaddr(phandle_t node, u_long addr, 
 int
 fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size)
 {
-   pcell_t ranges[6], *rangesptr;
+   pcell_t ranges[FDT_RANGES_SIZE], *rangesptr;
pcell_t addr_cells, size_cells, par_addr_cells;
u_long par_bus_addr, pbase, psize;
int err, len, tuple_size, tuples;
___
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: r322282 - head/sys/arm/conf

2017-08-08 Thread Ian Lepore
Author: ian
Date: Tue Aug  8 22:58:34 2017
New Revision: 322282
URL: https://svnweb.freebsd.org/changeset/base/322282

Log:
  Remove the ds133x and s35390a i2c RTC drivers for now.  They both do i2c
  transfers in their probe() or attach() routines, and that doesn't work
  when the low-level controller requires interrupts to be functional.
  
  The DS133x family of chips is nearly identical to the DS1307 and support
  for them should be added to that driver, then the ds133x driver can be
  deleted.  The s35390a driver just needs a non-trivial workover.  In both
  cases that work will be done and committed separately.

Modified:
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Tue Aug  8 22:40:26 2017(r322281)
+++ head/sys/arm/conf/GENERIC   Tue Aug  8 22:58:34 2017(r322282)
@@ -139,11 +139,9 @@ device twl_clks# twl external 
clocks
 
 # i2c RTCs
 device ds1307  # Dallas DS1307 RTC and compatible
-device ds133x  # Dallas DS1337, DS1338 and DS1339 RTC
 device ds1672  # Dallas DS1672 RTC
 device ds3231  # Dallas DS3231 RTC + temperature
 device nxprtc  # NXP RTCs: PCA/PFC212x PCA/PCF85xx
-device s35390a # Seiko Instruments S-35390A RTC
 
 # GPIO
 device gpio
___
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: r322281 - head/sbin/ifconfig

2017-08-08 Thread Renato Botelho
Author: garga (ports committer)
Date: Tue Aug  8 22:40:26 2017
New Revision: 322281
URL: https://svnweb.freebsd.org/changeset/base/322281

Log:
  Add missing parenthesis on error message
  
  Approved by:  loos
  MFC after:3 days
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sbin/ifconfig/ifconfig.c

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Tue Aug  8 21:09:26 2017
(r322280)
+++ head/sbin/ifconfig/ifconfig.c   Tue Aug  8 22:40:26 2017
(r322281)
@@ -760,7 +760,7 @@ top:
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 &&
(uafp != NULL || errno != EAFNOSUPPORT ||
 (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0))
-   err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family);
+   err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family);
 
while (argc > 0) {
p = cmd_lookup(*argv, iscreate);
___
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: r322280 - head/sys/netpfil/pf

2017-08-08 Thread Kristof Provost
Author: kp
Date: Tue Aug  8 21:09:26 2017
New Revision: 322280
URL: https://svnweb.freebsd.org/changeset/base/322280

Log:
  pf_get_sport(): Prevent possible endless loop when searching for an unused 
nat port
  
  This is an import of Alexander Bluhm's OpenBSD commit r1.60,
  the first chunk had to be modified because on OpenBSD the
  'cut' declaration is located elsewhere.
  
  Upstream report by Jingmin Zhou:
  https://marc.info/?l=openbsd-pf&m=150020133510896&w=2
  
  OpenBSD commit message:
   Use a 32 bit variable to detect integer overflow when searching for
   an unused nat port.  Prevents a possible endless loop if high port
   is 65535 or low port is 0.
   report and analysis Jingmin Zhou; OK sashan@ visa@
  Quoted from: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_lb.c
  
  PR:   221201
  Submitted by: Fabian Keil 
  Obtained from:  OpenBSD via ElectroBSD
  MFC after:1 week

Modified:
  head/sys/netpfil/pf/pf_lb.c

Modified: head/sys/netpfil/pf/pf_lb.c
==
--- head/sys/netpfil/pf/pf_lb.c Tue Aug  8 21:01:11 2017(r322279)
+++ head/sys/netpfil/pf/pf_lb.c Tue Aug  8 21:09:26 2017(r322280)
@@ -259,7 +259,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf
return (0);
}
} else {
-   uint16_t tmp, cut;
+   uint32_t tmp;
+   uint16_t cut;
 
if (low > high) {
tmp = low;
@@ -269,7 +270,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf
/* low < high */
cut = arc4random() % (1 + high - low) + low;
/* low <= cut <= high */
-   for (tmp = cut; tmp <= high; ++(tmp)) {
+   for (tmp = cut; tmp <= high && tmp <= 0x; ++tmp) {
key.port[1] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
NULL) {
@@ -277,7 +278,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf
return (0);
}
}
-   for (tmp = cut - 1; tmp >= low; --(tmp)) {
+   tmp = cut;
+   for (tmp -= 1; tmp >= low && tmp <= 0x; --tmp) {
key.port[1] = htons(tmp);
if (pf_find_state_all(&key, PF_IN, NULL) ==
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: r322279 - head/sys/dev/efidev

2017-08-08 Thread Warner Losh
Author: imp
Date: Tue Aug  8 21:01:11 2017
New Revision: 322279
URL: https://svnweb.freebsd.org/changeset/base/322279

Log:
  Turns out to be even simpler to just not create /dev/efi if we don't
  have a efi runtime.

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

Modified: head/sys/dev/efidev/efidev.c
==
--- head/sys/dev/efidev/efidev.cTue Aug  8 20:44:16 2017
(r322278)
+++ head/sys/dev/efidev/efidev.cTue Aug  8 21:01:11 2017
(r322279)
@@ -39,28 +39,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static d_open_t efidev_open;
 static d_ioctl_t efidev_ioctl;
 
 static struct cdevsw efi_cdevsw = {
.d_name = "efi",
.d_version = D_VERSION,
-   .d_open = efidev_open,
.d_ioctl = efidev_ioctl,
 };

 static int
-efidev_open(struct cdev *dev __unused, int oflags __unused,
-int devtype __unused, struct thread *td __unused)
-{
-   /*
-* Only return success when we have an actual runtime to call.
-*/
-
-   return efi_rt_ok();
-}
-
-static int
 efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
 int flags __unused, struct thread *td __unused)
 {
@@ -195,6 +182,11 @@ efidev_modevents(module_t m, int event, void *arg __un
 
switch (event) {
case MOD_LOAD:
+   /*
+* If we have no efi environment, then don't create the device.
+*/
+   if (efi_rt_ok() != 0)
+   return (0);
make_dev_args_init(&mda);
mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME;
mda.mda_devsw = &efi_cdevsw;
___
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: r322278 - in head/sys: amd64/amd64 amd64/include dev/efidev

2017-08-08 Thread Warner Losh
Author: imp
Date: Tue Aug  8 20:44:16 2017
New Revision: 322278
URL: https://svnweb.freebsd.org/changeset/base/322278

Log:
  Fail to open efirt device when no EFI on system.
  
  libefivar expects opening /dev/efi to indicate if the we can make efi
  runtime calls. With a null routine, it was always succeeding leading
  efi_variables_supported() to return the wrong value. Only succeed if
  we have an efi_runtime table. Also, while I'm hear, out of an
  abundance of caution, add a likely redundant check to make sure
  efi_systbl is not NULL before dereferencing it. I know it can't be
  NULL if efi_cfgtbl is non-NULL, but the compiler doesn't.

Modified:
  head/sys/amd64/amd64/efirt.c
  head/sys/amd64/include/efi.h
  head/sys/dev/efidev/efidev.c

Modified: head/sys/amd64/amd64/efirt.c
==
--- head/sys/amd64/amd64/efirt.cTue Aug  8 20:17:07 2017
(r322277)
+++ head/sys/amd64/amd64/efirt.cTue Aug  8 20:44:16 2017
(r322278)
@@ -421,12 +421,21 @@ efi_uninit(void)
 }
 
 int
+efi_rt_ok(void)
+{
+
+   if (efi_runtime == NULL)
+   return (ENXIO);
+   return (0);
+}
+
+int
 efi_get_table(struct uuid *uuid, void **ptr)
 {
struct efi_cfgtbl *ct;
u_long count;
 
-   if (efi_cfgtbl == NULL)
+   if (efi_cfgtbl == NULL || efi_systbl == NULL)
return (ENXIO);
count = efi_systbl->st_entries;
ct = efi_cfgtbl;

Modified: head/sys/amd64/include/efi.h
==
--- head/sys/amd64/include/efi.hTue Aug  8 20:17:07 2017
(r322277)
+++ head/sys/amd64/include/efi.hTue Aug  8 20:44:16 2017
(r322278)
@@ -49,6 +49,7 @@
 struct uuid;
 struct efi_tm;
 
+int efi_rt_ok(void);
 int efi_get_table(struct uuid *uuid, void **ptr);
 int efi_get_time(struct efi_tm *tm);
 int efi_get_time_locked(struct efi_tm *tm);

Modified: head/sys/dev/efidev/efidev.c
==
--- head/sys/dev/efidev/efidev.cTue Aug  8 20:17:07 2017
(r322277)
+++ head/sys/dev/efidev/efidev.cTue Aug  8 20:44:16 2017
(r322278)
@@ -39,14 +39,27 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static d_open_t efidev_open;
 static d_ioctl_t efidev_ioctl;
 
 static struct cdevsw efi_cdevsw = {
.d_name = "efi",
.d_version = D_VERSION,
+   .d_open = efidev_open,
.d_ioctl = efidev_ioctl,
 };

+static int
+efidev_open(struct cdev *dev __unused, int oflags __unused,
+int devtype __unused, struct thread *td __unused)
+{
+   /*
+* Only return success when we have an actual runtime to call.
+*/
+
+   return efi_rt_ok();
+}
+
 static int
 efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr,
 int flags __unused, struct thread *td __unused)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322029 - in head: usr.bin usr.sbin

2017-08-08 Thread Jeremie Le Hen
On Sat, Aug 5, 2017 at 3:38 PM, Brooks Davis  wrote:
> On Fri, Aug 04, 2017 at 04:50:32PM +0200, Jeremie Le Hen wrote:
>> On Fri, Aug 4, 2017 at 12:42 AM, Ngie Cooper (yaneurabeya)
>>  wrote:
>> >
>> >> On Aug 3, 2017, at 14:30, Jeremie Le Hen  wrote:
>> >>
>> >> Author: jlh
>> >> Date: Thu Aug  3 21:30:12 2017
>> >> New Revision: 322029
>> >> URL: https://svnweb.freebsd.org/changeset/base/322029
>> >>
>> >> Log:
>> >>  rwho/ruptime/rwhod shouldn't be gated by RCMDS.
>> >
>> > The why in this commit and the next you made (r322031) would have 
>> > been incredibly helpful. If bugzilla disappears I only have the commit 
>> > history tracking the what.
>>
>> I agree, I realized this only afterwards.  I don't know how to fix this 
>> though.
>
> Reverting the change and reapplying it with a meaningful message will
> produce the best result.

OK thanks.  FYI this is submitted in r322277, with changes to
tools/build/mk/OptionalObsoleteFiles.inc as requested by jhb@.

Thanks all for your patience :-).
-- 
Jeremie Le Hen
j...@freebsd.org
___
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: r322277 - in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod

2017-08-08 Thread Jeremie Le Hen
Author: jlh
Date: Tue Aug  8 20:17:07 2017
New Revision: 322277
URL: https://svnweb.freebsd.org/changeset/base/322277

Log:
  rwho/ruptime/rwhod shouldn't be gated by RCMDS.
  
  As peter@ points out in pr/220953:
  "rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin
  etc).
  
  They should *not* be in the rcmds package which is disabled by default.  We
  rely on rwho/rwhod/ruptime in the freebsd.org cluster."
  
  This commit is a re-commit of r322029 and r322031 with a better commit log, as
  pointed out by ngie@.
  
  This also includes the necesary changes to OptionalObsoleteFiles.inc, as
  requested by jhb@.
  
  PR:   220953
  Reported by:  peter@, jhb@
  Differential Revision:https://reviews.freebsd.org/D11743

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.bin/Makefile
  head/usr.bin/ruptime/ruptime.1
  head/usr.bin/rwho/rwho.1
  head/usr.sbin/Makefile
  head/usr.sbin/rwhod/rwhod.8

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Aug  8 20:07:08 
2017(r322276)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Aug  8 20:17:07 
2017(r322277)
@@ -6895,24 +6895,16 @@ OLD_FILES+=usr/share/man/man8/rbootd.8.gz
 
 .if ${MK_RCMDS} == no
 OLD_FILES+=bin/rcp
-OLD_FILES+=etc/rc.d/rwho
-OLD_FILES+=etc/periodic/daily/140.clean-rwho
 OLD_FILES+=rescue/rcp
 OLD_FILES+=usr/bin/rlogin
 OLD_FILES+=usr/bin/rsh
-OLD_FILES+=usr/bin/ruptime
-OLD_FILES+=usr/bin/rwho
 OLD_FILES+=usr/libexec/rlogind
 OLD_FILES+=usr/libexec/rshd
-OLD_FILES+=usr/sbin/rwhod
 OLD_FILES+=usr/share/man/man1/rcp.1.gz
 OLD_FILES+=usr/share/man/man1/rlogin.1.gz
 OLD_FILES+=usr/share/man/man1/rsh.1.gz
-OLD_FILES+=usr/share/man/man1/ruptime.1.gz
-OLD_FILES+=usr/share/man/man1/rwho.1.gz
 OLD_FILES+=usr/share/man/man8/rlogind.8.gz
 OLD_FILES+=usr/share/man/man8/rshd.8.gz
-OLD_FILES+=usr/share/man/man8/rwhod.8.gz
 .endif
 
 .if ${MK_RESCUE} == no

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Tue Aug  8 20:07:08 2017(r322276)
+++ head/usr.bin/Makefile   Tue Aug  8 20:17:07 2017(r322277)
@@ -133,8 +133,10 @@ SUBDIR=alias \
rpcinfo \
rs \
rup \
+   ruptime \
rusers \
rwall \
+   rwho \
script \
sdiff \
sed \
@@ -251,8 +253,6 @@ SUBDIR.${MK_OPENSSL}+=  newkey
 SUBDIR.${MK_QUOTAS}+=  quota
 SUBDIR.${MK_RCMDS}+=   rlogin
 SUBDIR.${MK_RCMDS}+=   rsh
-SUBDIR.${MK_RCMDS}+=   ruptime
-SUBDIR.${MK_RCMDS}+=   rwho
 SUBDIR.${MK_SENDMAIL}+=vacation
 SUBDIR.${MK_TALK}+=talk
 SUBDIR.${MK_TELNET}+=  telnet

Modified: head/usr.bin/ruptime/ruptime.1
==
--- head/usr.bin/ruptime/ruptime.1  Tue Aug  8 20:07:08 2017
(r322276)
+++ head/usr.bin/ruptime/ruptime.1  Tue Aug  8 20:17:07 2017
(r322277)
@@ -38,15 +38,6 @@
 .Nm
 .Op Fl alrtu
 .Op Ar host ...
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and will be removed from future versions of the
-.Fx
-base system.
-If
-.Nm
-is still required, it can be installed from ports or packages
-(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/usr.bin/rwho/rwho.1
==
--- head/usr.bin/rwho/rwho.1Tue Aug  8 20:07:08 2017(r322276)
+++ head/usr.bin/rwho/rwho.1Tue Aug  8 20:17:07 2017(r322277)
@@ -37,15 +37,6 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl a
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and will be removed from future versions of the
-.Fx
-base system.
-If
-.Nm
-is still required, it can be installed from ports or packages
-(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Aug  8 20:07:08 2017(r322276)
+++ head/usr.sbin/Makefile  Tue Aug  8 20:17:07 2017(r322277)
@@ -74,6 +74,7 @@ SUBDIR=   adduser \
rpc.statd \
rpc.umntall \
rtprio \
+   rwhod \
service \
services_mkdb \
sesutil \
@@ -191,7 +192,6 @@ SUBDIR.${MK_PPP}+=  ppp
 SUBDIR.${MK_QUOTAS}+=  edquota
 SUBDIR.${MK_QUOTAS}+=  quotaon
 SUBDIR.${MK_QUOTAS}+=  repquota
-SUBDIR.${MK_RCMDS}+=   rwhod
 SUBDIR.${MK_SENDMAIL}+=editmap
 SUBDIR.${MK_SENDMAIL}+=mailstats
 SUBDIR.${MK_SENDMAIL}+=makemap

Modified: head/usr.sbin/rwhod/rwhod.8
==
--- head/usr.sbin/rwhod/rwhod.8 Tue Aug  8 20:07:08 2017(r322276)
+++ head/usr.sbin/rwhod/rwhod.8 Tue Aug  8 20:17:07 2017(r322277)
@@ -40,15 +40,6 @@
 .Op Fl p
 .Op Fl l
 .Op Fl m Op Ar ttl
-.Sh

svn commit: r322276 - in head: usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod

2017-08-08 Thread Jeremie Le Hen
Author: jlh
Date: Tue Aug  8 20:07:08 2017
New Revision: 322276
URL: https://svnweb.freebsd.org/changeset/base/322276

Log:
  Revert r322029 and r322031 so as to recommit them with a better commit log.
  
  PR:   220953
  Reported by:  ngie@

Modified:
  head/usr.bin/Makefile
  head/usr.bin/ruptime/ruptime.1
  head/usr.bin/rwho/rwho.1
  head/usr.sbin/Makefile
  head/usr.sbin/rwhod/rwhod.8

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Tue Aug  8 19:53:06 2017(r322275)
+++ head/usr.bin/Makefile   Tue Aug  8 20:07:08 2017(r322276)
@@ -133,10 +133,8 @@ SUBDIR=alias \
rpcinfo \
rs \
rup \
-   ruptime \
rusers \
rwall \
-   rwho \
script \
sdiff \
sed \
@@ -253,6 +251,8 @@ SUBDIR.${MK_OPENSSL}+=  newkey
 SUBDIR.${MK_QUOTAS}+=  quota
 SUBDIR.${MK_RCMDS}+=   rlogin
 SUBDIR.${MK_RCMDS}+=   rsh
+SUBDIR.${MK_RCMDS}+=   ruptime
+SUBDIR.${MK_RCMDS}+=   rwho
 SUBDIR.${MK_SENDMAIL}+=vacation
 SUBDIR.${MK_TALK}+=talk
 SUBDIR.${MK_TELNET}+=  telnet

Modified: head/usr.bin/ruptime/ruptime.1
==
--- head/usr.bin/ruptime/ruptime.1  Tue Aug  8 19:53:06 2017
(r322275)
+++ head/usr.bin/ruptime/ruptime.1  Tue Aug  8 20:07:08 2017
(r322276)
@@ -38,6 +38,15 @@
 .Nm
 .Op Fl alrtu
 .Op Ar host ...
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+If
+.Nm
+is still required, it can be installed from ports or packages
+(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/usr.bin/rwho/rwho.1
==
--- head/usr.bin/rwho/rwho.1Tue Aug  8 19:53:06 2017(r322275)
+++ head/usr.bin/rwho/rwho.1Tue Aug  8 20:07:08 2017(r322276)
@@ -37,6 +37,15 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl a
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+If
+.Nm
+is still required, it can be installed from ports or packages
+(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Aug  8 19:53:06 2017(r322275)
+++ head/usr.sbin/Makefile  Tue Aug  8 20:07:08 2017(r322276)
@@ -74,7 +74,6 @@ SUBDIR=   adduser \
rpc.statd \
rpc.umntall \
rtprio \
-   rwhod \
service \
services_mkdb \
sesutil \
@@ -192,6 +191,7 @@ SUBDIR.${MK_PPP}+=  ppp
 SUBDIR.${MK_QUOTAS}+=  edquota
 SUBDIR.${MK_QUOTAS}+=  quotaon
 SUBDIR.${MK_QUOTAS}+=  repquota
+SUBDIR.${MK_RCMDS}+=   rwhod
 SUBDIR.${MK_SENDMAIL}+=editmap
 SUBDIR.${MK_SENDMAIL}+=mailstats
 SUBDIR.${MK_SENDMAIL}+=makemap

Modified: head/usr.sbin/rwhod/rwhod.8
==
--- head/usr.sbin/rwhod/rwhod.8 Tue Aug  8 19:53:06 2017(r322275)
+++ head/usr.sbin/rwhod/rwhod.8 Tue Aug  8 20:07:08 2017(r322276)
@@ -40,6 +40,15 @@
 .Op Fl p
 .Op Fl l
 .Op Fl m Op Ar ttl
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+If
+.Nm
+is still required, it can be installed from ports or packages
+(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm
___
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: r322272 - head/sys/compat/linuxkpi/common/src

2017-08-08 Thread Alexander Motin
Author: mav
Date: Tue Aug  8 19:36:34 2017
New Revision: 322272
URL: https://svnweb.freebsd.org/changeset/base/322272

Log:
  Fix few issues of LinuxKPI workqueue.
  
  LinuxKPI workqueue wrappers reported "successful" cancellation for works
  already completed in normal way.  This change brings reported status and
  real cancellation fact into sync.  This required for drm-next operation.
  
  Reviewed by:  hselasky (earlier version)
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D11904

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

Modified: head/sys/compat/linuxkpi/common/src/linux_work.c
==
--- head/sys/compat/linuxkpi/common/src/linux_work.cTue Aug  8 18:31:40 
2017(r322271)
+++ head/sys/compat/linuxkpi/common/src/linux_work.cTue Aug  8 19:36:34 
2017(r322272)
@@ -214,7 +214,7 @@ linux_work_fn(void *context, int pending)
[WORK_ST_TIMER] = WORK_ST_EXEC, /* delayed work w/o 
timeout */
[WORK_ST_TASK] = WORK_ST_EXEC,  /* call callback */
[WORK_ST_EXEC] = WORK_ST_IDLE,  /* complete callback */
-   [WORK_ST_CANCEL] = WORK_ST_IDLE,/* complete cancel */
+   [WORK_ST_CANCEL] = WORK_ST_EXEC,/* failed to cancel */
};
struct work_struct *work;
struct workqueue_struct *wq;
@@ -236,6 +236,7 @@ linux_work_fn(void *context, int pending)
switch (linux_update_state(&work->state, states)) {
case WORK_ST_TIMER:
case WORK_ST_TASK:
+   case WORK_ST_CANCEL:
WQ_EXEC_UNLOCK(wq);
 
/* call work function */
@@ -266,13 +267,14 @@ linux_delayed_work_timer_fn(void *arg)
[WORK_ST_IDLE] = WORK_ST_IDLE,  /* NOP */
[WORK_ST_TIMER] = WORK_ST_TASK, /* start queueing task 
*/
[WORK_ST_TASK] = WORK_ST_TASK,  /* NOP */
-   [WORK_ST_EXEC] = WORK_ST_TASK,  /* queue task another 
time */
-   [WORK_ST_CANCEL] = WORK_ST_IDLE,/* complete cancel */
+   [WORK_ST_EXEC] = WORK_ST_EXEC,  /* NOP */
+   [WORK_ST_CANCEL] = WORK_ST_TASK,/* failed to cancel */
};
struct delayed_work *dwork = arg;
 
switch (linux_update_state(&dwork->work.state, states)) {
case WORK_ST_TIMER:
+   case WORK_ST_CANCEL:
linux_delayed_work_enqueue(dwork);
break;
default:
@@ -290,10 +292,10 @@ linux_cancel_work_sync(struct work_struct *work)
 {
static const uint8_t states[WORK_ST_MAX] __aligned(8) = {
[WORK_ST_IDLE] = WORK_ST_IDLE,  /* NOP */
-   [WORK_ST_TIMER] = WORK_ST_IDLE, /* idle */
-   [WORK_ST_TASK] = WORK_ST_IDLE,  /* idle */
-   [WORK_ST_EXEC] = WORK_ST_IDLE,  /* idle */
-   [WORK_ST_CANCEL] = WORK_ST_IDLE,/* idle */
+   [WORK_ST_TIMER] = WORK_ST_TIMER,/* can't happen */
+   [WORK_ST_TASK] = WORK_ST_IDLE,  /* cancel and drain */
+   [WORK_ST_EXEC] = WORK_ST_IDLE,  /* too late, drain */
+   [WORK_ST_CANCEL] = WORK_ST_IDLE,/* cancel and drain */
};
struct taskqueue *tq;
 
@@ -302,7 +304,13 @@ linux_cancel_work_sync(struct work_struct *work)
 
switch (linux_update_state(&work->state, states)) {
case WORK_ST_IDLE:
+   case WORK_ST_TIMER:
return (0);
+   case WORK_ST_EXEC:
+   tq = work->work_queue->taskqueue;
+   if (taskqueue_cancel(tq, &work->work_task, NULL) != 0)
+   taskqueue_drain(tq, &work->work_task);
+   return (0);
default:
tq = work->work_queue->taskqueue;
if (taskqueue_cancel(tq, &work->work_task, NULL) != 0)
@@ -343,23 +351,29 @@ linux_cancel_delayed_work(struct delayed_work *dwork)
 {
static const uint8_t states[WORK_ST_MAX] __aligned(8) = {
[WORK_ST_IDLE] = WORK_ST_IDLE,  /* NOP */
-   [WORK_ST_TIMER] = WORK_ST_CANCEL,   /* cancel */
-   [WORK_ST_TASK] = WORK_ST_CANCEL,/* cancel */
-   [WORK_ST_EXEC] = WORK_ST_CANCEL,/* cancel */
-   [WORK_ST_CANCEL] = WORK_ST_CANCEL,  /* cancel */
+   [WORK_ST_TIMER] = WORK_ST_CANCEL,   /* try to cancel */
+   [WORK_ST_TASK] = WORK_ST_CANCEL,/* try to cancel */
+   [WORK_ST_EXEC] = WORK_ST_EXEC,  /* NOP */
+   [WORK_ST_CANCEL] = WORK_ST_CANCEL,  /* NOP */
};
struct taskqueue *tq;
 
switch (linux_update_state(&dwork->work.state, states)) {
case WORK_ST_TIMER:
- 

svn commit: r322271 - head/sbin/fsck_ffs

2017-08-08 Thread Ed Maste
Author: emaste
Date: Tue Aug  8 18:31:40 2017
New Revision: 322271
URL: https://svnweb.freebsd.org/changeset/base/322271

Log:
  Remove now-unused badsb declaration, missed in r322200
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/fsck_ffs/setup.c

Modified: head/sbin/fsck_ffs/setup.c
==
--- head/sbin/fsck_ffs/setup.c  Tue Aug  8 17:49:57 2017(r322270)
+++ head/sbin/fsck_ffs/setup.c  Tue Aug  8 18:31:40 2017(r322271)
@@ -58,8 +58,6 @@ struct bufarea asblk;
 #define altsblock (*asblk.b_un.b_fs)
 #define POWEROF2(num)  (((num) & ((num) - 1)) == 0)
 
-static void badsb(int listerr, const char *s);
-
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
___
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: r322270 - head/sys/dev/mly

2017-08-08 Thread John Baldwin
Author: jhb
Date: Tue Aug  8 17:49:57 2017
New Revision: 322270
URL: https://svnweb.freebsd.org/changeset/base/322270

Log:
  Fix a NULL pointer dereference in mly_user_command().
  
  If mly_user_command fails to allocate a command slot it jumps to an 'out'
  label used for error handling.  The error handling code checks for a data
  buffer in 'mc->mc_data' to free before checking if 'mc' is NULL.  Fix by
  just returning directly if we fail to allocate a command and only using
  the 'out' label for subsequent errors when there is actual cleanup to
  perform.
  
  PR:   217747
  Reported by:  PVS-Studio
  Reviewed by:  emaste
  MFC after:1 week

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

Modified: head/sys/dev/mly/mly.c
==
--- head/sys/dev/mly/mly.c  Tue Aug  8 17:26:19 2017(r322269)
+++ head/sys/dev/mly/mly.c  Tue Aug  8 17:49:57 2017(r322270)
@@ -2892,8 +2892,7 @@ mly_user_command(struct mly_softc *sc, struct mly_user
 MLY_LOCK(sc);
 if (mly_alloc_command(sc, &mc)) {
MLY_UNLOCK(sc);
-   error = ENOMEM;
-   goto out;   /* XXX Linux version will wait for a command */
+   return (ENOMEM);/* XXX Linux version will wait for a command */
 }
 MLY_UNLOCK(sc);
 
@@ -2952,11 +2951,9 @@ mly_user_command(struct mly_softc *sc, struct mly_user
  out:
 if (mc->mc_data != NULL)
free(mc->mc_data, M_DEVBUF);
-if (mc != NULL) {
-   MLY_LOCK(sc);
-   mly_release_command(mc);
-   MLY_UNLOCK(sc);
-}
+MLY_LOCK(sc);
+mly_release_command(mc);
+MLY_UNLOCK(sc);
 return(error);
 }
 
___
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: r322258 - head/sys/kern

2017-08-08 Thread Alan Somers
Author: asomers
Date: Tue Aug  8 16:14:31 2017
New Revision: 322258
URL: https://svnweb.freebsd.org/changeset/base/322258

Log:
  Make p1003_1b.aio_listio_max a tunable
  
  p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the
  sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX.
  Its value will be bounded from below by the compile-time constant
  AIO_LISTIO_MAX and from above by the compile-time constant
  MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue.
  
  Reviewed by:  jhb, kib
  MFC after:3 weeks
  Relnotes: yes
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D11601

Modified:
  head/sys/kern/posix4_mib.c
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/posix4_mib.c
==
--- head/sys/kern/posix4_mib.c  Tue Aug  8 16:06:16 2017(r322257)
+++ head/sys/kern/posix4_mib.c  Tue Aug  8 16:14:31 2017(r322258)
@@ -91,7 +91,6 @@ P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
 P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
 P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
 P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
-P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
 P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
 P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
 P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);

Modified: head/sys/kern/vfs_aio.c
==
--- head/sys/kern/vfs_aio.c Tue Aug  8 16:06:16 2017(r322257)
+++ head/sys/kern/vfs_aio.c Tue Aug  8 16:14:31 2017(r322258)
@@ -102,6 +102,7 @@ static uint64_t jobseqno;
 #endif
 
 FEATURE(aio, "Asynchronous I/O");
+SYSCTL_DECL(_p1003_1b);
 
 static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list");
 
@@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO;
 SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0,
 "Maximum buf aio requests per process (stored in the process)");
 
+static int aio_listio_max = AIO_LISTIO_MAX;
+SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max,
+CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0,
+"Maximum aio requests for a single lio_listio call");
+
 #ifdef COMPAT_FREEBSD6
 typedef struct oaiocb {
int aio_fildes; /* File descriptor */
@@ -388,6 +394,11 @@ static int
 aio_onceonly(void)
 {
 
+   if (aio_listio_max < AIO_LISTIO_MAX)
+   aio_listio_max = AIO_LISTIO_MAX;
+   if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count))
+   aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count);
+
exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
EVENTHANDLER_PRI_ANY);
exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec,
@@ -405,14 +416,13 @@ aio_onceonly(void)
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
-   aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL,
-   NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+   aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) ,
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL,
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiod_lifetime = AIOD_LIFETIME_DEFAULT;
jobrefid = 1;
p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO);
-   p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX);
p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE);
p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0);
 
@@ -1943,7 +1953,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_
struct aiocb **ujoblist;
int error;
 
-   if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX)
+   if (uap->nent < 0 || uap->nent > aio_listio_max)
return (EINVAL);
 
if (uap->timeout) {
@@ -2151,7 +2161,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai
if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT))
return (EINVAL);
 
-   if (nent < 0 || nent > AIO_LISTIO_MAX)
+   if (nent < 0 || nent > aio_listio_max)
return (EINVAL);
 
if (p->p_aioinfo == NULL)
@@ -2283,7 +2293,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6
return (EINVAL);
 
nent = uap->nent;
-   if (nent < 0 || nent > AIO_LISTIO_MAX)
+   if (nent < 0 || nent > aio_listio_max)
return (EINVAL);
 
if (uap->sig && (uap->mode == LIO_NOWAIT)) {
@@ -2320,7 +2330,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_a

svn commit: r322257 - head/sys/dev/nvme

2017-08-08 Thread Warner Losh
Author: imp
Date: Tue Aug  8 16:06:16 2017
New Revision: 322257
URL: https://svnweb.freebsd.org/changeset/base/322257

Log:
  Use the correct queue depth for nda devices.
  
  Submitted by: Matt Williams

Modified:
  head/sys/dev/nvme/nvme_sim.c

Modified: head/sys/dev/nvme/nvme_sim.c
==
--- head/sys/dev/nvme/nvme_sim.cTue Aug  8 15:46:29 2017
(r322256)
+++ head/sys/dev/nvme/nvme_sim.cTue Aug  8 16:06:16 2017
(r322257)
@@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr)
int unit;
struct nvme_sim_softc *sc = NULL;
 
-   max_trans = 256;/* XXX not so simple -- must match queues */
+   max_trans = ctrlr->num_io_queues;
unit = device_get_unit(ctrlr->dev);
devq = cam_simq_alloc(max_trans);
if (devq == 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"


Re: svn commit: r302474 - in head: cddl/lib/libdtrace tests/sys/netinet

2017-08-08 Thread Alan Somers
On Fri, Jul 8, 2016 at 5:44 PM, George V. Neville-Neil  wrote:
> Author: gnn
> Date: Fri Jul  8 23:44:09 2016
> New Revision: 302474
> URL: https://svnweb.freebsd.org/changeset/base/302474
>
> Log:
>   On FreeBSD there is a setsockopt option SO_USER_COOKIE which allows
>   setting a 32 bit value on each socket. This can be used by applications
>   and DTrace as a rendezvous point so that an applicaton's data can
>   more easily be captured at run time. Expose the user cookie via
>   DTrace by updating the translator in tcp.d and add a quick test
>   program, a TCP server, that sets the cookie on each connection
>   accepted.
>
>   Reviewed by:  hiren
>   MFC after:1 week
>   Sponsored by: Limelight Networks
>   Differential Revision:https://reviews.freebsd.org/D7152

I just noticed that the test program isn't hooked up to Kyua at all.
Nothing will ever run it.  Is there supposed to be a short atf-sh
script that invokes it?

-Alan
___
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: r322256 - head/sys/dev/hwpmc

2017-08-08 Thread Konstantin Belousov
Author: kib
Date: Tue Aug  8 15:46:29 2017
New Revision: 322256
URL: https://svnweb.freebsd.org/changeset/base/322256

Log:
  Fix logic error in the the assert, causing the condition to be always true.
  
  Also improve the formatting of the corresponding KASSERT message.
  
  Based on the submission by:   Svyatoslav 
  Found by: PVS-Studio
  PR:   217741
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation (kib)
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_piv.c

Modified: head/sys/dev/hwpmc/hwpmc_piv.c
==
--- head/sys/dev/hwpmc/hwpmc_piv.c  Tue Aug  8 15:37:21 2017
(r322255)
+++ head/sys/dev/hwpmc/hwpmc_piv.c  Tue Aug  8 15:46:29 2017
(r322256)
@@ -809,8 +809,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
mtx_lock_spin(&pc->pc_mtx);
cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri);
 
-   KASSERT(cfgflags >= 0 || cfgflags <= 3,
-   ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__,
+   KASSERT((cfgflags & ~0x3) == 0,
+   ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__,
cfgflags, cpu, ri));
 
KASSERT(cfgflags == 0 || phw->phw_pmc,
@@ -835,8 +835,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
phw->phw_pmc = NULL;
}
 
-   KASSERT(cfgflags >= 0 || cfgflags <= 3,
-   ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__,
+   KASSERT((cfgflags & ~0x3) == 0,
+   ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__,
cfgflags, cpu, ri));
 
P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags);
___
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: r322255 - head/tests/sys/netinet

2017-08-08 Thread Alan Somers
Author: asomers
Date: Tue Aug  8 15:37:21 2017
New Revision: 322255
URL: https://svnweb.freebsd.org/changeset/base/322255

Log:
  tests/sys/netinet/fibs_test: skip selected tests when firewalls are enabled
  
  Some tests send packets over epair(4) interfaces. Firewalls can cause
  spurious failures.
  
  Reviewed by:  ngie
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D11917

Modified:
  head/tests/sys/netinet/fibs_test.sh

Modified: head/tests/sys/netinet/fibs_test.sh
==
--- head/tests/sys/netinet/fibs_test.sh Tue Aug  8 13:44:32 2017
(r322254)
+++ head/tests/sys/netinet/fibs_test.sh Tue Aug  8 15:37:21 2017
(r322255)
@@ -766,6 +766,12 @@ get_epair()
 {
local EPAIRD
 
+   if  (which pfctl && pfctl -s info | grep -q 'Status: Enabled') || 
+   [ `sysctl -n net.inet.ip.fw.enable` = "1" ] ||
+   (which ipf && ipf -V); then
+   atf_skip "firewalls interfere with this test"
+   fi
+
if EPAIRD=`ifconfig epair create`; then
# Record the epair device so we can clean it up later
echo ${EPAIRD} >> "ifaces_to_cleanup"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322214 - in head/tests: etc/rc.d sys/acl sys/file sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys

2017-08-08 Thread Alan Somers
On Mon, Aug 7, 2017 at 10:59 PM, Ngie Cooper  wrote:
> Author: ngie
> Date: Tue Aug  8 04:59:16 2017
> New Revision: 322214
> URL: https://svnweb.freebsd.org/changeset/base/322214
>
> Log:
>   Make test scripts under tests/... non-executable
>
>   Executable bits should be set at install time instead of in the repo.
>   Setting executable bits on files triggers false positives with Phabricator.
>
>   MFC after:2 months

Thanks!  That was really annoying.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r322252 - head/usr.bin/vmstat

2017-08-08 Thread Emmanuel Vadot
On Tue, 8 Aug 2017 23:55:52 +1000 (EST)
Bruce Evans  wrote:

> On Tue, 8 Aug 2017, Emmanuel Vadot wrote:
> 
> > Log:
> >  vmstat: Always emit a space after the free-memory column
> >
> >  When displaying in non-human form, if the free-memory number
> >  is large (more than 7 digits), there is no space between it and
> >  the page fault column.
> >
> >  PR:221290
> >  Submitted by:  Josuah Demangeon  (Original version)
> >
> > Modified:
> >  head/usr.bin/vmstat/vmstat.c
> >
> > Modified: head/usr.bin/vmstat/vmstat.c
> > ==
> > --- head/usr.bin/vmstat/vmstat.cTue Aug  8 11:49:36 2017
> > (r322251)
> > +++ head/usr.bin/vmstat/vmstat.cTue Aug  8 12:18:11 2017
> > (r322252)
> > @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
> > xo_emit(" ");
> > xo_emit("{:free-memory/%7d}",
> > vmstat_pgtok(total.t_free));
> > +   xo_emit(" ");
> > }
> > xo_emit("{:total-page-faults/%5lu} ",
> > (unsigned long)rate(sum.v_vm_faults -
> 
> This seems to break the formatting.  There was a negative amount of space
> available for expansion, and since the header was not expanded to match
> its alignment with the fields is more random than before.  With -h, the
> width was 80 columns, giving ugly line wrap on 80-column terminals with
> auto-wrap.  Now it is 81 columns, giving uglier line wrap on all 80-
> column terminals.

 This break nothing, This was the case before too (with or without
-h), just tested in tmux with force-width 80.

> The bugs were mostly in the first line of the header:
> - the second line of the header was correct for vmstat -h
> - for vmstat without -h, the second line of the header was apparently broken
>by a change like the one here, that added a space after the "r b w" fields
>without adding one in the "r b w" header
> - most of the fields in the first line of the header are misaligned with the
>second lone.  Many have drifted 3 to the left of where the were in a sort
>of center-justified place.  Some of these might have actually been
>intended to be left justified, but had an off by +1 error.  Now these
>have an error of off by -2 relative to left justifications.
> 
> Only the "memory" header in the first line is better than in old versions.
> It is now left justified.  Left justifying all headers in the first line
> is probably best.  I couldn't find a good way to delimit the right hand
> side of the extents of the headers in the first line.  The second line of
> the headers already uses right justification consistently and this works
> well.
> 
> Bruce

 I think that all this might be true but you might talk about the whole
libxo conversion that was done, not my commit right ?

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


Re: svn commit: r322252 - head/usr.bin/vmstat

2017-08-08 Thread Bruce Evans

On Tue, 8 Aug 2017, Emmanuel Vadot wrote:


Log:
 vmstat: Always emit a space after the free-memory column

 When displaying in non-human form, if the free-memory number
 is large (more than 7 digits), there is no space between it and
 the page fault column.

 PR:221290
 Submitted by:  Josuah Demangeon  (Original version)

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

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cTue Aug  8 11:49:36 2017
(r322251)
+++ head/usr.bin/vmstat/vmstat.cTue Aug  8 12:18:11 2017
(r322252)
@@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
xo_emit(" ");
xo_emit("{:free-memory/%7d}",
vmstat_pgtok(total.t_free));
+   xo_emit(" ");
}
xo_emit("{:total-page-faults/%5lu} ",
(unsigned long)rate(sum.v_vm_faults -


This seems to break the formatting.  There was a negative amount of space
available for expansion, and since the header was not expanded to match
its alignment with the fields is more random than before.  With -h, the
width was 80 columns, giving ugly line wrap on 80-column terminals with
auto-wrap.  Now it is 81 columns, giving uglier line wrap on all 80-
column terminals.

The bugs were mostly in the first line of the header:
- the second line of the header was correct for vmstat -h
- for vmstat without -h, the second line of the header was apparently broken
  by a change like the one here, that added a space after the "r b w" fields
  without adding one in the "r b w" header
- most of the fields in the first line of the header are misaligned with the
  second lone.  Many have drifted 3 to the left of where the were in a sort
  of center-justified place.  Some of these might have actually been
  intended to be left justified, but had an off by +1 error.  Now these
  have an error of off by -2 relative to left justifications.

Only the "memory" header in the first line is better than in old versions.
It is now left justified.  Left justifying all headers in the first line
is probably best.  I couldn't find a good way to delimit the right hand
side of the extents of the headers in the first line.  The second line of
the headers already uses right justification consistently and this works
well.

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


svn commit: r322253 - head/sys/dev/cyapa

2017-08-08 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Aug  8 13:27:32 2017
New Revision: 322253
URL: https://svnweb.freebsd.org/changeset/base/322253

Log:
  Fix typo in cyapa out of bounds check.
  
  PR:   217783
  Submitted by: razmys...@viva64.com
  MFC after:1 week

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

Modified: head/sys/dev/cyapa/cyapa.c
==
--- head/sys/dev/cyapa/cyapa.c  Tue Aug  8 12:18:11 2017(r322252)
+++ head/sys/dev/cyapa/cyapa.c  Tue Aug  8 13:27:32 2017(r322253)
@@ -1455,7 +1455,7 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_r
sc->delta_x = sc->cap_resx;
if (sc->delta_x < -sc->cap_resx)
sc->delta_x = -sc->cap_resx;
-   if (sc->delta_y > sc->cap_resx)
+   if (sc->delta_y > sc->cap_resy)
sc->delta_y = sc->cap_resy;
if (sc->delta_y < -sc->cap_resy)
sc->delta_y = -sc->cap_resy;
___
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: r322252 - head/usr.bin/vmstat

2017-08-08 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug  8 12:18:11 2017
New Revision: 322252
URL: https://svnweb.freebsd.org/changeset/base/322252

Log:
  vmstat: Always emit a space after the free-memory column
  
  When displaying in non-human form, if the free-memory number
  is large (more than 7 digits), there is no space between it and
  the page fault column.
  
  PR:   221290
  Submitted by: Josuah Demangeon  (Original version)

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

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cTue Aug  8 11:49:36 2017
(r322251)
+++ head/usr.bin/vmstat/vmstat.cTue Aug  8 12:18:11 2017
(r322252)
@@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
xo_emit(" ");
xo_emit("{:free-memory/%7d}",
vmstat_pgtok(total.t_free));
+   xo_emit(" ");
}
xo_emit("{:total-page-faults/%5lu} ",
(unsigned long)rate(sum.v_vm_faults -
___
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: r322251 - head/sys/dev/mlx5/mlx5_en

2017-08-08 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug  8 11:49:36 2017
New Revision: 322251
URL: https://svnweb.freebsd.org/changeset/base/322251

Log:
  Make sure the received IP header gets 32-bit aligned for short packets
  in the mlx5en(4) driver.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Tue Aug  8 11:36:57 2017
(r322250)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Tue Aug  8 11:49:36 2017
(r322251)
@@ -355,9 +355,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget)
rq->stats.wqe_err++;
goto wq_ll_pop;
}
-
-   if (MHLEN >= byte_cnt &&
+   if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt &&
(mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) {
+   /* get IP header aligned */
+   mb->m_data += MLX5E_NET_IP_ALIGN;
+
bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t),
byte_cnt);
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322250 - head/sys/dev/mlx5/mlx5_en

2017-08-08 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug  8 11:36:57 2017
New Revision: 322250
URL: https://svnweb.freebsd.org/changeset/base/322250

Log:
  Count drop events due to lack of PCI bandwidth as queue drops and not as
  input errors in the mlx5en(4) driver. This improves the sysadmin view of
  physical port errors.
  
  Submitted by: gallatin@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cTue Aug  8 11:35:27 2017
(r322249)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cTue Aug  8 11:36:57 2017
(r322250)
@@ -552,7 +552,6 @@ mlx5e_update_stats_work(struct work_struct *work)
priv->stats.pport.alignment_err +
priv->stats.pport.check_seq_err +
priv->stats.pport.crc_align_errors +
-   priv->stats.pport.drop_events +
priv->stats.pport.in_range_len_errors +
priv->stats.pport.jabbers +
priv->stats.pport.out_of_range_len +
@@ -561,7 +560,8 @@ mlx5e_update_stats_work(struct work_struct *work)
priv->stats.pport.too_long_errors +
priv->stats.pport.undersize_pkts +
priv->stats.pport.unsupported_op_rx;
-   ifp->if_iqdrops = s->rx_out_of_buffer;
+   ifp->if_iqdrops = s->rx_out_of_buffer +
+   priv->stats.pport.drop_events;
ifp->if_opackets = s->tx_packets;
ifp->if_oerrors = s->tx_error_packets;
ifp->if_snd.ifq_drops = s->tx_queue_dropped;
@@ -2467,7 +2467,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
priv->stats.pport.alignment_err +
priv->stats.pport.check_seq_err +
priv->stats.pport.crc_align_errors +
-   priv->stats.pport.drop_events +
priv->stats.pport.in_range_len_errors +
priv->stats.pport.jabbers +
priv->stats.pport.out_of_range_len +
@@ -2478,7 +2477,8 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
priv->stats.pport.unsupported_op_rx;
break;
case IFCOUNTER_IQDROPS:
-   retval = priv->stats.vport.rx_out_of_buffer;
+   retval = priv->stats.vport.rx_out_of_buffer +
+   priv->stats.pport.drop_events;
break;
case IFCOUNTER_OPACKETS:
retval = priv->stats.vport.tx_packets;
___
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: r322248 - in head/sys/dev/mlx4: . mlx4_en

2017-08-08 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug  8 11:35:02 2017
New Revision: 322248
URL: https://svnweb.freebsd.org/changeset/base/322248

Log:
  Fix for mlx4en(4) to properly call m_defrag().
  
  The m_defrag() function can only defrag mbuf chains which have a valid
  mbuf packet header. In r291699 when the mlx4en(4) driver was converted
  into using BUSDMA(9), the call to m_defrag() was moved after the part
  of the transmit routine which strips the header from the mbuf chain.
  This effectivly disabled the mbuf defrag mechanism and such packets
  simply got dropped.
  
  This patch removes the stripping of mbufs from a chain and loads all
  mbufs using busdma. If busdma finds there are no segments, unload
  the DMA map and free the mbuf right away, because that means all
  data in the mbuf has been inlined in the TX ring. Else proceed
  as usual.
  
  Add a per-ring rounter for the number of defrag attempts and
  make sure the oversized_packets counter gets zeroed while at it.
  
  The counters are per-ring to avoid excessive cache misses in the
  TX path.
  
  Submitted by: mjoras@
  Differential Revision:https://reviews.freebsd.org/D11683
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/en.h
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
  head/sys/dev/mlx4/stats.h

Modified: head/sys/dev/mlx4/mlx4_en/en.h
==
--- head/sys/dev/mlx4/mlx4_en/en.h  Tue Aug  8 11:28:38 2017
(r322247)
+++ head/sys/dev/mlx4/mlx4_en/en.h  Tue Aug  8 11:35:02 2017
(r322248)
@@ -278,6 +278,8 @@ struct mlx4_en_tx_ring {
unsigned long queue_stopped;
unsigned long oversized_packets;
unsigned long wake_queue;
+   unsigned long tso_packets;
+   unsigned long defrag_attempts;
struct mlx4_bf bf;
bool bf_enabled;
int hwtstamp_tx_type;

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Tue Aug  8 11:28:38 2017
(r322247)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c  Tue Aug  8 11:35:02 2017
(r322248)
@@ -2681,6 +2681,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload",
CTLFLAG_RD, &priv->port_stats.tx_chksum_offload,
"TX checksum offloads");
+   SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", 
CTLFLAG_RD,
+   &priv->port_stats.defrag_attempts, "Oversized chains defragged");
 
/* Could strdup the names and add in a loop.  This is simpler. */
SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD,
@@ -2774,6 +2776,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
CTLFLAG_RD, &tx_ring->packets, "TX packets");
SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes",
CTLFLAG_RD, &tx_ring->bytes, "TX bytes");
+   SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets",
+   CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets");
+   SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts",
+   CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains 
defragged");
}
 
for (i = 0; i < priv->rx_ring_num; i++) {

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cTue Aug  8 11:28:38 2017
(r322247)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cTue Aug  8 11:35:02 2017
(r322248)
@@ -191,11 +191,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u
priv->port_stats.tx_chksum_offload = 0;
priv->port_stats.queue_stopped = 0;
priv->port_stats.wake_queue = 0;
+   priv->port_stats.oversized_packets = 0;
+   priv->port_stats.tso_packets = 0;
+   priv->port_stats.defrag_attempts = 0;
for (i = 0; i < priv->tx_ring_num; i++) {
priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum;
priv->port_stats.queue_stopped += 
priv->tx_ring[i]->queue_stopped;
priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue;
priv->port_stats.oversized_packets += 
priv->tx_ring[i]->oversized_packets;
+   priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets;
+   priv->port_stats.defrag_attempts += 
priv->tx_ring[i]->defrag_attempts;
}
/* RX Statistics */
priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) +

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
==

svn commit: r322247 - head/sys/cddl/contrib/opensolaris

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:28:38 2017
New Revision: 322247
URL: https://svnweb.freebsd.org/changeset/base/322247

Log:
  MFV r322246: 8508 Mounting a zpool on 32-bit platforms panics
  
  FreeBSD note: this is a record-only commit, the actual change originated
  from FreeBSD.
  
  illumos/illumos-gate@b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
  
https://github.com/illumos/illumos-gate/commit/b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
  
  https://www.illumos.org/issues/8508
Mounting a zpool on a 32-bit system triggers a panic in 
spa_history_log_version
() due to a type format mismatch for ZPL_VERSION. ZPL_VERSION is a unsigned
long long, but the format expects an integer. On 64-bit platforms this may 
not
be an issue due to word size and alignment. On 32-bit platforms a word size 
is
half that of a long long, causing the second word of the long long to be 
seen
as the string pointer for utsname.nodename.
  
  Reviewed by: Matt Ahrens 
  Approved by: Dan McDonald 
  Author: Justin Hibbits 

Modified:
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)
___
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: r322245 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:26:03 2017
New Revision: 322245
URL: https://svnweb.freebsd.org/changeset/base/322245

Log:
  MFV r322242: 8373 TXG_WAIT in ZIL commit path
  
  illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7
  
https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7
  
  https://www.illumos.org/issues/8373
The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign
a transaction to a transaction group.  That seems to be logically
incorrect as writing of the ZIL block does not introduce any new dirty
data.  Also, when there is a lot of dirty data, the call can introduce
significant delays into the ZIL commit path, thus affecting all
synchronous writes. Additionally, ARC throttling may affect the ZIL
writing.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Approved by: Dan McDonald 
  Author: Andriy Gapon 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Tue Aug  8 
11:25:09 2017(r322244)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Tue Aug  8 
11:26:03 2017(r322245)
@@ -985,7 +985,24 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea
 * to clean up in the event of allocation failure or I/O failure.
 */
tx = dmu_tx_create(zilog->zl_os);
-   VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0);
+
+   /*
+* Since we are not going to create any new dirty data and we can even
+* help with clearing the existing dirty data, we should not be subject
+* to the dirty data based delays.
+* We (ab)use TXG_WAITED to bypass the delay mechanism.
+* One side effect from using TXG_WAITED is that dmu_tx_assign() can
+* fail if the pool is suspended.  Those are dramatic circumstances,
+* so we return NULL to signal that the normal ZIL processing is not
+* possible and txg_wait_synced() should be used to ensure that the data
+* is on disk.
+*/
+   error = dmu_tx_assign(tx, TXG_WAITED);
+   if (error != 0) {
+   ASSERT3S(error, ==, EIO);
+   dmu_tx_abort(tx);
+   return (NULL);
+   }
dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
txg = dmu_tx_get_txg(tx);
 
___
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: r322241 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:21:58 2017
New Revision: 322241
URL: https://svnweb.freebsd.org/changeset/base/322241

Log:
  MFV r322240: 8491 uberblock on-disk padding to reserve space for smoothly 
merging zpool checkpoint & MMP in ZFS
  
  illumos/illumos-gate@79c2b812ee2010ebf20fdd92dc5f06b59000a94c
  
https://github.com/illumos/illumos-gate/commit/79c2b812ee2010ebf20fdd92dc5f06b59000a94c
  
  https://www.illumos.org/issues/8491
The zpool checkpoint feature in DxOS added a new field in the uberblock.
The Multi-Modifier Protection Pull Request from ZoL adds two new fields in 
the
uberblock (Reference: https://github.com/zfsonlinux/zfs/pull/6279).
As these two changes come from two different sources and once upstreamed and
deployed will introduce an incompatibility with each other we want
to upstream a change that will reserve the padding for both of them so
integration goes smoothly and everyone gets both features.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Brian Behlendorf 
  Reviewed by: Olaf Faaland 
  Approved by: Gordon Ross 
  Author: Serapheim Dimitropoulos 
  
  MFC after:3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: 
head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
Tue Aug  8 11:19:56 2017(r322240)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
Tue Aug  8 11:21:58 2017(r322241)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017 by Delphix. All rights reserved.
  */
 
 #ifndef _SYS_UBERBLOCK_IMPL_H
@@ -54,6 +55,12 @@ struct uberblock {
 
/* highest SPA_VERSION supported by software that wrote this txg */
uint64_tub_software_version;
+
+   /* These fields are reserved for features that are under development: */
+   uint64_tub_mmp_magic;
+   uint64_tub_mmp_delay;
+   uint64_tub_mmp_seq;
+   uint64_tub_checkpoint_txg;
 };
 
 #ifdef __cplusplus
___
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: r322239 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:19:14 2017
New Revision: 322239
URL: https://svnweb.freebsd.org/changeset/base/322239

Log:
  MFV r322238: 7915 checks in l2arc_evict could use some cleaning up
  
  illumos/illumos-gate@267ae6c3a88d2fc39276af66caafa978b0935b82
  
https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82
  
  https://www.illumos.org/issues/7915
l2arc_evict() is strictly serialized with respect to
l2arc_write_buffers() and l2arc_write_done().  Normally, l2arc_evict()
and l2arc_write_buffers() are called from the same thread, so they can
not be concurrent.  Also, l2arc_write_buffers() uses zio_wait() on the
parent zio of all cache zio-s.  That ensures that l2arc_write_done()
is completed before l2arc_write_buffers() returns.  Finally, if a
cache device is removed, then l2arc_evict() is called under SCL_ALL in
the exclusive mode.  That ensures that it can not be concurrent with
the normal L2ARC accesses to the device (including writing and
evicting buffers).  Given the above, some checks and actions in
l2arc_evict() do not make sense.  For instance, it must never
encounter the write head header let alone remove it from the buffer
list.
  
  Reviewed by: Dan Kimmel 
  Reviewed by: Prakash Surya 
  Approved by: Matthew Ahrens 
  Author: Andriy Gapon 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Aug  8 
11:15:36 2017(r322238)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Aug  8 
11:19:14 2017(r322239)
@@ -7284,18 +7284,16 @@ top:
goto top;
}
 
-   if (HDR_L2_WRITE_HEAD(hdr)) {
-   /*
-* We hit a write head node.  Leave it for
-* l2arc_write_done().
-*/
-   list_remove(buflist, hdr);
-   mutex_exit(hash_lock);
-   continue;
-   }
+   /*
+* A header can't be on this list if it doesn't have L2 header.
+*/
+   ASSERT(HDR_HAS_L2HDR(hdr));
 
-   if (!all && HDR_HAS_L2HDR(hdr) &&
-   (hdr->b_l2hdr.b_daddr >= taddr ||
+   /* Ensure this header has finished being written. */
+   ASSERT(!HDR_L2_WRITING(hdr));
+   ASSERT(!HDR_L2_WRITE_HEAD(hdr));
+
+   if (!all && (hdr->b_l2hdr.b_daddr >= taddr ||
hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
/*
 * We've evicted to the target address,
@@ -7305,7 +7303,6 @@ top:
break;
}
 
-   ASSERT(HDR_HAS_L2HDR(hdr));
if (!HDR_HAS_L1HDR(hdr)) {
ASSERT(!HDR_L2_READING(hdr));
/*
@@ -7327,9 +7324,6 @@ top:
ARCSTAT_BUMP(arcstat_l2_evict_reading);
arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED);
}
-
-   /* Ensure this header has finished being written */
-   ASSERT(!HDR_L2_WRITING(hdr));
 
arc_hdr_l2hdr_destroy(hdr);
}
___
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: r322237 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:14:40 2017
New Revision: 322237
URL: https://svnweb.freebsd.org/changeset/base/322237

Log:
  MFV r322236: 8126 ztest assertion failed in dbuf_dirty due to dn_nlevels 
changing
  
  illumos/illumos-gate@dcb6872c565819ac88acbc2ece999ef241c8b982
  
https://github.com/illumos/illumos-gate/commit/dcb6872c565819ac88acbc2ece999ef241c8b982
  
  https://www.illumos.org/issues/8126
The sync thread is concurrently modifying dn_phys->dn_nlevels
while dbuf_dirty() is trying to assert something about it, without
holding the necessary lock. We need to move this assertion further down
in the function, after we have acquired the dn_struct_rwlock.
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Serapheim Dimitropoulos 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Tue Aug  8 
11:13:27 2017(r322236)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Tue Aug  8 
11:14:40 2017(r322237)
@@ -1542,11 +1542,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
(dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN));
 
ASSERT3U(dn->dn_nlevels, >, db->db_level);
-   ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
-   dn->dn_phys->dn_nlevels > db->db_level ||
-   dn->dn_next_nlevels[txgoff] > db->db_level ||
-   dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
-   dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
 
/*
 * We should only be dirtying in syncing context if it's the
@@ -1662,6 +1657,16 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
rw_enter(&dn->dn_struct_rwlock, RW_READER);
drop_struct_lock = TRUE;
}
+
+   /*
+* We need to hold the dn_struct_rwlock to make this assertion,
+* because it protects dn_phys / dn_next_nlevels from changing.
+*/
+   ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
+   dn->dn_phys->dn_nlevels > db->db_level ||
+   dn->dn_next_nlevels[txgoff] > db->db_level ||
+   dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
+   dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
 
/*
 * If we are overwriting a dedup BP, then unless it is snapshotted,
___
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: r322234 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 11:07:34 2017
New Revision: 322234
URL: https://svnweb.freebsd.org/changeset/base/322234

Log:
  zfs: no need for __DECONST after abd constification in r322233
  
  Note that vdev_label_write_pad2() is FreeBSD specific.
  
  MFC after:2 weeks
  X-MFC after:  r322233

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cTue Aug 
 8 10:59:18 2017(r322233)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cTue Aug 
 8 11:07:34 2017(r322234)
@@ -899,7 +899,7 @@ vdev_label_write_pad2(vdev_t *vd, const char *buf, siz
 
pad2 = abd_alloc_for_io(VDEV_PAD_SIZE, B_TRUE);
abd_zero(pad2, VDEV_PAD_SIZE);
-   abd_copy_from_buf(pad2, __DECONST(void *, buf), size);
+   abd_copy_from_buf(pad2, buf, size);
 
 retry:
zio = zio_root(spa, NULL, NULL, flags);
___
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: r322233 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:59:18 2017
New Revision: 322233
URL: https://svnweb.freebsd.org/changeset/base/322233

Log:
  MFV r322232: 8426 mark immutable buffer arguments as such in abd.h
  
  illumos/illumos-gate@9b195260e22529ac0e2580faaf89402420589c1c
  
https://github.com/illumos/illumos-gate/commit/9b195260e22529ac0e2580faaf89402420589c1c
  
  https://www.illumos.org/issues/8426
abd_copy_from_buf and abd_cmp_buf do not modify their void *buf arguments, 
so
qualify them with const.
abd_copy_from_buf_off and abd_cmp_buf_off already had that type for the
corresponding arguments.
  
  Reviewed by: Matt Ahrens 
  Approved by: Robert Mustacchi 
  Author: Andriy Gapon 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h   Tue Aug 
 8 10:58:01 2017(r322232)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h   Tue Aug 
 8 10:59:18 2017(r322233)
@@ -117,7 +117,7 @@ abd_copy(abd_t *dabd, abd_t *sabd, size_t size)
 }
 
 inline void
-abd_copy_from_buf(abd_t *abd, void *buf, size_t size)
+abd_copy_from_buf(abd_t *abd, const void *buf, size_t size)
 {
abd_copy_from_buf_off(abd, buf, 0, size);
 }
@@ -129,7 +129,7 @@ abd_copy_to_buf(void* buf, abd_t *abd, size_t size)
 }
 
 inline int
-abd_cmp_buf(abd_t *abd, void *buf, size_t size)
+abd_cmp_buf(abd_t *abd, const void *buf, size_t size)
 {
return (abd_cmp_buf_off(abd, buf, 0, size));
 }
___
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: r322230 - in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris...

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:52:01 2017
New Revision: 322230
URL: https://svnweb.freebsd.org/changeset/base/322230

Log:
  MFV r39: 7600 zfs rollback should pass target snapshot to kernel
  
  illumos/illumos-gate@77b171372ed21642e04c873ef1e87fe2365520df
  
https://github.com/illumos/illumos-gate/commit/77b171372ed21642e04c873ef1e87fe2365520df
  
  https://www.illumos.org/issues/7600
At present, the kernel side code seems to blindly rollback to whatever 
happens
to be the latest snapshot at the time when the rollback task is processed.
The expected target's name should be passed to the kernel driver and the 
sync
task should validate that the target exists and that it is the latest 
snapshot
indeed.
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Pavel Zakharov 
  Approved by: Robert Mustacchi 
  Author: Andriy Gapon 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Aug 
 8 10:49:56 2017(r39)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Aug 
 8 10:52:01 2017(r322230)
@@ -3957,14 +3957,19 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo
}
 
/*
-* We rely on zfs_iter_children() to verify that there are no
-* newer snapshots for the given dataset.  Therefore, we can
-* simply pass the name on to the ioctl() call.  There is still
-* an unlikely race condition where the user has taken a
-* snapshot since we verified that this was the most recent.
+* Pass both the filesystem and the wanted snapshot names,
+* we would get an error back if the snapshot is destroyed or
+* a new snapshot is created before this request is processed.
 */
-   err = lzc_rollback(zhp->zfs_name, NULL, 0);
-   if (err != 0) {
+   err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name);
+   if (err == EXDEV) {
+   zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
+   "'%s' is not the latest snapshot"), snap->zfs_name);
+   (void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY,
+   dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
+   zhp->zfs_name);
+   return (err);
+   } else if (err != 0) {
(void) zfs_standard_error_fmt(zhp->zfs_hdl, errno,
dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
zhp->zfs_name);

Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c  Tue Aug 
 8 10:49:56 2017(r39)
+++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c  Tue Aug 
 8 10:52:01 2017(r322230)
@@ -765,6 +765,9 @@ lzc_receive_with_header(const char *snapname, nvlist_t
  * Roll back this filesystem or volume to its most recent snapshot.
  * If snapnamebuf is not NULL, it will be filled in with the name
  * of the most recent snapshot.
+ * Note that the latest snapshot may change if a new one is concurrently
+ * created or the current one is destroyed.  lzc_rollback_to can be used
+ * to roll back to a specific latest snapshot.
  *
  * Return 0 on success or an errno on failure.
  */
@@ -784,6 +787,27 @@ lzc_rollback(const char *fsname, char *snapnamebuf, in
}
nvlist_free(result);
 
+   return (err);
+}
+
+/*
+ * Roll back this filesystem or volume to the specified snapshot,
+ * if possible.
+ *
+ * Return 0 on success or an errno on failure.
+ */
+int
+lzc_rollback_to(const char *fsname, const char *snapname)
+{
+   nvlist_t *args;
+   nvlist_t *result;
+   int err;
+
+   args = fnvlist_alloc();
+   fnvlist_add_string(args, "target", snapname);
+   err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result);
+   nvlist_free(args);
+   nvlist_free(result);
return (err);
 }
 

Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
==
--- head/cddl/contrib/opensolaris/lib/libzfs_cor

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

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:48:52 2017
New Revision: 38
URL: https://svnweb.freebsd.org/changeset/base/38

Log:
  MFV r37: 8377 Panic in bookmark deletion
  
  illumos/illumos-gate@42418f9e73f0d007aa87675ecc206c26fc8e073e
  
https://github.com/illumos/illumos-gate/commit/42418f9e73f0d007aa87675ecc206c26fc8e073e
  
  https://www.illumos.org/issues/8377
The problem is that when dsl_bookmark_destroy_check() is executed from open
context (the pre-check), it fills in dbda_success based on the existence of 
the
bookmark.
But the bookmark (or containing filesystem as in this case) can be destroyed
before we get to syncing context. When we re-run 
dsl_bookmark_destroy_check()
in syncing
context, it will not add the deleted bookmark to dbda_success, intending for
dsl_bookmark_destroy_sync() to not process it. But because the bookmark is
still in dbda_success
from the open-context call, we do try to destroy it.
The fix is that dsl_bookmark_destroy_check() should not modify dbda_success
when called from open context.
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c  Tue Aug 
 8 10:47:56 2017(r37)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c  Tue Aug 
 8 10:48:52 2017(r38)
@@ -354,6 +354,9 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
dsl_pool_t *dp = dmu_tx_pool(tx);
int rv = 0;
 
+   ASSERT(nvlist_empty(dbda->dbda_success));
+   ASSERT(nvlist_empty(dbda->dbda_errors));
+
if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS))
return (0);
 
@@ -383,7 +386,10 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
}
}
if (error == 0) {
-   fnvlist_add_boolean(dbda->dbda_success, fullname);
+   if (dmu_tx_is_syncing(tx)) {
+   fnvlist_add_boolean(dbda->dbda_success,
+   fullname);
+   }
} else {
fnvlist_add_int32(dbda->dbda_errors, fullname, error);
rv = error;
___
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: r322226 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:46:51 2017
New Revision: 36
URL: https://svnweb.freebsd.org/changeset/base/36

Log:
  MFV r33: 8378 crash due to bp in-memory modification of nopwrite block
  
  illumos/illumos-gate@b7edcb940884114e61382937505433c4c38c0278
  
https://github.com/illumos/illumos-gate/commit/b7edcb940884114e61382937505433c4c38c0278
  
  https://www.illumos.org/issues/8378
The problem is that zfs_get_data() supplies a stale zgd_bp to dmu_sync(), 
which
we then nopwrite against.
zfs_get_data() doesn't hold any DMU-related locks, so after it copies 
db_blkptr
to zgd_bp, dbuf_write_ready()
could change db_blkptr, and dbuf_write_done() could remove the dirty record.
dmu_sync() then sees the stale
BP and that the dbuf it not dirty, so it is eligible for nop-writing.
The fix is for dmu_sync() to copy db_blkptr to zgd_bp after acquiring the
db_mtx. We could still see a stale
db_blkptr, but if it is stale then the dirty record will still exist and 
thus
we won't attempt to nopwrite.
  
  Reviewed by: Prakash Surya 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 
  
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Aug  8 10:45:22 
2017(r35)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Tue Aug  8 10:46:51 
2017(r36)
@@ -1838,7 +1838,6 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
uint64_t object = lr->lr_foid;
uint64_t offset = lr->lr_offset;
uint64_t size = lr->lr_length;
-   blkptr_t *bp = &lr->lr_blkptr;
uint64_t txg = lr->lr_common.lrc_txg;
uint64_t crtxg;
dmu_object_info_t doi;
@@ -1892,11 +1891,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
DMU_READ_NO_PREFETCH);
 
if (error == 0) {
-   blkptr_t *obp = dmu_buf_get_blkptr(db);
-   if (obp) {
-   ASSERT(BP_IS_HOLE(bp));
-   *bp = *obp;
-   }
+   blkptr_t *bp = &lr->lr_blkptr;
 
zgd->zgd_db = db;
zgd->zgd_bp = bp;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Tue Aug  8 
10:45:22 2017(r35)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Tue Aug  8 
10:46:51 2017(r36)
@@ -1657,6 +1657,7 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
uint8_t chksum = BP_GET_CHECKSUM(bp_orig);
 
ASSERT(BP_EQUAL(bp, bp_orig));
+   VERIFY(BP_EQUAL(bp, db->db_blkptr));
ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF);
ASSERT(zio_checksum_table[chksum].ci_flags &
ZCHECKSUM_FLAG_NOPWRITE);
@@ -1697,19 +1698,11 @@ dmu_sync_late_arrival_done(zio_t *zio)
blkptr_t *bp_orig = &zio->io_bp_orig;
 
if (zio->io_error == 0 && !BP_IS_HOLE(bp)) {
-   /*
-* If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE)
-* then there is nothing to do here. Otherwise, free the
-* newly allocated block in this txg.
-*/
-   if (zio->io_flags & ZIO_FLAG_NOPWRITE) {
-   ASSERT(BP_EQUAL(bp, bp_orig));
-   } else {
-   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
-   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
-   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
-   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
-   }
+   ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
+   ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
+   ASSERT(zio->io_bp->blk_birth == zio->io_txg);
+   ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
+   zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
}
 
dmu_tx_commit(dsa->dsa_tx);
@@ -1741,6 +1734,29 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy
dsa->dsa_zgd = zgd;
dsa->dsa_tx = tx;
 
+   /*
+* Since 

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

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:43:41 2017
New Revision: 32
URL: https://svnweb.freebsd.org/changeset/base/32

Log:
  MFV r31: 7910 l2arc_write_buffers() may write beyond target_sz
  
  FreeBD note: the essence of this change was committed to FreeBSD in
  r314274.  This commit catches up with differences between what was
  committed to FreeBSD and what was committed to OpenZFS, mainly more
  logical variable names.
  
  illumos/illumos-gate@16a7e5ac116c85d965007a5f201104b564e82210
  
https://github.com/illumos/illumos-gate/commit/16a7e5ac116c85d965007a5f201104b564e82210
  
  https://www.illumos.org/issues/7910
It seems that the change in issue #6950 resurrected the problem that was
earlier fixed by the change in issue #5219.
Please also see the following FreeBSD bug report:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216178
  
  Reviewed by: George Wilson 
  Reviewed by: Dan Kimmel 
  Approved by: Robert Mustacchi 
  Author: Andriy Gapon 
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Aug  8 
10:37:03 2017(r31)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Tue Aug  8 
10:43:41 2017(r32)
@@ -712,8 +712,8 @@ typedef struct arc_stats {
kstat_named_t arcstat_l2_abort_lowmem;
kstat_named_t arcstat_l2_cksum_bad;
kstat_named_t arcstat_l2_io_error;
-   kstat_named_t arcstat_l2_size;
-   kstat_named_t arcstat_l2_asize;
+   kstat_named_t arcstat_l2_lsize;
+   kstat_named_t arcstat_l2_psize;
kstat_named_t arcstat_l2_hdr_size;
kstat_named_t arcstat_l2_write_trylock_fail;
kstat_named_t arcstat_l2_write_passed_headroom;
@@ -3338,19 +3338,19 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr)
 {
l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr;
l2arc_dev_t *dev = l2hdr->b_dev;
-   uint64_t asize = arc_hdr_size(hdr);
+   uint64_t psize = arc_hdr_size(hdr);
 
ASSERT(MUTEX_HELD(&dev->l2ad_mtx));
ASSERT(HDR_HAS_L2HDR(hdr));
 
list_remove(&dev->l2ad_buflist, hdr);
 
-   ARCSTAT_INCR(arcstat_l2_asize, -asize);
-   ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
+   ARCSTAT_INCR(arcstat_l2_psize, -psize);
+   ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
 
-   vdev_space_update(dev->l2ad_vdev, -asize, 0, 0);
+   vdev_space_update(dev->l2ad_vdev, -psize, 0, 0);
 
-   (void) refcount_remove_many(&dev->l2ad_alloc, asize, hdr);
+   (void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr);
arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
 }
 
@@ -7051,8 +7051,8 @@ top:
l2arc_trim(hdr);
arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
 
-   ARCSTAT_INCR(arcstat_l2_asize, -arc_hdr_size(hdr));
-   ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
+   ARCSTAT_INCR(arcstat_l2_psize, -arc_hdr_size(hdr));
+   ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
 
bytes_dropped += arc_hdr_size(hdr);
(void) refcount_remove_many(&dev->l2ad_alloc,
@@ -7311,7 +7311,7 @@ top:
/*
 * This doesn't exist in the ARC.  Destroy.
 * arc_hdr_destroy() will call list_remove()
-* and decrement arcstat_l2_size.
+* and decrement arcstat_l2_lsize.
 */
arc_change_state(arc_anon, hdr, hash_lock);
arc_hdr_destroy(hdr);
@@ -7353,7 +7353,7 @@ static uint64_t
 l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
 {
arc_buf_hdr_t *hdr, *hdr_prev, *head;
-   uint64_t write_asize, write_psize, write_sz, headroom;
+   uint64_t write_asize, write_psize, write_lsize, headroom;
boolean_t full;
l2arc_write_callback_t *cb;
zio_t *pio, *wzio;
@@ -7363,7 +7363,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
ASSERT3P(dev->l2ad_vdev, !=, NULL);
 
pio = NULL;
-   write_sz = write_asize = write_psize = 0;
+   write_lsize = write_asize = write_psize = 0;
full = B_FALSE;
head = kmem_cache_alloc(hdr_l2only_cache, KM_PUSHPAGE);
arc_hdr_set_flags(head, ARC_FLAG_L2_WRITE_HEAD | ARC_FLAG_HAS_L2HDR);
@@ -7440,11 +7440,11 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
ASSERT3U(arc_hdr_size(hdr), >, 0);
-

svn commit: r322220 - head/sys/cddl/contrib/opensolaris

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:36:07 2017
New Revision: 30
URL: https://svnweb.freebsd.org/changeset/base/30

Log:
  MFV r322219: 8416 abd.h is not C++ friendly
  
  FreeBSD note: this is a record-only commit, we had to apply the change
  in r320156.
  
  illumos/illumos-gate@5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
  
https://github.com/illumos/illumos-gate/commit/5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
  
  https://www.illumos.org/issues/8416
A C++ compiler fails to compile abd_is_linear(), which is an inline function
defined in abd.h, with the following error:
 error: cannot initialize return object of type 'boolean_t' with an
 rvalue of type 'bool'
That happens because a bool can not be converted to an enum in C++.
That's a problem because abd.h can be visible through other header files 
that a
C++ program that works with ZFS can include.
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Dan Kimmel 
  Reviewed by: Alek Pinchuk 
  Approved by: Robert Mustacchi 
  Author: Andriy Gapon 

Modified:
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)
___
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: r322218 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  8 10:30:49 2017
New Revision: 322218
URL: https://svnweb.freebsd.org/changeset/base/322218

Log:
  MFV r322217: 8418 zfs_prop_get_table() call in zfs_validate_name() is a no-op
  
  illumos/illumos-gate@e09ba01dcda5e24964b8632718777b39166d86e4
  
https://github.com/illumos/illumos-gate/commit/e09ba01dcda5e24964b8632718777b39166d86e4
  
  https://www.illumos.org/issues/8418
The following line in zfs_validate_name() is just a no-op and it
should be removed:
108(void) zfs_prop_get_table();
  
  Reviewed by: Vitaliy Gusev 
  Approved by: Matthew Ahrens 
  Author: Marcel Telka 
  
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Aug 
 8 10:28:01 2017(r322217)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cTue Aug 
 8 10:30:49 2017(r322218)
@@ -103,7 +103,6 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa
namecheck_err_t why;
char what;
 
-   (void) zfs_prop_get_table();
if (entity_namecheck(path, &why, &what) != 0) {
if (hdl != NULL) {
switch (why) {
___
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"