Re: svn commit: r320156 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contr

2017-06-21 Thread O. Hartmann
Am Tue, 20 Jun 2017 17:25:53 -0400
"Kenneth D. Merry"  schrieb:

> On Tue, Jun 20, 2017 at 23:37:10 +0300, Andriy Gapon wrote:
> > On 20/06/2017 23:29, Ken Merry wrote:  
> > > I don???t know for sure that this commit is the cause, but it (and 
> > > r320153) are the
> > > only ZFS commits between a version of head from June 14th that boots off 
> > > a ZFS
> > > mirror, and one that panics.

r320153 is running well here and stable, but with r320156, my kernel(s) on all 
ZFS
machines panic immediately (they have ZFS built in into the kernel, not a 
module).

This moment, I went back to r320153. I'm sorry for not having debugging 
informations, the
boxes are w/o debugging options this moment.

> > > 
> > > Here???s the stack trace:
> > > 
> > > Fatal trap 12: page fault while in kernel mode
> > > cpuid = 22; 
> > > 
> > > Fatal trap 12: page fault while in kernel mode
> > > cpuid = 9; apic id = 09
> > > fault virtual address   = 0x0
> > > fault code  = supervisor read data, page not present
> > > instruction pointer = 0x20:0x81e47f21
> > > stack pointer   = 0x28:0xfe08b37f8810
> > > frame pointer   = 0x28:0xfe08b37f8860
> > > code segment= base 0x0, limit 0xf, type 0x1b
> > > = DPL 0, pres 1, long 1, def32 0, gran 1
> > > processor eflags= interrupt enabled, resume, IOPL = 0
> > > current process = 0 (zio_free_issue_0_3)
> > > [ thread pid 0 tid 100478 ]
> > > Stopped at  0x81e47f21 = zio_vdev_io_start+0x1f1:   testb
> > > $0x1,(%rax)  
> > > db> bt  
> > > Tracing pid 0 tid 100478 td 0xf80193156000
> > > zio_vdev_io_start() at 0x81e47f21 = zio_vdev_io_start+0x1f1/frame
> > > 0xfe08b37f8860 zio_execute() at 0x81e4312c = 
> > > zio_execute+0x36c/frame
> > > 0xfe08b37f88b0 zio_nowait() at 0x81e422b8 = 
> > > zio_nowait+0xb8/frame
> > > 0xfe08b37f88e0 vdev_mirror_io_start() at 0x81e224fc =
> > > vdev_mirror_io_start+0x38c/frame 0xfe08b37f8930 zio_vdev_io_start() at
> > > 0x81e48030 = zio_vdev_io_start+0x300/frame 0xfe08b37f8990 
> > > zio_execute()
> > > at 0x81e4312c = zio_execute+0x36c/frame 0xfe08b37f89e0
> > > taskqueue_run_locked() at 0x809a9d6d = 
> > > taskqueue_run_locked+0x13d/frame
> > > 0xfe08b37f8a40 taskqueue_thread_loop() at 0x809aab28 =
> > > taskqueue_thread_loop+0x88/frame 0xfe08b37f8a70 fork_exit() at
> > > 0x8091e3e4 = fork_exit+0x84/frame 0xfe08b37f8ab0 
> > > fork_trampoline() at
> > > 0x80d930fe = fork_trampoline+0xe/frame 0xfe08b37f8ab0 --- 
> > > trap 0, rip =
> > > 0, rsp = 0, rbp = 0 ---  
> > > db>   
> > > 
> > > (kgdb) list *(zio_vdev_io_start+0x1f1)
> > > 0xd9f21 is in zio_vdev_io_start
> > > (/usr/home/kenm/perforce4/kenm/FreeBSD-test/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c:350).
> > > 345 346 /*
> > > 347  * Ensure that anyone expecting this zio to contain a 
> > > linear ABD
> > > isn't 348  * going to get a nasty surprise when they try to 
> > > access the
> > > data. 349  */
> > > 350 IMPLY(abd_is_linear(zio->io_abd), abd_is_linear(data));
> > > 351
> > > 352 zt->zt_orig_abd = zio->io_abd;
> > > 353 zt->zt_orig_size = zio->io_size;
> > > 354 zt->zt_bufsize = bufsize;
> > > 
> > > I???ll try rebooting and see if the problem goes away.  If not, I???ll 
> > > roll back
> > > the ABD change and see if the problem goes away.  
> > 
> > Judging from the thread that panic-ed the problem may have to do with our 
> > TRIM
> > support.  Unfortunately,  I didn't have a chance to test the change on a 
> > system
> > with working TRIM and, so, I missed it.
> > I will look into this further, but it's almost obvious that the problem is
> > caused by zio->io_abd being NULL for a zio of type ZIO_TYPE_FREE.  
> 
> FWIW, avg sent me a patch for this particular problem (by checking for NULL
> before dereferencing the pointer), and although it got me past the above
> problem, I hit another related panic:
> 
> Fatal trap 12: page fault while in kernel mode
> cpuid = 6; 
> 
> Fatal trap 12: page fault while in kernel mode
> cpuid = 14; apic id = 22
> fault virtual address   = 0x4
> fault code  = supervisor read data, page not present
> instruction pointer = 0x20:0x81d92a2d
> stack pointer   = 0x0:0xfe08b36e0710
> frame pointer   = 0x0:0xfe08b36e0730
> code segment= base 0x0, limit 0xf, type 0x1b
> 
> 
> Fatal trap 12: page fault while in kernel mode
> cpuid = 11; apic id = 0b
> fault virtual address   = 0x4
> Fatal trap 12: page fault while in kernel mode
> cpuid = 8; apic id = 08
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags= interrupt enabled, resume, IOPL = 0
> current process = 0 (zio_free_issue_4_1)
> [ thread pid 0 tid 100799 ]
> St

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

2017-06-21 Thread Andriy Gapon
Author: avg
Date: Wed Jun 21 08:10:45 2017
New Revision: 320185
URL: https://svnweb.freebsd.org/changeset/base/320185

Log:
  fix several fallouts from r320156, ZFS ABD import
  
  All of the problems were related to the FreeBSD-only features.
  One was caused by a mismerge in the zfsbootcfg support code.
  All others were in the TRIM support code.
  
  Reported by:  ken,
O. Hartmann ,
Trond Endrestøl 
  MFC after:1 week
  X-MFC with:   r320156

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cWed Jun 
21 06:44:56 2017(r320184)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.cWed Jun 
21 08:10:45 2017(r320185)
@@ -279,7 +279,8 @@ vdev_raidz_map_free(raidz_map_t *rm)
 
size = 0;
for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) {
-   abd_put(rm->rm_col[c].rc_abd);
+   if (rm->rm_col[c].rc_abd != NULL)
+   abd_put(rm->rm_col[c].rc_abd);
size += rm->rm_col[c].rc_size;
}
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Wed Jun 21 
06:44:56 2017(r320184)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Wed Jun 21 
08:10:45 2017(r320185)
@@ -347,7 +347,12 @@ zio_push_transform(zio_t *zio, abd_t *data, uint64_t s
 * Ensure that anyone expecting this zio to contain a linear ABD isn't
 * going to get a nasty surprise when they try to access the data.
 */
+#ifdef illumos
IMPLY(abd_is_linear(zio->io_abd), abd_is_linear(data));
+#else
+   IMPLY(zio->io_abd != NULL && abd_is_linear(zio->io_abd),
+   abd_is_linear(data));
+#endif
 
zt->zt_orig_abd = zio->io_abd;
zt->zt_orig_size = zio->io_size;
@@ -3132,7 +3137,7 @@ zio_vdev_io_start(zio_t *zio)
P2PHASE(zio->io_size, align) != 0) {
/* Transform logical writes to be a full physical block size. */
uint64_t asize = P2ROUNDUP(zio->io_size, align);
-   abd_t *abuf;
+   abd_t *abuf = NULL;
if (zio->io_type == ZIO_TYPE_READ ||
zio->io_type == ZIO_TYPE_WRITE)
abuf = abd_alloc_sametype(zio->io_abd, asize);
___
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: r320186 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-06-21 Thread Andriy Gapon
Author: avg
Date: Wed Jun 21 08:12:07 2017
New Revision: 320186
URL: https://svnweb.freebsd.org/changeset/base/320186

Log:
  fix several fallouts from r320156, ZFS ABD import
  
  All of the problems were related to the FreeBSD-only features.
  One was caused by a mismerge in the zfsbootcfg support code.
  All others were in the TRIM support code.
  
  MFC after:1 week
  X-MFC with:   r320156

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.cWed Jun 
21 08:10:45 2017(r320185)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cWed Jun 
21 08:12:07 2017(r320186)
@@ -912,7 +912,7 @@ retry:
goto retry;
}
 
-   zio_buf_free(pad2, VDEV_PAD_SIZE);
+   abd_free(pad2);
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"


Re: svn commit: r320156 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contr

2017-06-21 Thread Andriy Gapon
On 21/06/2017 00:25, Kenneth D. Merry wrote:
> FWIW, avg sent me a patch for this particular problem (by checking for NULL
> before dereferencing the pointer), and although it got me past the above
> problem, I hit another related panic:

Could you please re-enable ZFS TRIM support and test r320186 or later?
Thank you for all your help with the testing and debugging.

-- 
Andriy Gapon
___
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: r320187 - head/contrib/ipfilter/tools

