Re: svn commit: r303887 - head/tools/tools/dmardump

2016-08-10 Thread Konstantin Belousov
On Tue, Aug 09, 2016 at 02:22:36PM -0700, John Baldwin wrote:
> On Tuesday, August 09, 2016 07:06:05 PM John Baldwin wrote:
> > Author: jhb
> > Date: Tue Aug  9 19:06:05 2016
> > New Revision: 303887
> > URL: https://svnweb.freebsd.org/changeset/base/303887
> > 
> > Log:
> >   Add a dmardump utility to dump the VT-d context tables.
> >   
> >   This tool parses the ACPI DMAR table looking for DMA remapping devices.
> >   For each device it walks the root table and any context tables
> >   referenced to display mapping info for PCI devices.
> >   
> >   Note that acpidump -t already parses the info in the ACPI DMAR tables
> >   directly.  This tool examines some of the data structures the DMAR
> >   remapping engines use to translate DMA requests.
> >   
> >   Reviewed by:  kib, grehan
> >   MFC after:1 month
> >   Sponsored by: Chelsio Communications
> >   Differential Revision:https://reviews.freebsd.org/D7444
> 
> I should have mentioned that this tool only supports "normal" context
> entry tables.  It does not (yet) support extended context entry
> tables.  However, neither bhyve nor ACPI_DMAR create extended context
> entry tables.

I am not aware of existence of hardware supporting the extended context
entries.  Even Skykale E3 v5 Xeons report ECS == 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"


Re: svn commit: r303870 - head/sys/dev/mlx5/mlx5_en

2016-08-10 Thread Hans Petter Selasky

On 08/09/16 19:25, John Baldwin wrote:

On Tuesday, August 09, 2016 07:43:15 AM Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Aug  9 07:43:15 2016
New Revision: 303870
URL: https://svnweb.freebsd.org/changeset/base/303870

Log:
  Fix for use after free.

  Clear the device description to avoid use after free because the
  bsddev is not destroyed when the mlx5en module is unloaded. Only when
  the parent mlx5 module is unloaded the bsddev is destroyed. This fixes
  a panic on listing sysctls which refer strings in the bsddev after the
  mlx5en module has been unloaded.

  Sponsored by: Mellanox Technologies
  MFC after:1 week


Hmmm, this seems like it is working around a bug somewhere else.
device_detach() calls device_set_driver(dev, NULL) which in turn calls
device_set_desc(dev, NULL) which should be clearing the description.  You can
only be leaking a desc pointer if you aren't detaching the device.  Not
detaching a device but unloading the module containing part (but apparently
not all) of its driver would seem to be fraught with peril.  Why are you not
detaching the mlx5en0 device when unloading this module?



Hi John,

It is not a bug in the kernel.

When mlx5en is unloaded, device_detach() is not called, and that is 
expected. The mlx5 and mlx4 family of drivers have their own one-level 
bus subsystem. mlx5.ko will call LINUXKPI's pci_register_driver() and 
then probe mlx5en internally. When mlx5en is detached, mlx5 will detach 
the mlx5en driver, but it will not call "pci_unregister_driver()" which 
calls the device_detach(). This will only happen when the mlx5.ko is 
unloaded. Because the mlx5, mlx5en and mlx5ib (coming) modules are 
separated we can end up in this situation.


I hope you understand and that my explanation was not too complicated.

For other in-kernel drivers, this is not a problem. Like you write 
device_detach() will take care of device_set_driver(dev, NULL) and that 
will clear the device description.


--HPS

___
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: r303903 - head/sys/arm64/arm64

2016-08-10 Thread Andrew Turner
Author: andrew
Date: Wed Aug 10 10:13:34 2016
New Revision: 303903
URL: https://svnweb.freebsd.org/changeset/base/303903

Log:
  Implement pmap_align_superpage on arm64 based on the amd64 implementation.
  This will be needed when superpage support is added.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed Aug 10 08:05:48 2016(r303902)
+++ head/sys/arm64/arm64/pmap.c Wed Aug 10 10:13:34 2016(r303903)
@@ -3490,6 +3490,20 @@ void
 pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
 vm_offset_t *addr, vm_size_t size)
 {
+   vm_offset_t superpage_offset;
+
+   if (size < L2_SIZE)
+   return;
+   if (object != NULL && (object->flags & OBJ_COLORED) != 0)
+   offset += ptoa(object->pg_color);
+   superpage_offset = offset & L2_OFFSET;
+   if (size - ((L2_SIZE - superpage_offset) & L2_OFFSET) < L2_SIZE ||
+   (*addr & L2_OFFSET) == superpage_offset)
+   return;
+   if ((*addr & L2_OFFSET) < superpage_offset)
+   *addr = (*addr & ~L2_OFFSET) + superpage_offset;
+   else
+   *addr = ((*addr + L2_OFFSET) & ~L2_OFFSET) + superpage_offset;
 }
 
 /**
___
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: r303904 - head/sys/arm64/arm64

2016-08-10 Thread Andrew Turner
Author: andrew
Date: Wed Aug 10 10:36:11 2016
New Revision: 303904
URL: https://svnweb.freebsd.org/changeset/base/303904

Log:
  Uncomment the vm.kvm_size and vm.kvm_free sysctls. These work as expected so
  there is no reason to leave them commented out.
  
  Obtained from:ABT Systems Ltd
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed Aug 10 10:13:34 2016(r303903)
+++ head/sys/arm64/arm64/pmap.c Wed Aug 10 10:36:11 2016(r303904)
@@ -1574,7 +1574,6 @@ pmap_release(pmap_t pmap)
vm_page_free_zero(m);
 }
 
-#if 0
 static int
 kvm_size(SYSCTL_HANDLER_ARGS)
 {
@@ -1594,7 +1593,6 @@ kvm_free(SYSCTL_HANDLER_ARGS)
 }
 SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD,
 0, 0, kvm_free, "LU", "Amount of KVM free");
-#endif /* 0 */
 
 /*
  * grow the number of kernel page table entries, if needed
___
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: r303890 - in head/sys: contrib/ncsw/user/env contrib/octeon-sdk dev/auxio dev/bktr dev/e1000 dev/ixgb dev/ixgbe dev/ixl dev/netmap dev/pci dev/sound/sbus dev/tpm kern mips/nlm/dev/net

2016-08-10 Thread Konstantin Belousov
On Tue, Aug 09, 2016 at 07:32:06PM +, Jean-S??bastien P??dron wrote:
> Author: dumbbell
> Date: Tue Aug  9 19:32:06 2016
> New Revision: 303890
> URL: https://svnweb.freebsd.org/changeset/base/303890
> 
> Log:
>   Consistently use `device_t`
>   
>   Several files use the internal name of `struct device` instead of
>   `device_t` which is part of the public API. This patch changes all
>   `struct device *` to `device_t`.
>   
>   The remaining occurrences of `struct device` are those referring to the
>   Linux or OpenBSD version of the structure, or the code is not built on
>   FreeBSD and it's unclear what to do.
>   
>   Submitted by:   Matthew Macy  (previous version)
>   Approved by:emaste, jhibbits, sbruno
>   MFC after:  3 days
>   Differential Revision:  https://reviews.freebsd.org/D7447

On powerpc and powerpc64, at r303902, I got
===> usr.sbin/camdd (all)
In file included from /scratch/tmp/kib/obj/powerpc.powerpc64/scratch/tmp/kib/src
/tmp/usr/include/machine/bus.h:463,   
 from /scratch/tmp/kib/src/usr.sbin/camdd/camdd.c:54:
/scratch/tmp/kib/obj/powerpc.powerpc64/scratch/tmp/kib/src/tmp/usr/include/machi
ne/bus_dma.h:33: error: expected declaration specifiers or '...' before 'device_
t'
--- camdd.o ---
*** [camdd.o] Error code 1

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


svn commit: r303908 - in head/sys: boot/fdt/dts/riscv conf riscv/conf riscv/htif riscv/include riscv/riscv

2016-08-10 Thread Ruslan Bukin
Author: br
Date: Wed Aug 10 12:41:36 2016
New Revision: 303908
URL: https://svnweb.freebsd.org/changeset/base/303908

Log:
  o Remove operation in machine mode.
Machine privilege level was specially designed to use in vendor's
firmware or bootloader. We have implemented operation in machine
mode in FreeBSD as part of understanding RISC-V ISA, but it is time
to remove it.
We now use BBL (Berkeley Boot Loader) -- standard RISC-V firmware,
which provides operation in machine mode for us.
We now use standard SBI calls to machine mode, instead of handmade
'syscalls'.
  o Remove HTIF bus.
HTIF bus is now legacy and no longer exists in RISC-V specification.
HTIF code still exists in Spike simulator, but BBL do not provide
raw interface to it.
Memory disk is only choice for now to have multiuser booted in Spike,
until Spike has implemented more devices (e.g. Virtio, etc).
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Added:
  head/sys/riscv/include/sbi.h   (contents, props changed)
  head/sys/riscv/riscv/riscv_console.c   (contents, props changed)
  head/sys/riscv/riscv/sbi.S   (contents, props changed)
Deleted:
  head/sys/riscv/htif/
Modified:
  head/sys/boot/fdt/dts/riscv/qemu.dts
  head/sys/boot/fdt/dts/riscv/rocket.dts
  head/sys/boot/fdt/dts/riscv/spike.dts
  head/sys/conf/files.riscv
  head/sys/conf/ldscript.riscv
  head/sys/riscv/conf/GENERIC
  head/sys/riscv/conf/QEMU
  head/sys/riscv/conf/ROCKET
  head/sys/riscv/conf/SPIKE
  head/sys/riscv/include/cpufunc.h
  head/sys/riscv/include/pcpu.h
  head/sys/riscv/include/riscvreg.h
  head/sys/riscv/include/vmparam.h
  head/sys/riscv/riscv/exception.S
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/identcpu.c
  head/sys/riscv/riscv/intr_machdep.c
  head/sys/riscv/riscv/locore.S
  head/sys/riscv/riscv/machdep.c
  head/sys/riscv/riscv/mp_machdep.c
  head/sys/riscv/riscv/pmap.c
  head/sys/riscv/riscv/timer.c
  head/sys/riscv/riscv/vm_machdep.c

Modified: head/sys/boot/fdt/dts/riscv/qemu.dts
==
--- head/sys/boot/fdt/dts/riscv/qemu.dtsWed Aug 10 12:36:54 2016
(r303907)
+++ head/sys/boot/fdt/dts/riscv/qemu.dtsWed Aug 10 12:41:36 2016
(r303908)
@@ -72,15 +72,11 @@
clock-frequency = < 4 >;
};
 
-   htif0: htif@0 {
-   compatible = "riscv,htif";
-   interrupts = < 0 >;
+   console0: console@0 {
+   compatible = "riscv,console";
+   status = "okay";
+   interrupts = < 1 >;
interrupt-parent = < &pic0 >;
-
-   console0: console@0 {
-   compatible = "htif,console";
-   status = "okay";
-   };
};
};
 

Modified: head/sys/boot/fdt/dts/riscv/rocket.dts
==
--- head/sys/boot/fdt/dts/riscv/rocket.dts  Wed Aug 10 12:36:54 2016
(r303907)
+++ head/sys/boot/fdt/dts/riscv/rocket.dts  Wed Aug 10 12:41:36 2016
(r303908)
@@ -83,15 +83,11 @@
clock-frequency = < 100 >;
};
 
-   htif0: htif@0 {
-   compatible = "riscv,htif";
-   interrupts = < 0 >;
+   console0: console@0 {
+   compatible = "riscv,console";
+   status = "okay";
+   interrupts = < 1 >;
interrupt-parent = < &pic0 >;
-
-   console0: console@0 {
-   compatible = "htif,console";
-   status = "okay";
-   };
};
};
 

Modified: head/sys/boot/fdt/dts/riscv/spike.dts
==
--- head/sys/boot/fdt/dts/riscv/spike.dts   Wed Aug 10 12:36:54 2016
(r303907)
+++ head/sys/boot/fdt/dts/riscv/spike.dts   Wed Aug 10 12:41:36 2016
(r303908)
@@ -65,6 +65,10 @@
};
 
memory {
+   /*
+* This is not used currently.
+* We take information from sbi_query_memory.
+*/
device_type = "memory";
reg = <0x8000 0x4000>; /* 1GB at 0x8000 */
};
@@ -90,15 +94,11 @@
clock-frequency = < 100 >;
};
 
