svn commit: r350322 - head

2019-07-25 Thread Li-Wen Hsu
Author: lwhsu
Date: Thu Jul 25 07:57:01 2019
New Revision: 350322
URL: https://svnweb.freebsd.org/changeset/base/350322

Log:
  Workaround the build failure on platforms have lib32 after r350301
  
  Error message:
  
  make[5]: make[5]: don't know how to make 
/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/sys/netinet/in.h. Stop
  
  make[5]: stopped in /usr/src/lib/libsysdecode
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/Makefile.libcompat

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Jul 25 06:48:30 2019(r350321)
+++ head/Makefile.libcompat Thu Jul 25 07:57:01 2019(r350322)
@@ -186,6 +186,7 @@ build${libcompat}: .PHONY
 .endif
mkdir -p ${WORLDTMP}
ln -sf ${.CURDIR}/sys ${WORLDTMP}
+   ln -sf ${.CURDIR}/sys ${LIBCOMPATTMP}
 .for _t in ${_obj} includes
 .for _dir in ${_LC_INCDIRS}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
___
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: r349976 - head

2019-07-25 Thread Renato Botelho
On 13/07/19 13:48, Ian Lepore wrote:
> Author: ian
> Date: Sat Jul 13 16:48:27 2019
> New Revision: 349976
> URL: https://svnweb.freebsd.org/changeset/base/349976
> 
> Log:
>   Add an entry mentioning the permission/mode change to daily accounting 
> files.
> 
> Modified:
>   head/UPDATING
> 
> Modified: head/UPDATING
> ==
> --- head/UPDATING Sat Jul 13 16:32:19 2019(r349975)
> +++ head/UPDATING Sat Jul 13 16:48:27 2019(r349976)
> @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
>   disable the most expensive debugging functionality run
>   "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>  
> +20190713:
> +Default permissions on the /var/account/acct file (and copies of it 
> rotated 
> +by periodic daily scripts) are changed from 0644 to 0640 because the 
> file 
> +contains sensitive information that should not be world-readable.  If 
> the 
> +/var/account directory must be created by rc.d/accounting, the mode used 
> is 
> +now 0750.  Admins who use the accounting feature are encouraged to 
> change 
> +the mode of an existing /var/account directory to 0750 or 0700.  

Block is indented with 4 spaces instead of tabs

-- 
Renato Botelho



signature.asc
Description: OpenPGP digital signature


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

2019-07-25 Thread Leandro Lupori
Author: luporl
Date: Thu Jul 25 15:27:05 2019
New Revision: 350323
URL: https://svnweb.freebsd.org/changeset/base/350323

Log:
  powerpc: Improve pvo allocation code
  
  Added allocation retry loop in alloc_pvo_entry(), to wait for
  memory to become available if the caller specifies the M_WAITOK flag.
  
  Also, the loop in moa64_enter() was removed, as moea64_pvo_enter()
  never returns ENOMEM. It is alloc_pvo_entry() memory allocation that
  can fail and must be retried.
  
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D21035

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

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Jul 25 07:57:01 2019
(r350322)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Jul 25 15:27:05 2019
(r350323)
@@ -373,24 +373,28 @@ vm_page_to_pvoh(vm_page_t m)
 }
 
 static struct pvo_entry *
-alloc_pvo_entry(int bootstrap)
+alloc_pvo_entry(int bootstrap, int flags)
 {
struct pvo_entry *pvo;
 
+   KASSERT(bootstrap || (flags & M_WAITOK) || (flags & M_NOWAIT),
+   ("Either M_WAITOK or M_NOWAIT flag must be specified "
+"when bootstrap is 0"));
+   KASSERT(!bootstrap || !(flags & M_WAITOK),
+   ("M_WAITOK can't be used with bootstrap"));
+
if (!moea64_initialized || bootstrap) {
if (moea64_bpvo_pool_index >= moea64_bpvo_pool_size) {
panic("moea64_enter: bpvo pool exhausted, %d, %d, %zd",
- moea64_bpvo_pool_index, moea64_bpvo_pool_size, 
+ moea64_bpvo_pool_index, moea64_bpvo_pool_size,
  moea64_bpvo_pool_size * sizeof(struct pvo_entry));
}
pvo = &moea64_bpvo_pool[
atomic_fetchadd_int(&moea64_bpvo_pool_index, 1)];
bzero(pvo, sizeof(*pvo));
pvo->pvo_vaddr = PVO_BOOTSTRAP;
-   } else {
-   pvo = uma_zalloc(moea64_pvo_zone, M_NOWAIT);
-   bzero(pvo, sizeof(*pvo));
-   }
+   } else
+   pvo = uma_zalloc(moea64_pvo_zone, flags | M_ZERO);
 
return (pvo);
 }
@@ -658,7 +662,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel
 pregions[i].mr_size; pa += moea64_large_page_size) {
pte_lo = LPTE_M;
 
-   pvo = alloc_pvo_entry(1 /* bootstrap */);
+   pvo = alloc_pvo_entry(1 /* bootstrap */, 0);
pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE;
init_pvo_entry(pvo, kernel_pmap, PHYS_TO_DMAP(pa));
 
@@ -1399,7 +1403,9 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m))
VM_OBJECT_ASSERT_LOCKED(m->object);
 
-   pvo = alloc_pvo_entry(0);
+   pvo = alloc_pvo_entry(0, M_NOWAIT);
+   if (pvo == NULL)
+   return (KERN_RESOURCE_SHORTAGE);
pvo->pvo_pmap = NULL; /* to be filled in later */
pvo->pvo_pte.prot = prot;
 
