Date: Wed, 27 Jul 2016 17:21:24 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r303401 - in user/alc/PQ_LAUNDRY: . contrib/gcc/config/arm gnu/lib/libgcc lib/libthr/thread sbin/route share/man/man4 share/mk share/timedef sys/compat/linprocfs sys/conf sys/dev/hyperv... Message-ID: <201607271721.u6RHLOsB018528@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Wed Jul 27 17:21:24 2016 New Revision: 303401 URL: https://svnweb.freebsd.org/changeset/base/303401 Log: MFH r303397 Added: user/alc/PQ_LAUNDRY/contrib/gcc/config/arm/libunwind-arm.S - copied unchanged from r303399, head/contrib/gcc/config/arm/libunwind-arm.S user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_br.c - copied unchanged from r303399, head/sys/dev/hyperv/vmbus/vmbus_br.c Deleted: user/alc/PQ_LAUNDRY/contrib/gcc/config/arm/libunwind.S user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/hv_ring_buffer.c Modified: user/alc/PQ_LAUNDRY/Makefile.inc1 user/alc/PQ_LAUNDRY/gnu/lib/libgcc/Makefile user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_init.c user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_once.c user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_private.h user/alc/PQ_LAUNDRY/sbin/route/route.c user/alc/PQ_LAUNDRY/share/man/man4/syscons.4 user/alc/PQ_LAUNDRY/share/man/man4/vt.4 user/alc/PQ_LAUNDRY/share/mk/local.meta.sys.mk user/alc/PQ_LAUNDRY/share/mk/src.opts.mk user/alc/PQ_LAUNDRY/share/mk/sys.mk user/alc/PQ_LAUNDRY/share/timedef/zh_TW.Big5.src user/alc/PQ_LAUNDRY/share/timedef/zh_TW.UTF-8.src user/alc/PQ_LAUNDRY/sys/compat/linprocfs/linprocfs.c user/alc/PQ_LAUNDRY/sys/conf/files.amd64 user/alc/PQ_LAUNDRY/sys/conf/files.i386 user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chanvar.h user/alc/PQ_LAUNDRY/sys/fs/devfs/devfs_vnops.c user/alc/PQ_LAUNDRY/sys/fs/fdescfs/fdesc_vnops.c user/alc/PQ_LAUNDRY/sys/fs/nfs/nfsport.h user/alc/PQ_LAUNDRY/sys/fs/procfs/procfs_status.c user/alc/PQ_LAUNDRY/sys/kern/kern_acct.c user/alc/PQ_LAUNDRY/sys/kern/kern_clock.c user/alc/PQ_LAUNDRY/sys/kern/kern_ntptime.c user/alc/PQ_LAUNDRY/sys/kern/kern_proc.c user/alc/PQ_LAUNDRY/sys/kern/kern_tc.c user/alc/PQ_LAUNDRY/sys/kern/kern_time.c user/alc/PQ_LAUNDRY/sys/kern/subr_rtc.c user/alc/PQ_LAUNDRY/sys/kern/sys_procdesc.c user/alc/PQ_LAUNDRY/sys/modules/hyperv/vmbus/Makefile user/alc/PQ_LAUNDRY/sys/net/altq/altq_subr.c user/alc/PQ_LAUNDRY/sys/net/bpf.c user/alc/PQ_LAUNDRY/sys/netpfil/ipfw/ip_fw_sockopt.c user/alc/PQ_LAUNDRY/sys/nfs/nfs_lock.c user/alc/PQ_LAUNDRY/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c user/alc/PQ_LAUNDRY/sys/sys/time.h user/alc/PQ_LAUNDRY/tools/tools/locale/README user/alc/PQ_LAUNDRY/tools/tools/locale/tools/cldr2def.pl user/alc/PQ_LAUNDRY/usr.bin/sed/tests/multi_test.sh Directory Properties: user/alc/PQ_LAUNDRY/ (props changed) user/alc/PQ_LAUNDRY/contrib/gcc/ (props changed) user/alc/PQ_LAUNDRY/gnu/lib/ (props changed) Modified: user/alc/PQ_LAUNDRY/Makefile.inc1 ============================================================================== --- user/alc/PQ_LAUNDRY/Makefile.inc1 Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/Makefile.inc1 Wed Jul 27 17:21:24 2016 (r303401) @@ -178,7 +178,7 @@ CROSS_BINUTILS_PREFIX=/usr/local/${TARGE .endif .endif .endif -XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS +XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) && \ exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) @@ -539,7 +539,7 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METAL CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \ CPP="${XCPP} ${XCFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ - OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ + OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ SIZE="${XSIZE}" Copied: user/alc/PQ_LAUNDRY/contrib/gcc/config/arm/libunwind-arm.S (from r303399, head/contrib/gcc/config/arm/libunwind-arm.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/alc/PQ_LAUNDRY/contrib/gcc/config/arm/libunwind-arm.S Wed Jul 27 17:21:24 2016 (r303401, copy of r303399, head/contrib/gcc/config/arm/libunwind-arm.S) @@ -0,0 +1,136 @@ +/* Support functions for the unwinder. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#include <machine/acle-compat.h> + +/* Allow the use of VFP instructions */ +#if __ARM_ARCH >= 7 +.fpu vfp +#endif + +#ifndef __symbian__ + +#include "lib1funcs.asm" + +.macro UNPREFIX name + .global SYM (\name) + EQUIV SYM (\name), SYM (__\name) +.endm + +/* r0 points to a 16-word block. Upload these values to the actual core + state. */ +ARM_FUNC_START restore_core_regs + /* We must use sp as the base register when restoring sp. Push the + last 3 registers onto the top of the current stack to achieve + this. */ + add r1, r0, #52 + ldmia r1, {r3, r4, r5} /* {sp, lr, pc}. */ +#ifdef __INTERWORKING__ + /* Restore pc into ip. */ + mov r2, r5 + stmfd sp!, {r2, r3, r4} +#else + stmfd sp!, {r3, r4, r5} +#endif + /* Don't bother restoring ip. */ + ldmia r0, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp} + /* Pop the three registers we pushed earlier. */ +#ifdef __INTERWORKING__ + ldmfd sp, {ip, sp, lr} + bx ip +#else + ldmfd sp, {sp, lr, pc} +#endif + FUNC_END restore_core_regs + UNPREFIX restore_core_regs + +/* Load VFP registers d0-d15 from the address in r0. */ +ARM_FUNC_START gnu_Unwind_Restore_VFP + /* Use the generic coprocessor form so that gas doesn't complain + on soft-float targets. */ +#if __ARM_ARCH >= 7 + fldmiax r0, {d0-d15} +#else + ldc p11,cr0,[r0],{0x21} /* fldmiax r0, {d0-d15} */ +#endif + RET + +/* Store VFR regsters d0-d15 to the address in r0. */ +ARM_FUNC_START gnu_Unwind_Save_VFP + /* Use the generic coprocessor form so that gas doesn't complain + on soft-float targets. */ +#if __ARM_ARCH >= 7 + fstmiax r0, {d0-d15} +#else + stc p11,cr0,[r0],{0x21} /* fstmiax r0, {d0-d15} */ +#endif + RET + +/* Wrappers to save core registers, then call the real routine. */ + +.macro UNWIND_WRAPPER name nargs + ARM_FUNC_START \name + /* Create a phase2_vrs structure. */ + /* Split reg push in two to ensure the correct value for sp. */ + stmfd sp!, {sp, lr, pc} + stmfd sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip} + + /* Demand-save flags, plus an extra word for alignment. */ + mov r3, #0 + stmfd sp!, {r2, r3} + + /* Point r1 at the block. Pass r[0..nargs) unchanged. */ + add r\nargs, sp, #4 +#if defined(__thumb__) + /* Switch back to thumb mode to avoid interworking hassle. */ + adr ip, .L1_\name + orr ip, ip, #1 + bx ip + .thumb +.L1_\name: + bl SYM (__gnu\name) __PLT__ + ldr r3, [sp, #64] + add sp, #72 + bx r3 +#else + bl SYM (__gnu\name) __PLT__ + ldr lr, [sp, #64] + add sp, sp, #72 + RET +#endif + FUNC_END \name + UNPREFIX \name +.endm + +UNWIND_WRAPPER _Unwind_RaiseException 1 +UNWIND_WRAPPER _Unwind_Resume 1 +UNWIND_WRAPPER _Unwind_Resume_or_Rethrow 1 +UNWIND_WRAPPER _Unwind_ForcedUnwind 3 +UNWIND_WRAPPER _Unwind_Backtrace 2 + +#endif /* ndef __symbian__ */ Modified: user/alc/PQ_LAUNDRY/gnu/lib/libgcc/Makefile ============================================================================== --- user/alc/PQ_LAUNDRY/gnu/lib/libgcc/Makefile Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/gnu/lib/libgcc/Makefile Wed Jul 27 17:21:24 2016 (r303401) @@ -99,7 +99,7 @@ STATIC_CXXFLAGS+= -fvisibility=hidden -f .else # MK_LLVM_LIBUNWIND .if ${TARGET_CPUARCH} == "arm" -LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c +LIB2ADDEH = unwind-arm.c libunwind-arm.S pr-support.c unwind-c.c .else LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \ unwind-c.c Modified: user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_init.c ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_init.c Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_init.c Wed Jul 27 17:21:24 2016 (r303401) @@ -447,7 +447,6 @@ init_private(void) _thr_urwlock_init(&_thr_atfork_lock); _thr_umutex_init(&_thr_event_lock); _thr_umutex_init(&_suspend_all_lock); - _thr_once_init(); _thr_spinlock_init(); _thr_list_init(); _thr_wake_addr_init(); Modified: user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_once.c ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_once.c Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_once.c Wed Jul 27 17:21:24 2016 (r303401) @@ -101,8 +101,3 @@ _pthread_once(pthread_once_t *once_contr _thr_umtx_wake(&once_control->state, INT_MAX, 0); return (0); } - -void -_thr_once_init(void) -{ -} Modified: user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_private.h ============================================================================== --- user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_private.h Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_private.h Wed Jul 27 17:21:24 2016 (r303401) @@ -811,7 +811,6 @@ void _thr_link(struct pthread *, struct void _thr_unlink(struct pthread *, struct pthread *) __hidden; void _thr_assert_lock_level(void) __hidden __dead2; void _thr_ast(struct pthread *) __hidden; -void _thr_once_init(void) __hidden; void _thr_report_creation(struct pthread *curthread, struct pthread *newthread) __hidden; void _thr_report_death(struct pthread *curthread) __hidden; Modified: user/alc/PQ_LAUNDRY/sbin/route/route.c ============================================================================== --- user/alc/PQ_LAUNDRY/sbin/route/route.c Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sbin/route/route.c Wed Jul 27 17:21:24 2016 (r303401) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <errno.h> #include <paths.h> +#include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -144,6 +145,16 @@ static int fiboptlist_range(const char * static void usage(const char *) __dead2; +#define READ_TIMEOUT 10 +static volatile sig_atomic_t stop_read; + +static void +stopit(int sig __unused) +{ + + stop_read = 1; +} + static void usage(const char *cp) { @@ -776,6 +787,7 @@ set_metric(char *value, int key) static void newroute(int argc, char **argv) { + struct sigaction sa; struct hostent *hp; struct fibl *fl; char *cmd; @@ -791,6 +803,12 @@ newroute(int argc, char **argv) hp = NULL; TAILQ_INIT(&fibl_head); + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = stopit; + if (sigaction(SIGALRM, &sa, 0) == -1) + warn("sigaction SIGALRM"); + cmd = argv[0]; if (*cmd != 'g' && *cmd != 's') shutdown(s, SHUT_RD); /* Don't want to read back our messages */ @@ -1541,9 +1559,17 @@ rtmsg(int cmd, int flags, int fib) return (-1); } if (cmd == RTM_GET) { + stop_read = 0; + alarm(READ_TIMEOUT); do { l = read(s, (char *)&m_rtmsg, sizeof(m_rtmsg)); - } while (l > 0 && (rtm.rtm_seq != rtm_seq || rtm.rtm_pid != pid)); + } while (l > 0 && stop_read == 0 && + (rtm.rtm_seq != rtm_seq || rtm.rtm_pid != pid)); + if (stop_read != 0) { + warnx("read from routing socket timed out"); + return (-1); + } else + alarm(0); if (l < 0) warn("read from routing socket"); else Modified: user/alc/PQ_LAUNDRY/share/man/man4/syscons.4 ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man4/syscons.4 Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/man/man4/syscons.4 Wed Jul 27 17:21:24 2016 (r303401) @@ -468,10 +468,11 @@ be selected by setting this variable to .Ql sc or .Ql vt . -If not set, the default console in the +The .Pa GENERIC -kernel is -.Xr vt 4 . +kernel uses +.Xr vt 4 +when this value is not set. .El .Sh FILES .Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact Modified: user/alc/PQ_LAUNDRY/share/man/man4/vt.4 ============================================================================== --- user/alc/PQ_LAUNDRY/share/man/man4/vt.4 Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/man/man4/vt.4 Wed Jul 27 17:21:24 2016 (r303401) @@ -201,10 +201,11 @@ Set this value to or .Ql sc to choose a specific system console, overriding the default. -If not set, the default in the +The .Pa GENERIC -kernel is -.Nm . +kernel uses +.Nm +when this value is not set. .It Va kern.vt.fb.default_mode Set this value to a graphic mode to override the default mode picked by the .Nm Modified: user/alc/PQ_LAUNDRY/share/mk/local.meta.sys.mk ============================================================================== --- user/alc/PQ_LAUNDRY/share/mk/local.meta.sys.mk Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/mk/local.meta.sys.mk Wed Jul 27 17:21:24 2016 (r303401) @@ -222,7 +222,7 @@ WITH_META_STATS= t .if ${MACHINE} == "host" MK_SHARED_TOOLCHAIN= no .endif -TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJDUMP OBJCOPY RANLIB \ +TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJCOPY RANLIB \ STRINGS SIZE LLVM_TBLGEN _toolchain_bin_CLANG_TBLGEN= /usr/bin/clang-tblgen _toolchain_bin_LLVM_TBLGEN= /usr/bin/llvm-tblgen Modified: user/alc/PQ_LAUNDRY/share/mk/src.opts.mk ============================================================================== --- user/alc/PQ_LAUNDRY/share/mk/src.opts.mk Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/mk/src.opts.mk Wed Jul 27 17:21:24 2016 (r303401) @@ -235,15 +235,18 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTST # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T} == "riscv64" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB -__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND -.else -__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "riscv64" BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V" BROKEN_OPTIONS+=TESTS # "undefined reference to `_Unwind_Resume'" BROKEN_OPTIONS+=CXX # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'" .endif +.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ + ${__T} == "riscv64" +__DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND +.else +__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND +.endif .if ${__T} == "aarch64" || ${__T} == "amd64" __DEFAULT_YES_OPTIONS+=LLDB .else Modified: user/alc/PQ_LAUNDRY/share/mk/sys.mk ============================================================================== --- user/alc/PQ_LAUNDRY/share/mk/sys.mk Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/mk/sys.mk Wed Jul 27 17:21:24 2016 (r303401) @@ -237,8 +237,6 @@ OBJCFLAGS ?= ${OBJCINCLUDES} ${CFLAGS} - OBJCOPY ?= objcopy -OBJDUMP ?= objdump - PC ?= pc PFLAGS ?= Modified: user/alc/PQ_LAUNDRY/share/timedef/zh_TW.Big5.src ============================================================================== --- user/alc/PQ_LAUNDRY/share/timedef/zh_TW.Big5.src Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/timedef/zh_TW.Big5.src Wed Jul 27 17:21:24 2016 (r303401) @@ -63,7 +63,7 @@ 下午 # # date_fmt -%Y年%m月%e日 %p%I:%M:%S [%Z] +%Y年%m月%e日 %A %p%I:%M:%S [%Z] # # Long month names (without case ending) 1月 Modified: user/alc/PQ_LAUNDRY/share/timedef/zh_TW.UTF-8.src ============================================================================== --- user/alc/PQ_LAUNDRY/share/timedef/zh_TW.UTF-8.src Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/share/timedef/zh_TW.UTF-8.src Wed Jul 27 17:21:24 2016 (r303401) @@ -56,14 +56,14 @@ %Y/%m/%d # # c_fmt -%Y撟%m%e%A %p%I:%M:%S [%Z] +%Y撟%m%e %A %p%I:%M:%S [%Z] # # AM/PM 銝 銝 # # date_fmt -%Y撟%m%e%A %p%I:%M:%S [%Z] +%Y撟%m%e %A %p%I:%M:%S [%Z] # # Long month names (without case ending) 1 Modified: user/alc/PQ_LAUNDRY/sys/compat/linprocfs/linprocfs.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/compat/linprocfs/linprocfs.c Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sys/compat/linprocfs/linprocfs.c Wed Jul 27 17:21:24 2016 (r303401) @@ -447,9 +447,11 @@ linprocfs_dostat(PFS_FILL_ARGS) struct pcpu *pcpu; long cp_time[CPUSTATES]; long *cp; + struct timeval boottime; int i; read_cpu_time(cp_time); + getboottime(&boottime); sbuf_printf(sb, "cpu %ld %ld %ld %ld\n", T2J(cp_time[CP_USER]), T2J(cp_time[CP_NICE]), @@ -624,10 +626,12 @@ static int linprocfs_doprocstat(PFS_FILL_ARGS) { struct kinfo_proc kp; + struct timeval boottime; char state; static int ratelimit = 0; vm_offset_t startcode, startdata; + getboottime(&boottime); sx_slock(&proctree_lock); PROC_LOCK(p); fill_kinfo_proc(p, &kp); Modified: user/alc/PQ_LAUNDRY/sys/conf/files.amd64 ============================================================================== --- user/alc/PQ_LAUNDRY/sys/conf/files.amd64 Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sys/conf/files.amd64 Wed Jul 27 17:21:24 2016 (r303401) @@ -270,10 +270,10 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv Modified: user/alc/PQ_LAUNDRY/sys/conf/files.i386 ============================================================================== --- user/alc/PQ_LAUNDRY/sys/conf/files.i386 Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sys/conf/files.i386 Wed Jul 27 17:21:24 2016 (r303401) @@ -246,10 +246,10 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv Copied: user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_br.c (from r303399, head/sys/dev/hyperv/vmbus/vmbus_br.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_br.c Wed Jul 27 17:21:24 2016 (r303401, copy of r303399, head/sys/dev/hyperv/vmbus/vmbus_br.c) @@ -0,0 +1,414 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * 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. + */ + +#include <sys/param.h> +#include <sys/lock.h> +#include <sys/mutex.h> +#include <sys/sysctl.h> + +#include <dev/hyperv/vmbus/vmbus_reg.h> +#include <dev/hyperv/vmbus/vmbus_brvar.h> + +/* Amount of space available for write */ +#define VMBUS_BR_WAVAIL(r, w, z) \ + (((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))) + +/* Increase bufing index */ +#define VMBUS_BR_IDXINC(idx, inc, sz) (((idx) + (inc)) % (sz)) + +static int +vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) +{ + const struct vmbus_br *br = arg1; + uint32_t rindex, windex, imask, ravail, wavail; + char state[256]; + + rindex = br->vbr_rindex; + windex = br->vbr_windex; + imask = br->vbr_imask; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); + ravail = br->vbr_dsize - wavail; + + snprintf(state, sizeof(state), + "rindex:%u windex:%u imask:%u ravail:%u wavail:%u", + rindex, windex, imask, ravail, wavail); + return sysctl_handle_string(oidp, state, sizeof(state), req); +} + +/* + * Binary bufring states. + */ +static int +vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS) +{ +#define BR_STATE_RIDX 0 +#define BR_STATE_WIDX 1 +#define BR_STATE_IMSK 2 +#define BR_STATE_RSPC 3 +#define BR_STATE_WSPC 4 +#define BR_STATE_MAX 5 + + const struct vmbus_br *br = arg1; + uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; + + rindex = br->vbr_rindex; + windex = br->vbr_windex; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); + + state[BR_STATE_RIDX] = rindex; + state[BR_STATE_WIDX] = windex; + state[BR_STATE_IMSK] = br->vbr_imask; + state[BR_STATE_WSPC] = wavail; + state[BR_STATE_RSPC] = br->vbr_dsize - wavail; + + return sysctl_handle_opaque(oidp, state, sizeof(state), req); +} + +void +vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, + struct vmbus_br *br, const char *name) +{ + struct sysctl_oid *tree; + char desc[64]; + + tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(br_tree), OID_AUTO, + name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (tree == NULL) + return; + + snprintf(desc, sizeof(desc), "%s state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state, "A", desc); + + snprintf(desc, sizeof(desc), "%s binary state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state_bin", + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state_bin, "IU", desc); +} + +void +vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr) +{ + rbr->rxbr_imask = 1; + mb(); +} + +static __inline uint32_t +vmbus_rxbr_avail(const struct vmbus_rxbr *rbr) +{ + uint32_t rindex, windex; + + /* Get snapshot */ + rindex = rbr->rxbr_rindex; + windex = rbr->rxbr_windex; + + return (rbr->rxbr_dsize - + VMBUS_BR_WAVAIL(rindex, windex, rbr->rxbr_dsize)); +} + +uint32_t +vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr) +{ + rbr->rxbr_imask = 0; + mb(); + + /* + * Now check to see if the ring buffer is still empty. + * If it is not, we raced and we need to process new + * incoming channel packets. + */ + return vmbus_rxbr_avail(rbr); +} + +static void +vmbus_br_setup(struct vmbus_br *br, void *buf, int blen) +{ + br->vbr = buf; + br->vbr_dsize = blen - sizeof(struct vmbus_bufring); +} + +void +vmbus_rxbr_init(struct vmbus_rxbr *rbr) +{ + mtx_init(&rbr->rxbr_lock, "vmbus_rxbr", NULL, MTX_SPIN); +} + +void +vmbus_rxbr_deinit(struct vmbus_rxbr *rbr) +{ + mtx_destroy(&rbr->rxbr_lock); +} + +void +vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen) +{ + vmbus_br_setup(&rbr->rxbr, buf, blen); +} + +void +vmbus_txbr_init(struct vmbus_txbr *tbr) +{ + mtx_init(&tbr->txbr_lock, "vmbus_txbr", NULL, MTX_SPIN); +} + +void +vmbus_txbr_deinit(struct vmbus_txbr *tbr) +{ + mtx_destroy(&tbr->txbr_lock); +} + +void +vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen) +{ + vmbus_br_setup(&tbr->txbr, buf, blen); +} + +/* + * When we write to the ring buffer, check if the host needs to be + * signaled. + * + * The contract: + * - The host guarantees that while it is draining the TX bufring, + * it will set the br_imask to indicate it does not need to be + * interrupted when new data are added. + * - The host guarantees that it will completely drain the TX bufring + * before exiting the read loop. Further, once the TX bufring is + * empty, it will clear the br_imask and re-check to see if new + * data have arrived. + */ +static __inline boolean_t +vmbus_txbr_need_signal(const struct vmbus_txbr *tbr, uint32_t old_windex) +{ + mb(); + if (tbr->txbr_imask) + return (FALSE); + + /* XXX only compiler fence is needed */ + /* Read memory barrier */ + rmb(); + + /* + * This is the only case we need to signal when the + * ring transitions from being empty to non-empty. + */ + if (old_windex == tbr->txbr_rindex) + return (TRUE); + + return (FALSE); +} + +static __inline uint32_t +vmbus_txbr_avail(const struct vmbus_txbr *tbr) +{ + uint32_t rindex, windex; + + /* Get snapshot */ + rindex = tbr->txbr_rindex; + windex = tbr->txbr_windex; + + return VMBUS_BR_WAVAIL(rindex, windex, tbr->txbr_dsize); +} + +static __inline uint32_t +vmbus_txbr_copyto(const struct vmbus_txbr *tbr, uint32_t windex, + const void *src0, uint32_t cplen) +{ + const uint8_t *src = src0; + uint8_t *br_data = tbr->txbr_data; + uint32_t br_dsize = tbr->txbr_dsize; + + if (cplen > br_dsize - windex) { + uint32_t fraglen = br_dsize - windex; + + /* Wrap-around detected */ + memcpy(br_data + windex, src, fraglen); + memcpy(br_data, src + fraglen, cplen - fraglen); + } else { + memcpy(br_data + windex, src, cplen); + } + return VMBUS_BR_IDXINC(windex, cplen, br_dsize); +} + +/* + * Write scattered channel packet to TX bufring. + * + * The offset of this channel packet is written as a 64bits value + * immediately after this channel packet. + */ +int +vmbus_txbr_write(struct vmbus_txbr *tbr, const struct iovec iov[], int iovlen, + boolean_t *need_sig) +{ + uint32_t old_windex, windex, total; + uint64_t save_windex; + int i; + + total = 0; + for (i = 0; i < iovlen; i++) + total += iov[i].iov_len; + total += sizeof(save_windex); + + mtx_lock_spin(&tbr->txbr_lock); + + /* + * NOTE: + * If this write is going to make br_windex same as br_rindex, + * i.e. the available space for write is same as the write size, + * we can't do it then, since br_windex == br_rindex means that + * the bufring is empty. + */ + if (vmbus_txbr_avail(tbr) <= total) { + mtx_unlock_spin(&tbr->txbr_lock); + return (EAGAIN); + } + + /* Save br_windex for later use */ + old_windex = tbr->txbr_windex; + + /* + * Copy the scattered channel packet to the TX bufring. + */ + windex = old_windex; + for (i = 0; i < iovlen; i++) { + windex = vmbus_txbr_copyto(tbr, windex, + iov[i].iov_base, iov[i].iov_len); + } + + /* + * Set the offset of the current channel packet. + */ + save_windex = ((uint64_t)old_windex) << 32; + windex = vmbus_txbr_copyto(tbr, windex, &save_windex, + sizeof(save_windex)); + + /* + * XXX only compiler fence is needed. + * Full memory barrier before upding the write index. + */ + mb(); + + /* + * Update the write index _after_ the channel packet + * is copied. + */ + tbr->txbr_windex = windex; + + mtx_unlock_spin(&tbr->txbr_lock); + + *need_sig = vmbus_txbr_need_signal(tbr, old_windex); + + return (0); +} + +static __inline uint32_t +vmbus_rxbr_copyfrom(const struct vmbus_rxbr *rbr, uint32_t rindex, + void *dst0, int cplen) +{ + uint8_t *dst = dst0; + const uint8_t *br_data = rbr->rxbr_data; + uint32_t br_dsize = rbr->rxbr_dsize; + + if (cplen > br_dsize - rindex) { + uint32_t fraglen = br_dsize - rindex; + + /* Wrap-around detected. */ + memcpy(dst, br_data + rindex, fraglen); + memcpy(dst + fraglen, br_data, cplen - fraglen); + } else { + memcpy(dst, br_data + rindex, cplen); + } + return VMBUS_BR_IDXINC(rindex, cplen, br_dsize); +} + +int +vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen) +{ + mtx_lock_spin(&rbr->rxbr_lock); + + /* + * The requested data and the 64bits channel packet + * offset should be there at least. + */ + if (vmbus_rxbr_avail(rbr) < dlen + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); + return (EAGAIN); + } + vmbus_rxbr_copyfrom(rbr, rbr->rxbr_rindex, data, dlen); + + mtx_unlock_spin(&rbr->rxbr_lock); + + return (0); +} + +/* + * NOTE: + * We assume (dlen + skip) == sizeof(channel packet). + */ +int +vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip) +{ + uint32_t rindex, br_dsize = rbr->rxbr_dsize; + + KASSERT(dlen + skip > 0, ("invalid dlen %d, offset %u", dlen, skip)); + + mtx_lock_spin(&rbr->rxbr_lock); + + if (vmbus_rxbr_avail(rbr) < dlen + skip + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); + return (EAGAIN); + } + + /* + * Copy channel packet from RX bufring. + */ + rindex = VMBUS_BR_IDXINC(rbr->rxbr_rindex, skip, br_dsize); + rindex = vmbus_rxbr_copyfrom(rbr, rindex, data, dlen); + + /* + * Discard this channel packet's 64bits offset, which is useless to us. + */ + rindex = VMBUS_BR_IDXINC(rindex, sizeof(uint64_t), br_dsize); + + /* + * XXX only compiler fence is needed. + * Make sure all reads are done before we update the read index since + * the writer may start writing to the read area once the read index + * is updated. + */ + wmb(); + + /* + * Update the read index _after_ the channel packet is fetched. + */ + rbr->rxbr_rindex = rindex; + + mtx_unlock_spin(&rbr->rxbr_lock); + + return (0); +} Modified: user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h Wed Jul 27 17:21:24 2016 (r303401) @@ -36,48 +36,58 @@ #include <sys/mutex.h> #include <sys/_iovec.h> -typedef struct { - struct vmbus_bufring *ring_buffer; - struct mtx ring_lock; - uint32_t ring_data_size; /* ring_size */ -} hv_vmbus_ring_buffer_info; +struct vmbus_br { + struct vmbus_bufring *vbr; + uint32_t vbr_dsize; /* total data size */ +}; + +#define vbr_windex vbr->br_windex +#define vbr_rindex vbr->br_rindex +#define vbr_imask vbr->br_imask +#define vbr_data vbr->br_data + +struct vmbus_rxbr { + struct mtx rxbr_lock; + struct vmbus_br rxbr; +}; + +#define rxbr_windex rxbr.vbr_windex +#define rxbr_rindex rxbr.vbr_rindex +#define rxbr_imask rxbr.vbr_imask +#define rxbr_data rxbr.vbr_data +#define rxbr_dsize rxbr.vbr_dsize + +struct vmbus_txbr { + struct mtx txbr_lock; + struct vmbus_br txbr; +}; + +#define txbr_windex txbr.vbr_windex +#define txbr_rindex txbr.vbr_rindex +#define txbr_imask txbr.vbr_imask +#define txbr_data txbr.vbr_data +#define txbr_dsize txbr.vbr_dsize struct sysctl_ctx_list; struct sysctl_oid; -void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, - struct sysctl_oid *br_tree, hv_vmbus_ring_buffer_info *br, - const char *name); - -int hv_vmbus_ring_buffer_init( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len); - -void hv_ring_buffer_cleanup( - hv_vmbus_ring_buffer_info *ring_info); - -int hv_ring_buffer_write( - hv_vmbus_ring_buffer_info *ring_info, - const struct iovec iov[], - uint32_t iovlen, - boolean_t *need_sig); - -int hv_ring_buffer_peek( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len); - -int hv_ring_buffer_read( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len, - uint32_t offset); - -void hv_ring_buffer_read_begin( - hv_vmbus_ring_buffer_info *ring_info); - -uint32_t hv_ring_buffer_read_end( - hv_vmbus_ring_buffer_info *ring_info); +void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, + struct sysctl_oid *br_tree, struct vmbus_br *br, + const char *name); + +void vmbus_rxbr_init(struct vmbus_rxbr *rbr); +void vmbus_rxbr_deinit(struct vmbus_rxbr *rbr); +void vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen); +int vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen); +int vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, + uint32_t skip); +void vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr); +uint32_t vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr); + +void vmbus_txbr_init(struct vmbus_txbr *tbr); +void vmbus_txbr_deinit(struct vmbus_txbr *tbr); +void vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen); +int vmbus_txbr_write(struct vmbus_txbr *tbr, + const struct iovec iov[], int iovlen, boolean_t *need_sig); #endif /* _VMBUS_BRVAR_H_ */ Modified: user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 27 17:18:08 2016 (r303400) +++ user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 27 17:21:24 2016 (r303401) @@ -178,11 +178,11 @@ vmbus_chan_sysctl_create(struct vmbus_ch /* * Create sysctl tree for RX bufring. */ - vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr, "rx"); + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr.rxbr, "rx"); /* * Create sysctl tree for TX bufring. */ - vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr, "tx"); + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr.txbr, "tx"); } } @@ -239,9 +239,9 @@ vmbus_chan_open(struct vmbus_channel *ch chan->ch_bufring = br; /* TX bufring comes first */ - hv_vmbus_ring_buffer_init(&chan->ch_txbr, br, txbr_size); + vmbus_txbr_setup(&chan->ch_txbr, br, txbr_size); /* RX bufring immediately follows TX bufring */ - hv_vmbus_ring_buffer_init(&chan->ch_rxbr, br + txbr_size, rxbr_size); + vmbus_rxbr_setup(&chan->ch_rxbr, br + txbr_size, rxbr_size); /* Create sysctl tree for this channel */ vmbus_chan_sysctl_create(chan); @@ -549,8 +549,6 @@ vmbus_chan_close_internal(struct vmbus_c /* * Destroy the TX+RX bufrings. */ - hv_ring_buffer_cleanup(&chan->ch_txbr); - hv_ring_buffer_cleanup(&chan->ch_rxbr); if (chan->ch_bufring != NULL) { hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); chan->ch_bufring = NULL; @@ -620,7 +618,7 @@ vmbus_chan_send(struct vmbus_channel *ch iov[2].iov_base = &pad; iov[2].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->ch_txbr, iov, 3, &send_evt); + error = vmbus_txbr_write(&chan->ch_txbr, iov, 3, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -660,7 +658,7 @@ vmbus_chan_send_sglist(struct vmbus_chan iov[3].iov_base = &pad; iov[3].iov_len = pad_pktlen - pktlen; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607271721.u6RHLOsB018528>