-   htif0: htif@0 {
-   compatible = "riscv,htif";
+   console0: console@0 {
+   compatible = "riscv,console";
+   status = "okay";
interrupts = < 1 >;
interrupt-parent = < &pic0 >;
-
-

svn commit: r303911 - in head: share/mk sys/modules/dtrace/dtrace

2016-08-10 Thread Ruslan Bukin
Author: br
Date: Wed Aug 10 13:32:27 2016
New Revision: 303911
URL: https://svnweb.freebsd.org/changeset/base/303911

Log:
  Remove extra -msoft-float flags settings.
  This helps to build firmware modules.
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/share/mk/bsd.cpu.mk
  head/sys/modules/dtrace/dtrace/Makefile

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkWed Aug 10 12:56:01 2016(r303910)
+++ head/share/mk/bsd.cpu.mkWed Aug 10 13:32:27 2016(r303911)
@@ -327,11 +327,6 @@ CFLAGS += -mfloat-abi=softfp
 .endif
 .endif
 
-.if ${MACHINE_CPUARCH} == "riscv"
-CFLAGS += -msoft-float
-ACFLAGS += -msoft-float
-.endif
-
 # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
 
 .if !defined(NO_CPU_CFLAGS)

Modified: head/sys/modules/dtrace/dtrace/Makefile
==
--- head/sys/modules/dtrace/dtrace/Makefile Wed Aug 10 12:56:01 2016
(r303910)
+++ head/sys/modules/dtrace/dtrace/Makefile Wed Aug 10 13:32:27 2016
(r303911)
@@ -58,11 +58,6 @@ assym.o: assym.s
${AS} -meabi=5 -o assym.o assym.s
 .endif
 
-.if ${MACHINE_CPUARCH} == "riscv"
-assym.o: assym.s
-   ${AS} -msoft-float -o assym.o assym.s
-.endif
-
 .include 
 
 CFLAGS+=   -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.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: r303913 - in head/sys: amd64/amd64 i386/i386

2016-08-10 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 10 13:44:03 2016
New Revision: 303913
URL: https://svnweb.freebsd.org/changeset/base/303913

Log:
  Unconditionally perform checks that FPU region was entered, when #NM
  exception is caught in kernel mode.  There are third-party modules
  which trigger the issue, and since the problem causes usermode state
  corruption at least, panic in production kernels as well.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Wed Aug 10 13:38:44 2016(r303912)
+++ head/sys/amd64/amd64/trap.c Wed Aug 10 13:44:03 2016(r303913)
@@ -443,8 +443,8 @@ trap(struct trapframe *frame)
goto out;
 
case T_DNA:
-   KASSERT(!PCB_USER_FPU(td->td_pcb),
-   ("Unregistered use of FPU in kernel"));
+   if (PCB_USER_FPU(td->td_pcb))
+   panic("Unregistered use of FPU in kernel");
fpudna();
goto out;
 

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Wed Aug 10 13:38:44 2016(r303912)
+++ head/sys/i386/i386/trap.c   Wed Aug 10 13:44:03 2016(r303913)
@@ -540,8 +540,8 @@ trap(struct trapframe *frame)
 
case T_DNA:
 #ifdef DEV_NPX
-   KASSERT(!PCB_USER_FPU(td->td_pcb),
-   ("Unregistered use of FPU in kernel"));
+   if (PCB_USER_FPU(td->td_pcb))
+   panic("Unregistered use of FPU in kernel");
if (npxdna())
goto out;
 #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: r303914 - head/sys/kern

2016-08-10 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 10 13:47:12 2016
New Revision: 303914
URL: https://svnweb.freebsd.org/changeset/base/303914

Log:
  Re-schedule signals after kthread exits, since apparently there are
  processes which combine kernel and non-kernel threads, e.g. nfsd.  For
  such processes, termination of a kthread must recheck signal delivery
  among other threads according to masks.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_kthread.c

Modified: head/sys/kern/kern_kthread.c
==
--- head/sys/kern/kern_kthread.cWed Aug 10 13:44:03 2016
(r303913)
+++ head/sys/kern/kern_kthread.cWed Aug 10 13:47:12 2016
(r303914)
@@ -320,11 +320,13 @@ void
 kthread_exit(void)
 {
struct proc *p;
+   struct thread *td;
 
-   p = curthread->td_proc;
+   td = curthread;
+   p = td->td_proc;
 
/* A module may be waiting for us to exit. */
-   wakeup(curthread);
+   wakeup(td);
 
/*
 * The last exiting thread in a kernel process must tear down
@@ -337,9 +339,10 @@ kthread_exit(void)
rw_wunlock(&tidhash_lock);
kproc_exit(0);
}
-   LIST_REMOVE(curthread, td_hash);
+   LIST_REMOVE(td, td_hash);
rw_wunlock(&tidhash_lock);
-   umtx_thread_exit(curthread);
+   umtx_thread_exit(td);
+   tdsigcleanup(td);
PROC_SLOCK(p);
thread_exit();
 }
___
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: r303915 - head/sys/tools

2016-08-10 Thread Ruslan Bukin
Author: br
Date: Wed Aug 10 13:49:17 2016
New Revision: 303915
URL: https://svnweb.freebsd.org/changeset/base/303915

Log:
  Consider CROSS_BINUTILS_PREFIX environment variable so we use correct
  objdump.
  
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5

Modified:
  head/sys/tools/embed_mfs.sh

Modified: head/sys/tools/embed_mfs.sh
==
--- head/sys/tools/embed_mfs.sh Wed Aug 10 13:47:12 2016(r303914)
+++ head/sys/tools/embed_mfs.sh Wed Aug 10 13:49:17 2016(r303915)
@@ -36,7 +36,7 @@ mfs_size=`stat -f '%z' $2 2> /dev/null`
 # If we can't determine MFS image size - bail.
 [ -z ${mfs_size} ] && echo "Can't determine MFS image size" && exit 1
 
-sec_info=`objdump -h $1 2> /dev/null | grep " oldmfs "`
+sec_info=`${CROSS_BINUTILS_PREFIX}objdump -h $1 2> /dev/null | grep " oldmfs "`
 # If we can't find the mfs section within the given kernel - bail.
 [ -z "${sec_info}" ] && echo "Can't locate mfs section within kernel" && exit 1
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303916 - head/sys/fs/tmpfs

2016-08-10 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 10 13:50:21 2016
New Revision: 303916
URL: https://svnweb.freebsd.org/changeset/base/303916

Log:
  Convert another tmpfs assert into runtime check.
  
  The offset of the directory file, passed to getdirentries(2) syscall,
  is user-controllable.  The value of the offset must not be asserted,
  instead the invalid value should be checked and rejected if invalid.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Wed Aug 10 13:49:17 2016
(r303915)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Wed Aug 10 13:50:21 2016
(r303916)
@@ -819,10 +819,13 @@ tmpfs_dir_lookup_cookie(struct tmpfs_nod
goto out;
}
 
-   MPASS((cookie & TMPFS_DIRCOOKIE_MASK) == cookie);
-   dekey.td_hash = cookie;
-   /* Recover if direntry for cookie was removed */
-   de = RB_NFIND(tmpfs_dir, dirhead, &dekey);
+   if ((cookie & TMPFS_DIRCOOKIE_MASK) != cookie) {
+   de = NULL;
+   } else {
+   dekey.td_hash = cookie;
+   /* Recover if direntry for cookie was removed */
+   de = RB_NFIND(tmpfs_dir, dirhead, &dekey);
+   }
dc->tdc_tree = de;
dc->tdc_current = de;
if (de != NULL && tmpfs_dirent_duphead(de)) {
___
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: r303425 - in head: share/man/man9 sys/kern sys/sys

2016-08-10 Thread Hans Petter Selasky

On 07/28/16 10:57, Konstantin Belousov wrote:

+   if ((flags & C_HARDCLOCK) == 0)
+   to_sbt += tick_sbt;
+   } else
+ to_sbt = sbinuptime();

   ^^^ looks like two whitespaces sneaked in here.

+   if (SBT_MAX - to_sbt < sbt)
+   to_sbt = SBT_MAX;
+   else


Else looks good.

--HPS
___
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: r303919 - head/sys/kern

2016-08-10 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 10 14:41:53 2016
New Revision: 303919
URL: https://svnweb.freebsd.org/changeset/base/303919

Log:
  Fix indentation.
  
  Reported by:  hselasky
  MFC after:17 days

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cWed Aug 10 14:31:32 2016
(r303918)
+++ head/sys/kern/kern_timeout.cWed Aug 10 14:41:53 2016
(r303919)
@@ -984,7 +984,7 @@ callout_when(sbintime_t sbt, sbintime_t 
if ((flags & C_HARDCLOCK) == 0)
to_sbt += tick_sbt;
} else
- to_sbt = sbinuptime();
+   to_sbt = sbinuptime();
if (SBT_MAX - to_sbt < sbt)
to_sbt = SBT_MAX;
else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303920 - in head: include lib/libcrypt secure/lib/libcrypt

2016-08-10 Thread Ed Schouten
Author: ed
Date: Wed Aug 10 15:16:28 2016
New Revision: 303920
URL: https://svnweb.freebsd.org/changeset/base/303920

Log:
  Make libcrypt thread-safe. Add crypt_r(3).
  
  glibc has a pretty nice function called crypt_r(3), which is nothing
  more than crypt(3), but thread-safe. It accomplishes this by introducing
  a 'struct crypt_data' structure that contains a buffer that is large
  enough to hold the resulting string.
  
  Let's go ahead and also add this function. It would be a shame if a
  useful function like this wouldn't be usable in multithreaded apps.
  Refactor crypt.c and all of the backends to no longer declare static
  arrays, but write their output in a provided buffer.
  
  There is no need to do any buffer length computation here, as we'll just
  need to ensure that 'struct crypt_data' is large enough, which it is.
  _PASSWORD_LEN is defined to 128 bytes, but in this case I'm picking 256,
  as this is going to be part of the actual ABI.
  
  Differential Revision:https://reviews.freebsd.org/D7306

Modified:
  head/include/unistd.h
  head/lib/libcrypt/Makefile
  head/lib/libcrypt/crypt-md5.c
  head/lib/libcrypt/crypt-nthash.c
  head/lib/libcrypt/crypt-sha256.c
  head/lib/libcrypt/crypt-sha512.c
  head/lib/libcrypt/crypt.3
  head/lib/libcrypt/crypt.c
  head/lib/libcrypt/crypt.h
  head/lib/libcrypt/misc.c
  head/secure/lib/libcrypt/crypt-blowfish.c
  head/secure/lib/libcrypt/crypt-des.c

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Wed Aug 10 14:41:53 2016(r303919)
+++ head/include/unistd.h   Wed Aug 10 15:16:28 2016(r303920)
@@ -484,11 +484,18 @@ pid_t  vfork(void) __returns_twice;
 
 #if __BSD_VISIBLE
 struct timeval;/* select(2) */
+
+struct crypt_data {
+   int initialized;/* For compatibility with glibc. */
+   char__buf[256]; /* Buffer returned by crypt_r(). */
+};
+
 int acct(const char *);
 int async_daemon(void);
 int check_utility_compat(const char *);
 const char *
 crypt_get_format(void);
+char   *crypt_r(const char *, const char *, struct crypt_data *);
 int crypt_set_format(const char *);
 int des_cipher(const char *, char *, long, int);
 int des_setkey(const char *key);

Modified: head/lib/libcrypt/Makefile
==
--- head/lib/libcrypt/Makefile  Wed Aug 10 14:41:53 2016(r303919)
+++ head/lib/libcrypt/Makefile  Wed Aug 10 15:16:28 2016(r303920)
@@ -17,7 +17,8 @@ SRCS= crypt.c misc.c \
crypt-sha256.c sha256c.c \
crypt-sha512.c sha512c.c
 MAN=   crypt.3
-MLINKS=crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3
+MLINKS=crypt.3 crypt_get_format.3 crypt.3 crypt_r.3 \
+   crypt.3 crypt_set_format.3
 CFLAGS+=   -I${.CURDIR}/../libmd -I${.CURDIR}/../libutil \
-I${.CURDIR}/../../sys/crypto/sha2
 

Modified: head/lib/libcrypt/crypt-md5.c
==
--- head/lib/libcrypt/crypt-md5.c   Wed Aug 10 14:41:53 2016
(r303919)
+++ head/lib/libcrypt/crypt-md5.c   Wed Aug 10 15:16:28 2016
(r303920)
@@ -41,31 +41,27 @@ __FBSDID("$FreeBSD$");
  * UNIX password
  */
 
-char *
-crypt_md5(const char *pw, const char *salt)
+int
+crypt_md5(const char *pw, const char *salt, char *buffer)
 {
MD5_CTX ctx,ctx1;
unsigned long l;
int sl, pl;
u_int i;
u_char final[MD5_SIZE];
-   static const char *sp, *ep;
-   static char passwd[120], *p;
+   const char *ep;
static const char *magic = "$1$";
 
-   /* Refine the Salt first */
-   sp = salt;
-
-   /* If it starts with the magic string, then skip that */
-   if(!strncmp(sp, magic, strlen(magic)))
-   sp += strlen(magic);
+   /* If the salt starts with the magic string, skip that. */
+   if (!strncmp(salt, magic, strlen(magic)))
+   salt += strlen(magic);
 
/* It stops at the first '$', max 8 chars */
-   for(ep = sp; *ep && *ep != '$' && ep < (sp + 8); ep++)
+   for (ep = salt; *ep && *ep != '$' && ep < salt + 8; ep++)
continue;
 
/* get the length of the true salt */
-   sl = ep - sp;
+   sl = ep - salt;
 
MD5Init(&ctx);
 
@@ -76,12 +72,12 @@ crypt_md5(const char *pw, const char *sa
MD5Update(&ctx, (const u_char *)magic, strlen(magic));
 
/* Then the raw salt */
-   MD5Update(&ctx, (const u_char *)sp, (u_int)sl);
+   MD5Update(&ctx, (const u_char *)salt, (u_int)sl);
 
/* Then just as many characters of the MD5(pw,salt,pw) */
MD5Init(&ctx1);
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
-   MD5Update(&ctx1, (const u_char *)sp, (u_int)sl);
+

svn commit: r303921 - head/sys/kern

2016-08-10 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 10 15:24:15 2016
New Revision: 303921
URL: https://svnweb.freebsd.org/changeset/base/303921

Log:
  sigio: do a lockless check in funsetownlist
  
  There is no need to grab the lock first to see if sigio is used, and it
  typically is not.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cWed Aug 10 15:16:28 2016
(r303920)
+++ head/sys/kern/kern_descrip.cWed Aug 10 15:24:15 2016
(r303921)
@@ -942,6 +942,8 @@ funsetown(struct sigio **sigiop)
 {
struct sigio *sigio;
 
+   if (*sigiop == NULL)
+   return;
SIGIO_LOCK();
sigio = *sigiop;
if (sigio == 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: r303922 - head/sys/kern

2016-08-10 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 10 15:25:44 2016
New Revision: 303922
URL: https://svnweb.freebsd.org/changeset/base/303922

Log:
  ktrace: do a lockless check on fork to see if tracing is enabled
  
  This saves 2 lock acquisitions in the common case.

Modified:
  head/sys/kern/kern_ktrace.c

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Wed Aug 10 15:24:15 2016(r303921)
+++ head/sys/kern/kern_ktrace.c Wed Aug 10 15:25:44 2016(r303922)
@@ -572,9 +572,14 @@ void
 ktrprocfork(struct proc *p1, struct proc *p2)
 {
 
+   MPASS(p2->p_tracevp == NULL);
+   MPASS(p2->p_traceflag == 0);
+
+   if (p1->p_traceflag == 0)
+   return;
+
PROC_LOCK(p1);
mtx_lock(&ktrace_mtx);
-   KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode"));
if (p1->p_traceflag & KTRFAC_INHERIT) {
p2->p_traceflag = p1->p_traceflag;
if ((p2->p_tracevp = p1->p_tracevp) != 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: r303923 - head/sys/arm64/arm64

2016-08-10 Thread Ed Schouten
Author: ed
Date: Wed Aug 10 15:45:25 2016
New Revision: 303923
URL: https://svnweb.freebsd.org/changeset/base/303923

Log:
  Make cpu_set_user_tls() work when called on the running thread.
  
  On all the other architectures, this function can also be called on the
  currently running thread. In this case, we shouldn't fix up the address
  in the PCB, but also patch up the register itself. Otherwise it will not
  become active and will simply become overwritten by the next switch.
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D7437

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

Modified: head/sys/arm64/arm64/vm_machdep.c
==
--- head/sys/arm64/arm64/vm_machdep.c   Wed Aug 10 15:25:44 2016
(r303922)
+++ head/sys/arm64/arm64/vm_machdep.c   Wed Aug 10 15:45:25 2016
(r303923)
@@ -201,6 +201,8 @@ cpu_set_user_tls(struct thread *td, void
 
pcb = td->td_pcb;
pcb->pcb_tpidr_el0 = (register_t)tls_base;
+   if (td == curthread)
+   WRITE_SPECIALREG(tpidr_el0, tls_base);
 
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"


Re: svn commit: r303426 - in head/sys: ddb kern sys

2016-08-10 Thread Hans Petter Selasky

On 07/28/16 11:09, Konstantin Belousov wrote:

Author: kib
Date: Thu Jul 28 09:09:55 2016
New Revision: 303426
URL: https://svnweb.freebsd.org/changeset/base/303426

Log:
  Rewrite subr_sleepqueue.c use of callouts to not depend on the
  specifics of callout KPI.  Esp., do not depend on the exact interface
  of callout_stop(9) return values.

  The main change is that instead of requiring precise callouts, code
  maintains absolute time to wake up.  Callouts now should ensure that a
  wake occurs at the requested moment, but we can tolerate both run-away
  callout, and callout_stop(9) lying about running callout either way.

  As consequence, it removes the constant source of the bugs where
  sleepq_check_timeout() causes uninterruptible thread state where the
  thread is detached from CPU, see e.g. r234952 and r296320.

  Patch also removes dual meaning of the TDF_TIMEOUT flag, making code
  (IMO much) simpler to reason about.

  Tested by:pho
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 month
  Differential revision:https://reviews.freebsd.org/D7137

Modified:
  head/sys/ddb/db_ps.c
  head/sys/kern/kern_thread.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/proc.h



Hi,

I think that:

#define SWT_SLEEPQTIMO  5   /* Sleepq timeout wait. */

in sys/proc.h can also be marked "available" after this change.

--HPS

___
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: r303924 - in head/sys: fs/smbfs fs/unionfs kern sys ufs/ffs ufs/ufs vm

2016-08-10 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Aug 10 16:12:31 2016
New Revision: 303924
URL: https://svnweb.freebsd.org/changeset/base/303924

Log:
  Replace all remaining calls to vprint(9) with vn_printf(9), and remove
  the old macro.
  
  MFC after:1 month

Modified:
  head/sys/fs/smbfs/smbfs_node.c
  head/sys/fs/unionfs/union_vnops.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_lookup.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/vnode.h
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ufs/ufs_lookup.c
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/vm/vm_object.c

Modified: head/sys/fs/smbfs/smbfs_node.c
==
--- head/sys/fs/smbfs/smbfs_node.c  Wed Aug 10 15:45:25 2016
(r303923)
+++ head/sys/fs/smbfs/smbfs_node.c  Wed Aug 10 16:12:31 2016
(r303924)
@@ -132,7 +132,7 @@ smbfs_node_alloc(struct mount *mp, struc
}
dnp = dvp ? VTOSMB(dvp) : NULL;
if (dnp == NULL && dvp != NULL) {
-   vprint("smbfs_node_alloc: dead parent vnode", dvp);
+   vn_printf(dvp, "smbfs_node_alloc: dead parent vnode ");
return EINVAL;
}
error = vfs_hash_get(mp, smbfs_hash(name, nmlen), LK_EXCLUSIVE, td,

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Wed Aug 10 15:45:25 2016
(r303923)
+++ head/sys/fs/unionfs/union_vnops.c   Wed Aug 10 16:12:31 2016
(r303924)
@@ -1753,9 +1753,9 @@ unionfs_print(struct vop_print_args *ap)
*/
 
if (unp->un_uppervp != NULLVP)
-   vprint("unionfs: upper", unp->un_uppervp);
+   vn_printf(unp->un_uppervp, "unionfs: upper ");
if (unp->un_lowervp != NULLVP)
-   vprint("unionfs: lower", unp->un_lowervp);
+   vn_printf(unp->un_lowervp, "unionfs: lower ");
 
return (0);
 }

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Wed Aug 10 15:45:25 2016(r303923)
+++ head/sys/kern/vfs_default.c Wed Aug 10 16:12:31 2016(r303924)
@@ -256,7 +256,7 @@ static int
 vop_nostrategy (struct vop_strategy_args *ap)
 {
printf("No strategy for buffer at %p\n", ap->a_bp);
-   vprint("vnode", ap->a_vp);
+   vn_printf(ap->a_vp, "vnode ");
ap->a_bp->b_ioflags |= BIO_ERROR;
ap->a_bp->b_error = EOPNOTSUPP;
bufdone(ap->a_bp);
@@ -722,7 +722,7 @@ loop2:
}
BO_UNLOCK(bo);
if (error == EAGAIN)
-   vprint("fsync: giving up on dirty", vp);
+   vn_printf(vp, "fsync: giving up on dirty ");
 
return (error);
 }

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Wed Aug 10 15:45:25 2016(r303923)
+++ head/sys/kern/vfs_lookup.c  Wed Aug 10 16:12:31 2016(r303924)
@@ -721,7 +721,7 @@ unionlookup:
if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags))
cnp->cn_lkflags = LK_EXCLUSIVE;
 #ifdef NAMEI_DIAGNOSTIC
-   vprint("lookup in", dp);
+   vn_printf(dp, "lookup in ");
 #endif
lkflags_save = cnp->cn_lkflags;
cnp->cn_lkflags = compute_cn_lkflags(dp->v_mount, cnp->cn_lkflags,
@@ -1007,7 +1007,7 @@ relookup(struct vnode *dvp, struct vnode
 * We now have a segment name to search for, and a directory to search.
 */
 #ifdef NAMEI_DIAGNOSTIC
-   vprint("search in:", dp);
+   vn_printf(dp, "search in ");
 #endif
if ((error = VOP_LOOKUP(dp, vpp, cnp)) != 0) {
KASSERT(*vpp == NULL, ("leaf should be empty"));

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Wed Aug 10 15:45:25 2016(r303923)
+++ head/sys/kern/vfs_mount.c   Wed Aug 10 16:12:31 2016(r303924)
@@ -510,7 +510,7 @@ vfs_mount_destroy(struct mount *mp)
struct vnode *vp;
 
TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes)
-   vprint("", vp);
+   vn_printf(vp, "dangling vnode ");
panic("unmount: dangling vnode");
}
KASSERT(TAILQ_EMPTY(&mp->mnt_uppers), ("mnt_uppers"));

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Aug 10 15:45:25 2016(r303923)
+++ head/sys/kern/vfs_subr.cWed Aug 10 16:12:31 2016(r303924)
@@ -2645,7 +2645,7 @@ vputx(struct vnode *vp, int func)
error = 0;
 
if (vp->v_usecount != 0) {
-   vprint("vputx: usecount not zero", vp);
+   vn_printf(vp, "vputx: usecount not zero for vnode "

Re: svn commit: r303887 - head/tools/tools/dmardump

2016-08-10 Thread John Baldwin
On Wednesday, August 10, 2016 10:43:03 AM Konstantin Belousov wrote:
> On Tue, Aug 09, 2016 at 02:22:36PM -0700, John Baldwin wrote:
> > On Tuesday, August 09, 2016 07:06:05 PM John Baldwin wrote:
> > > Author: jhb
> > > Date: Tue Aug  9 19:06:05 2016
> > > New Revision: 303887
> > > URL: https://svnweb.freebsd.org/changeset/base/303887
> > > 
> > > Log:
> > >   Add a dmardump utility to dump the VT-d context tables.
> > >   
> > >   This tool parses the ACPI DMAR table looking for DMA remapping devices.
> > >   For each device it walks the root table and any context tables
> > >   referenced to display mapping info for PCI devices.
> > >   
> > >   Note that acpidump -t already parses the info in the ACPI DMAR tables
> > >   directly.  This tool examines some of the data structures the DMAR
> > >   remapping engines use to translate DMA requests.
> > >   
> > >   Reviewed by:kib, grehan
> > >   MFC after:  1 month
> > >   Sponsored by:   Chelsio Communications
> > >   Differential Revision:  https://reviews.freebsd.org/D7444
> > 
> > I should have mentioned that this tool only supports "normal" context
> > entry tables.  It does not (yet) support extended context entry
> > tables.  However, neither bhyve nor ACPI_DMAR create extended context
> > entry tables.
> 
> I am not aware of existence of hardware supporting the extended context
> entries.  Even Skykale E3 v5 Xeons report ECS == 0.

That's completely fair, I was just going by what was in the recent spec.
I don't think it's worth implementing until anything actually uses it
certainly.

-- 
John Baldwin
___
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: r303927 - head/sys/netinet

2016-08-10 Thread Michael Tuexen
Author: tuexen
Date: Wed Aug 10 17:19:33 2016
New Revision: 303927
URL: https://svnweb.freebsd.org/changeset/base/303927

Log:
  Improve a consistency check to not detect valid cases for
  unordered user messages using DATA chunks as invalid ones.
  While there, ensure that error causes are provided when
  sending ABORT chunks in case of reassembly problems detected.
  Thanks to Taylor Brandstetter for making me aware of this problem.
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Wed Aug 10 17:11:12 2016
(r303926)
+++ head/sys/netinet/sctp_indata.c  Wed Aug 10 17:19:33 2016
(r303927)
@@ -1747,21 +1747,27 @@ sctp_process_a_data_chunk(struct sctp_tc
 * If its a fragmented message, lets see if we can find the control
 * on the reassembly queues.
 */
-   if ((chtype == SCTP_IDATA) && ((chunk_flags & SCTP_DATA_FIRST_FRAG) == 
0) && (fsn == 0)) {
+   if ((chtype == SCTP_IDATA) &&
+   ((chunk_flags & SCTP_DATA_FIRST_FRAG) == 0) &&
+   (fsn == 0)) {
/*
 * The first *must* be fsn 0, and other (middle/end) pieces
-* can *not* be fsn 0.
+* can *not* be fsn 0. XXX: This can happen in case of a
+* wrap around. Ignore is for now.
 */
+   snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but 
flags=%2.2x",
+   msg_id, chunk_flags);
goto err_out;
}
+   control = sctp_find_reasm_entry(strm, msg_id, ordered, old_data);
+   SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues 
%p\n",
+   chunk_flags, control);
if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) {
/* See if we can find the re-assembly entity */
-   control = sctp_find_reasm_entry(strm, msg_id, ordered, 
old_data);
-   SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on 
queues %p\n",
-   chunk_flags, control);
-   if (control) {
+   if (control != NULL) {
/* We found something, does it belong? */
if (ordered && (msg_id != control->sinfo_ssn)) {
+   snprintf(msg, sizeof(msg), "Reassembly problem 
(MID=%8.8x)", msg_id);
err_out:
op_err = 
sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
stcb->sctp_ep->last_abort_code = 
SCTP_FROM_SCTP_INDATA + SCTP_LOC_15;
@@ -1774,6 +1780,8 @@ sctp_process_a_data_chunk(struct sctp_tc
 * We can't have a switched order with an
 * unordered chunk
 */
+   snprintf(msg, sizeof(msg), "All fragments of a 
user message must be ordered or unordered (TSN=%8.8x)",
+   tsn);
goto err_out;
}
if (!ordered && (((control->sinfo_flags >> 8) & 
SCTP_DATA_UNORDERED) == 0)) {
@@ -1781,6 +1789,8 @@ sctp_process_a_data_chunk(struct sctp_tc
 * We can't have a switched unordered with a
 * ordered chunk
 */
+   snprintf(msg, sizeof(msg), "All fragments of a 
user message must be ordered or unordered (TSN=%8.8x)",
+   tsn);
goto err_out;
}
}
@@ -1790,14 +1800,21 @@ sctp_process_a_data_chunk(struct sctp_tc
 * re-assembly going on with the same Stream/Seq (for
 * ordered) or in the same Stream for unordered.
 */
-   SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for msg in case 
we have dup\n",
-   chunk_flags);
-   if (sctp_find_reasm_entry(strm, msg_id, ordered, old_data)) {
-   SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected 
on msg_id: %u\n",
-   chunk_flags,
-   msg_id);
-
-   goto err_out;
+   if (control != NULL) {
+   if (ordered || (old_data == 0)) {
+   SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup 
detected on msg_id: %u\n",
+   chunk_flags, msg_id);
+   snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x 
detected.", msg_id);
+   goto err_out;
+   } else {
+   if ((tsn == control->fsn_included + 1) &&
+ 

svn commit: r303929 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:02 2016
New Revision: 303929
URL: https://svnweb.freebsd.org/changeset/base/303929

Log:
  Fix -S with -b not atomically updating the destination file.
  
  With both of these flags, the backup was created via rename(dest, backup)
  followed by rename(tmp, dest).  This left the destination file missing
  for a moment which contradicts the point of -S.
  
  This fixes a race with installworld where PRECIOUSPROG and PRECIOUSLIB
  files (which use -S for installation) would briefly be missing.  In the
  case of installing rtld with parallel installworld it could render an
  error due to not having rtld present to run install/cp in another
  process.
  
  Reported by:  jhb
  Reviewed by:  jhb
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7451

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 18:18:51 2016
(r303928)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:02 2016
(r303929)
@@ -892,11 +892,17 @@ install(const char *from_name, const cha
}
if (verbose)
(void)printf("install: %s -> %s\n", to_name, 
backup);
-   if (rename(to_name, backup) < 0) {
+   if (unlink(backup) < 0 && errno != ENOENT) {
serrno = errno;
unlink(tempfile);
errno = serrno;
-   err(EX_OSERR, "rename: %s to %s", to_name,
+   err(EX_OSERR, "unlink: %s", backup);
+   }
+   if (link(to_name, backup) < 0) {
+   serrno = errno;
+   unlink(tempfile);
+   errno = serrno;
+   err(EX_OSERR, "link: %s to %s", to_name,
 backup);
}
}
___
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: r303928 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:18:51 2016
New Revision: 303928
URL: https://svnweb.freebsd.org/changeset/base/303928

Log:
  Trim out excessive / with -v when target directory ends with a trailing '/'.
  
  This is a minor nit after r289391 made all installations to a directory always
  end in a trailing '/'.
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 17:19:33 2016
(r303927)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:18:51 2016
(r303928)
@@ -749,8 +749,9 @@ install(const char *from_name, const cha
}
/* Build the target path. */
if (flags & DIRECTORY) {
-   (void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
+   (void)snprintf(pathbuf, sizeof(pathbuf), "%s%s%s",
to_name,
+   to_name[strlen(to_name) - 1] == '/' ? "" : "/",
(p = strrchr(from_name, '/')) ? ++p : from_name);
to_name = pathbuf;
}
___
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: r303934 - head/usr.bin/truss

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:17 2016
New Revision: 303934
URL: https://svnweb.freebsd.org/changeset/base/303934

Log:
  Support rmdir(2).
  
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Wed Aug 10 18:19:14 2016
(r303933)
+++ head/usr.bin/truss/syscalls.c   Wed Aug 10 18:19:17 2016
(r303934)
@@ -279,6 +279,8 @@ static struct syscall decoded_syscalls[]
  .args = { { Name, 0 }, { Name, 1 } } },
{ .name = "renameat", .ret_type = 1, .nargs = 4,
  .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
+   { .name = "rmdir", .ret_type = 1, .nargs = 2,
+ .args = { { Name, 0 }, { Octal, 1 } } },
{ .name = "rfork", .ret_type = 1, .nargs = 1,
  .args = { { Rforkflags, 0 } } },
{ .name = "select", .ret_type = 1, .nargs = 5,
___
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: r303933 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:14 2016
New Revision: 303933
URL: https://svnweb.freebsd.org/changeset/base/303933

Log:
  Squelch a false-positive Clang static analyzer warning.
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:11 2016
(r303932)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:14 2016
(r303933)
@@ -149,6 +149,7 @@ main(int argc, char *argv[])
char *p;
const char *to_name;
 
+   fset = 0;
iflags = 0;
group = owner = NULL;
while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
___
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: r303930 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:05 2016
New Revision: 303930
URL: https://svnweb.freebsd.org/changeset/base/303930

Log:
  Support -v for -l.
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:02 2016
(r303929)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:05 2016
(r303930)
@@ -533,6 +533,9 @@ do_link(const char *from_name, const cha
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
 ~NOCHANGEBITS);
+   if (verbose)
+   printf("install: link %s -> %s\n",
+   from_name, to_name);
unlink(to_name);
ret = rename(tmpl, to_name);
/*
@@ -543,8 +546,12 @@ do_link(const char *from_name, const cha
(void)unlink(tmpl);
}
return (ret);
-   } else
+   } else {
+   if (verbose)
+   printf("install: link %s -> %s\n",
+   from_name, to_name);
return (link(from_name, to_name));
+   }
 }
 
 /*
@@ -575,12 +582,18 @@ do_symlink(const char *from_name, const 
 ~NOCHANGEBITS);
unlink(to_name);
 
+   if (verbose)
+   printf("install: symlink %s -> %s\n",
+   from_name, to_name);
if (rename(tmpl, to_name) == -1) {
/* Remove temporary link before exiting. */
(void)unlink(tmpl);
err(EX_OSERR, "%s: rename", to_name);
}
} else {
+   if (verbose)
+   printf("install: symlink %s -> %s\n",
+   from_name, to_name);
if (symlink(from_name, to_name) == -1)
err(EX_OSERR, "symlink %s -> %s", from_name, to_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: r303932 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:11 2016
New Revision: 303932
URL: https://svnweb.freebsd.org/changeset/base/303932

Log:
  Fix -b failure not restoring flags on the destination file.
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:08 2016
(r303931)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:11 2016
(r303932)
@@ -904,6 +904,8 @@ install(const char *from_name, const cha
(void)printf("install: %s -> %s\n", to_name, 
backup);
if (unlink(backup) < 0 && errno != ENOENT) {
serrno = errno;
+   if (to_sb.st_flags & NOCHANGEBITS)
+   (void)chflags(to_name, to_sb.st_flags);
unlink(tempfile);
errno = serrno;
err(EX_OSERR, "unlink: %s", backup);
@@ -911,6 +913,8 @@ install(const char *from_name, const cha
if (link(to_name, backup) < 0) {
serrno = errno;
unlink(tempfile);
+   if (to_sb.st_flags & NOCHANGEBITS)
+   (void)chflags(to_name, to_sb.st_flags);
errno = serrno;
err(EX_OSERR, "link: %s to %s", to_name,
 backup);
@@ -1133,16 +1137,26 @@ create_newfile(const char *path, int tar
 
if (dobackup) {
if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s",
-   path, suffix) != strlen(path) + strlen(suffix))
+   path, suffix) != strlen(path) + strlen(suffix)) {
+   saved_errno = errno;
+   if (sbp->st_flags & NOCHANGEBITS)
+   (void)chflags(path, sbp->st_flags);
+   errno = saved_errno;
errx(EX_OSERR, "%s: backup filename too long",
path);
+   }
(void)snprintf(backup, MAXPATHLEN, "%s%s",
path, suffix);
if (verbose)
(void)printf("install: %s -> %s\n",
path, backup);
-   if (rename(path, backup) < 0)
+   if (rename(path, backup) < 0) {
+   saved_errno = errno;
+   if (sbp->st_flags & NOCHANGEBITS)
+   (void)chflags(path, sbp->st_flags);
+   errno = saved_errno;
err(EX_OSERR, "rename: %s to %s", path, backup);
+   }
} else
if (unlink(path) < 0)
saved_errno = errno;
___
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: r303931 - head/usr.bin/xinstall

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:19:08 2016
New Revision: 303931
URL: https://svnweb.freebsd.org/changeset/base/303931

Log:
  Fix -S with -l not being atomic.
  
  It was unlinking the target even though it uses rename(2) which already
  effectively does that.  -S is intended to not unlink(2) the target first.
  
  MFC after:1 week
  Reviewed by:  jhb
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7452

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:05 2016
(r303930)
+++ head/usr.bin/xinstall/xinstall.cWed Aug 10 18:19:08 2016
(r303931)
@@ -536,7 +536,6 @@ do_link(const char *from_name, const cha
if (verbose)
printf("install: link %s -> %s\n",
from_name, to_name);
-   unlink(to_name);
ret = rename(tmpl, to_name);
/*
 * If rename has posix semantics, then the temporary
@@ -580,8 +579,6 @@ do_symlink(const char *from_name, const 
if (target_sb->st_flags & NOCHANGEBITS)
(void)chflags(to_name, target_sb->st_flags &
 ~NOCHANGEBITS);
-   unlink(to_name);
-
if (verbose)
printf("install: symlink %s -> %s\n",
from_name, to_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: r303935 - head

2016-08-10 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Wed Aug 10 18:22:42 2016
New Revision: 303935
URL: https://svnweb.freebsd.org/changeset/base/303935

Log:
  Only remove empty directories before packaging.
  
  This preserves files are intentionally empty, most of them are in tests.txz
  
  Reviewed by:  bdrewery
  MFC after:3 days

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Aug 10 18:19:17 2016(r303934)
+++ head/Makefile.inc1  Wed Aug 10 18:22:42 2016(r303935)
@@ -1013,7 +1013,7 @@ distributeworld installworld stageworld:
${IMAKEENV} rm -rf ${INSTALLTMP}
 .if make(distributeworld)
 .for dist in ${EXTRA_DISTRIBUTIONS}
-   find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
+   find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete
 .endfor
 .if defined(NO_ROOT)
 .for dist in base ${EXTRA_DISTRIBUTIONS}
___
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: r303936 - head/sys/boot/i386/libi386

2016-08-10 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Aug 10 18:23:23 2016
New Revision: 303936
URL: https://svnweb.freebsd.org/changeset/base/303936

Log:
  Add kernel environment variables under smbios.system for the following
  SMBIOS Type 1 fields:
  smbios.system.sku  - SKU Number (SMBIOS 2.4 and above)
  smbios.system.family   - Family (SMBIOS 2.4 and above)
  
  Add kernel environment variables under smbios.planar for the following
  SMBIOS Type 2 fields:
  smbios.planar.tag  - Asset Tag
  smbios.planar.location - Location in Chassis
  
  Reviewed by:  jhb, grembo
  Approved by:  sjg (mentor)
  MFC after:2 weeks
  Sponsored by: Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D7453

Modified:
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/i386/libi386/smbios.c
==
--- head/sys/boot/i386/libi386/smbios.c Wed Aug 10 18:22:42 2016
(r303935)
+++ head/sys/boot/i386/libi386/smbios.c Wed Aug 10 18:23:23 2016
(r303936)
@@ -238,6 +238,10 @@ smbios_parse_table(const caddr_t addr)
smbios_setenv("smbios.system.serial", addr, 0x07);
smbios_setuuid("smbios.system.uuid", addr + 0x08, smbios.ver);
 #endif
+   if (smbios.major >= 2 && smbios.minor >= 4) {
+   smbios_setenv("smbios.system.sku", addr, 0x19);
+   smbios_setenv("smbios.system.family", addr, 0x1a);
+   }
break;
 
case 2: /* 3.3.3 Base Board (or Module) Information (Type 2) */
@@ -246,7 +250,9 @@ smbios_parse_table(const caddr_t addr)
smbios_setenv("smbios.planar.version", addr, 0x06);
 #ifdef SMBIOS_SERIAL_NUMBERS
smbios_setenv("smbios.planar.serial", addr, 0x07);
+   smbios_setenv("smbios.planar.tag", addr, 0x08);
 #endif
+   smbios_setenv("smbios.planar.location", addr, 0x0a);
break;
 
case 3: /* 3.3.4 System Enclosure or Chassis (Type 3) */
___
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: r303934 - head/usr.bin/truss

2016-08-10 Thread Konstantin Belousov
On Wed, Aug 10, 2016 at 06:19:17PM +, Bryan Drewery wrote:
> Author: bdrewery
> Date: Wed Aug 10 18:19:17 2016
> New Revision: 303934
> URL: https://svnweb.freebsd.org/changeset/base/303934
> 
> Log:
>   Support rmdir(2).
>   
>   MFC after:  3 days
>   Sponsored by:   EMC / Isilon Storage Division
> 
> Modified:
>   head/usr.bin/truss/syscalls.c
> 
> Modified: head/usr.bin/truss/syscalls.c
> ==
> --- head/usr.bin/truss/syscalls.c Wed Aug 10 18:19:14 2016
> (r303933)
> +++ head/usr.bin/truss/syscalls.c Wed Aug 10 18:19:17 2016
> (r303934)
> @@ -279,6 +279,8 @@ static struct syscall decoded_syscalls[]
> .args = { { Name, 0 }, { Name, 1 } } },
>   { .name = "renameat", .ret_type = 1, .nargs = 4,
> .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
> + { .name = "rmdir", .ret_type = 1, .nargs = 2,
> +   .args = { { Name, 0 }, { Octal, 1 } } },
I do not quite follow this.  The table format is that nargs is the number
of arguments to the syscall, and args describe each syscall' argument,
are my assumptions right ?

If yes, what is the second rmdir(2) argument for ?

>   { .name = "rfork", .ret_type = 1, .nargs = 1,
> .args = { { Rforkflags, 0 } } },
>   { .name = "select", .ret_type = 1, .nargs = 5,
___
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: r303937 - head/usr.bin/truss

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 18:45:26 2016
New Revision: 303937
URL: https://svnweb.freebsd.org/changeset/base/303937

Log:
  Use proper argument length for rmdir(2) for r303934.
  
  Reported by:  kib
  X-MFC-With:   r303934
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Wed Aug 10 18:23:23 2016
(r303936)
+++ head/usr.bin/truss/syscalls.c   Wed Aug 10 18:45:26 2016
(r303937)
@@ -279,8 +279,8 @@ static struct syscall decoded_syscalls[]
  .args = { { Name, 0 }, { Name, 1 } } },
{ .name = "renameat", .ret_type = 1, .nargs = 4,
  .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
-   { .name = "rmdir", .ret_type = 1, .nargs = 2,
- .args = { { Name, 0 }, { Octal, 1 } } },
+   { .name = "rmdir", .ret_type = 1, .nargs = 1,
+ .args = { { Name, 0 } } },
{ .name = "rfork", .ret_type = 1, .nargs = 1,
  .args = { { Rforkflags, 0 } } },
{ .name = "select", .ret_type = 1, .nargs = 5,
___
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: r303934 - head/usr.bin/truss

2016-08-10 Thread Bryan Drewery
On 8/10/16 11:41 AM, Konstantin Belousov wrote:
> On Wed, Aug 10, 2016 at 06:19:17PM +, Bryan Drewery wrote:
>> Author: bdrewery
>> Date: Wed Aug 10 18:19:17 2016
>> New Revision: 303934
>> URL: https://svnweb.freebsd.org/changeset/base/303934
>>
>> Log:
>>   Support rmdir(2).
>>   
>>   MFC after: 3 days
>>   Sponsored by:  EMC / Isilon Storage Division
>>
>> Modified:
>>   head/usr.bin/truss/syscalls.c
>>
>> Modified: head/usr.bin/truss/syscalls.c
>> ==
>> --- head/usr.bin/truss/syscalls.cWed Aug 10 18:19:14 2016
>> (r303933)
>> +++ head/usr.bin/truss/syscalls.cWed Aug 10 18:19:17 2016
>> (r303934)
>> @@ -279,6 +279,8 @@ static struct syscall decoded_syscalls[]
>>.args = { { Name, 0 }, { Name, 1 } } },
>>  { .name = "renameat", .ret_type = 1, .nargs = 4,
>>.args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
>> +{ .name = "rmdir", .ret_type = 1, .nargs = 2,
>> +  .args = { { Name, 0 }, { Octal, 1 } } },
> I do not quite follow this.  The table format is that nargs is the number
> of arguments to the syscall, and args describe each syscall' argument,
> are my assumptions right ?
> 
> If yes, what is the second rmdir(2) argument for ?

You're right, it's a bug.  I had copied the wrong syscall and missed this.

Fixing it, thanks.

> 
>>  { .name = "rfork", .ret_type = 1, .nargs = 1,
>>.args = { { Rforkflags, 0 } } },
>>  { .name = "select", .ret_type = 1, .nargs = 5,


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r303941 - in head/sys: amd64/cloudabi64 arm64/cloudabi64 compat/cloudabi compat/cloudabi64 conf modules/cloudabi modules/cloudabi64

2016-08-10 Thread Ed Schouten
Author: ed
Date: Wed Aug 10 21:02:41 2016
New Revision: 303941
URL: https://svnweb.freebsd.org/changeset/base/303941

Log:
  Provide the CloudABI vDSO to its executables.
  
  CloudABI executables already provide support for passing in vDSOs. This
  functionality is used by the emulator for OS X to inject system call
  handlers. On FreeBSD, we could use it to optimize calls to
  gettimeofday(), etc.
  
  Though I don't have any plans to optimize any system calls right now,
  let's go ahead and already pass in a vDSO. This will allow us to
  simplify the executables, as the traditional "syscall" shims can be
  removed entirely. It also means that we gain more flexibility with
  regards to adding and removing system calls.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D7438

Added:
  head/sys/compat/cloudabi/cloudabi_vdso.c   (contents, props changed)
  head/sys/compat/cloudabi64/cloudabi64_vdso.lds.s
 - copied, changed from r303816, head/sys/amd64/linux/linux_vdso.lds.s
Modified:
  head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
  head/sys/arm64/cloudabi64/cloudabi64_sysvec.c
  head/sys/compat/cloudabi/cloudabi_util.h
  head/sys/compat/cloudabi64/cloudabi64_module.c
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/files.arm64
  head/sys/modules/cloudabi/Makefile
  head/sys/modules/cloudabi64/Makefile

Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
==
--- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c   Wed Aug 10 20:34:25 
2016(r303940)
+++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c   Wed Aug 10 21:02:41 
2016(r303941)
@@ -196,7 +196,6 @@ static struct sysentvec cloudabi64_elf_s
.sv_pagesize= PAGE_SIZE,
.sv_minuser = VM_MIN_ADDRESS,
.sv_maxuser = VM_MAXUSER_ADDRESS,
-   .sv_usrstack= USRSTACK,
.sv_stackprot   = VM_PROT_READ | VM_PROT_WRITE,
.sv_copyout_strings = cloudabi64_copyout_strings,
.sv_setregs = cloudabi64_proc_setregs,

Modified: head/sys/arm64/cloudabi64/cloudabi64_sysvec.c
==
--- head/sys/arm64/cloudabi64/cloudabi64_sysvec.c   Wed Aug 10 20:34:25 
2016(r303940)
+++ head/sys/arm64/cloudabi64/cloudabi64_sysvec.c   Wed Aug 10 21:02:41 
2016(r303941)
@@ -165,7 +165,6 @@ static struct sysentvec cloudabi64_elf_s
.sv_pagesize= PAGE_SIZE,
.sv_minuser = VM_MIN_ADDRESS,
.sv_maxuser = VM_MAXUSER_ADDRESS,
-   .sv_usrstack= USRSTACK,
.sv_stackprot   = VM_PROT_READ | VM_PROT_WRITE,
.sv_copyout_strings = cloudabi64_copyout_strings,
.sv_setregs = cloudabi64_proc_setregs,

Modified: head/sys/compat/cloudabi/cloudabi_util.h
==
--- head/sys/compat/cloudabi/cloudabi_util.hWed Aug 10 20:34:25 2016
(r303940)
+++ head/sys/compat/cloudabi/cloudabi_util.hWed Aug 10 21:02:41 2016
(r303941)
@@ -33,6 +33,7 @@
 #include 
 
 struct file;
+struct sysentvec;
 struct thread;
 struct timespec;
 
@@ -76,4 +77,8 @@ int cloudabi_futex_lock_wrlock(struct th
 cloudabi_scope_t, cloudabi_clockid_t, cloudabi_timestamp_t,
 cloudabi_timestamp_t);
 
+/* vDSO setup and teardown. */
+void cloudabi_vdso_init(struct sysentvec *, char *, char *);
+void cloudabi_vdso_destroy(struct sysentvec *);
+
 #endif

Added: head/sys/compat/cloudabi/cloudabi_vdso.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/cloudabi/cloudabi_vdso.cWed Aug 10 21:02:41 2016
(r303941)
@@ -0,0 +1,88 @@
+/*-
+ * Copyright (c) 2016 Nuxi, https://nuxi.nl/
+ *
+ * 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

svn commit: r303942 - head/usr.bin/truss

2016-08-10 Thread Bryan Drewery
Author: bdrewery
Date: Wed Aug 10 21:59:59 2016
New Revision: 303942
URL: https://svnweb.freebsd.org/changeset/base/303942

Log:
  Fix sorting in r303934.
  
  Reported by:  jhb
  X-MFC-With:   r303934
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Wed Aug 10 21:02:41 2016
(r303941)
+++ head/usr.bin/truss/syscalls.c   Wed Aug 10 21:59:59 2016
(r303942)
@@ -279,10 +279,10 @@ static struct syscall decoded_syscalls[]
  .args = { { Name, 0 }, { Name, 1 } } },
{ .name = "renameat", .ret_type = 1, .nargs = 4,
  .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } },
-   { .name = "rmdir", .ret_type = 1, .nargs = 1,
- .args = { { Name, 0 } } },
{ .name = "rfork", .ret_type = 1, .nargs = 1,
  .args = { { Rforkflags, 0 } } },
+   { .name = "rmdir", .ret_type = 1, .nargs = 1,
+ .args = { { Name, 0 } } },
{ .name = "select", .ret_type = 1, .nargs = 5,
  .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 },
{ Timeval, 4 } } },
___
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: r303943 - head/etc/rc.d

2016-08-10 Thread Devin Teske
Author: dteske
Date: Wed Aug 10 23:24:21 2016
New Revision: 303943
URL: https://svnweb.freebsd.org/changeset/base/303943

Log:
  Allow enforce_statfs (see jail(8)) to be set per jail
  
  Reviewed by:  jelischer
  MFC after:3 days

Modified:
  head/etc/rc.d/jail

Modified: head/etc/rc.d/jail
==
--- head/etc/rc.d/jail  Wed Aug 10 21:59:59 2016(r303942)
+++ head/etc/rc.d/jail  Wed Aug 10 23:24:21 2016(r303943)
@@ -260,6 +260,7 @@ parse_options()
 
extract_var $_jv set_hostname_allow allow.set_hostname YN NO
extract_var $_jv sysvipc_allow allow.sysvipc YN NO
+   extract_var $_jv enforce_statfs enforce_statfs - 2
extract_var $_jv osreldate osreldate
extract_var $_jv osrelease osrelease
for _p in $_parameters; do
___
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: r303944 - head/sys/cam/scsi

2016-08-10 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Aug 11 03:12:56 2016
New Revision: 303944
URL: https://svnweb.freebsd.org/changeset/base/303944

Log:
  cam/da: Add quirk for I-O Data USB Flash Disk
  
  PR:   211716
  Submitted by: Jun Su 
  Reported by:  Jun Su 
  MFC after:1 week
  Sponsored by: Microsoft

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Wed Aug 10 23:24:21 2016(r303943)
+++ head/sys/cam/scsi/scsi_da.c Thu Aug 11 03:12:56 2016(r303944)
@@ -814,6 +814,14 @@ static struct da_quirk_entry da_quirk_ta
{T_DIRECT, SIP_MEDIA_REMOVABLE, "JetFlash", "Transcend*",
 "*"}, /*quirks*/ DA_Q_NO_RC16
},
+   {
+   /*
+* I-O Data USB Flash Disk
+* PR: usb/211716
+*/
+   {T_DIRECT, SIP_MEDIA_REMOVABLE, "I-O DATA", "USB Flash Disk*",
+"*"}, /*quirks*/ DA_Q_NO_RC16
+   },
/* ATA/SATA devices over SAS/USB/... */
{
/* Hitachi Advanced Format (4k) drives */
___
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: r303945 - head/sys/dev/hyperv/include

2016-08-10 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Aug 11 03:20:38 2016
New Revision: 303945
URL: https://svnweb.freebsd.org/changeset/base/303945

Log:
  hyperv/vmbus: Add macro to get channel packet data length.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7455

Modified:
  head/sys/dev/hyperv/include/vmbus.h

Modified: head/sys/dev/hyperv/include/vmbus.h
==
--- head/sys/dev/hyperv/include/vmbus.h Thu Aug 11 03:12:56 2016
(r303944)
+++ head/sys/dev/hyperv/include/vmbus.h Thu Aug 11 03:20:38 2016
(r303945)
@@ -89,6 +89,11 @@ struct vmbus_chanpkt_hdr {
(const void *)((const uint8_t *)(pkt) + \
VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen))
 
+/* Include padding */
+#define VMBUS_CHANPKT_DATALEN(pkt) \
+   (VMBUS_CHANPKT_GETLEN((pkt)->cph_tlen) -\
+VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen))
+
 struct vmbus_rxbuf_desc {
uint32_trb_len;
uint32_trb_ofs;
___
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: r303946 - in head/usr.bin: kdump truss

2016-08-10 Thread John Baldwin
Author: jhb
Date: Thu Aug 11 05:18:09 2016
New Revision: 303946
URL: https://svnweb.freebsd.org/changeset/base/303946

Log:
  Remove files unused after pulling system call names from libsysdecode.

Deleted:
  head/usr.bin/kdump/linux32_syscalls.conf
  head/usr.bin/kdump/linux_syscalls.conf
  head/usr.bin/truss/makesyscallsconf.sh
___
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: r303947 - in head/sys: conf dev/hyperv/include dev/hyperv/vmbus modules/hyperv/vmbus

2016-08-10 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Aug 11 05:49:49 2016
New Revision: 303947
URL: https://svnweb.freebsd.org/changeset/base/303947

Log:
  hyperv/vmbus: Add APIs for various types of transactions.
  
  Reviewed by:  Jun Su 
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7456

Added:
  head/sys/dev/hyperv/include/vmbus_xact.h   (contents, props changed)
  head/sys/dev/hyperv/vmbus/vmbus_xact.c   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/vmbus/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Thu Aug 11 05:18:09 2016(r303946)
+++ head/sys/conf/files.amd64   Thu Aug 11 05:49:49 2016(r303947)
@@ -294,6 +294,7 @@ dev/hyperv/vmbus/vmbus_br.c 
optional
 dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv
+dev/hyperv/vmbus/vmbus_xact.c  optionalhyperv
 dev/hyperv/vmbus/amd64/hyperv_machdep.coptional
hyperv
 dev/hyperv/vmbus/amd64/vmbus_vector.S  optionalhyperv
 dev/nfe/if_nfe.c   optionalnfe pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Thu Aug 11 05:18:09 2016(r303946)
+++ head/sys/conf/files.i386Thu Aug 11 05:49:49 2016(r303947)
@@ -253,6 +253,7 @@ dev/hyperv/vmbus/vmbus_br.c 
optional
 dev/hyperv/vmbus/vmbus_chan.c  optionalhyperv
 dev/hyperv/vmbus/vmbus_et.coptionalhyperv
 dev/hyperv/vmbus/vmbus_if.moptionalhyperv
+dev/hyperv/vmbus/vmbus_xact.c  optionalhyperv
 dev/hyperv/vmbus/i386/hyperv_machdep.c optionalhyperv
 dev/hyperv/vmbus/i386/vmbus_vector.S   optionalhyperv
 dev/ichwd/ichwd.c  optional ichwd

Added: head/sys/dev/hyperv/include/vmbus_xact.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/include/vmbus_xact.hThu Aug 11 05:49:49 2016
(r303947)
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2016 Microsoft Corp.
+ * 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 unmodified, 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 ``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 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 _VMBUS_XACT_H_
+#define _VMBUS_XACT_H_
+
+#include 
+#include 
+
+struct vmbus_xact;
+struct vmbus_xact_ctx;
+
+struct vmbus_xact_ctx  *vmbus_xact_ctx_create(bus_dma_tag_t dtag,
+   size_t req_size, size_t resp_size);
+void   vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx);
+struct vmbus_xact  *vmbus_xact_get(struct vmbus_xact_ctx *ctx,
+   size_t req_len);
+void   vmbus_xact_put(struct vmbus_xact *xact);
+
+void   *vmbus_xact_req_data(const struct vmbus_xact *xact);
+bus_addr_t vmbus_xact_req_paddr(const struct vmbus_xact *xact);
+void   vmbus_xact_activate(struct vmbus_xact *xact);
+void   vmbus_xact_deactivate(struct vmbus_xact *xact);
+const void *vmbus_xact_wait(struct vmbus_xact *xact,
+   size_t *resp_len);
+void   vmbus_xact_wakeup(stru

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

2016-08-10 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Aug 11 06:14:54 2016
New Revision: 303948
URL: https://svnweb.freebsd.org/changeset/base/303948

Log:
  hyperv/hn: Switch to vmbus xact APIs for NVS initialization
  
  Reviewed by:  Jun Su 
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7457

Added:
  head/sys/dev/hyperv/netvsc/if_hnreg.h   (contents, props changed)
Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/if_hnvar.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Aug 11 05:49:49 2016
(r303947)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Aug 11 06:14:54 2016
(r303948)
@@ -45,9 +45,11 @@
 #include 
 
 #include 
-#include "hv_net_vsc.h"
-#include "hv_rndis.h"
-#include "hv_rndis_filter.h"
+#include 
+#include 
+#include 
+#include 
+#include 
 
 MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver");
 
@@ -70,7 +72,10 @@ static void hv_nv_on_receive(netvsc_dev 
 const struct vmbus_chanpkt_hdr *pkt);
 static void hn_nvs_sent_none(struct hn_send_ctx *sndc,
 struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
-const struct nvsp_msg_ *msg);
+const struct nvsp_msg_ *msg, int);
+static void hn_nvs_sent_xact(struct hn_send_ctx *sndc,
+struct netvsc_dev_ *net_dev, struct vmbus_channel *chan,
+const struct nvsp_msg_ *msg, int dlen);
 
 static struct hn_send_ctx  hn_send_ctx_none =
 HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL);
@@ -462,45 +467,64 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne
return (ret);
 }
 
-
-/*
- * Attempt to negotiate the caller-specified NVSP version
- *
- * For NVSP v2, Server 2008 R2 does not set
- * init_pkt->msgs.init_msgs.init_compl.negotiated_prot_vers
- * to the negotiated version, so we cannot rely on that.
- */
 static int
 hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev,
-uint32_t nvsp_ver)
+uint32_t nvs_ver)
 {
struct hn_send_ctx sndc;
-   nvsp_msg *init_pkt;
-   int ret;
-
-   init_pkt = &net_dev->channel_init_packet;
-   memset(init_pkt, 0, sizeof(nvsp_msg));
-   init_pkt->hdr.msg_type = nvsp_msg_type_init;
+   struct vmbus_xact *xact;
+   struct hn_nvs_init *init;
+   const struct hn_nvs_init_resp *resp;
+   size_t resp_len;
+   uint32_t status;
+   int error;
+
+   xact = vmbus_xact_get(sc->hn_xact, sizeof(*init));
+   if (xact == NULL) {
+   if_printf(sc->hn_ifp, "no xact for nvs init\n");
+   return (ENXIO);
+   }
+
+   init = vmbus_xact_req_data(xact);
+   init->nvs_type = HN_NVS_TYPE_INIT;
+   init->nvs_ver_min = nvs_ver;
+   init->nvs_ver_max = nvs_ver;
 
-   /*
-* Specify parameter as the only acceptable protocol version
-*/
-   init_pkt->msgs.init_msgs.init.p1.protocol_version = nvsp_ver;
-   init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver;
+   vmbus_xact_activate(xact);
+   hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact);
 
-   /* Send the init request */
-   hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL);
-   ret = vmbus_chan_send(sc->hn_prichan,
+   error = vmbus_chan_send(sc->hn_prichan,
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-   init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc);
-   if (ret != 0)
-   return (-1);
-
-   sema_wait(&net_dev->channel_init_sema);
+   init, sizeof(*init), (uint64_t)(uintptr_t)&sndc);
+   if (error) {
+   if_printf(sc->hn_ifp, "send nvs init failed: %d\n", error);
+   vmbus_xact_deactivate(xact);
+   vmbus_xact_put(xact);
+   return (error);
+   }
 
-   if (init_pkt->msgs.init_msgs.init_compl.status != nvsp_status_success)
+   resp = vmbus_xact_wait(xact, &resp_len);
+   if (resp_len < sizeof(*resp)) {
+   if_printf(sc->hn_ifp, "invalid init resp length %zu\n",
+   resp_len);
+   vmbus_xact_put(xact);
return (EINVAL);
+   }
+   if (resp->nvs_type != HN_NVS_TYPE_INIT_RESP) {
+   if_printf(sc->hn_ifp, "not init resp, type %u\n",
+   resp->nvs_type);
+   vmbus_xact_put(xact);
+   return (EINVAL);
+   }
+
+   status = resp->nvs_status;
+   vmbus_xact_put(xact);
 
+   if (status != HN_NVS_STATUS_OK) {
+   if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n",
+   nvs_ver);
+   return (EINVAL);
+   }
return (0);
 }
 
@@ -744,7 +768,7 @@ hv_nv_on_device_remove(struct hn_softc *
 void
 hn_nvs_sent_wakeup(st

svn commit: r303949 - in head/sys/dev/hyperv: include netvsc vmbus

2016-08-10 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Aug 11 06:24:17 2016
New Revision: 303949
URL: https://svnweb.freebsd.org/changeset/base/303949

Log:
  hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs
  
  Avoid code duplication.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7458

Modified:
  head/sys/dev/hyperv/include/vmbus_xact.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h
  head/sys/dev/hyperv/vmbus/vmbus_xact.c

Modified: head/sys/dev/hyperv/include/vmbus_xact.h
==
--- head/sys/dev/hyperv/include/vmbus_xact.hThu Aug 11 06:14:54 2016
(r303948)
+++ head/sys/dev/hyperv/include/vmbus_xact.hThu Aug 11 06:24:17 2016
(r303949)
@@ -36,7 +36,8 @@ struct vmbus_xact;
 struct vmbus_xact_ctx;
 
 struct vmbus_xact_ctx  *vmbus_xact_ctx_create(bus_dma_tag_t dtag,
-   size_t req_size, size_t resp_size);
+   size_t req_size, size_t resp_size,
+   size_t priv_size);
 void   vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx);
 struct vmbus_xact  *vmbus_xact_get(struct vmbus_xact_ctx *ctx,
size_t req_len);
@@ -44,11 +45,15 @@ voidvmbus_xact_put(struct 
vmbus_xact 
 
 void   *vmbus_xact_req_data(const struct vmbus_xact *xact);
 bus_addr_t vmbus_xact_req_paddr(const struct vmbus_xact *xact);
+void   *vmbus_xact_priv(const struct vmbus_xact *xact,
+   size_t priv_len);
 void   vmbus_xact_activate(struct vmbus_xact *xact);
 void   vmbus_xact_deactivate(struct vmbus_xact *xact);
 const void *vmbus_xact_wait(struct vmbus_xact *xact,
size_t *resp_len);
 void   vmbus_xact_wakeup(struct vmbus_xact *xact,
const void *data, size_t dlen);
+void   vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx,
+   const void *data, size_t dlen);
 
 #endif /* !_VMBUS_XACT_H_ */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Aug 11 06:14:54 
2016(r303948)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Aug 11 06:24:17 
2016(r303949)
@@ -547,7 +547,7 @@ netvsc_attach(device_t dev)
ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO;
 
sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev),
-   HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE);
+   HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0);
if (sc->hn_xact == NULL)
goto failed;
 

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Thu Aug 11 06:14:54 2016
(r303948)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Thu Aug 11 06:24:17 2016
(r303949)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,25 +63,10 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_GPADL_START  0xe1e10
 
 struct vmbus_msghc {
-   struct hypercall_postmsg_in *mh_inprm;
+   struct vmbus_xact   *mh_xact;
struct hypercall_postmsg_in mh_inprm_save;
-   struct hyperv_dma   mh_inprm_dma;
-
-   struct vmbus_message*mh_resp;
-   struct vmbus_messagemh_resp0;
-};
-
-struct vmbus_msghc_ctx {
-   struct vmbus_msghc  *mhc_free;
-   struct mtx  mhc_free_lock;
-   uint32_tmhc_flags;
-
-   struct vmbus_msghc  *mhc_active;
-   struct mtx  mhc_active_lock;
 };
 
-#define VMBUS_MSGHC_CTXF_DESTROY   0x0001
-
 static int vmbus_probe(device_t);
 static int vmbus_attach(device_t);
 static int vmbus_detach(device_t);
@@ -116,15 +102,6 @@ static int vmbus_doattach(struct vmbus
 static voidvmbus_event_proc_dummy(struct vmbus_softc *,
int);
 
-static struct vmbus_msghc_ctx  *vmbus_msghc_ctx_create(bus_dma_tag_t);
-static voidvmbus_msghc_ctx_destroy(
-   struct vmbus_msghc_ctx *);
-static voidvmbus_msghc_ctx_free(struct vmbus_msghc_ctx *);
-static struct vmbus_msghc  *vmbus_msghc_alloc(bus_dma_tag_t);
-static voidvmbus_msghc_free(struct vmbus_msghc *);
-static struct vmbus_msghc  *vmbus_msghc_get1(struct vmbus_msghc_