@@ -1415,61 +1421,53 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v
pvo_head = &m->md.mdpg_pvoh;
pvo->pvo_vaddr |= PVO_MANAGED;
}
-   
-   for (;;) {
-   PV_PAGE_LOCK(m);
-   PMAP_LOCK(pmap);
-   if (pvo->pvo_pmap == NULL)
-   init_pvo_entry(pvo, pmap, va);
-   if (prot & VM_PROT_WRITE)
-   if (pmap_bootstrapped &&
-   (m->oflags & VPO_UNMANAGED) == 0)
-   vm_page_aflag_set(m, PGA_WRITEABLE);
 
-   error = moea64_pvo_enter(mmu, pvo, pvo_head, &oldpvo);
-   if (error == EEXIST) {
-   if (oldpvo->pvo_vaddr == pvo->pvo_vaddr &&
-   oldpvo->pvo_pte.pa == pvo->pvo_pte.pa &&
-   oldpvo->pvo_pte.prot == prot) {
-   /* Identical mapping already exists */
-   error = 0;
+   PV_PAGE_LOCK(m);
+   PMAP_LOCK(pmap);
+   if (pvo->pvo_pmap == NULL)
+   init_pvo_entry(pvo, pmap, va);
+   if (prot & VM_PROT_WRITE)
+   if (pmap_bootstrapped &&
+   (m->oflags & VPO_UNMANAGED) == 0)
+   vm_page_aflag_set(m, PGA_WRITEABLE);
 
-   /* If not in page table, reinsert it */
-   if (MOEA64_PTE_SYNCH(mmu, oldpvo) < 0) {
-   STAT_MOEA64(moea64_pte_overflow--);
-   MOEA64_PTE_INSERT(mmu, oldpvo);
-   }
+   error = moea64_pvo_enter(mmu, pvo, pvo_head, &oldpvo);
+   if (error == EEXIST) {
+   if (oldpvo->pvo_vaddr =

svn commit: r350324 - head

2019-07-25 Thread Ian Lepore
Author: ian
Date: Thu Jul 25 15:31:15 2019
New Revision: 350324
URL: https://svnweb.freebsd.org/changeset/base/350324

Log:
  Fix indentation (spaces->tab).
  
  Reported by:  garga@

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu Jul 25 15:27:05 2019(r350323)
+++ head/UPDATING   Thu Jul 25 15:31:15 2019(r350324)
@@ -27,12 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 20190713:
-Default permissions on the /var/account/acct file (and copies of it 
rotated 
-by periodic daily scripts) are changed from 0644 to 0640 because the file 
-contains sensitive information that should not be world-readable.  If the 
-/var/account directory must be created by rc.d/accounting, the mode used 
is 
-now 0750.  Admins who use the accounting feature are encouraged to change 
-the mode of an existing /var/account directory to 0750 or 0700.  
+   Default permissions on the /var/account/acct file (and copies of it 
rotated 
+   by periodic daily scripts) are changed from 0644 to 0640 because the 
file 
+   contains sensitive information that should not be world-readable.  If 
the 
+   /var/account directory must be created by rc.d/accounting, the mode 
used is 
+   now 0750.  Admins who use the accounting feature are encouraged to 
change 
+   the mode of an existing /var/account directory to 0750 or 0700.  
 
 20190620:
Entropy collection and the /dev/random device are no longer optional
___
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: r349976 - head

2019-07-25 Thread Ian Lepore
On Thu, 2019-07-25 at 10:27 -0300, Renato Botelho wrote:
> On 13/07/19 13:48, Ian Lepore wrote:
> > Author: ian
> > Date: Sat Jul 13 16:48:27 2019
> > New Revision: 349976
> > URL: https://svnweb.freebsd.org/changeset/base/349976
> > 
> > Log:
> >   Add an entry mentioning the permission/mode change to daily
> > accounting files.
> > 
> > Modified:
> >   head/UPDATING
> > 
> > Modified: head/UPDATING
> > ===
> > ===
> > --- head/UPDATING   Sat Jul 13 16:32:19 2019(r349975)
> > +++ head/UPDATING   Sat Jul 13 16:48:27 2019(r349976)
> > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS
> > SLOW:
> > disable the most expensive debugging functionality run
> > "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
> >  
> > +20190713:
> > +Default permissions on the /var/account/acct file (and copies
> > of it rotated 
> > +by periodic daily scripts) are changed from 0644 to 0640
> > because the file 
> > +contains sensitive information that should not be world-
> > readable.  If the 
> > +/var/account directory must be created by rc.d/accounting, the
> > mode used is 
> > +now 0750.  Admins who use the accounting feature are
> > encouraged to change 
> > +the mode of an existing /var/account directory to 0750 or
> > 0700.  
> 
> Block is indented with 4 spaces instead of tabs
> 

Doh!  Must've still had my editor set for the $work coding standards. 
Fixed in r350324.  Thanks!

-- Ian

___
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: r350325 - in head: lib/libc/sys share/man/man9

2019-07-25 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Thu Jul 25 15:43:15 2019
New Revision: 350325
URL: https://svnweb.freebsd.org/changeset/base/350325

Log:
  Fix grammar nit in copy_file_range docs
  
  Bytes are countable, so we have fewer of them, not less of them.

Modified:
  head/lib/libc/sys/copy_file_range.2
  head/share/man/man9/VOP_COPY_FILE_RANGE.9

Modified: head/lib/libc/sys/copy_file_range.2
==
--- head/lib/libc/sys/copy_file_range.2 Thu Jul 25 15:31:15 2019
(r350324)
+++ head/lib/libc/sys/copy_file_range.2 Thu Jul 25 15:43:15 2019
(r350325)
@@ -110,7 +110,7 @@ arguments and this system call for the
 data ranges found.
 .Pp
 .Sh RETURN VALUES
-If it succeeds, the call returns the number of bytes copied, which can be less
+If it succeeds, the call returns the number of bytes copied, which can be fewer
 than
 .Fa len .
 .Fn copy_file_range

Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9
==
--- head/share/man/man9/VOP_COPY_FILE_RANGE.9   Thu Jul 25 15:31:15 2019
(r350324)
+++ head/share/man/man9/VOP_COPY_FILE_RANGE.9   Thu Jul 25 15:43:15 2019
(r350325)
@@ -93,7 +93,7 @@ It should be reduced by the number of bytes copied, wh
 the value pointed to by
 .Fa len
 will normally be zero for a non-error return.
-However, a copy of less bytes than requested is permitted.
+However, a copy of fewer bytes than requested is permitted.
 .Sh LOCKS
 The vnode are unlocked on entry and must be unlocked on return.
 The byte ranges for both
___
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: r350315 - in head/sys: kern sys

2019-07-25 Thread Shawn Webb
Hey Rick,

On Thu, Jul 25, 2019 at 05:46:17AM +, Rick Macklem wrote:
> Author: rmacklem
> Date: Thu Jul 25 05:46:16 2019
> New Revision: 350315
> URL: https://svnweb.freebsd.org/changeset/base/350315
> 
> Log:
>   Add kernel support for a Linux compatible copy_file_range(2) syscall.
>   
>   This patch adds support to the kernel for a Linux compatible
>   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
>   This syscall/VOP can be used by the NFSv4.2 client to implement the
>   Copy operation against an NFSv4.2 server to do file copies locally on
>   the server.
>   The vn_generic_copy_file_range() function in this patch can be used
>   by the NFSv4.2 server to implement the Copy operation.
>   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
>   
>   vn_generic_copy_file_range() attempts to maintain holes in the output
>   file in the range to be copied, but may fail to do so if the input and
>   output files are on different file systems with different _PC_MIN_HOLE_SIZE
>   values.
>   
>   Separate commits will be done for the generated syscall files and userland
>   changes. A commit for a compat32 syscall will be done later.
>   
>   Reviewed by:kib, asomers (plus comments by brooks, jilles)
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D20584
> 
> Modified:
>   head/sys/kern/syscalls.master
>   head/sys/kern/vfs_default.c
>   head/sys/kern/vfs_syscalls.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/kern/vnode_if.src
>   head/sys/sys/syscallsubr.h
>   head/sys/sys/vnode.h
> 
> Modified: head/sys/kern/syscalls.master
> ==
> --- head/sys/kern/syscalls.master Thu Jul 25 03:55:05 2019
> (r350314)
> +++ head/sys/kern/syscalls.master Thu Jul 25 05:46:16 2019
> (r350315)
> @@ -3175,6 +3175,16 @@
>   int flag
>   );
>   }
> +569  AUE_NULLSTD {
> + ssize_t copy_file_range(
> + int infd,
> + _Inout_opt_ off_t *inoffp,
> + int outfd,
> + _Inout_opt_ off_t *outoffp,
> + size_t len,
> + unsigned int flags
> + );
> + }
>  
>  ; Please copy any additions and changes to the following compatability 
> tables:
>  ; sys/compat/freebsd32/syscalls.master
> 
> Modified: head/sys/kern/vfs_default.c
> ==
> --- head/sys/kern/vfs_default.c   Thu Jul 25 03:55:05 2019
> (r350314)
> +++ head/sys/kern/vfs_default.c   Thu Jul 25 05:46:16 2019
> (r350315)
> @@ -83,6 +83,7 @@ static int  dirent_exists(struct vnode *vp, const char 
>  static int vop_stdis_text(struct vop_is_text_args *ap);
>  static int vop_stdunset_text(struct vop_unset_text_args *ap);
>  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
>  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
>  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
>  
> @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops = {
>   .vop_set_text = vop_stdset_text,
>   .vop_unset_text =   vop_stdunset_text,
>   .vop_add_writecount =   vop_stdadd_writecount,
> + .vop_copy_file_range =  vop_stdcopy_file_range,
>  };
>  
>  /*
> @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
>  {
>  
>   return (0);
> +}
> +
> +static int
> +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> +{
> + int error;
> +
> + error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> + ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_incred,
> + ap->a_outcred, ap->a_fsizetd);
> + return (error);
>  }
>  
>  int
> 
> Modified: head/sys/kern/vfs_syscalls.c
> ==
> --- head/sys/kern/vfs_syscalls.c  Thu Jul 25 03:55:05 2019
> (r350314)
> +++ head/sys/kern/vfs_syscalls.c  Thu Jul 25 05:46:16 2019
> (r350315)
> @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct posix_fadv
>   uap->advice);
>   return (kern_posix_error(td, error));
>  }
> +
> +int
> +kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd,
> +off_t *outoffp, size_t len, unsigned int flags)
> +{
> + struct file *infp, *outfp;
> + struct vnode *invp, *outvp;
> + int error;
> + size_t retlen;
> + void *rl_rcookie, *rl_wcookie;
> + off_t savinoff, savoutoff;
> +
> + infp = outfp = NULL;
> + rl_rcookie = rl_wcookie = NULL;
> + savinoff = -1;
> + error = 0;
> + retlen = 0;
> +
> + if (flags != 0) {
> + error = EINVAL;
> + goto out;
> + }
> + if (len > SSIZE_MAX)
> + /*
> + 

Re: svn commit: r350315 - in head/sys: kern sys

2019-07-25 Thread Kyle Evans
On Thu, Jul 25, 2019 at 11:46 AM Shawn Webb  wrote:
>
> Hey Rick,
>
> On Thu, Jul 25, 2019 at 05:46:17AM +, Rick Macklem wrote:
> > Author: rmacklem
> > Date: Thu Jul 25 05:46:16 2019
> > New Revision: 350315
> > URL: https://svnweb.freebsd.org/changeset/base/350315
> >
> > Log:
> >   Add kernel support for a Linux compatible copy_file_range(2) syscall.
> >
> >   This patch adds support to the kernel for a Linux compatible
> >   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
> >   This syscall/VOP can be used by the NFSv4.2 client to implement the
> >   Copy operation against an NFSv4.2 server to do file copies locally on
> >   the server.
> >   The vn_generic_copy_file_range() function in this patch can be used
> >   by the NFSv4.2 server to implement the Copy operation.
> >   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
> >
> >   vn_generic_copy_file_range() attempts to maintain holes in the output
> >   file in the range to be copied, but may fail to do so if the input and
> >   output files are on different file systems with different 
> > _PC_MIN_HOLE_SIZE
> >   values.
> >
> >   Separate commits will be done for the generated syscall files and userland
> >   changes. A commit for a compat32 syscall will be done later.
> >
> >   Reviewed by:kib, asomers (plus comments by brooks, jilles)
> >   Relnotes:   yes
> >   Differential Revision:  https://reviews.freebsd.org/D20584
> >
> > Modified:
> >   head/sys/kern/syscalls.master
> >   head/sys/kern/vfs_default.c
> >   head/sys/kern/vfs_syscalls.c
> >   head/sys/kern/vfs_vnops.c
> >   head/sys/kern/vnode_if.src
> >   head/sys/sys/syscallsubr.h
> >   head/sys/sys/vnode.h
> >
> > Modified: head/sys/kern/syscalls.master
> > ==
> > --- head/sys/kern/syscalls.master Thu Jul 25 03:55:05 2019
> > (r350314)
> > +++ head/sys/kern/syscalls.master Thu Jul 25 05:46:16 2019
> > (r350315)
> > @@ -3175,6 +3175,16 @@
> >   int flag
> >   );
> >   }
> > +569  AUE_NULLSTD {
> > + ssize_t copy_file_range(
> > + int infd,
> > + _Inout_opt_ off_t *inoffp,
> > + int outfd,
> > + _Inout_opt_ off_t *outoffp,
> > + size_t len,
> > + unsigned int flags
> > + );
> > + }
> >
> >  ; Please copy any additions and changes to the following compatability 
> > tables:
> >  ; sys/compat/freebsd32/syscalls.master
> >
> > Modified: head/sys/kern/vfs_default.c
> > ==
> > --- head/sys/kern/vfs_default.c   Thu Jul 25 03:55:05 2019
> > (r350314)
> > +++ head/sys/kern/vfs_default.c   Thu Jul 25 05:46:16 2019
> > (r350315)
> > @@ -83,6 +83,7 @@ static int  dirent_exists(struct vnode *vp, const char
> >  static int vop_stdis_text(struct vop_is_text_args *ap);
> >  static int vop_stdunset_text(struct vop_unset_text_args *ap);
> >  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> > +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
> >  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
> >  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
> >
> > @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops = {
> >   .vop_set_text = vop_stdset_text,
> >   .vop_unset_text =   vop_stdunset_text,
> >   .vop_add_writecount =   vop_stdadd_writecount,
> > + .vop_copy_file_range =  vop_stdcopy_file_range,
> >  };
> >
> >  /*
> > @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
> >  {
> >
> >   return (0);
> > +}
> > +
> > +static int
> > +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> > +{
> > + int error;
> > +
> > + error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> > + ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, ap->a_incred,
> > + ap->a_outcred, ap->a_fsizetd);
> > + return (error);
> >  }
> >
> >  int
> >
> > Modified: head/sys/kern/vfs_syscalls.c
> > ==
> > --- head/sys/kern/vfs_syscalls.c  Thu Jul 25 03:55:05 2019
> > (r350314)
> > +++ head/sys/kern/vfs_syscalls.c  Thu Jul 25 05:46:16 2019
> > (r350315)
> > @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct 
> > posix_fadv
> >   uap->advice);
> >   return (kern_posix_error(td, error));
> >  }
> > +
> > +int
> > +kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd,
> > +off_t *outoffp, size_t len, unsigned int flags)
> > +{
> > + struct file *infp, *outfp;
> > + struct vnode *invp, *outvp;
> > + int error;
> > + size_t retlen;
> > + void *rl_rcookie, *rl_wcookie;
> > + off_t savinoff, savoutoff;
> > +

Re: svn commit: r350315 - in head/sys: kern sys

2019-07-25 Thread Shawn Webb
On Thu, Jul 25, 2019 at 11:48:39AM -0500, Kyle Evans wrote:
> On Thu, Jul 25, 2019 at 11:46 AM Shawn Webb  
> wrote:
> >
> > Hey Rick,
> >
> > On Thu, Jul 25, 2019 at 05:46:17AM +, Rick Macklem wrote:
> > > Author: rmacklem
> > > Date: Thu Jul 25 05:46:16 2019
> > > New Revision: 350315
> > > URL: https://svnweb.freebsd.org/changeset/base/350315
> > >
> > > Log:
> > >   Add kernel support for a Linux compatible copy_file_range(2) syscall.
> > >
> > >   This patch adds support to the kernel for a Linux compatible
> > >   copy_file_range(2) syscall and the related VOP_COPY_FILE_RANGE(9).
> > >   This syscall/VOP can be used by the NFSv4.2 client to implement the
> > >   Copy operation against an NFSv4.2 server to do file copies locally on
> > >   the server.
> > >   The vn_generic_copy_file_range() function in this patch can be used
> > >   by the NFSv4.2 server to implement the Copy operation.
> > >   Fuse may also me able to use the VOP_COPY_FILE_RANGE() method.
> > >
> > >   vn_generic_copy_file_range() attempts to maintain holes in the output
> > >   file in the range to be copied, but may fail to do so if the input and
> > >   output files are on different file systems with different 
> > > _PC_MIN_HOLE_SIZE
> > >   values.
> > >
> > >   Separate commits will be done for the generated syscall files and 
> > > userland
> > >   changes. A commit for a compat32 syscall will be done later.
> > >
> > >   Reviewed by:kib, asomers (plus comments by brooks, jilles)
> > >   Relnotes:   yes
> > >   Differential Revision:  https://reviews.freebsd.org/D20584
> > >
> > > Modified:
> > >   head/sys/kern/syscalls.master
> > >   head/sys/kern/vfs_default.c
> > >   head/sys/kern/vfs_syscalls.c
> > >   head/sys/kern/vfs_vnops.c
> > >   head/sys/kern/vnode_if.src
> > >   head/sys/sys/syscallsubr.h
> > >   head/sys/sys/vnode.h
> > >
> > > Modified: head/sys/kern/syscalls.master
> > > ==
> > > --- head/sys/kern/syscalls.master Thu Jul 25 03:55:05 2019
> > > (r350314)
> > > +++ head/sys/kern/syscalls.master Thu Jul 25 05:46:16 2019
> > > (r350315)
> > > @@ -3175,6 +3175,16 @@
> > >   int flag
> > >   );
> > >   }
> > > +569  AUE_NULLSTD {
> > > + ssize_t copy_file_range(
> > > + int infd,
> > > + _Inout_opt_ off_t *inoffp,
> > > + int outfd,
> > > + _Inout_opt_ off_t *outoffp,
> > > + size_t len,
> > > + unsigned int flags
> > > + );
> > > + }
> > >
> > >  ; Please copy any additions and changes to the following compatability 
> > > tables:
> > >  ; sys/compat/freebsd32/syscalls.master
> > >
> > > Modified: head/sys/kern/vfs_default.c
> > > ==
> > > --- head/sys/kern/vfs_default.c   Thu Jul 25 03:55:05 2019
> > > (r350314)
> > > +++ head/sys/kern/vfs_default.c   Thu Jul 25 05:46:16 2019
> > > (r350315)
> > > @@ -83,6 +83,7 @@ static int  dirent_exists(struct vnode *vp, const char
> > >  static int vop_stdis_text(struct vop_is_text_args *ap);
> > >  static int vop_stdunset_text(struct vop_unset_text_args *ap);
> > >  static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
> > > +static int vop_stdcopy_file_range(struct vop_copy_file_range_args *ap);
> > >  static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
> > >  static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
> > >
> > > @@ -140,6 +141,7 @@ struct vop_vector default_vnodeops = {
> > >   .vop_set_text = vop_stdset_text,
> > >   .vop_unset_text =   vop_stdunset_text,
> > >   .vop_add_writecount =   vop_stdadd_writecount,
> > > + .vop_copy_file_range =  vop_stdcopy_file_range,
> > >  };
> > >
> > >  /*
> > > @@ -1210,6 +1212,17 @@ vfs_stdnosync (mp, waitfor)
> > >  {
> > >
> > >   return (0);
> > > +}
> > > +
> > > +static int
> > > +vop_stdcopy_file_range(struct vop_copy_file_range_args *ap)
> > > +{
> > > + int error;
> > > +
> > > + error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
> > > + ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags, 
> > > ap->a_incred,
> > > + ap->a_outcred, ap->a_fsizetd);
> > > + return (error);
> > >  }
> > >
> > >  int
> > >
> > > Modified: head/sys/kern/vfs_syscalls.c
> > > ==
> > > --- head/sys/kern/vfs_syscalls.c  Thu Jul 25 03:55:05 2019
> > > (r350314)
> > > +++ head/sys/kern/vfs_syscalls.c  Thu Jul 25 05:46:16 2019
> > > (r350315)
> > > @@ -4814,3 +4814,122 @@ sys_posix_fadvise(struct thread *td, struct 
> > > posix_fadv
> > >   uap->advice);
> > >   return (kern_posix_error(td, error));
> > >  }
> > > +
> > > +int
> > > +kern_copy_file_range

svn commit: r350327 - in head: . lib/libsysdecode

2019-07-25 Thread Ed Maste
Author: emaste
Date: Thu Jul 25 17:10:17 2019
New Revision: 350327
URL: https://svnweb.freebsd.org/changeset/base/350327

Log:
  libsysdecode: use the proper include directory
  
  Reported by:  cy
  Reviewed by:  lwhsu
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21068

Modified:
  head/Makefile.libcompat
  head/lib/libsysdecode/Makefile

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Jul 25 16:22:37 2019(r350326)
+++ head/Makefile.libcompat Thu Jul 25 17:10:17 2019(r350327)
@@ -186,7 +186,6 @@ build${libcompat}: .PHONY
 .endif
mkdir -p ${WORLDTMP}
ln -sf ${.CURDIR}/sys ${WORLDTMP}
-   ln -sf ${.CURDIR}/sys ${LIBCOMPATTMP}
 .for _t in ${_obj} includes
 .for _dir in ${_LC_INCDIRS}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \

Modified: head/lib/libsysdecode/Makefile
==
--- head/lib/libsysdecode/Makefile  Thu Jul 25 16:22:37 2019
(r350326)
+++ head/lib/libsysdecode/Makefile  Thu Jul 25 17:10:17 2019
(r350327)
@@ -123,9 +123,10 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 CFLAGS.gcc+=   ${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=   tables.h
-tables.h: mktables ${SYSROOT}/sys/netinet/in.h ${SYSROOT}/sys/netinet/tcp.h \
-${SYSROOT}/sys/netinet6/in6.h
-   sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} 
${.TARGET}.tmp && \
+incdir=${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
+tables.h: mktables ${incdir}/netinet/in.h ${incdir}/netinet/tcp.h \
+${incdir}/netinet6/in6.h
+   sh ${.CURDIR}/mktables ${incdir} ${.TARGET}.tmp && \
mv -f ${.TARGET}.tmp ${.TARGET}
 
 # mkioctls runs find(1) for headers so needs to rebuild every time.  This used
___
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: r350327 - in head: . lib/libsysdecode

2019-07-25 Thread Ed Maste
On Thu, 25 Jul 2019 at 13:10, Ed Maste  wrote:
>
> Author: emaste
> Date: Thu Jul 25 17:10:17 2019
> New Revision: 350327
> URL: https://svnweb.freebsd.org/changeset/base/350327
>
> Log:
>   libsysdecode: use the proper include directory

I forgot to mention in the commit message that this reverts lwhsu's
initial workaround (r350322).
___
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: r350331 - in head: sbin/camcontrol sys/cam/ata sys/cam/scsi sys/sys

2019-07-25 Thread Alexander Motin
Author: mav
Date: Thu Jul 25 18:48:31 2019
New Revision: 350331
URL: https://svnweb.freebsd.org/changeset/base/350331

Log:
  Make `camcontrol sanitize` support also ATA devices.
  
  ATA sanitize is functionally identical to SCSI, just uses different
  initiation commands and status reporting mechanism.
  
  While there, make kernel better handle sanitize commands and statuses.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/ata/ata_all.c
  head/sys/cam/scsi/scsi_all.c
  head/sys/sys/ata.h

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Thu Jul 25 18:15:43 2019
(r350330)
+++ head/sbin/camcontrol/camcontrol.8   Thu Jul 25 18:48:31 2019
(r350331)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 22, 2019
+.Dd July 25, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -1276,13 +1276,11 @@ will not be asked about the timeout if a timeout is sp
 command line.
 .El
 .It Ic sanitize
-Issue the
-.Tn SCSI
-SANITIZE command to the named device.
+Issue the SANITIZE command to the named device.
 .Pp
 .Em WARNING! WARNING! WARNING!
 .Pp
-ALL data in the cache and on the disk will be destroyed or made inaccessible.
+ALL data on the disk will be destroyed or made inaccessible.
 Recovery of the data is not possible.
 Use extreme caution when issuing this command.
 .Pp

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Thu Jul 25 18:15:43 2019
(r350330)
+++ head/sbin/camcontrol/camcontrol.c   Thu Jul 25 18:48:31 2019
(r350331)
@@ -347,7 +347,7 @@ static int ratecontrol(struct cam_device *device, int 
 static int scsiformat(struct cam_device *device, int argc, char **argv,
  char *combinedopt, int task_attr, int retry_count,
  int timeout);
-static int scsisanitize(struct cam_device *device, int argc, char **argv,
+static int sanitize(struct cam_device *device, int argc, char **argv,
char *combinedopt, int task_attr, int retry_count,
int timeout);
 static int scsireportluns(struct cam_device *device, int argc, char **argv,
@@ -1743,6 +1743,19 @@ atacapprint(struct ata_params *parm)
} else {
printf("no\n");
}
+   printf("Sanitize   ");
+   if (parm->multi & ATA_SUPPORT_SANITIZE) {
+   printf("yes\t\t%s%s%s\n",
+   parm->multi & ATA_SUPPORT_BLOCK_ERASE_EXT ? "block, " : "",
+   parm->multi & ATA_SUPPORT_OVERWRITE_EXT ? "overwrite, " : 
"",
+   parm->multi & ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT ? "crypto" : 
"");
+   printf("Sanitize - commands allowed%s\n",
+   parm->multi & ATA_SUPPORT_SANITIZE_ALLOWED ? "yes" : "no");
+   printf("Sanitize - antifreeze lock %s\n",
+   parm->multi & ATA_SUPPORT_ANTIFREEZE_LOCK_EXT ? "yes" : 
"no");
+   } else {
+   printf("no\n");
+   }
 }
 
 static int
@@ -1989,6 +2002,11 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, 
res->lba_high_exp = res_pass16->lba_high_exp;
res->sector_count = res_pass16->sector_count;
res->sector_count_exp = res_pass16->sector_count_exp;
+   ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+   if (res->status & ATA_STATUS_ERROR)
+   ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR;
+   else
+   ccb->ccb_h.status |= CAM_REQ_CMP;
}
 
return (error);
@@ -2479,12 +2497,6 @@ ata_do_identify(struct cam_device *device, int retry_c
error = 0;
}
 
-   if (arglist & CAM_ARG_VERBOSE) {
-   fprintf(stdout, "%s%d: Raw identify data:\n",
-   device->device_name, device->dev_unit_num);
-   dump_data(ptr, sizeof(struct ata_params));
-   }
-
/* check for invalid (all zero) response */
if (error != 0) {
warnx("Invalid identify response detected");
@@ -2515,6 +2527,12 @@ ataidentify(struct cam_device *device, int retry_count
return (1);
}
 
+   if (arglist & CAM_ARG_VERBOSE) {
+   printf("%s%d: Raw identify data:\n",
+   device->device_name, device->dev_unit_num);
+   dump_data((void*)ident_buf, sizeof(struct ata_params));
+   }
+
if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) {
if (ata_read_native_max(device, retry_count, timeout, ccb,
ident_buf, &hpasize) != 0) {
@@ -6744,15 +6762,1

Re: svn commit: r350331 - in head: sbin/camcontrol sys/cam/ata sys/cam/scsi sys/sys

2019-07-25 Thread Edward Napierala
On Thu, 25 Jul 2019 at 19:48, Alexander Motin  wrote:
>
> Author: mav
> Date: Thu Jul 25 18:48:31 2019
> New Revision: 350331
> URL: https://svnweb.freebsd.org/changeset/base/350331
>
> Log:
>   Make `camcontrol sanitize` support also ATA devices.
>
>   ATA sanitize is functionally identical to SCSI, just uses different
>   initiation commands and status reporting mechanism.
>
>   While there, make kernel better handle sanitize commands and statuses.
>
>   MFC after:2 weeks
>   Sponsored by: iXsystems, Inc.

Relnotes: yes?
___
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: r350331 - in head: sbin/camcontrol sys/cam/ata sys/cam/scsi sys/sys

2019-07-25 Thread Alexander Motin
On 25.07.2019 15:40, Edward Napierala wrote:
> On Thu, 25 Jul 2019 at 19:48, Alexander Motin  wrote:
>>
>> Author: mav
>> Date: Thu Jul 25 18:48:31 2019
>> New Revision: 350331
>> URL: https://svnweb.freebsd.org/changeset/base/350331
>>
>> Log:
>>   Make `camcontrol sanitize` support also ATA devices.
>>
>>   ATA sanitize is functionally identical to SCSI, just uses different
>>   initiation commands and status reporting mechanism.
>>
>>   While there, make kernel better handle sanitize commands and statuses.
>>
>>   MFC after:2 weeks
>>   Sponsored by: iXsystems, Inc.
> 
> Relnotes: yes?

Ah. Sure. Why not.

-- 
Alexander Motin
___
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: r350333 - head/sys/dev/nvme

2019-07-25 Thread Warner Losh
Author: imp
Date: Thu Jul 25 20:26:21 2019
New Revision: 350333
URL: https://svnweb.freebsd.org/changeset/base/350333

Log:
  Widen the type for to.
  
  The timeout field in the CAPS register is defined to be 8 bits, so its type 
was
  uint8_t. We recently started adding 1 to it to cope with rogue devices that
  listed 0 timeout time (which is impossible). However, in so doing, other 
devices
  that list 0xff (for a 2 minute timeout) were broken when adding 1
  overflowed. Widen the type to be uint32_t like its source register to avoid 
the
  issue.
  
  Reported by: bapt@

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

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Thu Jul 25 20:01:24 2019
(r350332)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Thu Jul 25 20:26:21 2019
(r350333)
@@ -1227,7 +1227,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
struct make_dev_argsmd_args;
uint32_tcap_lo;
uint32_tcap_hi;
-   uint8_t to;
+   uint32_tto;
uint8_t dstrd;
uint8_t mpsmin;
int status, timeout_period;
___
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: r350335 - in head/sys: amd64/amd64 arm64/arm64 i386/i386 riscv/riscv

2019-07-25 Thread Alan Cox
Author: alc
Date: Thu Jul 25 22:02:55 2019
New Revision: 350335
URL: https://svnweb.freebsd.org/changeset/base/350335

Log:
  Simplify the handling of superpages in pmap_clear_modify().  Specifically,
  if a demotion succeeds, then all of the 4KB page mappings within the
  superpage-sized region must be valid, so there is no point in testing the
  validity of the 4KB page mapping that is going to be write protected.
  
  Deindent the nearby code.
  
  Reviewed by:  kib, markj
  Tested by:pho (amd64, i386)
  X-MFC after:  r350004 (this change depends on arm64 dirty bit emulation)
  Differential Revision:https://reviews.freebsd.org/D21027

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm64/arm64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jul 25 20:34:50 2019(r350334)
+++ head/sys/amd64/amd64/pmap.c Thu Jul 25 22:02:55 2019(r350335)
@@ -7574,7 +7574,7 @@ pmap_clear_modify(vm_page_t m)
pmap_t pmap;
pv_entry_t next_pv, pv;
pd_entry_t oldpde, *pde;
-   pt_entry_t oldpte, *pte, PG_M, PG_RW, PG_V;
+   pt_entry_t *pte, PG_M, PG_RW;
struct rwlock *lock;
vm_offset_t va;
int md_gen, pvh_gen;
@@ -7610,33 +7610,23 @@ restart:
}
}
PG_M = pmap_modified_bit(pmap);
-   PG_V = pmap_valid_bit(pmap);
PG_RW = pmap_rw_bit(pmap);
va = pv->pv_va;
pde = pmap_pde(pmap, va);
oldpde = *pde;
-   if ((oldpde & PG_RW) != 0) {
-   if (pmap_demote_pde_locked(pmap, pde, va, &lock)) {
-   if ((oldpde & PG_W) == 0) {
-   /*
-* Write protect the mapping to a
-* single page so that a subsequent
-* write access may repromote.
-*/
-   va += VM_PAGE_TO_PHYS(m) - (oldpde &
-   PG_PS_FRAME);
-   pte = pmap_pde_to_pte(pde, va);
-   oldpte = *pte;
-   if ((oldpte & PG_V) != 0) {
-   while (!atomic_cmpset_long(pte,
-   oldpte,
-   oldpte & ~(PG_M | PG_RW)))
-   oldpte = *pte;
-   vm_page_dirty(m);
-   pmap_invalidate_page(pmap, va);
-   }
-   }
-   }
+   /* If oldpde has PG_RW set, then it also has PG_M set. */
+   if ((oldpde & PG_RW) != 0 &&
+   pmap_demote_pde_locked(pmap, pde, va, &lock) &&
+   (oldpde & PG_W) == 0) {
+   /*
+* Write protect the mapping to a single page so that
+* a subsequent write access may repromote.
+*/
+   va += VM_PAGE_TO_PHYS(m) - (oldpde & PG_PS_FRAME);
+   pte = pmap_pde_to_pte(pde, va);
+   atomic_clear_long(pte, PG_M | PG_RW);
+   vm_page_dirty(m);
+   pmap_invalidate_page(pmap, va);
}
PMAP_UNLOCK(pmap);
}

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Jul 25 20:34:50 2019(r350334)
+++ head/sys/arm64/arm64/pmap.c Thu Jul 25 22:02:55 2019(r350335)
@@ -4889,28 +4889,22 @@ restart:
va = pv->pv_va;
l2 = pmap_l2(pmap, va);
oldl2 = pmap_load(l2);
-   if ((oldl2 & ATTR_SW_DBM) != 0) {
-   if (pmap_demote_l2_locked(pmap, l2, va, &lock)) {
-   if ((oldl2 & ATTR_SW_WIRED) == 0) {
-   /*
-* Write protect the mapping to a
-* single page so that a subsequent
-* write access may repromote.
-*/
-   va += VM_PAGE_TO_PHYS(m) -
-   (oldl2 & ~ATTR_MASK);
-   l3 = pmap_l2_to_l3(l2, va);
-   oldl3 = pmap_load(l3);
-

svn commit: r350336 - head/sys/net

2019-07-25 Thread Kyle Evans
Author: kevans
Date: Thu Jul 25 22:23:34 2019
New Revision: 350336
URL: https://svnweb.freebsd.org/changeset/base/350336

Log:
  if_tuntap(4): Add TUNGIFNAME
  
  This effectively just moves TAPGIFNAME into common ioctl territory.
  
  MFC after:3 days

Modified:
  head/sys/net/if_tap.h
  head/sys/net/if_tun.h
  head/sys/net/if_tuntap.c

Modified: head/sys/net/if_tap.h
==
--- head/sys/net/if_tap.h   Thu Jul 25 22:02:55 2019(r350335)
+++ head/sys/net/if_tap.h   Thu Jul 25 22:23:34 2019(r350336)
@@ -55,7 +55,7 @@
 #defineTAPGDEBUG   TUNGDEBUG
 #defineTAPSIFINFO  TUNSIFINFO
 #defineTAPGIFINFO  TUNGIFINFO
-#defineTAPGIFNAME  _IOR('t', 93, struct ifreq)
+#defineTAPGIFNAME  TUNGIFNAME
 
 /* VMware ioctl's */
 #define VMIO_SIOCSIFFLAGS  _IOWINT('V', 0)

Modified: head/sys/net/if_tun.h
==
--- head/sys/net/if_tun.h   Thu Jul 25 22:02:55 2019(r350335)
+++ head/sys/net/if_tun.h   Thu Jul 25 22:23:34 2019(r350336)
@@ -40,6 +40,7 @@ struct tuninfo {
 #defineTUNSIFINFO  _IOW('t', 91, struct tuninfo)
 #defineTUNGIFINFO  _IOR('t', 92, struct tuninfo)
 #defineTUNSLMODE   _IOW('t', 93, int)
+#defineTUNGIFNAME  _IOR('t', 93, struct ifreq)
 #defineTUNSIFMODE  _IOW('t', 94, int)
 #defineTUNSIFPID   _IO('t', 95)
 #defineTUNSIFHEAD  _IOW('t', 96, int)

Modified: head/sys/net/if_tuntap.c
==
--- head/sys/net/if_tuntap.cThu Jul 25 22:02:55 2019(r350335)
+++ head/sys/net/if_tuntap.cThu Jul 25 22:23:34 2019(r350336)
@@ -1235,12 +1235,6 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i
if (l2tun) {
/* tap specific ioctls */
switch(cmd) {
-   case TAPGIFNAME:
-   ifrp = (struct ifreq *)data;
-   strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname,
-   IFNAMSIZ);
-
-   return (0);
/* VMware/VMnet port ioctl's */
 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
 defined(COMPAT_FREEBSD4)
@@ -1337,6 +1331,11 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, i
}
 
switch (cmd) {
+   case TUNGIFNAME:
+   ifrp = (struct ifreq *)data;
+   strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
+
+   return (0);
case TUNSIFINFO:
tunp = (struct tuninfo *)data;
if (TUN2IFP(tp)->if_type != tunp->type)
___
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: r350343 - in head/sys/cam: ctl scsi

2019-07-25 Thread Alexander Motin
Author: mav
Date: Fri Jul 26 01:49:28 2019
New Revision: 350343
URL: https://svnweb.freebsd.org/changeset/base/350343

Log:
  Add reporting of SCSI Feature Sets VPD page from SPC-5.
  
  CTL implements all defined feature sets except Drive Maintenance 2016,
  which is not very applicable to such a virtual device, and implemented
  only partially now.  But may be it could be fixed later at least for
  completeness.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Jul 26 01:47:20 2019(r350342)
+++ head/sys/cam/ctl/ctl.c  Fri Jul 26 01:49:28 2019(r350343)
@@ -448,10 +448,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, max_ports, CTLFLAG
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
  * Extended INQUIRY Data (0x86), Mode Page Policy (0x87),
- * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0),
- * Block Device Characteristics (0xB1) and Logical Block Provisioning (0xB2)
+ * SCSI Ports (0x88), Third-party Copy (0x8F), SCSI Feature Sets (0x92),
+ * Block limits (0xB0), Block Device Characteristics (0xB1) and
+ * Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  10
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  11
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -489,6 +490,7 @@ static int ctl_inquiry_evpd_eid(struct ctl_scsiio *cts
 static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio,
 int alloc_len);
+static int ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio,
 int alloc_len);
 static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len);
@@ -9318,6 +9320,8 @@ ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, i
pages->page_list[p++] = SVPD_SCSI_PORTS;
/* Third-party Copy */
pages->page_list[p++] = SVPD_SCSI_TPC;
+   /* SCSI Feature Sets */
+   pages->page_list[p++] = SVPD_SCSI_SFS;
if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
/* Block limits */
pages->page_list[p++] = SVPD_BLOCK_LIMITS;
@@ -9699,6 +9703,58 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, 
 }
 
 static int
+ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len)
+{
+   struct ctl_lun *lun = CTL_LUN(ctsio);
+   struct scsi_vpd_sfs *sfs_ptr;
+   int sfs_page_size, n;
+
+   sfs_page_size = sizeof(*sfs_ptr) + 5 * 2;
+   ctsio->kern_data_ptr = malloc(sfs_page_size, M_CTL, M_WAITOK | M_ZERO);
+   sfs_ptr = (struct scsi_vpd_sfs *)ctsio->kern_data_ptr;
+   ctsio->kern_sg_entries = 0;
+   ctsio->kern_rel_offset = 0;
+   ctsio->kern_sg_entries = 0;
+   ctsio->kern_data_len = min(sfs_page_size, alloc_len);
+   ctsio->kern_total_len = ctsio->kern_data_len;
+
+   /*
+* The control device is always connected.  The disk device, on the
+* other hand, may not be online all the time.  Need to change this
+* to figure out whether the disk device is actually online or not.
+*/
+   if (lun != NULL)
+   sfs_ptr->device = (SID_QUAL_LU_CONNECTED << 5) |
+ lun->be_lun->lun_type;
+   else
+   sfs_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
+
+   sfs_ptr->page_code = SVPD_SCSI_SFS;
+   n = 0;
+   /* Discovery 2016 */
+   scsi_ulto2b(0x0001, &sfs_ptr->codes[2 * n++]);
+   if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
+/* SBC Base 2016 */
+   scsi_ulto2b(0x0101, &sfs_ptr->codes[2 * n++]);
+/* SBC Base 2010 */
+   scsi_ulto2b(0x0102, &sfs_ptr->codes[2 * n++]);
+   if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) {
+   /* Basic Provisioning 2016 */
+   scsi_ulto2b(0x0103, &sfs_ptr->codes[2 * n++]);
+   }
+   /* Drive Maintenance 2016 */
+   //scsi_ulto2b(0x0104, &sfs_ptr->codes[2 * n++]);
+   }
+   scsi_ulto2b(4 + 2 * n, sfs_ptr->page_length);
+
+   ctl_set_success(ctsio);
+   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
+   ctsio->be_move_done = ctl_config_move_done;
+   ctl_datamove((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+}
+
+static int
 ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len)
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
@@ -9811,7 +9867,7 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int all
else
i = 0;
bdc_ptr->wab_wac_ff = (i & 0x0f);
- 

svn commit: r350346 - in head: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm

2019-07-25 Thread Alexander Motin
Author: mav
Date: Fri Jul 26 03:49:16 2019
New Revision: 350346
URL: https://svnweb.freebsd.org/changeset/base/350346

Log:
  Add device temperature reporting into CTL.
  
  The values to report can be set via LUN options.  It can be useful for
  testing, and also required for Drive Maintenance 2016 feature set.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/scsi/scsi_all.h
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Jul 26 02:49:34 2019(r350345)
+++ head/sys/cam/ctl/ctl.c  Fri Jul 26 03:49:16 2019(r350346)
@@ -4450,12 +4450,14 @@ ctl_init_log_page_index(struct ctl_lun *lun)
lun->log_pages.index[0].page_len = j;
lun->log_pages.index[1].page_data = &lun->log_pages.subpages_page[0];
lun->log_pages.index[1].page_len = k * 2;
-   lun->log_pages.index[2].page_data = &lun->log_pages.lbp_page[0];
-   lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS;
-   lun->log_pages.index[3].page_data = (uint8_t 
*)&lun->log_pages.stat_page;
-   lun->log_pages.index[3].page_len = sizeof(lun->log_pages.stat_page);
-   lun->log_pages.index[4].page_data = (uint8_t *)&lun->log_pages.ie_page;
-   lun->log_pages.index[4].page_len = sizeof(lun->log_pages.ie_page);
+   lun->log_pages.index[2].page_data = (uint8_t 
*)&lun->log_pages.temp_page;
+   lun->log_pages.index[2].page_len = sizeof(lun->log_pages.temp_page);
+   lun->log_pages.index[3].page_data = &lun->log_pages.lbp_page[0];
+   lun->log_pages.index[3].page_len = 12*CTL_NUM_LBP_PARAMS;
+   lun->log_pages.index[4].page_data = (uint8_t 
*)&lun->log_pages.stat_page;
+   lun->log_pages.index[4].page_len = sizeof(lun->log_pages.stat_page);
+   lun->log_pages.index[5].page_data = (uint8_t *)&lun->log_pages.ie_page;
+   lun->log_pages.index[5].page_len = sizeof(lun->log_pages.ie_page);
 
return (CTL_RETVAL_COMPLETE);
 }
@@ -6679,6 +6681,40 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 }
 
 int
+ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+  struct ctl_page_index *page_index,
+  int pc)
+{
+   struct ctl_lun *lun = CTL_LUN(ctsio);
+   struct scsi_log_temperature *data;
+   const char *value;
+
+   data = (struct scsi_log_temperature *)page_index->page_data;
+
+   scsi_ulto2b(SLP_TEMPERATURE, data->hdr.param_code);
+   data->hdr.param_control = SLP_LBIN;
+   data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+   sizeof(struct scsi_log_param_header);
+   if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
+   data++;
+
+   scsi_ulto2b(SLP_REFTEMPERATURE, data->hdr.param_code);
+   data->hdr.param_control = SLP_LBIN;
+   data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+   sizeof(struct scsi_log_param_header);
+   if ((value = dnvlist_get_string(lun->be_lun->options, "reftemperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
+   return (0);
+}
+
+int
 ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
   struct ctl_page_index *page_index,
   int pc)
@@ -6802,6 +6838,7 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_log_informational_exceptions *data;
+   const char *value;
 
data = (struct scsi_log_informational_exceptions 
*)page_index->page_data;
 
@@ -6811,7 +6848,11 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
sizeof(struct scsi_log_param_header);
data->ie_asc = lun->ie_asc;
data->ie_ascq = lun->ie_ascq;
-   data->temperature = 0xff;
+   if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
return (0);
 }
 

Modified: head/sys/cam/ctl/ctl.h
==
--- head/sys/cam/ctl/ctl.h  Fri Jul 26 02:49:34 2019(r350345)
+++ head/sys/cam/ctl/ctl.h  Fri Jul 26 03:49:16 2019(r350346)
@@ -158,6 +158,9 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio,
 int ctl_ie_page_handler(struct ctl_scsiio *ctsio,
struct ctl_page_index *page_index,
uint8_t *page_ptr);
+int ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+  struct ctl_pa

svn commit: r350347 - head/sys/arm64/arm64

2019-07-25 Thread Alan Cox
Author: alc
Date: Fri Jul 26 05:07:09 2019
New Revision: 350347
URL: https://svnweb.freebsd.org/changeset/base/350347

Log:
  Implement pmap_advise().  (Without a working pmap_advise() implementation
  madvise(MADV_DONTNEED) and madvise(MADV_FREE) are NOPs.)
  
  Reviewed by:  markj
  X-MFC after:  r350004
  Differential Revision:https://reviews.freebsd.org/D21062

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Fri Jul 26 03:49:16 2019(r350346)
+++ head/sys/arm64/arm64/pmap.c Fri Jul 26 05:07:09 2019(r350347)
@@ -2499,7 +2499,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_
 /*
  * pmap_remove_l3: do the things to unmap a page in a process
  */
-static int __unused
+static int
 pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va,
 pd_entry_t l2e, struct spglist *free, struct rwlock **lockp)
 {
@@ -4839,6 +4839,110 @@ out:
 void
 pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice)
 {
+   struct rwlock *lock;
+   vm_offset_t va, va_next;
+   vm_page_t m;
+   pd_entry_t *l0, *l1, *l2, oldl2;
+   pt_entry_t *l3, oldl3;
+
+   if (advice != MADV_DONTNEED && advice != MADV_FREE)
+   return;
+
+   PMAP_LOCK(pmap);
+   for (; sva < eva; sva = va_next) {
+   l0 = pmap_l0(pmap, sva);
+   if (pmap_load(l0) == 0) {
+   va_next = (sva + L0_SIZE) & ~L0_OFFSET;
+   if (va_next < sva)
+   va_next = eva;
+   continue;
+   }
+   l1 = pmap_l0_to_l1(l0, sva);
+   if (pmap_load(l1) == 0) {
+   va_next = (sva + L1_SIZE) & ~L1_OFFSET;
+   if (va_next < sva)
+   va_next = eva;
+   continue;
+   }
+   va_next = (sva + L2_SIZE) & ~L2_OFFSET;
+   if (va_next < sva)
+   va_next = eva;
+   l2 = pmap_l1_to_l2(l1, sva);
+   oldl2 = pmap_load(l2);
+   if (oldl2 == 0)
+   continue;
+   if ((oldl2 & ATTR_DESCR_MASK) == L2_BLOCK) {
+   if ((oldl2 & ATTR_SW_MANAGED) == 0)
+   continue;
+   lock = NULL;
+   if (!pmap_demote_l2_locked(pmap, l2, sva, &lock)) {
+   if (lock != NULL)
+   rw_wunlock(lock);
+
+   /*
+* The 2MB page mapping was destroyed.
+*/
+   continue;
+   }
+
+   /*
+* Unless the page mappings are wired, remove the
+* mapping to a single page so that a subsequent
+* access may repromote.  Since the underlying page
+* table page is fully populated, this removal never
+* frees a page table page.
+*/
+   if ((oldl2 & ATTR_SW_WIRED) == 0) {
+   l3 = pmap_l2_to_l3(l2, sva);
+   KASSERT(pmap_load(l3) != 0,
+   ("pmap_advise: invalid PTE"));
+   pmap_remove_l3(pmap, l3, sva, pmap_load(l2),
+   NULL, &lock);
+   }
+   if (lock != NULL)
+   rw_wunlock(lock);
+   }
+   KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE,
+   ("pmap_advise: invalid L2 entry after demotion"));
+   if (va_next > eva)
+   va_next = eva;
+   va = va_next;
+   for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++,
+   sva += L3_SIZE) {
+   oldl3 = pmap_load(l3);
+   if ((oldl3 & (ATTR_SW_MANAGED | ATTR_DESCR_MASK)) !=
+   (ATTR_SW_MANAGED | L3_PAGE))
+   goto maybe_invlrng;
+   else if (pmap_pte_dirty(oldl3)) {
+   if (advice == MADV_DONTNEED) {
+   /*
+* Future calls to pmap_is_modified()
+* can be avoided by making the page
+* dirty now.
+*/
+   m = PHYS_TO_VM_PAGE(oldl3 & ~ATTR_MASK);
+   vm_page_dirty(m);
+   }
+