2017-06-21 Thread Cy Schubert
Author: cy
Date: Wed Jun 21 12:19:05 2017
New Revision: 320187
URL: https://svnweb.freebsd.org/changeset/base/320187

Log:
  Fix -S handling within poolcommand(). Specifying a seed (-S) is only
  valid when adding a pool (ippool -A), not when removing a pool
  (ippool -R). It is a command line syntax error if specifying a seed (-S)
  is specified when emoving a pool (-R).

Modified:
  head/contrib/ipfilter/tools/ippool.c

Modified: head/contrib/ipfilter/tools/ippool.c
==
--- head/contrib/ipfilter/tools/ippool.cWed Jun 21 08:12:07 2017
(r320186)
+++ head/contrib/ipfilter/tools/ippool.cWed Jun 21 12:19:05 2017
(r320187)
@@ -298,7 +298,10 @@ poolcommand(remove, argc, argv)
opts |= OPT_NORESOLVE;
break;
case 'S' :
-   iph.iph_seed = atoi(optarg);
+   if (remove == 0)
+   iph.iph_seed = atoi(optarg);
+   else
+   usage(argv[0]);
break;
case 'v' :
opts |= OPT_VERBOSE;
___
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: r320156 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contr

2017-06-21 Thread Kenneth D. Merry
On Wed, Jun 21, 2017 at 11:16:23 +0300, Andriy Gapon wrote:
> On 21/06/2017 00:25, Kenneth D. Merry wrote:
> > FWIW, avg sent me a patch for this particular problem (by checking for NULL
> > before dereferencing the pointer), and although it got me past the above
> > problem, I hit another related panic:
> 
> Could you please re-enable ZFS TRIM support and test r320186 or later?
> Thank you for all your help with the testing and debugging.

That fixed it, thank you!

Ken
-- 
Kenneth Merry
k...@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"


Re: svn commit: r320172 - head/bin/ln

2017-06-21 Thread Alexey Dokuchaev
On Tue, Jun 20, 2017 at 08:46:08PM +, Ngie Cooper wrote:
> New Revision: 320172
> URL: https://svnweb.freebsd.org/changeset/base/320172
> 
> Log:
>   ln(1): fix -F behavior
>   
>   When '-F' option is used, the target directory needs to be unlinked.
>   Currently, the modified target ("target/source") is being unlinked, and
>   since it doesn't yet exist, the original target isn't removed.
>   This is fixed by skipping the block where target is modified to
>   "target/source" when '-F' option is set.
>   Hence, a symbolic link (with the same name as of the original target) to
>   the source_file is produced.

Is this about the same problem I've asked asked on -hackers@ back in 2015
(and never got any answer)?

https://lists.freebsd.org/pipermail/freebsd-hackers/2015-January/046939.html

./danfe
___
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: r320172 - head/bin/ln

2017-06-21 Thread Alan Somers
On Wed, Jun 21, 2017 at 7:37 AM, Alexey Dokuchaev  wrote:
> On Tue, Jun 20, 2017 at 08:46:08PM +, Ngie Cooper wrote:
>> New Revision: 320172
>> URL: https://svnweb.freebsd.org/changeset/base/320172
>>
>> Log:
>>   ln(1): fix -F behavior
>>
>>   When '-F' option is used, the target directory needs to be unlinked.
>>   Currently, the modified target ("target/source") is being unlinked, and
>>   since it doesn't yet exist, the original target isn't removed.
>>   This is fixed by skipping the block where target is modified to
>>   "target/source" when '-F' option is set.
>>   Hence, a symbolic link (with the same name as of the original target) to
>>   the source_file is produced.
>
> Is this about the same problem I've asked asked on -hackers@ back in 2015
> (and never got any answer)?
>
> https://lists.freebsd.org/pipermail/freebsd-hackers/2015-January/046939.html
>
> ./danfe

Yep, shivansh rediscovered the same problem.  Sorry nobody noticed
your original post.
-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: r320189 - head/sys/compat/linuxkpi/common/src

2017-06-21 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 21 14:38:52 2017
New Revision: 320189
URL: https://svnweb.freebsd.org/changeset/base/320189

Log:
  Allow the VM fault handler to be NULL in the LinuxKPI when handling a
  memory map request. When the VM fault handler is NULL a return code of
  VM_PAGER_BAD is returned from the character device's pager populate
  handler. This fixes compatibility with Linux.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jun 21 14:36:25 
2017(r320188)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jun 21 14:38:52 
2017(r320189)
@@ -497,7 +497,7 @@ linux_cdev_pager_populate(vm_object_t vm_obj, vm_pinde
VM_OBJECT_WUNLOCK(vm_obj);
 
down_write(&vmap->vm_mm->mmap_sem);
-   if (unlikely(vmap->vm_ops == NULL)) {
+   if (unlikely(vmap->vm_ops == NULL || vmap->vm_ops->fault == NULL)) {
err = VM_FAULT_SIGBUS;
} else {
vmap->vm_pfn_count = 0;
@@ -1173,8 +1173,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t *
if (vmap->vm_ops != NULL) {
void *vm_private_data;
 
-   if (vmap->vm_ops->fault == NULL ||
-   vmap->vm_ops->open == NULL ||
+   if (vmap->vm_ops->open == NULL ||
vmap->vm_ops->close == NULL ||
vmap->vm_private_data == NULL) {
linux_cdev_handle_free(vmap);
___
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: r320172 - head/bin/ln

2017-06-21 Thread Alexey Dokuchaev
On Wed, Jun 21, 2017 at 08:31:10AM -0600, Alan Somers wrote:
> On Wed, Jun 21, 2017 at 7:37 AM, Alexey Dokuchaev  wrote:
> > On Tue, Jun 20, 2017 at 08:46:08PM +, Ngie Cooper wrote:
> >> New Revision: 320172
> >> URL: https://svnweb.freebsd.org/changeset/base/320172
> >>
> >> Log:
> >>   ln(1): fix -F behavior
> >>
> >>   When '-F' option is used, the target directory needs to be unlinked.
> >>   Currently, the modified target ("target/source") is being unlinked,
> >>   and since it doesn't yet exist, the original target isn't removed.
> >>   This is fixed by skipping the block where target is modified to
> >>   "target/source" when '-F' option is set.
> >>   Hence, a symbolic link (with the same name as of the original target)
> >>   to the source_file is produced.
> >
> > Is this about the same problem I've asked on -hackers@ back in 2015
> > (and never got any answer)?
> >
> > https://lists.freebsd.org/pipermail/freebsd-hackers/2015-January/046939.html
> 
> Yep, shivansh rediscovered the same problem.  Sorry nobody noticed
> your original post.

Yeah, I vaguely recall someone mentioned that -hackers@ is not the best
place to talk about technical problems these days. :-(

Do we have a -hackers-who-care@ ML now, when -arch@ would be too gross yet
lack of immediate patch would prevent one from opening a PR?

./danfe
___
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: r320191 - head/share/mk

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 17:11:49 2017
New Revision: 320191
URL: https://svnweb.freebsd.org/changeset/base/320191

Log:
  objwarn should be .PHONY.
  
  Otherwise in META_MODE it may create an objwarn.meta if only bsd.obj.mk
  is included;  bsd.sys.mk already had .PHONY: objwarn.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.obj.mk

Modified: head/share/mk/bsd.obj.mk
==
--- head/share/mk/bsd.obj.mkWed Jun 21 14:39:31 2017(r320190)
+++ head/share/mk/bsd.obj.mkWed Jun 21 17:11:49 2017(r320191)
@@ -102,7 +102,7 @@ OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
 # case 2 (using MAKEOBJDIR), don't issue a warning.  Otherwise,
 # issue a warning differentiating between cases 6 and (3 or 4).
 #
-objwarn:
+objwarn: .PHONY
 .if !defined(NO_OBJ) && ${.OBJDIR} != ${CANONICALOBJDIR} && \
 !(defined(MAKEOBJDIRPREFIX) && exists(${CANONICALOBJDIR}/)) && \
 !(defined(MAKEOBJDIR) && exists(${MAKEOBJDIR}/))
___
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: r320172 - head/bin/ln

2017-06-21 Thread Bryan Drewery
On 6/20/2017 1:46 PM, Ngie Cooper wrote:
> Author: ngie
> Date: Tue Jun 20 20:46:08 2017
> New Revision: 320172
> URL: https://svnweb.freebsd.org/changeset/base/320172
> 
> Log:
>   ln(1): fix -F behavior
>   
>   When '-F' option is used, the target directory needs to be unlinked.
>   Currently, the modified target ("target/source") is being unlinked, and
>   since it doesn't yet exist, the original target isn't removed.
>   This is fixed by skipping the block where target is modified to
>   "target/source" when '-F' option is set.
>   Hence, a symbolic link (with the same name as of the original target) to
>   the source_file is produced.
>   
=>   Update the test for ln(1) to reflect fix for option '-F'

I don't see a test update here.

>   
>   MFC after:  1 month
>   PR: 219943
>   Differential Revision:  D11167
>   Submitted by:   shivansh
>   Sponsored by:   Google (GSoC 2017)
> 
> Modified:
>   head/bin/ln/ln.c
> 
> Modified: head/bin/ln/ln.c
> ==
> --- head/bin/ln/ln.c  Tue Jun 20 20:34:30 2017(r320171)
> +++ head/bin/ln/ln.c  Tue Jun 20 20:46:08 2017(r320172)
> @@ -245,11 +245,11 @@ linkit(const char *source, const char *target, int isd
>  
>   /*
>* If the target is a directory (and not a symlink if hflag),
> -  * append the source's name.
> +  * append the source's name, unless Fflag is set.
>*/
> - if (isdir ||
> + if (!Fflag && (isdir ||
>   (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) ||
> - (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) {
> + (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode {
>   if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) ||
>   (p = basename(bbuf)) == NULL ||
>   snprintf(path, sizeof(path), "%s/%s", target, p) >=
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r320172 - head/bin/ln

2017-06-21 Thread Ngie Cooper
On Wed, Jun 21, 2017 at 10:12 AM, Bryan Drewery  wrote:

...

> I don't see a test update here.

Sorry :/.. I blindly copy-pasted the CR text. r320173 has the test update.
Thanks!
-Ngie
___
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: r320192 - head/sys/compat/linuxkpi/common/include/linux

2017-06-21 Thread Mark Johnston
Author: markj
Date: Wed Jun 21 18:08:36 2017
New Revision: 320192
URL: https://svnweb.freebsd.org/changeset/base/320192

Log:
  Add a lockdep macro to the LinuxKPI.
  
  Also fix some nearby style issues.
  
  MFC after:1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/lockdep.h

Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h
==
--- head/sys/compat/linuxkpi/common/include/linux/lockdep.h Wed Jun 21 
17:11:49 2017(r320191)
+++ head/sys/compat/linuxkpi/common/include/linux/lockdep.h Wed Jun 21 
18:08:36 2017(r320192)
@@ -28,14 +28,18 @@
  *
  * $FreeBSD$
  */
-#ifndef_LINUX_LOCKDEP_H_
+
+#ifndef _LINUX_LOCKDEP_H_
 #define_LINUX_LOCKDEP_H_
 
 struct lock_class_key {
 };
 
-#define lockdep_set_class(lock, key)
+#definelockdep_set_class(lock, key)
 
-#define lockdep_set_class_and_name(lock, key, name)
+#definelockdep_set_class_and_name(lock, key, name)
 
-#endif  /* _LINUX_LOCKDEP_H_ */
+#definelockdep_assert_held_once(m) \
+   sx_assert(&(m)->sx, SA_XLOCKED | SA_NOTRECURSED)
+
+#endif /* _LINUX_LOCKDEP_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r320193 - head/sys/compat/linuxkpi/common/include/linux

2017-06-21 Thread Mark Johnston
Author: markj
Date: Wed Jun 21 18:15:47 2017
New Revision: 320193
URL: https://svnweb.freebsd.org/changeset/base/320193

Log:
  Include kmod.h from the LinuxKPI's module.h.
  
  MFC after:1 week

Modified:
  head/sys/compat/linuxkpi/common/include/linux/module.h

Modified: head/sys/compat/linuxkpi/common/include/linux/module.h
==
--- head/sys/compat/linuxkpi/common/include/linux/module.h  Wed Jun 21 
18:08:36 2017(r320192)
+++ head/sys/compat/linuxkpi/common/include/linux/module.h  Wed Jun 21 
18:15:47 2017(r320193)
@@ -37,6 +37,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-06-21 Thread Mark Johnston
Author: markj
Date: Wed Jun 21 18:17:32 2017
New Revision: 320194
URL: https://svnweb.freebsd.org/changeset/base/320194

Log:
  Add missing lock destructor invocations to the LinuxKPI unload handler.
  
  MFC after:1 week

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

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jun 21 18:15:47 
2017(r320193)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jun 21 18:17:32 
2017(r320194)
@@ -2026,6 +2026,8 @@ linux_compat_uninit(void *arg)
linux_kobject_kfree_name(&linux_root_device.kobj);
linux_kobject_kfree_name(&linux_class_misc.kobj);
 
+   mtx_destroy(&vmmaplock);
+   spin_lock_destroy(&pci_lock);
rw_destroy(&linux_vma_lock);
 }
 SYSUNINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_uninit, 
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: r320195 - head/usr.sbin/bhyveload

2017-06-21 Thread Andriy Gapon
Author: avg
Date: Wed Jun 21 18:19:27 2017
New Revision: 320195
URL: https://svnweb.freebsd.org/changeset/base/320195

Log:
  bhyveload: correctly query size of disks
  
  On FreeBSD fstat(2) works fine for querying sizes of plain files,
  but not so much for character devices.
  So, use DIOCGMEDIASIZE to try to get the correct size for disks
  and disk-like devices (e.g. zvols).
  
  PR:   220186
  Reviewed by:  tsoome, grehan
  MFC after:1 week

Modified:
  head/usr.sbin/bhyveload/bhyveload.c

Modified: head/usr.sbin/bhyveload/bhyveload.c
==
--- head/usr.sbin/bhyveload/bhyveload.c Wed Jun 21 18:17:32 2017
(r320194)
+++ head/usr.sbin/bhyveload/bhyveload.c Wed Jun 21 18:19:27 2017
(r320195)
@@ -311,10 +311,12 @@ cb_diskioctl(void *arg, int unit, u_long cmd, void *da
*(u_int *)data = 512;
break;
case DIOCGMEDIASIZE:
-   if (fstat(disk_fd[unit], &sb) == 0)
-   *(off_t *)data = sb.st_size;
-   else
+   if (fstat(disk_fd[unit], &sb) != 0)
return (ENOTTY);
+   if (S_ISCHR(sb.st_mode) &&
+   ioctl(disk_fd[unit], DIOCGMEDIASIZE, &sb.st_size) != 0)
+   return (ENOTTY);
+   *(off_t *)data = sb.st_size;
break;
default:
return (ENOTTY);
___
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: r320196 - in head/sys: compat/linuxkpi/common/include/linux dev/mlx4/mlx4_core dev/mlx5/mlx5_core

2017-06-21 Thread Mark Johnston
Author: markj
Date: Wed Jun 21 18:20:17 2017
New Revision: 320196
URL: https://svnweb.freebsd.org/changeset/base/320196

Log:
  Update io-mapping.h in the LinuxKPI.
  
  Add io_mapping_init_wc() and add a third (unused) parameter to
  io_mapping_map_wc().
  
  Reviewed by:  hselasky
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D11286

Modified:
  head/sys/compat/linuxkpi/common/include/linux/io-mapping.h
  head/sys/dev/mlx4/mlx4_core/mlx4_pd.c
  head/sys/dev/mlx5/mlx5_core/mlx5_uar.c

Modified: head/sys/compat/linuxkpi/common/include/linux/io-mapping.h
==
--- head/sys/compat/linuxkpi/common/include/linux/io-mapping.h  Wed Jun 21 
18:19:27 2017(r320195)
+++ head/sys/compat/linuxkpi/common/include/linux/io-mapping.h  Wed Jun 21 
18:20:17 2017(r320196)
@@ -28,52 +28,85 @@
  *
  * $FreeBSD$
  */
-#ifndef_LINUX_IO_MAPPING_H_
+
+#ifndef _LINUX_IO_MAPPING_H_
 #define_LINUX_IO_MAPPING_H_
 
+#include 
+#include 
+
 #include 
 #include 
+#include 
 
-struct io_mapping;
+struct io_mapping {
+   unsigned long base;
+   unsigned long size;
+   void *mem;
+   vm_memattr_t attr;
+};
 
 static inline struct io_mapping *
+io_mapping_init_wc(struct io_mapping *mapping, resource_size_t base,
+unsigned long size)
+{
+
+   mapping->base = base;
+   mapping->size = size;
+   mapping->mem = ioremap_wc(base, size);
+   mapping->attr = VM_MEMATTR_WRITE_COMBINING;
+   return (mapping);
+}
+
+static inline struct io_mapping *
 io_mapping_create_wc(resource_size_t base, unsigned long size)
 {
+   struct io_mapping *mapping;
 
-   return ioremap_wc(base, size);
+   mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
+   if (mapping == NULL)
+   return (NULL);
+   return (io_mapping_init_wc(mapping, base, size));
 }
 
 static inline void
+io_mapping_fini(struct io_mapping *mapping)
+{
+
+   iounmap(mapping->mem);
+}
+
+static inline void
 io_mapping_free(struct io_mapping *mapping)
 {
 
-   iounmap(mapping);
+   io_mapping_fini(mapping->mem);
+   kfree(mapping);
 }
 
 static inline void *
 io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
 {
 
-   return (((char *)mapping) + offset);
+   return ((char *)mapping->mem + offset);
 }
 
 static inline void
 io_mapping_unmap_atomic(void *vaddr)
 {
-
 }
 
 static inline void *
-io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
+io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset,
+unsigned long size)
 {
 
-   return (((char *) mapping) + offset);
+   return ((char *)mapping->mem + offset);
 }
 
 static inline void
 io_mapping_unmap(void *vaddr)
 {
-
 }
 
-#endif /* _LINUX_IO_MAPPING_H_ */
+#endif /* _LINUX_IO_MAPPING_H_ */

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_pd.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_pd.c   Wed Jun 21 18:19:27 2017
(r320195)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_pd.c   Wed Jun 21 18:20:17 2017
(r320196)
@@ -204,7 +204,7 @@ int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf
goto free_uar;
}
 
-   uar->bf_map = io_mapping_map_wc(priv->bf_mapping, uar->index << 
PAGE_SHIFT);
+   uar->bf_map = io_mapping_map_wc(priv->bf_mapping, uar->index << 
PAGE_SHIFT, PAGE_SIZE);
if (!uar->bf_map) {
err = -ENOMEM;
goto unamp_uar;

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_uar.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_uar.c  Wed Jun 21 18:19:27 2017
(r320195)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_uar.c  Wed Jun 21 18:20:17 2017
(r320196)
@@ -189,7 +189,8 @@ int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, str
 
if (mdev->priv.bf_mapping)
uar->bf_map = io_mapping_map_wc(mdev->priv.bf_mapping,
-   uar->index << PAGE_SHIFT);
+   uar->index << PAGE_SHIFT,
+   PAGE_SIZE);
 
return 0;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-06-21 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jun 21 18:23:28 2017
New Revision: 320197
URL: https://svnweb.freebsd.org/changeset/base/320197

Log:
  Introduce support for DMA coherent ARM platforms
  
  - Inherit BUS_DMA_COHERENT flag from parent buses
  - Use cacheable memory attributes on dma coherent platform
  - Disable cache synchronization on coherent platform
  
  Changes are based on ARMv8 busdma code and commit r299683.
  
  Submitted by: Michal Mazur 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: ian
  Differential revision: https://reviews.freebsd.org/D11201

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cWed Jun 21 18:20:17 2017
(r320196)
+++ head/sys/arm/arm/busdma_machdep-v6.cWed Jun 21 18:23:28 2017
(r320197)
@@ -491,6 +491,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
newtag->alignment = MAX(parent->alignment, newtag->alignment);
newtag->flags |= parent->flags & BUS_DMA_COULD_BOUNCE;
+   newtag->flags |= parent->flags & BUS_DMA_COHERENT;
if (newtag->boundary == 0)
newtag->boundary = parent->boundary;
else if (parent->boundary != 0)
@@ -755,11 +756,19 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int
}
map->flags = DMAMAP_DMAMEM_ALLOC;
 
-   /* Choose a busdma buffer allocator based on memory type flags. */
-   if (flags & BUS_DMA_COHERENT) {
+   /* For coherent memory, set the map flag that disables sync ops. */
+   if (flags & BUS_DMA_COHERENT)
+   map->flags |= DMAMAP_COHERENT;
+
+   /*
+* Choose a busdma buffer allocator based on memory type flags.
+* If the tag's COHERENT flag is set, that means normal memory
+* is already coherent, use the normal allocator.
+*/
+   if ((flags & BUS_DMA_COHERENT) &&
+   ((dmat->flags & BUS_DMA_COHERENT) == 0)) {
memattr = VM_MEMATTR_UNCACHEABLE;
ba = coherent_allocator;
-   map->flags |= DMAMAP_COHERENT;
} else {
memattr = VM_MEMATTR_DEFAULT;
ba = standard_allocator;
@@ -829,7 +838,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_d
struct busdma_bufzone *bufzone;
busdma_bufalloc_t ba;
 
-   if (map->flags & DMAMAP_COHERENT)
+   if ((map->flags & DMAMAP_COHERENT) &&
+   ((dmat->flags & BUS_DMA_COHERENT) == 0))
ba = coherent_allocator;
else
ba = standard_allocator;
@@ -1030,7 +1040,7 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t
sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK));
curaddr = add_bounce_page(dmat, map, 0, curaddr,
sgsize);
-   } else {
+   } else if ((dmat->flags & BUS_DMA_COHERENT) == 0) {
if (map->sync_count > 0)
sl_end = sl->paddr + sl->datacount;
 
@@ -1144,7 +1154,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap
sgsize)) {
curaddr = add_bounce_page(dmat, map, kvaddr, curaddr,
sgsize);
-   } else {
+   } else if ((dmat->flags & BUS_DMA_COHERENT) == 0) {
if (map->sync_count > 0) {
sl_pend = sl->paddr + sl->datacount;
sl_vend = sl->vaddr + sl->datacount;
@@ -1353,8 +1363,9 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
bpage->datacount);
if (tempvaddr != 0)
pmap_quick_remove_page(tempvaddr);
-   dcache_wb_poc(bpage->vaddr, bpage->busaddr,
-   bpage->datacount);
+   if ((dmat->flags & BUS_DMA_COHERENT) == 0)
+   dcache_wb_poc(bpage->vaddr,
+   bpage->busaddr, bpage->datacount);
bpage = STAILQ_NEXT(bpage, links);
}
dmat->bounce_zone->total_bounced++;
@@ -1374,8 +1385,9 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map,
if ((op & BUS_DMASYNC_PREREAD) && !(op & BUS_DMASYNC_PREWRITE)) 
{
bpage = STAILQ_FIRST(&map->bpages);
while (bpage != NULL) {
-   dcache_inv_poc_dma(bpage->vaddr, bpage->busaddr,
-   bpage->datacount);
+   if 

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

2017-06-21 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jun 21 18:25:35 2017
New Revision: 320198
URL: https://svnweb.freebsd.org/changeset/base/320198

Log:
  Enable setting the dma tag at the nexus level
  
  Allow to set the dma tag for nexus in the platform init code,
  so that all busses and devices would be able to inherit it.
  This change is useful e.g. for setting coherent dma tag for
  the platforms with hardware IO cache coherency.
  
  Submitted by: ian
  Michal Mazur 
  Reviewed by: ian
  Differential revision: https://reviews.freebsd.org/D11202

Added:
  head/sys/arm/arm/nexusvar.h   (contents, props changed)
Modified:
  head/sys/arm/arm/nexus.c

Modified: head/sys/arm/arm/nexus.c
==
--- head/sys/arm/arm/nexus.cWed Jun 21 18:23:28 2017(r320197)
+++ head/sys/arm/arm/nexus.cWed Jun 21 18:25:35 2017(r320198)
@@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #ifdef FDT
 #include 
 #include 
@@ -87,6 +89,7 @@ staticstruct resource *nexus_alloc_resource(device_t,
 static int nexus_activate_resource(device_t, device_t, int, int,
 struct resource *);
 static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
+static bus_dma_tag_t nexus_get_dma_tag(device_t dev, device_t child);
 #ifdef INTRNG
 #ifdef SMP
 static int nexus_bind_intr(device_t, device_t, struct resource *, int);
@@ -112,6 +115,13 @@ static int nexus_ofw_map_intr(device_t dev, device_t c
 int icells, pcell_t *intr);
 #endif
 
+/*
+ * Normally NULL (which results in defaults which are handled in
+ * busdma_machdep), platform init code can use nexus_set_dma_tag() to set this
+ * to a tag that will be inherited by all busses and devices on the platform.
+ */
+static bus_dma_tag_t nexus_dma_tag;
+
 static device_method_t nexus_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, nexus_probe),
@@ -127,6 +137,7 @@ static device_method_t nexus_methods[] = {
DEVMETHOD(bus_setup_intr,   nexus_setup_intr),
DEVMETHOD(bus_teardown_intr,nexus_teardown_intr),
DEVMETHOD(bus_get_bus_tag,  nexus_get_bus_tag),
+   DEVMETHOD(bus_get_dma_tag,  nexus_get_dma_tag),
 #ifdef INTRNG
DEVMETHOD(bus_describe_intr,nexus_describe_intr),
 #ifdef SMP
@@ -273,6 +284,20 @@ nexus_get_bus_tag(device_t bus __unused, device_t chil
 #else
return((void *)1);
 #endif
+}
+
+static bus_dma_tag_t
+nexus_get_dma_tag(device_t dev, device_t child)
+{
+
+   return nexus_dma_tag;
+}
+
+void
+nexus_set_dma_tag(bus_dma_tag_t tag)
+{
+
+   nexus_dma_tag = tag;
 }
 
 static int

Added: head/sys/arm/arm/nexusvar.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/arm/nexusvar.h Wed Jun 21 18:25:35 2017(r320198)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2017 Ian Lepore 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef_ARM_ARM_NEXUSVAR_H_
+#define_ARM_ARM_NEXUSVAR_H_
+
+/* Set a platform busdma tag to be inherited by all busses and devices. */
+void nexus_set_dma_tag(bus_dma_tag_t _tag);
+
+#endif
+
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-06-21 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jun 21 18:27:05 2017
New Revision: 320199
URL: https://svnweb.freebsd.org/changeset/base/320199

Log:
  Create root DMA tag and fix MBUS windows on DMA coherent platforms
  
  Armada 38x SoCs, in order to work properly in IO-coherent mode,
  requires an update of the MBUS windows attributesd.
  
  This patch also configures nexus coherent dma tag, because all
  busses and children devices have to inherit this setting in runtime.
  The latter has to be executed as a sysinit (SI_SUB_DRIVERS type),
  so that bus_dma_tag_create() can be executed properly.
  
  Submitted by: Michal Mazur 
  Marcin Wojtas 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: ian
  Differential revision: https://reviews.freebsd.org/D11203

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

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Wed Jun 21 18:25:35 2017(r320198)
+++ head/sys/arm/mv/mv_common.c Wed Jun 21 18:27:05 2017(r320199)
@@ -128,6 +128,7 @@ static uint32_t dev_mask = 0;
 static int cpu_wins_no = 0;
 static int eth_port = 0;
 static int usb_port = 0;
+static boolean_t platform_io_coherent = false;
 
 static struct decode_win cpu_win_tbl[MAX_CPU_WIN];
 
@@ -1064,7 +1065,7 @@ ddr_size(int i)
 uint32_t
 ddr_attr(int i)
 {
-   uint32_t dev, rev;
+   uint32_t dev, rev, attr;
 
soc_id(&dev, &rev);
if (dev == MV_DEV_88RC8180)
@@ -1072,10 +1073,14 @@ ddr_attr(int i)
if (dev == MV_DEV_88F6781)
return (0);
 
-   return (i == 0 ? 0xe :
+   attr = (i == 0 ? 0xe :
(i == 1 ? 0xd :
(i == 2 ? 0xb :
(i == 3 ? 0x7 : 0xff;
+   if (platform_io_coherent)
+   attr |= 0x10;
+
+   return (attr);
 }
 
 uint32_t
@@ -2478,6 +2483,10 @@ fdt_win_setup(void)
node = OF_finddevice("/");
if (node == -1)
panic("fdt_win_setup: no root node");
+
+   /* Allow for coherent transactions on the A38x MBUS */
+   if (ofw_bus_node_is_compatible(node, "marvell,armada380"))
+   platform_io_coherent = true;
 
/*
 * Traverse through all children of root and simple-bus nodes.

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cWed Jun 21 18:25:35 2017
(r320198)
+++ head/sys/arm/mv/mv_machdep.cWed Jun 21 18:27:05 2017
(r320199)
@@ -46,10 +46,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -86,6 +89,39 @@ int armada38x_mbus_optimization(void);
 #define MPP_PINS_PER_REG   8
 #define MPP_SEL(pin,func)  (((func) & 0xf) <<  \
 (((pin) % MPP_PINS_PER_REG) * 4))
+
+static void
+mv_busdma_tag_init(void *arg __unused)
+{
+   phandle_t node;
+   bus_dma_tag_t dmat;
+
+   /*
+* If this platform has coherent DMA, create the parent DMA tag to pass
+* down the coherent flag to all busses and devices on the platform,
+* otherwise return without doing anything. By default create tag
+* for all A38x-based platforms only.
+*/
+   if ((node = OF_finddevice("/")) == -1)
+   return;
+   if (ofw_bus_node_is_compatible(node, "marvell,armada380") == 0)
+   return;
+
+   bus_dma_tag_create(NULL,/* No parent tag */
+   1, 0,   /* alignment, bounds */
+   BUS_SPACE_MAXADDR,  /* lowaddr */
+   BUS_SPACE_MAXADDR,  /* highaddr */
+   NULL, NULL, /* filter, filterarg */
+   BUS_SPACE_MAXSIZE,  /* maxsize */
+   BUS_SPACE_UNRESTRICTED, /* nsegments */
+   BUS_SPACE_MAXSIZE,  /* maxsegsize */
+   BUS_DMA_COHERENT,   /* flags */
+   NULL, NULL, /* lockfunc, lockarg */
+   &dmat);
+
+   nexus_set_dma_tag(dmat);
+}
+SYSINIT(mv_busdma_tag, SI_SUB_DRIVERS, SI_ORDER_ANY, mv_busdma_tag_init, NULL);
 
 static int
 platform_mpp_init(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: r320200 - head/sys/boot/fdt/dts/arm

2017-06-21 Thread Zbigniew Bodek
Author: zbb
Date: Wed Jun 21 18:28:37 2017
New Revision: 320200
URL: https://svnweb.freebsd.org/changeset/base/320200

Log:
  Enable arm,io-coherent property of PL310 L2 cache on Armada 38x platforms
  
  This patch disables outer cache sync in PL310 driver
  by adding "arm,io-coherent" property. In addition to
  the previous patches it was the last bit needed
  for enabling proper operation of Armada 38x SoCs
  with the IO cache coherency.
  
  Submitted by: Michal Mazur 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: mmel
  Differential revision: https://reviews.freebsd.org/D11204

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 Jun 21 18:27:05 2017
(r320199)
+++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Wed Jun 21 18:28:37 2017
(r320200)
@@ -177,6 +177,7 @@
reg = <0x8000 0x1000>;
cache-unified;
cache-level = <2>;
+   arm,io-coherent;
};
 
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: r320201 - head/sys/vm

2017-06-21 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 21 18:51:30 2017
New Revision: 320201
URL: https://svnweb.freebsd.org/changeset/base/320201

Log:
  Assert that the protection of a new map entry is a subset of the max
  protection.
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Jun 21 18:28:37 2017(r320200)
+++ head/sys/vm/vm_map.cWed Jun 21 18:51:30 2017(r320201)
@@ -1190,6 +1190,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof
("vm_map_insert: kmem or kernel object and COW"));
KASSERT(object == NULL || (cow & MAP_NOFAULT) == 0,
("vm_map_insert: paradoxical MAP_NOFAULT request"));
+   KASSERT((prot & ~max) == 0,
+   ("prot %#x is not subset of max_prot %#x", prot, max));
 
/*
 * Check that the start and end points are not bogus.
___
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: r320202 - head/sys/vm

2017-06-21 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 21 18:54:28 2017
New Revision: 320202
URL: https://svnweb.freebsd.org/changeset/base/320202

Log:
  Call pmap_copy() only for map entries which have the backing object
  instantiated.
  
  Calling pmap_copy() on non-faulted anonymous memory entries is useless.
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Jun 21 18:51:30 2017(r320201)
+++ head/sys/vm/vm_map.cWed Jun 21 18:54:28 2017(r320202)
@@ -3239,6 +3239,10 @@ vm_map_copy_entry(
fake_entry->next = curthread->td_map_def_user;
curthread->td_map_def_user = fake_entry;
}
+
+   pmap_copy(dst_map->pmap, src_map->pmap,
+   dst_entry->start, dst_entry->end - dst_entry->start,
+   src_entry->start);
} else {
dst_entry->object.vm_object = NULL;
dst_entry->offset = 0;
@@ -3248,9 +3252,6 @@ vm_map_copy_entry(
*fork_charge += size;
}
}
-
-   pmap_copy(dst_map->pmap, src_map->pmap, dst_entry->start,
-   dst_entry->end - dst_entry->start, src_entry->start);
} else {
/*
 * We don't want to make writeable wired pages copy-on-write.
___
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: r320203 - head/share/mk

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 18:56:53 2017
New Revision: 320203
URL: https://svnweb.freebsd.org/changeset/base/320203

Log:
  Similar to r296013 for NO_ROOT, force SUBDIR_PARALLEL for buildworld WORLDTMP 
staging.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==
--- head/share/mk/bsd.subdir.mk Wed Jun 21 18:54:28 2017(r320202)
+++ head/share/mk/bsd.subdir.mk Wed Jun 21 18:56:53 2017(r320203)
@@ -53,7 +53,7 @@ STANDALONE_SUBDIR_TARGETS+= \
maninstall manlint obj objlink
 
 # It is safe to install in parallel when staging.
-.if defined(NO_ROOT)
+.if defined(NO_ROOT) || !empty(SYSROOT)
 STANDALONE_SUBDIR_TARGETS+= realinstall
 .endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r317591 - head/sys/dev/drm2/radeon

2017-06-21 Thread Andriy Gapon
On 10/06/2017 18:07, TAKAHASHI Yoshihiro wrote:
> In article <03e500d5-76b1-fd38-04c6-90d85a2dd...@freebsd.org>
> Andriy Gapon  writes:
> 
>> On 29/04/2017 12:47, Takahashi Yoshihiro wrote:
>>> Author: nyan
>>> Date: Sat Apr 29 09:47:15 2017
>>> New Revision: 317591
>>> URL: https://svnweb.freebsd.org/changeset/base/317591
>>>
>>> Log:
>>>   Add TUNABLE_INT to radeonkms driver parameters.
>>>   They are required by PowerMac G5 DP.
>>>   
>>>   PR:   217852
>>>   Submitted by: Hiroo Ono
>>>   MFC after:1 week
>>
>> I think that this solution that I had in my private tree is a little bit more
>> powerful:
>> https://people.freebsd.org/~avg/radeon_drv-knobs.diff
>>
>> The advantage is that it is less intrusive and also provides read-only 
>> sysctl in
>> addition to the tunables.
>> Also, hw.drm.radeon seems like a better place for the knobs than just 
>> drm.radeon.
>>
>> Do you mind if I commit this?
> 
> Sorry for late.
> 
> I don't mind that your suggestion.  But if you will commit the patch,
> I think that you should apply the same way to the i915 driver.

Ooh, I didn't realize that there was a precedent and that "drm" was already used
as a root for tunables.  So, not sure if I want to pursue this further...

Thank you!


-- 
Andriy Gapon
___
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: r320204 - head/sys/conf

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 19:55:26 2017
New Revision: 320204
URL: https://svnweb.freebsd.org/changeset/base/320204

Log:
  Fix various 'make *clean *all *install' combinations.
  
  This follows commits like r320174 in share/mk/bsd.dep.mk.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Jun 21 18:56:53 2017(r320203)
+++ head/sys/conf/kern.post.mk  Wed Jun 21 19:55:26 2017(r320204)
@@ -200,10 +200,10 @@ _meta_filemon=1
 # lookups.  For install, only do this if no other targets are specified.
 # Also skip generating or including .depend.* files if in meta+filemon mode
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
-.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
+.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \
+${.TARGETS:M*clean*} == ${.TARGETS} || \
 ${.TARGETS:M*install*} == ${.TARGETS} || \
-make(kernel-obj) || make(kernel-clean*) || \
-make(kernel-install*) || defined(_meta_filemon)
+defined(_meta_filemon)
 _SKIP_READ_DEPEND= 1
 .MAKE.DEPENDFILE=  /dev/null
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r320205 - head/share/mk

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 20:10:58 2017
New Revision: 320205
URL: https://svnweb.freebsd.org/changeset/base/320205

Log:
  Remove logic for setting .MAKE.DEPENDFILE=/dev/null already covered by 
_SKIP_BUILD.
  
  _SKIP_BUILD is defined in bsd.init.mk.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.dep.mk

Modified: head/share/mk/bsd.dep.mk
==
--- head/share/mk/bsd.dep.mkWed Jun 21 19:55:26 2017(r320204)
+++ head/share/mk/bsd.dep.mkWed Jun 21 20:10:58 2017(r320205)
@@ -89,8 +89,7 @@ _meta_filemon=1
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
 .if defined(_SKIP_BUILD) || defined(_meta_filemon)
 _SKIP_READ_DEPEND= 1
-.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir) || \
-make(obj) || (!make(all) && (make(clean*) || make(destroy*)))
+.if ${MK_DIRDEPS_BUILD} == "no"
 .MAKE.DEPENDFILE=  /dev/null
 .endif
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r320206 - head/lib/libsysdecode

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 23:01:18 2017
New Revision: 320206
URL: https://svnweb.freebsd.org/changeset/base/320206

Log:
  Follow-up r308602: Don't add missing headers to .depend.tables.h.
  
  This also avoids an error from egrep when a header is missing.  This can 
happen
  with something like WITHOUT_BLUETOOTH set when searching for
  $include_dir/netgraph/bluetooth/include/ng_btsocket.h.  The warning was
  not an error (from set -e) due to being on the left side of a pipe.  Now the
  all_headers list is only filled with existing headers.
  
  Reviewed by:  ngie
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libsysdecode/mktables

Modified: head/lib/libsysdecode/mktables
==
--- head/lib/libsysdecode/mktables  Wed Jun 21 20:10:58 2017
(r320205)
+++ head/lib/libsysdecode/mktables  Wed Jun 21 23:01:18 2017
(r320206)
@@ -65,6 +65,7 @@ gen_table()
else
filter="egrep -v"
fi
+   [ -e "${include_dir}/${file}" ] || return 0
all_headers="${all_headers:+${all_headers} }${file}"
cat <<_EOF_
 TABLE_START(${name})
___
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: r320207 - head/lib/libsysdecode

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Wed Jun 21 23:28:24 2017
New Revision: 320207
URL: https://svnweb.freebsd.org/changeset/base/320207

Log:
  Tweak r320206: Still create the TABLE but not the .depend entry for missing 
headers.
  
  X-MFC-With:   r320206
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libsysdecode/mktables

Modified: head/lib/libsysdecode/mktables
==
--- head/lib/libsysdecode/mktables  Wed Jun 21 23:01:18 2017
(r320206)
+++ head/lib/libsysdecode/mktables  Wed Jun 21 23:28:24 2017
(r320207)
@@ -65,18 +65,19 @@ gen_table()
else
filter="egrep -v"
fi
-   [ -e "${include_dir}/${file}" ] || return 0
-   all_headers="${all_headers:+${all_headers} }${file}"
cat <<_EOF_
 TABLE_START(${name})
 _EOF_
-   egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
-   $include_dir/$file | ${filter} ${excl} | \
-   awk '{ for (i = 1; i <= NF; i++) \
-   if ($i ~ /define/) \
-   break; \
-   ++i; \
-   printf "TABLE_ENTRY(%s)\n", $i }'
+   if [ -e "${include_dir}/${file}" ]; then
+   all_headers="${all_headers:+${all_headers} }${file}"
+   egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
+   $include_dir/$file | ${filter} ${excl} | \
+   awk '{ for (i = 1; i <= NF; i++) \
+   if ($i ~ /define/) \
+   break; \
+   ++i; \
+   printf "TABLE_ENTRY(%s)\n", $i }'
+   fi
 cat <<_EOF_
 TABLE_END
 
___
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: r320208 - head/sys/fs/nfsclient

2017-06-21 Thread Rick Macklem
Author: rmacklem
Date: Thu Jun 22 00:17:15 2017
New Revision: 320208
URL: https://svnweb.freebsd.org/changeset/base/320208

Log:
  Ensure that the credentials field of the NFSv4 client open structure is
  initialized.
  
  bdrewery@ has reported panics "newnfs_copycred: negative nfsc_ngroups".
  The only way I can see that this occurs is that the credentials field of
  the open structure gets used before being filled in.
  I am not sure quite how this happens, but for the file create case, the
  code is serialized via the vnode lock on the directory. If, somehow, a
  link to the same file gets created just after file creation, this might
  occur.
  
  This patch ensures that the credentials field is initialized to a reasonable
  set of credentials before the structure is linked into any list, so I
  this should ensure it is initialized before use.
  I am committing the patch now, since bdrewery@ notes that the panics
  are intermittent and it may be months before he knows if the patch fixes
  his problem.
  
  Reported by:  bdrewery
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Wed Jun 21 23:28:24 2017
(r320207)
+++ head/sys/fs/nfsclient/nfs_clstate.c Thu Jun 22 00:17:15 2017
(r320208)
@@ -133,7 +133,7 @@ static int nfscl_localconflict(struct nfsclclient *, u
 struct nfscllock *, u_int8_t *, struct nfscldeleg *, struct nfscllock **);
 static void nfscl_newopen(struct nfsclclient *, struct nfscldeleg *,
 struct nfsclowner **, struct nfsclowner **, struct nfsclopen **,
-struct nfsclopen **, u_int8_t *, u_int8_t *, int, int *);
+struct nfsclopen **, u_int8_t *, u_int8_t *, int, struct ucred *, int *);
 static int nfscl_moveopen(vnode_t , struct nfsclclient *,
 struct nfsmount *, struct nfsclopen *, struct nfsclowner *,
 struct nfscldeleg *, struct ucred *, NFSPROC_T *);
@@ -287,7 +287,7 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_in
 * Create a new open, as required.
 */
nfscl_newopen(clp, dp, &owp, &nowp, &op, &nop, own, nfhp, fhlen,
-   newonep);
+   cred, newonep);
 
/*
 * Now, check the mode on the open and return the appropriate
@@ -346,7 +346,7 @@ static void
 nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp,
 struct nfsclowner **owpp, struct nfsclowner **nowpp, struct nfsclopen 
**opp,
 struct nfsclopen **nopp, u_int8_t *own, u_int8_t *fhp, int fhlen,
-int *newonep)
+struct ucred *cred, int *newonep)
 {
struct nfsclowner *owp = *owpp, *nowp;
struct nfsclopen *op, *nop;
@@ -399,6 +399,8 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldel
nop->nfso_stateid.other[0] = 0;
nop->nfso_stateid.other[1] = 0;
nop->nfso_stateid.other[2] = 0;
+   KASSERT(cred != NULL, ("%s: cred NULL\n", __func__));
+   newnfs_copyincred(cred, &nop->nfso_cred);
if (dp != NULL) {
TAILQ_REMOVE(&clp->nfsc_deleg, dp, nfsdl_list);
TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp,
@@ -3970,7 +3972,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsm
M_WAITOK);
nfscl_newopen(clp, NULL, &owp, &nowp, &op, 
NULL, lowp->nfsow_owner, dp->nfsdl_fh,
-   dp->nfsdl_fhlen, NULL);
+   dp->nfsdl_fhlen, NULL, NULL);
newnfs_copycred(&dp->nfsdl_cred, cred);
ret = nfscl_moveopen(vp, clp, nmp, lop,
owp, dp, cred, p);
@@ -4052,7 +4054,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st
lop->nfso_fhlen - 1, M_NFSCLOPEN, M_WAITOK);
newone = 0;
nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner,
-   lop->nfso_fh, lop->nfso_fhlen, &newone);
+   lop->nfso_fh, lop->nfso_fhlen, cred, &newone);
ndp = dp;
error = nfscl_tryopen(nmp, vp, np->n_v4->n4_data, np->n_v4->n4_fhlen,
lop->nfso_fh, lop->nfso_fhlen, lop->nfso_mode, op,
@@ -4061,8 +4063,6 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st
if (newone)
nfscl_freeopen(op, 0);
} else {
-   if (newone)
-   newnfs_copyincred(cred, &op->nfso_cred);
op->nfso_mode |= lop->nfso_mode;
op->nfso_opencnt += lop->nfso_opencnt;
nfscl_freeopen(lop, 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscr

svn commit: r320209 - head/sys/fs/msdosfs

2017-06-21 Thread Ed Maste
Author: emaste
Date: Thu Jun 22 01:11:20 2017
New Revision: 320209
URL: https://svnweb.freebsd.org/changeset/base/320209

Log:
  msdosfs: reformat a comment to reduce NetBSD diffs

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Thu Jun 22 00:17:15 2017
(r320208)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Thu Jun 22 01:11:20 2017
(r320209)
@@ -999,14 +999,12 @@ extendfile(struct denode *dep, u_long count, struct bu
while (count > 0) {
/*
 * Allocate a new cluster chain and cat onto the end of the
-* file.
-* If the file is empty we make de_StartCluster point
-* to the new block.  Note that de_StartCluster being
-* 0 is sufficient to be sure the file is empty since
-* we exclude attempts to extend the root directory
-* above, and the root dir is the only file with a
-* startcluster of 0 that has blocks allocated (sort
-* of).
+* file.  If the file is empty we make de_StartCluster point
+* to the new block.  Note that de_StartCluster being 0 is
+* sufficient to be sure the file is empty since we exclude
+* attempts to extend the root directory above, and the root
+* dir is the only file with a startcluster of 0 that has
+* blocks allocated (sort of).
 */
if (dep->de_StartCluster == 0)
cn = 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: r320210 - head/usr.bin/join

2017-06-21 Thread Conrad Meyer
Author: cem
Date: Thu Jun 22 02:19:39 2017
New Revision: 320210
URL: https://svnweb.freebsd.org/changeset/base/320210

Log:
  join(1): Fix field ordering for -v output
  
  Per POSIX, join(1) (in modes other than -o) is a concatenation of selected
  character fields.  The joined field is first, followed by fields in the
  order they occurred in the input files.
  
  Our join(1) utility previously handled this correctly for lines with a match
  in the other file.  But it failed to order output fields correctly for
  unmatched lines, printed in -a and -v modes.
  
  A simple test case is:
  
  $ touch a
  $ echo "2 1" > b
  $ join -v2 -2 2 a b
  1 2
  
  PR:   217711
  Reported by:  alt.j2-4o4s2yon at yopmail.com
  Sponsored by: Dell EMC Isilon

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

Modified: head/usr.bin/join/join.c
==
--- head/usr.bin/join/join.cThu Jun 22 01:11:20 2017(r320209)
+++ head/usr.bin/join/join.cThu Jun 22 02:19:39 2017(r320210)
@@ -467,9 +467,15 @@ outoneline(INPUT *F, LINE *lp)
else
outfield(lp, 0, 1);
}
-   else
+   else {
+   /*
+* Output the join field, then the remaining fields.
+*/
+   outfield(lp, F->joinf, 0);
for (cnt = 0; cnt < lp->fieldcnt; ++cnt)
-   outfield(lp, cnt, 0);
+   if (F->joinf != cnt)
+   outfield(lp, cnt, 0);
+   }
(void)printf("\n");
if (ferror(stdout))
err(1, "stdout");
___
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: r320211 - head/sys/fs/ext2fs

2017-06-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jun 22 02:43:32 2017
New Revision: 320211
URL: https://svnweb.freebsd.org/changeset/base/320211

Log:
  ext2fs: add dir_nlink feature support.
  
  ext4 on linux has always supported more than 32000 directories through
  the dir_nlink feature, but FreeBSD was unable to catch up on this feature.
  As part of the 64 bit inode changes nlink_t has been extended and this
  feature is now possible.
  
  Submitted by: Fedor Uporov
  Differential Revision:https://reviews.freebsd.org/D11210

Modified:
  head/sys/fs/ext2fs/ext2_dir.h
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/ext2fs/ext2fs.h
  head/sys/fs/ext2fs/inode.h

Modified: head/sys/fs/ext2fs/ext2_dir.h
==
--- head/sys/fs/ext2fs/ext2_dir.h   Thu Jun 22 02:19:39 2017
(r320210)
+++ head/sys/fs/ext2fs/ext2_dir.h   Thu Jun 22 02:43:32 2017
(r320211)
@@ -74,6 +74,7 @@ struct ext2fs_direct_2 {
  * Maximal count of links to a file
  */
 #defineEXT2_LINK_MAX   32000
+#defineEXT4_LINK_MAX   65000
 
 /*
  * Ext2 directory file types.  Only the low 3 bits are used.  The

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Thu Jun 22 02:19:39 2017
(r320210)
+++ head/sys/fs/ext2fs/ext2_vnops.c Thu Jun 22 02:43:32 2017
(r320211)
@@ -672,6 +672,19 @@ out:
return (error);
 }
 
+static unsigned short
+ext2_max_nlink(struct inode *ip)
+{
+   struct m_ext2fs *fs;
+
+   fs = ip->i_e2fs;
+
+   if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_DIR_NLINK))
+   return (EXT4_LINK_MAX);
+   else
+   return (EXT2_LINK_MAX);
+}
+
 /*
  * link vnode call
  */
@@ -689,7 +702,7 @@ ext2_link(struct vop_link_args *ap)
panic("ext2_link: no name");
 #endif
ip = VTOI(vp);
-   if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) {
+   if ((nlink_t)ip->i_nlink >= ext2_max_nlink(ip)) {
error = EMLINK;
goto out;
}
@@ -710,6 +723,31 @@ out:
return (error);
 }
 
+static int
+ext2_inc_nlink(struct inode *ip)
+{
+
+   ip->i_nlink++;
+
+   if (ext2_htree_has_idx(ip) && ip->i_nlink > 1) {
+   if (ip->i_nlink >= ext2_max_nlink(ip) || ip->i_nlink == 2)
+   ip->i_nlink = 1;
+   } else if (ip->i_nlink > ext2_max_nlink(ip)) {
+   ip->i_nlink--;
+   return (EMLINK);
+   }
+
+   return (0);
+}
+
+static void
+ext2_dec_nlink(struct inode *ip)
+{
+
+   if (!S_ISDIR(ip->i_mode) || ip->i_nlink > 2)
+   ip->i_nlink--;
+}
+
 /*
  * Rename system call.
  * rename("foo", "bar");
@@ -792,7 +830,7 @@ abortit:
goto abortit;
dp = VTOI(fdvp);
ip = VTOI(fvp);
-   if (ip->i_nlink >= EXT2_LINK_MAX) {
+   if (ip->i_nlink >= ext2_max_nlink(ip) && !ext2_htree_has_idx(ip)) {
VOP_UNLOCK(fvp, 0);
error = EMLINK;
goto abortit;
@@ -835,7 +873,7 @@ abortit:
 *completing our work, the link count
 *may be wrong, but correctable.
 */
-   ip->i_nlink++;
+   ext2_inc_nlink(ip);
ip->i_flag |= IN_CHANGE;
if ((error = ext2_update(fvp, !DOINGASYNC(fvp))) != 0) {
VOP_UNLOCK(fvp, 0);
@@ -890,11 +928,10 @@ abortit:
 * parent we don't fool with the link count.
 */
if (doingdirectory && newparent) {
-   if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) {
-   error = EMLINK;
+   error = ext2_inc_nlink(dp);
+   if (error)
goto bad;
-   }
-   dp->i_nlink++;
+
dp->i_flag |= IN_CHANGE;
error = ext2_update(tdvp, !DOINGASYNC(tdvp));
if (error)
@@ -903,7 +940,7 @@ abortit:
error = ext2_direnter(ip, tdvp, tcnp);
if (error) {
if (doingdirectory && newparent) {
-   dp->i_nlink--;
+   ext2_dec_nlink(dp);
dp->i_flag |= IN_CHANGE;
(void)ext2_update(tdvp, 1);
}
@@ -936,8 +973,7 @@ abortit:
 * (both directories, or both not directories).
 */
if ((xp->i_mode & IFMT) == IFDIR) {
-   if (!ext2_dirempty(xp, dp->i_number, tcnp->cn_cred) ||
-   xp->i_nlink > 2) {
+   if (!ext2_dirempty(xp, dp->i_number, tcnp->cn_cred)) {
error = ENOTEMPTY;
goto bad;
}
@@ -960,7 +996,7 @

svn commit: r320212 - head/usr.sbin/makefs/msdos

2017-06-21 Thread Ed Maste
Author: emaste
Date: Thu Jun 22 02:46:36 2017
New Revision: 320212
URL: https://svnweb.freebsd.org/changeset/base/320212

Log:
  makefs: add copies of NetBSD makefs msdos source files
  
  We do not treat makefs as contrib code.  Import copies of makefs msdos
  files from NetBSD so that we can track our changes to these files.
  
  These are copied from NetBSD, with only a change to use __FBSDID and
  $FreeBSD$ instead of __KERNEL_RCSID and $NetBSD$.  A copy of the
  original $NetBSD$ tag remains in each source file.
  
  Submitted by: Siva Mahadevan
  Sponsored by: The FreeBSD Foundation

Added:
  head/usr.sbin/makefs/msdos/
  head/usr.sbin/makefs/msdos/msdosfs_denode.c   (contents, props changed)
  head/usr.sbin/makefs/msdos/msdosfs_vfsops.c   (contents, props changed)
  head/usr.sbin/makefs/msdos/msdosfs_vnops.c   (contents, props changed)

Added: head/usr.sbin/makefs/msdos/msdosfs_denode.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/makefs/msdos/msdosfs_denode.c Thu Jun 22 02:46:36 2017
(r320212)
@@ -0,0 +1,363 @@
+/* $NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $   */
+
+/*-
+ * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
+ * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
+ * All rights reserved.
+ * Original code by Paul Popelka (pa...@uts.amdahl.com) (see below).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ * This product includes software developed by TooLs GmbH.
+ * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Written by Paul Popelka (pa...@uts.amdahl.com)
+ *
+ * You can do anything you want with this software, just don't say you wrote
+ * it, and don't remove this notice.
+ *
+ * This software is provided "as is".
+ *
+ * The author supplies this software to be publicly redistributed on the
+ * understanding that the author is not responsible for the correct
+ * functioning of this software in any circumstances and is not liable for
+ * any damages caused by this software.
+ *
+ * October 1992
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * If deget() succeeds it returns with the gotten denode locked().
+ *
+ * pmp  - address of msdosfsmount structure of the filesystem containing
+ *the denode of interest.  The pm_dev field and the address of
+ *the msdosfsmount structure are used.
+ * dirclust  - which cluster bp contains, if dirclust is 0 (root directory)
+ *diroffset is relative to the beginning of the root directory,
+ *otherwise it is cluster relative.
+ * diroffset - offset past begin of cluster of denode we want
+ * depp - returns the address of the gotten denode.
+ */
+int
+deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
+struct denode **depp)
+   /* pmp:  so we know the maj/min number */
+   /* dirclust: cluster this dir entry came from */
+   /* diroffset:index of entry within the cluster */
+   /* depp: returns the addr of the gotten denode */
+{
+   int error;
+   struct direntry *direntptr;
+   struct denode *ldep;
+   struct buf *bp;
+
+#ifdef MSDOSFS_DEBUG
+   printf("deget(pmp %p, dirclust %lu, diroffset %lx, depp %p)\n",
+   pmp, dirclust, diroffset, dep

svn commit: r320216 - head/lib/libc/rpc

2017-06-21 Thread Xin LI
Author: delphij
Date: Thu Jun 22 05:10:16 2017
New Revision: 320216
URL: https://svnweb.freebsd.org/changeset/base/320216

Log:
  Fix use-after-free introduced in r300388.
  
  In r300388, endnetconfig() was called on nc_handle which would release
  the associated netconfig structure, which means tmpnconf->nc_netid
  would be a use-after-free.
  
  Solve this by doing endnetconfig() in return paths instead.
  
  Reported by:  jemalloc via kevlo
  Reviewed by:  cem, ngie (earlier version)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D11288

Modified:
  head/lib/libc/rpc/rpcb_clnt.c

Modified: head/lib/libc/rpc/rpcb_clnt.c
==
--- head/lib/libc/rpc/rpcb_clnt.c   Thu Jun 22 04:40:11 2017
(r320215)
+++ head/lib/libc/rpc/rpcb_clnt.c   Thu Jun 22 05:10:16 2017
(r320216)
@@ -499,14 +499,15 @@ try_nconf:
hostname = IN6_LOCALHOST_STRING;
}
}
-   endnetconfig(nc_handle);
if (tmpnconf == NULL) {
+   endnetconfig(nc_handle);
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
mutex_unlock(&loopnconf_lock);
return (NULL);
}
loopnconf = getnetconfigent(tmpnconf->nc_netid);
/* loopnconf is never freed */
+   endnetconfig(nc_handle);
}
mutex_unlock(&loopnconf_lock);
client = getclnthandle(hostname, loopnconf, 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: r320220 - in head: share/mk sys/conf

2017-06-21 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jun 22 05:34:41 2017
New Revision: 320220
URL: https://svnweb.freebsd.org/changeset/base/320220

Log:
  Rework logic for skipping .depend/.meta file read/stat/writes.
  
  - Rename _SKIP_READ_DEPEND to _SKIP_DEPEND since it also avoids writing.
  - This now uses .NOMETA to avoid reading any .meta files related to
DEPENDOBJS.  Objects not in OBJS/DEPENDOBJS may still have their .meta
files read in if they are in the dependency graph.
  - This also avoids statting .meta and .depend files in the META_MODE +
-DNO_FILEMON case.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.dep.mk
  head/sys/conf/kern.post.mk

Modified: head/share/mk/bsd.dep.mk
==
--- head/share/mk/bsd.dep.mkThu Jun 22 05:30:27 2017(r320219)
+++ head/share/mk/bsd.dep.mkThu Jun 22 05:34:41 2017(r320220)
@@ -86,10 +86,13 @@ _meta_filemon=  1
 # Skip reading .depend when not needed to speed up tree-walks and simple
 # lookups.  See _SKIP_BUILD logic in bsd.init.mk for more details.
 # Also skip generating or including .depend.* files if in meta+filemon mode
-# since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
-.if defined(_SKIP_BUILD) || defined(_meta_filemon)
-_SKIP_READ_DEPEND= 1
+# since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used
+# for _meta_filemon but not for _SKIP_DEPEND.
+.if defined(_SKIP_BUILD)
+_SKIP_DEPEND=  1
+.endif
 .if ${MK_DIRDEPS_BUILD} == "no"
+.if defined(_SKIP_DEPEND) || defined(_meta_filemon)
 .MAKE.DEPENDFILE=  /dev/null
 .endif
 .endif
@@ -180,6 +183,15 @@ DEPENDSRCS=${SRCS:M*.[cSC]} ${SRCS:M*.cxx} 
${SRCS:M*.
 DEPENDOBJS+=   ${DEPENDSRCS:R:S,$,.o,}
 .endif
 DEPENDFILES_OBJS=  ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
+.if defined(_SKIP_DEPEND)
+# Don't bother statting any .meta files for .depend*
+${DEPENDOBJS}: .NOMETA
+${DEPENDFILE}: .NOMETA
+# Unset these to avoid looping/statting on them later.
+.undef DEPENDSRCS
+.undef DEPENDOBJS
+.undef DEPENDFILES_OBJS
+.endif # defined(_SKIP_DEPEND)
 DEPEND_CFLAGS+=-MD ${DEPEND_MP} 
-MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
 DEPEND_CFLAGS+=-MT${.TARGET}
 .if !defined(_meta_filemon)
@@ -191,7 +203,6 @@ CFLAGS+=${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS
 .else
 CFLAGS+=   ${DEPEND_CFLAGS}
 .endif
-.if !defined(_SKIP_READ_DEPEND)
 .for __depend_obj in ${DEPENDFILES_OBJS}
 .if ${MAKE_VERSION} < 20160220
 .sinclude "${.OBJDIR}/${__depend_obj}"
@@ -199,7 +210,6 @@ CFLAGS+=${DEPEND_CFLAGS}
 .dinclude "${.OBJDIR}/${__depend_obj}"
 .endif
 .endfor
-.endif # !defined(_SKIP_READ_DEPEND)
 .endif # !defined(_meta_filemon)
 .endif # defined(SRCS)
 
@@ -266,11 +276,13 @@ DPSRCS+= ${SRCS}
 # targets are kept as they be used for generating something.  The target is
 # kept to allow 'make depend' to generate files.
 ${DEPENDFILE}: ${DPSRCS}
+.if !defined(_SKIP_DEPEND)
 .if exists(${.OBJDIR}/${DEPENDFILE}) || \
 ((commands(beforedepend) || \
 (!defined(_meta_filemon) && commands(_EXTRADEPEND)) || \
 commands(afterdepend)) && !empty(.MAKE.MODE:Mmeta))
rm -f ${DEPENDFILE}
+.endif
 .endif
 .if !defined(_meta_filemon) && target(_EXTRADEPEND)
 _EXTRADEPEND: .USE

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Thu Jun 22 05:30:27 2017(r320219)
+++ head/sys/conf/kern.post.mk  Thu Jun 22 05:34:41 2017(r320220)
@@ -199,12 +199,15 @@ _meta_filemon=1
 # Skip reading .depend when not needed to speed up tree-walks and simple
 # lookups.  For install, only do this if no other targets are specified.
 # Also skip generating or including .depend.* files if in meta+filemon mode
-# since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
+# since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used
+# for _meta_filemon but not for _SKIP_DEPEND.
 .if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \
 ${.TARGETS:M*clean*} == ${.TARGETS} || \
 ${.TARGETS:M*install*} == ${.TARGETS} || \
 defined(_meta_filemon)
-_SKIP_READ_DEPEND= 1
+_SKIP_DEPEND=  1
+.endif
+.if defined(_SKIP_DEPEND) || defined(_meta_filemon)
 .MAKE.DEPENDFILE=  /dev/null
 .endif
 
@@ -218,6 +221,15 @@ DEPENDFILES_OBJS=  ${DEPENDOBJS:O:u:C/^/.depend./}
 .if ${MAKE_VERSION} < 20160220
 DEPEND_MP?=-MP
 .endif
+.if defined(_SKIP_DEPEND)
+# Don't bother reading any .meta files
+${DEPENDOBJS}: .NOMETA
+.depend:   .NOMETA
+# Unset these to avoid looping/statting on them later.
+.undef DEPENDSRCS
+.undef DEPENDOBJS
+.undef DEPENDFILES_OBJS
+.endif # defined(_SKIP_DEPEND)
 DEPEND_CFLAGS+=-MD ${DEPEND_MP} -MF.depend.${.TARGET}
 DEPEND_CFLAGS+=-MT${.TARGET}
 .if !defined(_meta_filemon)
@@ -229,7 +241,6 @@ CFLAGS+=${${DEPEND_CFLAGS_CONDITION}

svn commit: r320221 - head/contrib/ipfilter/tools

2017-06-21 Thread Cy Schubert
Author: cy
Date: Thu Jun 22 06:25:34 2017
New Revision: 320221
URL: https://svnweb.freebsd.org/changeset/base/320221

Log:
  poolflush() has no positional arguments.

Modified:
  head/contrib/ipfilter/tools/ippool.c

Modified: head/contrib/ipfilter/tools/ippool.c
==
--- head/contrib/ipfilter/tools/ippool.cThu Jun 22 05:34:41 2017
(r320220)
+++ head/contrib/ipfilter/tools/ippool.cThu Jun 22 06:25:34 2017
(r320221)
@@ -583,7 +583,7 @@ poolflush(argc, argv)
break;  /* keep compiler happy */
}
 
-   if (argc - 1 - optind > 0)
+   if (argc - optind > 0)
usage(argv[0]);
 
if (opts & OPT_DEBUG)
___
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"