From owner-svn-src-head@freebsd.org Sun Jul 10 00:08:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C298B857B4; Sun, 10 Jul 2016 00:08:42 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2B661691; Sun, 10 Jul 2016 00:08:41 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A08fYs069172; Sun, 10 Jul 2016 00:08:41 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A08fWA069171; Sun, 10 Jul 2016 00:08:41 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201607100008.u6A08fWA069171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 10 Jul 2016 00:08:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302509 - head/sys/dev/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 00:08:42 -0000 Author: landonf Date: Sun Jul 10 00:08:40 2016 New Revision: 302509 URL: https://svnweb.freebsd.org/changeset/base/302509 Log: Fix heap overflow in bhnd(4) SPROM parsing. The bus_region_* APIs accept the number of data items to be read, while the code was passing the total number of bytes, resulting in an overflow of the SPROM parser's buffer. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7168 Modified: head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c Modified: head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c Sat Jul 9 23:22:44 2016 (r302508) +++ head/sys/dev/bhnd/nvram/bhnd_sprom_subr.c Sun Jul 10 00:08:40 2016 (r302509) @@ -523,7 +523,8 @@ sprom_direct_read(struct bhnd_sprom *sc, p = (uint16_t *)buf; res_offset = sc->sp_res_off + offset; - bhnd_bus_read_region_stream_2(sc->sp_res, res_offset, p, nbytes); + bhnd_bus_read_region_stream_2(sc->sp_res, res_offset, p, + (nbytes / sizeof(uint16_t))); *crc = bhnd_nvram_crc8(p, nbytes, *crc); return (0); From owner-svn-src-head@freebsd.org Sun Jul 10 01:09:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A219B8332E; Sun, 10 Jul 2016 01:09:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37F31A3F; Sun, 10 Jul 2016 01:09:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A19GmA090927; Sun, 10 Jul 2016 01:09:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A19Gef090926; Sun, 10 Jul 2016 01:09:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607100109.u6A19Gef090926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Jul 2016 01:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302510 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 01:09:18 -0000 Author: mav Date: Sun Jul 10 01:09:16 2016 New Revision: 302510 URL: https://svnweb.freebsd.org/changeset/base/302510 Log: Simplify MSIX MW BAR xlat setup, and don't forget to unlock its limit. The last fixes SB01BASE_LOCKUP workaround after driver reload. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 00:08:40 2016 (r302509) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 01:09:16 2016 (r302510) @@ -1817,42 +1817,23 @@ xeon_setup_b2b_mw(struct ntb_softc *ntb, ntb_reg_write(8, XEON_SBAR4XLAT_OFFSET, 0); if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { - size_t size, xlatoffset; + uint32_t xlat_reg, lmt_reg; enum ntb_bar bar_num; - bar_num = ntb_mw_to_bar(ntb, ntb->msix_mw_idx); - switch (bar_num) { - case NTB_B2B_BAR_1: - size = 8; - xlatoffset = XEON_SBAR2XLAT_OFFSET; - break; - case NTB_B2B_BAR_2: - xlatoffset = XEON_SBAR4XLAT_OFFSET; - if (HAS_FEATURE(ntb, NTB_SPLIT_BAR)) - size = 4; - else - size = 8; - break; - case NTB_B2B_BAR_3: - xlatoffset = XEON_SBAR5XLAT_OFFSET; - size = 4; - break; - default: - KASSERT(false, ("Bogus msix mw idx: %u", - ntb->msix_mw_idx)); - return (EINVAL); - } - /* * We point the chosen MSIX MW BAR xlat to remote LAPIC for * workaround */ - if (size == 4) { - ntb_reg_write(4, xlatoffset, MSI_INTEL_ADDR_BASE); - ntb->msix_xlat = ntb_reg_read(4, xlatoffset); + bar_num = ntb_mw_to_bar(ntb, ntb->msix_mw_idx); + bar_get_xlat_params(ntb, bar_num, NULL, &xlat_reg, &lmt_reg); + if (bar_is_64bit(ntb, bar_num)) { + ntb_reg_write(8, xlat_reg, MSI_INTEL_ADDR_BASE); + ntb->msix_xlat = ntb_reg_read(8, xlat_reg); + ntb_reg_write(8, lmt_reg, 0); } else { - ntb_reg_write(8, xlatoffset, MSI_INTEL_ADDR_BASE); - ntb->msix_xlat = ntb_reg_read(8, xlatoffset); + ntb_reg_write(4, xlat_reg, MSI_INTEL_ADDR_BASE); + ntb->msix_xlat = ntb_reg_read(4, xlat_reg); + ntb_reg_write(8, lmt_reg, 0); } ntb->peer_lapic_bar = &ntb->bar_info[bar_num]; From owner-svn-src-head@freebsd.org Sun Jul 10 02:46:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C34EFB85B4D; Sun, 10 Jul 2016 02:46:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 950C3130B; Sun, 10 Jul 2016 02:46:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A2kKMn027504; Sun, 10 Jul 2016 02:46:20 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A2kKJo027502; Sun, 10 Jul 2016 02:46:20 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607100246.u6A2kKJo027502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 10 Jul 2016 02:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302511 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 02:46:21 -0000 Author: pfg Date: Sun Jul 10 02:46:20 2016 New Revision: 302511 URL: https://svnweb.freebsd.org/changeset/base/302511 Log: mail(1): Invert calloc(3) argument order. calloc(3) is documented to have first a number and then a size. Obtained from: OpenBSD (through NetBSD) Modified: head/usr.bin/mail/cmd3.c head/usr.bin/mail/vars.c Modified: head/usr.bin/mail/cmd3.c ============================================================================== --- head/usr.bin/mail/cmd3.c Sun Jul 10 01:09:16 2016 (r302510) +++ head/usr.bin/mail/cmd3.c Sun Jul 10 02:46:20 2016 (r302511) @@ -463,7 +463,7 @@ group(char **argv) gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NULL) { - gh = calloc(sizeof(*gh), 1); + gh = calloc(1, sizeof(*gh)); gh->g_name = vcopy(gname); gh->g_list = NULL; gh->g_link = groups[h]; @@ -477,7 +477,7 @@ group(char **argv) */ for (ap = argv+1; *ap != NULL; ap++) { - gp = calloc(sizeof(*gp), 1); + gp = calloc(1, sizeof(*gp)); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; Modified: head/usr.bin/mail/vars.c ============================================================================== --- head/usr.bin/mail/vars.c Sun Jul 10 01:09:16 2016 (r302510) +++ head/usr.bin/mail/vars.c Sun Jul 10 02:46:20 2016 (r302511) @@ -56,7 +56,7 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(sizeof(*vp), 1); + vp = calloc(1, sizeof(*vp)); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; From owner-svn-src-head@freebsd.org Sun Jul 10 03:49:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30C23B8392E; Sun, 10 Jul 2016 03:49:40 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6F901F92; Sun, 10 Jul 2016 03:49:39 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A3ndiq050497; Sun, 10 Jul 2016 03:49:39 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A3ncUC050491; Sun, 10 Jul 2016 03:49:38 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607100349.u6A3ncUC050491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 10 Jul 2016 03:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302512 - in head/lib/libc: gen locale regex stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 03:49:40 -0000 Author: ache Date: Sun Jul 10 03:49:38 2016 New Revision: 302512 URL: https://svnweb.freebsd.org/changeset/base/302512 Log: Remove broken support for collation in [a-z] type ranges. Only first 256 wide chars are considered currently, all other are just dropped from the range. Proper implementation require reverse tables database lookup, since objects are really big as max UTF-8 (1114112 code points), so just the same scanning as it was for 256 chars will slow things down. POSIX does not require collation for [a-z] type ranges and does not prohibit it for non-POSIX locales. POSIX require collation for ranges only for POSIX (or C) locale which is equal to ASCII and binary for other chars, so we already have it. No other *BSD implements collation for [a-z] type ranges. Restore ABI compatibility with unused now __collate_range_cmp() which is visible from outside (will be removed later). Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/gen/glob.c head/lib/libc/locale/collate.h head/lib/libc/locale/collcmp.c head/lib/libc/regex/regcomp.c head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/gen/fnmatch.c Sun Jul 10 03:49:38 2016 (r302512) @@ -63,8 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "collate.h" - #define EOS '\0' #define RANGE_MATCH 1 @@ -238,8 +236,6 @@ rangematch(const char *pattern, wchar_t wchar_t c, c2; size_t pclen; const char *origpat; - struct xlocale_collate *table = - (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* * A bracket expression starting with an unquoted circumflex @@ -294,11 +290,7 @@ rangematch(const char *pattern, wchar_t if (flags & FNM_CASEFOLD) c2 = towlower(c2); - if (table->__collate_load_error ? - c <= test && test <= c2 : - __wcollate_range_cmp(table, c, test) <= 0 - && __wcollate_range_cmp(table, test, c2) <= 0 - ) + if (c <= test && test <= c2) ok = 1; } else if (c == test) ok = 1; Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/gen/glob.c Sun Jul 10 03:49:38 2016 (r302512) @@ -92,8 +92,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "collate.h" - /* * glob(3) expansion limits. Stop the expansion if any of these limits * is reached. This caps the runtime in the face of DoS attacks. See @@ -804,8 +802,6 @@ match(Char *name, Char *pat, Char *paten { int ok, negate_range; Char c, k; - struct xlocale_collate *table = - (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; while (pat < patend) { c = *pat++; @@ -830,11 +826,7 @@ match(Char *name, Char *pat, Char *paten ++pat; while (((c = *pat++) & M_MASK) != M_END) if ((*pat & M_MASK) == M_RNG) { - if (table->__collate_load_error ? - CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : - __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 - && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 - ) + if (CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1])) ok = 1; pat += 2; } else if (c == k) Modified: head/lib/libc/locale/collate.h ============================================================================== --- head/lib/libc/locale/collate.h Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/locale/collate.h Sun Jul 10 03:49:38 2016 (r302512) @@ -128,8 +128,7 @@ int __collate_load_tables(const char *); int __collate_equiv_value(locale_t, const wchar_t *, size_t); void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, int, const int **); -int __collate_range_cmp(struct xlocale_collate *, char, char); -int __wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); +int __collate_range_cmp(int, int); size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, size_t); size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, Modified: head/lib/libc/locale/collcmp.c ============================================================================== --- head/lib/libc/locale/collcmp.c Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/locale/collcmp.c Sun Jul 10 03:49:38 2016 (r302512) @@ -33,15 +33,13 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include "collate.h" /* * Compare two characters using collate */ -int __collate_range_cmp(struct xlocale_collate *table, char c1, char c2) +int __collate_range_cmp(int c1, int c2) { char s1[2], s2[2]; @@ -49,20 +47,5 @@ int __collate_range_cmp(struct xlocale_c s1[1] = '\0'; s2[0] = c2; s2[1] = '\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (strcoll_l(s1, s2, &l)); -} - -int __wcollate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) -{ - wchar_t s1[2], s2[2]; - - s1[0] = c1; - s1[1] = L'\0'; - s2[0] = c2; - s2[1] = L'\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (wcscoll_l(s1, s2, &l)); + return (strcoll(s1, s2)); } Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/regex/regcomp.c Sun Jul 10 03:49:38 2016 (r302512) @@ -51,12 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include "collate.h" - #include "utils.h" #include "regex2.h" @@ -767,9 +764,6 @@ p_b_term(struct parse *p, cset *cs) { char c; wint_t start, finish; - wint_t i; - struct xlocale_collate *table = - (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* classify what we've got */ switch ((MORE()) ? PEEK() : '\0') { @@ -817,18 +811,8 @@ p_b_term(struct parse *p, cset *cs) if (start == finish) CHadd(p, cs, start); else { - if (table->__collate_load_error) { - (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); - CHaddrange(p, cs, start, finish); - } else { - (void)REQUIRE(__wcollate_range_cmp(table, start, finish) <= 0, REG_ERANGE); - for (i = 0; i <= UCHAR_MAX; i++) { - if ( __wcollate_range_cmp(table, start, i) <= 0 - && __wcollate_range_cmp(table, i, finish) <= 0 - ) - CHadd(p, cs, i); - } - } + (void)REQUIRE(start <= finish, REG_ERANGE); + CHaddrange(p, cs, start, finish); } break; } Modified: head/lib/libc/stdio/vfscanf.c ============================================================================== --- head/lib/libc/stdio/vfscanf.c Sun Jul 10 02:46:20 2016 (r302511) +++ head/lib/libc/stdio/vfscanf.c Sun Jul 10 03:49:38 2016 (r302512) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" -#include "collate.h" #include "libc_private.h" #include "local.h" #include "xlocale_private.h" @@ -816,9 +815,7 @@ match_failure: static const u_char * __sccl(char *tab, const u_char *fmt) { - int c, n, v, i; - struct xlocale_collate *table = - (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; + int c, n, v; /* first `clear' the whole table */ c = *fmt++; /* first char hat => negated scanset */ @@ -871,29 +868,15 @@ doswitch: * we just stored in the table (c). */ n = *fmt; - if (n == ']' - || (table->__collate_load_error ? n < c : - __wcollate_range_cmp(table, n, c) < 0 - ) - ) { + if (n == ']' || n < c) { c = '-'; break; /* resume the for(;;) */ } fmt++; - /* fill in the range */ - if (table->__collate_load_error) { - do { - tab[++c] = v; - } while (c < n); - } else { - for (i = 0; i < 256; i ++) - if (__wcollate_range_cmp(table, c, i) < 0 && - __wcollate_range_cmp(table, i, n) <= 0 - ) - tab[i] = v; - } + do { /* fill in the range */ + tab[++c] = v; + } while (c < n); #if 1 /* XXX another disgusting compatibility hack */ - c = n; /* * Alas, the V7 Unix scanf also treats formats * such as [a-c-e] as `the letters a through e'. From owner-svn-src-head@freebsd.org Sun Jul 10 08:04:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C908B8593F; Sun, 10 Jul 2016 08:04:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDE65117C; Sun, 10 Jul 2016 08:04:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A84335045946; Sun, 10 Jul 2016 08:04:03 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A842gr045943; Sun, 10 Jul 2016 08:04:02 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607100804.u6A842gr045943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 10 Jul 2016 08:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302514 - in head/sys: kern vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:04:04 -0000 Author: rwatson Date: Sun Jul 10 08:04:02 2016 New Revision: 302514 URL: https://svnweb.freebsd.org/changeset/base/302514 Log: Audit file-descriptor arguments to I/O system calls such as read(2), write(2), dup(2), and mmap(2). This auditing is not required by the Common Criteria (and hence was not being performed), but is valuable in both contemporary live analysis and forensic use cases. MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/kern/kern_descrip.c head/sys/kern/sys_generic.c head/sys/vm/vm_mmap.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jul 10 04:33:16 2016 (r302513) +++ head/sys/kern/kern_descrip.c Sun Jul 10 08:04:02 2016 (r302514) @@ -820,6 +820,9 @@ kern_dup(struct thread *td, u_int mode, MPASS((flags & ~(FDDUP_FLAG_CLOEXEC)) == 0); MPASS(mode < FDDUP_LASTMODE); + AUDIT_ARG_FD(old); + /* XXXRW: if (flags & FDDUP_FIXED) AUDIT_ARG_FD2(new); */ + /* * Verify we have a valid descriptor to dup from and possibly to * dup to. Unlike dup() and dup2(), fcntl()'s F_DUPFD should Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jul 10 04:33:16 2016 (r302513) +++ head/sys/kern/sys_generic.c Sun Jul 10 08:04:02 2016 (r302514) @@ -363,6 +363,8 @@ dofileread(td, fd, fp, auio, offset, fla struct uio *ktruio = NULL; #endif + AUDIT_ARG_FD(fd); + /* Finish zero length reads right here */ if (auio->uio_resid == 0) { td->td_retval[0] = 0; @@ -576,6 +578,7 @@ dofilewrite(td, fd, fp, auio, offset, fl struct uio *ktruio = NULL; #endif + AUDIT_ARG_FD(fd); auio->uio_rw = UIO_WRITE; auio->uio_td = td; auio->uio_offset = offset; Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sun Jul 10 04:33:16 2016 (r302513) +++ head/sys/vm/vm_mmap.c Sun Jul 10 08:04:02 2016 (r302514) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -206,6 +207,7 @@ sys_mmap(td, uap) pos = uap->pos; fp = NULL; + AUDIT_ARG_FD(uap->fd); /* * Ignore old flags that used to be defined but did not do anything. From owner-svn-src-head@freebsd.org Sun Jul 10 08:15:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5AFDB85DE7; Sun, 10 Jul 2016 08:15:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92FC7175A; Sun, 10 Jul 2016 08:15:52 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A8FpeO049815; Sun, 10 Jul 2016 08:15:51 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A8FpmA049808; Sun, 10 Jul 2016 08:15:51 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201607100815.u6A8FpmA049808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 10 Jul 2016 08:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302515 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:15:53 -0000 Author: dchagin Date: Sun Jul 10 08:15:50 2016 New Revision: 302515 URL: https://svnweb.freebsd.org/changeset/base/302515 Log: Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC flag. In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap(). Linux/i386 set this flag automatically if the binary requires executable stack. READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit. Added: head/sys/compat/linux/linux_persona.h (contents, props changed) Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_misc.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/syscalls.master ============================================================================== --- head/sys/amd64/linux/syscalls.master Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/amd64/linux/syscalls.master Sun Jul 10 08:15:50 2016 (r302515) @@ -270,7 +270,7 @@ 133 AUE_MKNOD STD { int linux_mknod(char *path, l_int mode, \ l_dev_t dev); } 134 AUE_USELIB UNIMPL uselib -135 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +135 AUE_PERSONALITY STD { int linux_personality(l_uint per); } 136 AUE_NULL STD { int linux_ustat(l_dev_t dev, \ struct l_ustat *ubuf); } 137 AUE_STATFS STD { int linux_statfs(char *path, \ Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/amd64/linux32/syscalls.master Sun Jul 10 08:15:50 2016 (r302515) @@ -238,7 +238,7 @@ 134 AUE_BDFLUSH STD { int linux_bdflush(void); } 135 AUE_NULL STD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -136 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +136 AUE_PERSONALITY STD { int linux_personality(l_uint per); } 137 AUE_NULL UNIMPL afs_syscall 138 AUE_SETFSUID STD { int linux_setfsuid16(l_uid16_t uid); } 139 AUE_SETFSGID STD { int linux_setfsgid16(l_gid16_t gid); } Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/compat/linux/linux_emul.c Sun Jul 10 08:15:50 2016 (r302515) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -127,7 +128,7 @@ linux_proc_init(struct thread *td, struc /* epoll should be destroyed in a case of exec. */ pem = pem_find(p); KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); - + pem->persona = 0; if (pem->epoll != NULL) { emd = pem->epoll; pem->epoll = NULL; @@ -220,6 +221,9 @@ linux_proc_exec(void *arg __unused, stru { struct thread *td = curthread; struct thread *othertd; +#if defined(__amd64__) + struct linux_pemuldata *pem; +#endif /* * In a case of execing from linux binary properly detach @@ -243,6 +247,17 @@ linux_proc_exec(void *arg __unused, stru linux_proc_init(td, NULL, 0); else linux_proc_init(td, td, 0); +#if defined(__amd64__) + /* + * An IA32 executable which has executable stack will have the + * READ_IMPLIES_EXEC personality flag set automatically. + */ + if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && + imgp->stack_prot & VM_PROT_EXECUTE) { + pem = pem_find(p); + pem->persona |= LINUX_READ_IMPLIES_EXEC; + } +#endif } } Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/compat/linux/linux_emul.h Sun Jul 10 08:15:50 2016 (r302515) @@ -67,6 +67,7 @@ struct linux_pemuldata { uint32_t flags; /* process emuldata flags */ struct sx pem_sx; /* lock for this struct */ void *epoll; /* epoll data */ + uint32_t persona; /* process execution domain */ }; #define LINUX_PEM_XLOCK(p) sx_xlock(&(p)->pem_sx) Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/compat/linux/linux_misc.c Sun Jul 10 08:15:50 2016 (r302515) @@ -1200,15 +1200,23 @@ linux_mknodat(struct thread *td, struct int linux_personality(struct thread *td, struct linux_personality_args *args) { + struct linux_pemuldata *pem; + struct proc *p = td->td_proc; + uint32_t old; + #ifdef DEBUG if (ldebug(personality)) - printf(ARGS(personality, "%lu"), (unsigned long)args->per); + printf(ARGS(personality, "%u"), args->per); #endif - if (args->per != 0) - return (EINVAL); - /* Yes Jim, it's still a Linux... */ - td->td_retval[0] = 0; + PROC_LOCK(p); + pem = pem_find(p); + old = pem->persona; + if (args->per != 0xffffffff) + pem->persona = args->per; + PROC_UNLOCK(p); + + td->td_retval[0] = old; return (0); } Added: head/sys/compat/linux/linux_persona.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_persona.h Sun Jul 10 08:15:50 2016 (r302515) @@ -0,0 +1,56 @@ +/* + * $FreeBSD$ + */ + +#ifndef LINUX_PERSONALITY_H +#define LINUX_PERSONALITY_H + +/* + * Flags for bug emulation. + * + * These occupy the top three bytes. + */ +enum { + LINUX_UNAME26 = 0x0020000, + LINUX_ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization + * of VA space + */ + LINUX_FDPIC_FUNCPTRS = 0x0080000, /* userspace function + * ptrs point to descriptors + * (signal handling) + */ + LINUX_MMAP_PAGE_ZERO = 0x0100000, + LINUX_ADDR_COMPAT_LAYOUT = 0x0200000, + LINUX_READ_IMPLIES_EXEC = 0x0400000, + LINUX_ADDR_LIMIT_32BIT = 0x0800000, + LINUX_SHORT_INODE = 0x1000000, + LINUX_WHOLE_SECONDS = 0x2000000, + LINUX_STICKY_TIMEOUTS = 0x4000000, + LINUX_ADDR_LIMIT_3GB = 0x8000000, +}; + +/* + * Security-relevant compatibility flags that must be + * cleared upon setuid or setgid exec: + */ +#define LINUX_PER_CLEAR_ON_SETID (LINUX_READ_IMPLIES_EXEC | \ + LINUX_ADDR_NO_RANDOMIZE | \ + LINUX_ADDR_COMPAT_LAYOUT | \ + LINUX_MMAP_PAGE_ZERO) + +/* + * Personality types. + * + * These go in the low byte. Avoid using the top bit, it will + * conflict with error returns. + */ +enum { + LINUX_PER_LINUX = 0x0000, + LINUX_PER_LINUX_32BIT = 0x0000 | LINUX_ADDR_LIMIT_32BIT, + LINUX_PER_LINUX_FDPIC = 0x0000 | LINUX_FDPIC_FUNCPTRS, + LINUX_PER_LINUX32 = 0x0008, + LINUX_PER_LINUX32_3GB = 0x0008 | LINUX_ADDR_LIMIT_3GB, + LINUX_PER_MASK = 0x00ff, +}; + +#endif /* LINUX_PERSONALITY_H */ Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun Jul 10 08:04:02 2016 (r302514) +++ head/sys/i386/linux/syscalls.master Sun Jul 10 08:15:50 2016 (r302515) @@ -240,7 +240,7 @@ 134 AUE_BDFLUSH STD { int linux_bdflush(void); } 135 AUE_NULL STD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -136 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +136 AUE_PERSONALITY STD { int linux_personality(l_uint per); } 137 AUE_NULL UNIMPL afs_syscall 138 AUE_SETFSUID STD { int linux_setfsuid16(l_uid16_t uid); } 139 AUE_SETFSGID STD { int linux_setfsgid16(l_gid16_t gid); } From owner-svn-src-head@freebsd.org Sun Jul 10 08:17:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F1BDB85E66; Sun, 10 Jul 2016 08:17:19 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A70C18E4; Sun, 10 Jul 2016 08:17:19 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A8HIvL049922; Sun, 10 Jul 2016 08:17:18 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A8HHvt049907; Sun, 10 Jul 2016 08:17:17 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201607100817.u6A8HHvt049907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 10 Jul 2016 08:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302516 - in head/sys: amd64/linux amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:17:19 -0000 Author: dchagin Date: Sun Jul 10 08:17:16 2016 New Revision: 302516 URL: https://svnweb.freebsd.org/changeset/base/302516 Log: Regen for r302215 (Linux personality). Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_syscall.h head/sys/amd64/linux/linux_syscalls.c head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux/linux_proto.h ============================================================================== --- head/sys/amd64/linux/linux_proto.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux/linux_proto.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -499,7 +499,7 @@ struct linux_mknod_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_ustat_args { char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)]; @@ -1397,6 +1397,13 @@ int linux_finit_module(struct thread *, #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD10 */ + #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX_SYS_AUE_linux_newstat AUE_STAT #define LINUX_SYS_AUE_linux_newfstat AUE_FSTAT Modified: head/sys/amd64/linux/linux_syscall.h ============================================================================== --- head/sys/amd64/linux/linux_syscall.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux/linux_syscall.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #define LINUX_SYS_read 0 Modified: head/sys/amd64/linux/linux_syscalls.c ============================================================================== --- head/sys/amd64/linux/linux_syscalls.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux/linux_syscalls.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux/linux_sysent.c ============================================================================== --- head/sys/amd64/linux/linux_sysent.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux/linux_sysent.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #include Modified: head/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- head/sys/amd64/linux/linux_systrace_args.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux/linux_systrace_args.c Sun Jul 10 08:17:16 2016 (r302516) @@ -1120,7 +1120,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 135: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -4112,7 +4112,7 @@ systrace_entry_setargdesc(int sysnum, in case 135: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux32/linux32_proto.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #ifndef _LINUX32_SYSPROTO_H_ @@ -427,7 +427,7 @@ struct linux_sysfs_args { char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_setfsuid16_args { char uid_l_[PADL_(l_uid16_t)]; l_uid16_t uid; char uid_r_[PADR_(l_uid16_t)]; @@ -1466,6 +1466,13 @@ int linux_process_vm_writev(struct threa #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD10 */ + #define LINUX32_SYS_AUE_linux_exit AUE_EXIT #define LINUX32_SYS_AUE_linux_fork AUE_FORK #define LINUX32_SYS_AUE_linux_open AUE_OPEN_RWTC Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux32/linux32_syscall.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #define LINUX32_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ const char *linux32_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux32/linux32_sysent.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #include "opt_compat.h" Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun Jul 10 08:17:16 2016 (r302516) @@ -910,7 +910,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 136: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -3715,7 +3715,7 @@ systrace_entry_setargdesc(int sysnum, in case 136: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/i386/linux/linux_proto.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -435,7 +435,7 @@ struct linux_sysfs_args { char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)]; }; struct linux_personality_args { - char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)]; + char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)]; }; struct linux_setfsuid16_args { char uid_l_[PADL_(l_uid16_t)]; l_uid16_t uid; char uid_r_[PADR_(l_uid16_t)]; @@ -1486,6 +1486,13 @@ int linux_process_vm_writev(struct threa #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD10 */ + #define LINUX_SYS_AUE_linux_exit AUE_EXIT #define LINUX_SYS_AUE_linux_fork AUE_FORK #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/i386/linux/linux_syscall.h Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/i386/linux/linux_syscalls.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/i386/linux/linux_sysent.c Sun Jul 10 08:17:16 2016 (r302516) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 300359 2016-05-21 08:01:14Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 302515 2016-07-10 08:15:50Z dchagin */ #include Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun Jul 10 08:15:50 2016 (r302515) +++ head/sys/i386/linux/linux_systrace_args.c Sun Jul 10 08:17:16 2016 (r302516) @@ -948,7 +948,7 @@ systrace_args(int sysnum, void *params, /* linux_personality */ case 136: { struct linux_personality_args *p = params; - iarg[0] = p->per; /* l_ulong */ + iarg[0] = p->per; /* l_uint */ *n_args = 1; break; } @@ -3849,7 +3849,7 @@ systrace_entry_setargdesc(int sysnum, in case 136: switch(ndx) { case 0: - p = "l_ulong"; + p = "l_uint"; break; default: break; From owner-svn-src-head@freebsd.org Sun Jul 10 08:22:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BC35B75083; Sun, 10 Jul 2016 08:22:06 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44CC41BFF; Sun, 10 Jul 2016 08:22:06 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A8M53G052797; Sun, 10 Jul 2016 08:22:05 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A8M4Kq052786; Sun, 10 Jul 2016 08:22:04 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201607100822.u6A8M4Kq052786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 10 Jul 2016 08:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:22:06 -0000 Author: dchagin Date: Sun Jul 10 08:22:04 2016 New Revision: 302517 URL: https://svnweb.freebsd.org/changeset/base/302517 Log: Fix a copy/paste bug introduced during X86_64 Linuxulator work. FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation use READ_IMPLIES_EXEC flag, introduced in r302515. While here move common part of mmap() and mprotect() code to the files in compat/linux to reduce code dupcliation between Linuxulator's. Reported by: Johannes Jost Meixner, Shawn Webb MFC after: 1 week XMFC with: r302515, r302516 Added: head/sys/compat/linux/linux_mmap.c (contents, props changed) head/sys/compat/linux/linux_mmap.h (contents, props changed) Modified: head/sys/amd64/linux/linux.h head/sys/amd64/linux/linux_machdep.c head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_machdep.c head/sys/i386/linux/linux.h head/sys/i386/linux/linux_machdep.c head/sys/modules/linux/Makefile head/sys/modules/linux_common/Makefile Modified: head/sys/amd64/linux/linux.h ============================================================================== --- head/sys/amd64/linux/linux.h Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/amd64/linux/linux.h Sun Jul 10 08:22:04 2016 (r302517) @@ -139,13 +139,6 @@ struct l_rlimit { l_ulong rlim_max; }; -/* mmap options */ -#define LINUX_MAP_SHARED 0x0001 -#define LINUX_MAP_PRIVATE 0x0002 -#define LINUX_MAP_FIXED 0x0010 -#define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 - /* * stat family of syscalls */ Modified: head/sys/amd64/linux/linux_machdep.c ============================================================================== --- head/sys/amd64/linux/linux_machdep.c Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/amd64/linux/linux_machdep.c Sun Jul 10 08:22:04 2016 (r302517) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -122,181 +123,19 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx", - args->addr, args->len, args->prot, - args->flags, args->fd, args->pgoff); - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* - * Linux mmap(2): - * You must specify exactly one of MAP_SHARED and MAP_PRIVATE - */ - if (! ((args->flags & LINUX_MAP_SHARED) ^ - (args->flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (args->flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (args->flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (args->flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (args->flags & LINUX_MAP_ANON) - bsd_args.flags |= MAP_ANON; - else - bsd_args.flags |= MAP_NOSYNC; - if (args->flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* - * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC - * on Linux/i386. We do this to ensure maximum compatibility. - * Linux/ia64 does the same in i386 emulation mode. - */ - bsd_args.prot = args->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd; - if (bsd_args.fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - */ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0 ) - return (error); - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - if (args->flags & LINUX_MAP_GROWSDOWN) { - /* - * The Linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the initial BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, Linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in Linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It then maps the top SGROWSIZ bytes, - * and auto grows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - if ((caddr_t)PTRIN(args->addr) + args->len > - p->p_vmspace->vm_maxsaddr) { - /* - * Some Linux apps will attempt to mmap - * thread stacks near the top of their - * address space. If their TOS is greater - * than vm_maxsaddr, vm_map_growstack() - * will confuse the thread stack with the - * process stack and deliver a SEGV if they - * attempt to grow the thread stack past their - * current stacksize rlimit. To avoid this, - * adjust vm_maxsaddr upwards to reflect - * the current stacksize rlimit rather - * than the maximum possible stacksize. - * It would be better to adjust the - * mmap'ed region, but some apps do not check - * mmap's return value. - */ - PROC_LOCK(p); - p->p_vmspace->vm_maxsaddr = (char *)USRSTACK - - lim_cur_proc(p, RLIMIT_STACK); - PROC_UNLOCK(p); - } - - /* - * This gives us our maximum stack size and a new BOS. - * If we're using VM_STACK, then mmap will just map - * the top SGROWSIZ bytes, and let the stack grow down - * to the limit at BOS. If we're not using VM_STACK - * we map the full stack, since we don't have a way - * to autogrow it. - */ - if (args->len > STACK_SIZE - GUARD_SIZE) { - bsd_args.addr = (caddr_t)PTRIN(args->addr); - bsd_args.len = args->len; - } else { - bsd_args.addr = (caddr_t)PTRIN(args->addr) - - (STACK_SIZE - GUARD_SIZE - args->len); - bsd_args.len = STACK_SIZE - GUARD_SIZE; - } - } else { - bsd_args.addr = (caddr_t)PTRIN(args->addr); - bsd_args.len = args->len; - } - bsd_args.pos = (off_t)args->pgoff; - - error = sys_mmap(td, &bsd_args); - - LINUX_CTR2(mmap2, "return: %d (%p)", - error, td->td_retval[0]); - return (error); + return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, + args->flags, args->fd, args->pgoff)); } int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - struct mprotect_args bsd_args; - - LINUX_CTR(mprotect); - bsd_args.addr = uap->addr; - bsd_args.len = uap->len; - bsd_args.prot = uap->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - return (sys_mprotect(td, &bsd_args)); + return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); } int Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/amd64/linux32/linux.h Sun Jul 10 08:22:04 2016 (r302517) @@ -165,13 +165,6 @@ struct l_rusage { l_long ru_nivcsw; } __packed; -/* mmap options */ -#define LINUX_MAP_SHARED 0x0001 -#define LINUX_MAP_PRIVATE 0x0002 -#define LINUX_MAP_FIXED 0x0010 -#define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 - struct l_mmap_argv { l_uintptr_t addr; l_size_t len; Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/amd64/linux32/linux32_machdep.c Sun Jul 10 08:22:04 2016 (r302517) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -84,9 +85,6 @@ struct l_old_select_argv { l_uintptr_t timeout; } __packed; -static int linux_mmap_common(struct thread *td, l_uintptr_t addr, - l_size_t len, l_int prot, l_int flags, l_int fd, - l_loff_t pos); static void bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru) @@ -448,9 +446,6 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { @@ -489,184 +484,11 @@ linux_mmap(struct thread *td, struct lin (uint32_t)linux_args.pgoff)); } -static int -linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot, - l_int flags, l_int fd, l_loff_t pos) -{ - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* - * Linux mmap(2): - * You must specify exactly one of MAP_SHARED and MAP_PRIVATE - */ - if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (flags & LINUX_MAP_ANON) { - /* Enforce pos to be on page boundary, then ignore. */ - if ((pos & PAGE_MASK) != 0) - return (EINVAL); - pos = 0; - bsd_args.flags |= MAP_ANON; - } else - bsd_args.flags |= MAP_NOSYNC; - if (flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* - * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC - * on Linux/i386. We do this to ensure maximum compatibility. - * Linux/ia64 does the same in i386 emulation mode. - */ - bsd_args.prot = prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd; - if (bsd_args.fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - */ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - - if (flags & LINUX_MAP_GROWSDOWN) { - /* - * The Linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the initial BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, Linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in Linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It then maps the top SGROWSIZ bytes, - * and auto grows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) { - /* - * Some Linux apps will attempt to mmap - * thread stacks near the top of their - * address space. If their TOS is greater - * than vm_maxsaddr, vm_map_growstack() - * will confuse the thread stack with the - * process stack and deliver a SEGV if they - * attempt to grow the thread stack past their - * current stacksize rlimit. To avoid this, - * adjust vm_maxsaddr upwards to reflect - * the current stacksize rlimit rather - * than the maximum possible stacksize. - * It would be better to adjust the - * mmap'ed region, but some apps do not check - * mmap's return value. - */ - PROC_LOCK(p); - p->p_vmspace->vm_maxsaddr = (char *)LINUX32_USRSTACK - - lim_cur_proc(p, RLIMIT_STACK); - PROC_UNLOCK(p); - } - - /* - * This gives us our maximum stack size and a new BOS. - * If we're using VM_STACK, then mmap will just map - * the top SGROWSIZ bytes, and let the stack grow down - * to the limit at BOS. If we're not using VM_STACK - * we map the full stack, since we don't have a way - * to autogrow it. - */ - if (len > STACK_SIZE - GUARD_SIZE) { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } else { - bsd_args.addr = (caddr_t)PTRIN(addr) - - (STACK_SIZE - GUARD_SIZE - len); - bsd_args.len = STACK_SIZE - GUARD_SIZE; - } - } else { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } - bsd_args.pos = pos; - -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s(%p, %d, %d, 0x%08x, %d, 0x%x)\n", - __func__, - (void *)bsd_args.addr, (int)bsd_args.len, bsd_args.prot, - bsd_args.flags, bsd_args.fd, (int)bsd_args.pos); -#endif - error = sys_mmap(td, &bsd_args); -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s() return: 0x%x (0x%08x)\n", - __func__, error, (u_int)td->td_retval[0]); -#endif - return (error); -} - int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - struct mprotect_args bsd_args; - bsd_args.addr = uap->addr; - bsd_args.len = uap->len; - bsd_args.prot = uap->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - return (sys_mprotect(td, &bsd_args)); + return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); } int Added: head/sys/compat/linux/linux_mmap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_mmap.c Sun Jul 10 08:22:04 2016 (r302517) @@ -0,0 +1,257 @@ +/*- + * Copyright (c) 2004 Tim J. Robbins + * Copyright (c) 2002 Doug Rabson + * Copyright (c) 2000 Marcel Moolenaar + * Copyright (c) 1994-1995 Søren Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + + +#define STACK_SIZE (2 * 1024 * 1024) +#define GUARD_SIZE (4 * PAGE_SIZE) + +#if defined(__amd64__) +static void linux_fixup_prot(struct thread *td, int *prot); +#endif + + +int +linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot, + int flags, int fd, off_t pos) +{ + struct proc *p = td->td_proc; + struct vmspace *vms = td->td_proc->p_vmspace; + struct mmap_args /* { + caddr_t addr; + size_t len; + int prot; + int flags; + int fd; + off_t pos; + } */ bsd_args; + int error; + struct file *fp; + + cap_rights_t rights; + LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx", + addr, len, prot, flags, fd, pos); + + error = 0; + bsd_args.flags = 0; + fp = NULL; + + /* + * Linux mmap(2): + * You must specify exactly one of MAP_SHARED and MAP_PRIVATE + */ + if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE))) + return (EINVAL); + + if (flags & LINUX_MAP_SHARED) + bsd_args.flags |= MAP_SHARED; + if (flags & LINUX_MAP_PRIVATE) + bsd_args.flags |= MAP_PRIVATE; + if (flags & LINUX_MAP_FIXED) + bsd_args.flags |= MAP_FIXED; + if (flags & LINUX_MAP_ANON) { + /* Enforce pos to be on page boundary, then ignore. */ + if ((pos & PAGE_MASK) != 0) + return (EINVAL); + pos = 0; + bsd_args.flags |= MAP_ANON; + } else + bsd_args.flags |= MAP_NOSYNC; + if (flags & LINUX_MAP_GROWSDOWN) + bsd_args.flags |= MAP_STACK; + + /* + * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC + * on Linux/i386 if the binary requires executable stack. + * We do this only for IA32 emulation as on native i386 this is does not + * make sense without PAE. + * + * XXX. Linux checks that the file system is not mounted with noexec. + */ + bsd_args.prot = prot; +#if defined(__amd64__) + linux_fixup_prot(td, &bsd_args.prot); +#endif + + /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ + bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd; + if (bsd_args.fd != -1) { + /* + * Linux follows Solaris mmap(2) description: + * The file descriptor fildes is opened with + * read permission, regardless of the + * protection options specified. + */ + + error = fget(td, bsd_args.fd, + cap_rights_init(&rights, CAP_MMAP), &fp); + if (error != 0) + return (error); + if (fp->f_type != DTYPE_VNODE) { + fdrop(fp, td); + return (EINVAL); + } + + /* Linux mmap() just fails for O_WRONLY files */ + if (!(fp->f_flag & FREAD)) { + fdrop(fp, td); + return (EACCES); + } + + fdrop(fp, td); + } + + if (flags & LINUX_MAP_GROWSDOWN) { + /* + * The Linux MAP_GROWSDOWN option does not limit auto + * growth of the region. Linux mmap with this option + * takes as addr the initial BOS, and as len, the initial + * region size. It can then grow down from addr without + * limit. However, Linux threads has an implicit internal + * limit to stack size of STACK_SIZE. Its just not + * enforced explicitly in Linux. But, here we impose + * a limit of (STACK_SIZE - GUARD_SIZE) on the stack + * region, since we can do this with our mmap. + * + * Our mmap with MAP_STACK takes addr as the maximum + * downsize limit on BOS, and as len the max size of + * the region. It then maps the top SGROWSIZ bytes, + * and auto grows the region down, up to the limit + * in addr. + * + * If we don't use the MAP_STACK option, the effect + * of this code is to allocate a stack region of a + * fixed size of (STACK_SIZE - GUARD_SIZE). + */ + + if ((caddr_t)addr + len > vms->vm_maxsaddr) { + /* + * Some Linux apps will attempt to mmap + * thread stacks near the top of their + * address space. If their TOS is greater + * than vm_maxsaddr, vm_map_growstack() + * will confuse the thread stack with the + * process stack and deliver a SEGV if they + * attempt to grow the thread stack past their + * current stacksize rlimit. To avoid this, + * adjust vm_maxsaddr upwards to reflect + * the current stacksize rlimit rather + * than the maximum possible stacksize. + * It would be better to adjust the + * mmap'ed region, but some apps do not check + * mmap's return value. + */ + PROC_LOCK(p); + vms->vm_maxsaddr = (char *)p->p_sysent->sv_usrstack - + lim_cur_proc(p, RLIMIT_STACK); + PROC_UNLOCK(p); + } + + /* + * This gives us our maximum stack size and a new BOS. + * If we're using VM_STACK, then mmap will just map + * the top SGROWSIZ bytes, and let the stack grow down + * to the limit at BOS. If we're not using VM_STACK + * we map the full stack, since we don't have a way + * to autogrow it. + */ + if (len > STACK_SIZE - GUARD_SIZE) { + bsd_args.addr = (caddr_t)addr; + bsd_args.len = len; + } else { + bsd_args.addr = (caddr_t)addr - + (STACK_SIZE - GUARD_SIZE - len); + bsd_args.len = STACK_SIZE - GUARD_SIZE; + } + } else { + bsd_args.addr = (caddr_t)addr; + bsd_args.len = len; + } + bsd_args.pos = pos; + + error = sys_mmap(td, &bsd_args); + + LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); + + return (error); +} + +int +linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot) +{ + struct mprotect_args bsd_args; + + bsd_args.addr = (void *)addr; + bsd_args.len = len; + bsd_args.prot = prot; + +#if defined(__amd64__) + linux_fixup_prot(td, &bsd_args.prot); +#endif + return (sys_mprotect(td, &bsd_args)); +} + +#if defined(__amd64__) +static void +linux_fixup_prot(struct thread *td, int *prot) +{ + struct linux_pemuldata *pem; + + if (SV_PROC_FLAG(td->td_proc, SV_ILP32) && *prot & PROT_READ) { + pem = pem_find(td->td_proc); + if (pem->persona & LINUX_READ_IMPLIES_EXEC) + *prot |= PROT_EXEC; + } + +} +#endif Added: head/sys/compat/linux/linux_mmap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_mmap.h Sun Jul 10 08:22:04 2016 (r302517) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2004 Tim J. Robbins + * Copyright (c) 2002 Doug Rabson + * Copyright (c) 2000 Marcel Moolenaar + * Copyright (c) 1994-1995 Søren Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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 _LINUX_MMAP_H_ +#define _LINUX_MMAP_H_ + +/* mmap options */ +#define LINUX_MAP_SHARED 0x0001 +#define LINUX_MAP_PRIVATE 0x0002 +#define LINUX_MAP_FIXED 0x0010 +#define LINUX_MAP_ANON 0x0020 +#define LINUX_MAP_GROWSDOWN 0x0100 + + +int linux_mmap_common(struct thread *, uintptr_t, size_t, int, int, + int, off_t); +int linux_mprotect_common(struct thread *, uintptr_t, size_t, int); + +#endif /* _LINUX_MMAP_H_ */ Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/i386/linux/linux.h Sun Jul 10 08:22:04 2016 (r302517) @@ -140,13 +140,6 @@ struct l_rlimit { l_ulong rlim_max; }; -/* mmap options */ -#define LINUX_MAP_SHARED 0x0001 -#define LINUX_MAP_PRIVATE 0x0002 -#define LINUX_MAP_FIXED 0x0010 -#define LINUX_MAP_ANON 0x0020 -#define LINUX_MAP_GROWSDOWN 0x0100 - struct l_mmap_argv { l_uintptr_t addr; l_size_t len; Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/i386/linux/linux_machdep.c Sun Jul 10 08:22:04 2016 (r302517) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -95,10 +96,6 @@ struct l_old_select_argv { struct l_timeval *timeout; }; -static int linux_mmap_common(struct thread *td, l_uintptr_t addr, - l_size_t len, l_int prot, l_int flags, l_int fd, - l_loff_t pos); - int linux_execve(struct thread *td, struct linux_execve_args *args) @@ -340,9 +337,6 @@ linux_set_upcall_kse(struct thread *td, return (0); } -#define STACK_SIZE (2 * 1024 * 1024) -#define GUARD_SIZE (4 * PAGE_SIZE) - int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { @@ -381,187 +375,11 @@ linux_mmap(struct thread *td, struct lin (uint32_t)linux_args.pgoff)); } -static int -linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot, - l_int flags, l_int fd, l_loff_t pos) -{ - struct proc *p = td->td_proc; - struct mmap_args /* { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; - } */ bsd_args; - int error; - struct file *fp; - cap_rights_t rights; - - error = 0; - bsd_args.flags = 0; - fp = NULL; - - /* - * Linux mmap(2): - * You must specify exactly one of MAP_SHARED and MAP_PRIVATE - */ - if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE))) - return (EINVAL); - - if (flags & LINUX_MAP_SHARED) - bsd_args.flags |= MAP_SHARED; - if (flags & LINUX_MAP_PRIVATE) - bsd_args.flags |= MAP_PRIVATE; - if (flags & LINUX_MAP_FIXED) - bsd_args.flags |= MAP_FIXED; - if (flags & LINUX_MAP_ANON) { - /* Enforce pos to be on page boundary, then ignore. */ - if ((pos & PAGE_MASK) != 0) - return (EINVAL); - pos = 0; - bsd_args.flags |= MAP_ANON; - } else - bsd_args.flags |= MAP_NOSYNC; - if (flags & LINUX_MAP_GROWSDOWN) - bsd_args.flags |= MAP_STACK; - - /* - * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC - * on Linux/i386. We do this to ensure maximum compatibility. - * Linux/ia64 does the same in i386 emulation mode. - */ - bsd_args.prot = prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - - /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */ - bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd; - if (bsd_args.fd != -1) { - /* - * Linux follows Solaris mmap(2) description: - * The file descriptor fildes is opened with - * read permission, regardless of the - * protection options specified. - * - * Checking just CAP_MMAP is fine here, since the real work - * is done in the FreeBSD mmap(). - */ - - error = fget(td, bsd_args.fd, - cap_rights_init(&rights, CAP_MMAP), &fp); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_VNODE) { - fdrop(fp, td); - return (EINVAL); - } - - /* Linux mmap() just fails for O_WRONLY files */ - if (!(fp->f_flag & FREAD)) { - fdrop(fp, td); - return (EACCES); - } - - fdrop(fp, td); - } - - if (flags & LINUX_MAP_GROWSDOWN) { - /* - * The Linux MAP_GROWSDOWN option does not limit auto - * growth of the region. Linux mmap with this option - * takes as addr the inital BOS, and as len, the initial - * region size. It can then grow down from addr without - * limit. However, linux threads has an implicit internal - * limit to stack size of STACK_SIZE. Its just not - * enforced explicitly in linux. But, here we impose - * a limit of (STACK_SIZE - GUARD_SIZE) on the stack - * region, since we can do this with our mmap. - * - * Our mmap with MAP_STACK takes addr as the maximum - * downsize limit on BOS, and as len the max size of - * the region. It them maps the top SGROWSIZ bytes, - * and auto grows the region down, up to the limit - * in addr. - * - * If we don't use the MAP_STACK option, the effect - * of this code is to allocate a stack region of a - * fixed size of (STACK_SIZE - GUARD_SIZE). - */ - - if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) { - /* - * Some linux apps will attempt to mmap - * thread stacks near the top of their - * address space. If their TOS is greater - * than vm_maxsaddr, vm_map_growstack() - * will confuse the thread stack with the - * process stack and deliver a SEGV if they - * attempt to grow the thread stack past their - * current stacksize rlimit. To avoid this, - * adjust vm_maxsaddr upwards to reflect - * the current stacksize rlimit rather - * than the maximum possible stacksize. - * It would be better to adjust the - * mmap'ed region, but some apps do not check - * mmap's return value. - */ - PROC_LOCK(p); - p->p_vmspace->vm_maxsaddr = (char *)USRSTACK - - lim_cur_proc(p, RLIMIT_STACK); - PROC_UNLOCK(p); - } - - /* - * This gives us our maximum stack size and a new BOS. - * If we're using VM_STACK, then mmap will just map - * the top SGROWSIZ bytes, and let the stack grow down - * to the limit at BOS. If we're not using VM_STACK - * we map the full stack, since we don't have a way - * to autogrow it. - */ - if (len > STACK_SIZE - GUARD_SIZE) { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } else { - bsd_args.addr = (caddr_t)PTRIN(addr) - - (STACK_SIZE - GUARD_SIZE - len); - bsd_args.len = STACK_SIZE - GUARD_SIZE; - } - } else { - bsd_args.addr = (caddr_t)PTRIN(addr); - bsd_args.len = len; - } - bsd_args.pos = pos; - -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s(%p, %d, %d, 0x%08x, %d, 0x%x)\n", - __func__, - (void *)bsd_args.addr, bsd_args.len, bsd_args.prot, - bsd_args.flags, bsd_args.fd, (int)bsd_args.pos); -#endif - error = sys_mmap(td, &bsd_args); -#ifdef DEBUG - if (ldebug(mmap)) - printf("-> %s() return: 0x%x (0x%08x)\n", - __func__, error, (u_int)td->td_retval[0]); -#endif - return (error); -} - int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - struct mprotect_args bsd_args; - bsd_args.addr = uap->addr; - bsd_args.len = uap->len; - bsd_args.prot = uap->prot; - if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC)) - bsd_args.prot |= PROT_READ | PROT_EXEC; - return (sys_mprotect(td, &bsd_args)); + return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); } int Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Sun Jul 10 08:17:16 2016 (r302516) +++ head/sys/modules/linux/Makefile Sun Jul 10 08:22:04 2016 (r302517) @@ -30,7 +30,7 @@ SRCS+= opt_apic.h OBJS= ${VDSO}.so .if ${MACHINE_CPUARCH} == "i386" -SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c \ +SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c linux_mmap.c \ linux_emul.c opt_cpu.h linux.c *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jul 10 08:30:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73BB7B751E6; Sun, 10 Jul 2016 08:30:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E74C41188; Sun, 10 Jul 2016 08:30:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u6A8UH57072545 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 10 Jul 2016 11:30:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u6A8UH57072545 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u6A8UHhL072544; Sun, 10 Jul 2016 11:30:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 10 Jul 2016 11:30:17 +0300 From: Konstantin Belousov To: Dmitry Chagin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common Message-ID: <20160710083017.GR38613@kib.kiev.ua> References: <201607100822.u6A8M4Kq052786@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607100822.u6A8M4Kq052786@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:30:28 -0000 On Sun, Jul 10, 2016 at 08:22:04AM +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Sun Jul 10 08:22:04 2016 > New Revision: 302517 > URL: https://svnweb.freebsd.org/changeset/base/302517 > > Log: > Fix a copy/paste bug introduced during X86_64 Linuxulator work. > FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation > use READ_IMPLIES_EXEC flag, introduced in r302515. > > While here move common part of mmap() and mprotect() code to the files in compat/linux > to reduce code dupcliation between Linuxulator's. > > Reported by: Johannes Jost Meixner, Shawn Webb > > MFC after: 1 week > XMFC with: r302515, r302516 > > Added: > head/sys/compat/linux/linux_mmap.c (contents, props changed) > head/sys/compat/linux/linux_mmap.h (contents, props changed) > Modified: > head/sys/amd64/linux/linux.h > head/sys/amd64/linux/linux_machdep.c > head/sys/amd64/linux32/linux.h > head/sys/amd64/linux32/linux32_machdep.c > head/sys/i386/linux/linux.h > head/sys/i386/linux/linux_machdep.c > head/sys/modules/linux/Makefile > head/sys/modules/linux_common/Makefile Do conf/files.{i386,amd64} need update as well ? From owner-svn-src-head@freebsd.org Sun Jul 10 08:31:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 315B4B75265; Sun, 10 Jul 2016 08:31:17 +0000 (UTC) (envelope-from herbert@mailbox.org) Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.mailbox.org", Issuer "SwissSign Server Silver CA 2014 - G22" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E73F91365; Sun, 10 Jul 2016 08:31:16 +0000 (UTC) (envelope-from herbert@mailbox.org) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 5056840091; Sun, 10 Jul 2016 10:30:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-type:content-type:mime-version:references:in-reply-to :subject:subject:from:from:message-id:date:date:received; s= mail20150812; t=1468139457; bh=5IHXnnWRnfln02P9c265Q6PYeVRk3oMx9 /gUaat1MGE=; b=PvBrn/Bz9Zr7VcKOedKmCM5wyh6Eq8vDpbInh75QuMpcicIen swaHwuCzX1kKsvQm+p+jENEwPGzyP1vdUPy+2i1lMm6qPt/DJMyzcTpTNZjw8hSi BrKnjrA8TdqtRBHfd3eNs0ot6M+hyseZIwI4uVYjGtomfbKf21UChLTeqHh5kl9K k42kfC7tqQ0Rh+EHm/gRp2zy6+L9nMFPwNqe8rgp5nSS5k2KF3p/Lvagl8tdXfgl sKjDt5Hvb7C62ElyB7j8YVJCFPnPzwGFLrpslhDnEakRhrvr7USvfgcBzfDLxFe0 iMQ9tUkJqumuPVHvWx9WskDUfAPVfqYEldAYA== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id CohUXXHGOK8x; Sun, 10 Jul 2016 10:30:57 +0200 (CEST) Date: Sun, 10 Jul 2016 10:30:55 +0200 Message-ID: <868tx9x5c0.wl-herbert@mailbox.org> From: "Herbert J. Skuhra" To: Garrett Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r298840 - in head: . lib/libkvm In-Reply-To: <201604300921.u3U9LExR053840@repo.freebsd.org> References: <201604300921.u3U9LExR053840@repo.freebsd.org> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:31:17 -0000 Garrett Cooper skrev: > > Author: ngie > Date: Sat Apr 30 09:21:13 2016 > New Revision: 298840 > URL: https://svnweb.freebsd.org/changeset/base/298840 > > Log: > Remove kvm_getfiles(3) > > This libcall has been broken since (at least) r174989/8.0-RELEASE. > > Bump SHLIB_MAJOR for the change > > Differential Revision: https://reviews.freebsd.org/D6052 > Relnotes: yes > Reviewed by: jhb, markj > Sponsored by: EMC / Isilon Storage Division > > Deleted: > head/lib/libkvm/kvm_file.c > head/lib/libkvm/kvm_getfiles.3 > Modified: > head/ObsoleteFiles.inc > head/lib/libkvm/Makefile > head/lib/libkvm/kvm.3 > head/lib/libkvm/kvm.h > > Modified: head/ObsoleteFiles.inc > ============================================================================== > --- head/ObsoleteFiles.inc Sat Apr 30 09:13:26 2016 (r298839) > +++ head/ObsoleteFiles.inc Sat Apr 30 09:21:13 2016 (r298840) > @@ -38,6 +38,9 @@ > # xargs -n1 | sort | uniq -d; > # done > > +# 20160430: kvm_getfiles(3) removed from kvm(3) > +OLD_LIBS+=usr/lib/libkvm.so.6 ^^^ I guess this should be +OLD_LIBS+=lib/libkvm.so.6 -- Herbert From owner-svn-src-head@freebsd.org Sun Jul 10 08:38:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10031B75650; Sun, 10 Jul 2016 08:38:12 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0D261881; Sun, 10 Jul 2016 08:38:11 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A8cBD9057157; Sun, 10 Jul 2016 08:38:11 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A8cA4g057155; Sun, 10 Jul 2016 08:38:10 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201607100838.u6A8cA4g057155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 10 Jul 2016 08:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302518 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:38:12 -0000 Author: dchagin Date: Sun Jul 10 08:38:10 2016 New Revision: 302518 URL: https://svnweb.freebsd.org/changeset/base/302518 Log: Add linux_mmap.c to the appropriate conf/files. Reported by: kib@ MFC after: 1 week Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Jul 10 08:22:04 2016 (r302517) +++ head/sys/conf/files.amd64 Sun Jul 10 08:38:10 2016 (r302518) @@ -533,6 +533,7 @@ compat/linux/linux_ioctl.c optional comp compat/linux/linux_ipc.c optional compat_linux32 compat/linux/linux_mib.c optional compat_linux32 compat/linux/linux_misc.c optional compat_linux32 +compat/linux/linux_mmap.c optional compat_linux32 compat/linux/linux_signal.c optional compat_linux32 compat/linux/linux_socket.c optional compat_linux32 compat/linux/linux_stats.c optional compat_linux32 Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Jul 10 08:22:04 2016 (r302517) +++ head/sys/conf/files.i386 Sun Jul 10 08:38:10 2016 (r302518) @@ -96,6 +96,7 @@ compat/linux/linux_ioctl.c optional comp compat/linux/linux_ipc.c optional compat_linux compat/linux/linux_mib.c optional compat_linux compat/linux/linux_misc.c optional compat_linux +compat/linux/linux_mmap.c optional compat_linux compat/linux/linux_signal.c optional compat_linux compat/linux/linux_socket.c optional compat_linux compat/linux/linux_stats.c optional compat_linux From owner-svn-src-head@freebsd.org Sun Jul 10 08:39:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28344B756CC; Sun, 10 Jul 2016 08:39:49 +0000 (UTC) (envelope-from dchagin@chd.heemeyer.club) Received: from heemeyer.club (heemeyer.club [108.61.204.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "heemeyer.club", Issuer "heemeyer.club" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0198E1A45; Sun, 10 Jul 2016 08:39:48 +0000 (UTC) (envelope-from dchagin@chd.heemeyer.club) Received: from chd.heemeyer.club (dchagin.static.corbina.ru [78.107.232.239]) by heemeyer.club (8.15.2/8.15.1) with ESMTPS id u6A8diak001632 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Jul 2016 08:39:45 GMT (envelope-from dchagin@chd.heemeyer.club) X-Authentication-Warning: heemeyer.club: Host dchagin.static.corbina.ru [78.107.232.239] claimed to be chd.heemeyer.club Received: from chd.heemeyer.club (localhost [127.0.0.1]) by chd.heemeyer.club (8.15.2/8.15.1) with ESMTPS id u6A8dWMW015631 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 10 Jul 2016 11:39:33 +0300 (MSK) (envelope-from dchagin@chd.heemeyer.club) Received: (from dchagin@localhost) by chd.heemeyer.club (8.15.2/8.15.2/Submit) id u6A8dWFS015630; Sun, 10 Jul 2016 11:39:32 +0300 (MSK) (envelope-from dchagin) Date: Sun, 10 Jul 2016 11:39:32 +0300 From: Chagin Dmitry To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common Message-ID: <20160710083932.GA15617@chd.heemeyer.club> References: <201607100822.u6A8M4Kq052786@repo.freebsd.org> <20160710083017.GR38613@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160710083017.GR38613@kib.kiev.ua> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 08:39:49 -0000 On Sun, Jul 10, 2016 at 11:30:17AM +0300, Konstantin Belousov wrote: > On Sun, Jul 10, 2016 at 08:22:04AM +0000, Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Jul 10 08:22:04 2016 > > New Revision: 302517 > > URL: https://svnweb.freebsd.org/changeset/base/302517 > > > > Log: > > Fix a copy/paste bug introduced during X86_64 Linuxulator work. > > FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation > > use READ_IMPLIES_EXEC flag, introduced in r302515. > > > > While here move common part of mmap() and mprotect() code to the files in compat/linux > > to reduce code dupcliation between Linuxulator's. > > > > Reported by: Johannes Jost Meixner, Shawn Webb > > > > MFC after: 1 week > > XMFC with: r302515, r302516 > > > > Added: > > head/sys/compat/linux/linux_mmap.c (contents, props changed) > > head/sys/compat/linux/linux_mmap.h (contents, props changed) > > Modified: > > head/sys/amd64/linux/linux.h > > head/sys/amd64/linux/linux_machdep.c > > head/sys/amd64/linux32/linux.h > > head/sys/amd64/linux32/linux32_machdep.c > > head/sys/i386/linux/linux.h > > head/sys/i386/linux/linux_machdep.c > > head/sys/modules/linux/Makefile > > head/sys/modules/linux_common/Makefile > > Do conf/files.{i386,amd64} need update as well ? missed it, thank you! From owner-svn-src-head@freebsd.org Sun Jul 10 09:32:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68C61B8363E; Sun, 10 Jul 2016 09:32:39 +0000 (UTC) (envelope-from herbert@mailbox.org) Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.mailbox.org", Issuer "SwissSign Server Silver CA 2014 - G22" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C45113DF; Sun, 10 Jul 2016 09:32:38 +0000 (UTC) (envelope-from herbert@mailbox.org) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id EB777434EB; Sun, 10 Jul 2016 11:32:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-type:content-type:mime-version:references:in-reply-to :subject:subject:from:from:message-id:date:date:received; s= mail20150812; t=1468143147; bh=3K/CKDGF0Zf6AGoy4Uyfj5JnWESamGQMF LvHv4IiQEQ=; b=UVPpEpOUbUWyg3p1F32AGkhB5t+rvxSCiL57/VZPWBre7r508 8OYK2GdRxcscI3nSHipE4Bsa65y/4nw5SzfO999Ux4OAyXyQJrDWQMeQOYTHNUDz l7Y1lQAKtYF/e8qIQABcdE77jMNXW3+J12bHfBwQ3QB5uu5lkSWJUH5Eybjq55a2 zUWryI6zbh+g5XF0il12cS+pwFNUjQs255k5ViGCDHwysx9KkUA3E+qa0MLtUixj Qf0qqeX4XCUttJCPIBm++/mIIHV9AcO0UeDxgIrWG1dlBRCaPGhQkO316H2cub7O 433x0wpZPxbylmatBl1ViETKTF4wJh8+7nHfQ== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id WfwCebj-RZYa; Sun, 10 Jul 2016 11:32:27 +0200 (CEST) Date: Sun, 10 Jul 2016 11:32:26 +0200 Message-ID: <867fctx2hh.wl-herbert@mailbox.org> From: "Herbert J. Skuhra" To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r298627 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/arm arm/at91 arm/broadcom/bcm2835 arm/cavium/cns11xx arm/freescale arm/freescale/imx... In-Reply-To: <201604261153.u3QBrbKK077561@repo.freebsd.org> References: <201604261153.u3QBrbKK077561@repo.freebsd.org> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 09:32:39 -0000 Hei, Ruslan Bukin skrev: > > Author: br > Date: Tue Apr 26 11:53:37 2016 > New Revision: 298627 > URL: https://svnweb.freebsd.org/changeset/base/298627 > > Log: > Move arm's devmap to some generic place, so it can be used > by other architectures. > > Reviewed by: imp > Differential Revision: https://reviews.freebsd.org/D6091 > Sponsored by: DARPA, AFRL > Sponsored by: HEIF5 Should we have # 20160426: arm's devmap moved OLD_FILES+=usr/include/machine/devmap.h in ObsoleteFiles.inc ? -- Herbert From owner-svn-src-head@freebsd.org Sun Jul 10 09:50:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04CFBB838FE; Sun, 10 Jul 2016 09:50:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B417E1940; Sun, 10 Jul 2016 09:50:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6A9oLaF082916; Sun, 10 Jul 2016 09:50:21 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6A9oLVD082915; Sun, 10 Jul 2016 09:50:21 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607100950.u6A9oLVD082915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 10 Jul 2016 09:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302519 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 09:50:23 -0000 Author: rwatson Date: Sun Jul 10 09:50:21 2016 New Revision: 302519 URL: https://svnweb.freebsd.org/changeset/base/302519 Log: Audit the file-descriptor number argument for openat(2). Remove a comment about the desirability of auditing the number, as it was in fact in the wrong place (in the common path for open(2) and openat(2), and only the latter accepts a file-descriptor argument). Where other ABIs support openat(2), it may be necessary to do additional argument auditing as it is not performed in kern_openat(9). MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Jul 10 08:38:10 2016 (r302518) +++ head/sys/kern/vfs_syscalls.c Sun Jul 10 09:50:21 2016 (r302519) @@ -942,6 +942,7 @@ int sys_openat(struct thread *td, struct openat_args *uap) { + AUDIT_ARG_FD(uap->fd); return (kern_openat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag, uap->mode)); } @@ -962,7 +963,6 @@ kern_openat(struct thread *td, int fd, c AUDIT_ARG_FFLAGS(flags); AUDIT_ARG_MODE(mode); - /* XXX: audit dirfd */ cap_rights_init(&rights, CAP_LOOKUP); flags_to_rights(flags, &rights); /* From owner-svn-src-head@freebsd.org Sun Jul 10 10:17:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 934FDB840E9; Sun, 10 Jul 2016 10:17:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C5611705; Sun, 10 Jul 2016 10:17:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AAHcKe093799; Sun, 10 Jul 2016 10:17:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AAHcgR093795; Sun, 10 Jul 2016 10:17:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607101017.u6AAHcgR093795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Jul 2016 10:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302520 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 10:17:39 -0000 Author: mav Date: Sun Jul 10 10:17:38 2016 New Revision: 302520 URL: https://svnweb.freebsd.org/changeset/base/302520 Log: Replace NTB man page with more detailed and up to date. Sponsored by: iXsystems, Inc. Added: head/share/man/man4/if_ntb.4 (contents, props changed) head/share/man/man4/ntb_hw.4 (contents, props changed) head/share/man/man4/ntb_transport.4 (contents, props changed) Deleted: head/share/man/man4/ntb.4 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Jul 10 09:50:21 2016 (r302519) +++ head/share/man/man4/Makefile Sun Jul 10 10:17:38 2016 (r302520) @@ -374,7 +374,9 @@ MAN= aac.4 \ ng_vlan.4 \ nmdm.4 \ nsp.4 \ - ${_ntb.4} \ + ${_ntb_hw.4} \ + ${_ntb_transport.4} \ + ${_if_ntb.4} \ null.4 \ numa.4 \ ${_nvd.4} \ @@ -678,8 +680,7 @@ MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} MLINKS+=nge.4 if_nge.4 -MLINKS+=${_ntb.4} ${_if_ntb.4} \ - ${_ntb.4} ${_ntb_hw.4} +MLINKS+=${_ntb_hw.4} ${_ntb.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=ow.4 onewire.4 MLINKS+=patm.4 if_patm.4 @@ -820,6 +821,7 @@ _if_ntb.4= if_ntb.4 _ioat.4= ioat.4 _ntb.4= ntb.4 _ntb_hw.4= ntb_hw.4 +_ntb_transport.4=ntb_transport.4 _qlxge.4= qlxge.4 _qlxgb.4= qlxgb.4 _qlxgbe.4= qlxgbe.4 Added: head/share/man/man4/if_ntb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/if_ntb.4 Sun Jul 10 10:17:38 2016 (r302520) @@ -0,0 +1,86 @@ +.\" +.\" Copyright (c) 2016 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 10, 2016 +.Dt IF_NTB 4 +.Os +.Sh NAME +.Nm if_ntb +.Nd Virtual Ethernet interface for Non-Transparent Bridges +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device if_ntb" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_ntb_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hw.if_ntb.num_queues +Number of transport queues to use per interface. +Default is 1. +.El +.Sh DESCRIPTION +The +.Nm +driver attaches on top of the +.Xr ntb_transport 4 +driver to utilize its resources to create virtual Ethernet interface between +the systems. +Interface capabilities depend on the underlying transport. +Typical MTU is about 64KB to reduce overhead. +By default one queue is used, but more may be configured. +The MAC address for interface is randomly generated. +.Pp +The +.Nm +driver does not implement any real hardware offload, but since PCIe link is +protected by CRC32, in some situations it may be possible to save some CPU +cycles by enabling fake checksum offload on both link sides via setting +.Cm rxcsum +and +.Cm txcsum +interface options. +.Sh SEE ALSO +.Xr ntb_transport 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Carl Delsey Aq Mt carl@FreeBSD.org . +Later improvements were done by +.An Conrad E. Meyer Aq Mt cem@FreeBSD.org +and +.An Alexander Motin Aq Mt mav@FreeBSD.org . Added: head/share/man/man4/ntb_hw.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ntb_hw.4 Sun Jul 10 10:17:38 2016 (r302520) @@ -0,0 +1,103 @@ +.\" +.\" Copyright (c) 2016 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 10, 2016 +.Dt NTB_HW 4 +.Os +.Sh NAME +.Nm ntb , +.Nm ntb_hw +.Nd Intel(R) Non-Transparent Bridge driver +.Sh SYNOPSIS +To compile this driver into your kernel, +place the following lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ntb_hw" +.Ed +.Pp +Or, to load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ntb_hw_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hw.ntb.debug_level +Driver debug level. +The default value is 0, higher means more verbose. +.El +.Sh DESCRIPTION +The NTB allows you to connect two computer systems using a PCIe link if they +have the correct equipment and connectors. +The +.Nm ntb_hw +driver provides support for the Non-Transparent Bridge (NTB) in the Intel S1200 +and Xeon E3/E5 processor families. +The +.Nm +driver hides hardware details, exposing memory windows, scratchpads and +doorbells via hardware independent KPI. +.Pp +The hardware provides 2-3 memory windows to the other system's memory, +16 scratchpad registers and 14/34 doorbells to interrupt the other system. +On Xeon processors one of memory windows is typically consumed by the driver +to workaround multiple hardware erratas. +.Sh CONFIGURATION +Tne NTB configuration should be set by BIOS. +It includes enabling NTB, choosing between NTB-to-NTB or NTB-to-Root Port mode, +enabling split BAR mode (one of two 64-bit BARs can be split into two 32-bit +ones) and configuring BAR sizes in bits (from 12 to 29/39) for both NTB sides. +.Pp +The recommended configuration is NTB-to-NTB mode, split bar is enabled and +all BAR sizes are set to 20 (1 MiB). +This needs to be done on both systems. +.Sh SEE ALSO +.Xr ntb_transport 4 , +.Xr if_ntb 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Carl Delsey Aq Mt carl@FreeBSD.org . +Later improvements were done by +.An Conrad E. Meyer Aq Mt cem@FreeBSD.org +and +.An Alexander Motin Aq Mt mav@FreeBSD.org . +.Sh BUGS +NTB-to-Root Port mode is not yet supported, but it doesn't look very useful. +.Pp +On Xeon v2/v3/v4 processors split BAR mode should be enabled to allow +SB01BASE_LOCKUP errata workaround to be applied by the driver. +.Pp +There is no way to protect your system from malicious behavior on the other +system once the link is brought up. +Anyone with root or kernel access on the other system can read or write to +any location on your system. +In other words, only connect two systems that completely trust each other. Added: head/share/man/man4/ntb_transport.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ntb_transport.4 Sun Jul 10 10:17:38 2016 (r302520) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2016 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 10, 2016 +.Dt NTB_TRANSPORT 4 +.Os +.Sh NAME +.Nm ntb_transport +.Nd Packet-oriented transport for Non-Transparent Bridges +.Sh SYNOPSIS +To load the driver as a module at boot, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ntb_transport_load="YES" +.Ed +.Pp +The following tunables are settable from the +.Xr loader 8 : +.Bl -ohang +.It Va hw.ntb_transport.debug_level +Driver debug level. +The default value is 0, higher means more verbose. +.It Va hw.ntb_transport.max_num_clients +Number of bidirectional queues to setup. +The default value is 0, that means one queue per available memory window. +Maximal number is limited by number of doorbells. +.El +.Sh DESCRIPTION +The +.Nm +driver attaches on top of the +.Nm ntb +driver to utilize its resources to create set of bidirectional queues, +delivering packets between the systems. +The primary purpose of this is to be used by +.Nm if_ntb +network interface, but other consumers may also be developed using KPI. +.Sh SEE ALSO +.Xr if_ntb 4 , +.Xr ntb_hw 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was developed by Intel and originally written by +.An Carl Delsey Aq Mt carl@FreeBSD.org . +Later improvements were done by +.An Conrad E. Meyer Aq Mt cem@FreeBSD.org +and +.An Alexander Motin Aq Mt mav@FreeBSD.org . From owner-svn-src-head@freebsd.org Sun Jul 10 10:21:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9E2AB841F1; Sun, 10 Jul 2016 10:21:23 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 869D01A86; Sun, 10 Jul 2016 10:21:23 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AALMia094561; Sun, 10 Jul 2016 10:21:22 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AALM7m094560; Sun, 10 Jul 2016 10:21:22 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607101021.u6AALM7m094560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 10 Jul 2016 10:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302521 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 10:21:23 -0000 Author: jmcneill Date: Sun Jul 10 10:21:22 2016 New Revision: 302521 URL: https://svnweb.freebsd.org/changeset/base/302521 Log: In the absence of a bus-width property, default to 4-bit bus width instead of 1-bit. Modified: head/sys/arm/allwinner/a10_mmc.c Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 10:17:38 2016 (r302520) +++ head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 10:21:22 2016 (r302521) @@ -255,7 +255,7 @@ a10_mmc_attach(device_t dev) a10_mmc_pio_mode ? "disabled" : "enabled"); if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) - bus_width = 1; + bus_width = 4; sc->a10_host.f_min = 400000; sc->a10_host.f_max = 50000000; From owner-svn-src-head@freebsd.org Sun Jul 10 10:38:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F734B84A35; Sun, 10 Jul 2016 10:38:29 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 483251818; Sun, 10 Jul 2016 10:38:29 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AAcSGi001151; Sun, 10 Jul 2016 10:38:28 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AAcS8t001149; Sun, 10 Jul 2016 10:38:28 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607101038.u6AAcS8t001149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 10 Jul 2016 10:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302522 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 10:38:29 -0000 Author: jmcneill Date: Sun Jul 10 10:38:28 2016 New Revision: 302522 URL: https://svnweb.freebsd.org/changeset/base/302522 Log: Align descriptors and data buffers to 32 bits. This restriction is described in the A20 (and later) user manuals. Modified: head/sys/arm/allwinner/a10_mmc.c head/sys/arm/allwinner/a10_mmc.h Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 10:21:22 2016 (r302521) +++ head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 10:38:28 2016 (r302522) @@ -316,7 +316,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc * /* Allocate the DMA descriptor memory. */ dma_desc_size = sizeof(struct a10_mmc_dma_desc) * A10_MMC_DMA_SEGS; - error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0, + error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), + A10_MMC_DMA_ALIGN, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, dma_desc_size, 1, dma_desc_size, 0, NULL, NULL, &sc->a10_dma_tag); if (error) @@ -334,7 +335,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc * return (sc->a10_dma_map_err); /* Create the DMA map for data transfers. */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0, + error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), + A10_MMC_DMA_ALIGN, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, A10_MMC_DMA_MAX_SIZE * A10_MMC_DMA_SEGS, A10_MMC_DMA_SEGS, A10_MMC_DMA_MAX_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL, Modified: head/sys/arm/allwinner/a10_mmc.h ============================================================================== --- head/sys/arm/allwinner/a10_mmc.h Sun Jul 10 10:21:22 2016 (r302521) +++ head/sys/arm/allwinner/a10_mmc.h Sun Jul 10 10:38:28 2016 (r302522) @@ -196,4 +196,7 @@ struct a10_mmc_dma_desc { uint32_t next; }; +/* DMA descriptors and data buffers must be aligned to 32-bits */ +#define A10_MMC_DMA_ALIGN 4 + #endif /* _A10_MMC_H_ */ From owner-svn-src-head@freebsd.org Sun Jul 10 10:53:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3695B84DC0; Sun, 10 Jul 2016 10:53:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2891E94; Sun, 10 Jul 2016 10:53:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AArofK008436; Sun, 10 Jul 2016 10:53:50 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AAroYh008434; Sun, 10 Jul 2016 10:53:50 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607101053.u6AAroYh008434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 10 Jul 2016 10:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302523 - head/sys/dev/extres/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 10:53:52 -0000 Author: jmcneill Date: Sun Jul 10 10:53:50 2016 New Revision: 302523 URL: https://svnweb.freebsd.org/changeset/base/302523 Log: Add clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but operates on a specific OF node instead of the pass in device's OF node. Reviewed by: andrew, mmel Differential Revision: https://reviews.freebsd.org/D6957 Modified: head/sys/dev/extres/clk/clk.c head/sys/dev/extres/clk/clk.h Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Sun Jul 10 10:38:28 2016 (r302522) +++ head/sys/dev/extres/clk/clk.c Sun Jul 10 10:53:50 2016 (r302523) @@ -1198,13 +1198,7 @@ clk_get_by_id(device_t dev, struct clkdo int clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk) { - phandle_t cnode, parent, *cells; - device_t clockdev; - int ncells, rv; - struct clkdom *clkdom; - struct clknode *clknode; - - *clk = NULL; + phandle_t cnode; cnode = ofw_bus_get_node(dev); if (cnode <= 0) { @@ -1213,6 +1207,20 @@ clk_get_by_ofw_index(device_t dev, int i return (ENXIO); } + return (clk_get_by_ofw_node_index(dev, cnode, idx, clk)); +} + +int +clk_get_by_ofw_node_index(device_t dev, phandle_t cnode, int idx, clk_t *clk) +{ + phandle_t parent, *cells; + device_t clockdev; + int ncells, rv; + struct clkdom *clkdom; + struct clknode *clknode; + + *clk = NULL; + rv = ofw_bus_parse_xref_list_alloc(cnode, "clocks", "#clock-cells", idx, &parent, &ncells, &cells); if (rv != 0) { Modified: head/sys/dev/extres/clk/clk.h ============================================================================== --- head/sys/dev/extres/clk/clk.h Sun Jul 10 10:38:28 2016 (r302522) +++ head/sys/dev/extres/clk/clk.h Sun Jul 10 10:53:50 2016 (r302523) @@ -131,6 +131,8 @@ const char *clk_get_name(clk_t clk); #ifdef FDT int clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk); int clk_get_by_ofw_name(device_t dev, const char *name, clk_t *clk); +int clk_get_by_ofw_node_index(device_t dev, phandle_t node, int idx, + clk_t *clk); int clk_parse_ofw_out_names(device_t dev, phandle_t node, const char ***out_names, uint32_t **indices); int clk_parse_ofw_clk_name(device_t dev, phandle_t node, const char **name); From owner-svn-src-head@freebsd.org Sun Jul 10 11:49:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0934B83156; Sun, 10 Jul 2016 11:49:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 930DE1962; Sun, 10 Jul 2016 11:49:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ABnAOA027221; Sun, 10 Jul 2016 11:49:10 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ABnAPl027220; Sun, 10 Jul 2016 11:49:10 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607101149.u6ABnAPl027220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 10 Jul 2016 11:49:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302524 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 11:49:11 -0000 Author: rwatson Date: Sun Jul 10 11:49:10 2016 New Revision: 302524 URL: https://svnweb.freebsd.org/changeset/base/302524 Log: When mmap(2) is used with a vnode, capture vnode attributes in the audit trail. This was not required for Common Criteria auditing (which requires only that the intent to read or write be audited at the time of open(2)), but is useful for contemporary live analysis and forensics. MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sun Jul 10 10:53:50 2016 (r302523) +++ head/sys/vm/vm_mmap.c Sun Jul 10 11:49:10 2016 (r302524) @@ -1245,6 +1245,7 @@ vm_mmap_vnode(struct thread *td, vm_size locktype = LK_SHARED; if ((error = vget(vp, locktype, td)) != 0) return (error); + AUDIT_ARG_VNODE1(vp); foff = *foffp; flags = *flagsp; obj = vp->v_object; From owner-svn-src-head@freebsd.org Sun Jul 10 13:42:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE681B85EF0; Sun, 10 Jul 2016 13:42:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9639E1262; Sun, 10 Jul 2016 13:42:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ADgX7s071789; Sun, 10 Jul 2016 13:42:33 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ADgXSE071786; Sun, 10 Jul 2016 13:42:33 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607101342.u6ADgXSE071786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 10 Jul 2016 13:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302525 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 13:42:34 -0000 Author: rwatson Date: Sun Jul 10 13:42:33 2016 New Revision: 302525 URL: https://svnweb.freebsd.org/changeset/base/302525 Log: Do allow auditing of read(2) and write(2) system calls, by assigning those system calls audit event identifiers AUE_READ and AUE_WRITE. While auditing file-descriptor I/O is not required by the Common Criteria, in practice this proves useful for both live and forensic analysis. NB: freebsd32 already assigns AUE_READ and AUE_WRITE to read(2) and write(2). MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.master head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Sun Jul 10 11:49:10 2016 (r302524) +++ head/sys/kern/init_sysent.c Sun Jul 10 13:42:33 2016 (r302525) @@ -49,8 +49,8 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */ { AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 1 = exit */ { 0, (sy_call_t *)sys_fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = fork */ - { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = read */ - { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */ + { AS(read_args), (sy_call_t *)sys_read, AUE_READ, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = read */ + { AS(write_args), (sy_call_t *)sys_write, AUE_WRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = write */ { AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */ { AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = close */ { AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = wait4 */ Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Sun Jul 10 11:49:10 2016 (r302524) +++ head/sys/kern/syscalls.master Sun Jul 10 13:42:33 2016 (r302525) @@ -62,9 +62,9 @@ 1 AUE_EXIT STD { void sys_exit(int rval); } exit \ sys_exit_args void 2 AUE_FORK STD { int fork(void); } -3 AUE_NULL STD { ssize_t read(int fd, void *buf, \ +3 AUE_READ STD { ssize_t read(int fd, void *buf, \ size_t nbyte); } -4 AUE_NULL STD { ssize_t write(int fd, const void *buf, \ +4 AUE_WRITE STD { ssize_t write(int fd, const void *buf, \ size_t nbyte); } 5 AUE_OPEN_RWTC STD { int open(char *path, int flags, int mode); } ; XXX should be { int open(const char *path, int flags, ...); } Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Sun Jul 10 11:49:10 2016 (r302524) +++ head/sys/sys/sysproto.h Sun Jul 10 13:42:33 2016 (r302525) @@ -2508,8 +2508,8 @@ int freebsd10_pipe(struct thread *, stru #define SYS_AUE_syscall AUE_NULL #define SYS_AUE_exit AUE_EXIT #define SYS_AUE_fork AUE_FORK -#define SYS_AUE_read AUE_NULL -#define SYS_AUE_write AUE_NULL +#define SYS_AUE_read AUE_READ +#define SYS_AUE_write AUE_WRITE #define SYS_AUE_open AUE_OPEN_RWTC #define SYS_AUE_close AUE_CLOSE #define SYS_AUE_wait4 AUE_WAIT4 From owner-svn-src-head@freebsd.org Sun Jul 10 14:17:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76076B83A6C; Sun, 10 Jul 2016 14:17:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45AAF16F6; Sun, 10 Jul 2016 14:17:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AEHaCe083509; Sun, 10 Jul 2016 14:17:36 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AEHaFC083508; Sun, 10 Jul 2016 14:17:36 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607101417.u6AEHaFC083508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 10 Jul 2016 14:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302526 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 14:17:37 -0000 Author: rwatson Date: Sun Jul 10 14:17:36 2016 New Revision: 302526 URL: https://svnweb.freebsd.org/changeset/base/302526 Log: In process-descriptor close(2) and fstat(2), audit target process information. pgkill(2) already audits target process ID. MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/kern/sys_procdesc.c Modified: head/sys/kern/sys_procdesc.c ============================================================================== --- head/sys/kern/sys_procdesc.c Sun Jul 10 13:42:33 2016 (r302525) +++ head/sys/kern/sys_procdesc.c Sun Jul 10 14:17:36 2016 (r302526) @@ -1,10 +1,15 @@ /*- - * Copyright (c) 2009 Robert N. M. Watson + * Copyright (c) 2009, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed at the University of Cambridge Computer * Laboratory with support from a grant from Google, Inc. * + * Portions of this software were developed by BAE Systems, the University of + * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL + * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent + * Computing (TC) research program. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -383,6 +388,7 @@ procdesc_close(struct file *fp, struct t sx_xunlock(&proctree_lock); } else { PROC_LOCK(p); + AUDIT_ARG_PROCESS(p); if (p->p_state == PRS_ZOMBIE) { /* * If the process is already dead and just awaiting @@ -529,6 +535,7 @@ procdesc_stat(struct file *fp, struct st sx_slock(&proctree_lock); if (pd->pd_proc != NULL) { PROC_LOCK(pd->pd_proc); + AUDIT_ARG_PROCESS(pd->pd_proc); /* Set birth and [acm] times to process start time. */ pstart = pd->pd_proc->p_stats->p_start; From owner-svn-src-head@freebsd.org Sun Jul 10 18:28:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83D37B837CF; Sun, 10 Jul 2016 18:28:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FC931513; Sun, 10 Jul 2016 18:28:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AISKOj077151; Sun, 10 Jul 2016 18:28:20 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AISGjl077105; Sun, 10 Jul 2016 18:28:16 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201607101828.u6AISGjl077105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 10 Jul 2016 18:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302528 - in head/sys: arm/allwinner arm/allwinner/clk arm/nvidia arm/nvidia/tegra124 dev/dwc dev/extres/clk dev/extres/hwreset dev/extres/phy dev/extres/regulator dev/iicbus/twsi dev/u... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 18:28:21 -0000 Author: mmel Date: Sun Jul 10 18:28:15 2016 New Revision: 302528 URL: https://svnweb.freebsd.org/changeset/base/302528 Log: EXTRES: Add OF node as argument to all _get_by_ofw_() functions. In some cases, the driver must handle given properties located in specific OF subnode. Instead of creating duplicate set of function, add 'node' as argument to existing functions, defaulting it to device OF node. MFC after: 3 weeks Modified: head/sys/arm/allwinner/a10_ahci.c head/sys/arm/allwinner/a10_codec.c head/sys/arm/allwinner/a10_dmac.c head/sys/arm/allwinner/a10_ehci.c head/sys/arm/allwinner/a10_fb.c head/sys/arm/allwinner/a10_gpio.c head/sys/arm/allwinner/a10_hdmi.c head/sys/arm/allwinner/a10_mmc.c head/sys/arm/allwinner/aw_if_dwc.c head/sys/arm/allwinner/aw_rsb.c head/sys/arm/allwinner/aw_usbphy.c head/sys/arm/allwinner/clk/aw_ahbclk.c head/sys/arm/allwinner/clk/aw_apbclk.c head/sys/arm/allwinner/clk/aw_axiclk.c head/sys/arm/allwinner/clk/aw_codecclk.c head/sys/arm/allwinner/clk/aw_cpuclk.c head/sys/arm/allwinner/clk/aw_cpusclk.c head/sys/arm/allwinner/clk/aw_debeclk.c head/sys/arm/allwinner/clk/aw_gate.c head/sys/arm/allwinner/clk/aw_gmacclk.c head/sys/arm/allwinner/clk/aw_hdmiclk.c head/sys/arm/allwinner/clk/aw_lcdclk.c head/sys/arm/allwinner/clk/aw_mmcclk.c head/sys/arm/allwinner/clk/aw_modclk.c head/sys/arm/allwinner/clk/aw_pll.c head/sys/arm/allwinner/clk/aw_usbclk.c head/sys/arm/allwinner/if_awg.c head/sys/arm/allwinner/if_emac.c head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c head/sys/arm/nvidia/tegra124/tegra124_pmc.c head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c head/sys/arm/nvidia/tegra_ahci.c head/sys/arm/nvidia/tegra_efuse.c head/sys/arm/nvidia/tegra_ehci.c head/sys/arm/nvidia/tegra_i2c.c head/sys/arm/nvidia/tegra_pcie.c head/sys/arm/nvidia/tegra_rtc.c head/sys/arm/nvidia/tegra_sdhci.c head/sys/arm/nvidia/tegra_soctherm.c head/sys/arm/nvidia/tegra_uart.c head/sys/arm/nvidia/tegra_usbphy.c head/sys/dev/dwc/if_dwc.c head/sys/dev/extres/clk/clk.c head/sys/dev/extres/clk/clk.h head/sys/dev/extres/clk/clk_fixed.c head/sys/dev/extres/hwreset/hwreset.c head/sys/dev/extres/hwreset/hwreset.h head/sys/dev/extres/phy/phy.c head/sys/dev/extres/phy/phy.h head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/regulator/regulator.h head/sys/dev/iicbus/twsi/a10_twsi.c head/sys/dev/uart/uart_dev_snps.c head/sys/dev/usb/controller/generic_ohci.c Modified: head/sys/arm/allwinner/a10_ahci.c ============================================================================== --- head/sys/arm/allwinner/a10_ahci.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_ahci.c Sun Jul 10 18:28:15 2016 (r302528) @@ -313,12 +313,12 @@ ahci_a10_attach(device_t dev) return (ENXIO); /* Enable clocks */ - error = clk_get_by_ofw_index(dev, 0, &clk_pll); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_pll); if (error != 0) { device_printf(dev, "Cannot get PLL clock\n"); goto fail; } - error = clk_get_by_ofw_index(dev, 1, &clk_gate); + error = clk_get_by_ofw_index(dev, 0, 1, &clk_gate); if (error != 0) { device_printf(dev, "Cannot get gate clock\n"); goto fail; Modified: head/sys/arm/allwinner/a10_codec.c ============================================================================== --- head/sys/arm/allwinner/a10_codec.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_codec.c Sun Jul 10 18:28:15 2016 (r302528) @@ -786,12 +786,12 @@ a10codec_attach(device_t dev) } /* Get clocks */ - error = clk_get_by_ofw_name(dev, "apb", &clk_apb); + error = clk_get_by_ofw_name(dev, 0, "apb", &clk_apb); if (error != 0) { device_printf(dev, "cannot find apb clock\n"); goto fail; } - error = clk_get_by_ofw_name(dev, "codec", &clk_codec); + error = clk_get_by_ofw_name(dev, 0, "codec", &clk_codec); if (error != 0) { device_printf(dev, "cannot find codec clock\n"); goto fail; Modified: head/sys/arm/allwinner/a10_dmac.c ============================================================================== --- head/sys/arm/allwinner/a10_dmac.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_dmac.c Sun Jul 10 18:28:15 2016 (r302528) @@ -124,7 +124,7 @@ a10dmac_attach(device_t dev) mtx_init(&sc->sc_mtx, "a10 dmac", NULL, MTX_SPIN); /* Activate DMA controller clock */ - error = clk_get_by_ofw_index(dev, 0, &clk); + error = clk_get_by_ofw_index(dev, 0, 0, &clk); if (error != 0) { device_printf(dev, "cannot get clock\n"); return (error); Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_ehci.c Sun Jul 10 18:28:15 2016 (r302528) @@ -208,7 +208,7 @@ a10_ehci_attach(device_t self) sc->sc_flags |= EHCI_SCFLG_DONTRESET; /* De-assert reset */ - if (hwreset_get_by_ofw_idx(self, 0, &aw_sc->rst) == 0) { + if (hwreset_get_by_ofw_idx(self, 0, 0, &aw_sc->rst) == 0) { err = hwreset_deassert(aw_sc->rst); if (err != 0) { device_printf(self, "Could not de-assert reset\n"); @@ -217,7 +217,7 @@ a10_ehci_attach(device_t self) } /* Enable clock for USB */ - err = clk_get_by_ofw_index(self, 0, &aw_sc->clk); + err = clk_get_by_ofw_index(self, 0, 0, &aw_sc->clk); if (err != 0) { device_printf(self, "Could not get clock\n"); goto error; @@ -229,7 +229,7 @@ a10_ehci_attach(device_t self) } /* Enable USB PHY */ - err = phy_get_by_ofw_name(self, "usb", &aw_sc->phy); + err = phy_get_by_ofw_name(self, 0, "usb", &aw_sc->phy); if (err != 0) { device_printf(self, "Could not get phy\n"); goto error; Modified: head/sys/arm/allwinner/a10_fb.c ============================================================================== --- head/sys/arm/allwinner/a10_fb.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_fb.c Sun Jul 10 18:28:15 2016 (r302528) @@ -209,7 +209,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, height = mode->vdisplay << interlace; /* Leave reset */ - error = hwreset_get_by_ofw_name(sc->dev, "de_be", &rst); + error = hwreset_get_by_ofw_name(sc->dev, 0, "de_be", &rst); if (error != 0) { device_printf(sc->dev, "cannot find reset 'de_be'\n"); return (error); @@ -220,7 +220,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Gating AHB clock for BE */ - error = clk_get_by_ofw_name(sc->dev, "ahb_de_be", &clk_ahb); + error = clk_get_by_ofw_name(sc->dev, 0, "ahb_de_be", &clk_ahb); if (error != 0) { device_printf(sc->dev, "cannot find clk 'ahb_de_be'\n"); return (error); @@ -231,7 +231,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Enable DRAM clock to BE */ - error = clk_get_by_ofw_name(sc->dev, "dram_de_be", &clk_dram); + error = clk_get_by_ofw_name(sc->dev, 0, "dram_de_be", &clk_dram); if (error != 0) { device_printf(sc->dev, "cannot find clk 'dram_de_be'\n"); return (error); @@ -242,7 +242,7 @@ a10fb_setup_debe(struct a10fb_softc *sc, return (error); } /* Set BE clock to 300MHz and enable */ - error = clk_get_by_ofw_name(sc->dev, "de_be", &clk_debe); + error = clk_get_by_ofw_name(sc->dev, 0, "de_be", &clk_debe); if (error != 0) { device_printf(sc->dev, "cannot find clk 'de_be'\n"); return (error); @@ -309,12 +309,12 @@ a10fb_setup_pll(struct a10fb_softc *sc, clk_t clk_sclk1, clk_sclk2; int error; - error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk1", &clk_sclk1); + error = clk_get_by_ofw_name(sc->dev, 0, "lcd_ch1_sclk1", &clk_sclk1); if (error != 0) { device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk1'\n"); return (error); } - error = clk_get_by_ofw_name(sc->dev, "lcd_ch1_sclk2", &clk_sclk2); + error = clk_get_by_ofw_name(sc->dev, 0, "lcd_ch1_sclk2", &clk_sclk2); if (error != 0) { device_printf(sc->dev, "cannot find clk 'lcd_ch1_sclk2'\n"); return (error); @@ -360,7 +360,7 @@ a10fb_setup_tcon(struct a10fb_softc *sc, start_delay = START_DELAY(vbl); /* Leave reset */ - error = hwreset_get_by_ofw_name(sc->dev, "lcd", &rst); + error = hwreset_get_by_ofw_name(sc->dev, 0, "lcd", &rst); if (error != 0) { device_printf(sc->dev, "cannot find reset 'lcd'\n"); return (error); @@ -371,7 +371,7 @@ a10fb_setup_tcon(struct a10fb_softc *sc, return (error); } /* Gating AHB clock for LCD */ - error = clk_get_by_ofw_name(sc->dev, "ahb_lcd", &clk_ahb); + error = clk_get_by_ofw_name(sc->dev, 0, "ahb_lcd", &clk_ahb); if (error != 0) { device_printf(sc->dev, "cannot find clk 'ahb_lcd'\n"); return (error); Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_gpio.c Sun Jul 10 18:28:15 2016 (r302528) @@ -619,7 +619,7 @@ a10_gpio_attach(device_t dev) sc->padconf = (struct allwinner_padconf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; - if (hwreset_get_by_ofw_idx(dev, 0, &rst) == 0) { + if (hwreset_get_by_ofw_idx(dev, 0, 0, &rst) == 0) { error = hwreset_deassert(rst); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); @@ -627,7 +627,7 @@ a10_gpio_attach(device_t dev) } } - if (clk_get_by_ofw_index(dev, 0, &clk) == 0) { + if (clk_get_by_ofw_index(dev, 0, 0, &clk) == 0) { error = clk_enable(clk); if (error != 0) { device_printf(dev, "could not enable clock\n"); Modified: head/sys/arm/allwinner/a10_hdmi.c ============================================================================== --- head/sys/arm/allwinner/a10_hdmi.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_hdmi.c Sun Jul 10 18:28:15 2016 (r302528) @@ -293,17 +293,17 @@ a10hdmi_attach(device_t dev) } /* Setup clocks */ - error = clk_get_by_ofw_name(dev, "ahb", &sc->clk_ahb); + error = clk_get_by_ofw_name(dev, 0, "ahb", &sc->clk_ahb); if (error != 0) { device_printf(dev, "cannot find ahb clock\n"); return (error); } - error = clk_get_by_ofw_name(dev, "hdmi", &sc->clk_hdmi); + error = clk_get_by_ofw_name(dev, 0, "hdmi", &sc->clk_hdmi); if (error != 0) { device_printf(dev, "cannot find hdmi clock\n"); return (error); } - error = clk_get_by_ofw_name(dev, "lcd", &sc->clk_lcd); + error = clk_get_by_ofw_name(dev, 0, "lcd", &sc->clk_lcd); if (error != 0) { device_printf(dev, "cannot find lcd clock\n"); } Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/a10_mmc.c Sun Jul 10 18:28:15 2016 (r302528) @@ -198,7 +198,7 @@ a10_mmc_attach(device_t dev) } /* De-assert reset */ - if (hwreset_get_by_ofw_name(dev, "ahb", &sc->a10_rst_ahb) == 0) { + if (hwreset_get_by_ofw_name(dev, 0, "ahb", &sc->a10_rst_ahb) == 0) { error = hwreset_deassert(sc->a10_rst_ahb); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); @@ -207,7 +207,7 @@ a10_mmc_attach(device_t dev) } /* Activate the module clock. */ - error = clk_get_by_ofw_name(dev, "ahb", &sc->a10_clk_ahb); + error = clk_get_by_ofw_name(dev, 0, "ahb", &sc->a10_clk_ahb); if (error != 0) { device_printf(dev, "cannot get ahb clock\n"); goto fail; @@ -217,7 +217,7 @@ a10_mmc_attach(device_t dev) device_printf(dev, "cannot enable ahb clock\n"); goto fail; } - error = clk_get_by_ofw_name(dev, "mmc", &sc->a10_clk_mmc); + error = clk_get_by_ofw_name(dev, 0, "mmc", &sc->a10_clk_mmc); if (error != 0) { device_printf(dev, "cannot get mmc clock\n"); goto fail; Modified: head/sys/arm/allwinner/aw_if_dwc.c ============================================================================== --- head/sys/arm/allwinner/aw_if_dwc.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/aw_if_dwc.c Sun Jul 10 18:28:15 2016 (r302528) @@ -73,7 +73,7 @@ a20_if_dwc_init(device_t dev) /* Configure PHY for MII or RGMII mode */ if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type)) { - error = clk_get_by_ofw_name(dev, "allwinner_gmac_tx", &clk_tx); + error = clk_get_by_ofw_name(dev, 0, "allwinner_gmac_tx", &clk_tx); if (error != 0) { device_printf(dev, "could not get tx clk\n"); return (error); @@ -99,7 +99,7 @@ a20_if_dwc_init(device_t dev) } /* Enable PHY regulator if applicable */ - if (regulator_get_by_ofw_property(dev, "phy-supply", ®) == 0) { + if (regulator_get_by_ofw_property(dev, 0, "phy-supply", ®) == 0) { error = regulator_enable(reg); if (error != 0) { device_printf(dev, "could not enable PHY regulator\n"); Modified: head/sys/arm/allwinner/aw_rsb.c ============================================================================== --- head/sys/arm/allwinner/aw_rsb.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/aw_rsb.c Sun Jul 10 18:28:15 2016 (r302528) @@ -395,14 +395,14 @@ rsb_attach(device_t dev) sc = device_get_softc(dev); mtx_init(&sc->mtx, device_get_nameunit(dev), "rsb", MTX_DEF); - if (clk_get_by_ofw_index(dev, 0, &sc->clk) == 0) { + if (clk_get_by_ofw_index(dev, 0, 0, &sc->clk) == 0) { error = clk_enable(sc->clk); if (error != 0) { device_printf(dev, "cannot enable clock\n"); goto fail; } } - if (hwreset_get_by_ofw_idx(dev, 0, &sc->rst) == 0) { + if (hwreset_get_by_ofw_idx(dev, 0, 0, &sc->rst) == 0) { error = hwreset_deassert(sc->rst); if (error != 0) { device_printf(dev, "cannot de-assert reset\n"); Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/aw_usbphy.c Sun Jul 10 18:28:15 2016 (r302528) @@ -87,7 +87,7 @@ awusbphy_init(device_t dev) node = ofw_bus_get_node(dev); /* Enable clocks */ - for (off = 0; clk_get_by_ofw_index(dev, off, &clk) == 0; off++) { + for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) { error = clk_enable(clk); if (error != 0) { device_printf(dev, "couldn't enable clock %s\n", @@ -97,7 +97,7 @@ awusbphy_init(device_t dev) } /* De-assert resets */ - for (off = 0; hwreset_get_by_ofw_idx(dev, off, &rst) == 0; off++) { + for (off = 0; hwreset_get_by_ofw_idx(dev, 0, off, &rst) == 0; off++) { error = hwreset_deassert(rst); if (error != 0) { device_printf(dev, "couldn't de-assert reset %d\n", @@ -109,7 +109,7 @@ awusbphy_init(device_t dev) /* Get regulators */ for (off = 0; off < USBPHY_NPHYS; off++) { snprintf(pname, sizeof(pname), "usb%d_vbus-supply", off); - if (regulator_get_by_ofw_property(dev, pname, ®) == 0) + if (regulator_get_by_ofw_property(dev, 0, pname, ®) == 0) sc->reg[off] = reg; } Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_ahbclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_ahbclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -315,7 +315,7 @@ aw_ahbclk_attach(device_t dev) def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_apbclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_apbclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_apbclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -248,7 +248,7 @@ aw_apbclk_attach(device_t dev) def.id = 1; def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_axiclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_axiclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_axiclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -135,7 +135,7 @@ aw_axiclk_attach(device_t dev) clkdom = clkdom_create(dev); - error = clk_get_by_ofw_index(dev, 0, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_parent); if (error != 0) { device_printf(dev, "cannot parse clock parent\n"); return (ENXIO); Modified: head/sys/arm/allwinner/clk/aw_codecclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_codecclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_codecclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -120,7 +120,7 @@ aw_codecclk_attach(device_t dev) goto fail; } - error = clk_get_by_ofw_index(dev, 0, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_parent); if (error != 0) { device_printf(dev, "cannot parse clock parent\n"); return (ENXIO); Modified: head/sys/arm/allwinner/clk/aw_cpuclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_cpuclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_cpuclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -95,7 +95,7 @@ aw_cpuclk_attach(device_t dev) def.clkdef.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk); + error = clk_get_by_ofw_index(dev, 0, i, &clk); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_cpusclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_cpusclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_cpusclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -255,7 +255,7 @@ aw_cpusclk_attach(device_t dev) def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_debeclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_debeclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_debeclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -287,7 +287,7 @@ aw_debeclk_attach(device_t dev) def.id = 1; def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_gate.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_gate.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_gate.c Sun Jul 10 18:28:15 2016 (r302528) @@ -168,7 +168,7 @@ aw_gate_attach(device_t dev) goto fail; } - error = clk_get_by_ofw_index(dev, 0, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_parent); if (error != 0) { device_printf(dev, "cannot parse clock parent\n"); return (ENXIO); Modified: head/sys/arm/allwinner/clk/aw_gmacclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_gmacclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_gmacclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -240,7 +240,7 @@ aw_gmacclk_attach(device_t dev) def.id = 1; def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", error); goto fail; Modified: head/sys/arm/allwinner/clk/aw_hdmiclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_hdmiclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_hdmiclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -249,7 +249,7 @@ aw_hdmiclk_attach(device_t dev) clkdom = clkdom_create(dev); - error = clk_get_by_ofw_index(dev, 0, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_parent); if (error != 0) { device_printf(dev, "cannot parse clock parent\n"); return (ENXIO); Modified: head/sys/arm/allwinner/clk/aw_lcdclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_lcdclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_lcdclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -493,7 +493,7 @@ aw_lcdclk_attach(device_t dev) parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_mmcclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_mmcclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_mmcclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -292,7 +292,7 @@ aw_mmcclk_attach(device_t dev) def.id = 0; def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_modclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_modclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_modclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -260,7 +260,7 @@ aw_modclk_attach(device_t dev) def.id = 1; def.parent_names = malloc(sizeof(char *) * ncells, M_OFWPROP, M_WAITOK); for (i = 0; i < ncells; i++) { - error = clk_get_by_ofw_index(dev, i, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, i, &clk_parent); if (error != 0) { device_printf(dev, "cannot get clock %d\n", i); goto fail; Modified: head/sys/arm/allwinner/clk/aw_pll.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_pll.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_pll.c Sun Jul 10 18:28:15 2016 (r302528) @@ -856,7 +856,7 @@ aw_pll_attach(device_t dev) goto fail; } - if (clk_get_by_ofw_index(dev, 0, &clk_parent) != 0) + if (clk_get_by_ofw_index(dev, 0, 0, &clk_parent) != 0) clk_parent = NULL; for (index = 0; index < nout; index++) { Modified: head/sys/arm/allwinner/clk/aw_usbclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_usbclk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/clk/aw_usbclk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -202,13 +202,13 @@ aw_usbclk_attach(device_t dev) else if (indices == NULL && type == AW_H3_USBCLK) indices = aw_usbclk_indices_h3; - error = clk_get_by_ofw_index(dev, 0, &clk_parent); + error = clk_get_by_ofw_index(dev, 0, 0, &clk_parent); if (error != 0) { device_printf(dev, "cannot parse clock parent\n"); return (ENXIO); } if (type == AW_A83T_USBCLK) { - error = clk_get_by_ofw_index(dev, 1, &clk_parent_pll); + error = clk_get_by_ofw_index(dev, 0, 1, &clk_parent_pll); if (error != 0) { device_printf(dev, "cannot parse pll clock parent\n"); return (ENXIO); Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/if_awg.c Sun Jul 10 18:28:15 2016 (r302528) @@ -931,12 +931,12 @@ awg_setup_extres(device_t dev) phy_type = NULL; /* Get AHB clock and reset resources */ - error = hwreset_get_by_ofw_name(dev, "ahb", &rst_ahb); + error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); if (error != 0) { device_printf(dev, "cannot get ahb reset\n"); goto fail; } - error = clk_get_by_ofw_name(dev, "ahb", &clk_ahb); + error = clk_get_by_ofw_name(dev, 0, "ahb", &clk_ahb); if (error != 0) { device_printf(dev, "cannot get ahb clock\n"); goto fail; @@ -954,7 +954,7 @@ awg_setup_extres(device_t dev) OF_prop_free(phy_type); /* Get the TX clock */ - error = clk_get_by_ofw_name(dev, "tx", &clk_tx); + error = clk_get_by_ofw_name(dev, 0, "tx", &clk_tx); if (error != 0) { device_printf(dev, "cannot get tx clock\n"); goto fail; @@ -998,7 +998,7 @@ awg_setup_extres(device_t dev) } /* Enable PHY regulator if applicable */ - if (regulator_get_by_ofw_property(dev, "phy-supply", ®) == 0) { + if (regulator_get_by_ofw_property(dev, 0, "phy-supply", ®) == 0) { error = regulator_enable(reg); if (error != 0) { device_printf(dev, "cannot enable PHY regulator\n"); Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/allwinner/if_emac.c Sun Jul 10 18:28:15 2016 (r302528) @@ -146,7 +146,7 @@ emac_sys_setup(struct emac_softc *sc) int error; /* Activate EMAC clock. */ - error = clk_get_by_ofw_index(sc->emac_dev, 0, &sc->emac_clk); + error = clk_get_by_ofw_index(sc->emac_dev, 0, 0, &sc->emac_clk); if (error != 0) { device_printf(sc->emac_dev, "cannot get clock\n"); return (error); Modified: head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Sun Jul 10 18:28:15 2016 (r302528) @@ -432,36 +432,36 @@ get_fdt_resources(struct tegra124_cpufre device_t parent_dev; parent_dev = device_get_parent(sc->dev); - rv = regulator_get_by_ofw_property(parent_dev, "vdd-cpu-supply", + rv = regulator_get_by_ofw_property(parent_dev, 0, "vdd-cpu-supply", &sc->supply_vdd_cpu); if (rv != 0) { device_printf(sc->dev, "Cannot get 'vdd-cpu' regulator\n"); return (rv); } - rv = clk_get_by_ofw_name(parent_dev, "cpu_g", &sc->clk_cpu_g); + rv = clk_get_by_ofw_name(parent_dev, 0, "cpu_g", &sc->clk_cpu_g); if (rv != 0) { device_printf(sc->dev, "Cannot get 'cpu_g' clock: %d\n", rv); return (ENXIO); } - rv = clk_get_by_ofw_name(parent_dev, "cpu_lp", &sc->clk_cpu_lp); + rv = clk_get_by_ofw_name(parent_dev, 0, "cpu_lp", &sc->clk_cpu_lp); if (rv != 0) { device_printf(sc->dev, "Cannot get 'cpu_lp' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(parent_dev, "pll_x", &sc->clk_pll_x); + rv = clk_get_by_ofw_name(parent_dev, 0, "pll_x", &sc->clk_pll_x); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pll_x' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(parent_dev, "pll_p", &sc->clk_pll_p); + rv = clk_get_by_ofw_name(parent_dev, 0, "pll_p", &sc->clk_pll_p); if (rv != 0) { device_printf(parent_dev, "Cannot get 'pll_p' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(parent_dev, "dfll", &sc->clk_dfll); + rv = clk_get_by_ofw_name(parent_dev, 0, "dfll", &sc->clk_dfll); if (rv != 0) { /* XXX DPLL is not implemented yet */ /* Modified: head/sys/arm/nvidia/tegra124/tegra124_pmc.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_pmc.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra124/tegra124_pmc.c Sun Jul 10 18:28:15 2016 (r302528) @@ -494,7 +494,7 @@ tegra124_pmc_attach(device_t dev) return (rv); } - rv = clk_get_by_ofw_name(sc->dev, "pclk", &sc->clk); + rv = clk_get_by_ofw_name(sc->dev, 0, "pclk", &sc->clk); if (rv != 0) { device_printf(sc->dev, "Cannot get \"pclk\" clock\n"); return (ENXIO); Modified: head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Sun Jul 10 18:28:15 2016 (r302528) @@ -556,7 +556,7 @@ xusbpadctl_attach(device_t dev) } node = ofw_bus_get_node(dev); - rv = hwreset_get_by_ofw_name(dev, "padctl", &sc->rst); + rv = hwreset_get_by_ofw_name(dev, 0, "padctl", &sc->rst); if (rv != 0) { device_printf(dev, "Cannot get 'padctl' reset: %d\n", rv); return (rv); Modified: head/sys/arm/nvidia/tegra_ahci.c ============================================================================== --- head/sys/arm/nvidia/tegra_ahci.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_ahci.c Sun Jul 10 18:28:15 2016 (r302528) @@ -206,77 +206,77 @@ get_fdt_resources(struct tegra_ahci_sc * int rv; - rv = regulator_get_by_ofw_property(sc->dev, "hvdd-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "hvdd-supply", &sc->supply_hvdd ); if (rv != 0) { device_printf(sc->dev, "Cannot get 'hvdd' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "vddio-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "vddio-supply", &sc->supply_vddio); if (rv != 0) { device_printf(sc->dev, "Cannot get 'vddio' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "avdd-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-supply", &sc->supply_avdd); if (rv != 0) { device_printf(sc->dev, "Cannot get 'avdd' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "target-5v-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "target-5v-supply", &sc->supply_target_5v); if (rv != 0) { device_printf(sc->dev, "Cannot get 'target-5v' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "target-12v-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "target-12v-supply", &sc->supply_target_12v); if (rv != 0) { device_printf(sc->dev, "Cannot get 'target-12v' regulator\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "sata", &sc->hwreset_sata ); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata", &sc->hwreset_sata ); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata' reset\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "sata-oob", + rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata-oob", &sc->hwreset_sata_oob); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata oob' reset\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "sata-cold", + rv = hwreset_get_by_ofw_name(sc->dev, 0, "sata-cold", &sc->hwreset_sata_cold); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata cold' reset\n"); return (ENXIO); } - rv = phy_get_by_ofw_name(sc->dev, "sata-phy", &sc->phy); + rv = phy_get_by_ofw_name(sc->dev, 0, "sata-phy", &sc->phy); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata' phy\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "sata", &sc->clk_sata); + rv = clk_get_by_ofw_name(sc->dev, 0, "sata", &sc->clk_sata); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "sata-oob", &sc->clk_sata_oob); + rv = clk_get_by_ofw_name(sc->dev, 0, "sata-oob", &sc->clk_sata_oob); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sata oob' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "cml1", &sc->clk_cml); + rv = clk_get_by_ofw_name(sc->dev, 0, "cml1", &sc->clk_cml); if (rv != 0) { device_printf(sc->dev, "Cannot get 'cml1' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "pll_e", &sc->clk_pll_e); + rv = clk_get_by_ofw_name(sc->dev, 0, "pll_e", &sc->clk_pll_e); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pll_e' clock\n"); return (ENXIO); Modified: head/sys/arm/nvidia/tegra_efuse.c ============================================================================== --- head/sys/arm/nvidia/tegra_efuse.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_efuse.c Sun Jul 10 18:28:15 2016 (r302528) @@ -291,7 +291,7 @@ tegra_efuse_attach(device_t dev) } /* OFW resources. */ - rv = clk_get_by_ofw_name(dev, "fuse", &sc->clk); + rv = clk_get_by_ofw_name(dev, 0, "fuse", &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get fuse clock: %d\n", rv); goto fail; @@ -301,7 +301,7 @@ tegra_efuse_attach(device_t dev) device_printf(dev, "Cannot enable clock: %d\n", rv); goto fail; } - rv = hwreset_get_by_ofw_name(sc->dev, "fuse", &sc->reset); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "fuse", &sc->reset); if (rv != 0) { device_printf(dev, "Cannot get fuse reset\n"); goto fail; Modified: head/sys/arm/nvidia/tegra_ehci.c ============================================================================== --- head/sys/arm/nvidia/tegra_ehci.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_ehci.c Sun Jul 10 18:28:15 2016 (r302528) @@ -174,21 +174,21 @@ tegra_ehci_attach(device_t dev) goto out; } - rv = hwreset_get_by_ofw_name(dev, "usb", &sc->reset); + rv = hwreset_get_by_ofw_name(dev, 0, "usb", &sc->reset); if (rv != 0) { device_printf(dev, "Cannot get reset\n"); rv = ENXIO; goto out; } - rv = phy_get_by_ofw_property(sc->dev, "nvidia,phy", &sc->phy); + rv = phy_get_by_ofw_property(sc->dev, 0, "nvidia,phy", &sc->phy); if (rv != 0) { device_printf(sc->dev, "Cannot get 'nvidia,phy' phy\n"); rv = ENXIO; goto out; } - rv = clk_get_by_ofw_index(sc->dev, 0, &sc->clk); + rv = clk_get_by_ofw_index(sc->dev, 0, 0, &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get clock\n"); goto out; Modified: head/sys/arm/nvidia/tegra_i2c.c ============================================================================== --- head/sys/arm/nvidia/tegra_i2c.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_i2c.c Sun Jul 10 18:28:15 2016 (r302528) @@ -666,12 +666,12 @@ tegra_i2c_attach(device_t dev) } /* FDT resources. */ - rv = clk_get_by_ofw_name(dev, "div-clk", &sc->clk); + rv = clk_get_by_ofw_name(dev, 0, "div-clk", &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get i2c clock: %d\n", rv); goto fail; } - rv = hwreset_get_by_ofw_name(sc->dev, "i2c", &sc->reset); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "i2c", &sc->reset); if (rv != 0) { device_printf(sc->dev, "Cannot get i2c reset\n"); return (ENXIO); Modified: head/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- head/sys/arm/nvidia/tegra_pcie.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_pcie.c Sun Jul 10 18:28:15 2016 (r302528) @@ -1080,49 +1080,49 @@ tegra_pcib_parse_fdt_resources(struct te int rv; /* Power supplies. */ - rv = regulator_get_by_ofw_property(sc->dev, "avddio-pex-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "avddio-pex-supply", &sc->supply_avddio_pex); if (rv != 0) { device_printf(sc->dev, "Cannot get 'avddio-pex' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "dvddio-pex-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "dvddio-pex-supply", &sc->supply_dvddio_pex); if (rv != 0) { device_printf(sc->dev, "Cannot get 'dvddio-pex' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "avdd-pex-pll-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-pex-pll-supply", &sc->supply_avdd_pex_pll); if (rv != 0) { device_printf(sc->dev, "Cannot get 'avdd-pex-pll' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "hvdd-pex-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "hvdd-pex-supply", &sc->supply_hvdd_pex); if (rv != 0) { device_printf(sc->dev, "Cannot get 'hvdd-pex' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "hvdd-pex-pll-e-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "hvdd-pex-pll-e-supply", &sc->supply_hvdd_pex_pll_e); if (rv != 0) { device_printf(sc->dev, "Cannot get 'hvdd-pex-pll-e' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "vddio-pex-ctl-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "vddio-pex-ctl-supply", &sc->supply_vddio_pex_ctl); if (rv != 0) { device_printf(sc->dev, "Cannot get 'vddio-pex-ctl' regulator\n"); return (ENXIO); } - rv = regulator_get_by_ofw_property(sc->dev, "avdd-pll-erefe-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "avdd-pll-erefe-supply", &sc->supply_avdd_pll_erefe); if (rv != 0) { device_printf(sc->dev, @@ -1131,46 +1131,46 @@ tegra_pcib_parse_fdt_resources(struct te } /* Resets. */ - rv = hwreset_get_by_ofw_name(sc->dev, "pex", &sc->hwreset_pex); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "pex", &sc->hwreset_pex); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pex' reset\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "afi", &sc->hwreset_afi); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "afi", &sc->hwreset_afi); if (rv != 0) { device_printf(sc->dev, "Cannot get 'afi' reset\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "pcie_x", &sc->hwreset_pcie_x); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "pcie_x", &sc->hwreset_pcie_x); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pcie_x' reset\n"); return (ENXIO); } /* Clocks. */ - rv = clk_get_by_ofw_name(sc->dev, "pex", &sc->clk_pex); + rv = clk_get_by_ofw_name(sc->dev, 0, "pex", &sc->clk_pex); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pex' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "afi", &sc->clk_afi); + rv = clk_get_by_ofw_name(sc->dev, 0, "afi", &sc->clk_afi); if (rv != 0) { device_printf(sc->dev, "Cannot get 'afi' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "pll_e", &sc->clk_pll_e); + rv = clk_get_by_ofw_name(sc->dev, 0, "pll_e", &sc->clk_pll_e); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pll_e' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "cml", &sc->clk_cml); + rv = clk_get_by_ofw_name(sc->dev, 0, "cml", &sc->clk_cml); if (rv != 0) { device_printf(sc->dev, "Cannot get 'cml' clock\n"); return (ENXIO); } /* Phy. */ - rv = phy_get_by_ofw_name(sc->dev, "pcie", &sc->phy); + rv = phy_get_by_ofw_name(sc->dev, 0, "pcie", &sc->phy); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pcie' phy\n"); return (ENXIO); Modified: head/sys/arm/nvidia/tegra_rtc.c ============================================================================== --- head/sys/arm/nvidia/tegra_rtc.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_rtc.c Sun Jul 10 18:28:15 2016 (r302528) @@ -219,7 +219,7 @@ tegra_rtc_attach(device_t dev) } /* OFW resources. */ - rv = clk_get_by_ofw_index(dev, 0, &sc->clk); + rv = clk_get_by_ofw_index(dev, 0, 0, &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get i2c clock: %d\n", rv); goto fail; Modified: head/sys/arm/nvidia/tegra_sdhci.c ============================================================================== --- head/sys/arm/nvidia/tegra_sdhci.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_sdhci.c Sun Jul 10 18:28:15 2016 (r302528) @@ -289,7 +289,7 @@ tegra_sdhci_attach(device_t dev) goto fail; } - rv = hwreset_get_by_ofw_name(sc->dev, "sdhci", &sc->reset); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "sdhci", &sc->reset); if (rv != 0) { device_printf(sc->dev, "Cannot get 'sdhci' reset\n"); goto fail; @@ -304,14 +304,14 @@ tegra_sdhci_attach(device_t dev) gpio_pin_get_by_ofw_property(sc->dev, node, "power-gpios", &sc->gpio_power); gpio_pin_get_by_ofw_property(sc->dev, node, "wp-gpios", &sc->gpio_wp); - rv = clk_get_by_ofw_index(dev, 0, &sc->clk); + rv = clk_get_by_ofw_index(dev, 0, 0, &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get clock\n"); goto fail; } - rv = clk_get_by_ofw_index(dev, 0, &sc->clk); + rv = clk_get_by_ofw_index(dev, 0, 0, &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get clock\n"); goto fail; Modified: head/sys/arm/nvidia/tegra_soctherm.c ============================================================================== --- head/sys/arm/nvidia/tegra_soctherm.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_soctherm.c Sun Jul 10 18:28:15 2016 (r302528) @@ -579,17 +579,17 @@ soctherm_attach(device_t dev) */ /* OWF resources */ - rv = hwreset_get_by_ofw_name(dev, "soctherm", &sc->reset); + rv = hwreset_get_by_ofw_name(dev, 0, "soctherm", &sc->reset); if (rv != 0) { device_printf(dev, "Cannot get fuse reset\n"); goto fail; } - rv = clk_get_by_ofw_name(dev, "tsensor", &sc->tsensor_clk); + rv = clk_get_by_ofw_name(dev, 0, "tsensor", &sc->tsensor_clk); if (rv != 0) { device_printf(dev, "Cannot get 'tsensor' clock: %d\n", rv); goto fail; } - rv = clk_get_by_ofw_name(dev, "soctherm", &sc->soctherm_clk); + rv = clk_get_by_ofw_name(dev, 0, "soctherm", &sc->soctherm_clk); if (rv != 0) { device_printf(dev, "Cannot get 'soctherm' clock: %d\n", rv); goto fail; Modified: head/sys/arm/nvidia/tegra_uart.c ============================================================================== --- head/sys/arm/nvidia/tegra_uart.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_uart.c Sun Jul 10 18:28:15 2016 (r302528) @@ -189,7 +189,7 @@ tegra_uart_probe(device_t dev) return (ENXIO); sc->ns8250_base.base.sc_class = (struct uart_class *)cd->ocd_data; - rv = hwreset_get_by_ofw_name(dev, "serial", &sc->reset); + rv = hwreset_get_by_ofw_name(dev, 0, "serial", &sc->reset); if (rv != 0) { device_printf(dev, "Cannot get 'serial' reset\n"); return (ENXIO); @@ -202,7 +202,7 @@ tegra_uart_probe(device_t dev) node = ofw_bus_get_node(dev); shift = uart_fdt_get_shift1(node); - rv = clk_get_by_ofw_index(dev, 0, &sc->clk); + rv = clk_get_by_ofw_index(dev, 0, 0, &sc->clk); if (rv != 0) { device_printf(dev, "Cannot get UART clock: %d\n", rv); return (ENXIO); Modified: head/sys/arm/nvidia/tegra_usbphy.c ============================================================================== --- head/sys/arm/nvidia/tegra_usbphy.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/arm/nvidia/tegra_usbphy.c Sun Jul 10 18:28:15 2016 (r302528) @@ -726,28 +726,28 @@ usbphy_attach(device_t dev) node = ofw_bus_get_node(dev); - rv = hwreset_get_by_ofw_name(sc->dev, "usb", &sc->reset_usb); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "usb", &sc->reset_usb); if (rv != 0) { device_printf(dev, "Cannot get 'usb' reset\n"); return (ENXIO); } - rv = hwreset_get_by_ofw_name(sc->dev, "utmi-pads", &sc->reset_pads); + rv = hwreset_get_by_ofw_name(sc->dev, 0, "utmi-pads", &sc->reset_pads); if (rv != 0) { device_printf(dev, "Cannot get 'utmi-pads' reset\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "reg", &sc->clk_reg); + rv = clk_get_by_ofw_name(sc->dev, 0, "reg", &sc->clk_reg); if (rv != 0) { device_printf(sc->dev, "Cannot get 'reg' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "pll_u", &sc->clk_pllu); + rv = clk_get_by_ofw_name(sc->dev, 0, "pll_u", &sc->clk_pllu); if (rv != 0) { device_printf(sc->dev, "Cannot get 'pll_u' clock\n"); return (ENXIO); } - rv = clk_get_by_ofw_name(sc->dev, "utmi-pads", &sc->clk_pads); + rv = clk_get_by_ofw_name(sc->dev, 0, "utmi-pads", &sc->clk_pads); if (rv != 0) { device_printf(sc->dev, "Cannot get 'utmi-pads' clock\n"); return (ENXIO); @@ -788,7 +788,7 @@ usbphy_attach(device_t dev) return rv; if (OF_hasprop(node, "vbus-supply")) { - rv = regulator_get_by_ofw_property(sc->dev, "vbus-supply", + rv = regulator_get_by_ofw_property(sc->dev, 0, "vbus-supply", &sc->supply_vbus); if (rv != 0) { device_printf(sc->dev, Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/dev/dwc/if_dwc.c Sun Jul 10 18:28:15 2016 (r302528) @@ -1097,7 +1097,7 @@ dwc_clock_init(device_t dev) int error; /* Enable clock */ - if (clk_get_by_ofw_name(dev, "stmmaceth", &clk) == 0) { + if (clk_get_by_ofw_name(dev, 0, "stmmaceth", &clk) == 0) { error = clk_enable(clk); if (error != 0) { device_printf(dev, "could not enable main clock\n"); @@ -1106,7 +1106,7 @@ dwc_clock_init(device_t dev) } /* De-assert reset */ - if (hwreset_get_by_ofw_name(dev, "stmmaceth", &rst) == 0) { + if (hwreset_get_by_ofw_name(dev, 0, "stmmaceth", &rst) == 0) { error = hwreset_deassert(rst); if (error != 0) { device_printf(dev, "could not de-assert reset\n"); Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Sun Jul 10 17:16:56 2016 (r302527) +++ head/sys/dev/extres/clk/clk.c Sun Jul 10 18:28:15 2016 (r302528) @@ -1196,22 +1196,7 @@ clk_get_by_id(device_t dev, struct clkdo #ifdef FDT int -clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk) -{ - phandle_t cnode; - - cnode = ofw_bus_get_node(dev); - if (cnode <= 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jul 10 19:15:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10B2BB845CC; Sun, 10 Jul 2016 19:15:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1B061BC5; Sun, 10 Jul 2016 19:15:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AJFT0a095416; Sun, 10 Jul 2016 19:15:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AJFTLg095415; Sun, 10 Jul 2016 19:15:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607101915.u6AJFTLg095415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Jul 2016 19:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302529 - head/sys/dev/ntb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 19:15:31 -0000 Author: mav Date: Sun Jul 10 19:15:29 2016 New Revision: 302529 URL: https://svnweb.freebsd.org/changeset/base/302529 Log: Remove callout_reset(link_work) from ntb_transport_attach(). At that point link is quite likely not established yet, so messing with scratch registers is premature there. Original commit message mentioned code diff reduction from Linux, but this line is not present in Linux now. Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Sun Jul 10 18:28:15 2016 (r302528) +++ head/sys/dev/ntb/ntb_transport.c Sun Jul 10 19:15:29 2016 (r302529) @@ -394,7 +394,6 @@ ntb_transport_attach(device_t dev) nt->link_is_up = false; NTB_LINK_ENABLE(ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); - callout_reset(&nt->link_work, 0, ntb_transport_link_work, nt); if (enable_xeon_watchdog != 0) callout_reset(&nt->link_watchdog, 0, xeon_link_watchdog_hb, nt); From owner-svn-src-head@freebsd.org Sun Jul 10 19:52:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4ACDB85846; Sun, 10 Jul 2016 19:52:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A561E1EA6; Sun, 10 Jul 2016 19:52:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AJqQll009762; Sun, 10 Jul 2016 19:52:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AJqQwS009761; Sun, 10 Jul 2016 19:52:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607101952.u6AJqQwS009761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Jul 2016 19:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302530 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 19:52:27 -0000 Author: mav Date: Sun Jul 10 19:52:26 2016 New Revision: 302530 URL: https://svnweb.freebsd.org/changeset/base/302530 Log: Fix wrong copy/paste in r302510. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 19:15:29 2016 (r302529) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 19:52:26 2016 (r302530) @@ -1833,7 +1833,7 @@ xeon_setup_b2b_mw(struct ntb_softc *ntb, } else { ntb_reg_write(4, xlat_reg, MSI_INTEL_ADDR_BASE); ntb->msix_xlat = ntb_reg_read(4, xlat_reg); - ntb_reg_write(8, lmt_reg, 0); + ntb_reg_write(4, lmt_reg, 0); } ntb->peer_lapic_bar = &ntb->bar_info[bar_num]; From owner-svn-src-head@freebsd.org Sun Jul 10 20:22:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A62C4B85E1E; Sun, 10 Jul 2016 20:22:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7568D1D18; Sun, 10 Jul 2016 20:22:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AKM4b9021320; Sun, 10 Jul 2016 20:22:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AKM4MY021319; Sun, 10 Jul 2016 20:22:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607102022.u6AKM4MY021319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 10 Jul 2016 20:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302531 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 20:22:05 -0000 Author: mav Date: Sun Jul 10 20:22:04 2016 New Revision: 302531 URL: https://svnweb.freebsd.org/changeset/base/302531 Log: Revert odd change, setting limit registers before base. I don't know what errata is mentioned there, I was unable to find it, but setting limit before the base simply does not work at all. According to specification attempt to set limit out of the present window range resets it to zero, effectively disabling it. And that is what I see in practice. Fixing this properly disables access for remote side to our memory until respective xlat is negotiated and set. As I see, Linux does the same. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 19:52:26 2016 (r302530) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Sun Jul 10 20:22:04 2016 (r302531) @@ -1699,26 +1699,22 @@ xeon_set_sbar_base_and_limit(struct ntb_ bar_addr = 0; } - /* - * Set limit registers first to avoid an errata where setting the base - * registers locks the limit registers. - */ if (!bar_is_64bit(ntb, idx)) { - ntb_reg_write(4, lmt_reg, bar_addr); - reg_val = ntb_reg_read(4, lmt_reg); - (void)reg_val; - ntb_reg_write(4, base_reg, bar_addr); reg_val = ntb_reg_read(4, base_reg); (void)reg_val; - } else { - ntb_reg_write(8, lmt_reg, bar_addr); - reg_val = ntb_reg_read(8, lmt_reg); - (void)reg_val; + ntb_reg_write(4, lmt_reg, bar_addr); + reg_val = ntb_reg_read(4, lmt_reg); + (void)reg_val; + } else { ntb_reg_write(8, base_reg, bar_addr); reg_val = ntb_reg_read(8, base_reg); (void)reg_val; + + ntb_reg_write(8, lmt_reg, bar_addr); + reg_val = ntb_reg_read(8, lmt_reg); + (void)reg_val; } } From owner-svn-src-head@freebsd.org Sun Jul 10 20:32:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02F8AB83204; Sun, 10 Jul 2016 20:32:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B72A5148D; Sun, 10 Jul 2016 20:32:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id i123so28615994pfg.0; Sun, 10 Jul 2016 13:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=8jKwzclVht1qU3kIIqrKqOxkFvdjIa1nZyWvNICfTQk=; b=fW++F5BgLGN3XiPiRcdL8H5Uls3YFQQHCa12Iz4hPVR06DnHDFTXwhViWkUGlbDgXe WIdsJ6bo/Ri/aSBikBGO4z7oU1Fc2nYAh15SNg0BxDr09uiF2521CRK6q6PThPwhjaeU mD3+wPwx1Y6fqVARY2Udkq6NYQsaNGAT8T+KwzpR6ZEHB5bL2/soBxw0cpNdbnAcLq+F QSEQdY2XW5TInARYO+FQIARlyQXTJKaOa8OP9mFbAoUqMosNGooDqH4Lj+QW8x8CiCVz QHf3AhT6I7CY/sqLY+s3+J5EyWx7XQnQRYU6M8cMOAwoUonDWZzY09AUFqJLptL95WRn d/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=8jKwzclVht1qU3kIIqrKqOxkFvdjIa1nZyWvNICfTQk=; b=kIPYEwyPuhjLZQ0F7V0JEUm9lkiB9xpy4eatzVHeBT2a54v731YPbvTgWS9a35NrVb 7YyGmby6htljpD94To2DPQ6LGlOkpcb5Q8svQqxm3BF+q+vSCpb765rkv8D6wG56m98L euR87n2A1G4b7au34z2QE8cCYnh4NUZka4Mq+kedBZUvwpg23x7Mt5nkZdjQywF1nKsV 5xP4mrSkEfSDxHthao6eGTH7jSD4cWI9Seq0K7PlDBoYcgK5FKjZtDVzvwsbeE6mxQme qDT9NZVT4XeO7cUmyXGk37BD3ZMyATwifFhkLQE7eYM/eIQJxsppc0F71TbEWdXsVt6w AGrw== X-Gm-Message-State: ALyK8tJxq/pMMo763RgWQGih7EVvfwqFExeSfQ4eV+u9+4JT9JdkoFFptM7/FcgI2+0x3w== X-Received: by 10.98.52.3 with SMTP id b3mr29018714pfa.40.1468182769290; Sun, 10 Jul 2016 13:32:49 -0700 (PDT) Received: from [192.168.20.9] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id s12sm3801041pfj.57.2016.07.10.13.32.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Jul 2016 13:32:48 -0700 (PDT) Subject: Re: svn commit: r298840 - in head: . lib/libkvm Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_3F04749F-3A56-4BCF-8864-8883B0B87AA8"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <868tx9x5c0.wl-herbert@mailbox.org> Date: Sun, 10 Jul 2016 13:32:45 -0700 Cc: Garrett Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <1E4C9BE2-552F-4EB3-A24E-F8C8D4614AA1@gmail.com> References: <201604300921.u3U9LExR053840@repo.freebsd.org> <868tx9x5c0.wl-herbert@mailbox.org> To: "Herbert J. Skuhra" X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 20:32:51 -0000 --Apple-Mail=_3F04749F-3A56-4BCF-8864-8883B0B87AA8 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Jul 10, 2016, at 01:30, Herbert J. Skuhra wrote: > > Garrett Cooper skrev: >> >> Author: ngie >> Date: Sat Apr 30 09:21:13 2016 >> New Revision: 298840 >> URL: https://svnweb.freebsd.org/changeset/base/298840 >> >> Log: >> Remove kvm_getfiles(3) >> >> This libcall has been broken since (at least) r174989/8.0-RELEASE. >> >> Bump SHLIB_MAJOR for the change >> >> Differential Revision: https://reviews.freebsd.org/D6052 >> Relnotes: yes >> Reviewed by: jhb, markj >> Sponsored by: EMC / Isilon Storage Division Yes, it should be :/. --Apple-Mail=_3F04749F-3A56-4BCF-8864-8883B0B87AA8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXgrDtAAoJEPWDqSZpMIYVtkUP/3QUs3IJf4G6IIlOYLvZPcKs Wl61ZsG3ZltaXSxBNKJya664g7JqOTkMqnbVPzgs3ExaBnhDpQZY0ZR67W+yDqrv rypeyeK8/zbHOE/ZboHx48hKbcEOrxK7+iMmvnUF8xrVwSWiSZa/b0cMB/xEdvSZ hfg7KsS8WoMWUbcSI9/jUcPwDi2WtJh+SwBgpN636BMN+Ke7cnOt3xiOxH/lKWWm tvVEwWJUaulmnX1ua6T/Vw9BCYK10jeURvixiJPeVZue+ufMqdQxRrU0dwSTZtzy rL1pXV0iLaDicz91PxaTZsix9J0AlKWd264T6Gm6hsK7UOJNAu5tHlVrXX3ZtIUA VcKtaW3K8xPR5VPBzXe8fJmMqqQ94uPJee0a6dZkyespmIEwsPyqVXCaHKUIClhP xElgme1RKNYtPb6FL2DzNa/X1FPQ+PCiSyZHQkanTVs8sgrpCnWXDdMADYVOPsuu B8xpZuH0Q0S0eqIelaljYFOKQO3Gryb0UPT5FSqAREoi4LfJsNpTQkZVpHPB65Ic 8aLNYMAKZi2WpDwooxKEOwiZwZyAiRrWTGpkY7dAgqR6ReiCWKGrMxuaDaZoeNXh qC2d8QxnMV8nswtpYy+hqd3sKyy3pnIM9pFnFK7X4IC3NTtVyftcU93Jn/0ffDjC PgMvdJfkyhHR3vYZASzs =AHlx -----END PGP SIGNATURE----- --Apple-Mail=_3F04749F-3A56-4BCF-8864-8883B0B87AA8-- From owner-svn-src-head@freebsd.org Sun Jul 10 20:42:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1845B83491; Sun, 10 Jul 2016 20:42:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F5E61A45; Sun, 10 Jul 2016 20:42:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AKgIsK028503; Sun, 10 Jul 2016 20:42:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AKgIPP028502; Sun, 10 Jul 2016 20:42:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607102042.u6AKgIPP028502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 10 Jul 2016 20:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302532 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 20:42:20 -0000 Author: ngie Date: Sun Jul 10 20:42:18 2016 New Revision: 302532 URL: https://svnweb.freebsd.org/changeset/base/302532 Log: Correct OLD_LIBS change done in r298840 libkvm.so lives in /lib, not /usr/lib MFC after: 3 days X-MFC note: ^/stable/11 only X-MFC with: r298840 Submitted by: Herbert J. Skuhra Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Jul 10 20:22:04 2016 (r302531) +++ head/ObsoleteFiles.inc Sun Jul 10 20:42:18 2016 (r302532) @@ -203,7 +203,7 @@ OLD_FILES+=usr/share/man/man9/rman_await # 20160517: ReiserFS removed OLD_FILES+=usr/share/man/man5/reiserfs.5.gz # 20160430: kvm_getfiles(3) removed from kvm(3) -OLD_LIBS+=usr/lib/libkvm.so.6 +OLD_LIBS+=lib/libkvm.so.6 OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz # 20160423: remove mroute6d OLD_FILES+=etc/rc.d/mroute6d From owner-svn-src-head@freebsd.org Mon Jul 11 00:03:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8532B83DBC; Mon, 11 Jul 2016 00:03:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 994D01D97; Mon, 11 Jul 2016 00:03:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B03dHJ002701; Mon, 11 Jul 2016 00:03:39 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B03dFb002700; Mon, 11 Jul 2016 00:03:39 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607110003.u6B03dFb002700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 11 Jul 2016 00:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302533 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 00:03:40 -0000 Author: pfg Date: Mon Jul 11 00:03:39 2016 New Revision: 302533 URL: https://svnweb.freebsd.org/changeset/base/302533 Log: mail(1): Fix a comment. Obtained from: NetBSD (CVS Rev 1.29) Modified: head/usr.bin/mail/collect.c Modified: head/usr.bin/mail/collect.c ============================================================================== --- head/usr.bin/mail/collect.c Sun Jul 10 20:42:18 2016 (r302532) +++ head/usr.bin/mail/collect.c Mon Jul 11 00:03:39 2016 (r302533) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" /* - * Read a message from standard output and return a read file to it + * Read a message from standard input and return a read file to it * or NULL on error. */ From owner-svn-src-head@freebsd.org Mon Jul 11 03:31:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC401B90473; Mon, 11 Jul 2016 03:31:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CCB91C38; Mon, 11 Jul 2016 03:31:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B3VC2u078004; Mon, 11 Jul 2016 03:31:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B3VC9R078003; Mon, 11 Jul 2016 03:31:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201607110331.u6B3VC9R078003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 11 Jul 2016 03:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302534 - head/usr.sbin/freebsd-update X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 03:31:13 -0000 Author: delphij Date: Mon Jul 11 03:31:12 2016 New Revision: 302534 URL: https://svnweb.freebsd.org/changeset/base/302534 Log: Allow - in distribution names. This is needed for freebsd-update to work with 11.0+, where the debugging symbols use a new naming scheme for release distribution files. Errata candidate. Approved by: cperciva Differential Revision: https://reviews.freebsd.org/D7170 Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 00:03:39 2016 (r302533) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 03:31:12 2016 (r302534) @@ -1250,7 +1250,7 @@ fetch_metadata_sanity () { # Check that the first four fields make sense. if gunzip -c < files/$1.gz | - grep -qvE "^[a-z]+\|[0-9a-z]+\|${P}+\|[fdL-]\|"; then + grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then fetch_metadata_bogus "" return 1 fi From owner-svn-src-head@freebsd.org Mon Jul 11 03:34:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7D36B90547; Mon, 11 Jul 2016 03:34:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5E61F73; Mon, 11 Jul 2016 03:34:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B3YWKA081082; Mon, 11 Jul 2016 03:34:32 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B3YWrH081081; Mon, 11 Jul 2016 03:34:32 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201607110334.u6B3YWrH081081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 11 Jul 2016 03:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302535 - head/usr.sbin/ypldap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 03:34:33 -0000 Author: araujo Date: Mon Jul 11 03:34:32 2016 New Revision: 302535 URL: https://svnweb.freebsd.org/changeset/base/302535 Log: Do not allow whitespace in macro names. Obtained from: OpenBSD (r1.19). Modified: head/usr.sbin/ypldap/parse.y Modified: head/usr.sbin/ypldap/parse.y ============================================================================== --- head/usr.sbin/ypldap/parse.y Mon Jul 11 03:31:12 2016 (r302534) +++ head/usr.sbin/ypldap/parse.y Mon Jul 11 03:34:32 2016 (r302535) @@ -144,6 +144,14 @@ include : INCLUDE STRING { ; varset : STRING '=' STRING { + char *s = $1; + while (*s++) { + if (isspace((unsigned char) *s)) { + yyerror("macro name cannot contain " + "whitespace"); + YYERROR; + } + } if (symset($1, $3, 0) == -1) fatal("cannot store variable"); free($1); From owner-svn-src-head@freebsd.org Mon Jul 11 04:52:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ABB5B916E9; Mon, 11 Jul 2016 04:52:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63CD31622; Mon, 11 Jul 2016 04:52:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B4qClp011109; Mon, 11 Jul 2016 04:52:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B4qBRc011099; Mon, 11 Jul 2016 04:52:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110452.u6B4qBRc011099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 04:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302540 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 04:52:13 -0000 Author: sephe Date: Mon Jul 11 04:52:11 2016 New Revision: 302540 URL: https://svnweb.freebsd.org/changeset/base/302540 Log: hyperv/vmbus: Implement a new set of APIs for post message Hypercall And use this new APIs for Initial Contact post message Hypercall. More post message Hypercalls will be converted. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6830 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/hyperv_reg.h head/sys/dev/hyperv/vmbus/hyperv_var.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 04:52:11 2016 (r302540) @@ -77,10 +77,6 @@ typedef uint8_t hv_bool_uint8_t; #define HV_VMBUS_VERSION_WIN8 ((2 << 16) | (4)) #define HV_VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) -#define HV_VMBUS_VERSION_INVALID -1 - -#define HV_VMBUS_VERSION_CURRENT HV_VMBUS_VERSION_WIN8_1 - /* * Make maximum size of pipe payload of 16K */ @@ -537,20 +533,6 @@ typedef struct { uint32_t child_rel_id; } __packed hv_vmbus_channel_relid_released; -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t vmbus_version_requested; - uint32_t padding2; - uint64_t interrupt_page; - uint64_t monitor_page_1; - uint64_t monitor_page_2; -} __packed hv_vmbus_channel_initiate_contact; - -typedef struct { - hv_vmbus_channel_msg_header header; - hv_bool_uint8_t version_supported; -} __packed hv_vmbus_channel_version_response; - typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload; #define HW_MACADDR_LEN 6 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 04:52:11 2016 (r302540) @@ -40,29 +40,30 @@ * Internal functions */ -typedef void (*vmbus_msg_handler)(const hv_vmbus_channel_msg_header *msg); - typedef struct hv_vmbus_channel_msg_table_entry { hv_vmbus_channel_msg_type messageType; - vmbus_msg_handler messageHandler; + void (*messageHandler) + (struct vmbus_softc *sc, + const struct vmbus_message *msg); } hv_vmbus_channel_msg_table_entry; static void vmbus_channel_on_offer_internal(void *context); static void vmbus_channel_on_offer_rescind_internal(void *context); -static void vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_open_result( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_offer_rescind( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_gpadl_created( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_gpadl_torndown( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_offers_delivered( - const hv_vmbus_channel_msg_header *hdr); -static void vmbus_channel_on_version_response( - const hv_vmbus_channel_msg_header *hdr); +static void vmbus_channel_on_offer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_open_result(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_gpadl_created(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_channel_on_version_response(struct vmbus_softc *, + const struct vmbus_message *); /** * Channel message dispatch table @@ -398,8 +399,11 @@ vmbus_channel_select_defcpu(struct hv_vm * object to process the offer synchronously */ static void -vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_offer_channel *offer; hv_vmbus_channel_offer_channel *copied; @@ -476,8 +480,12 @@ vmbus_channel_on_offer_internal(void* co * synchronously */ static void -vmbus_channel_on_offer_rescind(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_rescind_offer *rescind; hv_vmbus_channel* channel; @@ -508,8 +516,8 @@ vmbus_channel_on_offer_rescind_internal( * @brief Invoked when all offers have been delivered. */ static void -vmbus_channel_on_offers_delivered( - const hv_vmbus_channel_msg_header *hdr __unused) +vmbus_channel_on_offers_delivered(struct vmbus_softc *sc __unused, + const struct vmbus_message *msg __unused) { mtx_lock(&vmbus_chwait_lock); @@ -526,8 +534,12 @@ vmbus_channel_on_offers_delivered( * response and signal the requesting thread. */ static void -vmbus_channel_on_open_result(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_open_result(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_open_result *result; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; @@ -568,8 +580,12 @@ vmbus_channel_on_open_result(const hv_vm * response and signal the requesting thread. */ static void -vmbus_channel_on_gpadl_created(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_gpadl_created *gpadl_created; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* request_header; @@ -610,8 +626,12 @@ vmbus_channel_on_gpadl_created(const hv_ * response and signal the requesting thread */ static void -vmbus_channel_on_gpadl_torndown(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const hv_vmbus_channel_msg_header *hdr = + (const hv_vmbus_channel_msg_header *)msg->msg_data; + const hv_vmbus_channel_gpadl_torndown *gpadl_torndown; hv_vmbus_channel_msg_info* msg_info; hv_vmbus_channel_msg_header* requestHeader; @@ -647,39 +667,11 @@ vmbus_channel_on_gpadl_torndown(const hv mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); } -/** - * @brief Version response handler. - * - * This is invoked when we received a response - * to our initiate contact request. Find the matching request, copy th - * response and signal the requesting thread. - */ static void -vmbus_channel_on_version_response(const hv_vmbus_channel_msg_header *hdr) +vmbus_channel_on_version_response(struct vmbus_softc *sc, + const struct vmbus_message *msg) { - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_initiate_contact* initiate; - const hv_vmbus_channel_version_response *versionResponse; - - versionResponse = (const hv_vmbus_channel_version_response *)hdr; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; - if (requestHeader->message_type - == HV_CHANNEL_MESSAGE_INITIATED_CONTACT) { - initiate = - (hv_vmbus_channel_initiate_contact*) requestHeader; - memcpy(&msg_info->response.version_response, - versionResponse, - sizeof(hv_vmbus_channel_version_response)); - sema_post(&msg_info->wait_sema); - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - + vmbus_msghc_wakeup(sc, msg); } /** @@ -865,5 +857,5 @@ vmbus_chan_msgproc(struct vmbus_softc *s entry = &g_channel_message_table[msg_type]; if (entry->messageHandler) - entry->messageHandler(hdr); + entry->messageHandler(sc, msg); } Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 04:52:11 2016 (r302540) @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -49,97 +50,7 @@ hv_vmbus_connection hv_vmbus_g_connectio { .connect_state = HV_DISCONNECTED, .next_gpadl_handle = 0xE1E10, }; -uint32_t hv_vmbus_protocal_version = HV_VMBUS_VERSION_WS2008; - -static uint32_t -hv_vmbus_get_next_version(uint32_t current_ver) -{ - switch (current_ver) { - case (HV_VMBUS_VERSION_WIN7): - return(HV_VMBUS_VERSION_WS2008); - - case (HV_VMBUS_VERSION_WIN8): - return(HV_VMBUS_VERSION_WIN7); - - case (HV_VMBUS_VERSION_WIN8_1): - return(HV_VMBUS_VERSION_WIN8); - - case (HV_VMBUS_VERSION_WS2008): - default: - return(HV_VMBUS_VERSION_INVALID); - } -} - -/** - * Negotiate the highest supported hypervisor version. - */ -static int -hv_vmbus_negotiate_version(struct vmbus_softc *sc, - hv_vmbus_channel_msg_info *msg_info, uint32_t version) -{ - int ret = 0; - hv_vmbus_channel_initiate_contact *msg; - - sema_init(&msg_info->wait_sema, 0, "Msg Info Sema"); - msg = (hv_vmbus_channel_initiate_contact*) msg_info->msg; - - msg->header.message_type = HV_CHANNEL_MESSAGE_INITIATED_CONTACT; - msg->vmbus_version_requested = version; - - msg->interrupt_page = sc->vmbus_evtflags_dma.hv_paddr; - msg->monitor_page_1 = sc->vmbus_mnf1_dma.hv_paddr; - msg->monitor_page_2 = sc->vmbus_mnf2_dma.hv_paddr; - - /** - * Add to list before we send the request since we may receive the - * response before returning from this routine - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message( - msg, - sizeof(hv_vmbus_channel_initiate_contact)); - - if (ret != 0) { - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - return (ret); - } - - /** - * Wait for the connection response - */ - ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds */ - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - /** - * Check if successful - */ - if (msg_info->response.version_response.version_supported) { - hv_vmbus_g_connection.connect_state = HV_CONNECTED; - } else { - ret = ECONNREFUSED; - } - - return (ret); -} +uint32_t hv_vmbus_protocal_version; /** * Send a connect request on the partition service connection @@ -147,10 +58,6 @@ hv_vmbus_negotiate_version(struct vmbus_ int hv_vmbus_connect(struct vmbus_softc *sc) { - int ret = 0; - uint32_t version; - hv_vmbus_channel_msg_info* msg_info = NULL; - /** * Make sure we are not connecting or connected */ @@ -171,60 +78,12 @@ hv_vmbus_connect(struct vmbus_softc *sc) mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", NULL, MTX_DEF); - msg_info = (hv_vmbus_channel_msg_info*) - malloc(sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_initiate_contact), - M_DEVBUF, M_WAITOK | M_ZERO); - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); - /* - * Find the highest vmbus version number we can support. - */ - version = HV_VMBUS_VERSION_CURRENT; - - do { - ret = hv_vmbus_negotiate_version(sc, msg_info, version); - if (ret == EWOULDBLOCK) { - /* - * We timed out. - */ - goto cleanup; - } - - if (hv_vmbus_g_connection.connect_state == HV_CONNECTED) - break; - - version = hv_vmbus_get_next_version(version); - } while (version != HV_VMBUS_VERSION_INVALID); - - hv_vmbus_protocal_version = version; - if (bootverbose) - printf("VMBUS: Protocol Version: %d.%d\n", - version >> 16, version & 0xFFFF); - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); + hv_vmbus_g_connection.connect_state = HV_CONNECTED; return (0); - - /* - * Cleanup after failure! - */ - cleanup: - - hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - - mtx_destroy(&hv_vmbus_g_connection.channel_lock); - mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); - - if (msg_info) { - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); - } - - free(hv_vmbus_g_connection.channels, M_DEVBUF); - return (ret); } /** @@ -330,7 +189,7 @@ int hv_vmbus_post_message(void *buffer, */ for (retries = 0; retries < 20; retries++) { ret = hv_vmbus_post_msg_via_msg_ipc(connId, - VMBUS_MSGTYPE_CHANNEL, buffer, bufferLen); + HYPERV_MSGTYPE_CHANNEL, buffer, bufferLen); if (ret == HV_STATUS_SUCCESS) return (0); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 04:52:11 2016 (r302540) @@ -95,7 +95,6 @@ typedef union { hv_vmbus_channel_open_result open_result; hv_vmbus_channel_gpadl_torndown gpadl_torndown; hv_vmbus_channel_gpadl_created gpadl_created; - hv_vmbus_channel_version_response version_response; } hv_vmbus_channel_msg_response; /* Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hyperv.c Mon Jul 11 04:52:11 2016 (r302540) @@ -118,6 +118,13 @@ hv_vmbus_do_hypercall(uint64_t value, vo in_paddr, out_paddr); } +uint64_t +hypercall_post_message(bus_addr_t msg_paddr) +{ + return hypercall_md(hypercall_context.hc_addr, + HYPERCALL_POST_MESSAGE, msg_paddr, 0); +} + /** * @brief Post a message using the hypervisor message IPC. * (This involves a hypercall.) Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Mon Jul 11 04:52:11 2016 (r302540) @@ -29,6 +29,8 @@ #ifndef _HYPERV_REG_H_ #define _HYPERV_REG_H_ +#include + /* * Hyper-V Synthetic MSRs */ @@ -130,4 +132,41 @@ #define CPUID_LEAF_HV_LIMITS 0x40000005 #define CPUID_LEAF_HV_HWFEATURES 0x40000006 +/* + * Hyper-V message types + */ +#define HYPERV_MSGTYPE_NONE 0 +#define HYPERV_MSGTYPE_CHANNEL 1 +#define HYPERV_MSGTYPE_TIMER_EXPIRED 0x80000010 + +/* + * Hypercall status codes + */ +#define HYPERCALL_STATUS_SUCCESS 0x0000 + +/* + * Hypercall input values + */ +#define HYPERCALL_POST_MESSAGE 0x005c + +/* + * Hypercall input parameters + */ + +/* + * HYPERCALL_POST_MESSAGE + */ +#define HYPERCALL_POSTMSGIN_DSIZE_MAX 240 +#define HYPERCALL_POSTMSGIN_SIZE 256 +#define HYPERCALL_POSTMSGIN_ALIGN 8 + +struct hypercall_postmsg_in { + uint32_t hc_connid; + uint32_t hc_rsvd; + uint32_t hc_msgtype; /* HYPERV_MSGTYPE_ */ + uint32_t hc_dsize; + uint8_t hc_data[HYPERCALL_POSTMSGIN_DSIZE_MAX]; +} __packed; +CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE); + #endif /* !_HYPERV_REG_H_ */ Modified: head/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_var.h Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/hyperv_var.h Mon Jul 11 04:52:11 2016 (r302540) @@ -38,4 +38,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; +uint64_t hypercall_post_message(bus_addr_t msg_paddr); + #endif /* !_HYPERV_VAR_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 04:52:11 2016 (r302540) @@ -69,10 +69,354 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +/* + * NOTE: DO NOT CHANGE THESE + */ +#define VMBUS_CONNID_MESSAGE 1 +#define VMBUS_CONNID_EVENT 2 + +struct vmbus_msghc { + struct hypercall_postmsg_in *mh_inprm; + struct hypercall_postmsg_in mh_inprm_save; + struct hyperv_dma mh_inprm_dma; + + struct vmbus_message *mh_resp; + struct vmbus_message mh_resp0; +}; + +struct vmbus_msghc_ctx { + struct vmbus_msghc *mhc_free; + struct mtx mhc_free_lock; + uint32_t mhc_flags; + + struct vmbus_msghc *mhc_active; + struct mtx mhc_active_lock; +}; + +#define VMBUS_MSGHC_CTXF_DESTROY 0x0001 + +static int vmbus_init(struct vmbus_softc *); +static int vmbus_init_contact(struct vmbus_softc *, + uint32_t); + +static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); +static void vmbus_msghc_ctx_destroy( + struct vmbus_msghc_ctx *); +static void vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *); +static struct vmbus_msghc *vmbus_msghc_alloc(bus_dma_tag_t); +static void vmbus_msghc_free(struct vmbus_msghc *); +static struct vmbus_msghc *vmbus_msghc_get1(struct vmbus_msghc_ctx *, + uint32_t); + struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); +static const uint32_t vmbus_version[] = { + HV_VMBUS_VERSION_WIN8_1, + HV_VMBUS_VERSION_WIN8, + HV_VMBUS_VERSION_WIN7, + HV_VMBUS_VERSION_WS2008 +}; + +static struct vmbus_msghc * +vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) +{ + struct vmbus_msghc *mh; + + mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO); + + mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag, + HYPERCALL_POSTMSGIN_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, + &mh->mh_inprm_dma, BUS_DMA_WAITOK); + if (mh->mh_inprm == NULL) { + free(mh, M_DEVBUF); + return NULL; + } + return mh; +} + +static void +vmbus_msghc_free(struct vmbus_msghc *mh) +{ + hyperv_dmamem_free(&mh->mh_inprm_dma, mh->mh_inprm); + free(mh, M_DEVBUF); +} + +static void +vmbus_msghc_ctx_free(struct vmbus_msghc_ctx *mhc) +{ + KASSERT(mhc->mhc_active == NULL, ("still have active msg hypercall")); + KASSERT(mhc->mhc_free == NULL, ("still have hypercall msg")); + + mtx_destroy(&mhc->mhc_free_lock); + mtx_destroy(&mhc->mhc_active_lock); + free(mhc, M_DEVBUF); +} + +static struct vmbus_msghc_ctx * +vmbus_msghc_ctx_create(bus_dma_tag_t parent_dtag) +{ + struct vmbus_msghc_ctx *mhc; + + mhc = malloc(sizeof(*mhc), M_DEVBUF, M_WAITOK | M_ZERO); + mtx_init(&mhc->mhc_free_lock, "vmbus msghc free", NULL, MTX_DEF); + mtx_init(&mhc->mhc_active_lock, "vmbus msghc act", NULL, MTX_DEF); + + mhc->mhc_free = vmbus_msghc_alloc(parent_dtag); + if (mhc->mhc_free == NULL) { + vmbus_msghc_ctx_free(mhc); + return NULL; + } + return mhc; +} + +static struct vmbus_msghc * +vmbus_msghc_get1(struct vmbus_msghc_ctx *mhc, uint32_t dtor_flag) +{ + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_free_lock); + + while ((mhc->mhc_flags & dtor_flag) == 0 && mhc->mhc_free == NULL) { + mtx_sleep(&mhc->mhc_free, &mhc->mhc_free_lock, 0, + "gmsghc", 0); + } + if (mhc->mhc_flags & dtor_flag) { + /* Being destroyed */ + mh = NULL; + } else { + mh = mhc->mhc_free; + KASSERT(mh != NULL, ("no free hypercall msg")); + KASSERT(mh->mh_resp == NULL, + ("hypercall msg has pending response")); + mhc->mhc_free = NULL; + } + + mtx_unlock(&mhc->mhc_free_lock); + + return mh; +} + +struct vmbus_msghc * +vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize) +{ + struct hypercall_postmsg_in *inprm; + struct vmbus_msghc *mh; + + if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX) + return NULL; + + mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY); + if (mh == NULL) + return NULL; + + inprm = mh->mh_inprm; + memset(inprm, 0, HYPERCALL_POSTMSGIN_SIZE); + inprm->hc_connid = VMBUS_CONNID_MESSAGE; + inprm->hc_msgtype = HYPERV_MSGTYPE_CHANNEL; + inprm->hc_dsize = dsize; + + return mh; +} + +void +vmbus_msghc_put(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + + KASSERT(mhc->mhc_active == NULL, ("msg hypercall is active")); + mh->mh_resp = NULL; + + mtx_lock(&mhc->mhc_free_lock); + KASSERT(mhc->mhc_free == NULL, ("has free hypercall msg")); + mhc->mhc_free = mh; + mtx_unlock(&mhc->mhc_free_lock); + wakeup(&mhc->mhc_free); +} + +void * +vmbus_msghc_dataptr(struct vmbus_msghc *mh) +{ + return mh->mh_inprm->hc_data; +} + +static void +vmbus_msghc_ctx_destroy(struct vmbus_msghc_ctx *mhc) +{ + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_free_lock); + mhc->mhc_flags |= VMBUS_MSGHC_CTXF_DESTROY; + mtx_unlock(&mhc->mhc_free_lock); + wakeup(&mhc->mhc_free); + + mh = vmbus_msghc_get1(mhc, 0); + if (mh == NULL) + panic("can't get msghc"); + + vmbus_msghc_free(mh); + vmbus_msghc_ctx_free(mhc); +} + +int +vmbus_msghc_exec_noresult(struct vmbus_msghc *mh) +{ + sbintime_t time = SBT_1MS; + int i; + + /* + * Save the input parameter so that we could restore the input + * parameter if the Hypercall failed. + * + * XXX + * Is this really necessary?! i.e. Will the Hypercall ever + * overwrite the input parameter? + */ + memcpy(&mh->mh_inprm_save, mh->mh_inprm, HYPERCALL_POSTMSGIN_SIZE); + + /* + * In order to cope with transient failures, e.g. insufficient + * resources on host side, we retry the post message Hypercall + * several times. 20 retries seem sufficient. + */ +#define HC_RETRY_MAX 20 + + for (i = 0; i < HC_RETRY_MAX; ++i) { + uint64_t status; + + status = hypercall_post_message(mh->mh_inprm_dma.hv_paddr); + if (status == HYPERCALL_STATUS_SUCCESS) + return 0; + + pause_sbt("hcpmsg", time, 0, C_HARDCLOCK); + if (time < SBT_1S * 2) + time *= 2; + + /* Restore input parameter and try again */ + memcpy(mh->mh_inprm, &mh->mh_inprm_save, + HYPERCALL_POSTMSGIN_SIZE); + } + +#undef HC_RETRY_MAX + + return EIO; +} + +int +vmbus_msghc_exec(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + int error; + + KASSERT(mh->mh_resp == NULL, ("hypercall msg has pending response")); + + mtx_lock(&mhc->mhc_active_lock); + KASSERT(mhc->mhc_active == NULL, ("pending active msg hypercall")); + mhc->mhc_active = mh; + mtx_unlock(&mhc->mhc_active_lock); + + error = vmbus_msghc_exec_noresult(mh); + if (error) { + mtx_lock(&mhc->mhc_active_lock); + KASSERT(mhc->mhc_active == mh, ("msghc mismatch")); + mhc->mhc_active = NULL; + mtx_unlock(&mhc->mhc_active_lock); + } + return error; +} + +const struct vmbus_message * +vmbus_msghc_wait_result(struct vmbus_softc *sc, struct vmbus_msghc *mh) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + + mtx_lock(&mhc->mhc_active_lock); + + KASSERT(mhc->mhc_active == mh, ("msghc mismatch")); + while (mh->mh_resp == NULL) { + mtx_sleep(&mhc->mhc_active, &mhc->mhc_active_lock, 0, + "wmsghc", 0); + } + mhc->mhc_active = NULL; + + mtx_unlock(&mhc->mhc_active_lock); + + return mh->mh_resp; +} + +void +vmbus_msghc_wakeup(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + struct vmbus_msghc_ctx *mhc = sc->vmbus_msg_hc; + struct vmbus_msghc *mh; + + mtx_lock(&mhc->mhc_active_lock); + + mh = mhc->mhc_active; + KASSERT(mh != NULL, ("no pending msg hypercall")); + memcpy(&mh->mh_resp0, msg, sizeof(mh->mh_resp0)); + mh->mh_resp = &mh->mh_resp0; + + mtx_unlock(&mhc->mhc_active_lock); + wakeup(&mhc->mhc_active); +} + +static int +vmbus_init_contact(struct vmbus_softc *sc, uint32_t version) +{ + struct vmbus_chanmsg_init_contact *req; + const struct vmbus_chanmsg_version_resp *resp; + const struct vmbus_message *msg; + struct vmbus_msghc *mh; + int error, supp = 0; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) + return ENXIO; + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_INIT_CONTACT; + req->chm_ver = version; + req->chm_evtflags = sc->vmbus_evtflags_dma.hv_paddr; + req->chm_mnf1 = sc->vmbus_mnf1_dma.hv_paddr; + req->chm_mnf2 = sc->vmbus_mnf2_dma.hv_paddr; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + vmbus_msghc_put(sc, mh); + return error; + } + + msg = vmbus_msghc_wait_result(sc, mh); + resp = (const struct vmbus_chanmsg_version_resp *)msg->msg_data; + supp = resp->chm_supp; + + vmbus_msghc_put(sc, mh); + + return (supp ? 0 : EOPNOTSUPP); +} + +static int +vmbus_init(struct vmbus_softc *sc) +{ + int i; + + for (i = 0; i < nitems(vmbus_version); ++i) { + int error; + + error = vmbus_init_contact(sc, vmbus_version[i]); + if (!error) { + hv_vmbus_protocal_version = vmbus_version[i]; + device_printf(sc->vmbus_dev, "version %u.%u\n", + (hv_vmbus_protocal_version >> 16), + (hv_vmbus_protocal_version & 0xffff)); + return 0; + } + } + return ENXIO; +} + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -81,19 +425,19 @@ vmbus_msg_task(void *xsc, int pending __ msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE; for (;;) { - if (msg->msg_type == VMBUS_MSGTYPE_NONE) { + if (msg->msg_type == HYPERV_MSGTYPE_NONE) { /* No message */ break; - } else if (msg->msg_type == VMBUS_MSGTYPE_CHANNEL) { + } else if (msg->msg_type == HYPERV_MSGTYPE_CHANNEL) { /* Channel message */ vmbus_chan_msgproc(sc, __DEVOLATILE(const struct vmbus_message *, msg)); } - msg->msg_type = VMBUS_MSGTYPE_NONE; + msg->msg_type = HYPERV_MSGTYPE_NONE; /* * Make sure the write to msg_type (i.e. set to - * VMBUS_MSGTYPE_NONE) happens before we read the + * HYPERV_MSGTYPE_NONE) happens before we read the * msg_flags and EOMing. Otherwise, the EOMing will * not deliver any more messages since there is no * empty slot @@ -127,14 +471,14 @@ vmbus_handle_intr1(struct vmbus_softc *s * TODO: move this to independent IDT vector. */ msg = msg_base + VMBUS_SINT_TIMER; - if (msg->msg_type == VMBUS_MSGTYPE_TIMER_EXPIRED) { - msg->msg_type = VMBUS_MSGTYPE_NONE; + if (msg->msg_type == HYPERV_MSGTYPE_TIMER_EXPIRED) { + msg->msg_type = HYPERV_MSGTYPE_NONE; vmbus_et_intr(frame); /* * Make sure the write to msg_type (i.e. set to - * VMBUS_MSGTYPE_NONE) happens before we read the + * HYPERV_MSGTYPE_NONE) happens before we read the * msg_flags and EOMing. Otherwise, the EOMing will * not deliver any more messages since there is no * empty slot @@ -166,7 +510,7 @@ vmbus_handle_intr1(struct vmbus_softc *s * Check messages. Mainly management stuffs; ultra low rate. */ msg = msg_base + VMBUS_SINT_MESSAGE; - if (__predict_false(msg->msg_type != VMBUS_MSGTYPE_NONE)) { + if (__predict_false(msg->msg_type != HYPERV_MSGTYPE_NONE)) { taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu), VMBUS_PCPU_PTR(sc, message_task, cpu)); } @@ -620,6 +964,16 @@ vmbus_bus_init(void) sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; /* + * Create context for "post message" Hypercalls + */ + sc->vmbus_msg_hc = vmbus_msghc_ctx_create( + bus_get_dma_tag(sc->vmbus_dev)); + if (sc->vmbus_msg_hc == NULL) { + ret = ENXIO; + goto cleanup; + } + + /* * Allocate DMA stuffs. */ ret = vmbus_dma_alloc(sc); @@ -648,6 +1002,10 @@ vmbus_bus_init(void) if (ret != 0) goto cleanup; + ret = vmbus_init(sc); + if (ret != 0) + goto cleanup; + if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) sc->vmbus_event_proc = vmbus_event_proc_compat; @@ -665,6 +1023,10 @@ vmbus_bus_init(void) cleanup: vmbus_intr_teardown(sc); vmbus_dma_free(sc); + if (sc->vmbus_msg_hc != NULL) { + vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); + sc->vmbus_msg_hc = NULL; + } return (ret); } @@ -737,6 +1099,11 @@ vmbus_detach(device_t dev) vmbus_intr_teardown(sc); vmbus_dma_free(sc); + if (sc->vmbus_msg_hc != NULL) { + vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); + sc->vmbus_msg_hc = NULL; + } + return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 04:50:32 2016 (r302539) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 04:52:11 2016 (r302540) @@ -39,7 +39,7 @@ #define VMBUS_MSG_SIZE 256 struct vmbus_message { - uint32_t msg_type; /* VMBUS_MSGTYPE_ */ + uint32_t msg_type; /* HYPERV_MSGTYPE_ */ uint8_t msg_dsize; /* data size */ uint8_t msg_flags; /* VMBUS_MSGFLAG_ */ uint16_t msg_rsvd; @@ -48,10 +48,6 @@ struct vmbus_message { } __packed; CTASSERT(sizeof(struct vmbus_message) == VMBUS_MSG_SIZE); -#define VMBUS_MSGTYPE_NONE 0 -#define VMBUS_MSGTYPE_CHANNEL 1 -#define VMBUS_MSGTYPE_TIMER_EXPIRED 0x80000010 - #define VMBUS_MSGFLAG_PENDING 0x01 /* @@ -81,4 +77,34 @@ CTASSERT(sizeof(struct vmbus_evtflags) = #define VMBUS_CHAN_MAX_COMPAT 256 #define VMBUS_CHAN_MAX (VMBUS_EVTFLAG_LEN * VMBUS_EVTFLAGS_MAX) +/* + * Channel messages + * - Embedded in vmbus_message.msg_data, e.g. response. + * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. + */ + +#define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ +#define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ + +struct vmbus_chanmsg_hdr { + uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ + uint32_t chm_rsvd; +} __packed; + +/* VMBUS_CHANMSG_TYPE_INIT_CONTACT */ +struct vmbus_chanmsg_init_contact { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_ver; + uint32_t chm_rsvd; + uint64_t chm_evtflags; + uint64_t chm_mnf1; + uint64_t chm_mnf2; +} __packed; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jul 11 05:17:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6B21B91B8C; Mon, 11 Jul 2016 05:17:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94FA71EC6; Mon, 11 Jul 2016 05:17:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B5HmpV018577; Mon, 11 Jul 2016 05:17:48 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B5Hm4n018576; Mon, 11 Jul 2016 05:17:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110517.u6B5Hm4n018576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 05:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302541 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 05:17:49 -0000 Author: sephe Date: Mon Jul 11 05:17:48 2016 New Revision: 302541 URL: https://svnweb.freebsd.org/changeset/base/302541 Log: hyperv/stor: Fix the INQUIRY checks Don't check the area that the host has not filled. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443 PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425 Submitted by: Hongjiang Zhang Reviewed by: sephe, Dexuan Cui MFC after: 3 days Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6955 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 11 04:52:11 2016 (r302540) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jul 11 05:17:48 2016 (r302541) @@ -1939,62 +1939,24 @@ create_storvsc_request(union ccb *ccb, s } /* - * Modified based on scsi_print_inquiry which is responsible to - * print the detail information for scsi_inquiry_data. - * + * SCSI Inquiry checks qualifier and type. + * If qualifier is 011b, means the device server is not capable + * of supporting a peripheral device on this logical unit, and + * the type should be set to 1Fh. + * * Return 1 if it is valid, 0 otherwise. */ static inline int is_inquiry_valid(const struct scsi_inquiry_data *inq_data) { uint8_t type; - char vendor[16], product[48], revision[16]; - - /* - * Check device type and qualifier - */ - if (!(SID_QUAL_IS_VENDOR_UNIQUE(inq_data) || - SID_QUAL(inq_data) == SID_QUAL_LU_CONNECTED)) + if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) { return (0); - + } type = SID_TYPE(inq_data); - switch (type) { - case T_DIRECT: - case T_SEQUENTIAL: - case T_PRINTER: - case T_PROCESSOR: - case T_WORM: - case T_CDROM: - case T_SCANNER: - case T_OPTICAL: - case T_CHANGER: - case T_COMM: - case T_STORARRAY: - case T_ENCLOSURE: - case T_RBC: - case T_OCRW: - case T_OSD: - case T_ADC: - break; - case T_NODEVICE: - default: + if (type == T_NODEVICE) { return (0); } - - /* - * Check vendor, product, and revision - */ - cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), - sizeof(vendor)); - cam_strvis(product, inq_data->product, sizeof(inq_data->product), - sizeof(product)); - cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), - sizeof(revision)); - if (strlen(vendor) == 0 || - strlen(product) == 0 || - strlen(revision) == 0) - return (0); - return (1); } @@ -2071,7 +2033,6 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - /* * Check whether the data for INQUIRY cmd is valid or * not. Windows 10 and Windows 2016 send all zero @@ -2080,23 +2041,59 @@ storvsc_io_done(struct hv_storvsc_reques cmd = (const struct scsi_generic *) ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); - if (cmd->opcode == INQUIRY && - /* - * XXX: Temporary work around disk hot plugin on win2k12r2, - * only filtering the invalid disk on win10 or 2016 server. - * So, the hot plugin on win10 and 2016 server needs - * to be fixed. + if (cmd->opcode == INQUIRY) { + /* + * The host of Windows 10 or 2016 server will response + * the inquiry request with invalid data for unexisted device: + [0x7f 0x0 0x5 0x2 0x1f ... ] + * But on windows 2012 R2, the response is: + [0x7f 0x0 0x0 0x0 0x0 ] + * That is why here wants to validate the inquiry response. + * The validation will skip the INQUIRY whose response is short, + * which is less than SHORT_INQUIRY_LENGTH (36). + * + * For more information about INQUIRY, please refer to: + * ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf */ - vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN10 && - is_inquiry_valid( - (const struct scsi_inquiry_data *)csio->data_ptr) == 0) { + const struct scsi_inquiry_data *inq_data = + (const struct scsi_inquiry_data *)csio->data_ptr; + uint8_t* resp_buf = (uint8_t*)csio->data_ptr; + /* Get the buffer length reported by host */ + int resp_xfer_len = vm_srb->transfer_len; + /* Get the available buffer length */ + int resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; + int data_len = (resp_buf_len < resp_xfer_len) ? resp_buf_len : resp_xfer_len; + if (data_len < SHORT_INQUIRY_LENGTH) { + ccb->ccb_h.status |= CAM_REQ_CMP; + if (bootverbose && data_len >= 5) { + mtx_lock(&sc->hs_lock); + xpt_print(ccb->ccb_h.path, + "storvsc skips the validation for short inquiry (%d)" + " [%x %x %x %x %x]\n", + data_len,resp_buf[0],resp_buf[1],resp_buf[2], + resp_buf[3],resp_buf[4]); + mtx_unlock(&sc->hs_lock); + } + } else if (is_inquiry_valid(inq_data) == 0) { ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + if (bootverbose && data_len >= 5) { + mtx_lock(&sc->hs_lock); + xpt_print(ccb->ccb_h.path, + "storvsc uninstalled invalid device" + " [%x %x %x %x %x]\n", + resp_buf[0],resp_buf[1],resp_buf[2],resp_buf[3],resp_buf[4]); + mtx_unlock(&sc->hs_lock); + } + } else { + ccb->ccb_h.status |= CAM_REQ_CMP; if (bootverbose) { mtx_lock(&sc->hs_lock); xpt_print(ccb->ccb_h.path, - "storvsc uninstalled device\n"); + "storvsc has passed inquiry response (%d) validation\n", + data_len); mtx_unlock(&sc->hs_lock); } + } } else { ccb->ccb_h.status |= CAM_REQ_CMP; } From owner-svn-src-head@freebsd.org Mon Jul 11 05:44:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 961F5B90666; Mon, 11 Jul 2016 05:44:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 681161CCC; Mon, 11 Jul 2016 05:44:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B5iw7f029355; Mon, 11 Jul 2016 05:44:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B5iwFm029354; Mon, 11 Jul 2016 05:44:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201607110544.u6B5iwFm029354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 11 Jul 2016 05:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302542 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 05:44:59 -0000 Author: delphij Date: Mon Jul 11 05:44:58 2016 New Revision: 302542 URL: https://svnweb.freebsd.org/changeset/base/302542 Log: Use _PATH_DEVNULL instead of hardcoding. MFC after: 2 weeks Modified: head/usr.bin/mail/collect.c Modified: head/usr.bin/mail/collect.c ============================================================================== --- head/usr.bin/mail/collect.c Mon Jul 11 05:17:48 2016 (r302541) +++ head/usr.bin/mail/collect.c Mon Jul 11 05:44:58 2016 (r302542) @@ -339,9 +339,9 @@ cont: int nullfd, tempfd, rc; char tempname2[PATHSIZE]; - if ((nullfd = open("/dev/null", O_RDONLY, 0)) + if ((nullfd = open(_PATH_DEVNULL, O_RDONLY, 0)) == -1) { - warn("/dev/null"); + warn(_PATH_DEVNULL); break; } From owner-svn-src-head@freebsd.org Mon Jul 11 06:11:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 573B3B90F90; Mon, 11 Jul 2016 06:11:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31CB11729; Mon, 11 Jul 2016 06:11:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6BPRq036994; Mon, 11 Jul 2016 06:11:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6BPD8036989; Mon, 11 Jul 2016 06:11:25 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110611.u6B6BPD8036989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 06:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302543 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:11:26 -0000 Author: sephe Date: Mon Jul 11 06:11:24 2016 New Revision: 302543 URL: https://svnweb.freebsd.org/changeset/base/302543 Log: hyperv/vmbus: Use post message Hypercall APIs for channel request MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6831 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 05:44:58 2016 (r302542) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:11:24 2016 (r302543) @@ -675,36 +675,6 @@ vmbus_channel_on_version_response(struct } /** - * @brief Send a request to get all our pending offers. - */ -int -hv_vmbus_request_channel_offers(void) -{ - int ret; - hv_vmbus_channel_msg_header* msg; - hv_vmbus_channel_msg_info* msg_info; - - msg_info = (hv_vmbus_channel_msg_info *) - malloc(sizeof(hv_vmbus_channel_msg_info) - + sizeof(hv_vmbus_channel_msg_header), M_DEVBUF, M_NOWAIT); - - if (msg_info == NULL) { - if(bootverbose) - printf("Error VMBUS: malloc failed for Request Offers\n"); - return (ENOMEM); - } - - msg = (hv_vmbus_channel_msg_header*) msg_info->msg; - msg->message_type = HV_CHANNEL_MESSAGE_REQUEST_OFFERS; - - ret = hv_vmbus_post_message(msg, sizeof(hv_vmbus_channel_msg_header)); - - free(msg_info, M_DEVBUF); - - return (ret); -} - -/** * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 05:44:58 2016 (r302542) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 06:11:24 2016 (r302543) @@ -397,7 +397,6 @@ uint32_t hv_ring_buffer_read_end( hv_vmbus_channel* hv_vmbus_allocate_channel(void); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); -int hv_vmbus_request_channel_offers(void); void hv_vmbus_release_unattached_channels(void); uint16_t hv_vmbus_post_msg_via_msg_ipc( Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 05:44:58 2016 (r302542) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 06:11:24 2016 (r302543) @@ -98,6 +98,7 @@ struct vmbus_msghc_ctx { static int vmbus_init(struct vmbus_softc *); static int vmbus_init_contact(struct vmbus_softc *, uint32_t); +static int vmbus_req_channels(struct vmbus_softc *sc); static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); static void vmbus_msghc_ctx_destroy( @@ -417,6 +418,26 @@ vmbus_init(struct vmbus_softc *sc) return ENXIO; } +static int +vmbus_req_channels(struct vmbus_softc *sc) +{ + struct vmbus_chanmsg_channel_req *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) + return ENXIO; + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + return error; +} + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -1012,7 +1033,9 @@ vmbus_bus_init(void) else sc->vmbus_event_proc = vmbus_event_proc; - hv_vmbus_request_channel_offers(); + ret = vmbus_req_channels(sc); + if (ret != 0) + goto cleanup; vmbus_scan(); bus_generic_attach(sc->vmbus_dev); Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 05:44:58 2016 (r302542) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 06:11:24 2016 (r302543) @@ -83,6 +83,7 @@ CTASSERT(sizeof(struct vmbus_evtflags) = * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ @@ -107,4 +108,9 @@ struct vmbus_chanmsg_version_resp { uint8_t chm_supp; } __packed; +/* VMBUS_CHANMSG_TYPE_CHANNEL_REQ */ +struct vmbus_chanmsg_channel_req { + struct vmbus_chanmsg_hdr chm_hdr; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Mon Jul 11 06:23:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EA8DB91266; Mon, 11 Jul 2016 06:23:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 555201D38; Mon, 11 Jul 2016 06:23:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6N1Px044028; Mon, 11 Jul 2016 06:23:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6N1Sf044027; Mon, 11 Jul 2016 06:23:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110623.u6B6N1Sf044027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 06:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302544 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:23:02 -0000 Author: sephe Date: Mon Jul 11 06:23:01 2016 New Revision: 302544 URL: https://svnweb.freebsd.org/changeset/base/302544 Log: hyperv/hn: Add tunable to allow tcp_lro_queue_mbuf() MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6841 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jul 11 06:11:24 2016 (r302543) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jul 11 06:23:01 2016 (r302544) @@ -299,6 +299,12 @@ static int hn_tx_swq_depth = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, &hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); +#if __FreeBSD_version >= 1100095 +static u_int hn_lro_mbufq_depth = 0; +SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, + &hn_lro_mbufq_depth, 0, "Depth of LRO mbuf queue"); +#endif + static u_int hn_cpu_index; /* @@ -1283,6 +1289,19 @@ hv_m_append(struct mbuf *m0, int len, c_ return (remainder == 0); } +#if defined(INET) || defined(INET6) +static __inline int +hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) +{ +#if __FreeBSD_version >= 1100095 + if (hn_lro_mbufq_depth) { + tcp_lro_queue_mbuf(lc, m); + return 0; + } +#endif + return tcp_lro_rx(lc, m, 0); +} +#endif /* * Called when we receive a data packet from the "wire" on the @@ -1488,7 +1507,7 @@ skip: if (lro->lro_cnt) { rxr->hn_lro_tried++; - if (tcp_lro_rx(lro, m_new, 0) == 0) { + if (hn_lro_rx(lro, m_new) == 0) { /* DONE! */ return 0; } @@ -2223,7 +2242,8 @@ hn_create_rx_data(struct hn_softc *sc, i */ #if defined(INET) || defined(INET6) #if __FreeBSD_version >= 1100095 - tcp_lro_init_args(&rxr->hn_lro, sc->hn_ifp, lroent_cnt, 0); + tcp_lro_init_args(&rxr->hn_lro, sc->hn_ifp, lroent_cnt, + hn_lro_mbufq_depth); #else tcp_lro_init(&rxr->hn_lro); rxr->hn_lro.ifp = sc->hn_ifp; From owner-svn-src-head@freebsd.org Mon Jul 11 06:29:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062F5B9136E; Mon, 11 Jul 2016 06:29:58 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB7551F6A; Mon, 11 Jul 2016 06:29:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6TvU8044292; Mon, 11 Jul 2016 06:29:57 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6TvEx044291; Mon, 11 Jul 2016 06:29:57 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110629.u6B6TvEx044291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 06:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302545 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:29:58 -0000 Author: sephe Date: Mon Jul 11 06:29:56 2016 New Revision: 302545 URL: https://svnweb.freebsd.org/changeset/base/302545 Log: hyperv/vmbus: Function renaming. And pass vmbus_softc to vmbus_doattach() MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6842 Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 06:23:01 2016 (r302544) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 06:29:56 2016 (r302545) @@ -975,9 +975,8 @@ vmbus_probe(device_t dev) * - retrieve the channel offers */ static int -vmbus_bus_init(void) +vmbus_doattach(struct vmbus_softc *sc) { - struct vmbus_softc *sc = vmbus_get_softc(); int ret; if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) @@ -1082,7 +1081,7 @@ vmbus_attach(device_t dev) */ if (!cold) #endif - vmbus_bus_init(); + vmbus_doattach(vmbus_sc); bus_generic_probe(dev); return (0); @@ -1091,7 +1090,9 @@ vmbus_attach(device_t dev) static void vmbus_sysinit(void *arg __unused) { - if (vm_guest != VM_GUEST_HV || vmbus_get_softc() == NULL) + struct vmbus_softc *sc = vmbus_get_softc(); + + if (vm_guest != VM_GUEST_HV || sc == NULL) return; #ifndef EARLY_AP_STARTUP @@ -1103,7 +1104,7 @@ vmbus_sysinit(void *arg __unused) */ if (!cold) #endif - vmbus_bus_init(); + vmbus_doattach(sc); } static int From owner-svn-src-head@freebsd.org Mon Jul 11 06:31:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CB23B913D9; Mon, 11 Jul 2016 06:31:17 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDCA712E6; Mon, 11 Jul 2016 06:31:16 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6VGhN044975; Mon, 11 Jul 2016 06:31:16 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6VGGW044974; Mon, 11 Jul 2016 06:31:16 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201607110631.u6B6VGGW044974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 11 Jul 2016 06:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302546 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:31:17 -0000 Author: grehan Date: Mon Jul 11 06:31:15 2016 New Revision: 302546 URL: https://svnweb.freebsd.org/changeset/base/302546 Log: Implement right shift/ctl, and convert the VNC/xorg scancode of 0xff03 into right-alt. Reported by: lme@ MFC after: 1 week Modified: head/usr.sbin/bhyve/ps2kbd.c Modified: head/usr.sbin/bhyve/ps2kbd.c ============================================================================== --- head/usr.sbin/bhyve/ps2kbd.c Mon Jul 11 06:29:56 2016 (r302545) +++ head/usr.sbin/bhyve/ps2kbd.c Mon Jul 11 06:31:15 2016 (r302546) @@ -324,7 +324,9 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0x12); break; case 0xffe2: /* Right shift */ - /* XXX */ + if (!down) + fifo_put(sc, 0xf0); + fifo_put(sc, 0x59); break; case 0xffe3: /* Left control */ if (!down) @@ -332,7 +334,10 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0x14); break; case 0xffe4: /* Right control */ - /* XXX */ + fifo_put(sc, 0xe0); + if (!down) + fifo_put(sc, 0xf0); + fifo_put(sc, 0x14); break; case 0xffe7: /* Left meta */ /* XXX */ @@ -345,6 +350,7 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0xf0); fifo_put(sc, 0x11); break; + case 0xfe03: /* AltGr */ case 0xffea: /* Right alt */ fifo_put(sc, 0xe0); if (!down) From owner-svn-src-head@freebsd.org Mon Jul 11 06:37:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59323B915DA; Mon, 11 Jul 2016 06:37:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 307C716DA; Mon, 11 Jul 2016 06:37:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6b4ic047863; Mon, 11 Jul 2016 06:37:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6b4cA047862; Mon, 11 Jul 2016 06:37:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110637.u6B6b4cA047862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 06:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302547 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:37:05 -0000 Author: sephe Date: Mon Jul 11 06:37:04 2016 New Revision: 302547 URL: https://svnweb.freebsd.org/changeset/base/302547 Log: hyperv/vmbus: Explicitly assign channel message process array. While I'm here, remove the useless message type from message process array, which is not used and serves no purposes at all. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6858 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:31:15 2016 (r302546) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 06:37:04 2016 (r302547) @@ -36,16 +36,8 @@ #include #include -/* - * Internal functions - */ - -typedef struct hv_vmbus_channel_msg_table_entry { - hv_vmbus_channel_msg_type messageType; - void (*messageHandler) - (struct vmbus_softc *sc, - const struct vmbus_message *msg); -} hv_vmbus_channel_msg_table_entry; +typedef void (*vmbus_chanmsg_proc_t) + (struct vmbus_softc *, const struct vmbus_message *); static void vmbus_channel_on_offer_internal(void *context); static void vmbus_channel_on_offer_rescind_internal(void *context); @@ -68,42 +60,22 @@ static void vmbus_channel_on_version_res /** * Channel message dispatch table */ -static const hv_vmbus_channel_msg_table_entry - g_channel_message_table[HV_CHANNEL_MESSAGE_COUNT] = { - { HV_CHANNEL_MESSAGE_INVALID, - NULL }, - { HV_CHANNEL_MESSAGE_OFFER_CHANNEL, - vmbus_channel_on_offer }, - { HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER, - vmbus_channel_on_offer_rescind }, - { HV_CHANNEL_MESSAGE_REQUEST_OFFERS, - NULL }, - { HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED, - vmbus_channel_on_offers_delivered }, - { HV_CHANNEL_MESSAGE_OPEN_CHANNEL, - NULL }, - { HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT, - vmbus_channel_on_open_result }, - { HV_CHANNEL_MESSAGE_CLOSE_CHANNEL, - NULL }, - { HV_CHANNEL_MESSAGEL_GPADL_HEADER, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_BODY, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_CREATED, - vmbus_channel_on_gpadl_created }, - { HV_CHANNEL_MESSAGE_GPADL_TEARDOWN, - NULL }, - { HV_CHANNEL_MESSAGE_GPADL_TORNDOWN, - vmbus_channel_on_gpadl_torndown }, - { HV_CHANNEL_MESSAGE_REL_ID_RELEASED, - NULL }, - { HV_CHANNEL_MESSAGE_INITIATED_CONTACT, - NULL }, - { HV_CHANNEL_MESSAGE_VERSION_RESPONSE, - vmbus_channel_on_version_response }, - { HV_CHANNEL_MESSAGE_UNLOAD, - NULL } +static const vmbus_chanmsg_proc_t +vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = { + [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] = + vmbus_channel_on_offer, + [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] = + vmbus_channel_on_offer_rescind, + [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = + vmbus_channel_on_offers_delivered, + [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = + vmbus_channel_on_open_result, + [HV_CHANNEL_MESSAGE_GPADL_CREATED] = + vmbus_channel_on_gpadl_created, + [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = + vmbus_channel_on_gpadl_torndown, + [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = + vmbus_channel_on_version_response }; typedef struct hv_work_item { @@ -812,20 +784,17 @@ vmbus_rel_subchan(struct hv_vmbus_channe void vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_table_entry *entry; - const hv_vmbus_channel_msg_header *hdr; - hv_vmbus_channel_msg_type msg_type; - - hdr = (const hv_vmbus_channel_msg_header *)msg->msg_data; - msg_type = hdr->message_type; + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", msg_type); return; } - entry = &g_channel_message_table[msg_type]; - if (entry->messageHandler) - entry->messageHandler(sc, msg); + msg_proc = vmbus_chanmsg_process[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); } From owner-svn-src-head@freebsd.org Mon Jul 11 06:49:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3304B917C6; Mon, 11 Jul 2016 06:49:57 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 837A21BFA; Mon, 11 Jul 2016 06:49:57 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6nuUJ051617; Mon, 11 Jul 2016 06:49:56 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6nuJv051616; Mon, 11 Jul 2016 06:49:56 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201607110649.u6B6nuJv051616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Mon, 11 Jul 2016 06:49:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302548 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:49:57 -0000 Author: yongari Date: Mon Jul 11 06:49:56 2016 New Revision: 302548 URL: https://svnweb.freebsd.org/changeset/base/302548 Log: Belatedly remove CSUM_IP_FRAGS and CSUM_FRAGMENT offloading capabilities. It was removed in r243624 and r254804/r271006 respectively. This file and mbuf(9) needs updates for other offloading capabilities(i.e. CSUM_SCTP and CSUM_TSO). Modified: head/share/man/man9/ifnet.9 Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Mon Jul 11 06:37:04 2016 (r302547) +++ head/share/man/man9/ifnet.9 Mon Jul 11 06:49:56 2016 (r302548) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2014 +.Dd July 11, 2016 .Dt IFNET 9 .Os .Sh NAME @@ -787,18 +787,6 @@ The interface will compute IP checksums. The interface will compute TCP checksums. .It Dv CSUM_UDP The interface will compute UDP checksums. -.It Dv CSUM_IP_FRAGS -The interface can compute a TCP or UDP checksum for a packet -fragmented by the host CPU. -Makes sense only along with -.Dv CSUM_TCP -or -.Dv CSUM_UDP . -.It Dv CSUM_FRAGMENT -The interface will do the fragmentation of IP packets if necessary. -The host CPU does not need to care about MTU on this interface -as long as a packet to transmit through it is an IP one and it -does not exceed the size of the hardware buffer. .El .Pp An interface notifies the TCP/IP module about the tasks From owner-svn-src-head@freebsd.org Mon Jul 11 06:55:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68CDAB91967; Mon, 11 Jul 2016 06:55:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F8131FB0; Mon, 11 Jul 2016 06:55:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6t2HU055379; Mon, 11 Jul 2016 06:55:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6t239055378; Mon, 11 Jul 2016 06:55:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110655.u6B6t239055378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 06:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302549 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:55:03 -0000 Author: sephe Date: Mon Jul 11 06:55:02 2016 New Revision: 302549 URL: https://svnweb.freebsd.org/changeset/base/302549 Log: hyperv/vmbus: Add sysctl to expose vmbus version. Requested by: Hongxiong Xian MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6860 Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 06:49:56 2016 (r302548) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 06:55:02 2016 (r302549) @@ -100,6 +100,8 @@ static int vmbus_init_contact(struct v uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); +static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); + static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); static void vmbus_msghc_ctx_destroy( struct vmbus_msghc_ctx *); @@ -948,6 +950,17 @@ hv_vmbus_child_device_unregister(struct } static int +vmbus_sysctl_version(SYSCTL_HANDLER_ARGS) +{ + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + hv_vmbus_protocal_version >> 16, + hv_vmbus_protocal_version & 0xffff); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int vmbus_probe(device_t dev) { char *id[] = { "VMBUS", NULL }; @@ -977,6 +990,8 @@ vmbus_probe(device_t dev) static int vmbus_doattach(struct vmbus_softc *sc) { + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int ret; if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) @@ -1040,6 +1055,12 @@ vmbus_doattach(struct vmbus_softc *sc) bus_generic_attach(sc->vmbus_dev); device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); + ctx = device_get_sysctl_ctx(sc->vmbus_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + vmbus_sysctl_version, "A", "vmbus version"); + return (ret); cleanup: From owner-svn-src-head@freebsd.org Mon Jul 11 06:58:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 619D8B91A1B; Mon, 11 Jul 2016 06:58:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2766B12C7; Mon, 11 Jul 2016 06:58:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B6wOra055531; Mon, 11 Jul 2016 06:58:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B6wOhi055529; Mon, 11 Jul 2016 06:58:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607110658.u6B6wOhi055529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 06:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302550 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 06:58:25 -0000 Author: ngie Date: Mon Jul 11 06:58:24 2016 New Revision: 302550 URL: https://svnweb.freebsd.org/changeset/base/302550 Log: Deobfuscate cleanup path in clnt_dg_create(..) Similar to r300836 and r301800, cl and cu will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. Deobfuscating the cleanup path fixes a leak where if cl was NULL and cu was not, cu would not be free'd, and also removes a duplicate test for cl not being NULL. MFC after: 1 week Reported by: Coverity CID: 1007033, 1007344 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/clnt_dg.c Modified: head/sys/rpc/clnt_dg.c ============================================================================== --- head/sys/rpc/clnt_dg.c Mon Jul 11 06:55:02 2016 (r302549) +++ head/sys/rpc/clnt_dg.c Mon Jul 11 06:58:24 2016 (r302550) @@ -313,11 +313,9 @@ recheck_socket: cl->cl_netid = NULL; return (cl); err2: - if (cl) { - mem_free(cl, sizeof (CLIENT)); - if (cu) - mem_free(cu, sizeof (*cu)); - } + mem_free(cl, sizeof (CLIENT)); + mem_free(cu, sizeof (*cu)); + return (NULL); } From owner-svn-src-head@freebsd.org Mon Jul 11 07:07:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E3FEB91D74; Mon, 11 Jul 2016 07:07:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F184417C9; Mon, 11 Jul 2016 07:07:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B77Gkb059274; Mon, 11 Jul 2016 07:07:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B77GCs059273; Mon, 11 Jul 2016 07:07:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607110707.u6B77GCs059273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 07:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302551 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:07:17 -0000 Author: ngie Date: Mon Jul 11 07:07:15 2016 New Revision: 302551 URL: https://svnweb.freebsd.org/changeset/base/302551 Log: Deobfuscate cleanup path in clnt_vc_create(..) Similar to r300836, r301800, and r302550, cl and ct will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. MFC after: 1 week Reported by: Coverity CID: 1007342 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/clnt_vc.c Modified: head/sys/rpc/clnt_vc.c ============================================================================== --- head/sys/rpc/clnt_vc.c Mon Jul 11 06:58:24 2016 (r302550) +++ head/sys/rpc/clnt_vc.c Mon Jul 11 07:07:15 2016 (r302551) @@ -270,12 +270,10 @@ clnt_vc_create( return (cl); err: - if (ct) { - mtx_destroy(&ct->ct_lock); - mem_free(ct, sizeof (struct ct_data)); - } - if (cl) - mem_free(cl, sizeof (CLIENT)); + mtx_destroy(&ct->ct_lock); + mem_free(ct, sizeof (struct ct_data)); + mem_free(cl, sizeof (CLIENT)); + return ((CLIENT *)NULL); } From owner-svn-src-head@freebsd.org Mon Jul 11 07:17:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17D4DB91F1C; Mon, 11 Jul 2016 07:17:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCF981C3B; Mon, 11 Jul 2016 07:17:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B7HraQ062908; Mon, 11 Jul 2016 07:17:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7Hrgt062907; Mon, 11 Jul 2016 07:17:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607110717.u6B7Hrgt062907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 07:17:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302552 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:17:54 -0000 Author: ngie Date: Mon Jul 11 07:17:52 2016 New Revision: 302552 URL: https://svnweb.freebsd.org/changeset/base/302552 Log: Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to ANSI C style prototypes MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/svc.c Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Mon Jul 11 07:07:15 2016 (r302551) +++ head/sys/rpc/svc.c Mon Jul 11 07:17:52 2016 (r302552) @@ -841,7 +841,7 @@ svcerr_progvers(struct svc_req *rqstp, r * parameters. */ SVCXPRT * -svc_xprt_alloc() +svc_xprt_alloc(void) { SVCXPRT *xprt; SVCXPRT_EXT *ext; @@ -858,8 +858,7 @@ svc_xprt_alloc() * Free a server transport structure. */ void -svc_xprt_free(xprt) - SVCXPRT *xprt; +svc_xprt_free(SVCXPRT *xprt) { mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT)); From owner-svn-src-head@freebsd.org Mon Jul 11 07:24:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD360B9009F; Mon, 11 Jul 2016 07:24:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A0D1116E; Mon, 11 Jul 2016 07:24:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B7Ou5Q066480; Mon, 11 Jul 2016 07:24:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7OuVc066479; Mon, 11 Jul 2016 07:24:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607110724.u6B7OuVc066479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 07:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302553 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:24:57 -0000 Author: ngie Date: Mon Jul 11 07:24:56 2016 New Revision: 302553 URL: https://svnweb.freebsd.org/changeset/base/302553 Log: Don't test for xpt not being NULL before calling svc_xprt_free(..) svc_xprt_alloc(..) will always return initialized memory as it uses mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..). MFC after: 1 week Reported by: Coverity CID: 1007341 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/svc_dg.c Modified: head/sys/rpc/svc_dg.c ============================================================================== --- head/sys/rpc/svc_dg.c Mon Jul 11 07:17:52 2016 (r302552) +++ head/sys/rpc/svc_dg.c Mon Jul 11 07:24:56 2016 (r302553) @@ -142,9 +142,8 @@ svc_dg_create(SVCPOOL *pool, struct sock return (xprt); freedata: (void) printf(svc_dg_str, __no_mem_str); - if (xprt) { - svc_xprt_free(xprt); - } + svc_xprt_free(xprt); + return (NULL); } From owner-svn-src-head@freebsd.org Mon Jul 11 07:28:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9411EB90105; Mon, 11 Jul 2016 07:28:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AF64130B; Mon, 11 Jul 2016 07:28:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B7SFRY066636; Mon, 11 Jul 2016 07:28:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7SFog066633; Mon, 11 Jul 2016 07:28:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110728.u6B7SFog066633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 07:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302554 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:28:16 -0000 Author: sephe Date: Mon Jul 11 07:28:15 2016 New Revision: 302554 URL: https://svnweb.freebsd.org/changeset/base/302554 Log: hyperv/vmbus: Use post message Hypercall APIs for unload MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6861 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 07:24:56 2016 (r302553) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 07:28:15 2016 (r302554) @@ -92,19 +92,13 @@ hv_vmbus_connect(struct vmbus_softc *sc) int hv_vmbus_disconnect(void) { - int ret = 0; - hv_vmbus_channel_unload msg; - - msg.message_type = HV_CHANNEL_MESSAGE_UNLOAD; - - ret = hv_vmbus_post_message(&msg, sizeof(hv_vmbus_channel_unload)); mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); free(hv_vmbus_g_connection.channels, M_DEVBUF); hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - return (ret); + return (0); } static __inline void Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 07:24:56 2016 (r302553) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Jul 11 07:28:15 2016 (r302554) @@ -99,6 +99,7 @@ static int vmbus_init(struct vmbus_sof static int vmbus_init_contact(struct vmbus_softc *, uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); +static void vmbus_uninit(struct vmbus_softc *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); @@ -420,6 +421,32 @@ vmbus_init(struct vmbus_softc *sc) return ENXIO; } +static void +vmbus_uninit(struct vmbus_softc *sc) +{ + struct vmbus_chanmsg_unload *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for unload\n"); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "unload msg hypercall failed\n"); + } +} + static int vmbus_req_channels(struct vmbus_softc *sc) { @@ -1134,6 +1161,8 @@ vmbus_detach(device_t dev) struct vmbus_softc *sc = device_get_softc(dev); hv_vmbus_release_unattached_channels(); + + vmbus_uninit(sc); hv_vmbus_disconnect(); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 07:24:56 2016 (r302553) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 11 07:28:15 2016 (r302554) @@ -86,6 +86,7 @@ CTASSERT(sizeof(struct vmbus_evtflags) = #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ +#define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ struct vmbus_chanmsg_hdr { uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ @@ -113,4 +114,9 @@ struct vmbus_chanmsg_channel_req { struct vmbus_chanmsg_hdr chm_hdr; } __packed; +/* VMBUS_CHANMSG_TYPE_UNLOAD */ +struct vmbus_chanmsg_unload { + struct vmbus_chanmsg_hdr chm_hdr; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Mon Jul 11 07:45:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 047ABB90454; Mon, 11 Jul 2016 07:45:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB0371C13; Mon, 11 Jul 2016 07:45:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B7jV8o073812; Mon, 11 Jul 2016 07:45:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7jVhY073811; Mon, 11 Jul 2016 07:45:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110745.u6B7jVhY073811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 07:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302556 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:45:33 -0000 Author: sephe Date: Mon Jul 11 07:45:31 2016 New Revision: 302556 URL: https://svnweb.freebsd.org/changeset/base/302556 Log: hyperv/vmbus: Create channel synchronously. The device probe/attach has been move to a different thread, so the reasons to create the channel asynchronously are no longer valid. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6862 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:35:58 2016 (r302555) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:45:31 2016 (r302556) @@ -39,7 +39,8 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_internal(void *context); +static void vmbus_channel_on_offer_internal( + const hv_vmbus_channel_offer_channel *offer); static void vmbus_channel_on_offer_rescind_internal(void *context); static void vmbus_channel_on_offer(struct vmbus_softc *, @@ -365,44 +366,27 @@ vmbus_channel_select_defcpu(struct hv_vm /** * @brief Handler for channel offers from Hyper-V/Azure * - * Handler for channel offers from vmbus in parent partition. We ignore - * all offers except network and storage offers. For each network and storage - * offers, we create a channel object and queue a work item to the channel - * object to process the offer synchronously + * Handler for channel offers from vmbus in parent partition. */ static void vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - const hv_vmbus_channel_offer_channel *offer; - hv_vmbus_channel_offer_channel *copied; - - offer = (const hv_vmbus_channel_offer_channel *)hdr; - - // copy offer data - copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT); - if (copied == NULL) { - printf("fail to allocate memory\n"); - return; - } - - memcpy(copied, hdr, sizeof(*copied)); - hv_queue_work_item(vmbus_channel_on_offer_internal, copied); mtx_lock(&vmbus_chwait_lock); if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) vmbus_chancnt++; mtx_unlock(&vmbus_chwait_lock); + + offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; + vmbus_channel_on_offer_internal(offer); } static void -vmbus_channel_on_offer_internal(void* context) +vmbus_channel_on_offer_internal(const hv_vmbus_channel_offer_channel *offer) { hv_vmbus_channel* new_channel; - hv_vmbus_channel_offer_channel* offer = (hv_vmbus_channel_offer_channel*)context; /* Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(); @@ -441,8 +425,6 @@ vmbus_channel_on_offer_internal(void* co vmbus_channel_select_defcpu(new_channel); vmbus_channel_process_offer(new_channel); - - free(offer, M_DEVBUF); } /** From owner-svn-src-head@freebsd.org Mon Jul 11 07:54:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9716DB906D0; Mon, 11 Jul 2016 07:54:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7495111DE; Mon, 11 Jul 2016 07:54:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B7sw4w077590; Mon, 11 Jul 2016 07:54:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B7swQ5077584; Mon, 11 Jul 2016 07:54:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110754.u6B7swQ5077584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 07:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302557 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 07:54:59 -0000 Author: sephe Date: Mon Jul 11 07:54:58 2016 New Revision: 302557 URL: https://svnweb.freebsd.org/changeset/base/302557 Log: hyperv/vmbus: Save vmbus softc to channels. So that we don't need to access the global vmbus softc. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6863 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 07:45:31 2016 (r302556) +++ head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 07:54:58 2016 (r302557) @@ -713,6 +713,7 @@ typedef struct { typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; + struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; hv_vmbus_channel_offer_channel offer_msg; /* Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 11 07:45:31 2016 (r302556) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 11 07:54:58 2016 (r302557) @@ -67,7 +67,7 @@ static void vmbus_channel_set_event(hv_vmbus_channel *channel) { if (channel->offer_msg.monitor_allocated) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = channel->vmbus_sc; hv_vmbus_monitor_page *monitor_page; uint32_t chanid = channel->offer_msg.child_rel_id; @@ -205,7 +205,7 @@ hv_vmbus_channel_open( vmbus_on_channel_open(new_channel); - new_channel->rxq = VMBUS_PCPU_GET(vmbus_get_softc(), event_tq, + new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:45:31 2016 (r302556) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 07:54:58 2016 (r302557) @@ -39,7 +39,8 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_internal( +static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); +static void vmbus_channel_on_offer_internal(struct vmbus_softc *, const hv_vmbus_channel_offer_channel *offer); static void vmbus_channel_on_offer_rescind_internal(void *context); @@ -131,15 +132,13 @@ hv_queue_work_item( /** * @brief Allocate and initialize a vmbus channel object */ -hv_vmbus_channel* -hv_vmbus_allocate_channel(void) +static struct hv_vmbus_channel * +hv_vmbus_allocate_channel(struct vmbus_softc *sc) { - hv_vmbus_channel* channel; + struct hv_vmbus_channel *channel; - channel = (hv_vmbus_channel*) malloc( - sizeof(hv_vmbus_channel), - M_DEVBUF, - M_WAITOK | M_ZERO); + channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO); + channel->vmbus_sc = sc; mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF); TAILQ_INIT(&channel->sc_list_anchor); @@ -297,7 +296,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } chan->target_cpu = cpu; - chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu); + chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -379,16 +378,17 @@ vmbus_channel_on_offer(struct vmbus_soft mtx_unlock(&vmbus_chwait_lock); offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; - vmbus_channel_on_offer_internal(offer); + vmbus_channel_on_offer_internal(sc, offer); } static void -vmbus_channel_on_offer_internal(const hv_vmbus_channel_offer_channel *offer) +vmbus_channel_on_offer_internal(struct vmbus_softc *sc, + const hv_vmbus_channel_offer_channel *offer) { hv_vmbus_channel* new_channel; /* Allocate the channel object and save this offer */ - new_channel = hv_vmbus_allocate_channel(); + new_channel = hv_vmbus_allocate_channel(sc); /* * By default we setup state to enable batched @@ -681,7 +681,7 @@ vmbus_select_outgoing_channel(struct hv_ return outgoing_channel; } - cur_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, smp_pro_id); + cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { if (new_channel->state != HV_CHANNEL_OPENED_STATE){ Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 07:45:31 2016 (r302556) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon Jul 11 07:54:58 2016 (r302557) @@ -204,7 +204,7 @@ int hv_vmbus_post_message(void *buffer, int hv_vmbus_set_event(hv_vmbus_channel *channel) { - struct vmbus_softc *sc = vmbus_get_softc(); + struct vmbus_softc *sc = channel->vmbus_sc; int ret = 0; uint32_t chanid = channel->offer_msg.child_rel_id; @@ -222,7 +222,7 @@ vmbus_on_channel_open(const struct hv_vm int flag_cnt; flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flags_cnt, + flag_cnt_ptr = VMBUS_PCPU_PTR(chan->vmbus_sc, event_flags_cnt, chan->target_cpu); for (;;) { Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 07:45:31 2016 (r302556) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Jul 11 07:54:58 2016 (r302557) @@ -395,7 +395,6 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -hv_vmbus_channel* hv_vmbus_allocate_channel(void); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); void hv_vmbus_release_unattached_channels(void); From owner-svn-src-head@freebsd.org Mon Jul 11 08:05:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87343B90C33; Mon, 11 Jul 2016 08:05:47 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62FD31ADF; Mon, 11 Jul 2016 08:05:47 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B85kCd081461; Mon, 11 Jul 2016 08:05:46 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B85k0Z081460; Mon, 11 Jul 2016 08:05:46 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201607110805.u6B85k0Z081460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Mon, 11 Jul 2016 08:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302558 - head/usr.bin/ul X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 08:05:47 -0000 Author: gahr (ports committer) Date: Mon Jul 11 08:05:46 2016 New Revision: 302558 URL: https://svnweb.freebsd.org/changeset/base/302558 Log: Do not truncate lines longer than 512 chars. PR: 210344 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6881 Modified: head/usr.bin/ul/ul.c Modified: head/usr.bin/ul/ul.c ============================================================================== --- head/usr.bin/ul/ul.c Mon Jul 11 07:54:58 2016 (r302557) +++ head/usr.bin/ul/ul.c Mon Jul 11 08:05:46 2016 (r302558) @@ -78,7 +78,9 @@ struct CHAR { int c_width; /* width or -1 if multi-column char. filler */ } ; -static struct CHAR obuf[MAXBUF]; +static struct CHAR sobuf[MAXBUF]; /* static output buffer */ +static struct CHAR *obuf = sobuf; +static int buflen = MAXBUF; static int col, maxcol; static int mode; static int halfpos; @@ -151,6 +153,9 @@ main(int argc, char **argv) else filter(f); } + if (obuf != sobuf) { + free(obuf); + } exit(0); } @@ -166,128 +171,148 @@ filter(FILE *f) { wint_t c; int i, w; + int copy; + + copy = 0; + + while ((c = getwc(f)) != WEOF) { + if (col == buflen) { + if (obuf == sobuf) { + obuf = NULL; + copy = 1; + } + obuf = realloc(obuf, sizeof(*obuf) * 2 * buflen); + if (obuf == NULL) { + obuf = sobuf; + break; + } else if (copy) { + memcpy(obuf, sobuf, sizeof(*obuf) * buflen); + copy = 0; + } + bzero((char *)(obuf + buflen), sizeof(*obuf) * buflen); + buflen *= 2; + } + switch(c) { + case '\b': + if (col > 0) + col--; + continue; - while ((c = getwc(f)) != WEOF && col < MAXBUF) switch(c) { + case '\t': + col = (col+8) & ~07; + if (col > maxcol) + maxcol = col; + continue; - case '\b': - if (col > 0) - col--; - continue; - - case '\t': - col = (col+8) & ~07; - if (col > maxcol) - maxcol = col; - continue; - - case '\r': - col = 0; - continue; - - case SO: - mode |= ALTSET; - continue; - - case SI: - mode &= ~ALTSET; - continue; - - case IESC: - switch (c = getwc(f)) { - - case HREV: - if (halfpos == 0) { - mode |= SUPERSC; - halfpos--; - } else if (halfpos > 0) { - mode &= ~SUBSC; - halfpos--; - } else { - halfpos = 0; - reverse(); - } + case '\r': + col = 0; continue; - case HFWD: - if (halfpos == 0) { - mode |= SUBSC; - halfpos++; - } else if (halfpos < 0) { - mode &= ~SUPERSC; - halfpos++; - } else { - halfpos = 0; - fwd(); - } + case SO: + mode |= ALTSET; continue; - case FREV: - reverse(); + case SI: + mode &= ~ALTSET; continue; - default: - errx(1, "unknown escape sequence in input: %o, %o", IESC, c); - } - continue; + case IESC: + switch (c = getwc(f)) { - case '_': - if (obuf[col].c_char || obuf[col].c_width < 0) { - while (col > 0 && obuf[col].c_width < 0) - col--; - w = obuf[col].c_width; - for (i = 0; i < w; i++) - obuf[col++].c_mode |= UNDERL | mode; + case HREV: + if (halfpos == 0) { + mode |= SUPERSC; + halfpos--; + } else if (halfpos > 0) { + mode &= ~SUBSC; + halfpos--; + } else { + halfpos = 0; + reverse(); + } + continue; + + case HFWD: + if (halfpos == 0) { + mode |= SUBSC; + halfpos++; + } else if (halfpos < 0) { + mode &= ~SUPERSC; + halfpos++; + } else { + halfpos = 0; + fwd(); + } + continue; + + case FREV: + reverse(); + continue; + + default: + errx(1, "unknown escape sequence in input: %o, %o", IESC, c); + } + continue; + + case '_': + if (obuf[col].c_char || obuf[col].c_width < 0) { + while (col > 0 && obuf[col].c_width < 0) + col--; + w = obuf[col].c_width; + for (i = 0; i < w; i++) + obuf[col++].c_mode |= UNDERL | mode; + if (col > maxcol) + maxcol = col; + continue; + } + obuf[col].c_char = '_'; + obuf[col].c_width = 1; + /* FALLTHROUGH */ + case ' ': + col++; if (col > maxcol) maxcol = col; continue; - } - obuf[col].c_char = '_'; - obuf[col].c_width = 1; - /* FALLTHROUGH */ - case ' ': - col++; - if (col > maxcol) - maxcol = col; - continue; - case '\n': - flushln(); - continue; + case '\n': + flushln(); + continue; - case '\f': - flushln(); - putwchar('\f'); - continue; + case '\f': + flushln(); + putwchar('\f'); + continue; - default: - if ((w = wcwidth(c)) <= 0) /* non printing */ + default: + if ((w = wcwidth(c)) <= 0) /* non printing */ + continue; + if (obuf[col].c_char == '\0') { + obuf[col].c_char = c; + for (i = 0; i < w; i++) + obuf[col + i].c_mode = mode; + obuf[col].c_width = w; + for (i = 1; i < w; i++) + obuf[col + i].c_width = -1; + } else if (obuf[col].c_char == '_') { + obuf[col].c_char = c; + for (i = 0; i < w; i++) + obuf[col + i].c_mode |= UNDERL|mode; + obuf[col].c_width = w; + for (i = 1; i < w; i++) + obuf[col + i].c_width = -1; + } else if ((wint_t)obuf[col].c_char == c) { + for (i = 0; i < w; i++) + obuf[col + i].c_mode |= BOLD|mode; + } else { + w = obuf[col].c_width; + for (i = 0; i < w; i++) + obuf[col + i].c_mode = mode; + } + col += w; + if (col > maxcol) + maxcol = col; continue; - if (obuf[col].c_char == '\0') { - obuf[col].c_char = c; - for (i = 0; i < w; i++) - obuf[col + i].c_mode = mode; - obuf[col].c_width = w; - for (i = 1; i < w; i++) - obuf[col + i].c_width = -1; - } else if (obuf[col].c_char == '_') { - obuf[col].c_char = c; - for (i = 0; i < w; i++) - obuf[col + i].c_mode |= UNDERL|mode; - obuf[col].c_width = w; - for (i = 1; i < w; i++) - obuf[col + i].c_width = -1; - } else if ((wint_t)obuf[col].c_char == c) { - for (i = 0; i < w; i++) - obuf[col + i].c_mode |= BOLD|mode; - } else { - w = obuf[col].c_width; - for (i = 0; i < w; i++) - obuf[col + i].c_mode = mode; } - col += w; - if (col > maxcol) - maxcol = col; - continue; } if (ferror(f)) err(1, NULL); @@ -405,7 +430,7 @@ static void initbuf(void) { - bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */ + bzero((char *)obuf, buflen * sizeof(*obuf)); /* depends on NORMAL == 0 */ col = 0; maxcol = 0; mode &= ALTSET; From owner-svn-src-head@freebsd.org Mon Jul 11 08:12:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D48AB910B1; Mon, 11 Jul 2016 08:12:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F40F01F17; Mon, 11 Jul 2016 08:12:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B8C5QN084500; Mon, 11 Jul 2016 08:12:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B8C580084498; Mon, 11 Jul 2016 08:12:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607110812.u6B8C580084498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 11 Jul 2016 08:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302559 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 08:12:06 -0000 Author: sephe Date: Mon Jul 11 08:12:04 2016 New Revision: 302559 URL: https://svnweb.freebsd.org/changeset/base/302559 Log: hyperv/vmbus: Embed channel detach task in channel itself. GC work queue stuffs. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6864 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 08:05:46 2016 (r302558) +++ head/sys/dev/hyperv/include/hyperv.h Mon Jul 11 08:12:04 2016 (r302559) @@ -809,6 +809,8 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv1; void *hv_chan_priv2; void *hv_chan_priv3; + + struct task ch_detach_task; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 08:05:46 2016 (r302558) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 08:12:04 2016 (r302559) @@ -42,7 +42,7 @@ typedef void (*vmbus_chanmsg_proc_t) static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); static void vmbus_channel_on_offer_internal(struct vmbus_softc *, const hv_vmbus_channel_offer_channel *offer); -static void vmbus_channel_on_offer_rescind_internal(void *context); +static void vmbus_chan_detach_task(void *, int); static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); @@ -80,12 +80,6 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE vmbus_channel_on_version_response }; -typedef struct hv_work_item { - struct task work; - void (*callback)(void *); - void* context; -} hv_work_item; - static struct mtx vmbus_chwait_lock; MTX_SYSINIT(vmbus_chwait_lk, &vmbus_chwait_lock, "vmbus primarych wait lock", MTX_DEF); @@ -95,41 +89,6 @@ static uint32_t vmbus_devcnt; #define VMBUS_CHANCNT_DONE 0x80000000 /** - * Implementation of the work abstraction. - */ -static void -work_item_callback(void *work, int pending) -{ - struct hv_work_item *w = (struct hv_work_item *)work; - - w->callback(w->context); - - free(w, M_DEVBUF); -} - -/** - * @brief Create work item - */ -static int -hv_queue_work_item( - void (*callback)(void *), void *context) -{ - struct hv_work_item *w = malloc(sizeof(struct hv_work_item), - M_DEVBUF, M_NOWAIT); - KASSERT(w != NULL, ("Error VMBUS: Failed to allocate WorkItem\n")); - if (w == NULL) - return (ENOMEM); - - w->callback = callback; - w->context = context; - - TASK_INIT(&w->work, 0, work_item_callback, w); - - return (taskqueue_enqueue(taskqueue_thread, &w->work)); -} - - -/** * @brief Allocate and initialize a vmbus channel object */ static struct hv_vmbus_channel * @@ -142,6 +101,7 @@ hv_vmbus_allocate_channel(struct vmbus_s mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF); TAILQ_INIT(&channel->sc_list_anchor); + TASK_INIT(&channel->ch_detach_task, 0, vmbus_chan_detach_task, channel); return (channel); } @@ -431,37 +391,35 @@ vmbus_channel_on_offer_internal(struct v * @brief Rescind offer handler. * * We queue a work item to process this offer - * synchronously + * synchronously. + * + * XXX pretty broken; need rework. */ static void vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - const hv_vmbus_channel_rescind_offer *rescind; hv_vmbus_channel* channel; - rescind = (const hv_vmbus_channel_rescind_offer *)hdr; + rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; if (channel == NULL) return; - - hv_queue_work_item(vmbus_channel_on_offer_rescind_internal, channel); hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL; + + taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); } static void -vmbus_channel_on_offer_rescind_internal(void *context) +vmbus_chan_detach_task(void *xchan, int pending __unused) { - hv_vmbus_channel* channel; + struct hv_vmbus_channel *chan = xchan; - channel = (hv_vmbus_channel*)context; - if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { + if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the hv_device */ - hv_vmbus_child_device_unregister(channel->device); + hv_vmbus_child_device_unregister(chan->device); } } From owner-svn-src-head@freebsd.org Mon Jul 11 08:24:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83C24B914F3; Mon, 11 Jul 2016 08:24:05 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 338201964; Mon, 11 Jul 2016 08:24:05 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6B8O4Ki088916; Mon, 11 Jul 2016 08:24:04 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6B8O4KD088915; Mon, 11 Jul 2016 08:24:04 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201607110824.u6B8O4KD088915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 11 Jul 2016 08:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302560 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 08:24:05 -0000 Author: mmel Date: Mon Jul 11 08:24:04 2016 New Revision: 302560 URL: https://svnweb.freebsd.org/changeset/base/302560 Log: OFWPCI: Fix style(9). No functional change. MFC after: 3 weeks Modified: head/sys/dev/ofw/ofwpci.c Modified: head/sys/dev/ofw/ofwpci.c ============================================================================== --- head/sys/dev/ofw/ofwpci.c Mon Jul 11 08:12:04 2016 (r302559) +++ head/sys/dev/ofw/ofwpci.c Mon Jul 11 08:24:04 2016 (r302560) @@ -195,7 +195,7 @@ ofw_pci_init(device_t dev) sc->sc_io_rman.rm_type = RMAN_ARRAY; sc->sc_io_rman.rm_descr = "PCI I/O Ports"; error = rman_init(&sc->sc_io_rman); - if (error) { + if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } @@ -203,7 +203,7 @@ ofw_pci_init(device_t dev) sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "PCI Memory"; error = rman_init(&sc->sc_mem_rman); - if (error) { + if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } @@ -226,7 +226,7 @@ ofw_pci_init(device_t dev) break; } - if (error) { + if (error != 0) { device_printf(dev, "rman_manage_region(%x, %#jx, %#jx) failed. " "error = %d\n", rp->pci_hi & @@ -257,7 +257,7 @@ ofw_pci_attach(device_t dev) sc = device_get_softc(dev); if (!sc->sc_initialized) { error = ofw_pci_init(dev); - if (error) + if (error != 0) return (error); } @@ -437,9 +437,11 @@ ofw_pci_release_resource(device_t bus, d { if (rman_get_flags(res) & RF_ACTIVE) { - int error = bus_deactivate_resource(child, type, rid, res); - if (error) - return error; + int error; + + error = bus_deactivate_resource(child, type, rid, res); + if (error != 0) + return (error); } return (rman_release_resource(res)); @@ -544,9 +546,10 @@ static int ofw_pci_adjust_resource(device_t bus, device_t child, int type, struct resource *res, rman_res_t start, rman_res_t end) { - struct rman *rm = NULL; - struct ofw_pci_softc *sc = device_get_softc(bus); + struct rman *rm; + struct ofw_pci_softc *sc; + sc = device_get_softc(bus); KASSERT(!(rman_get_flags(res) & RF_ACTIVE), ("active resources cannot be adjusted")); if (rman_get_flags(res) & RF_ACTIVE) From owner-svn-src-head@freebsd.org Mon Jul 11 12:45:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F335FB91A54; Mon, 11 Jul 2016 12:44:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C03211AFD; Mon, 11 Jul 2016 12:44:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BCiwPk087743; Mon, 11 Jul 2016 12:44:58 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BCiwbu087742; Mon, 11 Jul 2016 12:44:58 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201607111244.u6BCiwbu087742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 11 Jul 2016 12:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302561 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 12:45:00 -0000 Author: ae Date: Mon Jul 11 12:44:58 2016 New Revision: 302561 URL: https://svnweb.freebsd.org/changeset/base/302561 Log: Flush buffer after output. This fixes adding new data to already printed flows. PR: 210882 MFC after: 3 days Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Mon Jul 11 08:24:04 2016 (r302560) +++ head/sbin/ipfw/dummynet.c Mon Jul 11 12:44:58 2016 (r302561) @@ -612,6 +612,7 @@ list_pipes(struct dn_id *oid, struct dn_ } list_flow(&bp, (struct dn_flow *)oid); printf("%s\n", bp.buf); + bp_flush(&bp); break; case DN_LINK: { From owner-svn-src-head@freebsd.org Mon Jul 11 13:06:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C84FB83641; Mon, 11 Jul 2016 13:06:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EED11148; Mon, 11 Jul 2016 13:06:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BD6H9R095199; Mon, 11 Jul 2016 13:06:17 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BD6HxT095198; Mon, 11 Jul 2016 13:06:17 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201607111306.u6BD6HxT095198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Mon, 11 Jul 2016 13:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302564 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 13:06:18 -0000 Author: rwatson Date: Mon Jul 11 13:06:17 2016 New Revision: 302564 URL: https://svnweb.freebsd.org/changeset/base/302564 Log: Add AUE_WAIT6 handling to the BSM conversion switch statement, reusing the BSM encoding used for AUE_WAIT4. MFC after: 3 days Sponsored by: DARPA, AFRL Modified: head/sys/security/audit/audit_bsm.c Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Mon Jul 11 13:01:42 2016 (r302563) +++ head/sys/security/audit/audit_bsm.c Mon Jul 11 13:06:17 2016 (r302564) @@ -1606,6 +1606,7 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_WAIT4: + case AUE_WAIT6: PROCESS_PID_TOKENS(1); if (ARG_IS_VALID(kar, ARG_VALUE)) { tok = au_to_arg32(3, "options", ar->ar_arg_value); From owner-svn-src-head@freebsd.org Mon Jul 11 13:41:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 783E9B841D8; Mon, 11 Jul 2016 13:41:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48AE415E2; Mon, 11 Jul 2016 13:41:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BDfeoH008173; Mon, 11 Jul 2016 13:41:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BDfeuP008172; Mon, 11 Jul 2016 13:41:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607111341.u6BDfeuP008172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 11 Jul 2016 13:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302565 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 13:41:41 -0000 Author: cy Date: Mon Jul 11 13:41:40 2016 New Revision: 302565 URL: https://svnweb.freebsd.org/changeset/base/302565 Log: r302561 broke buildworld. This patch fixes that. MFC after: 3 days X-MFC with: r302561 Modified: head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Jul 11 13:06:17 2016 (r302564) +++ head/sbin/ipfw/ipfw2.h Mon Jul 11 13:41:40 2016 (r302565) @@ -371,6 +371,9 @@ void fill_unreach6_code(u_short *codep, void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen); int fill_ext6hdr(struct _ipfw_insn *cmd, char *av); +/* ipfw2.c */ +void bp_flush(struct buf_pr *b); + /* tables.c */ struct _ipfw_obj_ctlv; int table_check_name(const char *tablename); From owner-svn-src-head@freebsd.org Mon Jul 11 14:07:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47151B85A1A; Mon, 11 Jul 2016 14:07:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 163A2125C; Mon, 11 Jul 2016 14:07:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BE7O1F018757; Mon, 11 Jul 2016 14:07:24 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BE7OQf018756; Mon, 11 Jul 2016 14:07:24 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607111407.u6BE7OQf018756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 11 Jul 2016 14:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302566 - head/release/doc/share/xml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 14:07:25 -0000 Author: gjb Date: Mon Jul 11 14:07:24 2016 New Revision: 302566 URL: https://svnweb.freebsd.org/changeset/base/302566 Log: Fix the naming of -CURRENT Sponsored by: The FreeBSD Foundation Modified: head/release/doc/share/xml/release.ent Modified: head/release/doc/share/xml/release.ent ============================================================================== --- head/release/doc/share/xml/release.ent Mon Jul 11 13:41:40 2016 (r302565) +++ head/release/doc/share/xml/release.ent Mon Jul 11 14:07:24 2016 (r302566) @@ -6,17 +6,17 @@ - + - + - + From owner-svn-src-head@freebsd.org Mon Jul 11 14:19:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DA5BB85EBF; Mon, 11 Jul 2016 14:19:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 383141954; Mon, 11 Jul 2016 14:19:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BEJ9fX022417; Mon, 11 Jul 2016 14:19:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BEJ9sU022415; Mon, 11 Jul 2016 14:19:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607111419.u6BEJ9sU022415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Jul 2016 14:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302567 - in head/sys: kern vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 14:19:10 -0000 Author: kib Date: Mon Jul 11 14:19:09 2016 New Revision: 302567 URL: https://svnweb.freebsd.org/changeset/base/302567 Log: In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called, if vnode is VMIO. For VMIO vnodes, set BO_DEAD in vm_object_terminate(). The vnode_destroy_object(), when calling into vm_object_terminate(), must be able to flush buffers. BO_DEAD purpose is to quickly destroy buffers on write when the underlying vnode is not operable any more (one example is the devfs node after geom is gone). Setting BO_DEAD for reclaiming vnode before object is terminated is premature, and results in unability to flush buffers with live SU dependencies from vinvalbuf() in vm_object_terminate(). Reported by: David Cross Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c head/sys/vm/vm_object.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Jul 11 14:07:24 2016 (r302566) +++ head/sys/kern/vfs_subr.c Mon Jul 11 14:19:09 2016 (r302567) @@ -3232,7 +3232,13 @@ vgonel(struct vnode *vp) TAILQ_EMPTY(&vp->v_bufobj.bo_clean.bv_hd) && vp->v_bufobj.bo_clean.bv_cnt == 0, ("vp %p bufobj not invalidated", vp)); - vp->v_bufobj.bo_flag |= BO_DEAD; + + /* + * For VMIO bufobj, BO_DEAD is set in vm_object_terminate() + * after the object' page queue is flushed. + */ + if (vp->v_bufobj.bo_object == NULL) + vp->v_bufobj.bo_flag |= BO_DEAD; BO_UNLOCK(&vp->v_bufobj); /* Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Jul 11 14:07:24 2016 (r302566) +++ head/sys/vm/vm_object.c Mon Jul 11 14:19:09 2016 (r302567) @@ -741,6 +741,10 @@ vm_object_terminate(vm_object_t object) vinvalbuf(vp, V_SAVE, 0, 0); + BO_LOCK(&vp->v_bufobj); + vp->v_bufobj.bo_flag |= BO_DEAD; + BO_UNLOCK(&vp->v_bufobj); + VM_OBJECT_WLOCK(object); } From owner-svn-src-head@freebsd.org Mon Jul 11 15:12:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 815DDB8FFA6; Mon, 11 Jul 2016 15:12:59 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com [209.85.214.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55DFB17C2; Mon, 11 Jul 2016 15:12:58 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f41.google.com with SMTP id f6so56203134ith.1; Mon, 11 Jul 2016 08:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=zu8qwczNp47AnqjtnjUrVJaOYo824qdNTkDEofnkBW8=; b=MceeyWp+FApvosmXAx5AXOtHbsCaJa9eCFAG/XNi/HJi8XTDUEwdC+SZFJLpqhkltb rK3C0h0JWRuBKUxlxe8jUsX0Kz1RdhWMt86t/iKisjMOA6v+rhpV8Csh4k5xV1JXXmQo H+6A8/BKbe3G4dW4VFJWYKgNi+oFeO4LqYo3yDclooZSAgDKQiZBjIddZkJLFAaQ5lCp invl4gDMYRfFmcoFaEHellX0VD2nQXgWHL3HY4QqhHbqb366FjA1XzWEKqH0Xk3pVauy 9eibcLgFeZdfjIafHrTLXegaWsLXE8QQH/kxWgSzoBYk15s7KiHQckXqgrHSFSM4SxAS bptw== X-Gm-Message-State: ALyK8tJGKi3DA++vD1fhYJrPQuAnaTF2Pd0CYwaHCNfi3tA4yayBxW+WDN1UtRFlxu09hg== X-Received: by 10.36.142.129 with SMTP id h123mr16397605ite.66.1468249971846; Mon, 11 Jul 2016 08:12:51 -0700 (PDT) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com. [209.85.223.182]) by smtp.gmail.com with ESMTPSA id o133sm891457ioo.10.2016.07.11.08.12.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2016 08:12:51 -0700 (PDT) Received: by mail-io0-f182.google.com with SMTP id 38so9069927iol.0; Mon, 11 Jul 2016 08:12:51 -0700 (PDT) X-Received: by 10.107.38.76 with SMTP id m73mr23965393iom.7.1468249971399; Mon, 11 Jul 2016 08:12:51 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.206.2 with HTTP; Mon, 11 Jul 2016 08:12:51 -0700 (PDT) In-Reply-To: <201607110658.u6B6wOhi055529@repo.freebsd.org> References: <201607110658.u6B6wOhi055529@repo.freebsd.org> From: Conrad Meyer Date: Mon, 11 Jul 2016 08:12:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r302550 - head/sys/rpc To: Garrett Cooper Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:12:59 -0000 On Sun, Jul 10, 2016 at 11:58 PM, Garrett Cooper wrote: > Author: ngie > Date: Mon Jul 11 06:58:24 2016 > New Revision: 302550 > URL: https://svnweb.freebsd.org/changeset/base/302550 > > Log: ... > MFC after: 1 week > Reported by: Coverity > CID: 1007033, 1007344 > Sponsored by: EMC / Isilon Storage Division FYI, your svn commit message editor appears to be eating the tabs from the commit template. Best, Conrad From owner-svn-src-head@freebsd.org Mon Jul 11 15:47:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F7B5B92631; Mon, 11 Jul 2016 15:47:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7099C1B33; Mon, 11 Jul 2016 15:47:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BFlhZK055911; Mon, 11 Jul 2016 15:47:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BFlhO8055910; Mon, 11 Jul 2016 15:47:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111547.u6BFlhO8055910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 15:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302571 - head/sys/dev/drm2/radeon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:47:44 -0000 Author: ngie Date: Mon Jul 11 15:47:43 2016 New Revision: 302571 URL: https://svnweb.freebsd.org/changeset/base/302571 Log: Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix -Wredundant-decls warning MFC after: 1 week PR: 209924 Reported by: Mark Millard Tested with: devel/amd64-gcc (5.3.0) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/radeon/radeon_acpi.c Modified: head/sys/dev/drm2/radeon/radeon_acpi.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_acpi.c Mon Jul 11 15:33:49 2016 (r302570) +++ head/sys/dev/drm2/radeon/radeon_acpi.c Mon Jul 11 15:47:43 2016 (r302571) @@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$"); #define ACPI_AC_CLASS "ac_adapter" -extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev); - struct atif_verify_interface { u16 size; /* structure size in bytes (includes size field) */ u16 version; /* version */ From owner-svn-src-head@freebsd.org Mon Jul 11 15:50:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7561B926CF; Mon, 11 Jul 2016 15:50:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A664B1CEA; Mon, 11 Jul 2016 15:50:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BFo6xZ056077; Mon, 11 Jul 2016 15:50:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BFo6RX056076; Mon, 11 Jul 2016 15:50:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111550.u6BFo6RX056076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 15:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302572 - head/sys/dev/drm2/i915 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:50:07 -0000 Author: ngie Date: Mon Jul 11 15:50:06 2016 New Revision: 302572 URL: https://svnweb.freebsd.org/changeset/base/302572 Log: Remove redundant declarations for intel_fbc_enabled(..) and i915_gem_dump_object(..) to fix -Wredundant-decls warning MFC after: 1 week PR: 209924 Reported by: Mark Millard Tested with: devel/amd64-gcc (5.3.0) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/i915/i915_drv.h Modified: head/sys/dev/drm2/i915/i915_drv.h ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.h Mon Jul 11 15:47:43 2016 (r302571) +++ head/sys/dev/drm2/i915/i915_drv.h Mon Jul 11 15:50:06 2016 (r302572) @@ -1618,8 +1618,6 @@ int i915_verify_lists(struct drm_device #endif void i915_gem_object_check_coherency(struct drm_i915_gem_object *obj, int handle); -void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len, - const char *where, uint32_t mark); /* i915_suspend.c */ extern int i915_save_state(struct drm_device *dev); @@ -1673,7 +1671,6 @@ extern void intel_modeset_cleanup(struct extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); extern void intel_modeset_setup_hw_state(struct drm_device *dev, bool force_restore); -extern bool intel_fbc_enabled(struct drm_device *dev); extern void intel_disable_fbc(struct drm_device *dev); extern bool ironlake_set_drps(struct drm_device *dev, u8 val); extern void intel_init_pch_refclk(struct drm_device *dev); From owner-svn-src-head@freebsd.org Mon Jul 11 15:52:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EF58B9283F; Mon, 11 Jul 2016 15:52:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48B63132F; Mon, 11 Jul 2016 15:52:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BFqqoC059524; Mon, 11 Jul 2016 15:52:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BFqqH2059523; Mon, 11 Jul 2016 15:52:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607111552.u6BFqqH2059523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Jul 2016 15:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302573 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 15:52:53 -0000 Author: kib Date: Mon Jul 11 15:52:52 2016 New Revision: 302573 URL: https://svnweb.freebsd.org/changeset/base/302573 Log: Fill tf_trapno for trap frames created for syscall. If tf_trapno contains garbage which appears to be equal to T_NMI, e.g. due to thread previously entered kernel due to NMI, doreti sequence skips ast, and does so until a trap or hardware interrupt occur. The visible effects of the issue are quite confusing. First, signals delivery is postponed in observable ways. In particular, the guarantee that unblocked async signals queue is flushed before a return from syscall, is broken. Second, if there are pending signals, all interruptible sleeps of the stuck thread are aborted immediately. Since modern CPUs are relatively fast and tickless kernel generates low interrupt rate, the faulty condition might exist for long time (in an application time scale). In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Mon Jul 11 15:50:06 2016 (r302572) +++ head/sys/i386/i386/exception.s Mon Jul 11 15:52:52 2016 (r302573) @@ -234,7 +234,7 @@ IDTVEC(lcall_syscall) pushfl /* save eflags */ popl 8(%esp) /* shuffle into tf_eflags */ pushl $7 /* sizeof "lcall 7,0" */ - subl $4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw %ds,(%esp) @@ -263,7 +263,7 @@ IDTVEC(lcall_syscall) SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ - subl $4,%esp /* skip over tf_trapno */ + pushl $0 /* tf_trapno */ pushal pushl $0 movw %ds,(%esp) From owner-svn-src-head@freebsd.org Mon Jul 11 16:52:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9274B92121; Mon, 11 Jul 2016 16:52:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB85D12ED; Mon, 11 Jul 2016 16:52:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BGq4Ei081231; Mon, 11 Jul 2016 16:52:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BGq43L081230; Mon, 11 Jul 2016 16:52:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111652.u6BGq43L081230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 16:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302574 - head/sys/dev/cxgb/ulp/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 16:52:06 -0000 Author: ngie Date: Mon Jul 11 16:52:04 2016 New Revision: 302574 URL: https://svnweb.freebsd.org/changeset/base/302574 Log: Remove redundant declaration for tcp_dooptions netinet/tcp_var.h already defines this function PR: 209924 Reported by: Mark Millard Reviewed by: np Tested with: clang 3.8.0, gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 15:52:52 2016 (r302573) +++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:52:04 2016 (r302574) @@ -922,9 +922,6 @@ t3_syncache_removed(struct toedev *tod _ release_synqe(synqe); } -/* XXX */ -extern void tcp_dooptions(struct tcpopt *, u_char *, int, int); - int t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m) { From owner-svn-src-head@freebsd.org Mon Jul 11 16:52:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 384EEB9216E; Mon, 11 Jul 2016 16:52:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08BAC14EF; Mon, 11 Jul 2016 16:52:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x235.google.com with SMTP id c2so38122887pfa.2; Mon, 11 Jul 2016 09:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=0lNmg2mKGGdnadsESlFvVdAvjdRlbe/b33Ph66oBuuk=; b=PQ5c9eqLG/Wp607c0tleuoW0cf00xpMrde0m1qebVj0NYoB0+r9OfrumhGapg9Fy3r bC0qXfcgbfL6l7PHu+vFOzpFLHpBkmUUfUgSZmqR+VBLG2dbrRQCct/yVVji0ivxhBlI iNYTuo5HqEB+m78/aDw5IVwiTHXw4aZ6WyF00h9z4n0NlSmN/Ya7nvN4cZ3CUECdkuGJ ngBxZF+d+JU7crnwxSmKnGv4A92W7OuOHWxtOLy7l7kQopJAegw7IW8j5bQMFkykL+bG tyhMmnd2uViIcCsyIn6iCTsqNkSF+sdYLE+FI6i+aI1lrVTKDhr5W0sM6FCy4/PEpeuH LGfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=0lNmg2mKGGdnadsESlFvVdAvjdRlbe/b33Ph66oBuuk=; b=PujgfQQnTbsspcZVDpQ41XlQalTy85QBNmpHzvtndgMpZ4QwrNArBoHXZMj9FQ1LU3 0Q6on01sY3RhiJwM/nQps5nVtI5fbIqEyW/p+2DoUDTTrC5hW2j/UkQyyWYKpue2i1ox LFG1EkoavaVfFNk3fsG4moOC0eeaYigPeQ6f/YNie7ruiVgagTeruH3gangyv5EMVYRl 1SUbrEp1DeVw/ISg63qXaEpwcq9OkSzj942YrwQOBs6vPGkLeKmgUH6oCk5ntSZFmjzq 9xN7u0zJvpCYr3yHUjoW40ftZeLMLRQYroz0bcC0sAXQuQmBjtyswtYYcAepoCUcbqyW bkNQ== X-Gm-Message-State: ALyK8tLEaVJdUGMw9UCr7iKxqYR8FeJOHAyvXmnXJUWiXiPmp+ZSy/UCgPMT2xH/RGEp/g== X-Received: by 10.98.23.134 with SMTP id 128mr13227071pfx.96.1468255961053; Mon, 11 Jul 2016 09:52:41 -0700 (PDT) Received: from [192.168.20.9] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id r7sm5436963pfa.3.2016.07.11.09.52.37 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jul 2016 09:52:38 -0700 (PDT) Subject: Re: svn commit: r302574 - head/sys/dev/cxgb/ulp/tom Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_7AB8724C-AC73-463B-B8F3-FF06E5C05303"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201607111652.u6BGq43L081230@repo.freebsd.org> Date: Mon, 11 Jul 2016 09:52:36 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <0C4D38A9-2983-4DD0-B518-E4BDC51583A6@gmail.com> References: <201607111652.u6BGq43L081230@repo.freebsd.org> To: Garrett Cooper X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 16:52:42 -0000 --Apple-Mail=_7AB8724C-AC73-463B-B8F3-FF06E5C05303 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Jul 11, 2016, at 09:52, Garrett Cooper wrote: > > Author: ngie > Date: Mon Jul 11 16:52:04 2016 > New Revision: 302574 > URL: https://svnweb.freebsd.org/changeset/base/302574 > > Log: > Remove redundant declaration for tcp_dooptions > > netinet/tcp_var.h already defines this function > > PR: 209924 > Reported by: Mark Millard > Reviewed by: np > Tested with: clang 3.8.0, gcc 4.2.1, gcc 5.3.0 > Sponsored by: EMC / Isilon Storage Division Also: MFC after: 1 week --Apple-Mail=_7AB8724C-AC73-463B-B8F3-FF06E5C05303 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXg87VAAoJEPWDqSZpMIYVyqYP/2pkdnJfKGKfQ4vKH51PuZQ6 Lh/rQzKzjb5PMUqfxlE6lVjosgwSsS2oFPqSVBULsjCzrMhuris2Y4E1EsGX+iDV aTea8QFDmA5Gmd0XpzcT4bARl14bGVLujLv0q9QtGIBwaRW4MLQwZ1n/HvsnPu05 Xkghq+23sqgFIe6AUntGc6G/uirnM/2/hDH2mhSN8CkbyVEczcXhkLnxcP3rzFw1 T67AIBnLzALWdFjFqPBYYGlMeVCfz/LC3VVVqNY1QC6Cc+SV8/5UHygZwMcM8K0P r23Ncg9/5Q5Db4G72xuoxx1ZTvOWBwuVGJA8V7ymKQyqAi/j0XhCfP0GlBCFLL0N FFfxWJyTOLMmeDW9Z5Qwy1q5+B1w/dljrlCPqXN1nM0zgEmzAk6rA/zPevk1MItW 2nXixC1WeK6iU90O6/N172lqBGjWVef0ln5oDSDYriCzThn/0GQGPJqXyd2v1rjv jE1HM/IDjInHfWaNtfEVlRHpPlLlsAJ1aw/1Wm56qOVaqRI4FVXpMVFzRSY3821w 5ZghK9w3H6GGOK9Je6ND+/W8EgMjr3653HpKCl0sfGJPjT4nb9pV7fbix6WhvdD1 8Y5OOrP4zjtxU5kP5GiX2MJlqayryWEqs3IXh7CDcqrS7qQA15udfWNAsoOcz6o/ PZHiVqqZ+xcNT3bXXwW9 =+xTf -----END PGP SIGNATURE----- --Apple-Mail=_7AB8724C-AC73-463B-B8F3-FF06E5C05303-- From owner-svn-src-head@freebsd.org Mon Jul 11 16:54:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB7B0B92210; Mon, 11 Jul 2016 16:54:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A39C316CD; Mon, 11 Jul 2016 16:54:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BGsJkQ082043; Mon, 11 Jul 2016 16:54:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BGsJ4O082042; Mon, 11 Jul 2016 16:54:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111654.u6BGsJ4O082042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 16:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302575 - head/sys/dev/cxgb/ulp/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 16:54:21 -0000 Author: ngie Date: Mon Jul 11 16:54:19 2016 New Revision: 302575 URL: https://svnweb.freebsd.org/changeset/base/302575 Log: Revert r302574. I botched the commit message in more way than 1 Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:52:04 2016 (r302574) +++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:54:19 2016 (r302575) @@ -922,6 +922,9 @@ t3_syncache_removed(struct toedev *tod _ release_synqe(synqe); } +/* XXX */ +extern void tcp_dooptions(struct tcpopt *, u_char *, int, int); + int t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m) { From owner-svn-src-head@freebsd.org Mon Jul 11 16:56:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE9C9B92395; Mon, 11 Jul 2016 16:56:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B61E1AEE; Mon, 11 Jul 2016 16:56:52 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BGupa1082197; Mon, 11 Jul 2016 16:56:51 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BGupJn082196; Mon, 11 Jul 2016 16:56:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111656.u6BGupJn082196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 16:56:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302576 - head/sys/dev/cxgb/ulp/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 16:56:52 -0000 Author: ngie Date: Mon Jul 11 16:56:51 2016 New Revision: 302576 URL: https://svnweb.freebsd.org/changeset/base/302576 Log: (Re-do r302574 with corrected commit message..) Remove redundant declaration for tcp_dooptions netinet/tcp_var.h already defines this function Differential Revision: https://reviews.freebsd.org/D7187 MFC after: 1 week PR: 209920 Reported by: Mark Millard Reviewed by: np Tested with: clang 3.8.0, gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:54:19 2016 (r302575) +++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Mon Jul 11 16:56:51 2016 (r302576) @@ -922,9 +922,6 @@ t3_syncache_removed(struct toedev *tod _ release_synqe(synqe); } -/* XXX */ -extern void tcp_dooptions(struct tcpopt *, u_char *, int, int); - int t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m) { From owner-svn-src-head@freebsd.org Mon Jul 11 17:01:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CF3FB92475; Mon, 11 Jul 2016 17:01:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE7371D7D; Mon, 11 Jul 2016 17:01:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BH181S083053; Mon, 11 Jul 2016 17:01:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BH189R083052; Mon, 11 Jul 2016 17:01:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111701.u6BH189R083052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 17:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302577 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 17:01:09 -0000 Author: ngie Date: Mon Jul 11 17:01:07 2016 New Revision: 302577 URL: https://svnweb.freebsd.org/changeset/base/302577 Log: Add missing default case to capable(..) function definition By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN aren't possible. Add in a KASSERT safety belt and return false in !INVARIANTS case if an invalid value is passed in, as it would be a programmer error. This fixes a -Wreturn-type error with gcc 5.3.0. Differential Revision: https://reviews.freebsd.org/D7188 MFC after: 1 week Reported by: devel/amd64-gcc (5.3.0) Reviewed by: dumbbell Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/drm_os_freebsd.h Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Mon Jul 11 16:56:51 2016 (r302576) +++ head/sys/dev/drm2/drm_os_freebsd.h Mon Jul 11 17:01:07 2016 (r302577) @@ -438,6 +438,10 @@ capable(enum __drm_capabilities cap) switch (cap) { case CAP_SYS_ADMIN: return DRM_SUSER(curthread); + default: + KASSERT(false, + ("%s: unhandled capability: %0x", __func__, cap)); + return (false); } } From owner-svn-src-head@freebsd.org Mon Jul 11 17:02:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0055FB92584; Mon, 11 Jul 2016 17:02:19 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A41B211CC; Mon, 11 Jul 2016 17:02:18 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BH2Hig085758; Mon, 11 Jul 2016 17:02:17 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BH2Hqh085757; Mon, 11 Jul 2016 17:02:17 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607111702.u6BH2Hqh085757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 17:02:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302578 - head/sys/powerpc/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 17:02:19 -0000 Author: nwhitehorn Date: Mon Jul 11 17:02:17 2016 New Revision: 302578 URL: https://svnweb.freebsd.org/changeset/base/302578 Log: Remove dead code. This should have been removed in r297392, when these files were moved to dev/ofw, but wasn't, apparently due to some version control issue. MFC after: 1 week Deleted: head/sys/powerpc/ofw/ofw_pci.c head/sys/powerpc/ofw/ofw_pci.h From owner-svn-src-head@freebsd.org Mon Jul 11 17:04:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 431A7B926B8; Mon, 11 Jul 2016 17:04:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15FA41639; Mon, 11 Jul 2016 17:04:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BH4Mop085978; Mon, 11 Jul 2016 17:04:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BH4M3m085977; Mon, 11 Jul 2016 17:04:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607111704.u6BH4M3m085977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 11 Jul 2016 17:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302580 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 17:04:23 -0000 Author: kib Date: Mon Jul 11 17:04:22 2016 New Revision: 302580 URL: https://svnweb.freebsd.org/changeset/base/302580 Log: Fix grammar. Submitted by: alc MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Jul 11 17:03:35 2016 (r302579) +++ head/sys/kern/vfs_subr.c Mon Jul 11 17:04:22 2016 (r302580) @@ -3235,7 +3235,7 @@ vgonel(struct vnode *vp) /* * For VMIO bufobj, BO_DEAD is set in vm_object_terminate() - * after the object' page queue is flushed. + * after the object's page queue is flushed. */ if (vp->v_bufobj.bo_object == NULL) vp->v_bufobj.bo_flag |= BO_DEAD; From owner-svn-src-head@freebsd.org Mon Jul 11 17:11:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 046E6B9297B; Mon, 11 Jul 2016 17:11:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C95A71B68; Mon, 11 Jul 2016 17:11:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BHBJVp086933; Mon, 11 Jul 2016 17:11:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BHBJfT086932; Mon, 11 Jul 2016 17:11:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607111711.u6BHBJfT086932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 11 Jul 2016 17:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302581 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 17:11:20 -0000 Author: ngie Date: Mon Jul 11 17:11:18 2016 New Revision: 302581 URL: https://svnweb.freebsd.org/changeset/base/302581 Log: Remove redundant declaration for tcp_dooptions, similar to r302576 netinet/tcp_var.h already defines this function Differential Revision: https://reviews.freebsd.org/D7189 MFC after: 1 week PR: 209920 Reported by: Mark Millard Reviewed by: np Tested with: clang 3.8.0, gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Mon Jul 11 17:04:22 2016 (r302580) +++ head/sys/dev/cxgbe/tom/t4_listen.c Mon Jul 11 17:11:18 2016 (r302581) @@ -665,9 +665,6 @@ t4_syncache_removed(struct toedev *tod _ release_synqe(synqe); } -/* XXX */ -extern void tcp_dooptions(struct tcpopt *, u_char *, int, int); - int t4_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m) { From owner-svn-src-head@freebsd.org Mon Jul 11 19:58:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4437CB9240F; Mon, 11 Jul 2016 19:58:01 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11C511783; Mon, 11 Jul 2016 19:58:00 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BJw0XB048894; Mon, 11 Jul 2016 19:58:00 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BJw0GQ048893; Mon, 11 Jul 2016 19:58:00 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607111958.u6BJw0GQ048893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 19:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302584 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 19:58:01 -0000 Author: jmcneill Date: Mon Jul 11 19:58:00 2016 New Revision: 302584 URL: https://svnweb.freebsd.org/changeset/base/302584 Log: Remove unused bus_space prototypes. Modified: head/sys/arm/allwinner/a10_ehci.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Mon Jul 11 17:31:30 2016 (r302583) +++ head/sys/arm/allwinner/a10_ehci.c Mon Jul 11 19:58:00 2016 (r302584) @@ -88,9 +88,6 @@ __FBSDID("$FreeBSD$"); static device_attach_t a10_ehci_attach; static device_detach_t a10_ehci_detach; -bs_r_1_proto(reversed); -bs_w_1_proto(reversed); - struct aw_ehci_softc { ehci_softc_t sc; clk_t clk; From owner-svn-src-head@freebsd.org Mon Jul 11 20:00:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60376B9260D; Mon, 11 Jul 2016 20:00:58 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FFBF1C8E; Mon, 11 Jul 2016 20:00:58 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK0vHr051408; Mon, 11 Jul 2016 20:00:57 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK0vEZ051407; Mon, 11 Jul 2016 20:00:57 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112000.u6BK0vEZ051407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302585 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:00:58 -0000 Author: jmcneill Date: Mon Jul 11 20:00:57 2016 New Revision: 302585 URL: https://svnweb.freebsd.org/changeset/base/302585 Log: Build fix for arm64. The phy interface uses intptr_t for the "phy" parameter, not int. Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Mon Jul 11 19:58:00 2016 (r302584) +++ head/sys/arm/allwinner/aw_usbphy.c Mon Jul 11 20:00:57 2016 (r302585) @@ -148,7 +148,7 @@ awusbphy_vbus_detect(device_t dev, int * } static int -awusbphy_phy_enable(device_t dev, int phy, bool enable) +awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable) { struct awusbphy_softc *sc; regulator_t reg; @@ -177,8 +177,9 @@ awusbphy_phy_enable(device_t dev, int ph } else error = regulator_disable(reg); if (error != 0) { - device_printf(dev, "couldn't %s regulator for phy %d\n", - enable ? "enable" : "disable", phy); + device_printf(dev, + "couldn't %s regulator for phy %jd\n", + enable ? "enable" : "disable", (intmax_t)phy); return (error); } From owner-svn-src-head@freebsd.org Mon Jul 11 20:02:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A35BB927DF; Mon, 11 Jul 2016 20:02:52 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AD4D12BF; Mon, 11 Jul 2016 20:02:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK2pG4053016; Mon, 11 Jul 2016 20:02:51 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK2pmi053015; Mon, 11 Jul 2016 20:02:51 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112002.u6BK2pmi053015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302586 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:02:52 -0000 Author: jmcneill Date: Mon Jul 11 20:02:51 2016 New Revision: 302586 URL: https://svnweb.freebsd.org/changeset/base/302586 Log: Attach RSB early. Children of RSB may provide resources necessary for other devices such as interrupts, GPIOs, and regulators. Modified: head/sys/arm/allwinner/aw_rsb.c Modified: head/sys/arm/allwinner/aw_rsb.c ============================================================================== --- head/sys/arm/allwinner/aw_rsb.c Mon Jul 11 20:00:57 2016 (r302585) +++ head/sys/arm/allwinner/aw_rsb.c Mon Jul 11 20:02:51 2016 (r302586) @@ -472,6 +472,8 @@ static driver_t rsb_driver = { static devclass_t rsb_devclass; -DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus_devclass, 0, 0); -DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0); +EARLY_DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus_devclass, 0, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0, + BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(rsb, 1); From owner-svn-src-head@freebsd.org Mon Jul 11 20:03:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77207B92877; Mon, 11 Jul 2016 20:03:32 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 479051469; Mon, 11 Jul 2016 20:03:32 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK3VXw053084; Mon, 11 Jul 2016 20:03:31 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK3Vua053083; Mon, 11 Jul 2016 20:03:31 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112003.u6BK3Vua053083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302587 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:03:32 -0000 Author: jmcneill Date: Mon Jul 11 20:03:31 2016 New Revision: 302587 URL: https://svnweb.freebsd.org/changeset/base/302587 Log: Include sys/rman.h to fix build on arm64. Modified: head/sys/arm/allwinner/aw_nmi.c Modified: head/sys/arm/allwinner/aw_nmi.c ============================================================================== --- head/sys/arm/allwinner/aw_nmi.c Mon Jul 11 20:02:51 2016 (r302586) +++ head/sys/arm/allwinner/aw_nmi.c Mon Jul 11 20:03:31 2016 (r302587) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Mon Jul 11 20:05:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A9C1B92938; Mon, 11 Jul 2016 20:05:04 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A85B1741; Mon, 11 Jul 2016 20:05:03 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK53gK053363; Mon, 11 Jul 2016 20:05:03 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK53JD053362; Mon, 11 Jul 2016 20:05:03 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112005.u6BK53JD053362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302588 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:05:04 -0000 Author: jmcneill Date: Mon Jul 11 20:05:03 2016 New Revision: 302588 URL: https://svnweb.freebsd.org/changeset/base/302588 Log: Add SOC_ALLWINNER_A64 option for Allwinner A64 (sun50i) SoCs. Modified: head/sys/conf/options.arm64 Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Mon Jul 11 20:03:31 2016 (r302587) +++ head/sys/conf/options.arm64 Mon Jul 11 20:05:03 2016 (r302588) @@ -8,5 +8,6 @@ THUNDERX_PASS_1_1_ERRATA opt_global.h VFP opt_global.h # SoC Support +SOC_ALLWINNER_A64 opt_soc.h SOC_CAVM_THUNDERX opt_soc.h SOC_HISI_HI6220 opt_soc.h From owner-svn-src-head@freebsd.org Mon Jul 11 20:06:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA47AB92A2C; Mon, 11 Jul 2016 20:06:22 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 890491997; Mon, 11 Jul 2016 20:06:22 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK6Lva053454; Mon, 11 Jul 2016 20:06:21 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK6L9Y053452; Mon, 11 Jul 2016 20:06:21 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112006.u6BK6L9Y053452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302589 - head/sys/arm/allwinner/a64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:06:22 -0000 Author: jmcneill Date: Mon Jul 11 20:06:21 2016 New Revision: 302589 URL: https://svnweb.freebsd.org/changeset/base/302589 Log: Add Allwinner A64 padconf settings. Reviewed by: andrew, manu Added: head/sys/arm/allwinner/a64/ head/sys/arm/allwinner/a64/a64_padconf.c (contents, props changed) head/sys/arm/allwinner/a64/a64_r_padconf.c (contents, props changed) Added: head/sys/arm/allwinner/a64/a64_padconf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/a64/a64_padconf.c Mon Jul 11 20:06:21 2016 (r302589) @@ -0,0 +1,160 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include "opt_soc.h" + +#ifdef SOC_ALLWINNER_A64 + +static const struct allwinner_pins a64_pins[] = { + { "PB0", 1, 0, { "gpio_in", "gpio_out", "uart2", NULL, "jtag", NULL, "eint" } }, + { "PB1", 1, 1, { "gpio_in", "gpio_out", "uart2", NULL, "jtag", "sim", "eint" } }, + { "PB2", 1, 2, { "gpio_in", "gpio_out", "uart2", NULL, "jtag", "sim", "eint" } }, + { "PB3", 1, 3, { "gpio_in", "gpio_out", "uart2", "i2s0", "jtag", "sim", "eint" } }, + { "PB4", 1, 4, { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", "eint" } }, + { "PB5", 1, 5, { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", "eint" } }, + { "PB6", 1, 6, { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", "eint" } }, + { "PB7", 1, 7, { "gpio_in", "gpio_out", "aif2", "pcm0", NULL, "sim", "eint" } }, + { "PB8", 1, 8, { "gpio_in", "gpio_out", NULL, NULL, "uart0", NULL, "eint" } }, + { "PB9", 1, 9, { "gpio_in", "gpio_out", NULL, NULL, "uart0", NULL, "eint" } }, + + { "PC0", 2, 0, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC1", 2, 1, { "gpio_in", "gpio_out", "nand", "mmc2", "spi0" } }, + { "PC2", 2, 2, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC3", 2, 3, { "gpio_in", "gpio_out", "nand", NULL, "spi0" } }, + { "PC4", 2, 4, { "gpio_in", "gpio_out", "nand" } }, + { "PC5", 2, 5, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC6", 2, 6, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC7", 2, 7, { "gpio_in", "gpio_out", "nand" } }, + { "PC8", 2, 8, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC9", 2, 9, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC10", 2, 10, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC11", 2, 11, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC12", 2, 12, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC13", 2, 13, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC14", 2, 14, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC15", 2, 15, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + { "PC16", 2, 16, { "gpio_in", "gpio_out", "nand", "mmc2" } }, + + { "PD0", 3, 0, { "gpio_in", "gpio_out", "lcd", "uart3", "spi1", "ccir" } }, + { "PD1", 3, 1, { "gpio_in", "gpio_out", "lcd", "uart3", "spi1", "ccir" } }, + { "PD2", 3, 2, { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", "ccir" } }, + { "PD3", 3, 3, { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", "ccir" } }, + { "PD4", 3, 4, { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", "ccir" } }, + { "PD5", 3, 5, { "gpio_in", "gpio_out", "lcd", "uart4", "spi1", "ccir" } }, + { "PD6", 3, 6, { "gpio_in", "gpio_out", "lcd", NULL, NULL, "ccir" } }, + { "PD7", 3, 7, { "gpio_in", "gpio_out", "lcd", NULL, NULL, "ccir" } }, + { "PD8", 3, 8, { "gpio_in", "gpio_out", "lcd", NULL, "emac", "ccir" } }, + { "PD9", 3, 9, { "gpio_in", "gpio_out", "lcd", NULL, "emac", "ccir" } }, + { "PD10", 3, 10, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, + { "PD11", 3, 11, { "gpio_in", "gpio_out", "lcd", NULL, "emac" } }, + { "PD12", 3, 12, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD13", 3, 13, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD14", 3, 14, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD15", 3, 15, { "gpio_in", "gpio_out", "lcd", "lvds", "emac", "ccir" } }, + { "PD16", 3, 16, { "gpio_in", "gpio_out", "lcd", "lvds", "emac", "ccir" } }, + { "PD17", 3, 17, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD18", 3, 18, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD19", 3, 19, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD20", 3, 20, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD21", 3, 21, { "gpio_in", "gpio_out", "lcd", "lvds", "emac" } }, + { "PD22", 3, 22, { "gpio_in", "gpio_out", "pwm0", NULL, "emac" } }, + { "PD23", 3, 23, { "gpio_in", "gpio_out", NULL, NULL, "emac" } }, + { "PD24", 3, 24, { "gpio_in", "gpio_out" } }, + + { "PE0", 4, 0, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE1", 4, 1, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE2", 4, 2, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE3", 4, 3, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE4", 4, 4, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE5", 4, 5, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE6", 4, 6, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE7", 4, 7, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE8", 4, 8, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE9", 4, 9, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE10", 4, 10, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE11", 4, 11, { "gpio_in", "gpio_out", "csi", NULL, "ts" } }, + { "PE12", 4, 12, { "gpio_in", "gpio_out", "csi" } }, + { "PE13", 4, 13, { "gpio_in", "gpio_out", "csi" } }, + { "PE14", 4, 14, { "gpio_in", "gpio_out", "pll_lock", "twi2" } }, + { "PE15", 4, 15, { "gpio_in", "gpio_out", NULL, "twi2" } }, + { "PE16", 4, 16, { "gpio_in", "gpio_out" } }, + { "PE17", 4, 17, { "gpio_in", "gpio_out" } }, + + { "PF0", 5, 0, { "gpio_in", "gpio_out", "mmc0", "jtag" } }, + { "PF1", 5, 1, { "gpio_in", "gpio_out", "mmc0", "jtag" } }, + { "PF2", 5, 2, { "gpio_in", "gpio_out", "mmc0", "uart0" } }, + { "PF3", 5, 3, { "gpio_in", "gpio_out", "mmc0", "jtag" } }, + { "PF4", 5, 4, { "gpio_in", "gpio_out", "mmc0", "uart0" } }, + { "PF5", 5, 5, { "gpio_in", "gpio_out", "mmc0", "jtag" } }, + { "PF6", 5, 6, { "gpio_in", "gpio_out" } }, + + { "PG0", 6, 0, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG1", 6, 1, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG2", 6, 2, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG3", 6, 3, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG4", 6, 4, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG5", 6, 5, { "gpio_in", "gpio_out", "mmc1", NULL, NULL, NULL, "eint" } }, + { "PG6", 6, 6, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "eint" } }, + { "PG7", 6, 7, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "eint" } }, + { "PG8", 6, 8, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "eint" } }, + { "PG9", 6, 9, { "gpio_in", "gpio_out", "uart1", NULL, NULL, NULL, "eint" } }, + { "PG10", 6, 10, { "gpio_in", "gpio_out", "aif3", "pcm1", NULL, NULL, "eint" } }, + { "PG11", 6, 11, { "gpio_in", "gpio_out", "aif3", "pcm1", NULL, NULL, "eint" } }, + { "PG12", 6, 12, { "gpio_in", "gpio_out", "aif3", "pcm1", NULL, NULL, "eint" } }, + { "PG13", 6, 13, { "gpio_in", "gpio_out", "aif3", "pcm1", NULL, NULL, "eint" } }, + + { "PH0", 7, 0, { "gpio_in", "gpio_out", "i2c0", NULL, NULL, NULL, "eint" } }, + { "PH1", 7, 1, { "gpio_in", "gpio_out", "i2c0", NULL, NULL, NULL, "eint" } }, + { "PH2", 7, 2, { "gpio_in", "gpio_out", "i2c1", NULL, NULL, NULL, "eint" } }, + { "PH3", 7, 3, { "gpio_in", "gpio_out", "i2c1", NULL, NULL, NULL, "eint" } }, + { "PH4", 7, 4, { "gpio_in", "gpio_out", "uart3", NULL, NULL, NULL, "eint" } }, + { "PH5", 7, 5, { "gpio_in", "gpio_out", "uart3", NULL, NULL, NULL, "eint" } }, + { "PH6", 7, 6, { "gpio_in", "gpio_out", "uart3", NULL, NULL, NULL, "eint" } }, + { "PH7", 7, 7, { "gpio_in", "gpio_out", "uart3", NULL, NULL, NULL, "eint" } }, + { "PH8", 7, 8, { "gpio_in", "gpio_out", "owa", NULL, NULL, NULL, "eint" } }, + { "PH9", 7, 9, { "gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "eint" } }, + { "PH10", 7, 10, { "gpio_in", "gpio_out", "mic", NULL, NULL, NULL, "eint" } }, + { "PH11", 7, 11, { "gpio_in", "gpio_out", "mic", NULL, NULL, NULL, "eint" } }, +}; + +const struct allwinner_padconf a64_padconf = { + .npins = nitems(a64_pins), + .pins = a64_pins, +}; + +#endif /* !SOC_ALLWINNER_A64 */ Added: head/sys/arm/allwinner/a64/a64_r_padconf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/a64/a64_r_padconf.c Mon Jul 11 20:06:21 2016 (r302589) @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include "opt_soc.h" + +#ifdef SOC_ALLWINNER_A64 + +static const struct allwinner_pins a64_r_pins[] = { + { "PL0", 0, 0, { "gpio_in", "gpio_out", "s_rsb", "s_i2c", NULL, NULL, "eint" } }, + { "PL1", 0, 1, { "gpio_in", "gpio_out", "s_rsb", "s_i2c", NULL, NULL, "eint" } }, + { "PL2", 0, 2, { "gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, "eint" } }, + { "PL3", 0, 3, { "gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, "eint" } }, + { "PL4", 0, 4, { "gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "eint" } }, + { "PL5", 0, 5, { "gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "eint" } }, + { "PL6", 0, 6, { "gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "eint" } }, + { "PL7", 0, 7, { "gpio_in", "gpio_out", "s_jtag", NULL, NULL, NULL, "eint" } }, + { "PL8", 0, 8, { "gpio_in", "gpio_out", "s_i2c", NULL, NULL, NULL, "eint" } }, + { "PL9", 0, 9, { "gpio_in", "gpio_out", "s_i2c", NULL, NULL, NULL, "eint" } }, + { "PL10", 0, 10, { "gpio_in", "gpio_out", "s_pwm", NULL, NULL, NULL, "eint" } }, + { "PL11", 0, 11, { "gpio_in", "gpio_out", "s_cir", NULL, NULL, NULL, "eint" } }, + { "PL12", 0, 12, { "gpio_in", "gpio_out", NULL, NULL, NULL, NULL, "eint" } }, +}; + +const struct allwinner_padconf a64_r_padconf = { + .npins = nitems(a64_r_pins), + .pins = a64_r_pins, +}; + +#endif /* !SOC_ALLWINNER_A64 */ From owner-svn-src-head@freebsd.org Mon Jul 11 20:09:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AC2BB92AC0; Mon, 11 Jul 2016 20:09:18 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 277961B6C; Mon, 11 Jul 2016 20:09:18 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BK9HhM053582; Mon, 11 Jul 2016 20:09:17 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BK9Hqb053581; Mon, 11 Jul 2016 20:09:17 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112009.u6BK9Hqb053581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302590 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:09:18 -0000 Author: jmcneill Date: Mon Jul 11 20:09:17 2016 New Revision: 302590 URL: https://svnweb.freebsd.org/changeset/base/302590 Log: Add support for Allwinner A64 CPUx-PORT and CPUs-PORT Port Controllers. Reviewed by: andrew, manu Modified: head/sys/arm/allwinner/a10_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Mon Jul 11 20:06:21 2016 (r302589) +++ head/sys/arm/allwinner/a10_gpio.c Mon Jul 11 20:09:17 2016 (r302590) @@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(__aarch64__) +#include "opt_soc.h" +#endif + #include "gpio_if.h" #define A10_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ @@ -116,6 +120,12 @@ extern const struct allwinner_padconf a8 extern const struct allwinner_padconf a83t_r_padconf; #endif +/* Defined in a64_padconf.c */ +#ifdef SOC_ALLWINNER_A64 +extern const struct allwinner_padconf a64_padconf; +extern const struct allwinner_padconf a64_r_padconf; +#endif + static struct ofw_compat_data compat_data[] = { #ifdef SOC_ALLWINNER_A10 {"allwinner,sun4i-a10-pinctrl", (uintptr_t)&a10_padconf}, @@ -143,6 +153,10 @@ static struct ofw_compat_data compat_dat {"allwinner,sun8i-h3-pinctrl", (uintptr_t)&h3_padconf}, {"allwinner,sun8i-h3-r-pinctrl", (uintptr_t)&h3_r_padconf}, #endif +#ifdef SOC_ALLWINNER_A64 + {"allwinner,sun50i-a64-pinctrl", (uintptr_t)&a64_padconf}, + {"allwinner,sun50i-a64-r-pinctrl", (uintptr_t)&a64_r_padconf}, +#endif {NULL, 0} }; From owner-svn-src-head@freebsd.org Mon Jul 11 20:13:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8534DB92CD0; Mon, 11 Jul 2016 20:13:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F4AB1211; Mon, 11 Jul 2016 20:13:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BKDkEF057218; Mon, 11 Jul 2016 20:13:46 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BKDk3m057217; Mon, 11 Jul 2016 20:13:46 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112013.u6BKDk3m057217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302591 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:13:47 -0000 Author: jmcneill Date: Mon Jul 11 20:13:46 2016 New Revision: 302591 URL: https://svnweb.freebsd.org/changeset/base/302591 Log: Add support for arm64. The allwinner_soc_family() function is not available on arm64 and all SoCs using the old FIFO register location are 32-bit only, so unconditionally use the new location for arm64. Reviewed by: andrew, manu Modified: head/sys/arm/allwinner/a10_mmc.c Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:09:17 2016 (r302590) +++ head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:13:46 2016 (r302591) @@ -182,6 +182,7 @@ a10_mmc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->a10_timeoutc, &sc->a10_mtx, 0); +#if defined(__arm__) /* * Later chips use a different FIFO offset. Unfortunately the FDT * uses the same compatible string for old and new implementations. @@ -196,6 +197,9 @@ a10_mmc_attach(device_t dev) sc->a10_fifo_reg = A31_MMC_FIFO; break; } +#else /* __aarch64__ */ + sc->a10_fifo_reg = A31_MMC_FIFO; +#endif /* De-assert reset */ if (hwreset_get_by_ofw_name(dev, 0, "ahb", &sc->a10_rst_ahb) == 0) { From owner-svn-src-head@freebsd.org Mon Jul 11 20:14:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03B0CB92EEF; Mon, 11 Jul 2016 20:14:52 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA72C1819; Mon, 11 Jul 2016 20:14:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BKEpba057589; Mon, 11 Jul 2016 20:14:51 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BKEpbH057588; Mon, 11 Jul 2016 20:14:51 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112014.u6BKEpbH057588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302592 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:14:52 -0000 Author: jmcneill Date: Mon Jul 11 20:14:50 2016 New Revision: 302592 URL: https://svnweb.freebsd.org/changeset/base/302592 Log: Return early from bus_dmamap_load callback if the error indicator is set. Reviewed by: andrew, manu Modified: head/sys/arm/allwinner/a10_mmc.c Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:13:46 2016 (r302591) +++ head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:14:50 2016 (r302592) @@ -364,6 +364,10 @@ a10_dma_cb(void *arg, bus_dma_segment_t sc = (struct a10_mmc_softc *)arg; sc->a10_dma_map_err = err; + + if (err) + return; + dma_desc = sc->a10_dma_desc; /* Note nsegs is guaranteed to be zero if err is non-zero. */ for (i = 0; i < nsegs; i++) { From owner-svn-src-head@freebsd.org Mon Jul 11 20:15:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CDC7B92FB5; Mon, 11 Jul 2016 20:15:48 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDE4D19F9; Mon, 11 Jul 2016 20:15:47 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BKFlda057669; Mon, 11 Jul 2016 20:15:47 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BKFlG3057668; Mon, 11 Jul 2016 20:15:47 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607112015.u6BKFlG3057668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Mon, 11 Jul 2016 20:15:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302593 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:15:48 -0000 Author: jmcneill Date: Mon Jul 11 20:15:46 2016 New Revision: 302593 URL: https://svnweb.freebsd.org/changeset/base/302593 Log: Add support for Allwinner A64. Reviewed by: andrew, manu Modified: head/sys/arm/allwinner/aw_ccu.c Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Mon Jul 11 20:14:50 2016 (r302592) +++ head/sys/arm/allwinner/aw_ccu.c Mon Jul 11 20:15:46 2016 (r302593) @@ -80,6 +80,7 @@ static struct ofw_compat_data compat_dat { "allwinner,sun7i-a20", CLOCK_CCU }, { "allwinner,sun6i-a31", CLOCK_CCU }, { "allwinner,sun6i-a31s", CLOCK_CCU }, + { "allwinner,sun50i-a64", CLOCK_CCU }, { "allwinner,sun8i-a83t", CLOCK_CCU|CLOCK_PRCM|CLOCK_SYSCTRL }, { "allwinner,sun8i-h3", CLOCK_CCU }, { NULL, 0 } From owner-svn-src-head@freebsd.org Mon Jul 11 20:50:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E5B1B9292E for ; Mon, 11 Jul 2016 20:50:28 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC9B91E32 for ; Mon, 11 Jul 2016 20:50:27 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 18de9ab3-47a9-11e6-ac92-3142cfe117f2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.eu.mailhop.org (Halon Mail Gateway) with ESMTPSA; Mon, 11 Jul 2016 20:50:26 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u6BKoE5b004266; Mon, 11 Jul 2016 14:50:14 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1468270214.72182.126.camel@freebsd.org> Subject: Re: svn commit: r302592 - head/sys/arm/allwinner From: Ian Lepore To: Jared McNeill , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 11 Jul 2016 14:50:14 -0600 In-Reply-To: <201607112014.u6BKEpbH057588@repo.freebsd.org> References: <201607112014.u6BKEpbH057588@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 20:50:28 -0000 On Mon, 2016-07-11 at 20:14 +0000, Jared McNeill wrote: > Author: jmcneill > Date: Mon Jul 11 20:14:50 2016 > New Revision: 302592 > URL: https://svnweb.freebsd.org/changeset/base/302592 > > Log: > Return early from bus_dmamap_load callback if the error indicator > is set. > > Reviewed by: andrew, manu > > Modified: > head/sys/arm/allwinner/a10_mmc.c > > Modified: head/sys/arm/allwinner/a10_mmc.c > ===================================================================== > ========= > --- head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:13:46 2016 > (r302591) > +++ head/sys/arm/allwinner/a10_mmc.c Mon Jul 11 20:14:50 2016 > (r302592) > @@ -364,6 +364,10 @@ a10_dma_cb(void *arg, bus_dma_segment_t > > sc = (struct a10_mmc_softc *)arg; > sc->a10_dma_map_err = err; > + > + if (err) > + return; > + > dma_desc = sc->a10_dma_desc; > /* Note nsegs is guaranteed to be zero if err is non-zero. > */ > for (i = 0; i < nsegs; i++) { > The comment about nsegs g'teed to be zero is now rather moot. That comment may have been copied from code I wrote long ago. I think the comment is true of the armv4/6 implementations, but it doesn't appear to be a g'tee made by the busdma manpage. -- Ian From owner-svn-src-head@freebsd.org Mon Jul 11 21:23:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD83BB92715; Mon, 11 Jul 2016 21:23:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 912111BBC; Mon, 11 Jul 2016 21:23:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BLNoqr084239; Mon, 11 Jul 2016 21:23:50 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BLNoT7084236; Mon, 11 Jul 2016 21:23:50 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607112123.u6BLNoT7084236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 11 Jul 2016 21:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302594 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 21:23:51 -0000 Author: ache Date: Mon Jul 11 21:23:50 2016 New Revision: 302594 URL: https://svnweb.freebsd.org/changeset/base/302594 Log: 1) Following r302512 (remove collation support for [a-z]-ranges in libc) remove collation support for a-z ranges here too. It was implemented for single byte locales only in any case. 2) Reduce [Cc]flag loop to WCHAR_MAX, WINT_MAX here includes WEOF which is not a character. 3) Optimize [Cc]flag case: don't repeatedly add the last character of string2 to squeeze cset when string2 reach its EOS state. 4) Reflect in the manpage that [=equiv=] is implemented for single byte locales only. Modified: head/usr.bin/tr/str.c head/usr.bin/tr/tr.1 head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/str.c ============================================================================== --- head/usr.bin/tr/str.c Mon Jul 11 20:15:46 2016 (r302593) +++ head/usr.bin/tr/str.c Mon Jul 11 21:23:50 2016 (r302594) @@ -53,7 +53,7 @@ static int backslash(STR *, int *); static int bracket(STR *); static void genclass(STR *); static void genequiv(STR *); -static int genrange(STR *, int); +static int genrange(STR *); static void genseq(STR *); wint_t @@ -93,7 +93,7 @@ next(STR *s) } /* We can start a range at any time. */ - if (s->str[0] == '-' && genrange(s, is_octal)) + if (s->str[0] == '-' && genrange(s)) return (next(s)); return (1); case RANGE: @@ -237,18 +237,16 @@ genequiv(STR *s) } static int -genrange(STR *s, int was_octal) +genrange(STR *s) { - int stopval, octal; + int stopval; char *savestart; - int n, cnt, *p; size_t clen; wchar_t wc; - octal = 0; savestart = s->str; if (*++s->str == '\\') - stopval = backslash(s, &octal); + stopval = backslash(s, NULL); else { clen = mbrtowc(&wc, s->str, MB_LEN_MAX, NULL); if (clen == (size_t)-1 || clen == (size_t)-2) @@ -256,37 +254,13 @@ genrange(STR *s, int was_octal) stopval = wc; s->str += clen; } - /* - * XXX Characters are not ordered according to collating sequence in - * multibyte locales. - */ - if (octal || was_octal || MB_CUR_MAX > 1) { - if (stopval < s->lastch) { - s->str = savestart; - return (0); - } - s->cnt = stopval - s->lastch + 1; - s->state = RANGE; - --s->lastch; - return (1); - } - if (charcoll((const void *)&stopval, (const void *)&(s->lastch)) < 0) { + if (stopval < s->lastch) { s->str = savestart; return (0); } - if ((s->set = p = malloc((NCHARS_SB + 1) * sizeof(int))) == NULL) - err(1, "genrange() malloc"); - for (cnt = 0; cnt < NCHARS_SB; cnt++) - if (charcoll((const void *)&cnt, (const void *)&(s->lastch)) >= 0 && - charcoll((const void *)&cnt, (const void *)&stopval) <= 0) - *p++ = cnt; - *p = OOBCH; - n = p - s->set; - - s->cnt = 0; - s->state = SET; - if (n > 1) - mergesort(s->set, n, sizeof(*(s->set)), charcoll); + s->cnt = stopval - s->lastch + 1; + s->state = RANGE; + --s->lastch; return (1); } Modified: head/usr.bin/tr/tr.1 ============================================================================== --- head/usr.bin/tr/tr.1 Mon Jul 11 20:15:46 2016 (r302593) +++ head/usr.bin/tr/tr.1 Mon Jul 11 21:23:50 2016 (r302594) @@ -164,14 +164,6 @@ as defined by the collation sequence. If either or both of the range endpoints are octal sequences, it represents the range of specific coded values between the range endpoints, inclusive. -.Pp -.Bf Em -See the -.Sx COMPATIBILITY -section below for an important note regarding -differences in the way the current -implementation interprets range expressions differently from -previous implementations. .Ef .It [:class:] Represents all characters belonging to the defined character class. @@ -307,22 +299,16 @@ Remove diacritical marks from all accent .Pp .Dl "tr \*q[=e=]\*q \*qe\*q" .Sh COMPATIBILITY -Previous .Fx implementations of .Nm did not order characters in range expressions according to the current -locale's collation order, making it possible to convert unaccented Latin -characters (esp.\& as found in English text) from upper to lower case using +locale's collation order, making it possible to convert accented Latin +characters from upper to lower case using the traditional .Ux idiom of .Dq Li "tr A-Z a-z" . -Since -.Nm -now obeys the locale's collation order, this idiom may not produce -correct results when there is not a 1:1 mapping between lower and -upper case, or when the order of characters within the two cases differs. As noted in the .Sx EXAMPLES section above, the character class expressions @@ -334,6 +320,9 @@ should be used instead of explicit chara and .Dq Li A-Z . .Pp +.Dq Li [=equiv=] +expression is implemented for single byte locales only. +.Pp System V has historically implemented character ranges using the syntax .Dq Li [c-c] instead of the Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Mon Jul 11 20:15:46 2016 (r302593) +++ head/usr.bin/tr/tr.c Mon Jul 11 21:23:50 2016 (r302594) @@ -68,10 +68,8 @@ static void usage(void); int main(int argc, char **argv) { - static int carray[NCHARS_SB]; struct cmap *map; struct cset *delete, *squeeze; - int n, *p; int Cflag, cflag, dflag, sflag, isstring2; wint_t ch, cnt, lastch; @@ -254,7 +252,7 @@ main(int argc, char **argv) (void)next(&s2); } endloop: - if (cflag || (Cflag && MB_CUR_MAX > 1)) { + if (cflag || Cflag) { /* * This is somewhat tricky: since the character set is * potentially huge, we need to avoid allocating a map @@ -268,14 +266,15 @@ endloop: */ s2.str = argv[1]; s2.state = NORMAL; - for (cnt = 0; cnt < WINT_MAX; cnt++) { + for (cnt = 0; cnt <= WCHAR_MAX; cnt++) { if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { - if (next(&s2)) + if (next(&s2)) { cmap_add(map, cnt, s2.lastch); - if (sflag) - cset_add(squeeze, s2.lastch); + if (sflag) + cset_add(squeeze, s2.lastch); + } } else cmap_add(map, cnt, cnt); if ((s2.state == EOS || s2.state == INFINITE) && @@ -283,30 +282,6 @@ endloop: break; } cmap_default(map, s2.lastch); - } else if (Cflag) { - for (p = carray, cnt = 0; cnt < NCHARS_SB; cnt++) { - if (cmap_lookup(map, cnt) == OOBCH && iswrune(cnt)) - *p++ = cnt; - else - cmap_add(map, cnt, cnt); - } - n = p - carray; - if (Cflag && n > 1) - (void)mergesort(carray, n, sizeof(*carray), charcoll); - - s2.str = argv[1]; - s2.state = NORMAL; - for (cnt = 0; cnt < n; cnt++) { - (void)next(&s2); - cmap_add(map, carray[cnt], s2.lastch); - /* - * Chars taken from s2 can be different this time - * due to lack of complex upper/lower processing, - * so fill string2 again to not miss some. - */ - if (sflag) - cset_add(squeeze, s2.lastch); - } } cset_cache(squeeze); @@ -351,16 +326,6 @@ setup(char *arg, STR *str, int cflag, in return (cs); } -int -charcoll(const void *a, const void *b) -{ - static char sa[2], sb[2]; - - sa[0] = *(const int *)a; - sb[0] = *(const int *)b; - return (strcoll(sa, sb)); -} - static void usage(void) { From owner-svn-src-head@freebsd.org Mon Jul 11 21:25:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99311B9284C; Mon, 11 Jul 2016 21:25:29 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 680031EA9; Mon, 11 Jul 2016 21:25:29 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BLPS7H084348; Mon, 11 Jul 2016 21:25:28 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BLPSfT084346; Mon, 11 Jul 2016 21:25:28 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607112125.u6BLPSfT084346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 11 Jul 2016 21:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302595 - in head/sys: kern net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 21:25:29 -0000 Author: nwhitehorn Date: Mon Jul 11 21:25:28 2016 New Revision: 302595 URL: https://svnweb.freebsd.org/changeset/base/302595 Log: Remove assumptions in MI code that the BSP is CPU 0. MFC after: 2 weeks Modified: head/sys/kern/init_main.c head/sys/net/netisr.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Mon Jul 11 21:23:50 2016 (r302594) +++ head/sys/kern/init_main.c Mon Jul 11 21:25:28 2016 (r302595) @@ -495,7 +495,7 @@ proc0_init(void *dummy __unused) td->td_lend_user_pri = PRI_MAX; td->td_priority = PVM; td->td_base_pri = PVM; - td->td_oncpu = 0; + td->td_oncpu = curcpu; td->td_flags = TDF_INMEM; td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Mon Jul 11 21:23:50 2016 (r302594) +++ head/sys/net/netisr.c Mon Jul 11 21:25:28 2016 (r302595) @@ -1273,8 +1273,6 @@ netisr_init(void *arg) struct pcpu *pc; #endif - KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__)); - NETISR_LOCK_INIT(); if (netisr_maxthreads == 0 || netisr_maxthreads < -1 ) netisr_maxthreads = 1; /* default behavior */ From owner-svn-src-head@freebsd.org Mon Jul 11 21:55:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C48FB921D4; Mon, 11 Jul 2016 21:55:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3586149D; Mon, 11 Jul 2016 21:55:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BLtv51095193; Mon, 11 Jul 2016 21:55:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BLtvbG095192; Mon, 11 Jul 2016 21:55:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607112155.u6BLtvbG095192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 11 Jul 2016 21:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302596 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 21:55:58 -0000 Author: gjb Date: Mon Jul 11 21:55:56 2016 New Revision: 302596 URL: https://svnweb.freebsd.org/changeset/base/302596 Log: Fix TARGET_TRIPLE for 12.0-CURRENT. Submitted by: rene Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 11 21:25:28 2016 (r302595) +++ head/Makefile.inc1 Mon Jul 11 21:55:56 2016 (r302596) @@ -555,7 +555,7 @@ XCXXFLAGS+= -isystem ${WORLDTMP}/usr/inc .endif .else TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 XCFLAGS+= -target ${TARGET_TRIPLE} .endif XCFLAGS+= --sysroot=${WORLDTMP} From owner-svn-src-head@freebsd.org Mon Jul 11 23:06:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41D18B9269C; Mon, 11 Jul 2016 23:06:12 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 109B3160B; Mon, 11 Jul 2016 23:06:11 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6BN6Bpc021231; Mon, 11 Jul 2016 23:06:11 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6BN6BQ4021230; Mon, 11 Jul 2016 23:06:11 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607112306.u6BN6BQ4021230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 11 Jul 2016 23:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302599 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 23:06:12 -0000 Author: ache Date: Mon Jul 11 23:06:11 2016 New Revision: 302599 URL: https://svnweb.freebsd.org/changeset/base/302599 Log: Cast WCHAR_MAX to wint_t, it can be unsigned on some systems. Modified: head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Mon Jul 11 23:01:58 2016 (r302598) +++ head/usr.bin/tr/tr.c Mon Jul 11 23:06:11 2016 (r302599) @@ -266,7 +266,7 @@ endloop: */ s2.str = argv[1]; s2.state = NORMAL; - for (cnt = 0; cnt <= WCHAR_MAX; cnt++) { + for (cnt = 0; cnt <= (wint_t)WCHAR_MAX; cnt++) { if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { From owner-svn-src-head@freebsd.org Tue Jul 12 00:37:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78FA6B92C76; Tue, 12 Jul 2016 00:37:49 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 455011DC8; Tue, 12 Jul 2016 00:37:49 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C0bmrB054454; Tue, 12 Jul 2016 00:37:48 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C0bmNF054452; Tue, 12 Jul 2016 00:37:48 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607120037.u6C0bmNF054452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 12 Jul 2016 00:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302601 - in head/sys: arm/include arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 00:37:49 -0000 Author: ache Date: Tue Jul 12 00:37:48 2016 New Revision: 302601 URL: https://svnweb.freebsd.org/changeset/base/302601 Log: I don't know why unsigned int is choosed for wchar_t here, but WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX Modified: head/sys/arm/include/_types.h head/sys/arm64/include/_types.h Modified: head/sys/arm/include/_types.h ============================================================================== --- head/sys/arm/include/_types.h Mon Jul 11 23:15:54 2016 (r302600) +++ head/sys/arm/include/_types.h Tue Jul 12 00:37:48 2016 (r302601) @@ -107,7 +107,7 @@ typedef __uint32_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ -#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ +#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <= WINT_MAX */ /* * Unusual type definitions. Modified: head/sys/arm64/include/_types.h ============================================================================== --- head/sys/arm64/include/_types.h Mon Jul 11 23:15:54 2016 (r302600) +++ head/sys/arm64/include/_types.h Tue Jul 12 00:37:48 2016 (r302601) @@ -95,7 +95,7 @@ typedef __uint64_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ -#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ +#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <= WINT_MAX */ /* * Unusual type definitions. From owner-svn-src-head@freebsd.org Tue Jul 12 01:15:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79E95B8354F; Tue, 12 Jul 2016 01:15:01 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49E43114D; Tue, 12 Jul 2016 01:15:01 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C1F0b7069230; Tue, 12 Jul 2016 01:15:00 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C1F0gO069229; Tue, 12 Jul 2016 01:15:00 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201607120115.u6C1F0gO069229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Tue, 12 Jul 2016 01:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302602 - head/sys/dev/bhnd/cores/chipc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 01:15:01 -0000 Author: landonf Date: Tue Jul 12 01:15:00 2016 New Revision: 302602 URL: https://svnweb.freebsd.org/changeset/base/302602 Log: bhnd(4): print extra register information on chipc SPI timeout. Submitted by: Michael Zhilin Reviewed by: imp Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6993 Modified: head/sys/dev/bhnd/cores/chipc/chipc_spi.c Modified: head/sys/dev/bhnd/cores/chipc/chipc_spi.c ============================================================================== --- head/sys/dev/bhnd/cores/chipc/chipc_spi.c Tue Jul 12 00:37:48 2016 (r302601) +++ head/sys/dev/bhnd/cores/chipc/chipc_spi.c Tue Jul 12 01:15:00 2016 (r302602) @@ -184,7 +184,9 @@ chipc_spi_wait(struct chipc_spi_softc *s if (i > 0) return (0); - BHND_DEBUG_DEV(sc->sc_dev, "busy"); + BHND_WARN_DEV(sc->sc_dev, "busy: CTL=0x%x DATA=0x%x", + SPI_READ(sc, CHIPC_SPI_FLASHCTL), + SPI_READ(sc, CHIPC_SPI_FLASHDATA)); return (-1); } From owner-svn-src-head@freebsd.org Tue Jul 12 02:12:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAD58B852E1; Tue, 12 Jul 2016 02:12:32 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80F47130A; Tue, 12 Jul 2016 02:12:32 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C2CVCN090917; Tue, 12 Jul 2016 02:12:31 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C2CVaO090916; Tue, 12 Jul 2016 02:12:31 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201607120212.u6C2CVaO090916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Tue, 12 Jul 2016 02:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302603 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 02:12:32 -0000 Author: landonf Date: Tue Jul 12 02:12:31 2016 New Revision: 302603 URL: https://svnweb.freebsd.org/changeset/base/302603 Log: mips/ddb: fix MIPS backtrace truncation and MIPS32 register printing. - Cast 32-bit register values to uintmax_t for use with %jx. - Add special-case return address handling for MipsKernGenException to avoid early termination of stack walking in the exception handler stack frame. Submitted by: Michael Zhilin Reviewed by: ray Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6907 Modified: head/sys/mips/mips/db_trace.c Modified: head/sys/mips/mips/db_trace.c ============================================================================== --- head/sys/mips/mips/db_trace.c Tue Jul 12 01:15:00 2016 (r302602) +++ head/sys/mips/mips/db_trace.c Tue Jul 12 02:12:31 2016 (r302603) @@ -144,6 +144,7 @@ stacktrace_subr(register_t pc, register_ unsigned instr, mask; unsigned int frames = 0; int more, stksize, j; + register_t next_ra; /* Jump here when done with a frame, to start a new one */ loop: @@ -155,6 +156,7 @@ loop: valid_args[1] = 0; valid_args[2] = 0; valid_args[3] = 0; + next_ra = 0; /* Jump here after a nonstandard (interrupt handler) frame */ stksize = 0; subr = 0; @@ -288,9 +290,17 @@ loop: /* look for saved registers on the stack */ if (i.IType.rs != 29) break; - /* only restore the first one */ - if (mask & (1 << i.IType.rt)) + /* + * only restore the first one except RA for + * MipsKernGenException case + */ + if (mask & (1 << i.IType.rt)) { + if (subr == (uintptr_t)MipsKernGenException && + i.IType.rt == 31) + next_ra = kdbpeek((int *)(sp + + (short)i.IType.imm)); break; + } mask |= (1 << i.IType.rt); switch (i.IType.rt) { case 4:/* a0 */ @@ -374,7 +384,10 @@ done: (*printfn)("?"); } - (*printfn) (") ra %jx sp %jx sz %d\n", ra, sp, stksize); + (*printfn) (") ra %jx sp %jx sz %d\n", + (uintmax_t)(u_register_t) ra, + (uintmax_t)(u_register_t) sp, + stksize); if (ra) { if (pc == ra && stksize == 0) @@ -382,7 +395,7 @@ done: else { pc = ra; sp += stksize; - ra = 0; + ra = next_ra; goto loop; } } else { From owner-svn-src-head@freebsd.org Tue Jul 12 02:16:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E3A8B854DE; Tue, 12 Jul 2016 02:16:50 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DAB51537; Tue, 12 Jul 2016 02:16:50 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C2GnJk091111; Tue, 12 Jul 2016 02:16:49 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C2GnIb091106; Tue, 12 Jul 2016 02:16:49 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201607120216.u6C2GnIb091106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Tue, 12 Jul 2016 02:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302604 - in head/sys/dev/bhnd: . bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 02:16:50 -0000 Author: landonf Date: Tue Jul 12 02:16:48 2016 New Revision: 302604 URL: https://svnweb.freebsd.org/changeset/base/302604 Log: bhnd(4): Add bus pass-aware discovery of platform devices (PMU, NVRAM, ChipCommon, etc). This extends the existing handling of NVRAM core discovery to support locating additional devices that may be attached either directly as real cores, or indirectly via ChipCommon (e.g. bhnd_pmu). When attached as a SoC root bus (as opposed to a bridged WiFi device), the platform devices may not be attached until later bus passes, necessitating delayed discovery/initialization. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6962 Modified: head/sys/dev/bhnd/bhnd.c head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndvar.h Modified: head/sys/dev/bhnd/bhnd.c ============================================================================== --- head/sys/dev/bhnd/bhnd.c Tue Jul 12 02:12:31 2016 (r302603) +++ head/sys/dev/bhnd/bhnd.c Tue Jul 12 02:16:48 2016 (r302604) @@ -58,11 +58,20 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include "bhnd_chipc_if.h" +#include "bhnd_nvram_if.h" + #include "bhnd.h" #include "bhndvar.h" MALLOC_DEFINE(M_BHND, "bhnd", "bhnd bus data structures"); +/* Bus pass at which all bus-required children must be available, and + * attachment may be finalized. */ +#define BHND_FINISH_ATTACH_PASS BUS_PASS_DEFAULT + /** * bhnd_generic_probe_nomatch() reporting configuration. */ @@ -80,10 +89,22 @@ static const struct bhnd_nomatch { { BHND_MFGID_INVALID, BHND_COREID_INVALID, false } }; -static int compare_ascending_probe_order(const void *lhs, - const void *rhs); -static int compare_descending_probe_order(const void *lhs, - const void *rhs); + +static int bhnd_delete_children(struct bhnd_softc *sc); + +static int bhnd_finish_attach(struct bhnd_softc *sc); + +static device_t bhnd_find_chipc(struct bhnd_softc *sc); +static struct chipc_caps *bhnd_find_chipc_caps(struct bhnd_softc *sc); +static device_t bhnd_find_platform_dev(struct bhnd_softc *sc, + const char *classname); +static device_t bhnd_find_pmu(struct bhnd_softc *sc); +static device_t bhnd_find_nvram(struct bhnd_softc *sc); + +static int compare_ascending_probe_order(const void *lhs, + const void *rhs); +static int compare_descending_probe_order(const void *lhs, + const void *rhs); /** * Default bhnd(4) bus driver implementation of DEVICE_ATTACH(). @@ -94,44 +115,53 @@ static int compare_descending_probe_orde int bhnd_generic_attach(device_t dev) { - device_t *devs; - int ndevs; - int error; + struct bhnd_softc *sc; + device_t *devs; + int ndevs; + int error; if (device_is_attached(dev)) return (EBUSY); + sc = device_get_softc(dev); + sc->dev = dev; + if ((error = device_get_children(dev, &devs, &ndevs))) return (error); + /* Probe and attach all children */ qsort(devs, ndevs, sizeof(*devs), compare_ascending_probe_order); for (int i = 0; i < ndevs; i++) { device_t child = devs[i]; device_probe_and_attach(child); } + /* Try to finalize attachment */ + if (bus_current_pass >= BHND_FINISH_ATTACH_PASS) { + if ((error = bhnd_finish_attach(sc))) + goto cleanup; + } + +cleanup: free(devs, M_TEMP); - return (0); + + if (error) + bhnd_delete_children(sc); + + return (error); } /** - * Default bhnd(4) bus driver implementation of DEVICE_DETACH(). - * - * This implementation calls device_detach() for each of the device's - * children, in reverse bhnd probe order, terminating if any call to - * device_detach() fails. + * Detach and delete all children, in reverse of their attach order. */ -int -bhnd_generic_detach(device_t dev) +static int +bhnd_delete_children(struct bhnd_softc *sc) { - device_t *devs; - int ndevs; - int error; + device_t *devs; + int ndevs; + int error; - if (!device_is_attached(dev)) - return (EBUSY); - - if ((error = device_get_children(dev, &devs, &ndevs))) + if ((error = device_get_children(sc->dev, &devs, &ndevs))) return (error); /* Detach in the reverse of attach order */ @@ -140,7 +170,7 @@ bhnd_generic_detach(device_t dev) device_t child = devs[i]; /* Terminate on first error */ - if ((error = device_detach(child))) + if ((error = device_delete_child(sc->dev, child))) goto cleanup; } @@ -150,6 +180,25 @@ cleanup: } /** + * Default bhnd(4) bus driver implementation of DEVICE_DETACH(). + * + * This implementation calls device_detach() for each of the device's + * children, in reverse bhnd probe order, terminating if any call to + * device_detach() fails. + */ +int +bhnd_generic_detach(device_t dev) +{ + struct bhnd_softc *sc; + + if (!device_is_attached(dev)) + return (EBUSY); + + sc = device_get_softc(dev); + return (bhnd_delete_children(sc)); +} + +/** * Default bhnd(4) bus driver implementation of DEVICE_SHUTDOWN(). * * This implementation calls device_shutdown() for each of the device's @@ -262,6 +311,223 @@ cleanup: return (error); } +static void +bhnd_new_pass(device_t dev) +{ + struct bhnd_softc *sc; + int error; + + sc = device_get_softc(dev); + + /* Attach any permissible children */ + bus_generic_new_pass(dev); + + /* Finalize attachment */ + if (!sc->attach_done && bus_current_pass >= BHND_FINISH_ATTACH_PASS) { + if ((error = bhnd_finish_attach(sc))) { + panic("bhnd_finish_attach() failed: %d", error); + } + } +} + +/* + * Finish any pending bus attachment operations. + * + * When attached as a SoC bus (as opposed to a bridged WiFi device), our + * platform devices may not be attached until later bus passes, necessitating + * delayed initialization on our part. + */ +static int +bhnd_finish_attach(struct bhnd_softc *sc) +{ + struct chipc_caps *ccaps; + + GIANT_REQUIRED; /* newbus */ + + KASSERT(bus_current_pass >= BHND_FINISH_ATTACH_PASS, + ("bhnd_finish_attach() called in pass %d", bus_current_pass)); + + KASSERT(!sc->attach_done, ("duplicate call to bhnd_finish_attach()")); + + /* Locate chipc device */ + if ((sc->chipc_dev = bhnd_find_chipc(sc)) == NULL) { + device_printf(sc->dev, "error: ChipCommon device not found\n"); + return (ENXIO); + } + + ccaps = BHND_CHIPC_GET_CAPS(sc->chipc_dev); + + /* Look for NVRAM device */ + if (ccaps->nvram_src != BHND_NVRAM_SRC_UNKNOWN) { + if ((sc->nvram_dev = bhnd_find_nvram(sc)) == NULL) { + device_printf(sc->dev, + "warning: %s NVRAM device not found\n", + bhnd_nvram_src_name(ccaps->nvram_src)); + } + } + + /* Look for a PMU */ + if (ccaps->pmu) { + if ((sc->pmu_dev = bhnd_find_pmu(sc)) == NULL) { + device_printf(sc->dev, + "warning: PMU device not found\n"); + } + } + + /* Mark attach as completed */ + sc->attach_done = true; + + return (0); +} + +/* Locate the ChipCommon core. */ +static device_t +bhnd_find_chipc(struct bhnd_softc *sc) +{ + device_t chipc; + + /* Make sure we're holding Giant for newbus */ + GIANT_REQUIRED; + + /* chipc_dev is initialized during attachment */ + if (sc->attach_done) { + if ((chipc = sc->chipc_dev) == NULL) + return (NULL); + + goto found; + } + + /* Locate chipc core with a core unit of 0 */ + chipc = bhnd_find_child(sc->dev, BHND_DEVCLASS_CC, 0); + if (chipc == NULL) + return (NULL); + +found: + if (device_get_state(chipc) < DS_ATTACHING) { + device_printf(sc->dev, "chipc found, but did not attach\n"); + return (NULL); + } + + return (chipc); +} + +/* Locate the ChipCommon core and return the device capabilities */ +static struct chipc_caps * +bhnd_find_chipc_caps(struct bhnd_softc *sc) +{ + device_t chipc; + + if ((chipc = bhnd_find_chipc(sc)) == NULL) { + device_printf(sc->dev, + "chipc unavailable; cannot fetch capabilities\n"); + return (NULL); + } + + return (BHND_CHIPC_GET_CAPS(chipc)); +} + +/** + * Find an attached platform device on @p dev, searching first for cores + * matching @p classname, and if not found, searching the children of the first + * bhnd_chipc device on the bus. + * + * @param sc Driver state. + * @param chipc Attached ChipCommon device. + * @param classname Device class to search for. + * + * @retval device_t A matching device. + * @retval NULL If no matching device is found. + */ +static device_t +bhnd_find_platform_dev(struct bhnd_softc *sc, const char *classname) +{ + device_t chipc, child; + + /* Make sure we're holding Giant for newbus */ + GIANT_REQUIRED; + + /* Look for a directly-attached child */ + child = device_find_child(sc->dev, classname, -1); + if (child != NULL) + goto found; + + /* Look for the first matching ChipCommon child */ + if ((chipc = bhnd_find_chipc(sc)) == NULL) { + device_printf(sc->dev, + "chipc unavailable; cannot locate %s\n", classname); + return (NULL); + } + + child = device_find_child(chipc, classname, -1); + if (child == NULL) + return (NULL); + +found: + if (device_get_state(child) < DS_ATTACHING) + return (NULL); + + return (child); +} + +/* Locate the PMU device, if any */ +static device_t +bhnd_find_pmu(struct bhnd_softc *sc) +{ + struct chipc_caps *ccaps; + + /* Make sure we're holding Giant for newbus */ + GIANT_REQUIRED; + + /* pmu_dev is initialized during attachment */ + if (sc->attach_done) { + if (sc->pmu_dev == NULL) + return (NULL); + + if (device_get_state(sc->pmu_dev) < DS_ATTACHING) + return (NULL); + + return (sc->pmu_dev); + } + + if ((ccaps = bhnd_find_chipc_caps(sc)) == NULL) + return (NULL); + + if (!ccaps->pmu) + return (NULL); + + return (bhnd_find_platform_dev(sc, "bhnd_pmu")); +} + +/* Locate the NVRAM device, if any */ +static device_t +bhnd_find_nvram(struct bhnd_softc *sc) +{ + struct chipc_caps *ccaps; + + /* Make sure we're holding Giant for newbus */ + GIANT_REQUIRED; + + + /* nvram_dev is initialized during attachment */ + if (sc->attach_done) { + if (sc->nvram_dev == NULL) + return (NULL); + + if (device_get_state(sc->nvram_dev) < DS_ATTACHING) + return (NULL); + + return (sc->nvram_dev); + } + + if ((ccaps = bhnd_find_chipc_caps(sc)) == NULL) + return (NULL); + + if (ccaps->nvram_src == BHND_NVRAM_SRC_UNKNOWN) + return (NULL); + + return (bhnd_find_platform_dev(sc, "bhnd_nvram")); +} + /* * Ascending comparison of bhnd device's probe order. */ @@ -376,6 +642,35 @@ bhnd_generic_is_region_valid(device_t de } /** + * Default bhnd(4) bus driver implementation of BHND_BUS_GET_NVRAM_VAR(). + * + * This implementation searches @p dev for a usable NVRAM child device. + * + * If no usable child device is found on @p dev, the request is delegated to + * the BHND_BUS_GET_NVRAM_VAR() method on the parent of @p dev. + */ +int +bhnd_generic_get_nvram_var(device_t dev, device_t child, const char *name, + void *buf, size_t *size) +{ + struct bhnd_softc *sc; + device_t nvram, parent; + + sc = device_get_softc(dev); + + /* If a NVRAM device is available, consult it first */ + if ((nvram = bhnd_find_nvram(sc)) != NULL) + return BHND_NVRAM_GETVAR(nvram, name, buf, size); + + /* Otherwise, try to delegate to parent */ + if ((parent = device_get_parent(dev)) == NULL) + return (ENODEV); + + return (BHND_BUS_GET_NVRAM_VAR(device_get_parent(dev), child, + name, buf, size)); +} + +/** * Default bhnd(4) bus driver implementation of BUS_PRINT_CHILD(). * * This implementation requests the device's struct resource_list via @@ -538,6 +833,15 @@ bhnd_generic_child_deleted(device_t dev, /* Free device info */ if ((dinfo = device_get_ivars(child)) != NULL) BHND_BUS_FREE_DEVINFO(dev, dinfo); + + /* Clean up platform device references */ + if (sc->chipc_dev == child) { + sc->chipc_dev = NULL; + } else if (sc->nvram_dev == child) { + sc->nvram_dev = NULL; + } else if (sc->pmu_dev == child) { + sc->pmu_dev = NULL; + } } /** @@ -659,6 +963,7 @@ static device_method_t bhnd_methods[] = DEVMETHOD(device_resume, bhnd_generic_resume), /* Bus interface */ + DEVMETHOD(bus_new_pass, bhnd_new_pass), DEVMETHOD(bus_add_child, bhnd_generic_add_child), DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), @@ -691,7 +996,7 @@ static device_method_t bhnd_methods[] = DEVMETHOD(bhnd_bus_get_probe_order, bhnd_generic_get_probe_order), DEVMETHOD(bhnd_bus_is_region_valid, bhnd_generic_is_region_valid), DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_bus_generic_is_hw_disabled), - DEVMETHOD(bhnd_bus_get_nvram_var, bhnd_bus_generic_get_nvram_var), + DEVMETHOD(bhnd_bus_get_nvram_var, bhnd_generic_get_nvram_var), /* BHND interface (bus I/O) */ DEVMETHOD(bhnd_bus_read_1, bhnd_read_1), Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Tue Jul 12 02:12:31 2016 (r302603) +++ head/sys/dev/bhnd/bhnd.h Tue Jul 12 02:16:48 2016 (r302604) @@ -43,6 +43,8 @@ #include "bhnd_bus_if.h" #include "bhnd_match.h" +#include "nvram/bhnd_nvram.h" + extern devclass_t bhnd_devclass; extern devclass_t bhnd_hostb_devclass; extern devclass_t bhnd_nvram_devclass; @@ -242,6 +244,7 @@ struct bhnd_device { const char *bhnd_vendor_name(uint16_t vendor); const char *bhnd_port_type_name(bhnd_port_type port_type); +const char *bhnd_nvram_src_name(bhnd_nvram_src nvram_src); const char *bhnd_find_core_name(uint16_t vendor, uint16_t device); @@ -324,7 +327,7 @@ bool bhnd_bus_generic_is_hw_disabled bool bhnd_bus_generic_is_region_valid(device_t dev, device_t child, bhnd_port_type type, u_int port, u_int region); -int bhnd_bus_generic_read_nvram_var(device_t dev, +int bhnd_bus_generic_get_nvram_var(device_t dev, device_t child, const char *name, void *buf, size_t *size); const struct bhnd_chipid *bhnd_bus_generic_get_chipid(device_t dev, @@ -332,9 +335,6 @@ const struct bhnd_chipid *bhnd_bus_gener int bhnd_bus_generic_read_board_info(device_t dev, device_t child, struct bhnd_board_info *info); -int bhnd_bus_generic_get_nvram_var(device_t dev, - device_t child, const char *name, - void *buf, size_t *size); struct bhnd_resource *bhnd_bus_generic_alloc_resource (device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, Modified: head/sys/dev/bhnd/bhnd_subr.c ============================================================================== --- head/sys/dev/bhnd/bhnd_subr.c Tue Jul 12 02:12:31 2016 (r302603) +++ head/sys/dev/bhnd/bhnd_subr.c Tue Jul 12 02:16:48 2016 (r302604) @@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$"); #include "bhndreg.h" #include "bhndvar.h" -static device_t find_nvram_child(device_t dev); - /* BHND core device description table. */ static const struct bhnd_core_desc { uint16_t vendor; @@ -198,6 +196,25 @@ bhnd_port_type_name(bhnd_port_type port_ } } +/** + * Return the name of an NVRAM source. + */ +const char * +bhnd_nvram_src_name(bhnd_nvram_src nvram_src) +{ + switch (nvram_src) { + case BHND_NVRAM_SRC_FLASH: + return ("flash"); + case BHND_NVRAM_SRC_OTP: + return ("OTP"); + case BHND_NVRAM_SRC_SPROM: + return ("SPROM"); + case BHND_NVRAM_SRC_UNKNOWN: + return ("none"); + default: + return ("unknown"); + } +} static const struct bhnd_core_desc * bhnd_find_core_desc(uint16_t vendor, uint16_t device) @@ -293,7 +310,7 @@ bhnd_get_core_info(device_t dev) { * * @param parent The bhnd-compatible bus to be searched. * @param class The device class to match on. - * @param unit The device unit number; specify -1 to return the first match + * @param unit The core unit number; specify -1 to return the first match * regardless of unit number. * * @retval device_t if a matching child device is found. @@ -990,47 +1007,10 @@ bhnd_bus_generic_read_board_info(device_ #undef BHND_GV_REQ #undef BHND_GV_OPT - -/** - * Find an NVRAM child device on @p dev, if any. - * - * @retval device_t An NVRAM device. - * @retval NULL If no NVRAM device is found. - */ -static device_t -find_nvram_child(device_t dev) -{ - device_t chipc, nvram; - - /* Look for a directly-attached NVRAM child */ - nvram = device_find_child(dev, "bhnd_nvram", 0); - if (nvram != NULL) - return (nvram); - - /* Remaining checks are only applicable when searching a bhnd(4) - * bus. */ - if (device_get_devclass(dev) != bhnd_devclass) - return (NULL); - - /* Look for a ChipCommon-attached NVRAM device */ - if ((chipc = bhnd_find_child(dev, BHND_DEVCLASS_CC, -1)) != NULL) { - nvram = device_find_child(chipc, "bhnd_nvram", 0); - if (nvram != NULL) - return (nvram); - } - - /* Not found */ - return (NULL); -} - /** * Helper function for implementing BHND_BUS_GET_NVRAM_VAR(). * - * This implementation searches @p dev for a usable NVRAM child device: - * - The first child device implementing the bhnd_nvram devclass is - * returned, otherwise - * - If @p dev is a bhnd(4) bus, a ChipCommon core that advertises an - * attached NVRAM source. + * This implementation searches @p dev for a usable NVRAM child device. * * If no usable child device is found on @p dev, the request is delegated to * the BHND_BUS_GET_NVRAM_VAR() method on the parent of @p dev. @@ -1042,8 +1022,11 @@ bhnd_bus_generic_get_nvram_var(device_t device_t nvram; device_t parent; - /* Try to find an NVRAM device applicable to @p child */ - if ((nvram = find_nvram_child(dev)) != NULL) + /* Make sure we're holding Giant for newbus */ + GIANT_REQUIRED; + + /* Look for a directly-attached NVRAM child */ + if ((nvram = device_find_child(dev, "bhnd_nvram", -1)) != NULL) return BHND_NVRAM_GETVAR(nvram, name, buf, size); /* Try to delegate to parent */ Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Tue Jul 12 02:12:31 2016 (r302603) +++ head/sys/dev/bhnd/bhndb/bhndb.c Tue Jul 12 02:16:48 2016 (r302604) @@ -1121,7 +1121,11 @@ static int bhndb_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - int error; + struct resource_list_entry *rle; + bool passthrough; + int error; + + passthrough = (device_get_parent(child) != dev); /* Deactivate resources */ if (rman_get_flags(r) & RF_ACTIVE) { @@ -1133,6 +1137,14 @@ bhndb_release_resource(device_t dev, dev if ((error = rman_release_resource(r))) return (error); + if (!passthrough) { + /* Clean resource list entry */ + rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), + type, rid); + if (rle != NULL) + rle->res = NULL; + } + return (0); } Modified: head/sys/dev/bhnd/bhndvar.h ============================================================================== --- head/sys/dev/bhnd/bhndvar.h Tue Jul 12 02:12:31 2016 (r302603) +++ head/sys/dev/bhnd/bhndvar.h Tue Jul 12 02:16:48 2016 (r302604) @@ -56,8 +56,16 @@ struct bhnd_devinfo { * bhnd driver instance state. Must be first member of all subclass * softc structures. */ -struct bhnd_softc {}; +struct bhnd_softc { + device_t dev; /**< bus device */ + bool attach_done; /**< true if initialization of all + * platform devices has been + * completed */ + device_t chipc_dev; /**< bhnd_chipc device */ + device_t nvram_dev; /**< bhnd_nvram device, if any */ + device_t pmu_dev; /**< bhnd_pmu device, if any */ +}; int bhnd_generic_attach(device_t dev); int bhnd_generic_detach(device_t dev); @@ -82,4 +90,8 @@ int bhnd_generic_suspend_child(device int bhnd_generic_resume_child(device_t dev, device_t child); +int bhnd_generic_get_nvram_var(device_t dev, + device_t child, const char *name, void *buf, + size_t *size); + #endif /* _BHND_BHNDVAR_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 02:44:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04C97B85CD5 for ; Tue, 12 Jul 2016 02:44:32 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-153.reflexion.net [208.70.211.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2A2C1012 for ; Tue, 12 Jul 2016 02:44:31 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 23488 invoked from network); 12 Jul 2016 02:44:24 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 12 Jul 2016 02:44:24 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.90.3) with SMTP; Mon, 11 Jul 2016 22:44:35 -0400 (EDT) Received: (qmail 9173 invoked from network); 12 Jul 2016 02:44:35 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 12 Jul 2016 02:44:35 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 864B81C405F; Mon, 11 Jul 2016 19:44:23 -0700 (PDT) From: Mark Millard Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [__WCHAR_MAX definition mostly] Date: Mon, 11 Jul 2016 19:44:28 -0700 Message-Id: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> Cc: Bruce Evans To: svn-src-head@freebsd.org, ache@FreeBSD.org, FreeBSD Current , freebsd-stable@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 02:44:32 -0000 https://lists.freebsd.org/pipermail/svn-src-head/2016-July/088998.html = shows: > Modified: head/sys/arm/include/_types.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/arm/include/_types.h Mon Jul 11 23:15:54 2016 = (r302600) > +++ head/sys/arm/include/_types.h Tue Jul 12 00:37:48 2016 = (r302601) > @@ -107,7 +107,7 @@ typedef __uint32_t __vm_size_t; > =20 > typedef unsigned int ___wchar_t; > #define __WCHAR_MIN 0 /* min value for a = wchar_t */ > -#define __WCHAR_MAX __UINT_MAX /* max value for a = wchar_t */ > +#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <=3D = WINT_MAX */ > =20 > /* > * Unusual type definitions. >=20 > Modified: head/sys/arm64/include/_types.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/arm64/include/_types.h Mon Jul 11 23:15:54 2016 = (r302600) > +++ head/sys/arm64/include/_types.h Tue Jul 12 00:37:48 2016 = (r302601) > @@ -95,7 +95,7 @@ typedef __uint64_t __vm_size_t; > typedef unsigned int ___wchar_t; > =20 > #define __WCHAR_MIN 0 /* min value for a = wchar_t */ > -#define __WCHAR_MAX __UINT_MAX /* max value for a = wchar_t */ > +#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <=3D = WINT_MAX */ > =20 > /* > * Unusual type definitions. My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion of = ___wchar_t (if that is distinct). B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; not = necessarily a valid char value C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; not = necessarily a valid char value (A) and (C) seem to be violated here for __WHAR_MAX if I'm right about = (A)-(C). [I'm not sure sure that (A)'s violation for __WCHAR_MIN here = matters much if I got that combination right.] As far as I know arm FreeBSD uses unsigned character types (of whatever = width). There is also at least one past example of Bruce Evans not objecting to = __UINT_MAX for __WCHAR_MAX for arm: https://lists.freebsd.org/pipermail/freebsd-arch/2012-June/012721.html = has his only comment being. . . > % +#ifdef __ARM_EABI__ > % +#define __WCHAR_MIN (0) >=20 > Bogus parentheses. >=20 > % +#define __WCHAR_MAX __UINT_MAX (The definitions were in a different file back then, leading to the = ifdef use.) You may want to check with Bruce Evans. He has good coverage of the = various standards to be covered (that may not all agree and how/what = FreeBSD then picks). =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-svn-src-head@freebsd.org Tue Jul 12 02:57:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91068B912C1; Tue, 12 Jul 2016 02:57:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43BB91752; Tue, 12 Jul 2016 02:57:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C2vDVd005673; Tue, 12 Jul 2016 02:57:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C2vD9i005672; Tue, 12 Jul 2016 02:57:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120257.u6C2vD9i005672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 02:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302605 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 02:57:14 -0000 Author: sephe Date: Tue Jul 12 02:57:13 2016 New Revision: 302605 URL: https://svnweb.freebsd.org/changeset/base/302605 Log: hyperv/stor: Save the response status and xfer length properly. The current command response handling discards status and xfer length unconditionally, so that all of the commands would be considered successful, even if errors happened. When errors really happens, this causes all kinds of wiredness, since the buffer will not be filled on the host side and sense data will be ignored. Most of the time, errors do not happen, however, error does happen for the request sent immediately after the disk resizing. Discarding the SCSI status (SCSI_STATUS_CHECK_COND) and sense data (capacity changes) prevents the disk resizing from working properly. This commit saves the response status and xfer length properly for later use. Submitted by: Dexuan Cui Noticed by: sephe MFC after: 3 days Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7181 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 02:16:48 2016 (r302604) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 02:57:13 2016 (r302605) @@ -805,6 +805,13 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; + /* + * Copy some fields of the host's response into the request structure, + * because the fields will be used later in storvsc_io_done(). + */ + request->vstor_packet.u.vm_srb.scsi_status = vm_srb->scsi_status; + request->vstor_packet.u.vm_srb.transfer_len = vm_srb->transfer_len; + if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:03:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F8C8B91447; Tue, 12 Jul 2016 03:03:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FF111BF6; Tue, 12 Jul 2016 03:03:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C33IVf009891; Tue, 12 Jul 2016 03:03:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C33H3q009886; Tue, 12 Jul 2016 03:03:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120303.u6C33H3q009886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302606 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:03:19 -0000 Author: sephe Date: Tue Jul 12 03:03:17 2016 New Revision: 302606 URL: https://svnweb.freebsd.org/changeset/base/302606 Log: hyperv/vmbus: Reorganize vmbus scan process. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6875 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 02:57:13 2016 (r302605) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:03:17 2016 (r302606) @@ -80,14 +80,6 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE vmbus_channel_on_version_response }; -static struct mtx vmbus_chwait_lock; -MTX_SYSINIT(vmbus_chwait_lk, &vmbus_chwait_lock, "vmbus primarych wait lock", - MTX_DEF); -static uint32_t vmbus_chancnt; -static uint32_t vmbus_devcnt; - -#define VMBUS_CHANCNT_DONE 0x80000000 - /** * @brief Allocate and initialize a vmbus channel object */ @@ -124,7 +116,6 @@ static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { hv_vmbus_channel* channel; - int ret; uint32_t relid; relid = new_channel->offer_msg.child_rel_id; @@ -229,19 +220,8 @@ vmbus_channel_process_offer(hv_vmbus_cha * binding which eventually invokes the device driver's AddDevice() * method. */ - ret = hv_vmbus_child_device_register(new_channel->device); - if (ret != 0) { - mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); - hv_vmbus_free_vmbus_channel(new_channel); - } - - mtx_lock(&vmbus_chwait_lock); - vmbus_devcnt++; - mtx_unlock(&vmbus_chwait_lock); - wakeup(&vmbus_devcnt); + hv_vmbus_child_device_register(new_channel->vmbus_sc, + new_channel->device); } void @@ -332,10 +312,8 @@ vmbus_channel_on_offer(struct vmbus_soft { const hv_vmbus_channel_offer_channel *offer; - mtx_lock(&vmbus_chwait_lock); - if ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) - vmbus_chancnt++; - mtx_unlock(&vmbus_chwait_lock); + /* New channel is offered by vmbus */ + vmbus_scan_newchan(sc); offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; vmbus_channel_on_offer_internal(sc, offer); @@ -428,14 +406,12 @@ vmbus_chan_detach_task(void *xchan, int * @brief Invoked when all offers have been delivered. */ static void -vmbus_channel_on_offers_delivered(struct vmbus_softc *sc __unused, +vmbus_channel_on_offers_delivered(struct vmbus_softc *sc, const struct vmbus_message *msg __unused) { - mtx_lock(&vmbus_chwait_lock); - vmbus_chancnt |= VMBUS_CHANCNT_DONE; - mtx_unlock(&vmbus_chwait_lock); - wakeup(&vmbus_chancnt); + /* No more new channels for the channel request. */ + vmbus_scan_done(sc); } /** @@ -668,21 +644,6 @@ vmbus_select_outgoing_channel(struct hv_ return(outgoing_channel); } -void -vmbus_scan(void) -{ - uint32_t chancnt; - - mtx_lock(&vmbus_chwait_lock); - while ((vmbus_chancnt & VMBUS_CHANCNT_DONE) == 0) - mtx_sleep(&vmbus_chancnt, &vmbus_chwait_lock, 0, "waitch", 0); - chancnt = vmbus_chancnt & ~VMBUS_CHANCNT_DONE; - - while (vmbus_devcnt != chancnt) - mtx_sleep(&vmbus_devcnt, &vmbus_chwait_lock, 0, "waitdev", 0); - mtx_unlock(&vmbus_chwait_lock); -} - struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) { Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 02:57:13 2016 (r302605) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 03:03:17 2016 (r302606) @@ -411,7 +411,9 @@ struct hv_device* hv_vmbus_child_device_ hv_guid device_instance, hv_vmbus_channel *channel); -int hv_vmbus_child_device_register( +struct vmbus_softc; + +void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); int hv_vmbus_child_device_unregister( struct hv_device *child_dev); @@ -419,13 +421,9 @@ int hv_vmbus_child_device_unregister( /** * Connection interfaces */ -struct vmbus_softc; int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); -/* Wait for device creation */ -void vmbus_scan(void); - #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 02:57:13 2016 (r302605) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 03:03:17 2016 (r302606) @@ -100,6 +100,9 @@ static int vmbus_init_contact(struct v uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); static void vmbus_uninit(struct vmbus_softc *); +static int vmbus_scan(struct vmbus_softc *); +static void vmbus_scan_wait(struct vmbus_softc *); +static void vmbus_scan_newdev(struct vmbus_softc *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); @@ -467,6 +470,85 @@ vmbus_req_channels(struct vmbus_softc *s return error; } +void +vmbus_scan_newchan(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + if ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) + sc->vmbus_scan_chcnt++; + mtx_unlock(&sc->vmbus_scan_lock); +} + +void +vmbus_scan_done(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE; + mtx_unlock(&sc->vmbus_scan_lock); + wakeup(&sc->vmbus_scan_chcnt); +} + +static void +vmbus_scan_newdev(struct vmbus_softc *sc) +{ + mtx_lock(&sc->vmbus_scan_lock); + sc->vmbus_scan_devcnt++; + mtx_unlock(&sc->vmbus_scan_lock); + wakeup(&sc->vmbus_scan_devcnt); +} + +static void +vmbus_scan_wait(struct vmbus_softc *sc) +{ + uint32_t chancnt; + + mtx_lock(&sc->vmbus_scan_lock); + while ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) { + mtx_sleep(&sc->vmbus_scan_chcnt, &sc->vmbus_scan_lock, 0, + "waitch", 0); + } + chancnt = sc->vmbus_scan_chcnt & ~VMBUS_SCAN_CHCNT_DONE; + + while (sc->vmbus_scan_devcnt != chancnt) { + mtx_sleep(&sc->vmbus_scan_devcnt, &sc->vmbus_scan_lock, 0, + "waitdev", 0); + } + mtx_unlock(&sc->vmbus_scan_lock); +} + +static int +vmbus_scan(struct vmbus_softc *sc) +{ + int error; + + /* + * Start vmbus scanning. + */ + error = vmbus_req_channels(sc); + if (error) { + device_printf(sc->vmbus_dev, "channel request failed: %d\n", + error); + return error; + } + + /* + * Wait for all devices are added to vmbus. + */ + vmbus_scan_wait(sc); + + /* + * Identify, probe and attach. + */ + bus_generic_probe(sc->vmbus_dev); + bus_generic_attach(sc->vmbus_dev); + + if (bootverbose) { + device_printf(sc->vmbus_dev, "device scan, probe and attach " + "done\n"); + } + return 0; +} + static void vmbus_msg_task(void *xsc, int pending __unused) { @@ -942,12 +1024,13 @@ hv_vmbus_child_device_create(hv_guid typ return (child_dev); } -int -hv_vmbus_child_device_register(struct hv_device *child_dev) +void +hv_vmbus_child_device_register(struct vmbus_softc *sc, + struct hv_device *child_dev) { device_t child, parent; - parent = vmbus_get_device(); + parent = sc->vmbus_dev; if (bootverbose) { char name[HYPERV_GUID_STRLEN]; @@ -959,7 +1042,8 @@ hv_vmbus_child_device_register(struct hv child_dev->device = child; device_set_ivars(child, child_dev); - return (0); + /* New device was added to vmbus */ + vmbus_scan_newdev(sc); } int @@ -1025,6 +1109,8 @@ vmbus_doattach(struct vmbus_softc *sc) return (0); sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; + mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); + /* * Create context for "post message" Hypercalls */ @@ -1074,14 +1160,10 @@ vmbus_doattach(struct vmbus_softc *sc) else sc->vmbus_event_proc = vmbus_event_proc; - ret = vmbus_req_channels(sc); + ret = vmbus_scan(sc); if (ret != 0) goto cleanup; - vmbus_scan(); - bus_generic_attach(sc->vmbus_dev); - device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); - ctx = device_get_sysctl_ctx(sc->vmbus_dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev)); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version", @@ -1097,6 +1179,7 @@ cleanup: vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); sc->vmbus_msg_hc = NULL; } + mtx_destroy(&sc->vmbus_scan_lock); return (ret); } @@ -1131,7 +1214,6 @@ vmbus_attach(device_t dev) #endif vmbus_doattach(vmbus_sc); - bus_generic_probe(dev); return (0); } @@ -1178,6 +1260,7 @@ vmbus_detach(device_t dev) sc->vmbus_msg_hc = NULL; } + mtx_destroy(&sc->vmbus_scan_lock); return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 02:57:13 2016 (r302605) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 03:03:17 2016 (r302606) @@ -84,6 +84,11 @@ struct vmbus_softc { void *vmbus_mnf1; /* monitored by VM, unused */ struct hyperv_dma vmbus_mnf1_dma; struct hyperv_dma vmbus_mnf2_dma; + + struct mtx vmbus_scan_lock; + uint32_t vmbus_scan_chcnt; +#define VMBUS_SCAN_CHCNT_DONE 0x80000000 + uint32_t vmbus_scan_devcnt; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ @@ -129,4 +134,7 @@ const struct vmbus_message *vmbus_msghc_ struct vmbus_msghc *); void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_scan_done(struct vmbus_softc *); +void vmbus_scan_newchan(struct vmbus_softc *); + #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:09:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 621A3B914F5; Tue, 12 Jul 2016 03:09:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24B421E3F; Tue, 12 Jul 2016 03:09:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C39BD0010119; Tue, 12 Jul 2016 03:09:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C39BGY010116; Tue, 12 Jul 2016 03:09:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120309.u6C39BGY010116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302607 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:09:12 -0000 Author: sephe Date: Tue Jul 12 03:09:10 2016 New Revision: 302607 URL: https://svnweb.freebsd.org/changeset/base/302607 Log: hyperv/vmbus: Use post message Hypercall APIs for channel open MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6876 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:03:17 2016 (r302606) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:09:10 2016 (r302607) @@ -182,11 +182,21 @@ hv_vmbus_channel_open( hv_vmbus_pfn_channel_callback pfn_on_channel_callback, void* context) { - + struct vmbus_softc *sc = new_channel->vmbus_sc; + const struct vmbus_chanmsg_chopen_resp *resp; + const struct vmbus_message *msg; + struct vmbus_chanmsg_chopen *req; + struct vmbus_msghc *mh; + uint32_t status; int ret = 0; void *in, *out; - hv_vmbus_channel_open_channel* open_msg; - hv_vmbus_channel_msg_info* open_info; + + if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + device_printf(sc->vmbus_dev, + "invalid udata len %u for chan%u\n", + user_data_len, new_channel->offer_msg.child_rel_id); + return EINVAL; + } mtx_lock(&new_channel->sc_lock); if (new_channel->state == HV_CHANNEL_OPEN_STATE) { @@ -248,76 +258,53 @@ hv_vmbus_channel_open( send_ring_buffer_size + recv_ring_buffer_size, &new_channel->ring_buffer_gpadl_handle); - /** - * Create and init the channel open message + /* + * Open channel w/ the bufring GPADL on the target CPU. */ - open_info = (hv_vmbus_channel_msg_info*) malloc( - sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_open_channel), - M_DEVBUF, - M_NOWAIT); - KASSERT(open_info != NULL, - ("Error VMBUS: malloc failed to allocate Open Channel message!")); - - if (open_info == NULL) - return (ENOMEM); - - sema_init(&open_info->wait_sema, 0, "Open Info Sema"); - - open_msg = (hv_vmbus_channel_open_channel*) open_info->msg; - open_msg->header.message_type = HV_CHANNEL_MESSAGE_OPEN_CHANNEL; - open_msg->open_id = new_channel->offer_msg.child_rel_id; - open_msg->child_rel_id = new_channel->offer_msg.child_rel_id; - open_msg->ring_buffer_gpadl_handle = - new_channel->ring_buffer_gpadl_handle; - open_msg->downstream_ring_buffer_page_offset = send_ring_buffer_size - >> PAGE_SHIFT; - open_msg->target_vcpu = new_channel->target_vcpu; - + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chopen(chan%u)\n", + new_channel->offer_msg.child_rel_id); + return ENXIO; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; + req->chm_chanid = new_channel->offer_msg.child_rel_id; + req->chm_openid = new_channel->offer_msg.child_rel_id; + req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; + req->chm_vcpuid = new_channel->target_vcpu; + req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) - memcpy(open_msg->user_data, user_data, user_data_len); - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - open_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message( - open_msg, sizeof(hv_vmbus_channel_open_channel)); - - if (ret != 0) - goto cleanup; - - ret = sema_timedwait(&open_info->wait_sema, 5 * hz); /* KYS 5 seconds */ + memcpy(req->chm_udata, user_data, user_data_len); - if (ret) { - if(bootverbose) - printf("VMBUS: channel <%p> open timeout.\n", new_channel); - goto cleanup; + ret = vmbus_msghc_exec(sc, mh); + if (ret != 0) { + device_printf(sc->vmbus_dev, + "chopen(chan%u) msg hypercall exec failed: %d\n", + new_channel->offer_msg.child_rel_id, ret); + vmbus_msghc_put(sc, mh); + return ret; } - if (open_info->response.open_result.status == 0) { - new_channel->state = HV_CHANNEL_OPENED_STATE; - if(bootverbose) - printf("VMBUS: channel <%p> open success.\n", new_channel); + msg = vmbus_msghc_wait_result(sc, mh); + resp = (const struct vmbus_chanmsg_chopen_resp *)msg->msg_data; + status = resp->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status == 0) { + new_channel->state = HV_CHANNEL_OPENED_STATE; + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u opened\n", + new_channel->offer_msg.child_rel_id); + } } else { - if(bootverbose) - printf("Error VMBUS: channel <%p> open failed - %d!\n", - new_channel, open_info->response.open_result.status); + device_printf(sc->vmbus_dev, "failed to open chan%u\n", + new_channel->offer_msg.child_rel_id); + ret = ENXIO; } - - cleanup: - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_msg_anchor, - open_info, - msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - sema_destroy(&open_info->wait_sema); - free(open_info, M_DEVBUF); - return (ret); } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:03:17 2016 (r302606) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:09:10 2016 (r302607) @@ -418,46 +418,13 @@ vmbus_channel_on_offers_delivered(struct * @brief Open result handler. * * This is invoked when we received a response - * to our channel open request. Find the matching request, copy the - * response and signal the requesting thread. + * to our channel open request. */ static void vmbus_channel_on_open_result(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_open_result *result; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_open_channel* openMsg; - - result = (const hv_vmbus_channel_open_result *)hdr; - - /* - * Find the open msg, copy the result and signal/unblock the wait event - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; - - if (requestHeader->message_type == - HV_CHANNEL_MESSAGE_OPEN_CHANNEL) { - openMsg = (hv_vmbus_channel_open_channel*) msg_info->msg; - if (openMsg->child_rel_id == result->child_rel_id - && openMsg->open_id == result->open_id) { - memcpy(&msg_info->response.open_result, result, - sizeof(hv_vmbus_channel_open_result)); - sema_post(&msg_info->wait_sema); - break; - } - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - + vmbus_msghc_wakeup(sc, msg); } /** Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:03:17 2016 (r302606) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:09:10 2016 (r302607) @@ -84,6 +84,8 @@ CTASSERT(sizeof(struct vmbus_evtflags) = */ #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ @@ -119,4 +121,24 @@ struct vmbus_chanmsg_unload { struct vmbus_chanmsg_hdr chm_hdr; } __packed; +/* VMBUS_CHANMSG_TYPE_CHOPEN */ +struct vmbus_chanmsg_chopen { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; + uint32_t chm_openid; + uint32_t chm_gpadl; + uint32_t chm_vcpuid; + uint32_t chm_rxbr_pgofs; +#define VMBUS_CHANMSG_CHOPEN_UDATA_SIZE 120 + uint8_t chm_udata[VMBUS_CHANMSG_CHOPEN_UDATA_SIZE]; +} __packed; + +/* VMBUS_CHANMSG_TYPE_CHOPEN_RESP */ +struct vmbus_chanmsg_chopen_resp { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; + uint32_t chm_openid; + uint32_t chm_status; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:14:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B5B3B916CD; Tue, 12 Jul 2016 03:14:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D47FD13B3; Tue, 12 Jul 2016 03:14:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3EZa6013574; Tue, 12 Jul 2016 03:14:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3EZFo013573; Tue, 12 Jul 2016 03:14:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120314.u6C3EZFo013573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302608 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:14:37 -0000 Author: sephe Date: Tue Jul 12 03:14:35 2016 New Revision: 302608 URL: https://svnweb.freebsd.org/changeset/base/302608 Log: hyperv/vmbus: Remove unnecessary check and unapplied comment MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6877 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:09:10 2016 (r302607) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:14:35 2016 (r302608) @@ -975,23 +975,6 @@ VmbusProcessChannelEvent(void* context, hv_vmbus_channel* channel = (hv_vmbus_channel*)context; boolean_t is_batched_reading; - /** - * Find the channel based on this relid and invokes - * the channel callback to process the event - */ - - if (channel == NULL) { - return; - } - /** - * To deal with the race condition where we might - * receive a packet while the relevant driver is - * being unloaded, dispatch the callback while - * holding the channel lock. The unloading driver - * will acquire the same channel lock to set the - * callback to NULL. This closes the window. - */ - if (channel->on_channel_callback != NULL) { arg = channel->channel_callback_context; is_batched_reading = channel->batched_reading; From owner-svn-src-head@freebsd.org Tue Jul 12 03:19:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4E92B9178B; Tue, 12 Jul 2016 03:19:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 847C21669; Tue, 12 Jul 2016 03:19:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3JeZD013792; Tue, 12 Jul 2016 03:19:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3JeoH013787; Tue, 12 Jul 2016 03:19:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120319.u6C3JeoH013787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302609 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:19:41 -0000 Author: sephe Date: Tue Jul 12 03:19:40 2016 New Revision: 302609 URL: https://svnweb.freebsd.org/changeset/base/302609 Log: hyperv/vmbus: Use post message Hypercall APIs for GPADL connect. This also fixes memory leakge if sub-connect messages are needed. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6878 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:14:35 2016 (r302608) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:19:40 2016 (r302609) @@ -49,14 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int vmbus_channel_create_gpadl_header( - /* must be phys and virt contiguous*/ - void* contig_buffer, - /* page-size multiple */ - uint32_t size, - hv_vmbus_channel_msg_info** msg_info, - uint32_t* message_count); - static void vmbus_channel_set_event(hv_vmbus_channel* channel); static void VmbusProcessChannelEvent(void* channel, int pending); @@ -309,241 +301,130 @@ hv_vmbus_channel_open( } /** - * @brief Create a gpadl for the specified buffer + * @brief Establish a GPADL for the specified buffer */ -static int -vmbus_channel_create_gpadl_header( - void* contig_buffer, - uint32_t size, /* page-size multiple */ - hv_vmbus_channel_msg_info** msg_info, - uint32_t* message_count) -{ - int i; - int page_count; - unsigned long long pfn; - uint32_t msg_size; - hv_vmbus_channel_gpadl_header* gpa_header; - hv_vmbus_channel_gpadl_body* gpadl_body; - hv_vmbus_channel_msg_info* msg_header; - hv_vmbus_channel_msg_info* msg_body; +int +hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, + void *contig_buffer, uint32_t size, uint32_t *gpadl0) +{ + struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_conn *req; + const struct vmbus_message *msg; + size_t reqsz; + uint32_t gpadl, status; + int page_count, range_len, i, cnt, error; + uint64_t page_id, paddr; - int pfnSum, pfnCount, pfnLeft, pfnCurr, pfnSize; + /* + * Preliminary checks. + */ + KASSERT((size & PAGE_MASK) == 0, + ("invalid GPA size %u, not multiple page size", size)); page_count = size >> PAGE_SHIFT; - pfn = hv_get_phys_addr(contig_buffer) >> PAGE_SHIFT; - - /*do we need a gpadl body msg */ - pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE - - sizeof(hv_vmbus_channel_gpadl_header) - - sizeof(hv_gpa_range); - pfnCount = pfnSize / sizeof(uint64_t); - - if (page_count > pfnCount) { /* if(we need a gpadl body) */ - /* fill in the header */ - msg_size = sizeof(hv_vmbus_channel_msg_info) - + sizeof(hv_vmbus_channel_gpadl_header) - + sizeof(hv_gpa_range) - + pfnCount * sizeof(uint64_t); - msg_header = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_header != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Message!")); - if (msg_header == NULL) - return (ENOMEM); - - TAILQ_INIT(&msg_header->sub_msg_list_anchor); - msg_header->message_size = msg_size; - - gpa_header = (hv_vmbus_channel_gpadl_header*) msg_header->msg; - gpa_header->range_count = 1; - gpa_header->range_buf_len = sizeof(hv_gpa_range) - + page_count * sizeof(uint64_t); - gpa_header->range[0].byte_offset = 0; - gpa_header->range[0].byte_count = size; - for (i = 0; i < pfnCount; i++) { - gpa_header->range[0].pfn_array[i] = pfn + i; - } - *msg_info = msg_header; - *message_count = 1; - - pfnSum = pfnCount; - pfnLeft = page_count - pfnCount; - - /* - * figure out how many pfns we can fit - */ - pfnSize = HV_MAX_SIZE_CHANNEL_MESSAGE - - sizeof(hv_vmbus_channel_gpadl_body); - pfnCount = pfnSize / sizeof(uint64_t); - - /* - * fill in the body - */ - while (pfnLeft) { - if (pfnLeft > pfnCount) { - pfnCurr = pfnCount; - } else { - pfnCurr = pfnLeft; - } - - msg_size = sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_body) + - pfnCurr * sizeof(uint64_t); - msg_body = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_body != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl msg_body!")); - if (msg_body == NULL) - return (ENOMEM); - - msg_body->message_size = msg_size; - (*message_count)++; - gpadl_body = - (hv_vmbus_channel_gpadl_body*) msg_body->msg; - /* - * gpadl_body->gpadl = kbuffer; - */ - for (i = 0; i < pfnCurr; i++) { - gpadl_body->pfn[i] = pfn + pfnSum + i; - } - - TAILQ_INSERT_TAIL( - &msg_header->sub_msg_list_anchor, - msg_body, - msg_list_entry); - pfnSum += pfnCurr; - pfnLeft -= pfnCurr; - } - } else { /* else everything fits in a header */ - - msg_size = sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_header) + - sizeof(hv_gpa_range) + - page_count * sizeof(uint64_t); - msg_header = malloc(msg_size, M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT( - msg_header != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Message!")); - if (msg_header == NULL) - return (ENOMEM); - msg_header->message_size = msg_size; + paddr = hv_get_phys_addr(contig_buffer); + KASSERT((paddr & PAGE_MASK) == 0, + ("GPA is not page aligned %jx", (uintmax_t)paddr)); + page_id = paddr >> PAGE_SHIFT; - gpa_header = (hv_vmbus_channel_gpadl_header*) msg_header->msg; - gpa_header->range_count = 1; - gpa_header->range_buf_len = sizeof(hv_gpa_range) + - page_count * sizeof(uint64_t); - gpa_header->range[0].byte_offset = 0; - gpa_header->range[0].byte_count = size; - for (i = 0; i < page_count; i++) { - gpa_header->range[0].pfn_array[i] = pfn + i; - } - - *msg_info = msg_header; - *message_count = 1; + range_len = __offsetof(struct vmbus_gpa_range, gpa_page[page_count]); + /* + * We don't support multiple GPA ranges. + */ + if (range_len > UINT16_MAX) { + device_printf(sc->vmbus_dev, "GPA too large, %d pages\n", + page_count); + return EOPNOTSUPP; } - return (0); -} - -/** - * @brief Establish a GPADL for the specified buffer - */ -int -hv_vmbus_channel_establish_gpadl( - hv_vmbus_channel* channel, - void* contig_buffer, - uint32_t size, /* page-size multiple */ - uint32_t* gpadl_handle) - -{ - int ret = 0; - hv_vmbus_channel_gpadl_header* gpadl_msg; - hv_vmbus_channel_gpadl_body* gpadl_body; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_info* sub_msg_info; - uint32_t msg_count; - hv_vmbus_channel_msg_info* curr; - uint32_t next_gpadl_handle; - - next_gpadl_handle = atomic_fetchadd_int( + /* + * Allocate GPADL id. + */ + gpadl = atomic_fetchadd_int( &hv_vmbus_g_connection.next_gpadl_handle, 1); + *gpadl0 = gpadl; - ret = vmbus_channel_create_gpadl_header( - contig_buffer, size, &msg_info, &msg_count); - - if(ret != 0) { - /* - * XXX - * We can _not_ even revert the above incremental, - * if multiple GPADL establishments are running - * parallelly, decrement the global next_gpadl_handle - * is calling for _big_ trouble. A better solution - * is to have a 0-based GPADL id bitmap ... - */ - return ret; + /* + * Connect this GPADL to the target channel. + * + * NOTE: + * Since each message can only hold small set of page + * addresses, several messages may be required to + * complete the connection. + */ + if (page_count > VMBUS_CHANMSG_GPADL_CONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_CONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_conn, + chm_range.gpa_page[cnt]); + mh = vmbus_msghc_get(sc, reqsz); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpadl->chan%u\n", + channel->offer_msg.child_rel_id); + return EIO; } - sema_init(&msg_info->wait_sema, 0, "Open Info Sema"); - gpadl_msg = (hv_vmbus_channel_gpadl_header*) msg_info->msg; - gpadl_msg->header.message_type = HV_CHANNEL_MESSAGEL_GPADL_HEADER; - gpadl_msg->child_rel_id = channel->offer_msg.child_rel_id; - gpadl_msg->gpadl = next_gpadl_handle; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_msg_anchor, - msg_info, - msg_list_entry); - - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; + req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_gpadl = gpadl; + req->chm_range_len = range_len; + req->chm_range_cnt = 1; + req->chm_range.gpa_len = size; + req->chm_range.gpa_ofs = 0; + for (i = 0; i < cnt; ++i) + req->chm_range.gpa_page[i] = page_id++; - ret = hv_vmbus_post_message( - gpadl_msg, - msg_info->message_size - - (uint32_t) sizeof(hv_vmbus_channel_msg_info)); + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpadl->chan%u msg hypercall exec failed: %d\n", + channel->offer_msg.child_rel_id, error); + vmbus_msghc_put(sc, mh); + return error; + } - if (ret != 0) - goto cleanup; + while (page_count > 0) { + struct vmbus_chanmsg_gpadl_subconn *subreq; - if (msg_count > 1) { - TAILQ_FOREACH(curr, - &msg_info->sub_msg_list_anchor, msg_list_entry) { - sub_msg_info = curr; - gpadl_body = - (hv_vmbus_channel_gpadl_body*) sub_msg_info->msg; - - gpadl_body->header.message_type = - HV_CHANNEL_MESSAGE_GPADL_BODY; - gpadl_body->gpadl = next_gpadl_handle; - - ret = hv_vmbus_post_message( - gpadl_body, - sub_msg_info->message_size - - (uint32_t) sizeof(hv_vmbus_channel_msg_info)); - /* if (the post message failed) give up and clean up */ - if(ret != 0) - goto cleanup; - } - } + if (page_count > VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; - ret = sema_timedwait(&msg_info->wait_sema, 5 * hz); /* KYS 5 seconds*/ - if (ret != 0) - goto cleanup; + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_subconn, + chm_gpa_page[cnt]); + vmbus_msghc_reset(mh, reqsz); - *gpadl_handle = gpadl_msg->gpadl; + subreq = vmbus_msghc_dataptr(mh); + subreq->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_SUBCONN; + subreq->chm_gpadl = gpadl; + for (i = 0; i < cnt; ++i) + subreq->chm_gpa_page[i] = page_id++; -cleanup: + vmbus_msghc_exec_noresult(mh); + } + KASSERT(page_count == 0, ("invalid page count %d", page_count)); - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, - msg_info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); + msg = vmbus_msghc_wait_result(sc, mh); + status = ((const struct vmbus_chanmsg_gpadl_connresp *) + msg->msg_data)->chm_status; - sema_destroy(&msg_info->wait_sema); - free(msg_info, M_DEVBUF); + vmbus_msghc_put(sc, mh); - return (ret); + if (status != 0) { + device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " + "status %u\n", channel->offer_msg.child_rel_id, status); + return EIO; + } + return 0; } /** Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:14:35 2016 (r302608) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:19:40 2016 (r302609) @@ -438,39 +438,7 @@ static void vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_gpadl_created *gpadl_created; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* request_header; - hv_vmbus_channel_gpadl_header* gpadl_header; - - gpadl_created = (const hv_vmbus_channel_gpadl_created *)hdr; - - /* Find the establish msg, copy the result and signal/unblock - * the wait event - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - request_header = (hv_vmbus_channel_msg_header*) msg_info->msg; - if (request_header->message_type == - HV_CHANNEL_MESSAGEL_GPADL_HEADER) { - gpadl_header = - (hv_vmbus_channel_gpadl_header*) request_header; - - if ((gpadl_created->child_rel_id == gpadl_header->child_rel_id) - && (gpadl_created->gpadl == gpadl_header->gpadl)) { - memcpy(&msg_info->response.gpadl_created, - gpadl_created, - sizeof(hv_vmbus_channel_gpadl_created)); - sema_post(&msg_info->wait_sema); - break; - } - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); + vmbus_msghc_wakeup(sc, msg); } /** Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 03:14:35 2016 (r302608) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 03:19:40 2016 (r302609) @@ -205,25 +205,34 @@ vmbus_msghc_get1(struct vmbus_msghc_ctx return mh; } -struct vmbus_msghc * -vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize) +void +vmbus_msghc_reset(struct vmbus_msghc *mh, size_t dsize) { struct hypercall_postmsg_in *inprm; - struct vmbus_msghc *mh; if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX) - return NULL; - - mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY); - if (mh == NULL) - return NULL; + panic("invalid data size %zu", dsize); inprm = mh->mh_inprm; memset(inprm, 0, HYPERCALL_POSTMSGIN_SIZE); inprm->hc_connid = VMBUS_CONNID_MESSAGE; inprm->hc_msgtype = HYPERV_MSGTYPE_CHANNEL; inprm->hc_dsize = dsize; +} + +struct vmbus_msghc * +vmbus_msghc_get(struct vmbus_softc *sc, size_t dsize) +{ + struct vmbus_msghc *mh; + + if (dsize > HYPERCALL_POSTMSGIN_DSIZE_MAX) + panic("invalid data size %zu", dsize); + + mh = vmbus_msghc_get1(sc->vmbus_msg_hc, VMBUS_MSGHC_CTXF_DESTROY); + if (mh == NULL) + return NULL; + vmbus_msghc_reset(mh, dsize); return mh; } Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:14:35 2016 (r302608) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:19:40 2016 (r302609) @@ -30,6 +30,7 @@ #define _VMBUS_REG_H_ #include +#include /* * Hyper-V SynIC message format. @@ -78,6 +79,15 @@ CTASSERT(sizeof(struct vmbus_evtflags) = #define VMBUS_CHAN_MAX (VMBUS_EVTFLAG_LEN * VMBUS_EVTFLAGS_MAX) /* + * GPA range. + */ +struct vmbus_gpa_range { + uint32_t gpa_len; + uint32_t gpa_ofs; + uint64_t gpa_page[]; +} __packed; + +/* * Channel messages * - Embedded in vmbus_message.msg_data, e.g. response. * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. @@ -86,6 +96,9 @@ CTASSERT(sizeof(struct vmbus_evtflags) = #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ +#define VMBUS_CHANMSG_TYPE_GPADL_CONN 8 /* REQ */ +#define VMBUS_CHANMSG_TYPE_GPADL_SUBCONN 9 /* REQ */ +#define VMBUS_CHANMSG_TYPE_GPADP_CONNRESP 10 /* RESP */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ @@ -141,4 +154,40 @@ struct vmbus_chanmsg_chopen_resp { uint32_t chm_status; } __packed; +/* VMBUS_CHANMSG_TYPE_GPADL_CONN */ +struct vmbus_chanmsg_gpadl_conn { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; + uint32_t chm_gpadl; + uint16_t chm_range_len; + uint16_t chm_range_cnt; + struct vmbus_gpa_range chm_range; +} __packed; + +#define VMBUS_CHANMSG_GPADL_CONN_PGMAX 26 +CTASSERT(__offsetof(struct vmbus_chanmsg_gpadl_conn, + chm_range.gpa_page[VMBUS_CHANMSG_GPADL_CONN_PGMAX]) <= + HYPERCALL_POSTMSGIN_DSIZE_MAX); + +/* VMBUS_CHANMSG_TYPE_GPADL_SUBCONN */ +struct vmbus_chanmsg_gpadl_subconn { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_msgno; + uint32_t chm_gpadl; + uint64_t chm_gpa_page[]; +} __packed; + +#define VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX 28 +CTASSERT(__offsetof(struct vmbus_chanmsg_gpadl_subconn, + chm_gpa_page[VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX]) <= + HYPERCALL_POSTMSGIN_DSIZE_MAX); + +/* VMBUS_CHANMSG_TYPE_GPADL_CONNRESP */ +struct vmbus_chanmsg_gpadl_connresp { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; + uint32_t chm_gpadl; + uint32_t chm_status; +} __packed; + #endif /* !_VMBUS_REG_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 03:14:35 2016 (r302608) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 03:19:40 2016 (r302609) @@ -133,6 +133,7 @@ int vmbus_msghc_exec(struct vmbus_softc const struct vmbus_message *vmbus_msghc_wait_result(struct vmbus_softc *, struct vmbus_msghc *); void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_msghc_reset(struct vmbus_msghc *, size_t); void vmbus_scan_done(struct vmbus_softc *); void vmbus_scan_newchan(struct vmbus_softc *); From owner-svn-src-head@freebsd.org Tue Jul 12 03:25:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0CAFB91A7F; Tue, 12 Jul 2016 03:25:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B87501CED; Tue, 12 Jul 2016 03:25:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3PaS0017575; Tue, 12 Jul 2016 03:25:36 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3Pa8u017573; Tue, 12 Jul 2016 03:25:36 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120325.u6C3Pa8u017573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302610 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:25:38 -0000 Author: sephe Date: Tue Jul 12 03:25:36 2016 New Revision: 302610 URL: https://svnweb.freebsd.org/changeset/base/302610 Log: hyperv/vmbus: Use post message Hypercall APIs for channel close MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6906 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:19:40 2016 (r302609) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:25:36 2016 (r302610) @@ -487,10 +487,11 @@ cleanup: static void hv_vmbus_channel_close_internal(hv_vmbus_channel *channel) { - int ret = 0; + struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_chclose *req; struct taskqueue *rxq = channel->rxq; - hv_vmbus_channel_close_channel* msg; - hv_vmbus_channel_msg_info* info; + int error; channel->state = HV_CHANNEL_OPEN_STATE; @@ -504,20 +505,31 @@ hv_vmbus_channel_close_internal(hv_vmbus /** * Send a closing message */ - info = (hv_vmbus_channel_msg_info *) - malloc( sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_close_channel), - M_DEVBUF, M_NOWAIT); - KASSERT(info != NULL, ("VMBUS: malloc failed hv_vmbus_channel_close!")); - if(info == NULL) - return; - - msg = (hv_vmbus_channel_close_channel*) info->msg; - msg->header.message_type = HV_CHANNEL_MESSAGE_CLOSE_CHANNEL; - msg->child_rel_id = channel->offer_msg.child_rel_id; - ret = hv_vmbus_post_message( - msg, sizeof(hv_vmbus_channel_close_channel)); + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chclose(chan%u)\n", + channel->offer_msg.child_rel_id); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; + req->chm_chanid = channel->offer_msg.child_rel_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chclose(chan%u) msg hypercall exec failed: %d\n", + channel->offer_msg.child_rel_id, error); + return; + } else if (bootverbose) { + device_printf(sc->vmbus_dev, "close chan%u\n", + channel->offer_msg.child_rel_id); + } /* Tear down the gpadl for the channel's ring buffer */ if (channel->ring_buffer_gpadl_handle) { @@ -533,8 +545,6 @@ hv_vmbus_channel_close_internal(hv_vmbus contigfree(channel->ring_buffer_pages, channel->ring_buffer_size, M_DEVBUF); - - free(info, M_DEVBUF); } /** Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:19:40 2016 (r302609) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:25:36 2016 (r302610) @@ -96,6 +96,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ +#define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_CONN 8 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_SUBCONN 9 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADP_CONNRESP 10 /* RESP */ @@ -190,4 +191,10 @@ struct vmbus_chanmsg_gpadl_connresp { uint32_t chm_status; } __packed; +/* VMBUS_CHANMSG_TYPE_CHCLOSE */ +struct vmbus_chanmsg_chclose { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:32:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B99BEB91C84; Tue, 12 Jul 2016 03:32:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8726F13A3; Tue, 12 Jul 2016 03:32:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3W7dN020408; Tue, 12 Jul 2016 03:32:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3W7AR020405; Tue, 12 Jul 2016 03:32:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120332.u6C3W7AR020405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302611 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:32:08 -0000 Author: sephe Date: Tue Jul 12 03:32:07 2016 New Revision: 302611 URL: https://svnweb.freebsd.org/changeset/base/302611 Log: hyperv/vmbus: Use post message Hypercall APIs for GPA disconnect MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6912 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:25:36 2016 (r302610) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 03:32:07 2016 (r302611) @@ -427,61 +427,44 @@ hv_vmbus_channel_establish_gpadl(struct return 0; } -/** - * @brief Teardown the specified GPADL handle +/* + * Disconnect the GPA from the target channel */ int -hv_vmbus_channel_teardown_gpdal( - hv_vmbus_channel* channel, - uint32_t gpadl_handle) +hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) { - int ret = 0; - hv_vmbus_channel_gpadl_teardown* msg; - hv_vmbus_channel_msg_info* info; + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_disconn *req; + int error; - info = (hv_vmbus_channel_msg_info *) - malloc( sizeof(hv_vmbus_channel_msg_info) + - sizeof(hv_vmbus_channel_gpadl_teardown), - M_DEVBUF, M_NOWAIT); - KASSERT(info != NULL, - ("Error VMBUS: malloc failed to allocate Gpadl Teardown Msg!")); - if (info == NULL) { - ret = ENOMEM; - goto cleanup; - } - - sema_init(&info->wait_sema, 0, "Open Info Sema"); - - msg = (hv_vmbus_channel_gpadl_teardown*) info->msg; - - msg->header.message_type = HV_CHANNEL_MESSAGE_GPADL_TEARDOWN; - msg->child_rel_id = channel->offer_msg.child_rel_id; - msg->gpadl = gpadl_handle; - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_msg_anchor, - info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - - ret = hv_vmbus_post_message(msg, - sizeof(hv_vmbus_channel_gpadl_teardown)); - if (ret != 0) - goto cleanup; - - ret = sema_timedwait(&info->wait_sema, 5 * hz); /* KYS 5 seconds */ + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpa x->chan%u\n", + chan->offer_msg.child_rel_id); + return EBUSY; + } -cleanup: - /* - * Received a torndown response - */ - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_msg_anchor, - info, msg_list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); - sema_destroy(&info->wait_sema); - free(info, M_DEVBUF); + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; + req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_gpadl = gpadl; - return (ret); + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpa x->chan%u msg hypercall exec failed: %d\n", + chan->offer_msg.child_rel_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + vmbus_msghc_wait_result(sc, mh); + /* Discard result; no useful information */ + vmbus_msghc_put(sc, mh); + + return 0; } static void Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:25:36 2016 (r302610) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 03:32:07 2016 (r302611) @@ -452,42 +452,7 @@ static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_msg_header *hdr = - (const hv_vmbus_channel_msg_header *)msg->msg_data; - - const hv_vmbus_channel_gpadl_torndown *gpadl_torndown; - hv_vmbus_channel_msg_info* msg_info; - hv_vmbus_channel_msg_header* requestHeader; - hv_vmbus_channel_gpadl_teardown* gpadlTeardown; - - gpadl_torndown = (const hv_vmbus_channel_gpadl_torndown *)hdr; - - /* - * Find the open msg, copy the result and signal/unblock the - * wait event. - */ - - mtx_lock(&hv_vmbus_g_connection.channel_msg_lock); - - TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor, - msg_list_entry) { - requestHeader = (hv_vmbus_channel_msg_header*) msg_info->msg; - - if (requestHeader->message_type - == HV_CHANNEL_MESSAGE_GPADL_TEARDOWN) { - gpadlTeardown = - (hv_vmbus_channel_gpadl_teardown*) requestHeader; - - if (gpadl_torndown->gpadl == gpadlTeardown->gpadl) { - memcpy(&msg_info->response.gpadl_torndown, - gpadl_torndown, - sizeof(hv_vmbus_channel_gpadl_torndown)); - sema_post(&msg_info->wait_sema); - break; - } - } - } - mtx_unlock(&hv_vmbus_g_connection.channel_msg_lock); + vmbus_msghc_wakeup(sc, msg); } static void Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:25:36 2016 (r302610) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 03:32:07 2016 (r302611) @@ -99,7 +99,9 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_CONN 8 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_SUBCONN 9 /* REQ */ -#define VMBUS_CHANMSG_TYPE_GPADP_CONNRESP 10 /* RESP */ +#define VMBUS_CHANMSG_TYPE_GPADL_CONNRESP 10 /* RESP */ +#define VMBUS_CHANMSG_TYPE_GPADL_DISCONN 11 /* REQ */ +#define VMBUS_CHANMSG_TYPE_GPADL_DISCONNRESP 12 /* RESP */ #define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ @@ -197,4 +199,11 @@ struct vmbus_chanmsg_chclose { uint32_t chm_chanid; } __packed; +/* VMBUS_CHANMSG_TYPE_GPADL_DISCONN */ +struct vmbus_chanmsg_gpadl_disconn { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; + uint32_t chm_gpadl; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:38:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A707B91F56; Tue, 12 Jul 2016 03:38:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35704177C; Tue, 12 Jul 2016 03:38:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3cU65021437; Tue, 12 Jul 2016 03:38:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3cUFF021433; Tue, 12 Jul 2016 03:38:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120338.u6C3cUFF021433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 03:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302612 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:38:31 -0000 Author: sephe Date: Tue Jul 12 03:38:29 2016 New Revision: 302612 URL: https://svnweb.freebsd.org/changeset/base/302612 Log: hyperv: Nuke unused stuffs MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6913 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/hyperv.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 03:32:07 2016 (r302611) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 03:38:29 2016 (r302612) @@ -179,8 +179,6 @@ typedef struct hv_vmbus_channel_offer { } __packed hv_vmbus_channel_offer; -typedef uint32_t hv_gpadl_handle; - typedef struct { uint16_t type; uint16_t data_offset8; @@ -352,14 +350,6 @@ typedef struct { } __packed hv_vmbus_channel_query_vmbus_version; /* - * VMBus Version Supported parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - hv_bool_uint8_t version_supported; -} __packed hv_vmbus_channel_version_supported; - -/* * Channel Offer parameters */ typedef struct { @@ -397,171 +387,13 @@ typedef struct uint32_t child_rel_id; } __packed hv_vmbus_channel_rescind_offer; - -/* - * Request Offer -- no parameters, SynIC message contains the partition ID - * - * Set Snoop -- no parameters, SynIC message contains the partition ID - * - * Clear Snoop -- no parameters, SynIC message contains the partition ID - * - * All Offers Delivered -- no parameters, SynIC message contains the - * partition ID - * - * Flush Client -- no parameters, SynIC message contains the partition ID - */ - - -/* - * Open Channel parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - - /* - * Identifies the specific VMBus channel that is being opened. - */ - uint32_t child_rel_id; - - /* - * ID making a particular open request at a channel offer unique. - */ - uint32_t open_id; - - /* - * GPADL for the channel's ring buffer. - */ - hv_gpadl_handle ring_buffer_gpadl_handle; - - /* - * Before win8, all incoming channel interrupts are only - * delivered on cpu 0. Setting this value to 0 would - * preserve the earlier behavior. - */ - uint32_t target_vcpu; - - /* - * The upstream ring buffer begins at offset zero in the memory described - * by ring_buffer_gpadl_handle. The downstream ring buffer follows it at - * this offset (in pages). - */ - uint32_t downstream_ring_buffer_page_offset; - - /* - * User-specific data to be passed along to the server endpoint. - */ - uint8_t user_data[HV_MAX_USER_DEFINED_BYTES]; - -} __packed hv_vmbus_channel_open_channel; - -typedef uint32_t hv_nt_status; - -/* - * Open Channel Result parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t open_id; - hv_nt_status status; -} __packed hv_vmbus_channel_open_result; - -/* - * Close channel parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_close_channel; - -/* - * Channel Message GPADL - */ -#define HV_GPADL_TYPE_RING_BUFFER 1 -#define HV_GPADL_TYPE_SERVER_SAVE_AREA 2 -#define HV_GPADL_TYPE_TRANSACTION 8 - -/* - * The number of PFNs in a GPADL message is defined by the number of pages - * that would be spanned by byte_count and byte_offset. If the implied number - * of PFNs won't fit in this packet, there will be a follow-up packet that - * contains more - */ - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; - uint16_t range_buf_len; - uint16_t range_count; - hv_gpa_range range[0]; -} __packed hv_vmbus_channel_gpadl_header; - -/* - * This is the follow-up packet that contains more PFNs - */ -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t message_number; - uint32_t gpadl; - uint64_t pfn[0]; -} __packed hv_vmbus_channel_gpadl_body; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; - uint32_t creation_status; -} __packed hv_vmbus_channel_gpadl_created; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; - uint32_t gpadl; -} __packed hv_vmbus_channel_gpadl_teardown; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t gpadl; -} __packed hv_vmbus_channel_gpadl_torndown; - typedef struct { hv_vmbus_channel_msg_header header; uint32_t child_rel_id; } __packed hv_vmbus_channel_relid_released; -typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload; - #define HW_MACADDR_LEN 6 -/* - * Fixme: Added to quiet "typeof" errors involving hv_vmbus.h when - * the including C file was compiled with "-std=c99". - */ -#ifndef typeof -#define typeof __typeof -#endif - -#ifndef NULL -#define NULL (void *)0 -#endif - -typedef void *hv_vmbus_handle; - -#ifndef CONTAINING_RECORD -#define CONTAINING_RECORD(address, type, field) ((type *)( \ - (uint8_t *)(address) - \ - (uint8_t *)(&((type *)0)->field))) -#endif /* CONTAINING_RECORD */ - - -#define container_of(ptr, type, member) ({ \ - __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - enum { HV_VMBUS_IVAR_TYPE, HV_VMBUS_IVAR_INSTANCE, Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 03:32:07 2016 (r302611) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 03:38:29 2016 (r302612) @@ -70,10 +70,6 @@ hv_vmbus_connect(struct vmbus_softc *sc) */ hv_vmbus_g_connection.connect_state = HV_CONNECTING; - TAILQ_INIT(&hv_vmbus_g_connection.channel_msg_anchor); - mtx_init(&hv_vmbus_g_connection.channel_msg_lock, "vmbus channel msg", - NULL, MTX_DEF); - TAILQ_INIT(&hv_vmbus_g_connection.channel_anchor); mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", NULL, MTX_DEF); @@ -93,8 +89,6 @@ int hv_vmbus_disconnect(void) { - mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock); - free(hv_vmbus_g_connection.channels, M_DEVBUF); hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; @@ -165,40 +159,6 @@ vmbus_event_proc_compat(struct vmbus_sof } /** - * Send a msg on the vmbus's message connection - */ -int hv_vmbus_post_message(void *buffer, size_t bufferLen) -{ - hv_vmbus_connection_id connId; - sbintime_t time = SBT_1MS; - int retries; - int ret; - - connId.as_uint32_t = 0; - connId.u.id = HV_VMBUS_MESSAGE_CONNECTION_ID; - - /* - * We retry to cope with transient failures caused by host side's - * insufficient resources. 20 times should suffice in practice. - */ - for (retries = 0; retries < 20; retries++) { - ret = hv_vmbus_post_msg_via_msg_ipc(connId, - HYPERV_MSGTYPE_CHANNEL, buffer, bufferLen); - if (ret == HV_STATUS_SUCCESS) - return (0); - - pause_sbt("pstmsg", time, 0, C_HARDCLOCK); - if (time < SBT_1S * 2) - time *= 2; - } - - KASSERT(ret == HV_STATUS_SUCCESS, - ("Error VMBUS: Message Post Failed, ret=%d\n", ret)); - - return (EAGAIN); -} - -/** * Send an event notification to the parent */ int Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 03:32:07 2016 (r302611) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 03:38:29 2016 (r302612) @@ -90,47 +90,6 @@ typedef struct { hv_vmbus_ring_buffer_debug_info outbound; } hv_vmbus_channel_debug_info; -typedef union { - hv_vmbus_channel_version_supported version_supported; - hv_vmbus_channel_open_result open_result; - hv_vmbus_channel_gpadl_torndown gpadl_torndown; - hv_vmbus_channel_gpadl_created gpadl_created; -} hv_vmbus_channel_msg_response; - -/* - * Represents each channel msg on the vmbus connection - * This is a variable-size data structure depending on - * the msg type itself - */ -typedef struct hv_vmbus_channel_msg_info { - /* - * Bookkeeping stuff - */ - TAILQ_ENTRY(hv_vmbus_channel_msg_info) msg_list_entry; - /* - * So far, this is only used to handle - * gpadl body message - */ - TAILQ_HEAD(, hv_vmbus_channel_msg_info) sub_msg_list_anchor; - /* - * Synchronize the request/response if - * needed. - * KYS: Use a semaphore for now. - * Not perf critical. - */ - struct sema wait_sema; - hv_vmbus_channel_msg_response response; - uint32_t message_size; - /** - * The channel message that goes out on - * the "wire". It will contain at - * minimum the - * hv_vmbus_channel_msg_header - * header. - */ - unsigned char msg[0]; -} hv_vmbus_channel_msg_info; - /* * The format must be the same as hv_vm_data_gpa_direct */ @@ -244,8 +203,6 @@ typedef struct { hv_vmbus_connect_state connect_state; uint32_t next_gpadl_handle; - TAILQ_HEAD(, hv_vmbus_channel_msg_info) channel_msg_anchor; - struct mtx channel_msg_lock; /** * List of primary channels. Sub channels will be linked * under their primary channel. @@ -321,17 +278,6 @@ typedef struct { } hv_vmbus_monitor_page; /* - * Define the hv_vmbus_post_message hypercall input structure - */ -typedef struct { - hv_vmbus_connection_id connection_id; - uint32_t reserved; - hv_vmbus_msg_type message_type; - uint32_t payload_size; - uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; -} hv_vmbus_input_post_message; - -/* * Declare the various hypercall operations */ typedef enum { @@ -398,12 +344,6 @@ uint32_t hv_ring_buffer_read_end( void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); void hv_vmbus_release_unattached_channels(void); -uint16_t hv_vmbus_post_msg_via_msg_ipc( - hv_vmbus_connection_id connection_id, - hv_vmbus_msg_type message_type, - void *payload, - size_t payload_size); - uint16_t hv_vmbus_signal_event(void *con_id); struct hv_device* hv_vmbus_child_device_create( @@ -423,7 +363,6 @@ int hv_vmbus_child_device_unregister( */ int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); -int hv_vmbus_post_message(void *buffer, size_t buf_size); int hv_vmbus_set_event(hv_vmbus_channel *channel); #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 03:32:07 2016 (r302611) +++ head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 03:38:29 2016 (r302612) @@ -126,51 +126,6 @@ hypercall_post_message(bus_addr_t msg_pa } /** - * @brief Post a message using the hypervisor message IPC. - * (This involves a hypercall.) - */ -hv_vmbus_status -hv_vmbus_post_msg_via_msg_ipc( - hv_vmbus_connection_id connection_id, - hv_vmbus_msg_type message_type, - void* payload, - size_t payload_size) -{ - struct alignedinput { - uint64_t alignment8; - hv_vmbus_input_post_message msg; - }; - - hv_vmbus_input_post_message* aligned_msg; - hv_vmbus_status status; - size_t addr; - - if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT) - return (EMSGSIZE); - - addr = (size_t) malloc(sizeof(struct alignedinput), M_DEVBUF, - M_ZERO | M_NOWAIT); - KASSERT(addr != 0, - ("Error VMBUS: malloc failed to allocate message buffer!")); - if (addr == 0) - return (ENOMEM); - - aligned_msg = (hv_vmbus_input_post_message*) - (HV_ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); - - aligned_msg->connection_id = connection_id; - aligned_msg->message_type = message_type; - aligned_msg->payload_size = payload_size; - memcpy((void*) aligned_msg->payload, payload, payload_size); - - status = hv_vmbus_do_hypercall( - HV_CALL_POST_MESSAGE, aligned_msg, 0) & 0xFFFF; - - free((void *) addr, M_DEVBUF); - return (status); -} - -/** * @brief Signal an event on the specified connection using the hypervisor * event IPC. (This involves a hypercall.) */ From owner-svn-src-head@freebsd.org Tue Jul 12 03:52:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4174B923EC; Tue, 12 Jul 2016 03:52:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACF771F2A; Tue, 12 Jul 2016 03:52:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3q5p7027207; Tue, 12 Jul 2016 03:52:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3q567027206; Tue, 12 Jul 2016 03:52:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607120352.u6C3q567027206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Jul 2016 03:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302613 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:52:07 -0000 Author: kib Date: Tue Jul 12 03:52:05 2016 New Revision: 302613 URL: https://svnweb.freebsd.org/changeset/base/302613 Log: Add assert to complement r302328. AST must not execute with TDF_SBDRY or TDF_SEINTR/TDF_SERESTART thread flags set, which is asserted in userret(). As the consequence, -1 return from cursig() must not be possible. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Jul 12 03:38:29 2016 (r302612) +++ head/sys/kern/subr_trap.c Tue Jul 12 03:52:05 2016 (r302613) @@ -274,8 +274,10 @@ ast(struct trapframe *framep) !SIGISEMPTY(p->p_siglist)) { PROC_LOCK(p); mtx_lock(&p->p_sigacts->ps_mtx); - while ((sig = cursig(td)) != 0) + while ((sig = cursig(td)) != 0) { + KASSERT(sig >= 0, ("sig %d", sig)); postsig(sig); + } mtx_unlock(&p->p_sigacts->ps_mtx); PROC_UNLOCK(p); } From owner-svn-src-head@freebsd.org Tue Jul 12 03:53:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 424F4B92479; Tue, 12 Jul 2016 03:53:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 000921282; Tue, 12 Jul 2016 03:53:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C3rGQk028800; Tue, 12 Jul 2016 03:53:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C3rGj1028799; Tue, 12 Jul 2016 03:53:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607120353.u6C3rGj1028799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 12 Jul 2016 03:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302614 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:53:17 -0000 Author: kib Date: Tue Jul 12 03:53:15 2016 New Revision: 302614 URL: https://svnweb.freebsd.org/changeset/base/302614 Log: Revive the check, disabled in r197963. Despite the implication (process has pending signals -> the current thread marked for AST and has TDF_NEEDSIGCHK set) is not true due to other thread might manipulate its signal blocking mask, it should still hold for the single-threaded processes. Enable check for the condition for single-threaded case, and replicate it from userret() to ast() as well, where we check that ast indeed has no signal to deliver. Note that the check is under DIAGNOSTIC, it is not enabled for INVARIANTS but !DIAGNOSTIC since it imposes too heavy-weight locking for day-to-day used debugging kernel. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Jul 12 03:52:05 2016 (r302613) +++ head/sys/kern/subr_trap.c Tue Jul 12 03:53:15 2016 (r302614) @@ -101,17 +101,24 @@ userret(struct thread *td, struct trapfr td->td_name); KASSERT((p->p_flag & P_WEXIT) == 0, ("Exiting process returns to usermode")); -#if 0 #ifdef DIAGNOSTIC - /* Check that we called signotify() enough. */ - PROC_LOCK(p); - thread_lock(td); - if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 || - (td->td_flags & TDF_ASTPENDING) == 0)) - printf("failed to set signal flags properly for ast()\n"); - thread_unlock(td); - PROC_UNLOCK(p); -#endif + /* + * Check that we called signotify() enough. For + * multi-threaded processes, where signal distribution might + * change due to other threads changing sigmask, the check is + * racy and cannot be performed reliably. + */ + if (p->p_numthreads == 1) { + PROC_LOCK(p); + thread_lock(td); + KASSERT(!SIGPENDING(td) || + (td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) == + (TDF_NEEDSIGCHK | TDF_ASTPENDING), + ("failed to set signal flags for ast p %p td %p fl %x", + p, td, td->td_flags)); + thread_unlock(td); + PROC_UNLOCK(p); + } #endif #ifdef KTRACE KTRUSERRET(td); @@ -265,6 +272,26 @@ ast(struct trapframe *framep) #endif } +#ifdef DIAGNOSTIC + if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) { + PROC_LOCK(p); + thread_lock(td); + /* + * Note that TDF_NEEDSIGCHK should be re-read from + * td_flags, since signal might have been delivered + * after we cleared td_flags above. This is one of + * the reason for looping check for AST condition. + */ + KASSERT(!SIGPENDING(td) || + (td->td_flags & (TDF_NEEDSIGCHK | TDF_ASTPENDING)) == + (TDF_NEEDSIGCHK | TDF_ASTPENDING), + ("failed2 to set signal flags for ast p %p td %p fl %x %x", + p, td, flags, td->td_flags)); + thread_unlock(td); + PROC_UNLOCK(p); + } +#endif + /* * Check for signals. Unlocked reads of p_pendingcnt or * p_siglist might cause process-directed signal to be handled From owner-svn-src-head@freebsd.org Tue Jul 12 03:58:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B92BB925AC for ; Tue, 12 Jul 2016 03:58:03 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B18C6153D for ; Tue, 12 Jul 2016 03:58:02 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f51.google.com with SMTP id q132so2332778lfe.3 for ; Mon, 11 Jul 2016 20:58:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=0nhk2KkMaPDyZ2vaCh68ir713TZduRu8jgFYJ3rUklI=; b=O2AmIemXKx+jnq/EEofyCPU9yA9+NNYhuxlpFO1bXBwZNzE0ZhwyW045xl3rDSBAns J3y+Z1A5cE5W8dwUyOOPM6+j1+8WCQCQ02XfK/VLtEjEdQ/3d6lvmpeyNxgmdC/L9OSz XZF581KO8Dli24IQmmpX6u8fqiPAov9jYQ5SnhWSU8ekI+ceIz92fXc3I/J9Hu+QhgOX R/SdvGtB0ybXtvILtKzkmAmw5sOzyW74awuojDvpE2QwUfZPrlhtE+AEprSoxI/f93pX N6tvNVWvtywHL+SjL0iEszNP8LZwOcwuDVBMD6Ei2g7qGsglctMVg3KCYNOAvprTyuVP ub5g== X-Gm-Message-State: ALyK8tJ0okuGXk2xdznQxndxLq1TJq1LQEp2iS5hW4M9IUbnxIWnl+oVMgvpuoGZiZGXiQ== X-Received: by 10.25.38.213 with SMTP id m204mr22723lfm.107.1468295880295; Mon, 11 Jul 2016 20:58:00 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id r190sm1279323lfg.49.2016.07.11.20.57.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2016 20:57:59 -0700 (PDT) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [__WCHAR_MAX definition mostly] To: Mark Millard , svn-src-head@freebsd.org, FreeBSD Current , freebsd-stable@freebsd.org References: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> Cc: Bruce Evans From: Andrey Chernov Message-ID: Date: Tue, 12 Jul 2016 06:57:58 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 03:58:03 -0000 On 12.07.2016 5:44, Mark Millard wrote: > My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: > > A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion of > ___wchar_t (if that is distinct). > B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; not > necessarily a valid char value > C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; not > necessarily a valid char value It seems you are right about "not a valid char value", I'll back this change out. > As far as I know arm FreeBSD uses unsigned character types (of whatever > width). Probably it should be unsigned for other architectures too, clang does not generate negative values with L'' literals and locale use only positive values too. From owner-svn-src-head@freebsd.org Tue Jul 12 04:20:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED8DB92C75; Tue, 12 Jul 2016 04:20:46 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8EB01F4D; Tue, 12 Jul 2016 04:20:45 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C4KjBk039326; Tue, 12 Jul 2016 04:20:45 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C4KiSB039324; Tue, 12 Jul 2016 04:20:44 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607120420.u6C4KiSB039324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 12 Jul 2016 04:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302615 - in head/sys: arm/include arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 04:20:46 -0000 Author: ache Date: Tue Jul 12 04:20:44 2016 New Revision: 302615 URL: https://svnweb.freebsd.org/changeset/base/302615 Log: Undo r302601, WCHAR_MAX may not be a valid wchar value. Modified: head/sys/arm/include/_types.h head/sys/arm64/include/_types.h Modified: head/sys/arm/include/_types.h ============================================================================== --- head/sys/arm/include/_types.h Tue Jul 12 03:53:15 2016 (r302614) +++ head/sys/arm/include/_types.h Tue Jul 12 04:20:44 2016 (r302615) @@ -107,7 +107,7 @@ typedef __uint32_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ -#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <= WINT_MAX */ +#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ /* * Unusual type definitions. Modified: head/sys/arm64/include/_types.h ============================================================================== --- head/sys/arm64/include/_types.h Tue Jul 12 03:53:15 2016 (r302614) +++ head/sys/arm64/include/_types.h Tue Jul 12 04:20:44 2016 (r302615) @@ -95,7 +95,7 @@ typedef __uint64_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ -#define __WCHAR_MAX __INT_MAX /* max for a wchar_t <= WINT_MAX */ +#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ /* * Unusual type definitions. From owner-svn-src-head@freebsd.org Tue Jul 12 04:29:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66744B92EBF; Tue, 12 Jul 2016 04:29:35 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 261FB14CE; Tue, 12 Jul 2016 04:29:35 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C4TYdB040300; Tue, 12 Jul 2016 04:29:34 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C4TYK1040299; Tue, 12 Jul 2016 04:29:34 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607120429.u6C4TYK1040299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 12 Jul 2016 04:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302616 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 04:29:35 -0000 Author: ache Date: Tue Jul 12 04:29:34 2016 New Revision: 302616 URL: https://svnweb.freebsd.org/changeset/base/302616 Log: Undo r302599 and partially r302594 case 2): since WCHAR_MAX can be not a valid wchar value, it is easier to stay inside wint_t. Modified: head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Tue Jul 12 04:20:44 2016 (r302615) +++ head/usr.bin/tr/tr.c Tue Jul 12 04:29:34 2016 (r302616) @@ -266,7 +266,7 @@ endloop: */ s2.str = argv[1]; s2.state = NORMAL; - for (cnt = 0; cnt <= (wint_t)WCHAR_MAX; cnt++) { + for (cnt = 0; cnt <= WINT_MAX; cnt++) { if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { From owner-svn-src-head@freebsd.org Tue Jul 12 04:35:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D40FCB9208B; Tue, 12 Jul 2016 04:35:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE5C919DD; Tue, 12 Jul 2016 04:35:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C4ZWin043998; Tue, 12 Jul 2016 04:35:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C4ZWvd043997; Tue, 12 Jul 2016 04:35:32 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120435.u6C4ZWvd043997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 04:35:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302617 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 04:35:33 -0000 Author: sephe Date: Tue Jul 12 04:35:32 2016 New Revision: 302617 URL: https://svnweb.freebsd.org/changeset/base/302617 Log: hyperv/vmbus: Flatten channel message response processing. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6914 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:29:34 2016 (r302616) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:35:32 2016 (r302617) @@ -46,18 +46,10 @@ static void vmbus_chan_detach_task(void static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_open_result(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_gpadl_created(struct vmbus_softc *, - const struct vmbus_message *); -static void vmbus_channel_on_gpadl_torndown(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_version_response(struct vmbus_softc *, - const struct vmbus_message *); /** * Channel message dispatch table @@ -71,13 +63,13 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = vmbus_channel_on_offers_delivered, [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = - vmbus_channel_on_open_result, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_GPADL_CREATED] = - vmbus_channel_on_gpadl_created, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = - vmbus_channel_on_gpadl_torndown, + vmbus_msghc_wakeup, [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = - vmbus_channel_on_version_response + vmbus_msghc_wakeup }; /** @@ -415,54 +407,6 @@ vmbus_channel_on_offers_delivered(struct } /** - * @brief Open result handler. - * - * This is invoked when we received a response - * to our channel open request. - */ -static void -vmbus_channel_on_open_result(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** - * @brief GPADL created handler. - * - * This is invoked when we received a response - * to our gpadl create request. Find the matching request, copy the - * response and signal the requesting thread. - */ -static void -vmbus_channel_on_gpadl_created(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** - * @brief GPADL torndown handler. - * - * This is invoked when we received a respons - * to our gpadl teardown request. Find the matching request, copy the - * response and signal the requesting thread - */ -static void -vmbus_channel_on_gpadl_torndown(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -static void -vmbus_channel_on_version_response(struct vmbus_softc *sc, - const struct vmbus_message *msg) -{ - vmbus_msghc_wakeup(sc, msg); -} - -/** * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void From owner-svn-src-head@freebsd.org Tue Jul 12 04:58:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33A93B9263E; Tue, 12 Jul 2016 04:58:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DECC91444; Tue, 12 Jul 2016 04:58:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C4wMf1051541; Tue, 12 Jul 2016 04:58:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C4wLUF051539; Tue, 12 Jul 2016 04:58:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120458.u6C4wLUF051539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 04:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302618 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 04:58:23 -0000 Author: sephe Date: Tue Jul 12 04:58:21 2016 New Revision: 302618 URL: https://svnweb.freebsd.org/changeset/base/302618 Log: hyperv/vmbus: Avoid tx_evtflags setting code duplication. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6915 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 04:35:32 2016 (r302617) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 04:58:21 2016 (r302618) @@ -58,14 +58,14 @@ static void VmbusProcessChannelEvent(voi static void vmbus_channel_set_event(hv_vmbus_channel *channel) { + struct vmbus_softc *sc = channel->vmbus_sc; + uint32_t chanid = channel->offer_msg.child_rel_id; + + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); + if (channel->offer_msg.monitor_allocated) { - struct vmbus_softc *sc = channel->vmbus_sc; hv_vmbus_monitor_page *monitor_page; - uint32_t chanid = channel->offer_msg.child_rel_id; - - atomic_set_long( - &sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); monitor_page = sc->vmbus_mnf2; synch_set_bit(channel->monitor_bit, Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 04:35:32 2016 (r302617) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 04:58:21 2016 (r302618) @@ -164,15 +164,8 @@ vmbus_event_proc_compat(struct vmbus_sof int hv_vmbus_set_event(hv_vmbus_channel *channel) { - struct vmbus_softc *sc = channel->vmbus_sc; - int ret = 0; - uint32_t chanid = channel->offer_msg.child_rel_id; - atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - ret = hv_vmbus_signal_event(channel->signal_event_param); - - return (ret); + return hv_vmbus_signal_event(channel->signal_event_param); } void From owner-svn-src-head@freebsd.org Tue Jul 12 05:09:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26D95B9282C; Tue, 12 Jul 2016 05:09:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02CAD1A58; Tue, 12 Jul 2016 05:09:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C599Zn055172; Tue, 12 Jul 2016 05:09:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C598Qg055161; Tue, 12 Jul 2016 05:09:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120509.u6C598Qg055161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 05:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302619 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 05:09:10 -0000 Author: sephe Date: Tue Jul 12 05:09:07 2016 New Revision: 302619 URL: https://svnweb.freebsd.org/changeset/base/302619 Log: hyperv/vmbus: Busdma-fy Hypercall signal event input parameter. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6916 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/hyperv_busdma.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/hyperv_reg.h head/sys/dev/hyperv/vmbus/hyperv_var.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 05:09:07 2016 (r302619) @@ -55,6 +55,7 @@ #include #include +#include typedef uint8_t hv_bool_uint8_t; @@ -528,20 +529,6 @@ typedef union { } __packed hv_vmbus_connection_id; -/* - * Definition of the hv_vmbus_signal_event hypercall input structure - */ -typedef struct { - hv_vmbus_connection_id connection_id; - uint16_t flag_number; - uint16_t rsvd_z; -} __packed hv_vmbus_input_signal_event; - -typedef struct { - uint64_t align8; - hv_vmbus_input_signal_event event; -} __packed hv_vmbus_input_signal_event_buffer; - typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; @@ -589,14 +576,8 @@ typedef struct hv_vmbus_channel { boolean_t is_dedicated_interrupt; - /* - * Used as an input param for HV_CALL_SIGNAL_EVENT hypercall. - */ - hv_vmbus_input_signal_event_buffer signal_event_buffer; - /* - * 8-bytes aligned of the buffer above - */ - hv_vmbus_input_signal_event *signal_event_param; + struct hypercall_sigevt_in *ch_sigevt; + struct hyperv_dma ch_sigevt_dma; /* * From Win8, this field specifies the target virtual process Modified: head/sys/dev/hyperv/include/hyperv_busdma.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv_busdma.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/include/hyperv_busdma.h Tue Jul 12 05:09:07 2016 (r302619) @@ -29,6 +29,10 @@ #ifndef _HYPERV_BUSDMA_H_ #define _HYPERV_BUSDMA_H_ +#include +#include +#include + struct hyperv_dma { bus_addr_t hv_paddr; bus_dma_tag_t hv_dtag; Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 05:09:07 2016 (r302619) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -72,7 +73,7 @@ vmbus_channel_set_event(hv_vmbus_channel (uint32_t *)&monitor_page-> trigger_group[channel->monitor_group].u.pending); } else { - hv_vmbus_set_event(channel); + hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr); } } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:09:07 2016 (r302619) @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -327,23 +328,23 @@ vmbus_channel_on_offer_internal(struct v */ new_channel->batched_reading = TRUE; - new_channel->signal_event_param = - (hv_vmbus_input_signal_event *) - (HV_ALIGN_UP((unsigned long) - &new_channel->signal_event_buffer, - HV_HYPERCALL_PARAM_ALIGN)); - - new_channel->signal_event_param->connection_id.as_uint32_t = 0; - new_channel->signal_event_param->connection_id.u.id = - HV_VMBUS_EVENT_CONNECTION_ID; - new_channel->signal_event_param->flag_number = 0; - new_channel->signal_event_param->rsvd_z = 0; + new_channel->ch_sigevt = hyperv_dmamem_alloc( + bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in), + &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (new_channel->ch_sigevt == NULL) { + device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); + /* XXX */ + mtx_destroy(&new_channel->sc_lock); + free(new_channel, M_DEVBUF); + return; + } + new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; if (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) { new_channel->is_dedicated_interrupt = (offer->is_dedicated_interrupt != 0); - new_channel->signal_event_param->connection_id.u.id = - offer->connection_id; + new_channel->ch_sigevt->hc_connid = offer->connection_id; } memcpy(&new_channel->offer_msg, offer, Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 05:09:07 2016 (r302619) @@ -158,16 +158,6 @@ vmbus_event_proc_compat(struct vmbus_sof } } -/** - * Send an event notification to the parent - */ -int -hv_vmbus_set_event(hv_vmbus_channel *channel) -{ - - return hv_vmbus_signal_event(channel->signal_event_param); -} - void vmbus_on_channel_open(const struct hv_vmbus_channel *chan) { Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 05:09:07 2016 (r302619) @@ -363,6 +363,5 @@ int hv_vmbus_child_device_unregister( */ int hv_vmbus_connect(struct vmbus_softc *); int hv_vmbus_disconnect(void); -int hv_vmbus_set_event(hv_vmbus_channel *channel); #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 05:09:07 2016 (r302619) @@ -125,6 +125,13 @@ hypercall_post_message(bus_addr_t msg_pa HYPERCALL_POST_MESSAGE, msg_paddr, 0); } +uint64_t +hypercall_signal_event(bus_addr_t sigevt_paddr) +{ + return hypercall_md(hypercall_context.hc_addr, + HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0); +} + /** * @brief Signal an event on the specified connection using the hypervisor * event IPC. (This involves a hypercall.) Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Tue Jul 12 05:09:07 2016 (r302619) @@ -148,6 +148,7 @@ * Hypercall input values */ #define HYPERCALL_POST_MESSAGE 0x005c +#define HYPERCALL_SIGNAL_EVENT 0x005d /* * Hypercall input parameters @@ -169,4 +170,15 @@ struct hypercall_postmsg_in { } __packed; CTASSERT(sizeof(struct hypercall_postmsg_in) == HYPERCALL_POSTMSGIN_SIZE); +/* + * HYPERCALL_SIGNAL_EVENT + */ +#define HYPERCALL_SIGEVTIN_ALIGN 8 + +struct hypercall_sigevt_in { + uint32_t hc_connid; + uint16_t hc_evtflag_ofs; + uint16_t hc_rsvd; +} __packed; + #endif /* !_HYPERV_REG_H_ */ Modified: head/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_var.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/hyperv_var.h Tue Jul 12 05:09:07 2016 (r302619) @@ -39,5 +39,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; uint64_t hypercall_post_message(bus_addr_t msg_paddr); +uint64_t hypercall_signal_event(bus_addr_t sigevt_paddr); #endif /* !_HYPERV_VAR_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 05:09:07 2016 (r302619) @@ -69,12 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" -/* - * NOTE: DO NOT CHANGE THESE - */ -#define VMBUS_CONNID_MESSAGE 1 -#define VMBUS_CONNID_EVENT 2 - struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; struct hypercall_postmsg_in mh_inprm_save; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 04:58:21 2016 (r302618) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 05:09:07 2016 (r302619) @@ -46,6 +46,12 @@ */ #define VMBUS_SINT_TIMER 4 +/* + * NOTE: DO NOT CHANGE THESE + */ +#define VMBUS_CONNID_MESSAGE 1 +#define VMBUS_CONNID_EVENT 2 + struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ From owner-svn-src-head@freebsd.org Tue Jul 12 05:23:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 077EEB92BF3; Tue, 12 Jul 2016 05:23:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA835135E; Tue, 12 Jul 2016 05:23:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C5NErM062329; Tue, 12 Jul 2016 05:23:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C5NEMF062327; Tue, 12 Jul 2016 05:23:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120523.u6C5NEMF062327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 05:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302620 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 05:23:16 -0000 Author: sephe Date: Tue Jul 12 05:23:14 2016 New Revision: 302620 URL: https://svnweb.freebsd.org/changeset/base/302620 Log: hyperv: Nuke unused stuffs MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6917 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/hyperv.c Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 05:09:07 2016 (r302619) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 05:23:14 2016 (r302620) @@ -38,29 +38,6 @@ #include - -/* - * Status codes for hypervisor operations. - */ - -typedef uint16_t hv_vmbus_status; - -#define HV_MESSAGE_SIZE (256) -#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240) -#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30) -#define HV_ANY_VP (0xFFFFFFFF) - -/* - * MessageId: HV_STATUS_INSUFFICIENT_BUFFERS - * MessageText: - * You did not supply enough message buffers to send a message. - */ - -#define HV_STATUS_SUCCESS ((uint16_t)0) -#define HV_STATUS_INSUFFICIENT_BUFFERS ((uint16_t)0x0013) - -typedef void (*hv_vmbus_channel_callback)(void *context); - typedef struct { void* data; uint32_t length; @@ -118,74 +95,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -enum { - HV_VMBUS_MESSAGE_CONNECTION_ID = 1, - HV_VMBUS_MESSAGE_PORT_ID = 1, - HV_VMBUS_EVENT_CONNECTION_ID = 2, - HV_VMBUS_EVENT_PORT_ID = 2, - HV_VMBUS_MONITOR_CONNECTION_ID = 3, - HV_VMBUS_MONITOR_PORT_ID = 3, -}; - -#define HV_PRESENT_BIT 0x80000000 - -#define HV_HYPERCALL_PARAM_ALIGN sizeof(uint64_t) - -/* - * Define hypervisor message types - */ -typedef enum { - - HV_MESSAGE_TYPE_NONE = 0x00000000, - - /* - * Memory access messages - */ - HV_MESSAGE_TYPE_UNMAPPED_GPA = 0x80000000, - HV_MESSAGE_TYPE_GPA_INTERCEPT = 0x80000001, - - /* - * Timer notification messages - */ - HV_MESSAGE_TIMER_EXPIRED = 0x80000010, - - /* - * Error messages - */ - HV_MESSAGE_TYPE_INVALID_VP_REGISTER_VALUE = 0x80000020, - HV_MESSAGE_TYPE_UNRECOVERABLE_EXCEPTION = 0x80000021, - HV_MESSAGE_TYPE_UNSUPPORTED_FEATURE = 0x80000022, - - /* - * Trace buffer complete messages - */ - HV_MESSAGE_TYPE_EVENT_LOG_BUFFER_COMPLETE = 0x80000040, - - /* - * Platform-specific processor intercept messages - */ - HV_MESSAGE_TYPE_X64_IO_PORT_INTERCEPT = 0x80010000, - HV_MESSAGE_TYPE_X64_MSR_INTERCEPT = 0x80010001, - HV_MESSAGE_TYPE_X64_CPU_INTERCEPT = 0x80010002, - HV_MESSAGE_TYPE_X64_EXCEPTION_INTERCEPT = 0x80010003, - HV_MESSAGE_TYPE_X64_APIC_EOI = 0x80010004, - HV_MESSAGE_TYPE_X64_LEGACY_FP_ERROR = 0x80010005 - -} hv_vmbus_msg_type; - -/* - * Define port identifier type - */ -typedef union _hv_vmbus_port_id { - uint32_t as_uint32_t; - struct { - uint32_t id:24; - uint32_t reserved:8; - } u ; -} hv_vmbus_port_id; - -typedef uint64_t hv_vmbus_partition_id; - /* * VM Bus connection states */ @@ -196,9 +105,6 @@ typedef enum { HV_DISCONNECTING } hv_vmbus_connect_state; -#define HV_MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT - - typedef struct { hv_vmbus_connect_state connect_state; uint32_t next_gpadl_handle; @@ -277,14 +183,6 @@ typedef struct { uint8_t rsvd_z4[1984]; } hv_vmbus_monitor_page; -/* - * Declare the various hypercall operations - */ -typedef enum { - HV_CALL_POST_MESSAGE = 0x005c, - HV_CALL_SIGNAL_EVENT = 0x005d, -} hv_vmbus_call_code; - /** * Global variables */ @@ -344,8 +242,6 @@ uint32_t hv_ring_buffer_read_end( void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); void hv_vmbus_release_unattached_channels(void); -uint16_t hv_vmbus_signal_event(void *con_id); - struct hv_device* hv_vmbus_child_device_create( hv_guid device_type, hv_guid device_instance, Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 05:09:07 2016 (r302619) +++ head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 05:23:14 2016 (r302620) @@ -101,23 +101,6 @@ hyperv_get_timecount(struct timecounter return rdmsr(MSR_HV_TIME_REF_COUNT); } -/** - * @brief Invoke the specified hypercall - */ -static uint64_t -hv_vmbus_do_hypercall(uint64_t value, void *input, void *output) -{ - uint64_t in_paddr = 0, out_paddr = 0; - - if (input != NULL) - in_paddr = hv_get_phys_addr(input); - if (output != NULL) - out_paddr = hv_get_phys_addr(output); - - return hypercall_md(hypercall_context.hc_addr, value, - in_paddr, out_paddr); -} - uint64_t hypercall_post_message(bus_addr_t msg_paddr) { @@ -132,23 +115,6 @@ hypercall_signal_event(bus_addr_t sigevt HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0); } -/** - * @brief Signal an event on the specified connection using the hypervisor - * event IPC. (This involves a hypercall.) - */ -hv_vmbus_status -hv_vmbus_signal_event(void *con_id) -{ - hv_vmbus_status status; - - status = hv_vmbus_do_hypercall( - HV_CALL_SIGNAL_EVENT, - con_id, - 0) & 0xFFFF; - - return (status); -} - int hyperv_guid2str(const struct hv_guid *guid, char *buf, size_t sz) { From owner-svn-src-head@freebsd.org Tue Jul 12 05:31:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF0A3B92FD9; Tue, 12 Jul 2016 05:31:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C46C18CB; Tue, 12 Jul 2016 05:31:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C5VXYw064643; Tue, 12 Jul 2016 05:31:33 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C5VXTS064640; Tue, 12 Jul 2016 05:31:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120531.u6C5VXTS064640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 05:31:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302621 - in head/sys/dev/hyperv: include storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 05:31:34 -0000 Author: sephe Date: Tue Jul 12 05:31:33 2016 New Revision: 302621 URL: https://svnweb.freebsd.org/changeset/base/302621 Log: hyperv/vmbus: Don't be oversmart in default cpu selection. Pin the channel to cpu0 by default. Drivers having special channel-cpu mapping requirement should call vmbus_channel_cpu_{set,rr}() themselves. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6918 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 05:23:14 2016 (r302620) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 05:31:33 2016 (r302621) @@ -707,6 +707,7 @@ int hv_vmbus_channel_teardown_gpdal( struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 05:23:14 2016 (r302620) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 05:31:33 2016 (r302621) @@ -361,6 +361,7 @@ storvsc_subchan_attach(struct hv_vmbus_c memset(&props, 0, sizeof(props)); + vmbus_channel_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -655,7 +656,7 @@ hv_storvsc_connect_vsp(struct hv_device /* * Open the channel */ - + vmbus_channel_cpu_rr(dev->channel); ret = hv_vmbus_channel_open( dev->channel, sc->hs_drv_props->drv_ringbuffer_size, Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:23:14 2016 (r302620) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 05:31:33 2016 (r302621) @@ -238,61 +238,25 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } } -/** - * Array of device guids that are performance critical. We try to distribute - * the interrupt load for these devices across all online cpus. - */ -static const hv_guid high_perf_devices[] = { - {HV_NIC_GUID, }, - {HV_IDE_GUID, }, - {HV_SCSI_GUID, }, -}; - -enum { - PERF_CHN_NIC = 0, - PERF_CHN_IDE, - PERF_CHN_SCSI, - MAX_PERF_CHN, -}; +void +vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +{ + static uint32_t vmbus_chan_nextcpu; + int cpu; -/* - * We use this static number to distribute the channel interrupt load. - */ -static uint32_t next_vcpu; + cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; + vmbus_channel_cpu_set(chan, cpu); +} -/** - * Starting with Win8, we can statically distribute the incoming - * channel interrupt load by binding a channel to VCPU. We - * implement here a simple round robin scheme for distributing - * the interrupt load. - * We will bind channels that are not performance critical to cpu 0 and - * performance critical channels (IDE, SCSI and Network) will be uniformly - * distributed across all available CPUs. - */ static void -vmbus_channel_select_defcpu(struct hv_vmbus_channel *channel) +vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan) { - uint32_t current_cpu; - int i; - boolean_t is_perf_channel = FALSE; - const hv_guid *guid = &channel->offer_msg.offer.interface_type; - - for (i = PERF_CHN_NIC; i < MAX_PERF_CHN; i++) { - if (memcmp(guid->data, high_perf_devices[i].data, - sizeof(hv_guid)) == 0) { - is_perf_channel = TRUE; - break; - } - } - - if (!is_perf_channel) { - /* Stick to cpu0 */ - vmbus_channel_cpu_set(channel, 0); - return; - } - /* mp_ncpus should have the number cpus currently online */ - current_cpu = (++next_vcpu % mp_ncpus); - vmbus_channel_cpu_set(channel, current_cpu); + /* + * By default, pin the channel to cpu0. Devices having + * special channel-cpu mapping requirement should call + * vmbus_channel_cpu_{set,rr}(). + */ + vmbus_channel_cpu_set(chan, 0); } /** From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF0B4B93655; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5403164F; Tue, 12 Jul 2016 08:06:57 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C6CwNb080010; Tue, 12 Jul 2016 06:12:58 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C6CwbR080009; Tue, 12 Jul 2016 06:12:58 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201607120612.u6C6CwbR080009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Tue, 12 Jul 2016 06:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302626 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:29 -0000 Author: dchagin Date: Tue Jul 12 06:12:58 2016 New Revision: 302626 URL: https://svnweb.freebsd.org/changeset/base/302626 Log: Fix pc98 LINT build. MFC after: 4 days Modified: head/sys/conf/files.pc98 Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Tue Jul 12 06:06:10 2016 (r302625) +++ head/sys/conf/files.pc98 Tue Jul 12 06:12:58 2016 (r302626) @@ -63,6 +63,7 @@ compat/linux/linux_ioctl.c optional comp compat/linux/linux_ipc.c optional compat_linux compat/linux/linux_mib.c optional compat_linux compat/linux/linux_misc.c optional compat_linux +compat/linux/linux_mmap.c optional compat_linux compat/linux/linux_signal.c optional compat_linux compat/linux/linux_socket.c optional compat_linux compat/linux/linux_stats.c optional compat_linux From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0AA8B9364C; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BCE61589; Tue, 12 Jul 2016 08:06:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C7nc5t011470; Tue, 12 Jul 2016 07:49:38 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C7nc5C011465; Tue, 12 Jul 2016 07:49:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120749.u6C7nc5C011465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 07:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302630 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:28 -0000 Author: sephe Date: Tue Jul 12 07:49:38 2016 New Revision: 302630 URL: https://svnweb.freebsd.org/changeset/base/302630 Log: hyperv/vmbus: Move GPADL index into vmbus_softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6954 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 07:49:38 2016 (r302630) @@ -343,8 +343,7 @@ hv_vmbus_channel_establish_gpadl(struct /* * Allocate GPADL id. */ - gpadl = atomic_fetchadd_int( - &hv_vmbus_g_connection.next_gpadl_handle, 1); + gpadl = vmbus_gpadl_alloc(sc); *gpadl0 = gpadl; /* Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:49:38 2016 (r302630) @@ -47,8 +47,7 @@ * Globals */ hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED, - .next_gpadl_handle = 0xE1E10, }; + { .connect_state = HV_DISCONNECTED }; /** * Send a connect request on the partition service connection Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 07:49:38 2016 (r302630) @@ -107,7 +107,6 @@ typedef enum { typedef struct { hv_vmbus_connect_state connect_state; - uint32_t next_gpadl_handle; /** * List of primary channels. Sub channels will be linked Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:49:38 2016 (r302630) @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); #include "acpi_if.h" #include "vmbus_if.h" +#define VMBUS_GPADL_START 0xe1e10 + struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; struct hypercall_postmsg_in mh_inprm_save; @@ -372,6 +374,12 @@ vmbus_msghc_wakeup(struct vmbus_softc *s wakeup(&mhc->mhc_active); } +uint32_t +vmbus_gpadl_alloc(struct vmbus_softc *sc) +{ + return atomic_fetchadd_int(&sc->vmbus_gpadl, 1); +} + static int vmbus_connect(struct vmbus_softc *sc, uint32_t version) { @@ -1121,6 +1129,7 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); + sc->vmbus_gpadl = VMBUS_GPADL_START; /* * Create context for "post message" Hypercalls Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:49:38 2016 (r302630) @@ -86,6 +86,7 @@ struct vmbus_softc { int vmbus_idtvec; uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ uint32_t vmbus_version; + uint32_t vmbus_gpadl; /* Shared memory for vmbus_{rx,tx}_evtflags */ void *vmbus_evtflags; @@ -148,4 +149,6 @@ void vmbus_msghc_reset(struct vmbus_msgh void vmbus_scan_done(struct vmbus_softc *); void vmbus_scan_newchan(struct vmbus_softc *); +uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); + #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BACADB9364E; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6950615B8; Tue, 12 Jul 2016 08:06:52 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C7Gbod000891; Tue, 12 Jul 2016 07:16:37 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C7GbEI000890; Tue, 12 Jul 2016 07:16:37 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607120716.u6C7GbEI000890@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 12 Jul 2016 07:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302628 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:28 -0000 Author: ache Date: Tue Jul 12 07:16:37 2016 New Revision: 302628 URL: https://svnweb.freebsd.org/changeset/base/302628 Log: Bump __FreeBSD_version after removing collation from [a-z]-type ranges. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Jul 12 06:25:28 2016 (r302627) +++ head/sys/sys/param.h Tue Jul 12 07:16:37 2016 (r302628) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200000 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200001 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C13EDB9365A; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4417F16BD; Tue, 12 Jul 2016 08:07:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C5tBdZ073001; Tue, 12 Jul 2016 05:55:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C5tBU6072999; Tue, 12 Jul 2016 05:55:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120555.u6C5tBU6072999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 05:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302623 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:29 -0000 Author: sephe Date: Tue Jul 12 05:55:11 2016 New Revision: 302623 URL: https://svnweb.freebsd.org/changeset/base/302623 Log: hyperv/vmbus: Minor renaming MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6919 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 05:41:34 2016 (r302622) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 05:55:11 2016 (r302623) @@ -90,10 +90,9 @@ struct vmbus_msghc_ctx { #define VMBUS_MSGHC_CTXF_DESTROY 0x0001 static int vmbus_init(struct vmbus_softc *); -static int vmbus_init_contact(struct vmbus_softc *, - uint32_t); +static int vmbus_connect(struct vmbus_softc *, uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); -static void vmbus_uninit(struct vmbus_softc *); +static void vmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); static void vmbus_scan_wait(struct vmbus_softc *); static void vmbus_scan_newdev(struct vmbus_softc *); @@ -373,20 +372,19 @@ vmbus_msghc_wakeup(struct vmbus_softc *s } static int -vmbus_init_contact(struct vmbus_softc *sc, uint32_t version) +vmbus_connect(struct vmbus_softc *sc, uint32_t version) { - struct vmbus_chanmsg_init_contact *req; - const struct vmbus_chanmsg_version_resp *resp; + struct vmbus_chanmsg_connect *req; const struct vmbus_message *msg; struct vmbus_msghc *mh; - int error, supp = 0; + int error, done = 0; mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) return ENXIO; req = vmbus_msghc_dataptr(mh); - req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_INIT_CONTACT; + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CONNECT; req->chm_ver = version; req->chm_evtflags = sc->vmbus_evtflags_dma.hv_paddr; req->chm_mnf1 = sc->vmbus_mnf1_dma.hv_paddr; @@ -399,12 +397,12 @@ vmbus_init_contact(struct vmbus_softc *s } msg = vmbus_msghc_wait_result(sc, mh); - resp = (const struct vmbus_chanmsg_version_resp *)msg->msg_data; - supp = resp->chm_supp; + done = ((const struct vmbus_chanmsg_connect_resp *) + msg->msg_data)->chm_done; vmbus_msghc_put(sc, mh); - return (supp ? 0 : EOPNOTSUPP); + return (done ? 0 : EOPNOTSUPP); } static int @@ -415,7 +413,7 @@ vmbus_init(struct vmbus_softc *sc) for (i = 0; i < nitems(vmbus_version); ++i) { int error; - error = vmbus_init_contact(sc, vmbus_version[i]); + error = vmbus_connect(sc, vmbus_version[i]); if (!error) { hv_vmbus_protocal_version = vmbus_version[i]; device_printf(sc->vmbus_dev, "version %u.%u\n", @@ -428,35 +426,35 @@ vmbus_init(struct vmbus_softc *sc) } static void -vmbus_uninit(struct vmbus_softc *sc) +vmbus_disconnect(struct vmbus_softc *sc) { - struct vmbus_chanmsg_unload *req; + struct vmbus_chanmsg_disconnect *req; struct vmbus_msghc *mh; int error; mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { device_printf(sc->vmbus_dev, - "can not get msg hypercall for unload\n"); + "can not get msg hypercall for disconnect\n"); return; } req = vmbus_msghc_dataptr(mh); - req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_UNLOAD; + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_DISCONNECT; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); if (error) { device_printf(sc->vmbus_dev, - "unload msg hypercall failed\n"); + "disconnect msg hypercall failed\n"); } } static int vmbus_req_channels(struct vmbus_softc *sc) { - struct vmbus_chanmsg_channel_req *req; + struct vmbus_chanmsg_chrequest *req; struct vmbus_msghc *mh; int error; @@ -465,7 +463,7 @@ vmbus_req_channels(struct vmbus_softc *s return ENXIO; req = vmbus_msghc_dataptr(mh); - req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHANNEL_REQ; + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHREQUEST; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -1247,7 +1245,7 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(); - vmbus_uninit(sc); + vmbus_disconnect(sc); hv_vmbus_disconnect(); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 05:41:34 2016 (r302622) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 05:55:11 2016 (r302623) @@ -93,7 +93,7 @@ struct vmbus_gpa_range { * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ -#define VMBUS_CHANMSG_TYPE_CHANNEL_REQ 3 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ #define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */ @@ -102,17 +102,17 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_GPADL_CONNRESP 10 /* RESP */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONN 11 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONNRESP 12 /* RESP */ -#define VMBUS_CHANMSG_TYPE_INIT_CONTACT 14 /* REQ */ -#define VMBUS_CHANMSG_TYPE_VERSION_RESP 15 /* RESP */ -#define VMBUS_CHANMSG_TYPE_UNLOAD 16 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */ +#define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */ struct vmbus_chanmsg_hdr { uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ uint32_t chm_rsvd; } __packed; -/* VMBUS_CHANMSG_TYPE_INIT_CONTACT */ -struct vmbus_chanmsg_init_contact { +/* VMBUS_CHANMSG_TYPE_CONNECT */ +struct vmbus_chanmsg_connect { struct vmbus_chanmsg_hdr chm_hdr; uint32_t chm_ver; uint32_t chm_rsvd; @@ -121,19 +121,19 @@ struct vmbus_chanmsg_init_contact { uint64_t chm_mnf2; } __packed; -/* VMBUS_CHANMSG_TYPE_VERSION_RESP */ -struct vmbus_chanmsg_version_resp { +/* VMBUS_CHANMSG_TYPE_CONNECT_RESP */ +struct vmbus_chanmsg_connect_resp { struct vmbus_chanmsg_hdr chm_hdr; - uint8_t chm_supp; + uint8_t chm_done; } __packed; -/* VMBUS_CHANMSG_TYPE_CHANNEL_REQ */ -struct vmbus_chanmsg_channel_req { +/* VMBUS_CHANMSG_TYPE_CHREQUEST */ +struct vmbus_chanmsg_chrequest { struct vmbus_chanmsg_hdr chm_hdr; } __packed; -/* VMBUS_CHANMSG_TYPE_UNLOAD */ -struct vmbus_chanmsg_unload { +/* VMBUS_CHANMSG_TYPE_DISCONNECT */ +struct vmbus_chanmsg_disconnect { struct vmbus_chanmsg_hdr chm_hdr; } __packed; From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD87DB93651; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EF9515CD; Tue, 12 Jul 2016 08:06:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C7XfTD007863; Tue, 12 Jul 2016 07:33:41 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C7Xeta007850; Tue, 12 Jul 2016 07:33:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120733.u6C7Xeta007850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 07:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302629 - in head/sys: conf dev/hyperv/include dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/vmbus modules/hyperv/netvsc modules/hyperv/storvsc modules/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:29 -0000 Author: sephe Date: Tue Jul 12 07:33:39 2016 New Revision: 302629 URL: https://svnweb.freebsd.org/changeset/base/302629 Log: hyperv/vmbus: Rework vmbus version accessing. Instead of global variable, vmbus version is accessed through a vmbus DEVMETHOD now. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6953 Added: head/sys/dev/hyperv/vmbus/vmbus_if.m (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h head/sys/modules/hyperv/netvsc/Makefile head/sys/modules/hyperv/storvsc/Makefile head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/conf/files.amd64 Tue Jul 12 07:33:39 2016 (r302629) @@ -278,6 +278,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/nfe/if_nfe.c optional nfe pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/conf/files.i386 Tue Jul 12 07:33:39 2016 (r302629) @@ -254,6 +254,7 @@ dev/hyperv/vmbus/hyperv.c optional hy dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv +dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 07:33:39 2016 (r302629) @@ -73,10 +73,13 @@ typedef uint8_t hv_bool_uint8_t; * 2.4 -- Windows 8 * 3.0 -- Windows 8.1 */ -#define HV_VMBUS_VERSION_WS2008 ((0 << 16) | (13)) -#define HV_VMBUS_VERSION_WIN7 ((1 << 16) | (1)) -#define HV_VMBUS_VERSION_WIN8 ((2 << 16) | (4)) -#define HV_VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) +#define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) +#define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) +#define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) +#define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) + +#define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) +#define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) /* * Make maximum size of pipe payload of 16K @@ -723,5 +726,4 @@ hv_get_phys_addr(void *virt) return (ret); } -extern uint32_t hv_vmbus_protocal_version; #endif /* __HYPERV_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 12 07:33:39 2016 (r302629) @@ -114,9 +114,11 @@ __FBSDID("$FreeBSD$"); #include #include + #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" +#include "vmbus_if.h" #define hv_chan_rxr hv_chan_priv1 #define hv_chan_txr hv_chan_priv2 @@ -2369,8 +2371,10 @@ static int hn_create_tx_ring(struct hn_softc *sc, int id) { struct hn_tx_ring *txr = &sc->hn_tx_ring[id]; + device_t dev = sc->hn_dev; bus_dma_tag_t parent_dtag; int error, i; + uint32_t version; txr->hn_sc = sc; txr->hn_tx_idx = id; @@ -2409,10 +2413,18 @@ hn_create_tx_ring(struct hn_softc *sc, i } txr->hn_direct_tx_size = hn_direct_tx_size; - if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1) + version = VMBUS_GET_VERSION(device_get_parent(dev), dev); + if (version >= VMBUS_VERSION_WIN8_1) { txr->hn_csum_assist = HN_CSUM_ASSIST; - else + } else { txr->hn_csum_assist = HN_CSUM_ASSIST_WIN8; + if (id == 0) { + device_printf(dev, "bus version %u.%u, " + "no UDP checksum offloading\n", + VMBUS_VERSION_MAJOR(version), + VMBUS_VERSION_MINOR(version)); + } + } /* * Always schedule transmission instead of trying to do direct @@ -2420,7 +2432,7 @@ hn_create_tx_ring(struct hn_softc *sc, i */ txr->hn_sched_tx = 1; - parent_dtag = bus_get_dma_tag(sc->hn_dev); + parent_dtag = bus_get_dma_tag(dev); /* DMA tag for RNDIS messages. */ error = bus_dma_tag_create(parent_dtag, /* parent */ @@ -2437,7 +2449,7 @@ hn_create_tx_ring(struct hn_softc *sc, i NULL, /* lockfuncarg */ &txr->hn_tx_rndis_dtag); if (error) { - device_printf(sc->hn_dev, "failed to create rndis dmatag\n"); + device_printf(dev, "failed to create rndis dmatag\n"); return error; } @@ -2456,7 +2468,7 @@ hn_create_tx_ring(struct hn_softc *sc, i NULL, /* lockfuncarg */ &txr->hn_tx_data_dtag); if (error) { - device_printf(sc->hn_dev, "failed to create data dmatag\n"); + device_printf(dev, "failed to create data dmatag\n"); return error; } @@ -2473,7 +2485,7 @@ hn_create_tx_ring(struct hn_softc *sc, i BUS_DMA_WAITOK | BUS_DMA_COHERENT, &txd->rndis_msg_dmap); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to allocate rndis_msg, %d\n", i); return error; } @@ -2484,7 +2496,7 @@ hn_create_tx_ring(struct hn_softc *sc, i hyperv_dma_map_paddr, &txd->rndis_msg_paddr, BUS_DMA_NOWAIT); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to load rndis_msg, %d\n", i); bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_msg, txd->rndis_msg_dmap); @@ -2495,7 +2507,7 @@ hn_create_tx_ring(struct hn_softc *sc, i error = bus_dmamap_create(txr->hn_tx_data_dtag, 0, &txd->data_dmap); if (error) { - device_printf(sc->hn_dev, + device_printf(dev, "failed to allocate tx data dmamap\n"); bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap); @@ -2523,7 +2535,7 @@ hn_create_tx_ring(struct hn_softc *sc, i * Create per TX ring sysctl tree: * dev.hn.UNIT.tx.RINGID */ - ctx = device_get_sysctl_ctx(sc->hn_dev); + ctx = device_get_sysctl_ctx(dev); child = SYSCTL_CHILDREN(sc->hn_tx_sysctl_tree); snprintf(name, sizeof(name), "%d", id); Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 12 07:33:39 2016 (r302629) @@ -72,7 +72,9 @@ __FBSDID("$FreeBSD$"); #include #include + #include "hv_vstorage.h" +#include "vmbus_if.h" #define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) #define STORVSC_MAX_LUNS_PER_TARGET (64) @@ -465,6 +467,7 @@ hv_storvsc_channel_init(struct hv_device struct storvsc_softc *sc; uint16_t max_chans = 0; boolean_t support_multichannel = FALSE; + uint32_t version; max_chans = 0; support_multichannel = FALSE; @@ -589,8 +592,9 @@ hv_storvsc_channel_init(struct hv_device /* multi-channels feature is supported by WIN8 and above version */ max_chans = vstor_packet->u.chan_props.max_channel_cnt; - if ((hv_vmbus_protocal_version != HV_VMBUS_VERSION_WIN7) && - (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) && + version = VMBUS_GET_VERSION(device_get_parent(dev->device), + dev->device); + if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && (vstor_packet->u.chan_props.flags & HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { support_multichannel = TRUE; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 07:33:39 2016 (r302629) @@ -222,8 +222,8 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); - if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || - hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) { + if (chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WS2008 || + chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WIN7) { /* Only cpu0 is supported */ cpu = 0; } @@ -305,7 +305,7 @@ vmbus_channel_on_offer_internal(struct v } new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; - if (hv_vmbus_protocal_version != HV_VMBUS_VERSION_WS2008) { + if (sc->vmbus_version != VMBUS_VERSION_WS2008) { new_channel->is_dedicated_interrupt = (offer->is_dedicated_interrupt != 0); new_channel->ch_sigevt->hc_connid = offer->connection_id; Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:33:39 2016 (r302629) @@ -50,8 +50,6 @@ hv_vmbus_connection hv_vmbus_g_connectio { .connect_state = HV_DISCONNECTED, .next_gpadl_handle = 0xE1E10, }; -uint32_t hv_vmbus_protocal_version; - /** * Send a connect request on the partition service connection */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:33:39 2016 (r302629) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +#include "vmbus_if.h" struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; @@ -113,10 +114,10 @@ struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); static const uint32_t vmbus_version[] = { - HV_VMBUS_VERSION_WIN8_1, - HV_VMBUS_VERSION_WIN8, - HV_VMBUS_VERSION_WIN7, - HV_VMBUS_VERSION_WS2008 + VMBUS_VERSION_WIN8_1, + VMBUS_VERSION_WIN8, + VMBUS_VERSION_WIN7, + VMBUS_VERSION_WS2008 }; static struct vmbus_msghc * @@ -415,10 +416,10 @@ vmbus_init(struct vmbus_softc *sc) error = vmbus_connect(sc, vmbus_version[i]); if (!error) { - hv_vmbus_protocal_version = vmbus_version[i]; + sc->vmbus_version = vmbus_version[i]; device_printf(sc->vmbus_dev, "version %u.%u\n", - (hv_vmbus_protocal_version >> 16), - (hv_vmbus_protocal_version & 0xffff)); + VMBUS_VERSION_MAJOR(sc->vmbus_version), + VMBUS_VERSION_MINOR(sc->vmbus_version)); return 0; } } @@ -1064,14 +1065,23 @@ hv_vmbus_child_device_unregister(struct static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS) { + struct vmbus_softc *sc = arg1; char verstr[16]; snprintf(verstr, sizeof(verstr), "%u.%u", - hv_vmbus_protocal_version >> 16, - hv_vmbus_protocal_version & 0xffff); + VMBUS_VERSION_MAJOR(sc->vmbus_version), + VMBUS_VERSION_MINOR(sc->vmbus_version)); return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); } +static uint32_t +vmbus_get_version_method(device_t bus, device_t dev) +{ + struct vmbus_softc *sc = device_get_softc(bus); + + return sc->vmbus_version; +} + static int vmbus_probe(device_t dev) { @@ -1155,8 +1165,8 @@ vmbus_doattach(struct vmbus_softc *sc) if (ret != 0) goto cleanup; - if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 || - hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) + if (sc->vmbus_version == VMBUS_VERSION_WS2008 || + sc->vmbus_version == VMBUS_VERSION_WIN7) sc->vmbus_event_proc = vmbus_event_proc_compat; else sc->vmbus_event_proc = vmbus_event_proc; @@ -1168,7 +1178,7 @@ vmbus_doattach(struct vmbus_softc *sc) ctx = device_get_sysctl_ctx(sc->vmbus_dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev)); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, vmbus_sysctl_version, "A", "vmbus version"); return (ret); @@ -1281,6 +1291,9 @@ static device_method_t vmbus_methods[] = DEVMETHOD(bus_write_ivar, vmbus_write_ivar), DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + /* Vmbus interface */ + DEVMETHOD(vmbus_get_version, vmbus_get_version_method), + DEVMETHOD_END }; Added: head/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/vmbus/vmbus_if.m Tue Jul 12 07:33:39 2016 (r302629) @@ -0,0 +1,37 @@ +#- +# 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$ +# + +#include +#include + +INTERFACE vmbus; + +METHOD uint32_t get_version { + device_t bus; + device_t dev; +}; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:33:39 2016 (r302629) @@ -78,10 +78,14 @@ struct vmbus_softc { struct vmbus_msghc_ctx *vmbus_msg_hc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; - /* Rarely used fields */ + /* + * Rarely used fields + */ + device_t vmbus_dev; int vmbus_idtvec; uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ + uint32_t vmbus_version; /* Shared memory for vmbus_{rx,tx}_evtflags */ void *vmbus_evtflags; Modified: head/sys/modules/hyperv/netvsc/Makefile ============================================================================== --- head/sys/modules/hyperv/netvsc/Makefile Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/modules/hyperv/netvsc/Makefile Tue Jul 12 07:33:39 2016 (r302629) @@ -1,12 +1,13 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../dev/hyperv/netvsc +.PATH: ${.CURDIR}/../../../dev/hyperv/netvsc \ + ${.CURDIR}/../../../dev/hyperv/vmbus KMOD= hv_netvsc SRCS= hv_net_vsc.c \ hv_netvsc_drv_freebsd.c \ hv_rndis_filter.c -SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h +SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/netvsc Modified: head/sys/modules/hyperv/storvsc/Makefile ============================================================================== --- head/sys/modules/hyperv/storvsc/Makefile Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/modules/hyperv/storvsc/Makefile Tue Jul 12 07:33:39 2016 (r302629) @@ -1,11 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../dev/hyperv/storvsc +.PATH: ${.CURDIR}/../../../dev/hyperv/storvsc \ + ${.CURDIR}/../../../dev/hyperv/vmbus \ KMOD= hv_storvsc SRCS = hv_storvsc_drv_freebsd.c \ hv_vstorage.h -SRCS+= bus_if.h device_if.h opt_cam.h +SRCS+= bus_if.h device_if.h opt_cam.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/include \ -I${.CURDIR}/../../../dev/hyperv/vmbus \ Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Tue Jul 12 07:16:37 2016 (r302628) +++ head/sys/modules/hyperv/vmbus/Makefile Tue Jul 12 07:33:39 2016 (r302629) @@ -13,7 +13,7 @@ SRCS= hv_channel.c \ hyperv_machdep.c \ vmbus.c \ vmbus_et.c -SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h +SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h # XXX: for assym.s SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_hwpmc_hooks.h opt_compat.h From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C069AB93658; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73761169B; Tue, 12 Jul 2016 08:07:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C60vQP073123; Tue, 12 Jul 2016 06:00:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C60vHo073122; Tue, 12 Jul 2016 06:00:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201607120600.u6C60vHo073122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 12 Jul 2016 06:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302624 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:29 -0000 Author: trasz Date: Tue Jul 12 06:00:57 2016 New Revision: 302624 URL: https://svnweb.freebsd.org/changeset/base/302624 Log: Add some .Xrs to getloginclass(2). MFC after: 1 month Modified: head/lib/libc/sys/getloginclass.2 Modified: head/lib/libc/sys/getloginclass.2 ============================================================================== --- head/lib/libc/sys/getloginclass.2 Tue Jul 12 05:55:11 2016 (r302623) +++ head/lib/libc/sys/getloginclass.2 Tue Jul 12 06:00:57 2016 (r302624) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2011 +.Dd July 12, 2016 .Dt GETLOGINCLASS 2 .Os .Sh NAME @@ -87,7 +87,10 @@ The caller tried to set the login class The size of the buffer is smaller than the result to be returned. .El .Sh SEE ALSO -.Xr setusercontext 3 +.Xr ps 1 , +.Xr setusercontext 3 , +.Xr login.conf 5 , +.Xr rctl 8 .Sh HISTORY The .Fn getloginclass From owner-svn-src-head@freebsd.org Tue Jul 12 08:07:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F89B93659; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5CDA16A8; Tue, 12 Jul 2016 08:07:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C5fYTT066854; Tue, 12 Jul 2016 05:41:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C5fYIS066852; Tue, 12 Jul 2016 05:41:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120541.u6C5fYIS066852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 05:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302622 - in head/sys/dev/ntb: . ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:29 -0000 Author: sephe Date: Tue Jul 12 05:41:34 2016 New Revision: 302622 URL: https://svnweb.freebsd.org/changeset/base/302622 Log: ntb: Fix LINT Sponsored by: Microsoft OSTC Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Jul 12 05:31:33 2016 (r302621) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Jul 12 05:41:34 2016 (r302622) @@ -617,8 +617,6 @@ SYSCTL_UQUAD(_hw_ntb_xeon_b2b, OID_AUTO, */ MALLOC_DEFINE(M_NTB, "ntb_hw", "ntb_hw driver memory allocations"); -SYSCTL_NODE(_hw, OID_AUTO, ntb, CTLFLAG_RW, 0, "NTB sysctls"); - /* * OS <-> Driver linkage functions */ Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Tue Jul 12 05:31:33 2016 (r302621) +++ head/sys/dev/ntb/ntb_transport.c Tue Jul 12 05:41:34 2016 (r302622) @@ -882,7 +882,7 @@ ntb_memcpy_rx(struct ntb_transport_qp *q /* Ensure that the data is globally visible before clearing the flag */ wmb(); - CTR2(KTR_NTB, "RX: copied entry %p to mbuf %p.", entry, m); + CTR2(KTR_NTB, "RX: copied entry %p to mbuf %p.", entry, entry->buf); ntb_rx_copy_callback(qp, entry); } From owner-svn-src-head@freebsd.org Tue Jul 12 08:11:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73537B93EF8; Tue, 12 Jul 2016 08:11:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32AB21177; Tue, 12 Jul 2016 08:11:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8BH6P018366; Tue, 12 Jul 2016 08:11:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8BGfA018360; Tue, 12 Jul 2016 08:11:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120811.u6C8BGfA018360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:11:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302631 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:11:18 -0000 Author: sephe Date: Tue Jul 12 08:11:16 2016 New Revision: 302631 URL: https://svnweb.freebsd.org/changeset/base/302631 Log: hyperv/vmbus: Move channel list to vmbus_softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6956 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 08:11:16 2016 (r302631) @@ -533,7 +533,6 @@ typedef union { } __packed hv_vmbus_connection_id; typedef struct hv_vmbus_channel { - TAILQ_ENTRY(hv_vmbus_channel) list_entry; struct hv_device* device; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; @@ -627,6 +626,7 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv3; struct task ch_detach_task; + TAILQ_ENTRY(hv_vmbus_channel) ch_link; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:11:16 2016 (r302631) @@ -108,6 +108,7 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { + struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; uint32_t relid; @@ -115,7 +116,7 @@ vmbus_channel_process_offer(hv_vmbus_cha /* * Make sure this is a new offer */ - mtx_lock(&hv_vmbus_g_connection.channel_lock); + mtx_lock(&sc->vmbus_chlist_lock); if (relid == 0) { /* * XXX channel0 will not be processed; skip it. @@ -125,8 +126,7 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_g_connection.channels[relid] = new_channel; } - TAILQ_FOREACH(channel, &hv_vmbus_g_connection.channel_anchor, - list_entry) { + TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { if (memcmp(&channel->offer_msg.offer.interface_type, &new_channel->offer_msg.offer.interface_type, sizeof(hv_guid)) == 0 && @@ -138,10 +138,9 @@ vmbus_channel_process_offer(hv_vmbus_cha if (channel == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); } - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + mtx_unlock(&sc->vmbus_chlist_lock); if (channel != NULL) { /* @@ -165,11 +164,19 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel->offer_msg.offer.sub_channel_index); } - /* Insert new channel into channel_anchor. */ - mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, - new_channel, list_entry); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + /* + * Insert the new channel to the end of the global + * channel list. + * + * NOTE: + * The new sub-channel MUST be inserted AFTER it's + * primary channel, so that the primary channel will + * be found in the above loop for its baby siblings. + */ + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, + ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); if(bootverbose) printf("VMBUS: new multi-channel offer <%p>, " @@ -375,16 +382,15 @@ vmbus_channel_on_offers_delivered(struct * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) */ void -hv_vmbus_release_unattached_channels(void) +hv_vmbus_release_unattached_channels(struct vmbus_softc *sc) { hv_vmbus_channel *channel; - mtx_lock(&hv_vmbus_g_connection.channel_lock); + mtx_lock(&sc->vmbus_chlist_lock); - while (!TAILQ_EMPTY(&hv_vmbus_g_connection.channel_anchor)) { - channel = TAILQ_FIRST(&hv_vmbus_g_connection.channel_anchor); - TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, - channel, list_entry); + while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { + channel = TAILQ_FIRST(&sc->vmbus_chlist); + TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { /* Only primary channel owns the hv_device */ @@ -394,7 +400,8 @@ hv_vmbus_release_unattached_channels(voi } bzero(hv_vmbus_g_connection.channels, sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX); - mtx_unlock(&hv_vmbus_g_connection.channel_lock); + + mtx_unlock(&sc->vmbus_chlist_lock); } /** Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 08:11:16 2016 (r302631) @@ -67,10 +67,6 @@ hv_vmbus_connect(struct vmbus_softc *sc) */ hv_vmbus_g_connection.connect_state = HV_CONNECTING; - TAILQ_INIT(&hv_vmbus_g_connection.channel_anchor); - mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel", - NULL, MTX_DEF); - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 08:11:16 2016 (r302631) @@ -38,6 +38,8 @@ #include +struct vmbus_softc; + typedef struct { void* data; uint32_t length; @@ -109,13 +111,6 @@ typedef struct { hv_vmbus_connect_state connect_state; /** - * List of primary channels. Sub channels will be linked - * under their primary channel. - */ - TAILQ_HEAD(, hv_vmbus_channel) channel_anchor; - struct mtx channel_lock; - - /** * channel table for fast lookup through id. */ hv_vmbus_channel **channels; @@ -239,15 +234,14 @@ uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); -void hv_vmbus_release_unattached_channels(void); +void hv_vmbus_release_unattached_channels( + struct vmbus_softc *); struct hv_device* hv_vmbus_child_device_create( hv_guid device_type, hv_guid device_instance, hv_vmbus_channel *channel); -struct vmbus_softc; - void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); int hv_vmbus_child_device_unregister( Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:11:16 2016 (r302631) @@ -1130,6 +1130,8 @@ vmbus_doattach(struct vmbus_softc *sc) mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); sc->vmbus_gpadl = VMBUS_GPADL_START; + mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF); + TAILQ_INIT(&sc->vmbus_chlist); /* * Create context for "post message" Hypercalls @@ -1262,7 +1264,7 @@ vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - hv_vmbus_release_unattached_channels(); + hv_vmbus_release_unattached_channels(sc); vmbus_disconnect(sc); hv_vmbus_disconnect(); Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:49:38 2016 (r302630) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 08:11:16 2016 (r302631) @@ -100,6 +100,9 @@ struct vmbus_softc { uint32_t vmbus_scan_chcnt; #define VMBUS_SCAN_CHCNT_DONE 0x80000000 uint32_t vmbus_scan_devcnt; + + struct mtx vmbus_chlist_lock; + TAILQ_HEAD(, hv_vmbus_channel) vmbus_chlist; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ From owner-svn-src-head@freebsd.org Tue Jul 12 08:21:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5E7AB92B7C; Tue, 12 Jul 2016 08:21:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 547E816B0; Tue, 12 Jul 2016 08:21:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8LSH5022692; Tue, 12 Jul 2016 08:21:28 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8LSq2022690; Tue, 12 Jul 2016 08:21:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120821.u6C8LSq2022690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302632 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:21:30 -0000 Author: sephe Date: Tue Jul 12 08:21:28 2016 New Revision: 302632 URL: https://svnweb.freebsd.org/changeset/base/302632 Log: hyperv/vmbus: More verbose for GPADL_connect/chan_{rescind,offer} Reviewed by: Dexuan Cui , Hongjiang Zhang MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6976 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 08:11:16 2016 (r302631) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 08:21:28 2016 (r302632) @@ -423,6 +423,11 @@ hv_vmbus_channel_establish_gpadl(struct device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " "status %u\n", channel->offer_msg.child_rel_id, status); return EIO; + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "gpadl->chan%u " + "succeeded\n", channel->offer_msg.child_rel_id); + } } return 0; } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:11:16 2016 (r302631) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:21:28 2016 (r302632) @@ -142,6 +142,19 @@ vmbus_channel_process_offer(hv_vmbus_cha } mtx_unlock(&sc->vmbus_chlist_lock); + if (bootverbose) { + char logstr[64]; + + logstr[0] = '\0'; + if (channel != NULL) { + snprintf(logstr, sizeof(logstr), ", primary chan%u", + channel->offer_msg.child_rel_id); + } + device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", + new_channel->offer_msg.child_rel_id, + new_channel->offer_msg.offer.sub_channel_index, logstr); + } + if (channel != NULL) { /* * Check if this is a sub channel. @@ -157,13 +170,6 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel, sc_list_entry); mtx_unlock(&channel->sc_lock); - if (bootverbose) { - printf("VMBUS get multi-channel offer, " - "rel=%u, sub=%u\n", - new_channel->offer_msg.child_rel_id, - new_channel->offer_msg.offer.sub_channel_index); - } - /* * Insert the new channel to the end of the global * channel list. @@ -178,11 +184,6 @@ vmbus_channel_process_offer(hv_vmbus_cha ch_link); mtx_unlock(&sc->vmbus_chlist_lock); - if(bootverbose) - printf("VMBUS: new multi-channel offer <%p>, " - "its primary channel is <%p>.\n", - new_channel, new_channel->primary_channel); - new_channel->state = HV_CHANNEL_OPEN_STATE; /* @@ -345,6 +346,10 @@ vmbus_channel_on_offer_rescind(struct vm hv_vmbus_channel* channel; rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u rescind\n", + rescind->child_rel_id); + } channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; if (channel == NULL) From owner-svn-src-head@freebsd.org Tue Jul 12 08:28:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 072BEB93175; Tue, 12 Jul 2016 08:28:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B19061642; Tue, 12 Jul 2016 08:28:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8SpDk025868; Tue, 12 Jul 2016 08:28:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8SpkK025866; Tue, 12 Jul 2016 08:28:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120828.u6C8SpkK025866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302633 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:28:53 -0000 Author: sephe Date: Tue Jul 12 08:28:51 2016 New Revision: 302633 URL: https://svnweb.freebsd.org/changeset/base/302633 Log: hyperv/vmbus: Free sysctl properly upon channel close. Prepare for sub-channel re-open. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6977 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 08:21:28 2016 (r302632) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 08:28:51 2016 (r302633) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -627,6 +628,8 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; + + struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 08:21:28 2016 (r302632) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 08:28:51 2016 (r302633) @@ -111,7 +111,8 @@ vmbus_channel_sysctl_create(hv_vmbus_cha ch_id = primary_ch->offer_msg.child_rel_id; sub_ch_id = channel->offer_msg.offer.sub_channel_index; } - ctx = device_get_sysctl_ctx(dev); + ctx = &channel->ch_sysctl_ctx; + sysctl_ctx_init(ctx); /* This creates dev.DEVNAME.DEVUNIT.channel tree */ devch_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -482,6 +483,7 @@ hv_vmbus_channel_close_internal(hv_vmbus int error; channel->state = HV_CHANNEL_OPEN_STATE; + sysctl_ctx_free(&channel->ch_sysctl_ctx); /* * set rxq to NULL to avoid more requests be scheduled From owner-svn-src-head@freebsd.org Tue Jul 12 08:35:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B88DAB934FC; Tue, 12 Jul 2016 08:35:19 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 898AD129D; Tue, 12 Jul 2016 08:35:19 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (bcdf0033.skybroadband.com [188.223.0.51]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 90F8BD78FE; Tue, 12 Jul 2016 08:35:12 +0000 (UTC) Date: Tue, 12 Jul 2016 09:35:09 +0100 From: Andrew Turner To: "Andrey A. Chernov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include Message-ID: <20160712093509.69540801@zapp> In-Reply-To: <201607120037.u6C0bmNF054452@repo.freebsd.org> References: <201607120037.u6C0bmNF054452@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:35:19 -0000 On Tue, 12 Jul 2016 00:37:48 +0000 (UTC) "Andrey A. Chernov" wrote: > Author: ache > Date: Tue Jul 12 00:37:48 2016 > New Revision: 302601 > URL: https://svnweb.freebsd.org/changeset/base/302601 > > Log: > I don't know why unsigned int is choosed for wchar_t here, but > WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX Because the ABI either requires us to use an unsigned int [1], or the preferred type is unsigned int [2]. In the latter case the other choice is unsigned short, it would seem this is for Windows. Andrew [1] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf [2] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf From owner-svn-src-head@freebsd.org Tue Jul 12 08:38:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF11B936FC; Tue, 12 Jul 2016 08:38:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8293318A3; Tue, 12 Jul 2016 08:38:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8c3dE029554; Tue, 12 Jul 2016 08:38:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8c3iV029550; Tue, 12 Jul 2016 08:38:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120838.u6C8c3iV029550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302634 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:38:04 -0000 Author: sephe Date: Tue Jul 12 08:38:03 2016 New Revision: 302634 URL: https://svnweb.freebsd.org/changeset/base/302634 Log: hyperv/vmbus: Fix sub-channel re-open support. For multi-channel devices, once the primary channel is closed, a set of 'rescind' messages for sub-channels will be delivered by Hypervisor. Sub-channel MUST be freed according to these 'rescind' messages; directly re-openning sub-channels in the same fashion as the primary channel's re-opening does NOT work at all. After the primary channel is re-opened, requested # of sub- channels will be delivered though 'channel offer' messages, and this set of newly offered channels can be opened along side with the primary channel. This unbreaks the MTU setting for hn(4), which requires re- openning all existsing channels upon MTU change. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6978 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 08:28:51 2016 (r302633) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 08:38:03 2016 (r302634) @@ -717,6 +717,7 @@ void vmbus_channel_cpu_rr(struct hv_vmb struct hv_vmbus_channel ** vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); /** * @brief Get physical address from virtual Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 12 08:28:51 2016 (r302633) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 12 08:38:03 2016 (r302634) @@ -345,6 +345,7 @@ static void hn_destroy_rx_data(struct hn static void hn_set_tx_chimney_size(struct hn_softc *, int); static void hn_channel_attach(struct hn_softc *, struct hv_vmbus_channel *); static void hn_subchan_attach(struct hn_softc *, struct hv_vmbus_channel *); +static void hn_subchan_setup(struct hn_softc *); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -575,25 +576,8 @@ netvsc_attach(device_t dev) device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); - if (sc->net_dev->num_channel > 1) { - struct hv_vmbus_channel **subchan; - int subchan_cnt = sc->net_dev->num_channel - 1; - int i; - - /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(pri_chan, subchan_cnt); - - /* Attach the sub-channels. */ - for (i = 0; i < subchan_cnt; ++i) { - /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan[i]); - hv_nv_subchan_attach(subchan[i]); - } - - /* Release the sub-channels */ - vmbus_rel_subchan(subchan, subchan_cnt); - device_printf(dev, "%d sub-channels setup done\n", subchan_cnt); - } + if (sc->net_dev->num_channel > 1) + hn_subchan_setup(sc); #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { @@ -1620,6 +1604,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, NV_UNLOCK(sc); break; } + + /* Wait for subchannels to be destroyed */ + vmbus_drain_subchan(hn_dev->channel); + error = hv_rf_on_device_add(hn_dev, &device_info, sc->hn_rx_ring_inuse); if (error) { @@ -1628,6 +1616,26 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, NV_UNLOCK(sc); break; } + KASSERT(sc->hn_rx_ring_cnt == sc->net_dev->num_channel, + ("RX ring count %d and channel count %u mismatch", + sc->hn_rx_ring_cnt, sc->net_dev->num_channel)); + if (sc->net_dev->num_channel > 1) { + int r; + + /* + * Skip the rings on primary channel; they are + * handled by the hv_rf_on_device_add() above. + */ + for (r = 1; r < sc->hn_rx_ring_cnt; ++r) { + sc->hn_rx_ring[r].hn_rx_flags &= + ~HN_RX_FLAG_ATTACHED; + } + for (r = 1; r < sc->hn_tx_ring_cnt; ++r) { + sc->hn_tx_ring[r].hn_tx_flags &= + ~HN_TX_FLAG_ATTACHED; + } + hn_subchan_setup(sc); + } sc->hn_tx_chimney_max = sc->net_dev->send_section_size; if (sc->hn_tx_ring[0].hn_tx_chimney_size > @@ -2980,6 +2988,29 @@ hn_subchan_attach(struct hn_softc *sc, s } static void +hn_subchan_setup(struct hn_softc *sc) +{ + struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); + struct hv_vmbus_channel **subchan; + int subchan_cnt = sc->net_dev->num_channel - 1; + int i; + + /* Wait for sub-channels setup to complete. */ + subchan = vmbus_get_subchan(device_ctx->channel, subchan_cnt); + + /* Attach the sub-channels. */ + for (i = 0; i < subchan_cnt; ++i) { + /* NOTE: Calling order is critical. */ + hn_subchan_attach(sc, subchan[i]); + hv_nv_subchan_attach(subchan[i]); + } + + /* Release the sub-channels */ + vmbus_rel_subchan(subchan, subchan_cnt); + if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); +} + +static void hn_tx_taskq_create(void *arg __unused) { if (!hn_share_tx_taskq) Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:28:51 2016 (r302633) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:38:03 2016 (r302634) @@ -367,6 +367,54 @@ vmbus_chan_detach_task(void *xchan, int if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the hv_device */ hv_vmbus_child_device_unregister(chan->device); + /* NOTE: DO NOT free primary channel for now */ + } else { + struct vmbus_softc *sc = chan->vmbus_sc; + struct hv_vmbus_channel *pri_chan = chan->primary_channel; + struct vmbus_chanmsg_chfree *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chfree(chan%u)\n", + chan->offer_msg.child_rel_id); + goto remove; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; + req->chm_chanid = chan->offer_msg.child_rel_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chfree(chan%u) failed: %d", + chan->offer_msg.child_rel_id, error); + /* NOTE: Move on! */ + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u freed\n", + chan->offer_msg.child_rel_id); + } + } +remove: + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); + + mtx_lock(&pri_chan->sc_lock); + TAILQ_REMOVE(&pri_chan->sc_list_anchor, chan, sc_list_entry); + KASSERT(pri_chan->subchan_cnt > 0, + ("invalid subchan_cnt %d", pri_chan->subchan_cnt)); + pri_chan->subchan_cnt--; + mtx_unlock(&pri_chan->sc_lock); + wakeup(pri_chan); + + hv_vmbus_free_vmbus_channel(chan); } } @@ -504,6 +552,15 @@ vmbus_rel_subchan(struct hv_vmbus_channe } void +vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +{ + mtx_lock(&pri_chan->sc_lock); + while (pri_chan->subchan_cnt > 0) + mtx_sleep(pri_chan, &pri_chan->sc_lock, 0, "dsubch", 0); + mtx_unlock(&pri_chan->sc_lock); +} + +void vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) { vmbus_chanmsg_proc_t msg_proc; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 08:28:51 2016 (r302633) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Tue Jul 12 08:38:03 2016 (r302634) @@ -102,6 +102,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_GPADL_CONNRESP 10 /* RESP */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONN 11 /* REQ */ #define VMBUS_CHANMSG_TYPE_GPADL_DISCONNRESP 12 /* RESP */ +#define VMBUS_CHANMSG_TYPE_CHFREE 13 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */ @@ -206,4 +207,10 @@ struct vmbus_chanmsg_gpadl_disconn { uint32_t chm_gpadl; } __packed; +/* VMBUS_CHANMSG_TYPE_CHFREE */ +struct vmbus_chanmsg_chfree { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Tue Jul 12 08:43:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 159D8B93993; Tue, 12 Jul 2016 08:43:11 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E37381E96; Tue, 12 Jul 2016 08:43:10 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8hA2a032979; Tue, 12 Jul 2016 08:43:10 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8h9bc032975; Tue, 12 Jul 2016 08:43:09 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201607120843.u6C8h9bc032975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Tue, 12 Jul 2016 08:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302635 - in head/sys: amd64/include i386/include x86/x86 x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:43:11 -0000 Author: royger Date: Tue Jul 12 08:43:09 2016 New Revision: 302635 URL: https://svnweb.freebsd.org/changeset/base/302635 Log: xen: automatically disable MSI-X interrupt migration If the hypervisor version is smaller than 4.6.0. Xen commits 74fd00 and 70a3cb are required on the hypervisor side for this to be fixed, and those are only included in 4.6.0, so stay on the safe side and disable MSI-X interrupt migration on anything older than 4.6.0. It should not cause major performance degradation unless a lot of MSI-X interrupts are allocated. Sponsored by: Citrix Systems R&D MFC after: 3 days Reviewed by: jhb Differential revision: https://reviews.freebsd.org/D7148 Modified: head/sys/amd64/include/intr_machdep.h head/sys/i386/include/intr_machdep.h head/sys/x86/x86/msi.c head/sys/x86/xen/hvm.c Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Tue Jul 12 08:38:03 2016 (r302634) +++ head/sys/amd64/include/intr_machdep.h Tue Jul 12 08:43:09 2016 (r302635) @@ -149,6 +149,8 @@ extern cpuset_t intr_cpus; extern struct mtx icu_lock; extern int elcr_found; +extern int msix_disable_migration; + #ifndef DEV_ATPIC void atpic_reset(void); #endif Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Tue Jul 12 08:38:03 2016 (r302634) +++ head/sys/i386/include/intr_machdep.h Tue Jul 12 08:43:09 2016 (r302635) @@ -140,6 +140,8 @@ extern cpuset_t intr_cpus; extern struct mtx icu_lock; extern int elcr_found; +extern int msix_disable_migration; + #ifndef DEV_ATPIC void atpic_reset(void); #endif Modified: head/sys/x86/x86/msi.c ============================================================================== --- head/sys/x86/x86/msi.c Tue Jul 12 08:38:03 2016 (r302634) +++ head/sys/x86/x86/msi.c Tue Jul 12 08:43:09 2016 (r302635) @@ -149,12 +149,16 @@ struct pic msi_pic = { .pic_reprogram_pin = NULL, }; -/* +/** * Xen hypervisors prior to 4.6.0 do not properly handle updates to * enabled MSI-X table entries. Allow migration of MSI-X interrupts - * to be disabled via a tunable. + * to be disabled via a tunable. Values have the following meaning: + * + * -1: automatic detection by FreeBSD + * 0: enable migration + * 1: disable migration */ -static int msix_disable_migration = 0; +int msix_disable_migration = -1; SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN, &msix_disable_migration, 0, "Disable migration of MSI-X interrupts between CPUs"); @@ -312,6 +316,11 @@ msi_init(void) return; } + if (msix_disable_migration == -1) { + /* The default is to allow migration of MSI-X interrupts. */ + msix_disable_migration = 0; + } + msi_enabled = 1; intr_register_pic(&msi_pic); mtx_init(&msi_lock, "msi", NULL, MTX_DEF); Modified: head/sys/x86/xen/hvm.c ============================================================================== --- head/sys/x86/xen/hvm.c Tue Jul 12 08:38:03 2016 (r302634) +++ head/sys/x86/xen/hvm.c Tue Jul 12 08:43:09 2016 (r302635) @@ -134,9 +134,29 @@ xen_hvm_init_hypercall_stubs(enum xen_hv return (ENXIO); if (init_type == XEN_HVM_INIT_COLD) { + int major, minor; + do_cpuid(base + 1, regs); - printf("XEN: Hypervisor version %d.%d detected.\n", - regs[0] >> 16, regs[0] & 0xffff); + + major = regs[0] >> 16; + minor = regs[0] & 0xffff; + printf("XEN: Hypervisor version %d.%d detected.\n", major, + minor); + + if (((major < 4) || (major == 4 && minor <= 5)) && + msix_disable_migration == -1) { + /* + * Xen hypervisors prior to 4.6.0 do not properly + * handle updates to enabled MSI-X table entries, + * so disable MSI-X interrupt migration in that + * case. + */ + if (bootverbose) + printf( +"Disabling MSI-X interrupt migration due to Xen hypervisor bug.\n" +"Set machdep.msix_disable_migration=0 to forcefully enable it.\n"); + msix_disable_migration = 1; + } } /* From owner-svn-src-head@freebsd.org Tue Jul 12 08:45:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B11EB93A9C for ; Tue, 12 Jul 2016 08:45:38 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA58F12FF for ; Tue, 12 Jul 2016 08:45:37 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f52.google.com with SMTP id b199so6324142lfe.0 for ; Tue, 12 Jul 2016 01:45:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ex2NJ9LrbGDqexYoXH9t0ebRRiAzAGkHPQN8HQ2xBls=; b=C2qFIarFZefk1+UxTcbRrORVJj4D4+5DFBTHhAH1JTvznmlheR7So6Ln3Qz6VHeEPG 6xUGziUVd2QcvCcV/Al+awEHZ/MWYTK3gOI0Fjx8I3Bhs4QFdQ49/7CWxSB1py/u/OzU RqpbjrMrOkqmqhYBVzOTddAaz3W+WNjxroQwjdSfMsWxfr5vd2/4oy5Vk3DvsKwQf9YH BawR+SDcPJD9eI9hoBdQmMoz3s9msRkA7rr9S5cVv0uxVFINipj62PnuAi/kqN7M0buz UJSvpL5w0dNfMcQXH5iYk304I6pwUIBdZh7KsST0PWuA5W2hl+N3sgOcSWnRdm3OnJ0k REew== X-Gm-Message-State: ALyK8tLaB9qX3zlyRTRnKc9Y599fvHAdMV10lJ9Uit7K+R0lHnD+C32TAd3D9jgqS4B7bQ== X-Received: by 10.25.21.160 with SMTP id 32mr295715lfv.1.1468313129904; Tue, 12 Jul 2016 01:45:29 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id 4sm12291866ljf.9.2016.07.12.01.45.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 01:45:29 -0700 (PDT) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include To: Andrew Turner References: <201607120037.u6C0bmNF054452@repo.freebsd.org> <20160712093509.69540801@zapp> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: <03ee3549-563d-6ee1-dab7-4818e8376dd1@freebsd.org> Date: Tue, 12 Jul 2016 11:45:28 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160712093509.69540801@zapp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:45:38 -0000 On 12.07.2016 11:35, Andrew Turner wrote: > On Tue, 12 Jul 2016 00:37:48 +0000 (UTC) > "Andrey A. Chernov" wrote: > >> Author: ache >> Date: Tue Jul 12 00:37:48 2016 >> New Revision: 302601 >> URL: https://svnweb.freebsd.org/changeset/base/302601 >> >> Log: >> I don't know why unsigned int is choosed for wchar_t here, but >> WCHAR_MAX should be <= WINT_MAX. It is bigger, __UINT_MAX > INT32_MAX > > Because the ABI either requires us to use an unsigned int [1], or the > preferred type is unsigned int [2]. In the latter case the other choice > is unsigned short, it would seem this is for Windows. Thanx for explanation. Perhaps we need to use 32bit unsigned int for other architectures too (instead of 32bit signed int), because no L'' literals produce negative value and locale enumerates positive values only. BTW, this commit is already backed out. > > Andrew > > [1] > http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf > [2] > http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf > From owner-svn-src-head@freebsd.org Tue Jul 12 08:47:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B01EB93C06; Tue, 12 Jul 2016 08:47:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D319B17B0; Tue, 12 Jul 2016 08:47:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8l5QE033368; Tue, 12 Jul 2016 08:47:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8l4nN033363; Tue, 12 Jul 2016 08:47:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120847.u6C8l4nN033363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302636 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:47:06 -0000 Author: sephe Date: Tue Jul 12 08:47:04 2016 New Revision: 302636 URL: https://svnweb.freebsd.org/changeset/base/302636 Log: hyperv/vmbus: Move channel map to vmbus_softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6982 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:43:09 2016 (r302635) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Tue Jul 12 08:47:04 2016 (r302636) @@ -123,7 +123,7 @@ vmbus_channel_process_offer(hv_vmbus_cha */ printf("VMBUS: got channel0 offer\n"); } else { - hv_vmbus_g_connection.channels[relid] = new_channel; + sc->vmbus_chmap[relid] = new_channel; } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { @@ -351,10 +351,10 @@ vmbus_channel_on_offer_rescind(struct vm rescind->child_rel_id); } - channel = hv_vmbus_g_connection.channels[rescind->child_rel_id]; + channel = sc->vmbus_chmap[rescind->child_rel_id]; if (channel == NULL) return; - hv_vmbus_g_connection.channels[rescind->child_rel_id] = NULL; + sc->vmbus_chmap[rescind->child_rel_id] = NULL; taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); } @@ -451,8 +451,8 @@ hv_vmbus_release_unattached_channels(str } hv_vmbus_free_vmbus_channel(channel); } - bzero(hv_vmbus_g_connection.channels, - sizeof(hv_vmbus_channel*) * VMBUS_CHAN_MAX); + bzero(sc->vmbus_chmap, + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); mtx_unlock(&sc->vmbus_chlist_lock); } Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 08:43:09 2016 (r302635) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 08:47:04 2016 (r302636) @@ -67,9 +67,6 @@ hv_vmbus_connect(struct vmbus_softc *sc) */ hv_vmbus_g_connection.connect_state = HV_CONNECTING; - hv_vmbus_g_connection.channels = malloc(sizeof(hv_vmbus_channel*) * - VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); - hv_vmbus_g_connection.connect_state = HV_CONNECTED; return (0); @@ -82,14 +79,14 @@ int hv_vmbus_disconnect(void) { - free(hv_vmbus_g_connection.channels, M_DEVBUF); hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; return (0); } static __inline void -vmbus_event_flags_proc(volatile u_long *event_flags, int flag_cnt) +vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, + int flag_cnt) { int f; @@ -112,7 +109,7 @@ vmbus_event_flags_proc(volatile u_long * flags &= ~(1UL << bit); rel_id = rel_id_base + bit; - channel = hv_vmbus_g_connection.channels[rel_id]; + channel = sc->vmbus_chmap[rel_id]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) @@ -135,7 +132,7 @@ vmbus_event_proc(struct vmbus_softc *sc, * to get the id of the channel that has the pending interrupt. */ eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; - vmbus_event_flags_proc(eventf->evt_flags, + vmbus_event_flags_proc(sc, eventf->evt_flags, VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); } @@ -146,7 +143,7 @@ vmbus_event_proc_compat(struct vmbus_sof eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { - vmbus_event_flags_proc(sc->vmbus_rx_evtflags, + vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags, VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); } } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 08:43:09 2016 (r302635) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 08:47:04 2016 (r302636) @@ -109,11 +109,6 @@ typedef enum { typedef struct { hv_vmbus_connect_state connect_state; - - /** - * channel table for fast lookup through id. - */ - hv_vmbus_channel **channels; } hv_vmbus_connection; typedef union { Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:43:09 2016 (r302635) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:47:04 2016 (r302636) @@ -1132,6 +1132,9 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_gpadl = VMBUS_GPADL_START; mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF); TAILQ_INIT(&sc->vmbus_chlist); + sc->vmbus_chmap = malloc( + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, + M_WAITOK | M_ZERO); /* * Create context for "post message" Hypercalls @@ -1201,6 +1204,7 @@ cleanup: vmbus_msghc_ctx_destroy(sc->vmbus_msg_hc); sc->vmbus_msg_hc = NULL; } + free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); return (ret); @@ -1282,6 +1286,7 @@ vmbus_detach(device_t dev) sc->vmbus_msg_hc = NULL; } + free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 08:43:09 2016 (r302635) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 08:47:04 2016 (r302636) @@ -75,6 +75,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ + struct hv_vmbus_channel **vmbus_chmap; struct vmbus_msghc_ctx *vmbus_msg_hc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; From owner-svn-src-head@freebsd.org Tue Jul 12 08:55:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18DB0B93EAA; Tue, 12 Jul 2016 08:55:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0B391F33; Tue, 12 Jul 2016 08:55:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8t9Rv037080; Tue, 12 Jul 2016 08:55:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8t8AF037077; Tue, 12 Jul 2016 08:55:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120855.u6C8t8AF037077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302637 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:55:10 -0000 Author: sephe Date: Tue Jul 12 08:55:08 2016 New Revision: 302637 URL: https://svnweb.freebsd.org/changeset/base/302637 Log: hyperv/vmbus: Remove needed bits MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7002 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 08:47:04 2016 (r302636) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 08:55:08 2016 (r302637) @@ -43,47 +43,6 @@ #include #include -/* - * Globals - */ -hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED }; - -/** - * Send a connect request on the partition service connection - */ -int -hv_vmbus_connect(struct vmbus_softc *sc) -{ - /** - * Make sure we are not connecting or connected - */ - if (hv_vmbus_g_connection.connect_state != HV_DISCONNECTED) { - return (-1); - } - - /** - * Initialize the vmbus connection - */ - hv_vmbus_g_connection.connect_state = HV_CONNECTING; - - hv_vmbus_g_connection.connect_state = HV_CONNECTED; - - return (0); -} - -/** - * Send a disconnect request on the partition service connection - */ -int -hv_vmbus_disconnect(void) -{ - - hv_vmbus_g_connection.connect_state = HV_DISCONNECTED; - - return (0); -} - static __inline void vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, int flag_cnt) Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 08:47:04 2016 (r302636) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 08:55:08 2016 (r302637) @@ -97,20 +97,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -/* - * VM Bus connection states - */ -typedef enum { - HV_DISCONNECTED, - HV_CONNECTING, - HV_CONNECTED, - HV_DISCONNECTING -} hv_vmbus_connect_state; - -typedef struct { - hv_vmbus_connect_state connect_state; -} hv_vmbus_connection; - typedef union { uint32_t as_uint32_t; struct { @@ -172,12 +158,6 @@ typedef struct { uint8_t rsvd_z4[1984]; } hv_vmbus_monitor_page; -/** - * Global variables - */ - -extern hv_vmbus_connection hv_vmbus_g_connection; - /* * Private, VM Bus functions */ @@ -242,10 +222,4 @@ void hv_vmbus_child_device_register(st int hv_vmbus_child_device_unregister( struct hv_device *child_dev); -/** - * Connection interfaces - */ -int hv_vmbus_connect(struct vmbus_softc *); -int hv_vmbus_disconnect(void); - #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:47:04 2016 (r302636) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:55:08 2016 (r302637) @@ -1169,12 +1169,8 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_flags |= VMBUS_FLAG_SYNIC; /* - * Connect to VMBus in the root partition + * Initialize vmbus, e.g. connect to Hypervisor. */ - ret = hv_vmbus_connect(sc); - if (ret != 0) - goto cleanup; - ret = vmbus_init(sc); if (ret != 0) goto cleanup; @@ -1271,7 +1267,6 @@ vmbus_detach(device_t dev) hv_vmbus_release_unattached_channels(sc); vmbus_disconnect(sc); - hv_vmbus_disconnect(); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { sc->vmbus_flags &= ~VMBUS_FLAG_SYNIC; From owner-svn-src-head@freebsd.org Tue Jul 12 09:06:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB4BB92715; Tue, 12 Jul 2016 09:06:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B5B41CBC; Tue, 12 Jul 2016 09:06:26 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C96PjK041013; Tue, 12 Jul 2016 09:06:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C96Psm041012; Tue, 12 Jul 2016 09:06:25 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120906.u6C96Psm041012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 09:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302638 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 09:06:26 -0000 Author: sephe Date: Tue Jul 12 09:06:25 2016 New Revision: 302638 URL: https://svnweb.freebsd.org/changeset/base/302638 Log: hyperv/vmbus: Destroy channel list lock upon attach failure and detach. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7003 Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 08:55:08 2016 (r302637) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 09:06:25 2016 (r302638) @@ -1202,6 +1202,7 @@ cleanup: } free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); + mtx_destroy(&sc->vmbus_chlist_lock); return (ret); } @@ -1283,6 +1284,8 @@ vmbus_detach(device_t dev) free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); + mtx_destroy(&sc->vmbus_chlist_lock); + return (0); } From owner-svn-src-head@freebsd.org Tue Jul 12 14:32:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36ABAB92FA8 for ; Tue, 12 Jul 2016 14:32:51 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DDB41AB3 for ; Tue, 12 Jul 2016 14:32:50 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 865f2072-483d-11e6-ac92-3142cfe117f2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.eu.mailhop.org (Halon Mail Gateway) with ESMTPSA; Tue, 12 Jul 2016 14:32:55 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u6CEWhmF001302; Tue, 12 Jul 2016 08:32:43 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1468333963.72182.133.camel@freebsd.org> Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include From: Ian Lepore To: "Andrey A. Chernov" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 12 Jul 2016 08:32:43 -0600 In-Reply-To: <201607120037.u6C0bmNF054452@repo.freebsd.org> References: <201607120037.u6C0bmNF054452@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 14:32:51 -0000 On Tue, 2016-07-12 at 00:37 +0000, Andrey A. Chernov wrote: > Author: ache > Date: Tue Jul 12 00:37:48 2016 > New Revision: 302601 > URL: https://svnweb.freebsd.org/changeset/base/302601 > > Log: > I don't know why unsigned int is choosed for wchar_t here, but The ARM ABI requires wchar_t to be unsigned (plain char is unsigned by default in the ARM ABI too). -- Ian From owner-svn-src-head@freebsd.org Tue Jul 12 15:46:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2425AB93986; Tue, 12 Jul 2016 15:46:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDF2F1199; Tue, 12 Jul 2016 15:46:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CFks2X090086; Tue, 12 Jul 2016 15:46:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CFksru090085; Tue, 12 Jul 2016 15:46:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607121546.u6CFksru090085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 Jul 2016 15:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302664 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 15:46:55 -0000 Author: pfg Date: Tue Jul 12 15:46:53 2016 New Revision: 302664 URL: https://svnweb.freebsd.org/changeset/base/302664 Log: mkimg(1): minor cleanups with argument order in calloc(3). Generally the first argument in calloc is supposed to stand for a count and the second for a size. Try to make that consistent. While here, attempt to make some use of the overflow detection capability in calloc(3). Modified: head/usr.bin/mkimg/vmdk.c Modified: head/usr.bin/mkimg/vmdk.c ============================================================================== --- head/usr.bin/mkimg/vmdk.c Tue Jul 12 13:12:01 2016 (r302663) +++ head/usr.bin/mkimg/vmdk.c Tue Jul 12 15:46:53 2016 (r302664) @@ -149,7 +149,7 @@ vmdk_write(int fd) gdsz = (ngts * sizeof(uint32_t) + VMDK_SECTOR_SIZE - 1) & ~(VMDK_SECTOR_SIZE - 1); - gd = calloc(gdsz, 1); + gd = calloc(1, gdsz); if (gd == NULL) { free(desc); return (ENOMEM); @@ -161,7 +161,7 @@ vmdk_write(int fd) sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE; } - rgd = calloc(gdsz, 1); + rgd = calloc(1, gdsz); if (rgd == NULL) { free(gd); free(desc); @@ -183,14 +183,14 @@ vmdk_write(int fd) le64enc(&hdr.overhead, sec); be32enc(&hdr.nl_test, VMDK_NL_TEST); - gtsz = ngts * VMDK_NGTES * sizeof(uint32_t); - gt = calloc(gtsz, 1); + gt = calloc(ngts, VMDK_NGTES * sizeof(uint32_t)); if (gt == NULL) { free(rgd); free(gd); free(desc); return (ENOMEM); } + gtsz = ngts * VMDK_NGTES * sizeof(uint32_t); cursec = sec; blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz; @@ -225,7 +225,7 @@ vmdk_write(int fd) cur = VMDK_SECTOR_SIZE + desc_len + (gdsz + gtsz) * 2; lim = sec * VMDK_SECTOR_SIZE; if (cur < lim) { - buf = calloc(VMDK_SECTOR_SIZE, 1); + buf = calloc(1, VMDK_SECTOR_SIZE); if (buf == NULL) error = ENOMEM; while (!error && cur < lim) { From owner-svn-src-head@freebsd.org Tue Jul 12 17:30:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38CFFB84607; Tue, 12 Jul 2016 17:30:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03F4017FC; Tue, 12 Jul 2016 17:30:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CHUc4R027154; Tue, 12 Jul 2016 17:30:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CHUcAR027153; Tue, 12 Jul 2016 17:30:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607121730.u6CHUcAR027153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 12 Jul 2016 17:30:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302666 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 17:30:39 -0000 Author: mav Date: Tue Jul 12 17:30:37 2016 New Revision: 302666 URL: https://svnweb.freebsd.org/changeset/base/302666 Log: Add missing breaks in I/O BAR read/write. This could be important if any guest actually used those registers. Reported by: Coverity CID: 1357519, 1357520 Modified: head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Tue Jul 12 17:22:13 2016 (r302665) +++ head/usr.sbin/bhyve/pci_e82545.c Tue Jul 12 17:30:37 2016 (r302666) @@ -2040,6 +2040,7 @@ e82545_write(struct vmctx *ctx, int vcpu DPRINTF("Unknown io bar write offset:0x%lx value:0x%lx size:%d\r\n", offset, value, size); break; } + break; case E82545_BAR_REGISTER: if (size != 4) { DPRINTF("Wrong register write size:%d offset:0x%lx value:0x%lx\r\n", size, offset, value); @@ -2092,6 +2093,7 @@ e82545_read(struct vmctx *ctx, int vcpu, offset, size); break; } + break; case E82545_BAR_REGISTER: if (size != 4) { DPRINTF("Wrong register read size:%d offset:0x%lx\r\n", From owner-svn-src-head@freebsd.org Tue Jul 12 17:32:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 695A2B8490D; Tue, 12 Jul 2016 17:32:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 406611C50; Tue, 12 Jul 2016 17:32:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CHWe64030652; Tue, 12 Jul 2016 17:32:40 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CHWeDv030651; Tue, 12 Jul 2016 17:32:40 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201607121732.u6CHWeDv030651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Tue, 12 Jul 2016 17:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302667 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 17:32:41 -0000 Author: truckman Date: Tue Jul 12 17:32:40 2016 New Revision: 302667 URL: https://svnweb.freebsd.org/changeset/base/302667 Log: Fix problems in the FQ-PIE AQM cleanup code that could leak memory or cause a crash. Because dummynet calls pie_cleanup() while holding a mutex, pie_cleanup() is not able to use callout_drain() to make sure that all callouts are finished before it returns, and callout_stop() is not sufficient to make that guarantee. After pie_cleanup() returns, dummynet will free a structure that any remaining callouts will want to access. Fix these problems by allocating a separate structure to contain the data used by the callouts. In pie_cleanup(), call callout_reset_sbt() to replace the normal callout with a cleanup callout that does the cleanup work for each sub-queue. The instance of the cleanup callout that destroys the last flow will also free the extra allocated block of memory. Protect the reference count manipulation in the cleanup callout with DN_BH_WLOCK() to be consistent with all of the other usage of the reference count where this lock is held by the dummynet code. Submitted by: Rasool Al-Saadi MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7174 Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Tue Jul 12 17:30:37 2016 (r302666) +++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Tue Jul 12 17:32:40 2016 (r302667) @@ -111,7 +111,7 @@ struct fq_pie_flow { int deficit; int active; /* 1: flow is active (in a list) */ struct pie_status pst; /* pie status variables */ - struct fq_pie_si *psi; /* parent scheduler instance */ + struct fq_pie_si_extra *psi_extra; STAILQ_ENTRY(fq_pie_flow) flowchain; }; @@ -120,23 +120,30 @@ struct fq_pie_schk { struct dn_sch_fq_pie_parms cfg; }; + +/* fq_pie scheduler instance extra state vars. + * The purpose of separation this structure is to preserve number of active + * sub-queues and the flows array pointer even after the scheduler instance + * is destroyed. + * Preserving these varaiables allows freeing the allocated memory by + * fqpie_callout_cleanup() independently from fq_pie_free_sched(). + */ +struct fq_pie_si_extra { + uint32_t nr_active_q; /* number of active queues */ + struct fq_pie_flow *flows; /* array of flows (queues) */ + }; + /* fq_pie scheduler instance */ struct fq_pie_si { - struct dn_sch_inst _si; /* standard scheduler instance */ + struct dn_sch_inst _si; /* standard scheduler instance. SHOULD BE FIRST */ struct dn_queue main_q; /* main queue is after si directly */ - uint32_t nr_active_q; - struct fq_pie_flow *flows; /* array of flows (queues) */ uint32_t perturbation; /* random value */ struct fq_pie_list newflows; /* list of new queues */ struct fq_pie_list oldflows; /* list of old queues */ + struct fq_pie_si_extra *si_extra; /* extra state vars*/ }; -struct mem_to_free { - void *mem_flows; - void *mem_callout; -}; -static struct mtx freemem_mtx; static struct dn_alg fq_pie_desc; /* Default FQ-PIE parameters including PIE */ @@ -371,22 +378,6 @@ fq_calculate_drop_prob(void *x) int64_t p, prob, oldprob; aqm_time_t now; - /* dealing with race condition */ - if (callout_pending(&pst->aqm_pie_callout)) { - /* callout was reset */ - mtx_unlock(&pst->lock_mtx); - return; - } - - if (!callout_active(&pst->aqm_pie_callout)) { - /* callout was stopped */ - mtx_unlock(&pst->lock_mtx); - mtx_destroy(&pst->lock_mtx); - q->psi->nr_active_q--; - return; - } - callout_deactivate(&pst->aqm_pie_callout); - now = AQM_UNOW; pprms = pst->parms; prob = pst->drop_prob; @@ -524,20 +515,17 @@ fq_deactivate_pie(struct pie_status *pst * Initialize PIE for sub-queue 'q' */ static int -pie_init(struct fq_pie_flow *q) +pie_init(struct fq_pie_flow *q, struct fq_pie_schk *fqpie_schk) { struct pie_status *pst=&q->pst; struct dn_aqm_pie_parms *pprms = pst->parms; - struct fq_pie_schk *fqpie_schk; - - fqpie_schk = (struct fq_pie_schk *)(q->psi->_si.sched+1); - int err = 0; + int err = 0; if (!pprms){ D("AQM_PIE is not configured"); err = EINVAL; } else { - q->psi->nr_active_q++; + q->psi_extra->nr_active_q++; /* For speed optimization, we caculate 1/3 queue size once here */ // XXX limit divided by number of queues divided by 3 ??? @@ -553,8 +541,36 @@ pie_init(struct fq_pie_flow *q) } /* + * callout function to destroy PIE lock, and free fq_pie flows and fq_pie si + * extra memory when number of active sub-queues reaches zero. + * 'x' is a fq_pie_flow to be destroyed + */ +static void +fqpie_callout_cleanup(void *x) +{ + struct fq_pie_flow *q = x; + struct pie_status *pst = &q->pst; + struct fq_pie_si_extra *psi_extra; + + mtx_unlock(&pst->lock_mtx); + mtx_destroy(&pst->lock_mtx); + psi_extra = q->psi_extra; + + DN_BH_WLOCK(); + psi_extra->nr_active_q--; + + /* when all sub-queues are destroyed, free flows fq_pie extra vars memory */ + if (!psi_extra->nr_active_q) { + free(psi_extra->flows, M_DUMMYNET); + free(psi_extra, M_DUMMYNET); + fq_pie_desc.ref_count--; + } + DN_BH_WUNLOCK(); +} + +/* * Clean up PIE status for sub-queue 'q' - * Stop callout timer and destroy mtx + * Stop callout timer and destroy mtx using fqpie_callout_cleanup() callout. */ static int pie_cleanup(struct fq_pie_flow *q) @@ -562,14 +578,9 @@ pie_cleanup(struct fq_pie_flow *q) struct pie_status *pst = &q->pst; mtx_lock(&pst->lock_mtx); - if (callout_stop(&pst->aqm_pie_callout) || !(pst->sflags & PIE_ACTIVE)) { - mtx_unlock(&pst->lock_mtx); - mtx_destroy(&pst->lock_mtx); - q->psi->nr_active_q--; - } else { - mtx_unlock(&pst->lock_mtx); - return EBUSY; - } + callout_reset_sbt(&pst->aqm_pie_callout, + SBT_1US, 0, fqpie_callout_cleanup, q, 0); + mtx_unlock(&pst->lock_mtx); return 0; } @@ -831,10 +842,12 @@ fq_pie_enqueue(struct dn_sch_inst *_si, struct fq_pie_schk *schk; struct dn_sch_fq_pie_parms *param; struct dn_queue *mainq; + struct fq_pie_flow *flows; int idx, drop, i, maxidx; mainq = (struct dn_queue *)(_si + 1); si = (struct fq_pie_si *)_si; + flows = si->si_extra->flows; schk = (struct fq_pie_schk *)(si->_si.sched+1); param = &schk->cfg; @@ -844,7 +857,7 @@ fq_pie_enqueue(struct dn_sch_inst *_si, /* enqueue packet into appropriate queue using PIE AQM. * Note: 'pie_enqueue' function returns 1 only when it unable to * add timestamp to packet (no limit check)*/ - drop = pie_enqueue(&si->flows[idx], m, si); + drop = pie_enqueue(&flows[idx], m, si); /* pie unable to timestamp a packet */ if (drop) @@ -853,11 +866,11 @@ fq_pie_enqueue(struct dn_sch_inst *_si, /* If the flow (sub-queue) is not active ,then add it to tail of * new flows list, initialize and activate it. */ - if (!si->flows[idx].active) { - STAILQ_INSERT_TAIL(&si->newflows, &si->flows[idx], flowchain); - si->flows[idx].deficit = param->quantum; - fq_activate_pie(&si->flows[idx]); - si->flows[idx].active = 1; + if (!flows[idx].active) { + STAILQ_INSERT_TAIL(&si->newflows, &flows[idx], flowchain); + flows[idx].deficit = param->quantum; + fq_activate_pie(&flows[idx]); + flows[idx].active = 1; } /* check the limit for all queues and remove a packet from the @@ -866,15 +879,15 @@ fq_pie_enqueue(struct dn_sch_inst *_si, if (mainq->ni.length > schk->cfg.limit) { /* find first active flow */ for (maxidx = 0; maxidx < schk->cfg.flows_cnt; maxidx++) - if (si->flows[maxidx].active) + if (flows[maxidx].active) break; if (maxidx < schk->cfg.flows_cnt) { /* find the largest sub- queue */ for (i = maxidx + 1; i < schk->cfg.flows_cnt; i++) - if (si->flows[i].active && si->flows[i].stats.length > - si->flows[maxidx].stats.length) + if (flows[i].active && flows[i].stats.length > + flows[maxidx].stats.length) maxidx = i; - pie_drop_head(&si->flows[maxidx], si); + pie_drop_head(&flows[maxidx], si); drop = 1; } } @@ -974,12 +987,13 @@ fq_pie_new_sched(struct dn_sch_inst *_si struct fq_pie_si *si; struct dn_queue *q; struct fq_pie_schk *schk; + struct fq_pie_flow *flows; int i; si = (struct fq_pie_si *)_si; schk = (struct fq_pie_schk *)(_si->sched+1); - if(si->flows) { + if(si->si_extra) { D("si already configured!"); return 0; } @@ -990,17 +1004,27 @@ fq_pie_new_sched(struct dn_sch_inst *_si q->_si = _si; q->fs = _si->sched->fs; + /* allocate memory for scheduler instance extra vars */ + si->si_extra = malloc(sizeof(struct fq_pie_si_extra), + M_DUMMYNET, M_NOWAIT | M_ZERO); + if (si->si_extra == NULL) { + D("cannot allocate memory for fq_pie si extra vars"); + return ENOMEM ; + } /* allocate memory for flows array */ - si->flows = malloc(schk->cfg.flows_cnt * sizeof(struct fq_pie_flow), + si->si_extra->flows = malloc(schk->cfg.flows_cnt * sizeof(struct fq_pie_flow), M_DUMMYNET, M_NOWAIT | M_ZERO); - if (si->flows == NULL) { - D("cannot allocate memory for fq_pie configuration parameters"); + flows = si->si_extra->flows; + if (flows == NULL) { + free(si->si_extra, M_DUMMYNET); + si->si_extra = NULL; + D("cannot allocate memory for fq_pie flows"); return ENOMEM ; } /* init perturbation for this si */ si->perturbation = random(); - si->nr_active_q = 0; + si->si_extra->nr_active_q = 0; /* init the old and new flows lists */ STAILQ_INIT(&si->newflows); @@ -1008,45 +1032,16 @@ fq_pie_new_sched(struct dn_sch_inst *_si /* init the flows (sub-queues) */ for (i = 0; i < schk->cfg.flows_cnt; i++) { - si->flows[i].pst.parms = &schk->cfg.pcfg; - si->flows[i].psi = si; - pie_init(&si->flows[i]); - } - - /* init mtx lock and callout function for free memory */ - if (!fq_pie_desc.ref_count) { - mtx_init(&freemem_mtx, "mtx_pie", NULL, MTX_DEF); + flows[i].pst.parms = &schk->cfg.pcfg; + flows[i].psi_extra = si->si_extra; + pie_init(&flows[i], schk); } - mtx_lock(&freemem_mtx); fq_pie_desc.ref_count++; - mtx_unlock(&freemem_mtx); return 0; } -/* - * Free FQ-PIE flows memory callout function. - * This function is scheduled when a flow or more still active and - * the scheduer is about to be destroyed, to prevent memory leak. - */ -static void -free_flows(void *_mem) -{ - struct mem_to_free *mem = _mem; - - free(mem->mem_flows, M_DUMMYNET); - free(mem->mem_callout, M_DUMMYNET); - free(_mem, M_DUMMYNET); - - fq_pie_desc.ref_count--; - if (!fq_pie_desc.ref_count) { - mtx_unlock(&freemem_mtx); - mtx_destroy(&freemem_mtx); - } else - mtx_unlock(&freemem_mtx); - //D("mem freed ok!"); -} /* * Free fq_pie scheduler instance. @@ -1056,61 +1051,17 @@ fq_pie_free_sched(struct dn_sch_inst *_s { struct fq_pie_si *si; struct fq_pie_schk *schk; + struct fq_pie_flow *flows; int i; si = (struct fq_pie_si *)_si; schk = (struct fq_pie_schk *)(_si->sched+1); - + flows = si->si_extra->flows; for (i = 0; i < schk->cfg.flows_cnt; i++) { - pie_cleanup(&si->flows[i]); - } - - /* if there are still some queues have a callout going to start, - * we cannot free flows memory. If we do so, a panic can happen - * as prob calculate callout function uses flows memory. - */ - if (!si->nr_active_q) { - /* free the flows array */ - free(si->flows , M_DUMMYNET); - si->flows = NULL; - mtx_lock(&freemem_mtx); - fq_pie_desc.ref_count--; - if (!fq_pie_desc.ref_count) { - mtx_unlock(&freemem_mtx); - mtx_destroy(&freemem_mtx); - } else - mtx_unlock(&freemem_mtx); - //D("ok!"); - return 0; - } else { - /* memory leak happens here. So, we register a callout function to free - * flows memory later. - */ - D("unable to stop all fq_pie sub-queues!"); - mtx_lock(&freemem_mtx); - - struct callout *mem_callout; - struct mem_to_free *mem; - - mem = malloc(sizeof(*mem), M_DUMMYNET, - M_NOWAIT | M_ZERO); - mem_callout = malloc(sizeof(*mem_callout), M_DUMMYNET, - M_NOWAIT | M_ZERO); - - callout_init_mtx(mem_callout, &freemem_mtx, - CALLOUT_RETURNUNLOCKED); - - mem->mem_flows = si->flows; - mem->mem_callout = mem_callout; - callout_reset_sbt(mem_callout, - (uint64_t)(si->flows[0].pst.parms->tupdate + 1000) * SBT_1US, - 0, free_flows, mem, 0); - - si->flows = NULL; - mtx_unlock(&freemem_mtx); - - return EBUSY; + pie_cleanup(&flows[i]); } + si->si_extra = NULL; + return 0; } /* From owner-svn-src-head@freebsd.org Tue Jul 12 17:38:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 687B2B84BB4; Tue, 12 Jul 2016 17:38:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35AF31F19; Tue, 12 Jul 2016 17:38:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CHcIvX030893; Tue, 12 Jul 2016 17:38:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CHcIPG030892; Tue, 12 Jul 2016 17:38:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607121738.u6CHcIPG030892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 12 Jul 2016 17:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302668 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 17:38:19 -0000 Author: mav Date: Tue Jul 12 17:38:18 2016 New Revision: 302668 URL: https://svnweb.freebsd.org/changeset/base/302668 Log: Make unknown register reads predictable. Reported by: Coverity CID: 1357525 Modified: head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Tue Jul 12 17:32:40 2016 (r302667) +++ head/usr.sbin/bhyve/pci_e82545.c Tue Jul 12 17:38:18 2016 (r302668) @@ -2000,6 +2000,7 @@ e82545_read_register(struct e82545_softc break; default: DPRINTF("Unknown read register: 0x%x\r\n", offset); + retval = 0; break; } From owner-svn-src-head@freebsd.org Tue Jul 12 17:58:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0F81B855B6; Tue, 12 Jul 2016 17:58:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E0EF1C3A; Tue, 12 Jul 2016 17:58:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CHwwUA038272; Tue, 12 Jul 2016 17:58:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CHww0b038271; Tue, 12 Jul 2016 17:58:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607121758.u6CHww0b038271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 17:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302669 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 17:59:00 -0000 Author: cem Date: Tue Jul 12 17:58:58 2016 New Revision: 302669 URL: https://svnweb.freebsd.org/changeset/base/302669 Log: ioat(4): Shrink using the correct timer Fix a typo introduced in r302352. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 17:38:18 2016 (r302668) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 17:58:58 2016 (r302669) @@ -1704,7 +1704,7 @@ ioat_shrink_timer_callback(void *arg) out: if (ioat->ring_size_order > IOAT_MIN_ORDER) - callout_reset(&ioat->poll_timer, IOAT_SHRINK_PERIOD, + callout_reset(&ioat->shrink_timer, IOAT_SHRINK_PERIOD, ioat_shrink_timer_callback, ioat); } From owner-svn-src-head@freebsd.org Tue Jul 12 18:57:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C774FB92A92; Tue, 12 Jul 2016 18:57:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2A5A11F7; Tue, 12 Jul 2016 18:57:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CIvPcB060477; Tue, 12 Jul 2016 18:57:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CIvPBG060470; Tue, 12 Jul 2016 18:57:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607121857.u6CIvPBG060470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 12 Jul 2016 18:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 18:57:26 -0000 Author: bdrewery Date: Tue Jul 12 18:57:25 2016 New Revision: 302670 URL: https://svnweb.freebsd.org/changeset/base/302670 Log: Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUARCH_SUB. This also adds missing s/aarch64/arm64 to the sys.mk version and also adds back armv6hf for universe since it was added to the sys.mk version in r300438. MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7159 Modified: head/Makefile head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/cc/Makefile.tgt head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/libgdb/Makefile head/share/mk/sys.mk Modified: head/Makefile ============================================================================== --- head/Makefile Tue Jul 12 17:58:58 2016 (r302669) +++ head/Makefile Tue Jul 12 18:57:25 2016 (r302670) @@ -235,7 +235,7 @@ _MAKE+= MK_META_MODE=no _TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} +_TARGET= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 17:58:58 2016 (r302669) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 18:57:25 2016 (r302670) @@ -7,7 +7,7 @@ VERSION= "2.17.50 [FreeBSD] 2007-07-03" .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 17:58:58 2016 (r302669) +++ head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 18:57:25 2016 (r302670) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 17:58:58 2016 (r302669) +++ head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 18:57:25 2016 (r302670) @@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 17:58:58 2016 (r302669) +++ head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 18:57:25 2016 (r302670) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Tue Jul 12 17:58:58 2016 (r302669) +++ head/share/mk/sys.mk Tue Jul 12 18:57:25 2016 (r302670) @@ -13,7 +13,13 @@ unix ?= We run FreeBSD, not UNIX. # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} +MACHINE_CPUARCH_SUB= \ + C/mips(n32|64)?(el)?/mips/ \ + C/arm(v6)?(eb|hf)?/arm/ \ + C/aarch64/arm64/ \ + C/powerpc64/powerpc/ \ + C/riscv64/riscv/ +MACHINE_CPUARCH=${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}} .endif From owner-svn-src-head@freebsd.org Tue Jul 12 18:57:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0601B92ABB; Tue, 12 Jul 2016 18:57:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F65111FC; Tue, 12 Jul 2016 18:57:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CIvSmU060523; Tue, 12 Jul 2016 18:57:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CIvS34060522; Tue, 12 Jul 2016 18:57:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607121857.u6CIvS34060522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 12 Jul 2016 18:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302671 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 18:57:29 -0000 Author: bdrewery Date: Tue Jul 12 18:57:28 2016 New Revision: 302671 URL: https://svnweb.freebsd.org/changeset/base/302671 Log: Create a TARGET_CPUARCH thing to go with MACHINE_CPUARCH. MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7160 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 12 18:57:25 2016 (r302670) +++ head/Makefile.inc1 Tue Jul 12 18:57:28 2016 (r302671) @@ -384,6 +384,8 @@ XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP} STRICTTMPPATH= ${BPATH}:${XPATH} TMPPATH= ${STRICTTMPPATH}:${PATH} +TARGET_CPUARCH?= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} + # # Avoid running mktemp(1) unless actually needed. # It may not be functional, e.g., due to new ABI From owner-svn-src-head@freebsd.org Tue Jul 12 19:34:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C06C1B934C7; Tue, 12 Jul 2016 19:34:12 +0000 (UTC) (envelope-from slm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8ADF11A4E; Tue, 12 Jul 2016 19:34:12 +0000 (UTC) (envelope-from slm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CJYBjP075561; Tue, 12 Jul 2016 19:34:11 GMT (envelope-from slm@FreeBSD.org) Received: (from slm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CJYBXB075553; Tue, 12 Jul 2016 19:34:11 GMT (envelope-from slm@FreeBSD.org) Message-Id: <201607121934.u6CJYBXB075553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: slm set sender to slm@FreeBSD.org using -f From: Stephen McConnell Date: Tue, 12 Jul 2016 19:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302673 - in head: share/man/man4 sys/dev/mpr sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 19:34:12 -0000 Author: slm Date: Tue Jul 12 19:34:10 2016 New Revision: 302673 URL: https://svnweb.freebsd.org/changeset/base/302673 Log: Use real values to calculate Max I/O size instead of guessing. Reviewed by: ken, scottl Approved by: ken, scottl, ambrisko (mentors) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7043 Modified: head/share/man/man4/mpr.4 head/share/man/man4/mps.4 head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mpsvar.h Modified: head/share/man/man4/mpr.4 ============================================================================== --- head/share/man/man4/mpr.4 Tue Jul 12 19:27:05 2016 (r302672) +++ head/share/man/man4/mpr.4 Tue Jul 12 19:34:10 2016 (r302673) @@ -38,7 +38,7 @@ .\" $Id$ .\" $FreeBSD$ .\" -.Dd April 29, 2016 +.Dd July 6, 2016 .Dt MPR 4 .Os .Sh NAME @@ -156,6 +156,29 @@ The current number of active I/O command dev.mpr.X.io_cmds_active .Xr sysctl 8 variable. +.Ed +.Pp +To set the maximum number of pages that will be used per I/O for all adapters, +set this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mpr.max_io_pages=NNNN +.Ed +.Pp +To set the maximum number of pages that will be used per I/O for a specific +adapter, set this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mpr.X.max_io_pages=NNNN +.Ed +.Pp +The default max_io_pages value is -1, meaning that the maximum I/O size that +will be used per I/O will be calculated using the IOCFacts values stored in +the controller. +The lowest value that the driver will use for max_io_pages is 1, otherwise +IOCFacts will be used to calculate the maximum I/O size. +The smaller I/O size calculated from either max_io_pages or IOCFacts will be the +maximum I/O size used by the driver. .Pp The highest number of active I/O commands seen since boot is stored in the dev.mpr.X.io_cmds_highwater @@ -220,7 +243,7 @@ SATA disks that take several seconds to command might not be discovered by the driver. This problem can sometimes be overcome by increasing the value of the spinup wait time in -.Xr loader.conf 5 : +.Xr loader.conf 5 with the .Bd -literal -offset indent hw.mpr.spinup_wait_time=NNNN Modified: head/share/man/man4/mps.4 ============================================================================== --- head/share/man/man4/mps.4 Tue Jul 12 19:27:05 2016 (r302672) +++ head/share/man/man4/mps.4 Tue Jul 12 19:34:10 2016 (r302673) @@ -1,5 +1,8 @@ .\" .\" Copyright (c) 2010 Spectra Logic Corporation +.\" Copyright (c) 2014 LSI Corp +.\" Copyright (c) 2016 Avago Technologies +.\" Copyright (c) 2016 Broadcom Ltd. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -30,25 +33,27 @@ .\" mps driver man page. .\" .\" Author: Ken Merry +.\" Author: Stephen McConnell .\" .\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $ .\" $FreeBSD$ .\" -.Dd December 9, 2015 +.Dd July 5, 2016 .Dt MPS 4 .Os .Sh NAME .Nm mps -.Nd LSI Fusion-MPT 2 Serial Attached SCSI driver +.Nd "LSI Fusion-MPT 2 IT/IR 6Gb/s Serial Attached SCSI/SATA driver" .Sh SYNOPSIS -To compile this driver into your kernel, -place the following lines in your kernel configuration file: +To compile this driver into the kernel, place these lines in the kernel +configuration file: .Bd -ragged -offset indent +.Cd "device pci" .Cd "device scbus" .Cd "device mps" .Ed .Pp -Or, to load the driver as a module at boot, place the following line in +The driver can be loaded as a module at boot time by placing this line in .Xr loader.conf 5 : .Bd -literal -offset indent mps_load="YES" @@ -56,35 +61,30 @@ mps_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for LSI Logic Fusion-MPT 2 +driver provides support for Broadcom Ltd./Avago Tech (LSI) +Fusion-MPT 2 IT/IR .Tn SAS controllers and WarpDrive solid state storage cards. .Sh HARDWARE -The +These controllers are supported by the .Nm -driver supports the following hardware: +driver: .Pp .Bl -bullet -compact .It -LSI Logic SAS2004 (4 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2004 (4 Port SAS) .It -LSI Logic SAS2008 (8 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2008 (8 Port SAS) .It -LSI Logic SAS2108 (8 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2108 (8 Port SAS) .It -LSI Logic SAS2116 (16 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2116 (16 Port SAS) .It -LSI Logic SAS2208 (8 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2208 (8 Port SAS) .It -LSI Logic SAS2308 (8 Port -.Tn SAS ) +Broadcom Ltd./Avago Tech (LSI) SAS 2308 (8 Port SAS) .It -LSI Logic SSS6200 Solid State Storage +Broadcom Ltd./Avago Tech (LSI) SSS6200 Solid State Storage .It Intel Integrated RAID Module RMS25JB040 .It @@ -95,9 +95,12 @@ Intel Integrated RAID Module RMS25KB040 Intel Integrated RAID Module RMS25KB080 .El .Sh CONFIGURATION +.Pp +In all tunable descriptions below, X represents the adapter number. +.Pp To disable MSI interrupts for all .Nm -driver instances, set the following tunable value in +driver instances, set this tunable value in .Xr loader.conf 5 : .Bd -literal -offset indent hw.mps.disable_msi=1 @@ -105,17 +108,15 @@ hw.mps.disable_msi=1 .Pp To disable MSI interrupts for a specific .Nm -driver instance, set the following tunable value in +driver instance, set this tunable value in .Xr loader.conf 5 : .Bd -literal -offset indent dev.mps.X.disable_msi=1 .Ed .Pp -where X is the adapter number. -.Pp To disable MSI-X interrupts for all .Nm -driver instances, set the following tunable value in +driver instances, set this tunable value in .Xr loader.conf 5 : .Bd -literal -offset indent hw.mps.disable_msix=1 @@ -123,84 +124,157 @@ hw.mps.disable_msix=1 .Pp To disable MSI-X interrupts for a specific .Nm -driver instance, set the following tunable value in +driver instance, set this tunable value in .Xr loader.conf 5 : .Bd -literal -offset indent dev.mps.X.disable_msix=1 .Ed .Pp -where X is the adapter number. -.Pp -To set the maximum number of DMA chains allocated for all adapters, -set the following variable in +To set the maximum number of DMA chains allocated for all adapters, set this +tunable in .Xr loader.conf 5 : .Bd -literal -offset indent hw.mps.max_chains=NNNN .Ed .Pp To set the maximum number of DMA chains allocated for a specific adapter, -set the following variable in +set this tunable in .Xr loader.conf 5 : .Bd -literal -offset indent dev.mps.X.max_chains=NNNN .Ed .Pp -This variable may also be viewed via -.Xr sysctl 8 -to see the maximum set for a given adapter. +The default max_chains value is 2048. .Pp -The current number of free chain frames may be seen via the +The current number of free chain frames is stored in the dev.mps.X.chain_free .Xr sysctl 8 variable. .Pp -The lowest number of free chain frames may be seen via the +The lowest number of free chain frames seen since boot is stored in the dev.mps.X.chain_free_lowwater .Xr sysctl 8 variable. .Pp +The number of times that chain frame allocations have failed since boot is +stored in the +dev.mps.X.chain_alloc_fail +.Xr sysctl 8 +variable. +This can be used to determine whether the max_chains tunable should be +increased to help performance. +.Pp The current number of active I/O commands is shown in the dev.mps.X.io_cmds_active .Xr sysctl 8 variable. +.Ed +.Pp +To set the maximum number of pages that will be used per I/O for all adapters, +set this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mps.max_io_pages=NNNN +.Ed .Pp -The maximum number of active I/O command seen since boot is shown in the +To set the maximum number of pages that will be used per I/O for a specific +adapter, set this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mps.X.max_io_pages=NNNN +.Ed +.Pp +The default max_io_pages value is -1, meaning that the maximum I/O size that +will be used per I/O will be calculated using the IOCFacts values stored in +the controller. +The lowest value that the driver will use for max_io_pages is 1, otherwise +IOCFacts will be used to calculate the maximum I/O size. +The smaller I/O size calculated from either max_io_pages or IOCFacts will be the +maximum I/O size used by the driver. +.Pp +The highest number of active I/O commands seen since boot is stored in the dev.mps.X.io_cmds_highwater .Xr sysctl 8 variable. .Pp +Devices can be excluded from +.Nm +control for all adapters by setting this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mps.exclude_ids=Y +.Ed +.Pp +Y represents the target ID of the device. +If more than one device is to be excluded, target IDs are separated by commas. +.Pp +Devices can be excluded from +.Nm +control for a specific adapter by setting this tunable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mps.X.exclude_ids=Y +.Ed +.Pp +Y represents the target ID of the device. +If more than one device is to be excluded, target IDs are separated by commas. +.Pp The adapter can issue the .Sy StartStopUnit -SCSI command to SATA direct-access devices during shutdown, to allow the -device to quiesce before being powered down. +SCSI command to SATA direct-access devices during shutdown. +This allows the device to quiesce powering down. To control this feature for all adapters, set the .Bd -literal -offset indent hw.mps.enable_ssu .Ed .Pp -tunable value in +tunable in .Xr loader.conf 5 -to one of the following values: +to one of these values: .Bl -tag -width 6n -offset indent .It 0 Do not send SSU to either HDDs or SSDs. .It 1 -Send SSU to SSDs, but not to HDDs; this is the default value. +Send SSU to SSDs, but not to HDDs. +This is the default value. .It 2 Send SSU to HDDs, but not to SSDs. .It 3 Send SSU to both HDDs and SSDs. .El .Pp -To control the feature for a specific adapter, set the following tunable -value in +To control the feature for a specific adapter, set this tunable value in .Xr loader.conf 5 : .Bd -literal -offset indent dev.mps.X.enable_ssu .Ed .Pp -where X is the adapter number. -The same set of values are valid as for all adapters. +The same set of values are valid when setting this tunable for all adapters. +.Pp +SATA disks that take several seconds to spin up and fail the SATA Identify +command might not be discovered by the driver. +This problem can sometimes be overcome by increasing the value of the spinup +wait time in +.Xr loader.conf 5 +with the +.Bd -literal -offset indent +hw.mps.spinup_wait_time=NNNN +.Ed +.Pp +tunable. +NNNN represents the number of seconds to wait for SATA devices to spin up when +the device fails the initial SATA Identify command. +.Pp +Spinup wait times can be set for specific adapters in +.Xr loader.conf 5 : +with the +.Bd -literal -offset indent +dev.mps.X.spinup_wait_time=NNNN +.Ed +.Pp +tunable. +NNNN is the number of seconds to wait for SATA devices to spin up when they fail +the initial SATA Identify command. .Sh DEBUGGING To enable debugging prints from the .Nm @@ -209,25 +283,30 @@ driver, set the hw.mps.X.debug_level .Ed .Pp -variable, where X is the adapter number, either in +tunable, either in .Xr loader.conf 5 -or via +or by using .Xr sysctl 8 . -The following bits have the described effects: -.Bl -tag -width 6n -offset indent -.It 0x01 -Enable informational prints. -.It 0x02 -Enable tracing prints. -.It 0x04 -Enable prints for driver faults. -.It 0x08 -Enable prints for controller events. -.El +These bits have the described effects: +.Bd -literal -offset indent +0x0001 Enable informational prints (set by default). +0x0002 Enable prints for driver faults (set by default). +0x0004 Enable prints for controller events. +0x0008 Enable prints for controller logging. +0x0010 Enable prints for tracing recovery operations. +0x0020 Enable prints for parameter errors and programming bugs. +0x0040 Enable prints for system initialization operations. +0x0080 Enable prints for more detailed information. +0x0100 Enable prints for user-generated commands (IOCTL). +0x0200 Enable prints for device mapping. +0x0400 Enable prints for tracing through driver functions. +.Ed .Sh SEE ALSO +.Xr cam 4 , .Xr cd 4 , .Xr ch 4 , .Xr da 4 , +.Xr mpr 4 , .Xr mpt 4 , .Xr pci 4 , .Xr sa 4 , @@ -238,24 +317,17 @@ Enable prints for controller events. .Sh HISTORY The .Nm -driver first appeared in -.Fx 9.0 . +driver first appeared in FreeBSD 9.3. .Sh AUTHORS -.An -nosplit The .Nm driver was originally written by +.An -nosplit .An Scott Long Aq Mt scottl@FreeBSD.org . -It has been improved and tested by LSI Logic Corporation. +It has been improved and tested by LSI Corporation, +Avago Technologies (formally LSI), and Broadcom Ltd. (formally Avago). +.Pp This man page was written by -.An Ken Merry Aq Mt ken@FreeBSD.org . -.Sh BUGS -This driver has a couple of known shortcomings: -.Bl -bullet -compact -.It -No userland utility available (e.g., -.Xr mptutil 8 ) . -.It -The driver probes devices sequentially. -If your system has a large number of devices, the probe will take a while. -.El +.An Ken Merry Aq Mt ken@FreeBSD.org +with additional input from +.An Stephen McConnell Aq Mt slm@FreeBSD.org . Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mpr/mpr.c Tue Jul 12 19:34:10 2016 (r302673) @@ -1373,6 +1373,7 @@ mpr_get_tunables(struct mpr_softc *sc) sc->disable_msix = 0; sc->disable_msi = 0; sc->max_chains = MPR_CHAIN_FRAMES; + sc->max_io_pages = MPR_MAXIO_PAGES; sc->enable_ssu = MPR_SSU_ENABLE_SSD_DISABLE_HDD; sc->spinup_wait_time = DEFAULT_SPINUP_WAIT; @@ -1383,6 +1384,7 @@ mpr_get_tunables(struct mpr_softc *sc) TUNABLE_INT_FETCH("hw.mpr.disable_msix", &sc->disable_msix); TUNABLE_INT_FETCH("hw.mpr.disable_msi", &sc->disable_msi); TUNABLE_INT_FETCH("hw.mpr.max_chains", &sc->max_chains); + TUNABLE_INT_FETCH("hw.mpr.max_io_pages", &sc->max_io_pages); TUNABLE_INT_FETCH("hw.mpr.enable_ssu", &sc->enable_ssu); TUNABLE_INT_FETCH("hw.mpr.spinup_wait_time", &sc->spinup_wait_time); @@ -1403,6 +1405,10 @@ mpr_get_tunables(struct mpr_softc *sc) device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->max_chains); + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_io_pages", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_io_pages); + bzero(sc->exclude_ids, sizeof(sc->exclude_ids)); snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.exclude_ids", device_get_unit(sc->mpr_dev)); @@ -1488,6 +1494,11 @@ mpr_setup_sysctl(struct mpr_softc *sc) &sc->max_chains, 0,"maximum chain frames that will be allocated"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_io_pages", CTLFLAG_RD, + &sc->max_io_pages, 0,"maximum pages to allow per I/O (if <1 use " + "IOCFacts)"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "enable_ssu", CTLFLAG_RW, &sc->enable_ssu, 0, "enable SSU to SATA SSD/HDD at shutdown"); Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mpr/mpr_sas.c Tue Jul 12 19:34:10 2016 (r302673) @@ -971,6 +971,8 @@ mprsas_action(struct cam_sim *sim, union case XPT_PATH_INQ: { struct ccb_pathinq *cpi = &ccb->cpi; + struct mpr_softc *sc = sassc->sc; + uint8_t sges_per_frame; cpi->version_num = 1; cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; @@ -999,13 +1001,23 @@ mprsas_action(struct cam_sim *sim, union cpi->transport_version = 0; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_SPC; -#if __FreeBSD_version >= 800001 + /* - * XXXSLM-probably need to base this number on max SGL's and - * page size. - */ - cpi->maxio = 256 * 1024; -#endif + * Max IO Size is Page Size * the following: + * ((SGEs per frame - 1 for chain element) * + * Max Chain Depth) + 1 for no chain needed in last frame + * + * If user suggests a Max IO size to use, use the smaller of the + * user's value and the calculated value as long as the user's + * value is larger than 0. The user's value is in pages. + */ + sges_per_frame = (sc->chain_frame_size / + sizeof(MPI2_IEEE_SGE_SIMPLE64)) - 1; + cpi->maxio = (sges_per_frame * sc->facts->MaxChainDepth) + 1; + cpi->maxio *= PAGE_SIZE; + if ((sc->max_io_pages > 0) && (sc->max_io_pages * PAGE_SIZE < + cpi->maxio)) + cpi->maxio = sc->max_io_pages * PAGE_SIZE; mprsas_set_ccbstatus(ccb, CAM_REQ_CMP); break; } Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mpr/mprvar.h Tue Jul 12 19:34:10 2016 (r302673) @@ -33,7 +33,7 @@ #ifndef _MPRVAR_H #define _MPRVAR_H -#define MPR_DRIVER_VERSION "13.00.00.00-fbsd" +#define MPR_DRIVER_VERSION "13.01.00.00-fbsd" #define MPR_DB_MAX_WAIT 2500 @@ -41,6 +41,7 @@ #define MPR_EVT_REPLY_FRAMES 32 #define MPR_REPLY_FRAMES MPR_REQ_FRAMES #define MPR_CHAIN_FRAMES 2048 +#define MPR_MAXIO_PAGES (-1) #define MPR_SENSE_LEN SSD_FULL_SIZE #define MPR_MSI_COUNT 1 #define MPR_SGE64_SIZE 12 @@ -264,6 +265,7 @@ struct mpr_softc { int io_cmds_highwater; int chain_free; int max_chains; + int max_io_pages; int chain_free_lowwater; uint32_t chain_frame_size; uint16_t chain_seg_size; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mps/mps.c Tue Jul 12 19:34:10 2016 (r302673) @@ -1350,6 +1350,7 @@ mps_get_tunables(struct mps_softc *sc) sc->disable_msix = 0; sc->disable_msi = 0; sc->max_chains = MPS_CHAIN_FRAMES; + sc->max_io_pages = MPS_MAXIO_PAGES; sc->enable_ssu = MPS_SSU_ENABLE_SSD_DISABLE_HDD; sc->spinup_wait_time = DEFAULT_SPINUP_WAIT; @@ -1360,6 +1361,7 @@ mps_get_tunables(struct mps_softc *sc) TUNABLE_INT_FETCH("hw.mps.disable_msix", &sc->disable_msix); TUNABLE_INT_FETCH("hw.mps.disable_msi", &sc->disable_msi); TUNABLE_INT_FETCH("hw.mps.max_chains", &sc->max_chains); + TUNABLE_INT_FETCH("hw.mps.max_io_pages", &sc->max_io_pages); TUNABLE_INT_FETCH("hw.mps.enable_ssu", &sc->enable_ssu); TUNABLE_INT_FETCH("hw.mps.spinup_wait_time", &sc->spinup_wait_time); @@ -1380,6 +1382,10 @@ mps_get_tunables(struct mps_softc *sc) device_get_unit(sc->mps_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->max_chains); + snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.max_io_pages", + device_get_unit(sc->mps_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->max_io_pages); + bzero(sc->exclude_ids, sizeof(sc->exclude_ids)); snprintf(tmpstr, sizeof(tmpstr), "dev.mps.%d.exclude_ids", device_get_unit(sc->mps_dev)); @@ -1465,6 +1471,11 @@ mps_setup_sysctl(struct mps_softc *sc) &sc->max_chains, 0,"maximum chain frames that will be allocated"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "max_io_pages", CTLFLAG_RD, + &sc->max_io_pages, 0,"maximum pages to allow per I/O (if <1 use " + "IOCFacts)"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "enable_ssu", CTLFLAG_RW, &sc->enable_ssu, 0, "enable SSU to SATA SSD/HDD at shutdown"); Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mps/mps_sas.c Tue Jul 12 19:34:10 2016 (r302673) @@ -928,6 +928,8 @@ mpssas_action(struct cam_sim *sim, union case XPT_PATH_INQ: { struct ccb_pathinq *cpi = &ccb->cpi; + struct mps_softc *sc = sassc->sc; + uint8_t sges_per_frame; cpi->version_num = 1; cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; @@ -951,12 +953,23 @@ mpssas_action(struct cam_sim *sim, union cpi->transport_version = 0; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_SPC; -#if __FreeBSD_version >= 800001 + /* - * XXX KDM where does this number come from? - */ - cpi->maxio = 256 * 1024; -#endif + * Max IO Size is Page Size * the following: + * ((SGEs per frame - 1 for chain element) * + * Max Chain Depth) + 1 for no chain needed in last frame + * + * If user suggests a Max IO size to use, use the smaller of the + * user's value and the calculated value as long as the user's + * value is larger than 0. The user's value is in pages. + */ + sges_per_frame = ((sc->facts->IOCRequestFrameSize * 4) / + sizeof(MPI2_SGE_SIMPLE64)) - 1; + cpi->maxio = (sges_per_frame * sc->facts->MaxChainDepth) + 1; + cpi->maxio *= PAGE_SIZE; + if ((sc->max_io_pages > 0) && (sc->max_io_pages * PAGE_SIZE < + cpi->maxio)) + cpi->maxio = sc->max_io_pages * PAGE_SIZE; mpssas_set_ccbstatus(ccb, CAM_REQ_CMP); break; } Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Tue Jul 12 19:27:05 2016 (r302672) +++ head/sys/dev/mps/mpsvar.h Tue Jul 12 19:34:10 2016 (r302673) @@ -33,7 +33,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "21.00.00.00-fbsd" +#define MPS_DRIVER_VERSION "21.01.00.00-fbsd" #define MPS_DB_MAX_WAIT 2500 @@ -41,6 +41,7 @@ #define MPS_EVT_REPLY_FRAMES 32 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES #define MPS_CHAIN_FRAMES 2048 +#define MPS_MAXIO_PAGES (-1) #define MPS_SENSE_LEN SSD_FULL_SIZE #define MPS_MSI_COUNT 1 #define MPS_SGE64_SIZE 12 @@ -280,6 +281,7 @@ struct mps_softc { int io_cmds_highwater; int chain_free; int max_chains; + int max_io_pages; int chain_free_lowwater; u_int enable_ssu; int spinup_wait_time; From owner-svn-src-head@freebsd.org Tue Jul 12 19:47:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82137B938BD; Tue, 12 Jul 2016 19:47:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 502341731; Tue, 12 Jul 2016 19:47:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CJl1gT080068; Tue, 12 Jul 2016 19:47:01 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CJl1ZM080066; Tue, 12 Jul 2016 19:47:01 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607121947.u6CJl1ZM080066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 12 Jul 2016 19:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302674 - in head/usr.sbin: etcupdate mergemaster X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 19:47:02 -0000 Author: bdrewery Date: Tue Jul 12 19:47:01 2016 New Revision: 302674 URL: https://svnweb.freebsd.org/changeset/base/302674 Log: META_MODE: Don't require filemon(4) for mergemaster(8)/etcupdate(8) New .meta files will be created without filemon data, but any future build that wants filemon data will force a rebuild due to the missing data due to use of bmake's .MAKE.MODE=missing-filemon=yes feature. Reported by: np Sponsored by: EMC / Isilon Storage Division MFC after: 3 days Modified: head/usr.sbin/etcupdate/etcupdate.sh head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/etcupdate/etcupdate.sh ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.sh Tue Jul 12 19:34:10 2016 (r302673) +++ head/usr.sbin/etcupdate/etcupdate.sh Tue Jul 12 19:47:01 2016 (r302674) @@ -184,7 +184,7 @@ build_tree() { local destdir dir file make - make="make $MAKE_OPTIONS" + make="make $MAKE_OPTIONS -DNO_FILEMON" log "Building tree at $1 with $make" mkdir -p $1/usr/obj >&3 2>&1 Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Tue Jul 12 19:34:10 2016 (r302673) +++ head/usr.sbin/mergemaster/mergemaster.sh Tue Jul 12 19:47:01 2016 (r302674) @@ -486,7 +486,7 @@ fi SOURCEDIR=$(realpath "$SOURCEDIR") # Setup make to use system files from SOURCEDIR -MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk" +MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk -DNO_FILEMON" # Check DESTDIR against the mergemaster mtree database to see what # files the user changed from the reference files. From owner-svn-src-head@freebsd.org Tue Jul 12 21:52:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60A74B93397; Tue, 12 Jul 2016 21:52:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 179DF1B3C; Tue, 12 Jul 2016 21:52:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLqQEU028483; Tue, 12 Jul 2016 21:52:26 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLqQMM028482; Tue, 12 Jul 2016 21:52:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122152.u6CLqQMM028482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302677 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:52:27 -0000 Author: cem Date: Tue Jul 12 21:52:26 2016 New Revision: 302677 URL: https://svnweb.freebsd.org/changeset/base/302677 Log: ioat(4): Print some more useful information about the ring from ddb "show ioat" Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:49:08 2016 (r302676) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:52:26 2016 (r302677) @@ -2203,7 +2203,7 @@ DB_SHOW_COMMAND(ioat, db_show_ioat) if (!have_addr) goto usage; idx = (unsigned)addr; - if (addr >= ioat_channel_index) + if (idx >= ioat_channel_index) goto usage; sc = ioat_channel[idx]; @@ -2251,6 +2251,35 @@ DB_SHOW_COMMAND(ioat, db_show_ioat) db_printf(" last_seen: 0x%lx\n", sc->last_seen); db_printf(" ring: %p\n", sc->ring); + db_printf(" ring[%u] (tail):\n", sc->tail % + (1 << sc->ring_size_order)); + db_printf(" id: %u\n", ioat_get_ring_entry(sc, sc->tail)->id); + db_printf(" addr: 0x%lx\n", + ioat_get_ring_entry(sc, sc->tail)->hw_desc_bus_addr); + db_printf(" next: 0x%lx\n", + ioat_get_ring_entry(sc, sc->tail)->u.generic->next); + + db_printf(" ring[%u] (head - 1):\n", (sc->head - 1) % + (1 << sc->ring_size_order)); + db_printf(" id: %u\n", ioat_get_ring_entry(sc, sc->head - 1)->id); + db_printf(" addr: 0x%lx\n", + ioat_get_ring_entry(sc, sc->head - 1)->hw_desc_bus_addr); + db_printf(" next: 0x%lx\n", + ioat_get_ring_entry(sc, sc->head - 1)->u.generic->next); + + db_printf(" ring[%u] (head):\n", (sc->head) % + (1 << sc->ring_size_order)); + db_printf(" id: %u\n", ioat_get_ring_entry(sc, sc->head)->id); + db_printf(" addr: 0x%lx\n", + ioat_get_ring_entry(sc, sc->head)->hw_desc_bus_addr); + db_printf(" next: 0x%lx\n", + ioat_get_ring_entry(sc, sc->head)->u.generic->next); + + for (idx = 0; idx < (1 << sc->ring_size_order); idx++) + if ((*sc->comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK) + == ioat_get_ring_entry(sc, idx)->hw_desc_bus_addr) + db_printf(" ring[%u] == hardware tail\n", idx); + db_printf(" cleanup_lock: "); db_show_lock(&sc->cleanup_lock); From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C98D0B93463; Tue, 12 Jul 2016 21:56:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C1AE1D66; Tue, 12 Jul 2016 21:56:35 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLuYAx028690; Tue, 12 Jul 2016 21:56:34 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLuYsP028689; Tue, 12 Jul 2016 21:56:34 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLuYsP028689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302678 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:35 -0000 Author: cem Date: Tue Jul 12 21:56:34 2016 New Revision: 302678 URL: https://svnweb.freebsd.org/changeset/base/302678 Log: ioat(4): Don't shrink ring if active Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:52:26 2016 (r302677) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:34 2016 (r302678) @@ -1682,7 +1682,8 @@ ioat_shrink_timer_callback(void *arg) } order = ioat->ring_size_order; - if (ioat->is_resize_pending || order == IOAT_MIN_ORDER) { + if (ioat->is_completion_pending || ioat->is_resize_pending || + order == IOAT_MIN_ORDER) { mtx_unlock(&ioat->submit_lock); goto out; } @@ -1696,8 +1697,10 @@ ioat_shrink_timer_callback(void *arg) KASSERT(ioat->ring_size_order == order, ("resize_pending protects order")); - if (newring != NULL) + if (newring != NULL && !ioat->is_completion_pending) ring_shrink(ioat, order, newring); + else if (newring != NULL) + ioat_free_ring(ioat, (1 << (order - 1)), newring); ioat->is_resize_pending = FALSE; mtx_unlock(&ioat->submit_lock); From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3153AB934B3; Tue, 12 Jul 2016 21:56:48 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F3631EC2; Tue, 12 Jul 2016 21:56:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLulWp028741; Tue, 12 Jul 2016 21:56:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLul1B028739; Tue, 12 Jul 2016 21:56:47 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLul1B028739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302679 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:48 -0000 Author: cem Date: Tue Jul 12 21:56:46 2016 New Revision: 302679 URL: https://svnweb.freebsd.org/changeset/base/302679 Log: ioat(4): Submitters pick up a shovel if queue is too full Before attempting to grow the ring. Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:34 2016 (r302678) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:46 2016 (r302679) @@ -462,6 +462,7 @@ ioat3_attach(device_t device) mtx_unlock(&ioat->submit_lock); ioat->is_resize_pending = FALSE; + ioat->is_submitter_processing = FALSE; ioat->is_completion_pending = FALSE; ioat->is_reset_pending = FALSE; ioat->is_channel_running = FALSE; @@ -1365,10 +1366,12 @@ ioat_reserve_space(struct ioat_softc *io { struct ioat_descriptor **new_ring; uint32_t order; + boolean_t dug; int error; mtx_assert(&ioat->submit_lock, MA_OWNED); error = 0; + dug = FALSE; if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) { error = EINVAL; @@ -1383,6 +1386,22 @@ ioat_reserve_space(struct ioat_softc *io if (ioat_get_ring_space(ioat) >= num_descs) goto out; + if (!dug && !ioat->is_submitter_processing && + (1 << ioat->ring_size_order) > num_descs) { + ioat->is_submitter_processing = TRUE; + mtx_unlock(&ioat->submit_lock); + + ioat_process_events(ioat); + + mtx_lock(&ioat->submit_lock); + dug = TRUE; + KASSERT(ioat->is_submitter_processing == TRUE, + ("is_submitter_processing")); + ioat->is_submitter_processing = FALSE; + wakeup(&ioat->tail); + continue; + } + order = ioat->ring_size_order; if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) { if ((mflags & M_WAITOK) != 0) { @@ -2054,6 +2073,9 @@ ioat_setup_sysctl(device_t device) SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_resize_pending", CTLFLAG_RD, &ioat->is_resize_pending, 0, "resize pending"); + SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_submitter_processing", + CTLFLAG_RD, &ioat->is_submitter_processing, 0, + "submitter processing"); SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_completion_pending", CTLFLAG_RD, &ioat->is_completion_pending, 0, "completion pending"); SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_reset_pending", CTLFLAG_RD, @@ -2241,6 +2263,8 @@ DB_SHOW_COMMAND(ioat, db_show_ioat) db_printf(" quiescing: %d\n", (int)sc->quiescing); db_printf(" destroying: %d\n", (int)sc->destroying); db_printf(" is_resize_pending: %d\n", (int)sc->is_resize_pending); + db_printf(" is_submitter_processing: %d\n", + (int)sc->is_submitter_processing); db_printf(" is_completion_pending: %d\n", (int)sc->is_completion_pending); db_printf(" is_reset_pending: %d\n", (int)sc->is_reset_pending); db_printf(" is_channel_running: %d\n", (int)sc->is_channel_running); Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Tue Jul 12 21:56:34 2016 (r302678) +++ head/sys/dev/ioat/ioat_internal.h Tue Jul 12 21:56:46 2016 (r302679) @@ -486,6 +486,7 @@ struct ioat_softc { boolean_t quiescing; boolean_t destroying; + boolean_t is_submitter_processing; boolean_t is_resize_pending; boolean_t is_completion_pending; /* submit_lock */ boolean_t is_reset_pending; From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25452B934F2; Tue, 12 Jul 2016 21:56:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC52C1F79; Tue, 12 Jul 2016 21:56:53 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLuqgH028834; Tue, 12 Jul 2016 21:56:52 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLuqp2028833; Tue, 12 Jul 2016 21:56:52 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLuqp2028833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302681 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:54 -0000 Author: cem Date: Tue Jul 12 21:56:52 2016 New Revision: 302681 URL: https://svnweb.freebsd.org/changeset/base/302681 Log: ioat(4): Remove force_hw_error sysctl; it does not work reliably Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:49 2016 (r302680) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:52 2016 (r302681) @@ -1975,38 +1975,6 @@ out: } static int -sysctl_handle_error(SYSCTL_HANDLER_ARGS) -{ - struct ioat_descriptor *desc; - struct ioat_softc *ioat; - int error, arg; - - ioat = arg1; - - arg = 0; - error = SYSCTL_OUT(req, &arg, sizeof(arg)); - if (error != 0 || req->newptr == NULL) - return (error); - - error = SYSCTL_IN(req, &arg, sizeof(arg)); - if (error != 0) - return (error); - - if (arg != 0) { - ioat_acquire(&ioat->dmaengine); - desc = ioat_op_generic(ioat, IOAT_OP_COPY, 1, - 0xffff000000000000ull, 0xffff000000000000ull, NULL, NULL, - 0); - if (desc == NULL) - error = ENOMEM; - else - ioat_submit_single(ioat); - ioat_release(&ioat->dmaengine); - } - return (error); -} - -static int sysctl_handle_reset(SYSCTL_HANDLER_ARGS) { struct ioat_softc *ioat; @@ -2107,9 +2075,6 @@ ioat_setup_sysctl(device_t device) SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_reset", CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_reset, "I", "Set to non-zero to reset the hardware"); - SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_error", - CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_error, "I", - "Set to non-zero to inject a recoverable hardware error"); tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "stats", CTLFLAG_RD, NULL, "IOAT channel statistics"); From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15B5EB934DA; Tue, 12 Jul 2016 21:56:51 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E49D11ECA; Tue, 12 Jul 2016 21:56:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLuotn028787; Tue, 12 Jul 2016 21:56:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLunUA028784; Tue, 12 Jul 2016 21:56:49 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLunUA028784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302680 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:51 -0000 Author: cem Date: Tue Jul 12 21:56:49 2016 New Revision: 302680 URL: https://svnweb.freebsd.org/changeset/base/302680 Log: ioat(4): Export HW capabilities to consumers Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat.h head/sys/dev/ioat/ioat_hw.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:46 2016 (r302679) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:49 2016 (r302680) @@ -870,6 +870,15 @@ ioat_get_max_io_size(bus_dmaengine_t dma return (ioat->max_xfer_size); } +uint32_t +ioat_get_capabilities(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->capabilities); +} + int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) { Modified: head/sys/dev/ioat/ioat.h ============================================================================== --- head/sys/dev/ioat/ioat.h Tue Jul 12 21:56:46 2016 (r302679) +++ head/sys/dev/ioat/ioat.h Tue Jul 12 21:56:49 2016 (r302680) @@ -81,6 +81,36 @@ __FBSDID("$FreeBSD$"); #define IOAT_VER_3_2 0x32 #define IOAT_VER_3_3 0x33 +/* + * Hardware capabilities. Different hardware revisions support different + * features. It is often useful to detect specific features than try to infer + * them from hardware version. + * + * Different channels may support different features too; for example, 'PQ' may + * only be supported on the first two channels of some hardware. + */ +#define IOAT_DMACAP_PB (1 << 0) +#define IOAT_DMACAP_CRC (1 << 1) +#define IOAT_DMACAP_MARKER_SKIP (1 << 2) +#define IOAT_DMACAP_OLD_XOR (1 << 3) +#define IOAT_DMACAP_DCA (1 << 4) +#define IOAT_DMACAP_MOVECRC (1 << 5) +#define IOAT_DMACAP_BFILL (1 << 6) +#define IOAT_DMACAP_EXT_APIC (1 << 7) +#define IOAT_DMACAP_XOR (1 << 8) +#define IOAT_DMACAP_PQ (1 << 9) +#define IOAT_DMACAP_DMA_DIF (1 << 10) +#define IOAT_DMACAP_DWBES (1 << 13) +#define IOAT_DMACAP_RAID16SS (1 << 17) +#define IOAT_DMACAP_DMAMC (1 << 18) +#define IOAT_DMACAP_CTOS (1 << 19) + +#define IOAT_DMACAP_STR \ + "\20\24Completion_Timeout_Support\23DMA_with_Multicasting_Support" \ + "\22RAID_Super_descriptors\16Descriptor_Write_Back_Error_Support" \ + "\13DMA_with_DIF\12PQ\11XOR\10Extended_APIC_ID\07Block_Fill\06Move_CRC" \ + "\05DCA\04Old_XOR\03Marker_Skipping\02CRC\01Page_Break" + typedef void *bus_dmaengine_t; struct bus_dmadesc; typedef void (*bus_dmaengine_callback_t)(void *arg, int error); @@ -100,6 +130,7 @@ void ioat_put_dmaengine(bus_dmaengine_t /* Check the DMA engine's HW version */ int ioat_get_hwversion(bus_dmaengine_t dmaengine); size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine); +uint32_t ioat_get_capabilities(bus_dmaengine_t dmaengine); /* * Set interrupt coalescing on a DMA channel. Modified: head/sys/dev/ioat/ioat_hw.h ============================================================================== --- head/sys/dev/ioat/ioat_hw.h Tue Jul 12 21:56:46 2016 (r302679) +++ head/sys/dev/ioat/ioat_hw.h Tue Jul 12 21:56:49 2016 (r302680) @@ -55,27 +55,6 @@ __FBSDID("$FreeBSD$"); #define IOAT_CS_STATUS_OFFSET 0x0E #define IOAT_DMACAPABILITY_OFFSET 0x10 -#define IOAT_DMACAP_PB (1 << 0) -#define IOAT_DMACAP_CRC (1 << 1) -#define IOAT_DMACAP_MARKER_SKIP (1 << 2) -#define IOAT_DMACAP_OLD_XOR (1 << 3) -#define IOAT_DMACAP_DCA (1 << 4) -#define IOAT_DMACAP_MOVECRC (1 << 5) -#define IOAT_DMACAP_BFILL (1 << 6) -#define IOAT_DMACAP_EXT_APIC (1 << 7) -#define IOAT_DMACAP_XOR (1 << 8) -#define IOAT_DMACAP_PQ (1 << 9) -#define IOAT_DMACAP_DMA_DIF (1 << 10) -#define IOAT_DMACAP_DWBES (1 << 13) -#define IOAT_DMACAP_RAID16SS (1 << 17) -#define IOAT_DMACAP_DMAMC (1 << 18) -#define IOAT_DMACAP_CTOS (1 << 19) - -#define IOAT_DMACAP_STR \ - "\20\24Completion_Timeout_Support\23DMA_with_Multicasting_Support" \ - "\22RAID_Super_descriptors\16Descriptor_Write_Back_Error_Support" \ - "\13DMA_with_DIF\12PQ\11XOR\10Extended_APIC_ID\07Block_Fill\06Move_CRC" \ - "\05DCA\04Old_XOR\03Marker_Skipping\02CRC\01Page_Break" /* DMA Channel Registers */ #define IOAT_CHANCTRL_OFFSET 0x80 From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AC57B93510; Tue, 12 Jul 2016 21:56:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34F5B119F; Tue, 12 Jul 2016 21:56:56 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLutin028878; Tue, 12 Jul 2016 21:56:55 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLutcF028877; Tue, 12 Jul 2016 21:56:55 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLutcF028877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302682 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:56 -0000 Author: cem Date: Tue Jul 12 21:56:55 2016 New Revision: 302682 URL: https://svnweb.freebsd.org/changeset/base/302682 Log: ioat_reserve_space: Recheck quiescing flag after dropping submit lock Fix a minor bound check error while here (ring can only hold 1 << MAX_ORDER - 1 entries). Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:52 2016 (r302681) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:55 2016 (r302682) @@ -1382,16 +1382,17 @@ ioat_reserve_space(struct ioat_softc *io error = 0; dug = FALSE; - if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) { + if (num_descs < 1 || num_descs >= (1 << IOAT_MAX_ORDER)) { error = EINVAL; goto out; } - if (ioat->quiescing) { - error = ENXIO; - goto out; - } for (;;) { + if (ioat->quiescing) { + error = ENXIO; + goto out; + } + if (ioat_get_ring_space(ioat) >= num_descs) goto out; @@ -1453,6 +1454,8 @@ ioat_reserve_space(struct ioat_softc *io out: mtx_assert(&ioat->submit_lock, MA_OWNED); + KASSERT(!ioat->quiescing || error == ENXIO, + ("reserved during quiesce")); return (error); } From owner-svn-src-head@freebsd.org Tue Jul 12 21:57:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCE0EB935AE; Tue, 12 Jul 2016 21:57:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63FB21327; Tue, 12 Jul 2016 21:57:01 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLv0Ok028973; Tue, 12 Jul 2016 21:57:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLv08L028972; Tue, 12 Jul 2016 21:57:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122157.u6CLv08L028972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302684 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:57:02 -0000 Author: cem Date: Tue Jul 12 21:57:00 2016 New Revision: 302684 URL: https://svnweb.freebsd.org/changeset/base/302684 Log: ioat(4): Enhance KTR logging for descriptor completions Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:57 2016 (r302683) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:57:00 2016 (r302684) @@ -693,7 +693,8 @@ ioat_process_events(struct ioat_softc *i while (1) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR1(KTR_IOAT, "completing desc %d", ioat->tail); + CTR3(KTR_IOAT, "completing desc %u ok cb %p(%p)", ioat->tail, + dmadesc->callback_fn, dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, 0); @@ -763,7 +764,8 @@ out: while (ioat_get_active(ioat) > 0) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; - CTR1(KTR_IOAT, "completing err desc %d", ioat->tail); + CTR3(KTR_IOAT, "completing desc %u err cb %p(%p)", ioat->tail, + dmadesc->callback_fn, dmadesc->callback_arg); if (dmadesc->callback_fn != NULL) dmadesc->callback_fn(dmadesc->callback_arg, From owner-svn-src-head@freebsd.org Tue Jul 12 21:56:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06FACB93550; Tue, 12 Jul 2016 21:56:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5ECB1275; Tue, 12 Jul 2016 21:56:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLuvut028922; Tue, 12 Jul 2016 21:56:57 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLuvnS028921; Tue, 12 Jul 2016 21:56:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122156.u6CLuvnS028921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302683 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:56:59 -0000 Author: cem Date: Tue Jul 12 21:56:57 2016 New Revision: 302683 URL: https://svnweb.freebsd.org/changeset/base/302683 Log: ioat(4): Assert against ring underflow Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:55 2016 (r302682) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:56:57 2016 (r302683) @@ -702,6 +702,11 @@ ioat_process_events(struct ioat_softc *i ioat->tail++; if (desc->hw_desc_bus_addr == status) break; + + KASSERT(ioat_get_active(ioat) > 0, ("overrunning ring t:%u " + "h:%u st:0x%016lx last_seen:%016lx completed:%u\n", + ioat->tail, ioat->head, comp_update, ioat->last_seen, + completed)); } ioat->last_seen = desc->hw_desc_bus_addr; From owner-svn-src-head@freebsd.org Tue Jul 12 21:57:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D752EB93608; Tue, 12 Jul 2016 21:57:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3C1151B; Tue, 12 Jul 2016 21:57:06 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLv56D029061; Tue, 12 Jul 2016 21:57:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLv57r029060; Tue, 12 Jul 2016 21:57:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122157.u6CLv57r029060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302686 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:57:07 -0000 Author: cem Date: Tue Jul 12 21:57:05 2016 New Revision: 302686 URL: https://svnweb.freebsd.org/changeset/base/302686 Log: ioat(4): Check ring links at grow/shrink in INVARIANTS Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:57:02 2016 (r302685) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:57:05 2016 (r302686) @@ -1591,6 +1591,18 @@ ring_grow(struct ioat_softc *ioat, uint3 hw->next = next->hw_desc_bus_addr; } +#ifdef INVARIANTS + for (i = 0; i < newsize; i++) { + next = newring[(i + 1) & (newsize - 1)]; + hw = newring[i & (newsize - 1)]->u.dma; + + KASSERT(hw->next == next->hw_desc_bus_addr, + ("mismatch at i:%u (oldsize:%u); next=%p nextaddr=0x%lx" + " (tail:%u)", i, oldsize, next, next->hw_desc_bus_addr, + tail)); + } +#endif + free(ioat->ring, M_IOAT); ioat->ring = newring; ioat->ring_size_order = oldorder + 1; @@ -1657,6 +1669,18 @@ ring_shrink(struct ioat_softc *ioat, uin next = newring[(ioat->tail + newsize) & (newsize - 1)]; hw->next = next->hw_desc_bus_addr; +#ifdef INVARIANTS + for (i = 0; i < newsize; i++) { + next = newring[(i + 1) & (newsize - 1)]; + hw = newring[i & (newsize - 1)]->u.dma; + + KASSERT(hw->next == next->hw_desc_bus_addr, + ("mismatch at i:%u (newsize:%u); next=%p nextaddr=0x%lx " + "(tail:%u)", i, newsize, next, next->hw_desc_bus_addr, + ioat->tail)); + } +#endif + free(ioat->ring, M_IOAT); ioat->ring = newring; ioat->ring_size_order = oldorder - 1; From owner-svn-src-head@freebsd.org Tue Jul 12 21:57:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59B03B935D7; Tue, 12 Jul 2016 21:57:04 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2A1113E5; Tue, 12 Jul 2016 21:57:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6CLv3jh029017; Tue, 12 Jul 2016 21:57:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6CLv30h029016; Tue, 12 Jul 2016 21:57:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607122157.u6CLv30h029016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 12 Jul 2016 21:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302685 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 21:57:04 -0000 Author: cem Date: Tue Jul 12 21:57:02 2016 New Revision: 302685 URL: https://svnweb.freebsd.org/changeset/base/302685 Log: ioat(4): Add KTR trace for ioat_reset_hw Modified: head/sys/dev/ioat/ioat.c Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Tue Jul 12 21:57:00 2016 (r302684) +++ head/sys/dev/ioat/ioat.c Tue Jul 12 21:57:02 2016 (r302685) @@ -1778,6 +1778,8 @@ ioat_reset_hw(struct ioat_softc *ioat) unsigned timeout; int error; + CTR0(KTR_IOAT, __func__); + mtx_lock(IOAT_REFLK); while (ioat->resetting && !ioat->destroying) msleep(&ioat->resetting, IOAT_REFLK, 0, "IRH_drain", 0); From owner-svn-src-head@freebsd.org Wed Jul 13 01:33:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75657B933CD; Wed, 13 Jul 2016 01:33:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 537761F70; Wed, 13 Jul 2016 01:33:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 47AB119EF; Wed, 13 Jul 2016 01:33:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id DEDEE1C8A9; Wed, 13 Jul 2016 01:33:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id Ew_FzVrJbXQ2; Wed, 13 Jul 2016 01:33:01 +0000 (UTC) Subject: Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 67D171C8A4 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Warner Losh , andrew@FreeBSD.org, Justin Hibbits References: <201607121857.u6CIvPBG060470@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Tue, 12 Jul 2016 18:32:54 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607121857.u6CIvPBG060470@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2QGa0M3KW7asCqJqELsXmN0hkwiJIoE5D" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 01:33:09 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2QGa0M3KW7asCqJqELsXmN0hkwiJIoE5D Content-Type: multipart/mixed; boundary="pWClTuKmXwdOrR73xXBX8GgkD93SNRbHh" From: Bryan Drewery To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Warner Losh , andrew@FreeBSD.org, Justin Hibbits Message-ID: Subject: Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk References: <201607121857.u6CIvPBG060470@repo.freebsd.org> In-Reply-To: <201607121857.u6CIvPBG060470@repo.freebsd.org> --pWClTuKmXwdOrR73xXBX8GgkD93SNRbHh Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 7/12/2016 11:57 AM, Bryan Drewery wrote: > Author: bdrewery > Date: Tue Jul 12 18:57:25 2016 > New Revision: 302670 > URL: https://svnweb.freebsd.org/changeset/base/302670 >=20 > Log: > Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUARC= H_SUB. > =20 > This also adds missing s/aarch64/arm64 to the sys.mk version and also= This breaks the arm64 build, but I think it's correct. Let's first start with what even is MACHINE_CPUARCH? It's unclear. Looking at r209024 we get: > Introduce MACHINE_CPUARCH. Many different MACHINE_ARCHs will be bu= ilt > from one MACHINE_CPUARCH. This will allow us to move to a more > standard MACHINE_ARCH for mips and arm which exist in many differen= t > endian variants, and for powerpc where both 32 and 64 bit binaries = are > generated from the same sources. If we look at the current targets list we have: > # make targets > Supported TARGET/TARGET_ARCH pairs for world and kernel targets > amd64/amd64 > arm/arm > arm/armeb > arm/armv6 > arm64/aarch64 > i386/i386 > mips/mipsel > mips/mips > mips/mips64el > mips/mips64 > mips/mipsn32 > pc98/i386 > powerpc/powerpc > powerpc/powerpc64 > sparc64/sparc64 So one TARGET can have multiple TARGET_ARCH. So MACHINE_CPUARCH sounds like TARGET. In all but the arm64 cases it seems that MACHINE_CPUARCH =3D=3D MACHINE (meaning TARGET_CPUARCH =3D=3D TARGET). So 1. I think MACHINE_CPUARCH is really just MACHINE. and 2. I think the proper MACHINE_CPUARCH for AArch64 is arm64 since that is what the TARGET is. There's a lot of code using MACHINE_CPUARCH =3D=3D aarc64 instead of MACHINE_CPUARCH =3D=3D arm64 (and directories na= med "aarch64" rather than "arm64", so I am willing to revert or modify this but it seems to be inconsistent. For now I am just reverting this, but I think the commit is worth having in here if we are going to keep MACHINE_CPUARCH as it keeps the replacement list in 1 place. > adds back armv6hf for universe since it was added to the sys.mk versi= on > in r300438. > =20 > MFC after: 3 days > Sponsored by: EMC / Isilon Storage Division > Differential Revision: https://reviews.freebsd.org/D7159 >=20 > Modified: > head/Makefile > head/gnu/usr.bin/binutils/Makefile.inc0 > head/gnu/usr.bin/cc/Makefile.tgt > head/gnu/usr.bin/gdb/Makefile.inc > head/gnu/usr.bin/gdb/libgdb/Makefile > head/share/mk/sys.mk >=20 > Modified: head/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/Makefile Tue Jul 12 17:58:58 2016 (r302669) > +++ head/Makefile Tue Jul 12 18:57:25 2016 (r302670) > @@ -235,7 +235,7 @@ _MAKE+=3D MK_META_MODE=3Dno > _TARGET_ARCH=3D ${TARGET:S/pc98/i386/:S/arm64/aarch64/} > .elif !defined(TARGET) && defined(TARGET_ARCH) && \ > ${TARGET_ARCH} !=3D ${MACHINE_ARCH} > -_TARGET=3D ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/a= rm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} > +_TARGET=3D ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .endif > .if defined(TARGET) && !defined(_TARGET) > _TARGET=3D${TARGET} >=20 > Modified: head/gnu/usr.bin/binutils/Makefile.inc0 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 17:58:58 2016 (r= 302669) > +++ head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 18:57:25 2016 (r= 302670) > @@ -7,7 +7,7 @@ > VERSION=3D "2.17.50 [FreeBSD] 2007-07-03" > =20 > .if defined(TARGET_ARCH) > -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(e= b)?/arm/:C/powerpc64/powerpc/} > +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .else > TARGET_CPUARCH=3D${MACHINE_CPUARCH} > .endif >=20 > Modified: head/gnu/usr.bin/cc/Makefile.tgt > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 17:58:58 2016 (r302669)= > +++ head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 18:57:25 2016 (r302670)= > @@ -4,7 +4,7 @@ > # MACHINE_CPUARCH, but there's no easy way to export make functions...= > =20 > .if defined(TARGET_ARCH) > -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(e= b)?/arm/:C/powerpc64/powerpc/} > +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .else > TARGET_CPUARCH=3D${MACHINE_CPUARCH} > .endif >=20 > Modified: head/gnu/usr.bin/gdb/Makefile.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 17:58:58 2016 (r302669= ) > +++ head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 18:57:25 2016 (r302670= ) > @@ -23,7 +23,7 @@ OBJ_RL=3D ${OBJ_ROOT}/../lib/libreadline/r > # MACHINE_CPUARCH, but there's no easy way to export make functions...= > =20 > .if defined(TARGET_ARCH) > -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(e= b)?/arm/:C/powerpc64/powerpc/} > +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .else > TARGET_CPUARCH=3D${MACHINE_CPUARCH} > .endif >=20 > Modified: head/gnu/usr.bin/gdb/libgdb/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 17:58:58 2016 (r302= 669) > +++ head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 18:57:25 2016 (r302= 670) > @@ -4,7 +4,7 @@ > # MACHINE_CPUARCH, but there's no easy way to export make functions...= > =20 > .if defined(TARGET_ARCH) > -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(e= b)?/arm/:C/powerpc64/powerpc/} > +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .else > TARGET_CPUARCH=3D${MACHINE_CPUARCH} > .endif >=20 > Modified: head/share/mk/sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/sys.mk Tue Jul 12 17:58:58 2016 (r302669) > +++ head/share/mk/sys.mk Tue Jul 12 18:57:25 2016 (r302670) > @@ -13,7 +13,13 @@ unix ?=3D We run FreeBSD, not UNIX. > # and/or endian. This is called MACHINE_CPU in NetBSD, but that's use= d > # for something different in FreeBSD. > # > -MACHINE_CPUARCH=3D${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?= (eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} > +MACHINE_CPUARCH_SUB=3D \ > + C/mips(n32|64)?(el)?/mips/ \ > + C/arm(v6)?(eb|hf)?/arm/ \ > + C/aarch64/arm64/ \ > + C/powerpc64/powerpc/ \ > + C/riscv64/riscv/ > +MACHINE_CPUARCH=3D${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}} > .endif > =20 > =20 >=20 --=20 Regards, Bryan Drewery --pWClTuKmXwdOrR73xXBX8GgkD93SNRbHh-- --2QGa0M3KW7asCqJqELsXmN0hkwiJIoE5D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJXhZpKAAoJEDXXcbtuRpfPoKgH/ipLhWCIJYiHy7JV82WOG4WB fieMICHRJaumxER5Mul2Appv5OqaWrjkFMR89x2DPkoODDdn9iEj8QZTJEGAXakv FWuf4TXkw+gihvMB26ncktp24BLjMc8TDCCW/2+7YmtrhkheLPbFrC0m1h/IUVr3 Glmq2ZOuHHrmbxPviEN4Ym3j7q4SPUGHhAcvzAdNzW5jlRx8okelVosURVwDgZSp 2gYYHgp+hiwKfLZo27uXyBwtK+Z0eUA1feOMlWL2hDppF6RUYYJAPBAellUDujtM 5RWLOkoOyRdeXaWm0a9U6xA4dILM740vtmUmkQNSoAVDQdpiSniyin/nu+2UTes= =S9xR -----END PGP SIGNATURE----- --2QGa0M3KW7asCqJqELsXmN0hkwiJIoE5D-- From owner-svn-src-head@freebsd.org Wed Jul 13 01:35:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7C7CB9347D; Wed, 13 Jul 2016 01:35:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id CA94F1276; Wed, 13 Jul 2016 01:35:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id B73A01B52; Wed, 13 Jul 2016 01:35:09 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 5A6C01C8BC; Wed, 13 Jul 2016 01:35:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id gByG5b_Lt7J4; Wed, 13 Jul 2016 01:35:04 +0000 (UTC) Subject: Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com B14BF1C8B6 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Warner Losh , andrew@FreeBSD.org, Justin Hibbits References: <201607121857.u6CIvPBG060470@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <6c601f75-c5eb-d276-b888-816c499cdcf5@FreeBSD.org> Date: Tue, 12 Jul 2016 18:35:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XgnQavqvOKfrHR0mxKx4gG1ggcodB8ogW" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 01:35:10 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XgnQavqvOKfrHR0mxKx4gG1ggcodB8ogW Content-Type: multipart/mixed; boundary="KJbMESl6wW6OvK3agJW8xrLLtBhfaJSD2" From: Bryan Drewery To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Warner Losh , andrew@FreeBSD.org, Justin Hibbits Message-ID: <6c601f75-c5eb-d276-b888-816c499cdcf5@FreeBSD.org> Subject: Re: svn commit: r302670 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk References: <201607121857.u6CIvPBG060470@repo.freebsd.org> In-Reply-To: --KJbMESl6wW6OvK3agJW8xrLLtBhfaJSD2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 7/12/2016 6:32 PM, Bryan Drewery wrote: > On 7/12/2016 11:57 AM, Bryan Drewery wrote: >> Author: bdrewery >> Date: Tue Jul 12 18:57:25 2016 >> New Revision: 302670 >> URL: https://svnweb.freebsd.org/changeset/base/302670 >> >> Log: >> Create one list of replacements for MACHINE_CPUARCH as MACHINE_CPUAR= CH_SUB. >> =20 >> This also adds missing s/aarch64/arm64 to the sys.mk version and als= o >=20 > This breaks the arm64 build, but I think it's correct. >=20 > Let's first start with what even is MACHINE_CPUARCH? It's unclear. > Looking at r209024 we get: >=20 >> Introduce MACHINE_CPUARCH. Many different MACHINE_ARCHs will be b= uilt >> from one MACHINE_CPUARCH. This will allow us to move to a more >> standard MACHINE_ARCH for mips and arm which exist in many differe= nt >> endian variants, and for powerpc where both 32 and 64 bit binaries= are >> generated from the same sources. >=20 > If we look at the current targets list we have: >=20 >> # make targets >> Supported TARGET/TARGET_ARCH pairs for world and kernel targets >> amd64/amd64 >> arm/arm >> arm/armeb >> arm/armv6 >> arm64/aarch64 >> i386/i386 >> mips/mipsel >> mips/mips >> mips/mips64el >> mips/mips64 >> mips/mipsn32 >> pc98/i386 >> powerpc/powerpc >> powerpc/powerpc64 >> sparc64/sparc64 >=20 > So one TARGET can have multiple TARGET_ARCH. So MACHINE_CPUARCH sounds= > like TARGET. >=20 > In all but the arm64 cases it seems that MACHINE_CPUARCH =3D=3D MACHINE= > (meaning TARGET_CPUARCH =3D=3D TARGET). >=20 > So 1. I think MACHINE_CPUARCH is really just MACHINE. > and 2. I think the proper MACHINE_CPUARCH for AArch64 is arm64 since > that is what the TARGET is. There's a lot of code using MACHINE_CPUARC= H > =3D=3D aarc64 instead of MACHINE_CPUARCH =3D=3D arm64 (and directories = named > "aarch64" rather than "arm64", And I think this is only the case because we had these replacements spread everywhere and C/aarch64/arm64/ was missed in share/mk/sys.mk until I added it here. > so I am willing to revert or modify this > but it seems to be inconsistent. >=20 > For now I am just reverting this, but I think the commit is worth havin= g > in here if we are going to keep MACHINE_CPUARCH as it keeps the > replacement list in 1 place. >=20 >> adds back armv6hf for universe since it was added to the sys.mk vers= ion >> in r300438. >> =20 >> MFC after: 3 days >> Sponsored by: EMC / Isilon Storage Division >> Differential Revision: https://reviews.freebsd.org/D7159 >> >> Modified: >> head/Makefile >> head/gnu/usr.bin/binutils/Makefile.inc0 >> head/gnu/usr.bin/cc/Makefile.tgt >> head/gnu/usr.bin/gdb/Makefile.inc >> head/gnu/usr.bin/gdb/libgdb/Makefile >> head/share/mk/sys.mk >> >> Modified: head/Makefile >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/Makefile Tue Jul 12 17:58:58 2016 (r302669) >> +++ head/Makefile Tue Jul 12 18:57:25 2016 (r302670) >> @@ -235,7 +235,7 @@ _MAKE+=3D MK_META_MODE=3Dno >> _TARGET_ARCH=3D ${TARGET:S/pc98/i386/:S/arm64/aarch64/} >> .elif !defined(TARGET) && defined(TARGET_ARCH) && \ >> ${TARGET_ARCH} !=3D ${MACHINE_ARCH} >> -_TARGET=3D ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/= arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} >> +_TARGET=3D ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .endif >> .if defined(TARGET) && !defined(_TARGET) >> _TARGET=3D${TARGET} >> >> Modified: head/gnu/usr.bin/binutils/Makefile.inc0 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 17:58:58 2016 (= r302669) >> +++ head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 18:57:25 2016 (= r302670) >> @@ -7,7 +7,7 @@ >> VERSION=3D "2.17.50 [FreeBSD] 2007-07-03" >> =20 >> .if defined(TARGET_ARCH) >> -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(= eb)?/arm/:C/powerpc64/powerpc/} >> +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .else >> TARGET_CPUARCH=3D${MACHINE_CPUARCH} >> .endif >> >> Modified: head/gnu/usr.bin/cc/Makefile.tgt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 17:58:58 2016 (r302669= ) >> +++ head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 18:57:25 2016 (r302670= ) >> @@ -4,7 +4,7 @@ >> # MACHINE_CPUARCH, but there's no easy way to export make functions..= =2E >> =20 >> .if defined(TARGET_ARCH) >> -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(= eb)?/arm/:C/powerpc64/powerpc/} >> +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .else >> TARGET_CPUARCH=3D${MACHINE_CPUARCH} >> .endif >> >> Modified: head/gnu/usr.bin/gdb/Makefile.inc >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 17:58:58 2016 (r30266= 9) >> +++ head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 18:57:25 2016 (r30267= 0) >> @@ -23,7 +23,7 @@ OBJ_RL=3D ${OBJ_ROOT}/../lib/libreadline/r >> # MACHINE_CPUARCH, but there's no easy way to export make functions..= =2E >> =20 >> .if defined(TARGET_ARCH) >> -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(= eb)?/arm/:C/powerpc64/powerpc/} >> +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .else >> TARGET_CPUARCH=3D${MACHINE_CPUARCH} >> .endif >> >> Modified: head/gnu/usr.bin/gdb/libgdb/Makefile >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 17:58:58 2016 (r30= 2669) >> +++ head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 18:57:25 2016 (r30= 2670) >> @@ -4,7 +4,7 @@ >> # MACHINE_CPUARCH, but there's no easy way to export make functions..= =2E >> =20 >> .if defined(TARGET_ARCH) >> -TARGET_CPUARCH=3D${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(= eb)?/arm/:C/powerpc64/powerpc/} >> +TARGET_CPUARCH=3D${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .else >> TARGET_CPUARCH=3D${MACHINE_CPUARCH} >> .endif >> >> Modified: head/share/mk/sys.mk >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/share/mk/sys.mk Tue Jul 12 17:58:58 2016 (r302669) >> +++ head/share/mk/sys.mk Tue Jul 12 18:57:25 2016 (r302670) >> @@ -13,7 +13,13 @@ unix ?=3D We run FreeBSD, not UNIX. >> # and/or endian. This is called MACHINE_CPU in NetBSD, but that's us= ed >> # for something different in FreeBSD. >> # >> -MACHINE_CPUARCH=3D${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)= ?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} >> +MACHINE_CPUARCH_SUB=3D \ >> + C/mips(n32|64)?(el)?/mips/ \ >> + C/arm(v6)?(eb|hf)?/arm/ \ >> + C/aarch64/arm64/ \ >> + C/powerpc64/powerpc/ \ >> + C/riscv64/riscv/ >> +MACHINE_CPUARCH=3D${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}} >> .endif >> =20 >> =20 >> >=20 >=20 --=20 Regards, Bryan Drewery --KJbMESl6wW6OvK3agJW8xrLLtBhfaJSD2-- --XgnQavqvOKfrHR0mxKx4gG1ggcodB8ogW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJXhZrIAAoJEDXXcbtuRpfPsxQH/1h/g8uUqpxMchuHJjxmQvG5 KfxJHRKZP4z4myyGIumDck0nt+aO1dsYeGaeRNuNYcGvWZ7ZM2ed2Bbk3rrNT0DQ XlGuueFmSby73p5AE2fxmyGKDrIh2LyZS/V9Z8uKXstBJWUFpY0xqkqKOJI4haVg zWiHVE40RKkFZDj3yrySMPt3wzSey13CeN6opbom1G3YBpyAzcJ+HWVoYDQ5EmYl brEVin/JxyCwHRQ1zkQ2w4RIKj2iyq/0WoSrzgUwanbpJlEfmN7W6PvkEdPz6ifR SSROSRgFT2542WWRB07T74eKWkvboneBwnWaRo/CvgxHcH0PJv85VdIn6MO1XOs= =i65F -----END PGP SIGNATURE----- --XgnQavqvOKfrHR0mxKx4gG1ggcodB8ogW-- From owner-svn-src-head@freebsd.org Wed Jul 13 01:35:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C12E0B93502; Wed, 13 Jul 2016 01:35:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84E021437; Wed, 13 Jul 2016 01:35:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D1ZsvT010389; Wed, 13 Jul 2016 01:35:54 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D1Zs9X010382; Wed, 13 Jul 2016 01:35:54 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607130135.u6D1Zs9X010382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 13 Jul 2016 01:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302690 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 01:35:55 -0000 Author: bdrewery Date: Wed Jul 13 01:35:53 2016 New Revision: 302690 URL: https://svnweb.freebsd.org/changeset/base/302690 Log: Revert r302670 and r302671 for now. MACHINE_CPUARCH smells like MACHINE except for arm64/aarch64 which has it backwards. Modified: head/Makefile head/Makefile.inc1 head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/cc/Makefile.tgt head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/libgdb/Makefile head/share/mk/sys.mk Modified: head/Makefile ============================================================================== --- head/Makefile Tue Jul 12 22:53:11 2016 (r302689) +++ head/Makefile Wed Jul 13 01:35:53 2016 (r302690) @@ -235,7 +235,7 @@ _MAKE+= MK_META_MODE=no _TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 12 22:53:11 2016 (r302689) +++ head/Makefile.inc1 Wed Jul 13 01:35:53 2016 (r302690) @@ -384,8 +384,6 @@ XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP} STRICTTMPPATH= ${BPATH}:${XPATH} TMPPATH= ${STRICTTMPPATH}:${PATH} -TARGET_CPUARCH?= ${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} - # # Avoid running mktemp(1) unless actually needed. # It may not be functional, e.g., due to new ABI Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Tue Jul 12 22:53:11 2016 (r302689) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Wed Jul 13 01:35:53 2016 (r302690) @@ -7,7 +7,7 @@ VERSION= "2.17.50 [FreeBSD] 2007-07-03" .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Tue Jul 12 22:53:11 2016 (r302689) +++ head/gnu/usr.bin/cc/Makefile.tgt Wed Jul 13 01:35:53 2016 (r302690) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Tue Jul 12 22:53:11 2016 (r302689) +++ head/gnu/usr.bin/gdb/Makefile.inc Wed Jul 13 01:35:53 2016 (r302690) @@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/Makefile Tue Jul 12 22:53:11 2016 (r302689) +++ head/gnu/usr.bin/gdb/libgdb/Makefile Wed Jul 13 01:35:53 2016 (r302690) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Tue Jul 12 22:53:11 2016 (r302689) +++ head/share/mk/sys.mk Wed Jul 13 01:35:53 2016 (r302690) @@ -13,13 +13,7 @@ unix ?= We run FreeBSD, not UNIX. # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH_SUB= \ - C/mips(n32|64)?(el)?/mips/ \ - C/arm(v6)?(eb|hf)?/arm/ \ - C/aarch64/arm64/ \ - C/powerpc64/powerpc/ \ - C/riscv64/riscv/ -MACHINE_CPUARCH=${MACHINE_ARCH:${MACHINE_CPUARCH_SUB:ts:}} +MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc64/powerpc/:C/riscv64/riscv/} .endif From owner-svn-src-head@freebsd.org Wed Jul 13 02:07:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B12D0B93C7E; Wed, 13 Jul 2016 02:07:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F3AD17CE; Wed, 13 Jul 2016 02:07:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D27acj021949; Wed, 13 Jul 2016 02:07:36 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D27a1o021948; Wed, 13 Jul 2016 02:07:36 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607130207.u6D27a1o021948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Wed, 13 Jul 2016 02:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302691 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 02:07:37 -0000 Author: nwhitehorn Date: Wed Jul 13 02:07:36 2016 New Revision: 302691 URL: https://svnweb.freebsd.org/changeset/base/302691 Log: Reduce the set of things on the disc1 image to those on the bootonly image. Notably, this removes the toolchain from the CD-ROM image (it remains on DVD images) and pushes the CD-ROM image well below the 700 MB mark. MFC after: 10 days Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Wed Jul 13 01:35:53 2016 (r302690) +++ head/release/Makefile Wed Jul 13 02:07:36 2016 (r302691) @@ -171,9 +171,11 @@ disc1: packagesystem # Install system mkdir -p ${.TARGET} cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ - DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ - MK_PROFILE=no MK_SENDMAIL=no MK_TESTS=no MK_LIB32=no \ - MK_DEBUG_FILES=no + DESTDIR=${.OBJDIR}/${.TARGET} MK_AMD=no MK_AT=no \ + MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \ + MK_NCP=no MK_TOOLCHAIN=no MK_PROFILE=no \ + MK_RESCUE=no MK_DICT=no \ + MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no # Copy distfiles mkdir -p ${.TARGET}/usr/freebsd-dist for dist in MANIFEST $$(ls *.txz | grep -vE -- '(base|lib32)-dbg'); \ From owner-svn-src-head@freebsd.org Wed Jul 13 02:20:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68FA9B93ECB; Wed, 13 Jul 2016 02:20:24 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22a.google.com (mail-pf0-x22a.google.com [IPv6:2607:f8b0:400e:c00::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 433E41C99; Wed, 13 Jul 2016 02:20:24 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22a.google.com with SMTP id c2so13257778pfa.2; Tue, 12 Jul 2016 19:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=hSMW3g9ji2VpgmXQA/ez+CXEdfglgiYn2wc8gR3Az80=; b=DX+UIqjQxw2NpOCNpllLRv5XA2tHpCwPFyvb/uzhvNWDQR36ZSbeFpQcATYkjxhYtR xJnW9x3Kf4apPaYgy+tvv3IuadlboyPzgpr5Fu2i97zSUP6I8QJl1VXKSuiz/cVQkqUs NiHSipnEgIIYEoYThPHr7q+2mLiIobQhqSBpuIGD+UyBbb2R1MmDcFSE8YtmEsojEpI/ Nx9qv/zSpRrzAhpE7xpBKQHJiG8lR63WEJmmAZdP4bjqqqnXcP88G/xS9w05DEukVU38 5mzrlDi+KlLiNhKnUz8dvIKF/Iiky0SeOlFAphOWN1RBSgbCRuGpxtdKR+4HX9L7L1s+ aELQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=hSMW3g9ji2VpgmXQA/ez+CXEdfglgiYn2wc8gR3Az80=; b=mWclSmAM42vCK2n9cSs3RSR2ZnNtBrmvq3DbV/KGyPPyvO5WAe2PtxdB5czwmQHAko qHRwoIsMy3i/wE617XDndc7d37YBLzUruO/wmaIh58r2yheJByo4jDgxR6UgA+R/rjyv Uh2teWwVdMixvYkO0ob1LxQb1qvu0p6b2b8ptW1b43yASjIa+yeIphwYcyjpLdeIuZro 8Bkr1IGQQr00kXQiPYW7WtrcP+WhZjW7SKt6OV55rTHjEucRIJsNBFTMDTW3hdNsqIRH aajYvxZ5hk5At921gZmZpwgif/7qc4S3BaVlKtNpOX68UfjXa1dJ5krfqHZZ0sg5Joi3 MqpA== X-Gm-Message-State: ALyK8tJUQR20WCf8z4tRBYSEbnhnegSTkCSs2jrHT3RYPJraBAaprAEnN7j3Aq/biAL5vA== X-Received: by 10.98.14.72 with SMTP id w69mr38991838pfi.119.1468376423291; Tue, 12 Jul 2016 19:20:23 -0700 (PDT) Received: from [192.168.20.9] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id y70sm2040785pff.25.2016.07.12.19.20.22 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jul 2016 19:20:22 -0700 (PDT) Subject: Re: svn commit: r302691 - head/release Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2BD5BCEE-3693-47B4-B88C-779806F0BD1C"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201607130207.u6D27a1o021948@repo.freebsd.org> Date: Tue, 12 Jul 2016 19:20:21 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <0C504A08-DE3E-4AC9-855F-A684E339E500@gmail.com> References: <201607130207.u6D27a1o021948@repo.freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 02:20:24 -0000 --Apple-Mail=_2BD5BCEE-3693-47B4-B88C-779806F0BD1C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 12, 2016, at 19:07, Nathan Whitehorn = wrote: >=20 > Author: nwhitehorn > Date: Wed Jul 13 02:07:36 2016 > New Revision: 302691 > URL: https://svnweb.freebsd.org/changeset/base/302691 >=20 > Log: > Reduce the set of things on the disc1 image to those on the bootonly = image. > Notably, this removes the toolchain from the CD-ROM image (it remains = on DVD > images) and pushes the CD-ROM image well below the 700 MB mark. >=20 > MFC after: 10 days >=20 > Modified: > head/release/Makefile There=E2=80=99s a lot more that could be done to be honest. Here are some other knobs that might help, depending on how people = configure their custom installers. Cheers, -Ngie WITHOUT_ACCT=3D WITHOUT_AMD=3D WITHOUT_APM=3D WITHOUT_AT=3D WITHOUT_ATM=3D WITHOUT_AUTOFS=3D WITHOUT_BHYVE=3D WITHOUT_BOOTPARAMD=3D WITHOUT_BOOTPD=3D WITHOUT_BSNMP=3D WITHOUT_CVS=3D WITHOUT_FINGER=3D WITHOUT_GAMES=3D WITHOUT_GDB=3D WITHOUT_GPIB=3D WITHOUT_HAST=3D WITHOUT_HESOID=3D WITHOUT_HTML=3D WITHOUT_HYPERV=3D WITHOUT_I4B=3D WITHOUT_INETD=3D WITHOUT_IPFILTER=3D WITHOUT_IPFW=3D WITHOUT_IPX=3D WITHOUT_ISCSI=3D WITHOUT_LIB32=3D WITHOUT_LPR=3D WITHOUT_NS_CACHING=3D WITHOUT_PC_SYSINSTALL=3D WITHOUT_PF=3D WITHOUT_QUOTAS=3D WITHOUT_RADIUS_SUPPORT=3D WITHOUT_RBOOTD=3D WITHOUT_RCMDS=3D WITHOUT_ROUTED=3D WITHOUT_SVN=3D WITHOUT_SVNLITE=3D WITHOUT_TALK=3D WITHOUT_TCP_WRAPPERS=3D WITHOUT_TFTP=3D WITHOUT_TIMED=3D WITHOUT_UNBOUND=3D --Apple-Mail=_2BD5BCEE-3693-47B4-B88C-779806F0BD1C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXhaVlAAoJEPWDqSZpMIYVB+0QAL/Udrh6FQalwdd1hGQZVGxb tnNNPwGGDiXbYwXOOUYZD5sNUnKw9tycLba7T0qlq4Sk8df2121avfBWQa1k/f0U Tyfplkjmh+SP2huWqnvHkex62vQ77zbzWEpni0VOf1BkP+YNGpOMK44lt8GDYRoi 6WYdt/udIkOGKZm3fbnXDmXKWHwserz63wafnklrqfYUiqxVhzyH6/0fD0fuA0QC SkmUeW/7L8rXqbba5LbLn3zmw8DlYwkfGalI9xqf/xRbk7tmYojS/FRMMeC+LHiE hh2VFCEIg7bfil6QO+gQXCWhpKv81B8EGJuKU7gyKc5VlD3tkJr3lkmCog/wEiT1 Ksc/+miHkb2I2RWqo8/IKuKQrUP61XOJnD6PjdcMysNgq5j3dfI3v7oex3b+4+w1 7mCwtK2FVdY9wI9ilhNiigwwK/ObIt7SW2j4K+lnbEMmilPtLjs1aUTRx6A3yEFq FF9ZHP6e/3piy9k41uJgW6AuT0LvVUMY/qftMWf+RO8x3tSHegqLNC5Eivbl6XbX taIymIH29FaB38TMIdQkZ7nRBBHpKoenLC27P91jdDXscABhuN3yib8nMN+Z3+pT sRD+1ujJoL7UkxRkME4ak26wrJTxH0As4m+b3rP4bEofaz0F5TbpiVi8dm2OMoBI oaU7TNo4jPXMLxa/6enm =iTZ+ -----END PGP SIGNATURE----- --Apple-Mail=_2BD5BCEE-3693-47B4-B88C-779806F0BD1C-- From owner-svn-src-head@freebsd.org Wed Jul 13 03:14:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96BE1B97908; Wed, 13 Jul 2016 03:14:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71CAC1A02; Wed, 13 Jul 2016 03:14:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D3ETqY048562; Wed, 13 Jul 2016 03:14:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D3ETT6048557; Wed, 13 Jul 2016 03:14:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130314.u6D3ETT6048557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 03:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302692 - in head/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 03:14:30 -0000 Author: sephe Date: Wed Jul 13 03:14:29 2016 New Revision: 302692 URL: https://svnweb.freebsd.org/changeset/base/302692 Log: hyperv/vmbus: Merge hv_connection.c into hv_channel.c MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7004 Deleted: head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_var.h head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Jul 13 02:07:36 2016 (r302691) +++ head/sys/conf/files.amd64 Wed Jul 13 03:14:29 2016 (r302692) @@ -272,7 +272,6 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv -dev/hyperv/vmbus/hv_connection.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 Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Jul 13 02:07:36 2016 (r302691) +++ head/sys/conf/files.i386 Wed Jul 13 03:14:29 2016 (r302692) @@ -248,7 +248,6 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv -dev/hyperv/vmbus/hv_connection.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 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 02:07:36 2016 (r302691) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:14:29 2016 (r302692) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); static void vmbus_channel_set_event(hv_vmbus_channel* channel); static void VmbusProcessChannelEvent(void* channel, int pending); +static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, + const struct hv_vmbus_channel *); /** * @brief Trigger an event notification on the specified channel @@ -207,7 +209,7 @@ hv_vmbus_channel_open( new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; - vmbus_on_channel_open(new_channel); + vmbus_chan_update_evtflagcnt(sc, new_channel); new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); @@ -883,3 +885,95 @@ VmbusProcessChannelEvent(void* context, } while (is_batched_reading && (bytes_to_read != 0)); } } + +static __inline void +vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, + int flag_cnt) +{ + int f; + + for (f = 0; f < flag_cnt; ++f) { + uint32_t rel_id_base; + u_long flags; + int bit; + + if (event_flags[f] == 0) + continue; + + flags = atomic_swap_long(&event_flags[f], 0); + rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + + while ((bit = ffsl(flags)) != 0) { + struct hv_vmbus_channel *channel; + uint32_t rel_id; + + --bit; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << bit); + + rel_id = rel_id_base + bit; + channel = sc->vmbus_chmap[rel_id]; + + /* if channel is closed or closing */ + if (channel == NULL || channel->rxq == NULL) + continue; + + if (channel->batched_reading) + hv_ring_buffer_read_begin(&channel->inbound); + taskqueue_enqueue(channel->rxq, &channel->channel_task); + } + } +} + +void +vmbus_event_proc(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + /* + * On Host with Win8 or above, the event page can be checked directly + * to get the id of the channel that has the pending interrupt. + */ + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + vmbus_event_flags_proc(sc, eventf->evt_flags, + VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); +} + +void +vmbus_event_proc_compat(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { + vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags, + VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); + } +} + +static void +vmbus_chan_update_evtflagcnt(struct vmbus_softc *sc, + const struct hv_vmbus_channel *chan) +{ + volatile int *flag_cnt_ptr; + int flag_cnt; + + flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); + + for (;;) { + int old_flag_cnt; + + old_flag_cnt = *flag_cnt_ptr; + if (old_flag_cnt >= flag_cnt) + break; + if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { + if (bootverbose) { + device_printf(sc->vmbus_dev, + "channel%u update cpu%d flag_cnt to %d\n", + chan->offer_msg.child_rel_id, + chan->target_cpu, flag_cnt); + } + break; + } + } +} Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Jul 13 02:07:36 2016 (r302691) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Jul 13 03:14:29 2016 (r302692) @@ -131,7 +131,6 @@ struct trapframe; struct vmbus_message; struct vmbus_msghc; -void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); void vmbus_handle_intr(struct trapframe *); Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Wed Jul 13 02:07:36 2016 (r302691) +++ head/sys/modules/hyperv/vmbus/Makefile Wed Jul 13 03:14:29 2016 (r302692) @@ -6,7 +6,6 @@ KMOD= hv_vmbus SRCS= hv_channel.c \ hv_channel_mgmt.c \ - hv_connection.c \ hv_ring_buffer.c \ hyperv.c \ hyperv_busdma.c \ From owner-svn-src-head@freebsd.org Wed Jul 13 03:24:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2091BB97A6B; Wed, 13 Jul 2016 03:24:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C81071E36; Wed, 13 Jul 2016 03:24:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D3OUVT052261; Wed, 13 Jul 2016 03:24:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D3OTUd052256; Wed, 13 Jul 2016 03:24:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130324.u6D3OTUd052256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 03:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302693 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 03:24:31 -0000 Author: sephe Date: Wed Jul 13 03:24:29 2016 New Revision: 302693 URL: https://svnweb.freebsd.org/changeset/base/302693 Log: hyperv/vmbus: Make channel id a field of hv_vmbus_channel. This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7014 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:14:29 2016 (r302692) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:24:29 2016 (r302693) @@ -538,6 +538,7 @@ typedef struct hv_vmbus_channel { struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; hv_vmbus_channel_offer_channel offer_msg; + uint32_t ch_id; /* channel id */ /* * These are based on the offer_msg.monitor_id. * Save it here for easy access. Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:14:29 2016 (r302692) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:24:29 2016 (r302693) @@ -2953,7 +2953,7 @@ hn_channel_attach(struct hn_softc *sc, s chan->hv_chan_rxr = rxr; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", - idx, chan->offer_msg.child_rel_id); + idx, chan->ch_id); } if (idx < sc->hn_tx_ring_inuse) { @@ -2967,7 +2967,7 @@ hn_channel_attach(struct hn_softc *sc, s txr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", - idx, chan->offer_msg.child_rel_id); + idx, chan->ch_id); } } Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:14:29 2016 (r302692) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:24:29 2016 (r302693) @@ -62,7 +62,7 @@ static void vmbus_channel_set_event(hv_vmbus_channel *channel) { struct vmbus_softc *sc = channel->vmbus_sc; - uint32_t chanid = channel->offer_msg.child_rel_id; + uint32_t chanid = channel->ch_id; atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); @@ -107,10 +107,10 @@ vmbus_channel_sysctl_create(hv_vmbus_cha if (primary_ch == NULL) { dev = channel->device->device; - ch_id = channel->offer_msg.child_rel_id; + ch_id = channel->ch_id; } else { dev = primary_ch->device->device; - ch_id = primary_ch->offer_msg.child_rel_id; + ch_id = primary_ch->ch_id; sub_ch_id = channel->offer_msg.offer.sub_channel_index; } ctx = &channel->ch_sysctl_ctx; @@ -136,7 +136,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "chanid", CTLFLAG_RD, - &channel->offer_msg.child_rel_id, 0, "channel id"); + &channel->ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); @@ -190,7 +190,7 @@ hv_vmbus_channel_open( if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, "invalid udata len %u for chan%u\n", - user_data_len, new_channel->offer_msg.child_rel_id); + user_data_len, new_channel->ch_id); return EINVAL; } @@ -261,14 +261,14 @@ hv_vmbus_channel_open( if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); return ENXIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; - req->chm_chanid = new_channel->offer_msg.child_rel_id; - req->chm_openid = new_channel->offer_msg.child_rel_id; + req->chm_chanid = new_channel->ch_id; + req->chm_openid = new_channel->ch_id; req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; req->chm_vcpuid = new_channel->target_vcpu; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; @@ -279,7 +279,7 @@ hv_vmbus_channel_open( if (ret != 0) { device_printf(sc->vmbus_dev, "chopen(chan%u) msg hypercall exec failed: %d\n", - new_channel->offer_msg.child_rel_id, ret); + new_channel->ch_id, ret); vmbus_msghc_put(sc, mh); return ret; } @@ -294,11 +294,11 @@ hv_vmbus_channel_open( new_channel->state = HV_CHANNEL_OPENED_STATE; if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); } } else { device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); ret = ENXIO; } return (ret); @@ -369,13 +369,13 @@ hv_vmbus_channel_establish_gpadl(struct if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpadl->chan%u\n", - channel->offer_msg.child_rel_id); + channel->ch_id); return EIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; - req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_chanid = channel->ch_id; req->chm_gpadl = gpadl; req->chm_range_len = range_len; req->chm_range_cnt = 1; @@ -388,7 +388,7 @@ hv_vmbus_channel_establish_gpadl(struct if (error) { device_printf(sc->vmbus_dev, "gpadl->chan%u msg hypercall exec failed: %d\n", - channel->offer_msg.child_rel_id, error); + channel->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -424,12 +424,12 @@ hv_vmbus_channel_establish_gpadl(struct if (status != 0) { device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", channel->offer_msg.child_rel_id, status); + "status %u\n", channel->ch_id, status); return EIO; } else { if (bootverbose) { device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", channel->offer_msg.child_rel_id); + "succeeded\n", channel->ch_id); } } return 0; @@ -450,20 +450,20 @@ hv_vmbus_channel_teardown_gpdal(struct h if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpa x->chan%u\n", - chan->offer_msg.child_rel_id); + chan->ch_id); return EBUSY; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; - req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_chanid = chan->ch_id; req->chm_gpadl = gpadl; error = vmbus_msghc_exec(sc, mh); if (error) { device_printf(sc->vmbus_dev, "gpa x->chan%u msg hypercall exec failed: %d\n", - chan->offer_msg.child_rel_id, error); + chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -502,13 +502,13 @@ hv_vmbus_channel_close_internal(hv_vmbus if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chclose(chan%u)\n", - channel->offer_msg.child_rel_id); + channel->ch_id); return; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; - req->chm_chanid = channel->offer_msg.child_rel_id; + req->chm_chanid = channel->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -516,11 +516,11 @@ hv_vmbus_channel_close_internal(hv_vmbus if (error) { device_printf(sc->vmbus_dev, "chclose(chan%u) msg hypercall exec failed: %d\n", - channel->offer_msg.child_rel_id, error); + channel->ch_id, error); return; } else if (bootverbose) { device_printf(sc->vmbus_dev, "close chan%u\n", - channel->offer_msg.child_rel_id); + channel->ch_id); } /* Tear down the gpadl for the channel's ring buffer */ @@ -957,7 +957,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu volatile int *flag_cnt_ptr; int flag_cnt; - flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); for (;;) { @@ -970,7 +970,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu if (bootverbose) { device_printf(sc->vmbus_dev, "channel%u update cpu%d flag_cnt to %d\n", - chan->offer_msg.child_rel_id, + chan->ch_id, chan->target_cpu, flag_cnt); } break; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:14:29 2016 (r302692) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:24:29 2016 (r302693) @@ -112,7 +112,7 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_channel* channel; uint32_t relid; - relid = new_channel->offer_msg.child_rel_id; + relid = new_channel->ch_id; /* * Make sure this is a new offer */ @@ -148,10 +148,10 @@ vmbus_channel_process_offer(hv_vmbus_cha logstr[0] = '\0'; if (channel != NULL) { snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->offer_msg.child_rel_id); + channel->ch_id); } device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", - new_channel->offer_msg.child_rel_id, + new_channel->ch_id, new_channel->offer_msg.offer.sub_channel_index, logstr); } @@ -200,7 +200,7 @@ vmbus_channel_process_offer(hv_vmbus_cha } printf("VMBUS: duplicated primary channel%u\n", - new_channel->offer_msg.child_rel_id); + new_channel->ch_id); hv_vmbus_free_vmbus_channel(new_channel); return; } @@ -241,7 +241,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", - chan->offer_msg.child_rel_id, + chan->ch_id, chan->target_cpu, chan->target_vcpu); } } @@ -292,6 +292,7 @@ vmbus_channel_on_offer_internal(struct v /* Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(sc); + new_channel->ch_id = offer->child_rel_id; /* * By default we setup state to enable batched @@ -379,13 +380,13 @@ vmbus_chan_detach_task(void *xchan, int if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chfree(chan%u)\n", - chan->offer_msg.child_rel_id); + chan->ch_id); goto remove; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; - req->chm_chanid = chan->offer_msg.child_rel_id; + req->chm_chanid = chan->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -393,12 +394,12 @@ vmbus_chan_detach_task(void *xchan, int if (error) { device_printf(sc->vmbus_dev, "chfree(chan%u) failed: %d", - chan->offer_msg.child_rel_id, error); + chan->ch_id, error); /* NOTE: Move on! */ } else { if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u freed\n", - chan->offer_msg.child_rel_id); + chan->ch_id); } } remove: From owner-svn-src-head@freebsd.org Wed Jul 13 03:35:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DF7DB97D74; Wed, 13 Jul 2016 03:35:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA599159D; Wed, 13 Jul 2016 03:35:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D3ZNgl056092; Wed, 13 Jul 2016 03:35:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D3ZMqE056088; Wed, 13 Jul 2016 03:35:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130335.u6D3ZMqE056088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 03:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302694 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 03:35:24 -0000 Author: sephe Date: Wed Jul 13 03:35:22 2016 New Revision: 302694 URL: https://svnweb.freebsd.org/changeset/base/302694 Log: hyperv/vmbus: Make subchan index a field of hv_vmbus_channel. This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7015 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:24:29 2016 (r302693) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:35:22 2016 (r302694) @@ -629,6 +629,7 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; + uint32_t ch_subidx; /* subchan index */ struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:24:29 2016 (r302693) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:35:22 2016 (r302694) @@ -518,9 +518,9 @@ netvsc_attach(device_t dev) */ pri_chan = device_ctx->channel; KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel")); - KASSERT(pri_chan->offer_msg.offer.sub_channel_index == 0, + KASSERT(pri_chan->ch_subidx == 0, ("primary channel subidx %u", - pri_chan->offer_msg.offer.sub_channel_index)); + pri_chan->ch_subidx)); hn_channel_attach(sc, pri_chan); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -809,8 +809,8 @@ hn_tx_done(struct hv_vmbus_channel *chan txr = txd->txr; KASSERT(txr->hn_chan == chan, ("channel mismatch, on channel%u, should be channel%u", - chan->offer_msg.offer.sub_channel_index, - txr->hn_chan->offer_msg.offer.sub_channel_index)); + chan->ch_subidx, + txr->hn_chan->ch_subidx)); txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); @@ -2940,7 +2940,7 @@ hn_channel_attach(struct hn_softc *sc, s struct hn_rx_ring *rxr; int idx; - idx = chan->offer_msg.offer.sub_channel_index; + idx = chan->ch_subidx; KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", @@ -2981,9 +2981,9 @@ hn_subchan_attach(struct hn_softc *sc, s KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), ("subchannel callback on primary channel")); - KASSERT(chan->offer_msg.offer.sub_channel_index > 0, + KASSERT(chan->ch_subidx > 0, ("invalid channel subidx %u", - chan->offer_msg.offer.sub_channel_index)); + chan->ch_subidx)); hn_channel_attach(sc, chan); } Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:24:29 2016 (r302693) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:35:22 2016 (r302694) @@ -111,7 +111,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha } else { dev = primary_ch->device->device; ch_id = primary_ch->ch_id; - sub_ch_id = channel->offer_msg.offer.sub_channel_index; + sub_ch_id = channel->ch_subidx; } ctx = &channel->ch_sysctl_ctx; sysctl_ctx_init(ctx); Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:24:29 2016 (r302693) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:35:22 2016 (r302694) @@ -152,14 +152,14 @@ vmbus_channel_process_offer(hv_vmbus_cha } device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", new_channel->ch_id, - new_channel->offer_msg.offer.sub_channel_index, logstr); + new_channel->ch_subidx, logstr); } if (channel != NULL) { /* * Check if this is a sub channel. */ - if (new_channel->offer_msg.offer.sub_channel_index != 0) { + if (new_channel->ch_subidx != 0) { /* * It is a sub channel offer, process it. */ @@ -293,6 +293,7 @@ vmbus_channel_on_offer_internal(struct v /* Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(sc); new_channel->ch_id = offer->child_rel_id; + new_channel->ch_subidx = offer->offer.sub_channel_index; /* * By default we setup state to enable batched From owner-svn-src-head@freebsd.org Wed Jul 13 04:31:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 553F6B93AD7; Wed, 13 Jul 2016 04:31:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 035A61BE8; Wed, 13 Jul 2016 04:31:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D4V9dT074895; Wed, 13 Jul 2016 04:31:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D4V8Pf074892; Wed, 13 Jul 2016 04:31:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130431.u6D4V8Pf074892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 04:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302695 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 04:31:10 -0000 Author: sephe Date: Wed Jul 13 04:31:08 2016 New Revision: 302695 URL: https://svnweb.freebsd.org/changeset/base/302695 Log: hyperv/vmbus: Add flags field into hv_vmbus_channel for MNF indication This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7019 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:35:22 2016 (r302694) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:31:08 2016 (r302695) @@ -538,6 +538,7 @@ typedef struct hv_vmbus_channel { struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; hv_vmbus_channel_offer_channel offer_msg; + uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ /* * These are based on the offer_msg.monitor_id. @@ -636,6 +637,8 @@ typedef struct hv_vmbus_channel { #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) +#define VMBUS_CHAN_FLAG_HASMNF 0x0001 + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) { Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:35:22 2016 (r302694) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 04:31:08 2016 (r302695) @@ -67,7 +67,7 @@ vmbus_channel_set_event(hv_vmbus_channel atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - if (channel->offer_msg.monitor_allocated) { + if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { hv_vmbus_monitor_page *monitor_page; monitor_page = sc->vmbus_mnf2; @@ -86,7 +86,7 @@ vmbus_channel_sysctl_monalloc(SYSCTL_HAN struct hv_vmbus_channel *chan = arg1; int alloc = 0; - if (chan->offer_msg.monitor_allocated) + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) alloc = 1; return sysctl_handle_int(oidp, &alloc, 0, req); } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:35:22 2016 (r302694) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:31:08 2016 (r302695) @@ -294,6 +294,8 @@ vmbus_channel_on_offer_internal(struct v new_channel = hv_vmbus_allocate_channel(sc); new_channel->ch_id = offer->child_rel_id; new_channel->ch_subidx = offer->offer.sub_channel_index; + if (offer->monitor_allocated) + new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; /* * By default we setup state to enable batched From owner-svn-src-head@freebsd.org Wed Jul 13 04:39:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC058B93BB3; Wed, 13 Jul 2016 04:39:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83A311EA8; Wed, 13 Jul 2016 04:39:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D4dGMZ078426; Wed, 13 Jul 2016 04:39:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D4dGaW078422; Wed, 13 Jul 2016 04:39:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130439.u6D4dGaW078422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 04:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302696 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 04:39:17 -0000 Author: sephe Date: Wed Jul 13 04:39:16 2016 New Revision: 302696 URL: https://svnweb.freebsd.org/changeset/base/302696 Log: hyperv/vmbus: Add type/instance guid fields into hv_vmbus_channel This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7020 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:39:16 2016 (r302696) @@ -632,6 +632,9 @@ typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ + struct hv_guid ch_guid_type; + struct hv_guid ch_guid_inst; + struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:39:16 2016 (r302696) @@ -127,11 +127,9 @@ vmbus_channel_process_offer(hv_vmbus_cha } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->offer_msg.offer.interface_type, - &new_channel->offer_msg.offer.interface_type, + if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, sizeof(hv_guid)) == 0 && - memcmp(&channel->offer_msg.offer.interface_instance, - &new_channel->offer_msg.offer.interface_instance, + memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, sizeof(hv_guid)) == 0) break; } @@ -212,9 +210,7 @@ vmbus_channel_process_offer(hv_vmbus_cha * (We need to set the device field before calling * hv_vmbus_child_device_add()) */ - new_channel->device = hv_vmbus_child_device_create( - new_channel->offer_msg.offer.interface_type, - new_channel->offer_msg.offer.interface_instance, new_channel); + new_channel->device = hv_vmbus_child_device_create(new_channel); /* * Add the new device to the bus. This will kick off device-driver @@ -296,6 +292,8 @@ vmbus_channel_on_offer_internal(struct v new_channel->ch_subidx = offer->offer.sub_channel_index; if (offer->monitor_allocated) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + new_channel->ch_guid_type = offer->offer.interface_type; + new_channel->ch_guid_inst = offer->offer.interface_instance; /* * By default we setup state to enable batched Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 04:39:16 2016 (r302696) @@ -213,9 +213,7 @@ void hv_vmbus_release_unattached_chann struct vmbus_softc *); struct hv_device* hv_vmbus_child_device_create( - hv_guid device_type, - hv_guid device_instance, - hv_vmbus_channel *channel); + struct hv_vmbus_channel *channel); void hv_vmbus_child_device_register(struct vmbus_softc *, struct hv_device *child_dev); Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 04:31:08 2016 (r302695) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 04:39:16 2016 (r302696) @@ -1017,8 +1017,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } struct hv_device * -hv_vmbus_child_device_create(hv_guid type, hv_guid instance, - hv_vmbus_channel *channel) +hv_vmbus_child_device_create(struct hv_vmbus_channel *channel) { hv_device *child_dev; @@ -1028,8 +1027,8 @@ hv_vmbus_child_device_create(hv_guid typ child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); child_dev->channel = channel; - memcpy(&child_dev->class_id, &type, sizeof(hv_guid)); - memcpy(&child_dev->device_id, &instance, sizeof(hv_guid)); + child_dev->class_id = channel->ch_guid_type; + child_dev->device_id = channel->ch_guid_inst; return (child_dev); } From owner-svn-src-head@freebsd.org Wed Jul 13 04:51:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 229DAB93E79; Wed, 13 Jul 2016 04:51:39 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E46FC1512; Wed, 13 Jul 2016 04:51:38 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D4pcD2082947; Wed, 13 Jul 2016 04:51:38 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D4pbmS082945; Wed, 13 Jul 2016 04:51:37 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130451.u6D4pbmS082945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 04:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302697 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 04:51:39 -0000 Author: sephe Date: Wed Jul 13 04:51:37 2016 New Revision: 302697 URL: https://svnweb.freebsd.org/changeset/base/302697 Log: hyperv/vmbus: Remove the embedded offer message from hv_vmbus_channel MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7021 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:39:16 2016 (r302696) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 04:51:37 2016 (r302697) @@ -537,7 +537,6 @@ typedef struct hv_vmbus_channel { struct hv_device* device; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; - hv_vmbus_channel_offer_channel offer_msg; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ /* Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:39:16 2016 (r302696) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 04:51:37 2016 (r302697) @@ -321,8 +321,6 @@ vmbus_channel_on_offer_internal(struct v new_channel->ch_sigevt->hc_connid = offer->connection_id; } - memcpy(&new_channel->offer_msg, offer, - sizeof(hv_vmbus_channel_offer_channel)); new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; From owner-svn-src-head@freebsd.org Wed Jul 13 05:01:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 974C2B970A6; Wed, 13 Jul 2016 05:01:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71B641AEE; Wed, 13 Jul 2016 05:01:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D51DEd089329; Wed, 13 Jul 2016 05:01:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D51Cis089320; Wed, 13 Jul 2016 05:01:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130501.u6D51Cis089320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302698 - in head/sys: dev/hyperv/netvsc dev/hyperv/storvsc dev/hyperv/utilities dev/hyperv/vmbus modules/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:01:14 -0000 Author: sephe Date: Wed Jul 13 05:01:12 2016 New Revision: 302698 URL: https://svnweb.freebsd.org/changeset/base/302698 Log: hyperv/vmbus: Add vmbus method for GUID base device probing. Reduce the exposure of hv_device. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7024 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_if.m head/sys/modules/hyperv/utilities/Makefile Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 05:01:12 2016 (r302698) @@ -411,18 +411,12 @@ static const hv_guid g_net_vsc_device_ty static int netvsc_probe(device_t dev) { - const char *p; - - p = vmbus_get_type(dev); - if (!memcmp(p, &g_net_vsc_device_type.data, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, + &g_net_vsc_device_type) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); - if (bootverbose) - printf("Netvsc probe... DONE \n"); - - return (BUS_PROBE_DEFAULT); + return BUS_PROBE_DEFAULT; } - - return (ENXIO); + return ENXIO; } /* Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 13 05:01:12 2016 (r302698) @@ -2167,13 +2167,11 @@ storvsc_free_request(struct storvsc_soft static enum hv_storage_type storvsc_get_storage_type(device_t dev) { - const char *p = vmbus_get_type(dev); + device_t parent = device_get_parent(dev); - if (!memcmp(p, &gBlkVscDeviceType, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(parent, dev, &gBlkVscDeviceType) == 0) return DRIVER_BLKVSC; - } else if (!memcmp(p, &gStorVscDeviceType, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(parent, dev, &gStorVscDeviceType) == 0) return DRIVER_STORVSC; - } - return (DRIVER_UNKNOWN); + return DRIVER_UNKNOWN; } - Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 13 05:01:12 2016 (r302698) @@ -36,9 +36,10 @@ #include #include "hv_util.h" +#include "vmbus_if.h" /* Heartbeat Service */ -static hv_guid service_guid = { .data = +static const hv_guid service_guid = { .data = {0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }; @@ -93,16 +94,13 @@ hv_heartbeat_cb(void *context) static int hv_heartbeat_probe(device_t dev) { - const char *p = vmbus_get_type(dev); - if (resource_disabled("hvheartbeat", 0)) return ENXIO; - if (!memcmp(p, &service_guid, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { device_set_desc(dev, "Hyper-V Heartbeat Service"); return BUS_PROBE_DEFAULT; } - return ENXIO; } Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 13 05:01:12 2016 (r302698) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include "hv_util.h" #include "unicode.h" #include "hv_kvp.h" +#include "vmbus_if.h" /* hv_kvp defines */ #define BUFFERSIZE sizeof(struct hv_kvp_msg) @@ -89,7 +90,7 @@ static int hv_kvp_log = 0; log(LOG_INFO, "hv_kvp: " __VA_ARGS__); \ } while (0) -static hv_guid service_guid = { .data = +static const hv_guid service_guid = { .data = {0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6} }; @@ -865,16 +866,13 @@ hv_kvp_dev_daemon_poll(struct cdev *dev, static int hv_kvp_probe(device_t dev) { - const char *p = vmbus_get_type(dev); - if (resource_disabled("hvkvp", 0)) return ENXIO; - if (!memcmp(p, &service_guid, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { device_set_desc(dev, "Hyper-V KVP Service"); return BUS_PROBE_DEFAULT; } - return ENXIO; } Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 05:01:12 2016 (r302698) @@ -41,8 +41,9 @@ #include #include "hv_util.h" +#include "vmbus_if.h" -static hv_guid service_guid = { .data = +static const hv_guid service_guid = { .data = {0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, 0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB} }; @@ -115,16 +116,13 @@ hv_shutdown_cb(void *context) static int hv_shutdown_probe(device_t dev) { - const char *p = vmbus_get_type(dev); - if (resource_disabled("hvshutdown", 0)) return ENXIO; - if (!memcmp(p, &service_guid, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { device_set_desc(dev, "Hyper-V Shutdown Service"); return BUS_PROBE_DEFAULT; } - return ENXIO; } Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 05:01:12 2016 (r302698) @@ -41,6 +41,7 @@ #include #include "hv_util.h" +#include "vmbus_if.h" #define HV_WLTIMEDELTA 116444736000000000L /* in 100ns unit */ #define HV_ICTIMESYNCFLAG_PROBE 0 @@ -54,7 +55,7 @@ typedef struct { } time_sync_data; /* Time Synch Service */ -static hv_guid service_guid = {.data = +static const hv_guid service_guid = {.data = {0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }; @@ -170,16 +171,13 @@ hv_timesync_cb(void *context) static int hv_timesync_probe(device_t dev) { - const char *p = vmbus_get_type(dev); - if (resource_disabled("hvtimesync", 0)) return ENXIO; - if (!memcmp(p, &service_guid, sizeof(hv_guid))) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { device_set_desc(dev, "Hyper-V Time Synch Service"); return BUS_PROBE_DEFAULT; } - return ENXIO; } Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:01:12 2016 (r302698) @@ -1090,6 +1090,16 @@ vmbus_get_version_method(device_t bus, d } static int +vmbus_probe_guid_method(device_t bus, device_t dev, const struct hv_guid *guid) +{ + struct hv_device *hv_dev = device_get_ivars(dev); + + if (memcmp(&hv_dev->class_id, guid, sizeof(struct hv_guid)) == 0) + return 0; + return ENXIO; +} + +static int vmbus_probe(device_t dev) { char *id[] = { "VMBUS", NULL }; @@ -1306,6 +1316,7 @@ static device_method_t vmbus_methods[] = /* Vmbus interface */ DEVMETHOD(vmbus_get_version, vmbus_get_version_method), + DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), DEVMETHOD_END }; Modified: head/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_if.m Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/dev/hyperv/vmbus/vmbus_if.m Wed Jul 13 05:01:12 2016 (r302698) @@ -31,7 +31,17 @@ INTERFACE vmbus; +HEADER { + struct hv_guid; +}; + METHOD uint32_t get_version { device_t bus; device_t dev; }; + +METHOD int probe_guid { + device_t bus; + device_t dev; + const struct hv_guid *guid; +}; Modified: head/sys/modules/hyperv/utilities/Makefile ============================================================================== --- head/sys/modules/hyperv/utilities/Makefile Wed Jul 13 04:51:37 2016 (r302697) +++ head/sys/modules/hyperv/utilities/Makefile Wed Jul 13 05:01:12 2016 (r302698) @@ -4,7 +4,7 @@ KMOD= hv_utils SRCS= hv_util.c hv_kvp.c hv_timesync.c hv_shutdown.c hv_heartbeat.c -SRCS+= bus_if.h device_if.h +SRCS+= bus_if.h device_if.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/include \ -I${.CURDIR}/../../../dev/hyperv/vmbus From owner-svn-src-head@freebsd.org Wed Jul 13 05:11:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 560C5B97344; Wed, 13 Jul 2016 05:11:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27DFF11F5; Wed, 13 Jul 2016 05:11:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5Bjqu092369; Wed, 13 Jul 2016 05:11:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5Bj29092368; Wed, 13 Jul 2016 05:11:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130511.u6D5Bj29092368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302699 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:11:46 -0000 Author: sephe Date: Wed Jul 13 05:11:45 2016 New Revision: 302699 URL: https://svnweb.freebsd.org/changeset/base/302699 Log: hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7025 Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:01:12 2016 (r302698) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:11:45 2016 (r302699) @@ -983,20 +983,6 @@ vmbus_read_ivar(device_t dev, device_t c } static int -vmbus_write_ivar(device_t dev, device_t child, int index, uintptr_t value) -{ - switch (index) { - case HV_VMBUS_IVAR_TYPE: - case HV_VMBUS_IVAR_INSTANCE: - case HV_VMBUS_IVAR_DEVCTX: - case HV_VMBUS_IVAR_NODE: - /* read-only */ - return (EINVAL); - } - return (ENOENT); -} - -static int vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen) { struct hv_device *dev_ctx = device_get_ivars(child); @@ -1311,7 +1297,6 @@ static device_method_t vmbus_methods[] = DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, vmbus_read_ivar), - DEVMETHOD(bus_write_ivar, vmbus_write_ivar), DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), /* Vmbus interface */ From owner-svn-src-head@freebsd.org Wed Jul 13 05:19:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45B71B97426; Wed, 13 Jul 2016 05:19:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09E9414C6; Wed, 13 Jul 2016 05:19:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5JklJ093251; Wed, 13 Jul 2016 05:19:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5JkO8093249; Wed, 13 Jul 2016 05:19:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130519.u6D5JkO8093249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302700 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:19:47 -0000 Author: sephe Date: Wed Jul 13 05:19:45 2016 New Revision: 302700 URL: https://svnweb.freebsd.org/changeset/base/302700 Log: hyperv/vmbus: Add channel ivar accessor. This makes life easier during the transition period to nuke the hv_device. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7026 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 05:11:45 2016 (r302699) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 05:19:45 2016 (r302700) @@ -403,14 +403,18 @@ enum { HV_VMBUS_IVAR_TYPE, HV_VMBUS_IVAR_INSTANCE, HV_VMBUS_IVAR_NODE, - HV_VMBUS_IVAR_DEVCTX + HV_VMBUS_IVAR_DEVCTX, + HV_VMBUS_IVAR_CHAN, }; #define HV_VMBUS_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(vmbus, var, HV_VMBUS, ivar, type) +struct hv_vmbus_channel; + HV_VMBUS_ACCESSOR(type, TYPE, const char *) HV_VMBUS_ACCESSOR(devctx, DEVCTX, struct hv_device *) +HV_VMBUS_ACCESSOR(channel, CHAN, struct hv_vmbus_channel *) /* Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:11:45 2016 (r302699) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:19:45 2016 (r302700) @@ -978,6 +978,10 @@ vmbus_read_ivar(device_t dev, device_t c case HV_VMBUS_IVAR_NODE: *result = (uintptr_t)child_dev_ctx->device; return (0); + + case HV_VMBUS_IVAR_CHAN: + *result = (uintptr_t)child_dev_ctx->channel; + return (0); } return (ENOENT); } From owner-svn-src-head@freebsd.org Wed Jul 13 05:28:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32C9AB9770B; Wed, 13 Jul 2016 05:28:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F21381B4E; Wed, 13 Jul 2016 05:28:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5S8mW097156; Wed, 13 Jul 2016 05:28:08 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5S8ju097155; Wed, 13 Jul 2016 05:28:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130528.u6D5S8ju097155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302701 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:28:09 -0000 Author: sephe Date: Wed Jul 13 05:28:07 2016 New Revision: 302701 URL: https://svnweb.freebsd.org/changeset/base/302701 Log: hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device This paves way to nuke the hv_device, which is actually an unncessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7027 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 13 05:19:45 2016 (r302700) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 13 05:28:07 2016 (r302701) @@ -125,7 +125,7 @@ struct hv_storvsc_request { }; struct storvsc_softc { - struct hv_device *hs_dev; + struct hv_vmbus_channel *hs_chan; LIST_HEAD(, hv_storvsc_request) hs_free_list; struct mtx hs_lock; struct storvsc_driver_props *hs_drv_props; @@ -139,6 +139,7 @@ struct storvsc_softc { struct sema hs_drain_sema; struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; + device_t hs_dev; }; @@ -264,11 +265,11 @@ static int create_storvsc_request(union static void storvsc_free_request(struct storvsc_softc *sc, struct hv_storvsc_request *reqp); static enum hv_storage_type storvsc_get_storage_type(device_t dev); static void hv_storvsc_rescan_target(struct storvsc_softc *sc); -static void hv_storvsc_on_channel_callback(void *context); +static void hv_storvsc_on_channel_callback(void *xchan); static void hv_storvsc_on_iocompletion( struct storvsc_softc *sc, struct vstor_packet *vstor_packet, struct hv_storvsc_request *request); -static int hv_storvsc_connect_vsp(struct hv_device *device); +static int hv_storvsc_connect_vsp(struct storvsc_softc *); static void storvsc_io_done(struct hv_storvsc_request *reqp); static void storvsc_copy_sgl_to_bounce_buf(struct sglist *bounce_sgl, bus_dma_segment_t *orig_sgl, @@ -297,72 +298,16 @@ DRIVER_MODULE(storvsc, vmbus, storvsc_dr MODULE_VERSION(storvsc, 1); MODULE_DEPEND(storvsc, vmbus, 1, 1, 1); - -/** - * The host is capable of sending messages to us that are - * completely unsolicited. So, we need to address the race - * condition where we may be in the process of unloading the - * driver when the host may send us an unsolicited message. - * We address this issue by implementing a sequentially - * consistent protocol: - * - * 1. Channel callback is invoked while holding the channel lock - * and an unloading driver will reset the channel callback under - * the protection of this channel lock. - * - * 2. To ensure bounded wait time for unloading a driver, we don't - * permit outgoing traffic once the device is marked as being - * destroyed. - * - * 3. Once the device is marked as being destroyed, we only - * permit incoming traffic to properly account for - * packets already sent out. - */ -static inline struct storvsc_softc * -get_stor_device(struct hv_device *device, - boolean_t outbound) -{ - struct storvsc_softc *sc; - - sc = device_get_softc(device->device); - - if (outbound) { - /* - * Here we permit outgoing I/O only - * if the device is not being destroyed. - */ - - if (sc->hs_destroy) { - sc = NULL; - } - } else { - /* - * inbound case; if being destroyed - * only permit to account for - * messages already sent out. - */ - if (sc->hs_destroy && (sc->hs_num_out_reqs == 0)) { - sc = NULL; - } - } - return sc; -} - static void -storvsc_subchan_attach(struct hv_vmbus_channel *new_channel) +storvsc_subchan_attach(struct storvsc_softc *sc, + struct hv_vmbus_channel *new_channel) { - struct hv_device *device; - struct storvsc_softc *sc; struct vmstor_chan_props props; int ret = 0; - device = new_channel->device; - sc = get_stor_device(device, TRUE); - if (sc == NULL) - return; - memset(&props, 0, sizeof(props)); + new_channel->hv_chan_priv1 = sc; vmbus_channel_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, @@ -371,8 +316,6 @@ storvsc_subchan_attach(struct hv_vmbus_c sizeof(struct vmstor_chan_props), hv_storvsc_on_channel_callback, new_channel); - - return; } /** @@ -382,10 +325,9 @@ storvsc_subchan_attach(struct hv_vmbus_c * @param max_chans the max channels supported by vmbus */ static void -storvsc_send_multichannel_request(struct hv_device *dev, int max_chans) +storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_chans) { struct hv_vmbus_channel **subchan; - struct storvsc_softc *sc; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; int request_channels_cnt = 0; @@ -394,13 +336,6 @@ storvsc_send_multichannel_request(struct /* get multichannels count that need to create */ request_channels_cnt = MIN(max_chans, mp_ncpus); - sc = get_stor_device(dev, TRUE); - if (sc == NULL) { - printf("Storvsc_error: get sc failed while send mutilchannel " - "request\n"); - return; - } - request = &sc->hs_init_req; /* request the host to create multi-channel */ @@ -415,7 +350,7 @@ storvsc_send_multichannel_request(struct vstor_packet->u.multi_channels_cnt = request_channels_cnt; ret = hv_vmbus_channel_send_packet( - dev->channel, + sc->hs_chan, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, @@ -439,11 +374,11 @@ storvsc_send_multichannel_request(struct } /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(dev->channel, request_channels_cnt); + subchan = vmbus_get_subchan(sc->hs_chan, request_channels_cnt); /* Attach the sub-channels. */ for (i = 0; i < request_channels_cnt; ++i) - storvsc_subchan_attach(subchan[i]); + storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ vmbus_rel_subchan(subchan, request_channels_cnt); @@ -459,12 +394,11 @@ storvsc_send_multichannel_request(struct * @returns 0 on success, non-zero error on failure */ static int -hv_storvsc_channel_init(struct hv_device *dev) +hv_storvsc_channel_init(struct storvsc_softc *sc) { int ret = 0, i; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - struct storvsc_softc *sc; uint16_t max_chans = 0; boolean_t support_multichannel = FALSE; uint32_t version; @@ -472,10 +406,6 @@ hv_storvsc_channel_init(struct hv_device max_chans = 0; support_multichannel = FALSE; - sc = get_stor_device(dev, TRUE); - if (sc == NULL) - return (ENODEV); - request = &sc->hs_init_req; memset(request, 0, sizeof(struct hv_storvsc_request)); vstor_packet = &request->vstor_packet; @@ -491,7 +421,7 @@ hv_storvsc_channel_init(struct hv_device ret = hv_vmbus_channel_send_packet( - dev->channel, + sc->hs_chan, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, @@ -525,7 +455,7 @@ hv_storvsc_channel_init(struct hv_device vstor_packet->u.version.revision = 0; ret = hv_vmbus_channel_send_packet( - dev->channel, + sc->hs_chan, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, @@ -568,7 +498,7 @@ hv_storvsc_channel_init(struct hv_device vstor_packet->flags = REQUEST_COMPLETION_FLAG; ret = hv_vmbus_channel_send_packet( - dev->channel, + sc->hs_chan, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, @@ -592,8 +522,7 @@ hv_storvsc_channel_init(struct hv_device /* multi-channels feature is supported by WIN8 and above version */ max_chans = vstor_packet->u.chan_props.max_channel_cnt; - version = VMBUS_GET_VERSION(device_get_parent(dev->device), - dev->device); + version = VMBUS_GET_VERSION(device_get_parent(sc->hs_dev), sc->hs_dev); if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && (vstor_packet->u.chan_props.flags & HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { @@ -605,7 +534,7 @@ hv_storvsc_channel_init(struct hv_device vstor_packet->flags = REQUEST_COMPLETION_FLAG; ret = hv_vmbus_channel_send_packet( - dev->channel, + sc->hs_chan, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, @@ -631,7 +560,7 @@ hv_storvsc_channel_init(struct hv_device * request to host. */ if (support_multichannel) - storvsc_send_multichannel_request(dev, max_chans); + storvsc_send_multichannel_request(sc, max_chans); cleanup: sema_destroy(&request->synch_sema); @@ -647,53 +576,45 @@ cleanup: * @returns 0 on success, non-zero error on failure */ static int -hv_storvsc_connect_vsp(struct hv_device *dev) +hv_storvsc_connect_vsp(struct storvsc_softc *sc) { int ret = 0; struct vmstor_chan_props props; - struct storvsc_softc *sc; - sc = device_get_softc(dev->device); - memset(&props, 0, sizeof(struct vmstor_chan_props)); /* * Open the channel */ - vmbus_channel_cpu_rr(dev->channel); + KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); + vmbus_channel_cpu_rr(sc->hs_chan); ret = hv_vmbus_channel_open( - dev->channel, + sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, (void *)&props, sizeof(struct vmstor_chan_props), hv_storvsc_on_channel_callback, - dev->channel); + sc->hs_chan); if (ret != 0) { return ret; } - ret = hv_storvsc_channel_init(dev); + ret = hv_storvsc_channel_init(sc); return (ret); } #if HVS_HOST_RESET static int -hv_storvsc_host_reset(struct hv_device *dev) +hv_storvsc_host_reset(struct storvsc_softc *sc) { int ret = 0; - struct storvsc_softc *sc; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - sc = get_stor_device(dev, TRUE); - if (sc == NULL) { - return ENODEV; - } - request = &sc->hs_reset_req; request->softc = sc; vstor_packet = &request->vstor_packet; @@ -740,20 +661,13 @@ cleanup: * @returns 0 on success, non-zero error on failure */ static int -hv_storvsc_io_request(struct hv_device *device, +hv_storvsc_io_request(struct storvsc_softc *sc, struct hv_storvsc_request *request) { - struct storvsc_softc *sc; struct vstor_packet *vstor_packet = &request->vstor_packet; struct hv_vmbus_channel* outgoing_channel = NULL; int ret = 0; - sc = get_stor_device(device, TRUE); - - if (sc == NULL) { - return ENODEV; - } - vstor_packet->flags |= REQUEST_COMPLETION_FLAG; vstor_packet->u.vm_srb.length = VSTOR_PKT_SIZE; @@ -764,7 +678,7 @@ hv_storvsc_io_request(struct hv_device * vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; - outgoing_channel = vmbus_select_outgoing_channel(device->channel); + outgoing_channel = vmbus_select_outgoing_channel(sc->hs_chan); mtx_unlock(&request->softc->hs_lock); if (request->data_buf.length) { @@ -875,27 +789,17 @@ hv_storvsc_rescan_target(struct storvsc_ } static void -hv_storvsc_on_channel_callback(void *context) +hv_storvsc_on_channel_callback(void *xchan) { int ret = 0; - hv_vmbus_channel *channel = (hv_vmbus_channel *)context; - struct hv_device *device = NULL; - struct storvsc_softc *sc; + hv_vmbus_channel *channel = xchan; + struct storvsc_softc *sc = channel->hv_chan_priv1; uint32_t bytes_recvd; uint64_t request_id; uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)]; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - device = channel->device; - KASSERT(device, ("device is NULL")); - - sc = get_stor_device(device, FALSE); - if (sc == NULL) { - printf("Storvsc_error: get stor device failed.\n"); - return; - } - ret = hv_vmbus_channel_recv_packet( channel, packet, @@ -999,7 +903,6 @@ storvsc_probe(device_t dev) static int storvsc_attach(device_t dev) { - struct hv_device *hv_dev = vmbus_get_devctx(dev); enum hv_storage_type stor_type; struct storvsc_softc *sc; struct cam_devq *devq; @@ -1015,6 +918,8 @@ storvsc_attach(device_t dev) root_mount_token = root_mount_hold("storvsc"); sc = device_get_softc(dev); + sc->hs_chan = vmbus_get_channel(dev); + sc->hs_chan->hv_chan_priv1 = sc; stor_type = storvsc_get_storage_type(dev); @@ -1028,7 +933,7 @@ storvsc_attach(device_t dev) /* fill in device specific properties */ sc->hs_unit = device_get_unit(dev); - sc->hs_dev = hv_dev; + sc->hs_dev = dev; LIST_INIT(&sc->hs_free_list); mtx_init(&sc->hs_lock, "hvslck", NULL, MTX_DEF); @@ -1077,7 +982,7 @@ storvsc_attach(device_t dev) sc->hs_drain_notify = FALSE; sema_init(&sc->hs_drain_sema, 0, "Store Drain Sema"); - ret = hv_storvsc_connect_vsp(hv_dev); + ret = hv_storvsc_connect_vsp(sc); if (ret != 0) { goto cleanup; } @@ -1175,7 +1080,6 @@ storvsc_detach(device_t dev) { struct storvsc_softc *sc = device_get_softc(dev); struct hv_storvsc_request *reqp = NULL; - struct hv_device *hv_device = vmbus_get_devctx(dev); struct hv_sgl_node *sgl_node = NULL; int j = 0; @@ -1197,7 +1101,7 @@ storvsc_detach(device_t dev) * under the protection of the incoming channel lock. */ - hv_vmbus_channel_close(hv_device->channel); + hv_vmbus_channel_close(sc->hs_chan); mtx_lock(&sc->hs_lock); while (!LIST_EMPTY(&sc->hs_free_list)) { @@ -1251,7 +1155,7 @@ storvsc_timeout_test(struct hv_storvsc_r if (wait) { mtx_lock(&reqp->event.mtx); } - ret = hv_storvsc_io_request(sc->hs_dev, reqp); + ret = hv_storvsc_io_request(sc, reqp); if (ret != 0) { if (wait) { mtx_unlock(&reqp->event.mtx); @@ -1362,7 +1266,7 @@ storvsc_poll(struct cam_sim *sim) mtx_assert(&sc->hs_lock, MA_OWNED); mtx_unlock(&sc->hs_lock); - hv_storvsc_on_channel_callback(sc->hs_dev->channel); + hv_storvsc_on_channel_callback(sc->hs_chan); mtx_lock(&sc->hs_lock); } @@ -1447,7 +1351,7 @@ storvsc_action(struct cam_sim *sim, unio case XPT_RESET_BUS: case XPT_RESET_DEV:{ #if HVS_HOST_RESET - if ((res = hv_storvsc_host_reset(sc->hs_dev)) != 0) { + if ((res = hv_storvsc_host_reset(sc)) != 0) { xpt_print(ccb->ccb_h.path, "hv_storvsc_host_reset failed with %d\n", res); ccb->ccb_h.status = CAM_PROVIDE_FAIL; @@ -1520,7 +1424,7 @@ storvsc_action(struct cam_sim *sim, unio } #endif - if ((res = hv_storvsc_io_request(sc->hs_dev, reqp)) != 0) { + if ((res = hv_storvsc_io_request(sc, reqp)) != 0) { xpt_print(ccb->ccb_h.path, "hv_storvsc_io_request failed with %d\n", res); ccb->ccb_h.status = CAM_PROVIDE_FAIL; From owner-svn-src-head@freebsd.org Wed Jul 13 05:35:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21C0CB97967; Wed, 13 Jul 2016 05:35:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED1191F78; Wed, 13 Jul 2016 05:35:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5ZTct000816; Wed, 13 Jul 2016 05:35:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5ZS78000810; Wed, 13 Jul 2016 05:35:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130535.u6D5ZS78000810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302702 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:35:30 -0000 Author: sephe Date: Wed Jul 13 05:35:28 2016 New Revision: 302702 URL: https://svnweb.freebsd.org/changeset/base/302702 Log: hyperv/util: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7028 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 13 05:35:28 2016 (r302702) @@ -61,7 +61,7 @@ hv_heartbeat_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; - channel = softc->hv_dev->channel; + channel = softc->channel; ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, &recvlen, &requestid); Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 13 05:35:28 2016 (r302702) @@ -308,10 +308,6 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru { int err_ip, err_subnet, err_gway, err_dns, err_adap; int UNUSED_FLAG = 1; - struct hv_device *hv_dev; /* GUID Data Structure */ - hn_softc_t *sc; /* hn softc structure */ - char buf[HYPERV_GUID_STRLEN]; - device_t *devs; int devcnt; @@ -333,12 +329,18 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) { for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { - sc = device_get_softc(devs[devcnt]); - - /* Trying to find GUID of Network Device */ - hv_dev = sc->hn_dev_obj; + /* XXX access other driver's softc? are you kidding? */ + device_t dev = devs[devcnt]; + struct hn_softc *sc = device_get_softc(dev); + struct hv_vmbus_channel *chan; + char buf[HYPERV_GUID_STRLEN]; - hyperv_guid2str(&hv_dev->device_id, buf, sizeof(buf)); + /* + * Trying to find GUID of Network Device + * TODO: need vmbus interface. + */ + chan = vmbus_get_channel(dev); + hyperv_guid2str(&chan->ch_guid_inst, buf, sizeof(buf)); if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, HYPERV_GUID_STRLEN - 1) == 0) { @@ -573,7 +575,7 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e hv_icmsg_hdrp->status = error; hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - error = hv_vmbus_channel_send_packet(sc->util_sc.hv_dev->channel, + error = hv_vmbus_channel_send_packet(sc->util_sc.channel, sc->rcv_buf, sc->host_msg_len, sc->host_msg_id, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); @@ -624,7 +626,7 @@ hv_kvp_process_request(void *context, in sc = (hv_kvp_sc*)context; kvp_buf = sc->util_sc.receive_buffer; - channel = sc->util_sc.hv_dev->channel; + channel = sc->util_sc.channel; ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, &recvlen, &requestid); Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 13 05:35:28 2016 (r302702) @@ -65,7 +65,7 @@ hv_shutdown_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; - channel = softc->hv_dev->channel; + channel = softc->channel; ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, &recv_len, &request_id); Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 13 05:35:28 2016 (r302702) @@ -140,7 +140,7 @@ hv_timesync_cb(void *context) hv_timesync_sc *softc; softc = (hv_timesync_sc*)context; - channel = softc->util_sc.hv_dev->channel; + channel = softc->util_sc.channel; time_buf = softc->util_sc.receive_buffer; ret = hv_vmbus_channel_recv_packet(channel, time_buf, Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 13 05:35:28 2016 (r302702) @@ -74,13 +74,11 @@ hv_negotiate_version( int hv_util_attach(device_t dev) { - struct hv_device* hv_dev; struct hv_util_sc* softc; int ret; - hv_dev = vmbus_get_devctx(dev); softc = device_get_softc(dev); - softc->hv_dev = hv_dev; + softc->channel = vmbus_get_channel(dev); softc->receive_buffer = malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); @@ -91,9 +89,9 @@ hv_util_attach(device_t dev) * Turn off batched reading for all util drivers before we open the * channel. */ - hv_set_channel_read_state(hv_dev->channel, FALSE); + hv_set_channel_read_state(softc->channel, FALSE); - ret = hv_vmbus_channel_open(hv_dev->channel, 4 * PAGE_SIZE, + ret = hv_vmbus_channel_open(softc->channel, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, softc->callback, softc); @@ -110,14 +108,10 @@ error0: int hv_util_detach(device_t dev) { - struct hv_device* hv_dev; - struct hv_util_sc* softc; - - hv_dev = vmbus_get_devctx(dev); + struct hv_util_sc *sc = device_get_softc(dev); - hv_vmbus_channel_close(hv_dev->channel); - softc = device_get_softc(dev); + hv_vmbus_channel_close(sc->channel); + free(sc->receive_buffer, M_DEVBUF); - free(softc->receive_buffer, M_DEVBUF); return (0); } Modified: head/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.h Wed Jul 13 05:28:07 2016 (r302701) +++ head/sys/dev/hyperv/utilities/hv_util.h Wed Jul 13 05:35:28 2016 (r302702) @@ -41,7 +41,7 @@ typedef struct hv_util_sc { */ void (*callback)(void *); - struct hv_device* hv_dev; + struct hv_vmbus_channel *channel; uint8_t *receive_buffer; } hv_util_sc; From owner-svn-src-head@freebsd.org Wed Jul 13 05:47:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9702B97B98; Wed, 13 Jul 2016 05:47:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A17ED15CD; Wed, 13 Jul 2016 05:47:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5l9Lg004592; Wed, 13 Jul 2016 05:47:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5l93U004588; Wed, 13 Jul 2016 05:47:09 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130547.u6D5l93U004588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302703 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:47:10 -0000 Author: sephe Date: Wed Jul 13 05:47:09 2016 New Revision: 302703 URL: https://svnweb.freebsd.org/changeset/base/302703 Log: hyperv/vmbus: Deprecate the usage of hv_device. This paves way to nuke the hv_device, which is actually an unncessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7032 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 05:35:28 2016 (r302702) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 05:47:09 2016 (r302703) @@ -539,6 +539,7 @@ typedef union { typedef struct hv_vmbus_channel { struct hv_device* device; + device_t ch_dev; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 05:35:28 2016 (r302702) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 05:47:09 2016 (r302703) @@ -163,6 +163,7 @@ vmbus_channel_process_offer(hv_vmbus_cha */ new_channel->primary_channel = channel; new_channel->device = channel->device; + new_channel->ch_dev = channel->ch_dev; mtx_lock(&channel->sc_lock); TAILQ_INSERT_TAIL(&channel->sc_list_anchor, new_channel, sc_list_entry); @@ -216,9 +217,12 @@ vmbus_channel_process_offer(hv_vmbus_cha * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. + * + * NOTE: + * Error is ignored here; don't have much to do if error really + * happens. */ - hv_vmbus_child_device_register(new_channel->vmbus_sc, - new_channel->device); + hv_vmbus_child_device_register(new_channel); } void @@ -365,8 +369,8 @@ vmbus_chan_detach_task(void *xchan, int struct hv_vmbus_channel *chan = xchan; if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { - /* Only primary channel owns the hv_device */ - hv_vmbus_child_device_unregister(chan->device); + /* Only primary channel owns the device */ + hv_vmbus_child_device_unregister(chan); /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->vmbus_sc; @@ -446,8 +450,8 @@ hv_vmbus_release_unattached_channels(str TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { - /* Only primary channel owns the hv_device */ - hv_vmbus_child_device_unregister(channel->device); + /* Only primary channel owns the device */ + hv_vmbus_child_device_unregister(channel); } hv_vmbus_free_vmbus_channel(channel); } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 05:35:28 2016 (r302702) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 05:47:09 2016 (r302703) @@ -215,9 +215,9 @@ void hv_vmbus_release_unattached_chann struct hv_device* hv_vmbus_child_device_create( struct hv_vmbus_channel *channel); -void hv_vmbus_child_device_register(struct vmbus_softc *, - struct hv_device *child_dev); +int hv_vmbus_child_device_register( + struct hv_vmbus_channel *chan); int hv_vmbus_child_device_unregister( - struct hv_device *child_dev); + struct hv_vmbus_channel *chan); #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:35:28 2016 (r302702) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 05:47:09 2016 (r302703) @@ -989,18 +989,21 @@ vmbus_read_ivar(device_t dev, device_t c static int vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen) { - struct hv_device *dev_ctx = device_get_ivars(child); + const struct hv_vmbus_channel *chan; char guidbuf[HYPERV_GUID_STRLEN]; - if (dev_ctx == NULL) + if (device_get_ivars(child) == NULL) { + /* Event timer device, which does not belong to a channel */ return (0); + } + chan = vmbus_get_channel(child); strlcat(buf, "classid=", buflen); - hyperv_guid2str(&dev_ctx->class_id, guidbuf, sizeof(guidbuf)); + hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf)); strlcat(buf, guidbuf, buflen); strlcat(buf, " deviceid=", buflen); - hyperv_guid2str(&dev_ctx->device_id, guidbuf, sizeof(guidbuf)); + hyperv_guid2str(&chan->ch_guid_inst, guidbuf, sizeof(guidbuf)); strlcat(buf, guidbuf, buflen); return (0); @@ -1023,40 +1026,48 @@ hv_vmbus_child_device_create(struct hv_v return (child_dev); } -void -hv_vmbus_child_device_register(struct vmbus_softc *sc, - struct hv_device *child_dev) -{ - device_t child, parent; - - parent = sc->vmbus_dev; - if (bootverbose) { - char name[HYPERV_GUID_STRLEN]; - - hyperv_guid2str(&child_dev->class_id, name, sizeof(name)); - device_printf(parent, "add device, classid: %s\n", name); +int +hv_vmbus_child_device_register(struct hv_vmbus_channel *chan) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + device_t parent = sc->vmbus_dev; + int error = 0; + + chan->ch_dev = device_add_child(parent, NULL, -1); + if (chan->ch_dev == NULL) { + device_printf(parent, "device_add_child for chan%u failed\n", + chan->ch_id); + error = ENXIO; + goto done; } + chan->device->device = chan->ch_dev; + device_set_ivars(chan->ch_dev, chan->device); - child = device_add_child(parent, NULL, -1); - child_dev->device = child; - device_set_ivars(child, child_dev); - - /* New device was added to vmbus */ +done: + /* New device has been/should be added to vmbus. */ vmbus_scan_newdev(sc); + return error; } int -hv_vmbus_child_device_unregister(struct hv_device *child_dev) +hv_vmbus_child_device_unregister(struct hv_vmbus_channel *chan) { - int ret = 0; + int error; + + if (chan->ch_dev == NULL) { + /* Failed to add a device. */ + return 0; + } + /* * XXXKYS: Ensure that this is the opposite of * device_add_child() */ mtx_lock(&Giant); - ret = device_delete_child(vmbus_get_device(), child_dev->device); + error = device_delete_child(chan->vmbus_sc->vmbus_dev, chan->ch_dev); mtx_unlock(&Giant); - return(ret); + + return error; } static int @@ -1082,9 +1093,9 @@ vmbus_get_version_method(device_t bus, d static int vmbus_probe_guid_method(device_t bus, device_t dev, const struct hv_guid *guid) { - struct hv_device *hv_dev = device_get_ivars(dev); + const struct hv_vmbus_channel *chan = vmbus_get_channel(dev); - if (memcmp(&hv_dev->class_id, guid, sizeof(struct hv_guid)) == 0) + if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hv_guid)) == 0) return 0; return ENXIO; } From owner-svn-src-head@freebsd.org Wed Jul 13 05:58:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE49AB97DE5; Wed, 13 Jul 2016 05:58:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9C8C1A69; Wed, 13 Jul 2016 05:58:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D5wlZc008666; Wed, 13 Jul 2016 05:58:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D5wkZH008661; Wed, 13 Jul 2016 05:58:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130558.u6D5wkZH008661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 05:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302704 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 05:58:48 -0000 Author: sephe Date: Wed Jul 13 05:58:46 2016 New Revision: 302704 URL: https://svnweb.freebsd.org/changeset/base/302704 Log: hyperv/hn: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7033 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/hv_rndis_filter.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 13 05:47:09 2016 (r302703) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 13 05:58:46 2016 (r302704) @@ -58,31 +58,30 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper * Forward declarations */ static void hv_nv_on_channel_callback(void *xchan); -static int hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device); +static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); -static int hv_nv_connect_to_vsp(struct hv_device *device); +static int hv_nv_connect_to_vsp(struct hn_softc *sc); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); + struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *chan, + struct hn_softc *sc, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt); /* * */ static inline netvsc_dev * -hv_nv_alloc_net_device(struct hv_device *device) +hv_nv_alloc_net_device(struct hn_softc *sc) { netvsc_dev *net_dev; - hn_softc_t *sc = device_get_softc(device->device); net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO); - net_dev->dev = device; + net_dev->sc = sc; net_dev->destroy = FALSE; sc->net_dev = net_dev; @@ -90,43 +89,21 @@ hv_nv_alloc_net_device(struct hv_device } /* - * + * XXX unnecessary; nuke it. */ static inline netvsc_dev * -hv_nv_get_outbound_net_device(struct hv_device *device) +hv_nv_get_outbound_net_device(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); - netvsc_dev *net_dev = sc->net_dev;; - - if ((net_dev != NULL) && net_dev->destroy) { - return (NULL); - } - - return (net_dev); + return sc->net_dev; } /* - * + * XXX unnecessary; nuke it. */ static inline netvsc_dev * -hv_nv_get_inbound_net_device(struct hv_device *device) +hv_nv_get_inbound_net_device(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); - netvsc_dev *net_dev = sc->net_dev;; - - if (net_dev == NULL) { - return (net_dev); - } - /* - * When the device is being destroyed; we only - * permit incoming packets if and only if there - * are outstanding sends. - */ - if (net_dev->destroy) { - return (NULL); - } - - return (net_dev); + return sc->net_dev; } int @@ -164,13 +141,13 @@ hv_nv_get_next_send_section(netvsc_dev * * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { return (ENODEV); } @@ -185,7 +162,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct * GPADL: Guest physical address descriptor list. */ ret = hv_vmbus_channel_establish_gpadl( - device->channel, net_dev->rx_buf, + sc->hn_prichan, net_dev->rx_buf, net_dev->rx_buf_size, &net_dev->rx_buf_gpadl_handle); if (ret != 0) { goto cleanup; @@ -206,7 +183,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -256,13 +233,13 @@ exit: * Net VSC initialize send buffer with net VSP */ static int -hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device) +hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { return (ENODEV); } @@ -279,7 +256,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru * Note: This call uses the vmbus connection rather than the * channel to establish the gpadl handle. */ - ret = hv_vmbus_channel_establish_gpadl(device->channel, + ret = hv_vmbus_channel_establish_gpadl(sc->hn_prichan, net_dev->send_buf, net_dev->send_buf_size, &net_dev->send_buf_gpadl_handle); if (ret != 0) { @@ -300,7 +277,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -360,7 +337,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = NETVSC_RECEIVE_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->dev->channel, + ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); @@ -376,7 +353,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->dev->channel, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -428,7 +405,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id = NETVSC_SEND_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->dev->channel, + ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); @@ -443,7 +420,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->dev->channel, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* @@ -478,7 +455,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne * to the negotiated version, so we cannot rely on that. */ static int -hv_nv_negotiate_nvsp_protocol(struct hv_device *device, netvsc_dev *net_dev, +hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev, uint32_t nvsp_ver) { nvsp_msg *init_pkt; @@ -495,7 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hv_ init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; /* Send the init request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -516,13 +493,13 @@ hv_nv_negotiate_nvsp_protocol(struct hv_ * Not valid for NDIS version 1. */ static int -hv_nv_send_ndis_config(struct hv_device *device, uint32_t mtu) +hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) { netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret; - net_dev = hv_nv_get_outbound_net_device(device); + net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) return (-ENODEV); @@ -539,7 +516,7 @@ hv_nv_send_ndis_config(struct hv_device = 1; /* Send the configuration packet */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); if (ret != 0) @@ -552,7 +529,7 @@ hv_nv_send_ndis_config(struct hv_device * Net VSC connect to VSP */ static int -hv_nv_connect_to_vsp(struct hv_device *device) +hv_nv_connect_to_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; nvsp_msg *init_pkt; @@ -564,20 +541,16 @@ hv_nv_connect_to_vsp(struct hv_device *d int i; int protocol_number = nitems(protocol_list); int ret = 0; - device_t dev = device->device; - hn_softc_t *sc = device_get_softc(dev); + device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; - net_dev = hv_nv_get_outbound_net_device(device); - if (!net_dev) { - return (ENODEV); - } + net_dev = hv_nv_get_outbound_net_device(sc); /* * Negotiate the NVSP version. Try the latest NVSP first. */ for (i = protocol_number - 1; i >= 0; i--) { - if (hv_nv_negotiate_nvsp_protocol(device, net_dev, + if (hv_nv_negotiate_nvsp_protocol(sc, net_dev, protocol_list[i]) == 0) { net_dev->nvsp_version = protocol_list[i]; if (bootverbose) @@ -599,7 +572,7 @@ hv_nv_connect_to_vsp(struct hv_device *d * This needs to be right after the NVSP init message per Haiyang */ if (net_dev->nvsp_version >= NVSP_PROTOCOL_VERSION_2) - ret = hv_nv_send_ndis_config(device, ifp->if_mtu); + ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); /* * Send the NDIS version @@ -622,7 +595,7 @@ hv_nv_connect_to_vsp(struct hv_device *d /* Send the init request */ - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); if (ret != 0) { @@ -643,9 +616,9 @@ hv_nv_connect_to_vsp(struct hv_device *d net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE; net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE; - ret = hv_nv_init_rx_buffer_with_net_vsp(device); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) - ret = hv_nv_init_send_buffer_with_net_vsp(device); + ret = hv_nv_init_send_buffer_with_net_vsp(sc); cleanup: return (ret); @@ -677,13 +650,13 @@ hv_nv_subchan_attach(struct hv_vmbus_cha * Callback when the device belonging to this driver is added */ netvsc_dev * -hv_nv_on_device_add(struct hv_device *device, void *additional_info) +hv_nv_on_device_add(struct hn_softc *sc, void *additional_info) { - struct hv_vmbus_channel *chan = device->channel; + struct hv_vmbus_channel *chan = sc->hn_prichan; netvsc_dev *net_dev; int ret = 0; - net_dev = hv_nv_alloc_net_device(device); + net_dev = hv_nv_alloc_net_device(sc); if (net_dev == NULL) return NULL; @@ -707,7 +680,7 @@ hv_nv_on_device_add(struct hv_device *de /* * Connect with the NetVsp */ - ret = hv_nv_connect_to_vsp(device); + ret = hv_nv_connect_to_vsp(sc); if (ret != 0) goto close; @@ -733,9 +706,8 @@ cleanup: * Net VSC on device remove */ int -hv_nv_on_device_remove(struct hv_device *device, boolean_t destroy_channel) +hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev;; /* Stop outbound traffic ie sends and receives completions */ @@ -748,12 +720,12 @@ hv_nv_on_device_remove(struct hv_device /* Now, we can close the channel safely */ if (!destroy_channel) { - device->channel->state = + sc->hn_prichan->state = HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE; } - free(device->channel->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(device->channel); + free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); + hv_vmbus_channel_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); @@ -765,8 +737,7 @@ hv_nv_on_device_remove(struct hv_device * Net VSC on send completion */ static void -hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, struct hv_vmbus_channel *chan, +hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) { nvsp_msg *nvsp_msg_pkt; @@ -871,14 +842,14 @@ hv_nv_on_send(struct hv_vmbus_channel *c * with virtual addresses. */ static void -hv_nv_on_receive(netvsc_dev *net_dev, struct hv_device *device, +hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) { hv_vm_transfer_page_packet_header *vm_xfer_page_pkt; nvsp_msg *nvsp_msg_pkt; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; - device_t dev = device->device; + device_t dev = sc->hn_dev; int count = 0; int i = 0; int status = nvsp_status_success; @@ -912,7 +883,6 @@ hv_nv_on_receive(netvsc_dev *net_dev, st } count = vm_xfer_page_pkt->range_count; - net_vsc_pkt->device = device; /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { @@ -922,7 +892,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st net_vsc_pkt->tot_data_buf_len = vm_xfer_page_pkt->ranges[i].byte_count; - hv_rf_on_receive(net_dev, device, chan, net_vsc_pkt); + hv_rf_on_receive(net_dev, chan, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { status = nvsp_status_failure; } @@ -978,14 +948,14 @@ retry_send_cmplt: * Net VSC receiving vRSS send table from VSP */ static void -hv_nv_send_table(struct hv_device *device, hv_vm_packet_descriptor *pkt) +hv_nv_send_table(struct hn_softc *sc, hv_vm_packet_descriptor *pkt) { netvsc_dev *net_dev; nvsp_msg *nvsp_msg_pkt; int i; uint32_t count, *table; - net_dev = hv_nv_get_inbound_net_device(device); + net_dev = hv_nv_get_inbound_net_device(sc); if (!net_dev) return; @@ -1021,9 +991,9 @@ static void hv_nv_on_channel_callback(void *xchan) { struct hv_vmbus_channel *chan = xchan; - struct hv_device *device = chan->device; + device_t dev = chan->ch_dev; + struct hn_softc *sc = device_get_softc(dev); netvsc_dev *net_dev; - device_t dev = device->device; uint32_t bytes_rxed; uint64_t request_id; hv_vm_packet_descriptor *desc; @@ -1031,7 +1001,7 @@ hv_nv_on_channel_callback(void *xchan) int bufferlen = NETVSC_PACKET_SIZE; int ret = 0; - net_dev = hv_nv_get_inbound_net_device(device); + net_dev = hv_nv_get_inbound_net_device(sc); if (net_dev == NULL) return; @@ -1045,14 +1015,14 @@ hv_nv_on_channel_callback(void *xchan) desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { case HV_VMBUS_PACKET_TYPE_COMPLETION: - hv_nv_on_send_completion(net_dev, device, - chan, desc); + hv_nv_on_send_completion(net_dev, chan, + desc); break; case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: - hv_nv_on_receive(net_dev, device, chan, desc); + hv_nv_on_receive(net_dev, sc, chan, desc); break; case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND: - hv_nv_send_table(device, desc); + hv_nv_send_table(sc, desc); break; default: device_printf(dev, Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 13 05:47:09 2016 (r302703) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 13 05:58:46 2016 (r302704) @@ -1040,7 +1040,7 @@ typedef struct nvsp_msg_ { * Per netvsc channel-specific */ typedef struct netvsc_dev_ { - struct hv_device *dev; + struct hn_softc *sc; /* Send buffer allocated by us but manages by NetVSP */ void *send_buf; @@ -1107,7 +1107,6 @@ typedef void (*pfn_on_send_rx_completion #endif typedef struct netvsc_packet_ { - struct hv_device *device; hv_bool_uint8_t is_data_pkt; /* One byte */ uint16_t vlan_tci; uint32_t status; @@ -1239,8 +1238,8 @@ typedef struct hn_softc { int hn_initdone; /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; - struct hv_device *hn_dev_obj; netvsc_dev *net_dev; + struct hv_vmbus_channel *hn_prichan; int hn_rx_ring_cnt; int hn_rx_ring_inuse; @@ -1262,10 +1261,10 @@ typedef struct hn_softc { */ extern int hv_promisc_mode; -void netvsc_linkstatus_callback(struct hv_device *device_obj, uint32_t status); -netvsc_dev *hv_nv_on_device_add(struct hv_device *device, +void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); +netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, void *additional_info); -int hv_nv_on_device_remove(struct hv_device *device, +int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); int hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 05:47:09 2016 (r302703) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 05:58:46 2016 (r302704) @@ -428,8 +428,6 @@ netvsc_probe(device_t dev) static int netvsc_attach(device_t dev) { - struct hv_device *device_ctx = vmbus_get_devctx(dev); - struct hv_vmbus_channel *pri_chan; netvsc_device_info device_info; hn_softc_t *sc; int unit = device_get_unit(dev); @@ -443,6 +441,7 @@ netvsc_attach(device_t dev) sc->hn_unit = unit; sc->hn_dev = dev; + sc->hn_prichan = vmbus_get_channel(dev); if (hn_tx_taskq == NULL) { sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, @@ -466,8 +465,6 @@ netvsc_attach(device_t dev) } NV_LOCK_INIT(sc, "NetVSCLock"); - sc->hn_dev_obj = device_ctx; - ifp = sc->hn_ifp = if_alloc(IFT_ETHER); ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); @@ -510,12 +507,7 @@ netvsc_attach(device_t dev) /* * Associate the first TX/RX ring w/ the primary channel. */ - pri_chan = device_ctx->channel; - KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel")); - KASSERT(pri_chan->ch_subidx == 0, - ("primary channel subidx %u", - pri_chan->ch_subidx)); - hn_channel_attach(sc, pri_chan); + hn_channel_attach(sc, sc->hn_prichan); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; @@ -552,7 +544,7 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; - error = hv_rf_on_device_add(device_ctx, &device_info, ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, ring_cnt); if (error) goto failed; KASSERT(sc->net_dev->num_channel > 0 && @@ -626,7 +618,6 @@ static int netvsc_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - struct hv_device *hv_device = vmbus_get_devctx(dev); if (bootverbose) printf("netvsc_detach\n"); @@ -642,7 +633,7 @@ netvsc_detach(device_t dev) * the netdevice. */ - hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); + hv_rf_on_device_remove(sc, HV_RF_NV_DESTROY_CHANNEL); hn_stop_tx_tasks(sc); @@ -1201,10 +1192,8 @@ hn_start_locked(struct hn_tx_ring *txr, * Link up/down notification */ void -netvsc_linkstatus_callback(struct hv_device *device_obj, uint32_t status) +netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status) { - hn_softc_t *sc = device_get_softc(device_obj->device); - if (status == 1) { sc->hn_carrier = 1; } else { @@ -1525,7 +1514,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, struct ifaddr *ifa = (struct ifaddr *)data; #endif netvsc_device_info device_info; - struct hv_device *hn_dev; int mask, error = 0; int retry_cnt = 500; @@ -1543,8 +1531,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, error = ether_ioctl(ifp, cmd, data); break; case SIOCSIFMTU: - hn_dev = vmbus_get_devctx(sc->hn_dev); - /* Check MTU value change */ if (ifp->if_mtu == ifr->ifr_mtu) break; @@ -1591,7 +1577,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * MTU to take effect. This includes tearing down, but not * deleting the channel, then bringing it back up. */ - error = hv_rf_on_device_remove(hn_dev, HV_RF_NV_RETAIN_CHANNEL); + error = hv_rf_on_device_remove(sc, HV_RF_NV_RETAIN_CHANNEL); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -1600,9 +1586,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_drain_subchan(hn_dev->channel); + vmbus_drain_subchan(sc->hn_prichan); - error = hv_rf_on_device_add(hn_dev, &device_info, + error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); if (error) { NV_LOCK(sc); @@ -1767,7 +1753,6 @@ hn_stop(hn_softc_t *sc) { struct ifnet *ifp; int ret, i; - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); ifp = sc->hn_ifp; @@ -1782,7 +1767,7 @@ hn_stop(hn_softc_t *sc) if_link_state_change(ifp, LINK_STATE_DOWN); sc->hn_initdone = 0; - ret = hv_rf_on_close(device_ctx); + ret = hv_rf_on_close(sc); } /* @@ -1850,7 +1835,6 @@ static void hn_ifinit_locked(hn_softc_t *sc) { struct ifnet *ifp; - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); int ret, i; ifp = sc->hn_ifp; @@ -1861,7 +1845,7 @@ hn_ifinit_locked(hn_softc_t *sc) hv_promisc_mode = 1; - ret = hv_rf_on_open(device_ctx); + ret = hv_rf_on_open(sc); if (ret != 0) { return; } else { @@ -2984,13 +2968,12 @@ hn_subchan_attach(struct hn_softc *sc, s static void hn_subchan_setup(struct hn_softc *sc) { - struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev); struct hv_vmbus_channel **subchan; int subchan_cnt = sc->net_dev->num_channel - 1; int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(device_ctx->channel, subchan_cnt); + subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 13 05:47:09 2016 (r302703) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 13 05:58:46 2016 (r302704) @@ -88,7 +88,7 @@ static int hv_rf_close_device(rndis_dev static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context); static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context); int -hv_rf_send_offload_request(struct hv_device *device, +hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads); /* * Set the Per-Packet-Info with the specified type @@ -298,7 +298,7 @@ hv_rf_send_request(rndis_device *device, packet->send_buf_section_size = 0; sendit: - ret = hv_nv_on_send(device->net_dev->dev->channel, packet); + ret = hv_nv_on_send(device->net_dev->sc->hn_prichan, packet); return (ret); } @@ -350,7 +350,7 @@ hv_rf_receive_response(rndis_device *dev } int -hv_rf_send_offload_request(struct hv_device *device, +hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads) { rndis_request *request; @@ -358,8 +358,7 @@ hv_rf_send_offload_request(struct hv_dev rndis_offload_params *offload_req; rndis_set_complete *set_complete; rndis_device *rndis_dev; - hn_softc_t *sc = device_get_softc(device->device); - device_t dev = device->device; + device_t dev = sc->hn_dev; netvsc_dev *net_dev = sc->net_dev; uint32_t vsp_version = net_dev->nvsp_version; uint32_t extlen = sizeof(rndis_offload_params); @@ -436,14 +435,14 @@ hv_rf_receive_indicate_status(rndis_devi switch(indicate->status) { case RNDIS_STATUS_MEDIA_CONNECT: - netvsc_linkstatus_callback(device->net_dev->dev, 1); + netvsc_linkstatus_callback(device->net_dev->sc, 1); break; case RNDIS_STATUS_MEDIA_DISCONNECT: - netvsc_linkstatus_callback(device->net_dev->dev, 0); + netvsc_linkstatus_callback(device->net_dev->sc, 0); break; default: /* TODO: */ - device_printf(device->net_dev->dev->device, + device_printf(device->net_dev->sc->hn_dev, "unknown status %d received\n", indicate->status); break; } @@ -536,7 +535,7 @@ hv_rf_receive_data(rndis_device *device, { rndis_packet *rndis_pkt; uint32_t data_offset; - device_t dev = device->net_dev->dev->device; + device_t dev = device->net_dev->sc->hn_dev; struct hv_rf_recvinfo info; rndis_pkt = &message->msg.packet; @@ -579,7 +578,7 @@ hv_rf_receive_data(rndis_device *device, * RNDIS filter on receive */ int -hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, +hv_rf_on_receive(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, netvsc_packet *pkt) { rndis_device *rndis_dev; @@ -1061,7 +1060,7 @@ hv_rf_close_device(rndis_device *device) * RNDIS filter on device add */ int -hv_rf_on_device_add(struct hv_device *device, void *additl_info, +hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan) { int ret; @@ -1072,7 +1071,7 @@ hv_rf_on_device_add(struct hv_device *de struct rndis_recv_scale_cap rsscaps; uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; - device_t dev = device->device; + device_t dev = sc->hn_dev; rndis_dev = hv_get_rndis_device(); if (rndis_dev == NULL) { @@ -1085,7 +1084,7 @@ hv_rf_on_device_add(struct hv_device *de * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - net_dev = hv_nv_on_device_add(device, additl_info); + net_dev = hv_nv_on_device_add(sc, additl_info); if (!net_dev) { hv_put_rndis_device(rndis_dev); @@ -1123,7 +1122,7 @@ hv_rf_on_device_add(struct hv_device *de offloads.udp_ipv6_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; offloads.lso_v2_ipv4 = RNDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - ret = hv_rf_send_offload_request(device, &offloads); + ret = hv_rf_send_offload_request(sc, &offloads); if (ret != 0) { /* TODO: shut down rndis device and the channel */ device_printf(dev, @@ -1170,7 +1169,7 @@ hv_rf_on_device_add(struct hv_device *de init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = net_dev->num_channel - 1; - ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); @@ -1204,9 +1203,8 @@ out: * RNDIS filter on device remove */ int -hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel) +hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; rndis_device *rndis_dev = (rndis_device *)net_dev->extension; int ret; @@ -1218,7 +1216,7 @@ hv_rf_on_device_remove(struct hv_device net_dev->extension = NULL; /* Pass control to inner driver to remove the device */ - ret |= hv_nv_on_device_remove(device, destroy_channel); + ret |= hv_nv_on_device_remove(sc, destroy_channel); return (ret); } @@ -1227,9 +1225,8 @@ hv_rf_on_device_remove(struct hv_device * RNDIS filter on open */ int -hv_rf_on_open(struct hv_device *device) +hv_rf_on_open(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; return (hv_rf_open_device((rndis_device *)net_dev->extension)); @@ -1239,9 +1236,8 @@ hv_rf_on_open(struct hv_device *device) * RNDIS filter on close */ int -hv_rf_on_close(struct hv_device *device) +hv_rf_on_close(struct hn_softc *sc) { - hn_softc_t *sc = device_get_softc(device->device); netvsc_dev *net_dev = sc->net_dev; return (hv_rf_close_device((rndis_device *)net_dev->extension)); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 13 05:47:09 2016 (r302703) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 13 05:58:46 2016 (r302704) @@ -111,15 +111,16 @@ typedef struct rndis_device_ { * Externs */ struct hv_vmbus_channel; +struct hn_softc; -int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, +int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, netvsc_packet *pkt); void hv_rf_receive_rollup(netvsc_dev *net_dev); void hv_rf_channel_rollup(struct hv_vmbus_channel *chan); -int hv_rf_on_device_add(struct hv_device *device, void *additl_info, int nchan); -int hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel); -int hv_rf_on_open(struct hv_device *device); -int hv_rf_on_close(struct hv_device *device); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan); +int hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); +int hv_rf_on_open(struct hn_softc *sc); +int hv_rf_on_close(struct hn_softc *sc); #endif /* __HV_RNDIS_FILTER_H__ */ From owner-svn-src-head@freebsd.org Wed Jul 13 06:17:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D83FB93283; Wed, 13 Jul 2016 06:17:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5566215FB; Wed, 13 Jul 2016 06:17:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D6HGi5016597; Wed, 13 Jul 2016 06:17:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D6HGdZ016592; Wed, 13 Jul 2016 06:17:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130617.u6D6HGdZ016592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302706 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 06:17:17 -0000 Author: sephe Date: Wed Jul 13 06:17:15 2016 New Revision: 302706 URL: https://svnweb.freebsd.org/changeset/base/302706 Log: hyperv: Get rid of hv_device, which is unnecessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7034 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:09:34 2016 (r302705) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:17:15 2016 (r302706) @@ -399,24 +399,6 @@ typedef struct { #define HW_MACADDR_LEN 6 -enum { - HV_VMBUS_IVAR_TYPE, - HV_VMBUS_IVAR_INSTANCE, - HV_VMBUS_IVAR_NODE, - HV_VMBUS_IVAR_DEVCTX, - HV_VMBUS_IVAR_CHAN, -}; - -#define HV_VMBUS_ACCESSOR(var, ivar, type) \ - __BUS_ACCESSOR(vmbus, var, HV_VMBUS, ivar, type) - -struct hv_vmbus_channel; - -HV_VMBUS_ACCESSOR(type, TYPE, const char *) -HV_VMBUS_ACCESSOR(devctx, DEVCTX, struct hv_device *) -HV_VMBUS_ACCESSOR(channel, CHAN, struct hv_vmbus_channel *) - - /* * Common defines for Hyper-V ICs */ @@ -538,7 +520,6 @@ typedef union { } __packed hv_vmbus_connection_id; typedef struct hv_vmbus_channel { - struct hv_device* device; device_t ch_dev; struct vmbus_softc *vmbus_sc; hv_vmbus_channel_state state; @@ -652,15 +633,6 @@ hv_set_channel_read_state(hv_vmbus_chann channel->batched_reading = state; } -typedef struct hv_device { - hv_guid class_id; - hv_guid device_id; - device_t device; - hv_vmbus_channel* channel; -} hv_device; - - - int hv_vmbus_channel_recv_packet( hv_vmbus_channel* channel, void* buffer, @@ -742,4 +714,10 @@ hv_get_phys_addr(void *virt) return (ret); } +static __inline struct hv_vmbus_channel * +vmbus_get_channel(device_t dev) +{ + return device_get_ivars(dev); +} + #endif /* __HYPERV_H__ */ Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:09:34 2016 (r302705) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:17:15 2016 (r302706) @@ -106,10 +106,10 @@ vmbus_channel_sysctl_create(hv_vmbus_cha hv_vmbus_channel* primary_ch = channel->primary_channel; if (primary_ch == NULL) { - dev = channel->device->device; + dev = channel->ch_dev; ch_id = channel->ch_id; } else { - dev = primary_ch->device->device; + dev = primary_ch->ch_dev; ch_id = primary_ch->ch_id; sub_ch_id = channel->ch_subidx; } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:09:34 2016 (r302705) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:17:15 2016 (r302706) @@ -162,7 +162,6 @@ vmbus_channel_process_offer(hv_vmbus_cha * It is a sub channel offer, process it. */ new_channel->primary_channel = channel; - new_channel->device = channel->device; new_channel->ch_dev = channel->ch_dev; mtx_lock(&channel->sc_lock); TAILQ_INSERT_TAIL(&channel->sc_list_anchor, @@ -207,13 +206,6 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel->state = HV_CHANNEL_OPEN_STATE; /* - * Start the process of binding this offer to the driver - * (We need to set the device field before calling - * hv_vmbus_child_device_add()) - */ - new_channel->device = hv_vmbus_child_device_create(new_channel); - - /* * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 06:09:34 2016 (r302705) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 06:17:15 2016 (r302706) @@ -212,9 +212,6 @@ void hv_vmbus_free_vmbus_channel(hv_vm void hv_vmbus_release_unattached_channels( struct vmbus_softc *); -struct hv_device* hv_vmbus_child_device_create( - struct hv_vmbus_channel *channel); - int hv_vmbus_child_device_register( struct hv_vmbus_channel *chan); int hv_vmbus_child_device_unregister( Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 06:09:34 2016 (r302705) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 06:17:15 2016 (r302706) @@ -960,29 +960,6 @@ vmbus_intr_teardown(struct vmbus_softc * static int vmbus_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { - struct hv_device *child_dev_ctx = device_get_ivars(child); - - switch (index) { - case HV_VMBUS_IVAR_TYPE: - *result = (uintptr_t)&child_dev_ctx->class_id; - return (0); - - case HV_VMBUS_IVAR_INSTANCE: - *result = (uintptr_t)&child_dev_ctx->device_id; - return (0); - - case HV_VMBUS_IVAR_DEVCTX: - *result = (uintptr_t)child_dev_ctx; - return (0); - - case HV_VMBUS_IVAR_NODE: - *result = (uintptr_t)child_dev_ctx->device; - return (0); - - case HV_VMBUS_IVAR_CHAN: - *result = (uintptr_t)child_dev_ctx->channel; - return (0); - } return (ENOENT); } @@ -992,11 +969,11 @@ vmbus_child_pnpinfo_str(device_t dev, de const struct hv_vmbus_channel *chan; char guidbuf[HYPERV_GUID_STRLEN]; - if (device_get_ivars(child) == NULL) { + chan = vmbus_get_channel(child); + if (chan == NULL) { /* Event timer device, which does not belong to a channel */ return (0); } - chan = vmbus_get_channel(child); strlcat(buf, "classid=", buflen); hyperv_guid2str(&chan->ch_guid_type, guidbuf, sizeof(guidbuf)); @@ -1009,23 +986,6 @@ vmbus_child_pnpinfo_str(device_t dev, de return (0); } -struct hv_device * -hv_vmbus_child_device_create(struct hv_vmbus_channel *channel) -{ - hv_device *child_dev; - - /* - * Allocate the new child device - */ - child_dev = malloc(sizeof(hv_device), M_DEVBUF, M_WAITOK | M_ZERO); - - child_dev->channel = channel; - child_dev->class_id = channel->ch_guid_type; - child_dev->device_id = channel->ch_guid_inst; - - return (child_dev); -} - int hv_vmbus_child_device_register(struct hv_vmbus_channel *chan) { @@ -1040,8 +1000,7 @@ hv_vmbus_child_device_register(struct hv error = ENXIO; goto done; } - chan->device->device = chan->ch_dev; - device_set_ivars(chan->ch_dev, chan->device); + device_set_ivars(chan->ch_dev, chan); done: /* New device has been/should be added to vmbus. */ From owner-svn-src-head@freebsd.org Wed Jul 13 06:30:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 045DBB93575; Wed, 13 Jul 2016 06:30:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92CCC1B11; Wed, 13 Jul 2016 06:30:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D6UX5X020561; Wed, 13 Jul 2016 06:30:33 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D6UXWi020559; Wed, 13 Jul 2016 06:30:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130630.u6D6UXWi020559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:30:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302707 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 06:30:35 -0000 Author: sephe Date: Wed Jul 13 06:30:33 2016 New Revision: 302707 URL: https://svnweb.freebsd.org/changeset/base/302707 Log: hyperv/vmbus: Nuke unused field from hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7036 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:17:15 2016 (r302706) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:30:33 2016 (r302707) @@ -564,8 +564,6 @@ typedef struct hv_vmbus_channel { */ boolean_t batched_reading; - boolean_t is_dedicated_interrupt; - struct hypercall_sigevt_in *ch_sigevt; struct hyperv_dma ch_sigevt_dma; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:17:15 2016 (r302706) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:30:33 2016 (r302707) @@ -311,11 +311,8 @@ vmbus_channel_on_offer_internal(struct v } new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; - if (sc->vmbus_version != VMBUS_VERSION_WS2008) { - new_channel->is_dedicated_interrupt = - (offer->is_dedicated_interrupt != 0); + if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_sigevt->hc_connid = offer->connection_id; - } new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; From owner-svn-src-head@freebsd.org Wed Jul 13 06:39:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5398B93752; Wed, 13 Jul 2016 06:39:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3671F13; Wed, 13 Jul 2016 06:39:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D6d46H024197; Wed, 13 Jul 2016 06:39:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D6d4jB024195; Wed, 13 Jul 2016 06:39:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130639.u6D6d4jB024195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302708 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 06:39:05 -0000 Author: sephe Date: Wed Jul 13 06:39:04 2016 New Revision: 302708 URL: https://svnweb.freebsd.org/changeset/base/302708 Log: hyperv/bufring: Remove unused fields MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7037 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:30:33 2016 (r302707) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:39:04 2016 (r302708) @@ -471,7 +471,7 @@ typedef struct { uint8_t reserved[4084]; /* - * WARNING: Ring data starts here + ring_data_start_offset + * WARNING: Ring data starts here * !!! DO NOT place any fields below this !!! */ uint8_t buffer[0]; /* doubles as interrupt mask */ @@ -491,10 +491,8 @@ typedef struct { typedef struct { hv_vmbus_ring_buffer* ring_buffer; - uint32_t ring_size; /* Include the shared header */ struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ - uint32_t ring_data_start_offset; } hv_vmbus_ring_buffer_info; typedef void (*hv_vmbus_pfn_channel_callback)(void *context); Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Jul 13 06:30:33 2016 (r302707) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Wed Jul 13 06:39:04 2016 (r302708) @@ -286,7 +286,6 @@ hv_vmbus_ring_buffer_init( ring_info->ring_buffer->read_index = ring_info->ring_buffer->write_index = 0; - ring_info->ring_size = buffer_len; ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer); mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); From owner-svn-src-head@freebsd.org Wed Jul 13 06:46:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEECCB93A13; Wed, 13 Jul 2016 06:46:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F3EB1673; Wed, 13 Jul 2016 06:46:30 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D6kTVd028103; Wed, 13 Jul 2016 06:46:29 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D6kTPu028099; Wed, 13 Jul 2016 06:46:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130646.u6D6kTPu028099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302709 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 06:46:30 -0000 Author: sephe Date: Wed Jul 13 06:46:29 2016 New Revision: 302709 URL: https://svnweb.freebsd.org/changeset/base/302709 Log: hyperv/vmbus: Pack bool field into flags field MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7038 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:39:04 2016 (r302708) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 06:46:29 2016 (r302709) @@ -551,17 +551,6 @@ typedef struct hv_vmbus_channel { hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; - /* - * If batched_reading is set to "true", mask the interrupt - * and read until the channel is empty. - * If batched_reading is set to "false", the channel is not - * going to perform batched reading. - * - * Batched reading is enabled by default; specific - * drivers that don't want this behavior can turn it off. - */ - boolean_t batched_reading; - struct hypercall_sigevt_in *ch_sigevt; struct hyperv_dma ch_sigevt_dma; @@ -622,11 +611,23 @@ typedef struct hv_vmbus_channel { #define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) #define VMBUS_CHAN_FLAG_HASMNF 0x0001 +/* + * If this flag is set, this channel's interrupt will be masked in ISR, + * and the RX bufring will be drained before this channel's interrupt is + * unmasked. + * + * This flag is turned on by default. Drivers can turn it off according + * to their own requirement. + */ +#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 static inline void -hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t state) +hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) { - channel->batched_reading = state; + if (!on) + channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; + else + channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } int hv_vmbus_channel_recv_packet( Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:39:04 2016 (r302708) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:46:29 2016 (r302709) @@ -856,11 +856,13 @@ VmbusProcessChannelEvent(void* context, void* arg; uint32_t bytes_to_read; hv_vmbus_channel* channel = (hv_vmbus_channel*)context; - boolean_t is_batched_reading; + bool is_batched_reading = false; + + if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + is_batched_reading = true; if (channel->on_channel_callback != NULL) { arg = channel->channel_callback_context; - is_batched_reading = channel->batched_reading; /* * Optimize host to guest signaling by ensuring: * 1. While reading the channel, we disable interrupts from @@ -917,7 +919,7 @@ vmbus_event_flags_proc(struct vmbus_soft if (channel == NULL || channel->rxq == NULL) continue; - if (channel->batched_reading) + if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) hv_ring_buffer_read_begin(&channel->inbound); taskqueue_enqueue(channel->rxq, &channel->channel_task); } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:39:04 2016 (r302708) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 06:46:29 2016 (r302709) @@ -282,21 +282,19 @@ vmbus_channel_on_offer_internal(struct v { hv_vmbus_channel* new_channel; - /* Allocate the channel object and save this offer */ + /* + * Allocate the channel object and save this offer + */ new_channel = hv_vmbus_allocate_channel(sc); new_channel->ch_id = offer->child_rel_id; new_channel->ch_subidx = offer->offer.sub_channel_index; - if (offer->monitor_allocated) - new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_guid_type = offer->offer.interface_type; new_channel->ch_guid_inst = offer->offer.interface_instance; - /* - * By default we setup state to enable batched - * reading. A specific service can choose to - * disable this prior to opening the channel. - */ - new_channel->batched_reading = TRUE; + /* Batch reading is on by default */ + new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; + if (offer->monitor_allocated) + new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_sigevt = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), @@ -310,7 +308,6 @@ vmbus_channel_on_offer_internal(struct v return; } new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; - if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_sigevt->hc_connid = offer->connection_id; From owner-svn-src-head@freebsd.org Wed Jul 13 06:55:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1F6AB93C57; Wed, 13 Jul 2016 06:55:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 887F01AB3; Wed, 13 Jul 2016 06:55:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D6tLWV031935; Wed, 13 Jul 2016 06:55:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D6tL97031934; Wed, 13 Jul 2016 06:55:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130655.u6D6tL97031934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 06:55:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302710 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 06:55:23 -0000 Author: sephe Date: Wed Jul 13 06:55:21 2016 New Revision: 302710 URL: https://svnweb.freebsd.org/changeset/base/302710 Log: hyperv/vmbus: Remove unnecessary callback check. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7046 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:46:29 2016 (r302709) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 06:55:21 2016 (r302710) @@ -861,31 +861,29 @@ VmbusProcessChannelEvent(void* context, if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) is_batched_reading = true; - if (channel->on_channel_callback != NULL) { - arg = channel->channel_callback_context; - /* - * Optimize host to guest signaling by ensuring: - * 1. While reading the channel, we disable interrupts from - * host. - * 2. Ensure that we process all posted messages from the host - * before returning from this callback. - * 3. Once we return, enable signaling from the host. Once this - * state is set we check to see if additional packets are - * available to read. In this case we repeat the process. - */ - do { - if (is_batched_reading) - hv_ring_buffer_read_begin(&channel->inbound); - - channel->on_channel_callback(arg); - - if (is_batched_reading) - bytes_to_read = - hv_ring_buffer_read_end(&channel->inbound); - else - bytes_to_read = 0; - } while (is_batched_reading && (bytes_to_read != 0)); - } + arg = channel->channel_callback_context; + /* + * Optimize host to guest signaling by ensuring: + * 1. While reading the channel, we disable interrupts from + * host. + * 2. Ensure that we process all posted messages from the host + * before returning from this callback. + * 3. Once we return, enable signaling from the host. Once this + * state is set we check to see if additional packets are + * available to read. In this case we repeat the process. + */ + do { + if (is_batched_reading) + hv_ring_buffer_read_begin(&channel->inbound); + + channel->on_channel_callback(arg); + + if (is_batched_reading) + bytes_to_read = + hv_ring_buffer_read_end(&channel->inbound); + else + bytes_to_read = 0; + } while (is_batched_reading && (bytes_to_read != 0)); } static __inline void From owner-svn-src-head@freebsd.org Wed Jul 13 07:56:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68706B97B75; Wed, 13 Jul 2016 07:56:02 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3725B18CE; Wed, 13 Jul 2016 07:56:02 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D7u1Qc053904; Wed, 13 Jul 2016 07:56:01 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D7u1ad053903; Wed, 13 Jul 2016 07:56:01 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607130756.u6D7u1ad053903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 07:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302711 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 07:56:02 -0000 Author: ache Date: Wed Jul 13 07:56:01 2016 New Revision: 302711 URL: https://svnweb.freebsd.org/changeset/base/302711 Log: Fully back out r302594 case 2) since overflow may happens. Modified: head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Wed Jul 13 06:55:21 2016 (r302710) +++ head/usr.bin/tr/tr.c Wed Jul 13 07:56:01 2016 (r302711) @@ -266,7 +266,7 @@ endloop: */ s2.str = argv[1]; s2.state = NORMAL; - for (cnt = 0; cnt <= WINT_MAX; cnt++) { + for (cnt = 0; cnt < WINT_MAX; cnt++) { if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { From owner-svn-src-head@freebsd.org Wed Jul 13 08:13:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D49EB932D1; Wed, 13 Jul 2016 08:13:11 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E746315B0; Wed, 13 Jul 2016 08:13:10 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D8DAqF061150; Wed, 13 Jul 2016 08:13:10 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D8DAcs061147; Wed, 13 Jul 2016 08:13:10 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607130813.u6D8DAcs061147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 08:13:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302712 - in head/bin/sh: . tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 08:13:11 -0000 Author: ache Date: Wed Jul 13 08:13:09 2016 New Revision: 302712 URL: https://svnweb.freebsd.org/changeset/base/302712 Log: After removing collation for [a-z] ranges in r302512, do it here too. Approved by: jilles Modified: head/bin/sh/expand.c head/bin/sh/tests/builtins/case7.0 Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Wed Jul 13 07:56:01 2016 (r302711) +++ head/bin/sh/expand.c Wed Jul 13 08:13:09 2016 (r302712) @@ -107,7 +107,6 @@ static void expmeta(char *, char *, stru static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); static void cvtnum(int, char *); -static int collate_range_cmp(wchar_t, wchar_t); void emptyarglist(struct arglist *list) @@ -138,16 +137,6 @@ appendarglist(struct arglist *list, char list->args[list->count++] = str; } -static int -collate_range_cmp(wchar_t c1, wchar_t c2) -{ - static wchar_t s1[2], s2[2]; - - s1[0] = c1; - s2[0] = c2; - return (wcscoll(s1, s2)); -} - static char * stputs_quotes(const char *data, const char *syntax, char *p) { @@ -1359,9 +1348,7 @@ patmatch(const char *pattern, const char return 0; } else wc2 = (unsigned char)*p++; - if ( collate_range_cmp(chr, wc) >= 0 - && collate_range_cmp(chr, wc2) <= 0 - ) + if (wc <= chr && chr <= wc2) found = 1; } else { if (chr == wc) Modified: head/bin/sh/tests/builtins/case7.0 ============================================================================== --- head/bin/sh/tests/builtins/case7.0 Wed Jul 13 07:56:01 2016 (r302711) +++ head/bin/sh/tests/builtins/case7.0 Wed Jul 13 08:13:09 2016 (r302712) @@ -14,11 +14,6 @@ c1=e c2=$(printf '\366') case $c1$c2 in -[a-z][a-z]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2 in -[a-f][n-p]) ;; +[a-z][!a-z]) ;; *) echo wrong at $LINENO ;; esac From owner-svn-src-head@freebsd.org Wed Jul 13 08:30:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78940B93612; Wed, 13 Jul 2016 08:30:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FA3F1B3E; Wed, 13 Jul 2016 08:30:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D8UEUo065320; Wed, 13 Jul 2016 08:30:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D8UEDj065319; Wed, 13 Jul 2016 08:30:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130830.u6D8UEDj065319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 08:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302713 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 08:30:15 -0000 Author: sephe Date: Wed Jul 13 08:30:14 2016 New Revision: 302713 URL: https://svnweb.freebsd.org/changeset/base/302713 Log: hyperv/vmbus: Install different task function for batch/non-batch channels This avoids bunch of unnecessary checks on hot path and simplifies the channel processing. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7085 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 08:13:09 2016 (r302712) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 08:30:14 2016 (r302713) @@ -51,9 +51,10 @@ __FBSDID("$FreeBSD$"); #include static void vmbus_channel_set_event(hv_vmbus_channel* channel); -static void VmbusProcessChannelEvent(void* channel, int pending); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); +static void vmbus_chan_task(void *, int); +static void vmbus_chan_task_nobatch(void *, int); /** * @brief Trigger an event notification on the specified channel @@ -213,7 +214,13 @@ hv_vmbus_channel_open( new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->target_cpu); - TASK_INIT(&new_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); + if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { + TASK_INIT(&new_channel->channel_task, 0, + vmbus_chan_task, new_channel); + } else { + TASK_INIT(&new_channel->channel_task, 0, + vmbus_chan_task_nobatch, new_channel); + } /* Allocate the ring buffer */ out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), @@ -846,22 +853,16 @@ hv_vmbus_channel_recv_packet_raw( return (0); } - -/** - * Process a channel event notification - */ static void -VmbusProcessChannelEvent(void* context, int pending) +vmbus_chan_task(void *xchan, int pending __unused) { - void* arg; - uint32_t bytes_to_read; - hv_vmbus_channel* channel = (hv_vmbus_channel*)context; - bool is_batched_reading = false; + struct hv_vmbus_channel *chan = xchan; + void (*callback)(void *); + void *arg; - if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - is_batched_reading = true; + arg = chan->channel_callback_context; + callback = chan->on_channel_callback; - arg = channel->channel_callback_context; /* * Optimize host to guest signaling by ensuring: * 1. While reading the channel, we disable interrupts from @@ -871,19 +872,29 @@ VmbusProcessChannelEvent(void* context, * 3. Once we return, enable signaling from the host. Once this * state is set we check to see if additional packets are * available to read. In this case we repeat the process. + * + * NOTE: Interrupt has been disabled in the ISR. */ - do { - if (is_batched_reading) - hv_ring_buffer_read_begin(&channel->inbound); - - channel->on_channel_callback(arg); - - if (is_batched_reading) - bytes_to_read = - hv_ring_buffer_read_end(&channel->inbound); - else - bytes_to_read = 0; - } while (is_batched_reading && (bytes_to_read != 0)); + for (;;) { + uint32_t left; + + callback(arg); + + left = hv_ring_buffer_read_end(&chan->inbound); + if (left == 0) { + /* No more data in RX bufring; done */ + break; + } + hv_ring_buffer_read_begin(&chan->inbound); + } +} + +static void +vmbus_chan_task_nobatch(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + + chan->on_channel_callback(chan->channel_callback_context); } static __inline void From owner-svn-src-head@freebsd.org Wed Jul 13 08:49:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5393FB93C36; Wed, 13 Jul 2016 08:49:55 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3D78180E; Wed, 13 Jul 2016 08:49:54 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id o80so58018109wme.1; Wed, 13 Jul 2016 01:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=o8pb+CR3TMgdP2WCCAjLYnvRYdovsLwjqEJILrWClf8=; b=vqIDOiYGOQewU8a+bSV+6MQCKeFR17tV8MX+qzpo0HAtQHar0tRzwIz2mY5GzTMTaq sesH6TL46km0M31DoyfWx+e49rNf2n4fubnXp1of97btD9woIhpu/Pd3FteZiDL2E7OY KhV/rKE5QykCHmGWPek68VsuGPh0S0PhD8XviECMqy/heY09jgOvxz4dNw1i/pBVzMO0 bDaxmxSMDp3KVzYkhdzVnZ4xy564pQk+at4m3QCIId5V/1zsyB65XK4btmpoQWayDKmd jkewJYzWB/FVIwESY7NvQUzh98gtwfYXnSQaU8UeL0iFk6AUfzCRTtc7kulOTPuN6vO3 ouaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=o8pb+CR3TMgdP2WCCAjLYnvRYdovsLwjqEJILrWClf8=; b=KqnhfWtkblcdAWeO3d5azvXr+U5HksTsOxySB0/8nwrbNbD4bB7TkhzmBthMk+yjGr +ZgD1sbuFa9GNL03dhwatFzjj02hoHJijFHbup9Mh84NvmStepXNbhlpioimIZnYSCG/ uVUMRkxejuwOUUh3oMHaYBnq+s8u+KUY+Xr1Q0bpQf9YIB88Eb5evtqrjoNv9LilgKS3 i6v5A57xvHgFx8m4U6O+aKb6AYRweY1uGWN4UBeKYAOTtqBmwimBYx+INQNsdu5xKNWe nG5Qq5nqNHjLZ7jZ83CGNHWb1KOwgioVY6DlIhRxOba+nlkxaOuWHApN1HVUNk1/hPZn 3tug== X-Gm-Message-State: ALyK8tIt11oihfGZJqhp/g3ZPU1zGCqbGNUc0DoakBrpAO4fYPZR14xc0H4BEfccxonjlg== X-Received: by 10.28.199.205 with SMTP id x196mr8626816wmf.96.1468399792822; Wed, 13 Jul 2016 01:49:52 -0700 (PDT) Received: from localhost (126.red-79-152-23.dynamicip.rima-tde.net. [79.152.23.126]) by smtp.gmail.com with ESMTPSA id o142sm35184629wme.20.2016.07.13.01.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2016 01:49:52 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Wed, 13 Jul 2016 10:49:47 +0200 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302350 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20160713084947.a4nfb6obr475pah6@mac> References: <201607051847.u65IlIYf000901@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607051847.u65IlIYf000901@repo.freebsd.org> User-Agent: Mutt/1.6.2-neo (2016-06-11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 08:49:55 -0000 On Tue, Jul 05, 2016 at 06:47:18PM +0000, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Jul 5 18:47:17 2016 > New Revision: 302350 > URL: https://svnweb.freebsd.org/changeset/base/302350 > > Log: > The paradigm of a callout is that it has three consequent states: > not scheduled -> scheduled -> running -> not scheduled. The API and the > manual page assume that, some comments in the code assume that, and looks > like some contributors to the code also did. The problem is that this > paradigm isn't true. A callout can be scheduled and running at the same > time, which makes API description ambigouous. In such case callout_stop() > family of functions/macros should return 1 and 0 at the same time, since it > successfully unscheduled future callout but the current one is running. > Before this change we returned 1 in such a case, with an exception that > if running callout was migrating we returned 0, unless CS_MIGRBLOCK was > specified. > > With this change, we now return 0 in case if future callout was unscheduled, > but another one is still in action, indicating to API users that resources > are not yet safe to be freed. > > However, the sleepqueue code relies on getting 1 return code in that case, > and there already was CS_MIGRBLOCK flag, that covered one of the edge cases. > In the new return path we will also use this flag, to keep sleepqueue safe. > > Since the flag CS_MIGRBLOCK doesn't block migration and now isn't limited to > migration edge case, rename it to CS_EXECUTING. > > This change fixes panics on a high loaded TCP server. > > Reviewed by: jch, hselasky, rrs, kib > Approved by: re (gjb) > Differential Revision: https://reviews.freebsd.org/D7042 This change triggers a KASSERT when resuming a Xen VM from suspension: panic: bogus refcnt 0 on lle 0xfffff800035b9c00 cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa800 vpanic() at vpanic+0x182/frame 0xfffffe001d2fa880 kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa8f0 llentry_free() at llentry_free+0x136/frame 0xfffffe001d2fa920 in_lltable_free_entry() at in_lltable_free_entry+0xb0/frame 0xfffffe001d2fa950 arp_ifinit() at arp_ifinit+0x54/frame 0xfffffe001d2fa980 netfront_backend_changed() at netfront_backend_changed+0x154/frame 0xfffffe001d2faa50 xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfffffe001d2faa70 fork_exit() at fork_exit+0x84/frame 0xfffffe001d2faab0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe001d2faab0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- This seems to be caused by the following snipped in xen-netfront, which is used by netfront in order to send a gratuitous ARP after recovering from migration, in order for the bridge in the host to cache the MAC of the domain. TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { arp_ifinit(ifp, ifa); } } FWIW, this was working fine before this change, so I'm afraid this change triggered some kind of bug in the lle entries. Roger. From owner-svn-src-head@freebsd.org Wed Jul 13 08:53:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87308B97083 for ; Wed, 13 Jul 2016 08:53:36 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-153.reflexion.net [208.70.211.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 401761D45 for ; Wed, 13 Jul 2016 08:53:35 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 4756 invoked from network); 13 Jul 2016 08:53:30 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 13 Jul 2016 08:53:30 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.90.3) with SMTP; Wed, 13 Jul 2016 04:54:18 -0400 (EDT) Received: (qmail 15942 invoked from network); 13 Jul 2016 08:54:18 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 13 Jul 2016 08:54:18 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 3F1AA1C405F; Wed, 13 Jul 2016 01:53:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [clang 3.8.0: powerpc has odd mix of signed wchar_t and unsigned char] From: Mark Millard In-Reply-To: Date: Wed, 13 Jul 2016 01:53:27 -0700 Cc: svn-src-head@freebsd.org, FreeBSD Current , freebsd-stable@freebsd.org, freebsd-arm , FreeBSD PowerPC ML , Bruce Evans , FreeBSD Toolchain Content-Transfer-Encoding: quoted-printable Message-Id: <38CF2C28-3BD1-4D09-939F-4DD0C2E8B58F@dsl-only.net> References: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> To: Andrey Chernov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 08:53:36 -0000 [The below does note that TARGET=3Dpowerpc has a mix of signed wchar_t = and unsigned char types and most architectures have both being signed = types.] On 2016-Jul-11, at 8:57 PM, Andrey Chernov wrote: > On 12.07.2016 5:44, Mark Millard wrote: >> My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: >>=20 >> A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion of >> ___wchar_t (if that is distinct). >> B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; = not >> necessarily a valid char value >> C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; = not >> necessarily a valid char value >=20 > It seems you are right about "not a valid char value", I'll back this > change out. >=20 >> As far as I know arm FreeBSD uses unsigned character types (of = whatever >> width). >=20 > Probably it should be unsigned for other architectures too, clang does > not generate negative values with L'' literals and locale use = only > positive values too. Looking around: # grep -i wchar sys/*/include/_types.h sys/arm/include/_types.h:typedef unsigned int ___wchar_t; sys/arm/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ sys/arm/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ sys/arm64/include/_types.h:typedef unsigned int ___wchar_t; sys/arm64/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ sys/arm64/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ sys/mips/include/_types.h:typedef int ___wchar_t; sys/mips/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/mips/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ sys/powerpc/include/_types.h:typedef int ___wchar_t; sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ sys/riscv/include/_types.h:typedef int ___wchar_t; sys/riscv/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/riscv/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ sys/sparc64/include/_types.h:typedef int ___wchar_t; sys/sparc64/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/sparc64/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ sys/x86/include/_types.h:typedef int ___wchar_t; sys/x86/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/x86/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ So only arm and arm64 have unsigned wchar_t types. [NOTE: __CHAR16_TYPE__ and __CHAR32_TYPE__ are always unsigned: in C++11 = terms char16_t is like std::uint_least16_t and char32_t is like = std::uint_least32_t despite being distinct types. So __CHAR16_TYPE__ and = __CHAR32_TYPE__ are ignored below.] The clang 3.8.0 compiler output has an odd mix for TARGET_ARCH=3Dpowerpc = and TARGET_ARCH=3Dpowerpc64 . . . armv6 has unsigned types for both char and __WCHAR_TYPE__. aarch64 has unsigned types for both char and __WCHAR_TYPE__. powerpc has unsigned for char but signed for __WCHAR_TYPE__. powerpc64 has unsigned for char but signed for __WCHAR_TYPE__. amd64 has signed types for both char and __WCHAR_TYPE__. i386 has signed types for both char and __WCHAR_TYPE__. mips has signed types for both char and __WCHAR_TYPE__. sparc64 has signed types for both char and __WCHAR_TYPE__. (riscv is not covered by clang as I understand) The details via compiler #define's. . . # clang --target=3Darmv6-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ . . . #define __CHAR_BIT__ 8 #define __CHAR_UNSIGNED__ 1 . . . #define __WCHAR_MAX__ 4294967295U #define __WCHAR_TYPE__ unsigned int #define __WCHAR_UNSIGNED__ 1 #define __WCHAR_WIDTH__ 32 . . . # clang --target=3Daarch64-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ . . . #define __CHAR_BIT__ 8 #define __CHAR_UNSIGNED__ 1 . . . #define __WCHAR_MAX__ 4294967295U #define __WCHAR_TYPE__ unsigned int #define __WCHAR_UNSIGNED__ 1 #define __WCHAR_WIDTH__ 32 . . . # clang --target=3Dpowerpc-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ . . . #define __CHAR_BIT__ 8 #define __CHAR_UNSIGNED__ 1 . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . Is powerpc wrong? # clang --target=3Dpowerpc64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more . . . #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ . . . #define __CHAR_BIT__ 8 #define __CHAR_UNSIGNED__ 1 . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . Is powerpc64 wrong? # clang --target=3Damd64-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ . . . #define __CHAR_BIT__ 8 . . . (note the lack of __CHAR_UNSIGNED__) . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . # clang --target=3Di386-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ . . . #define __CHAR_BIT__ 8 . . . (note the lack of __CHAR_UNSIGNED__) . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . # clang --target=3Dmips-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ . . . #define __CHAR_BIT__ 8 . . . (note the lack of __CHAR_UNSIGNED__) . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . # clang --target=3Dsparc64-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ . . . #define __CHAR_BIT__ 8 . . . (note the lack of __CHAR_UNSIGNED__) . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . (note the lack of __WCHAR_UNSIGNED__) . . . =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-svn-src-head@freebsd.org Wed Jul 13 09:11:04 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC35FB97C38; Wed, 13 Jul 2016 09:11:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE3571869; Wed, 13 Jul 2016 09:11:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D9B3Gm080548; Wed, 13 Jul 2016 09:11:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D9B3pP080545; Wed, 13 Jul 2016 09:11:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130911.u6D9B3pP080545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 09:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302723 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:11:05 -0000 Author: sephe Date: Wed Jul 13 09:11:03 2016 New Revision: 302723 URL: https://svnweb.freebsd.org/changeset/base/302723 Log: hyperv: All Hypercall parameters have same alignment requirement. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7086 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hyperv_reg.h head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:09:34 2016 (r302722) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:11:03 2016 (r302723) @@ -298,7 +298,7 @@ vmbus_channel_on_offer_internal(struct v new_channel->ch_sigevt = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_SIGEVTIN_ALIGN, 0, sizeof(struct hypercall_sigevt_in), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hypercall_sigevt_in), &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); if (new_channel->ch_sigevt == NULL) { device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Jul 13 09:09:34 2016 (r302722) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Jul 13 09:11:03 2016 (r302723) @@ -153,13 +153,22 @@ /* * Hypercall input parameters */ +#define HYPERCALL_PARAM_ALIGN 8 +#if 0 +/* + * XXX + * <> requires + * input parameters size to be multiple of 8, however, many post + * message input parameters do _not_ meet this requirement. + */ +#define HYPERCALL_PARAM_SIZE_ALIGN 8 +#endif /* * HYPERCALL_POST_MESSAGE */ #define HYPERCALL_POSTMSGIN_DSIZE_MAX 240 #define HYPERCALL_POSTMSGIN_SIZE 256 -#define HYPERCALL_POSTMSGIN_ALIGN 8 struct hypercall_postmsg_in { uint32_t hc_connid; @@ -173,8 +182,6 @@ CTASSERT(sizeof(struct hypercall_postmsg /* * HYPERCALL_SIGNAL_EVENT */ -#define HYPERCALL_SIGEVTIN_ALIGN 8 - struct hypercall_sigevt_in { uint32_t hc_connid; uint16_t hc_evtflag_ofs; Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 09:09:34 2016 (r302722) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 09:11:03 2016 (r302723) @@ -130,7 +130,7 @@ vmbus_msghc_alloc(bus_dma_tag_t parent_d mh = malloc(sizeof(*mh), M_DEVBUF, M_WAITOK | M_ZERO); mh->mh_inprm = hyperv_dmamem_alloc(parent_dtag, - HYPERCALL_POSTMSGIN_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, + HYPERCALL_PARAM_ALIGN, 0, HYPERCALL_POSTMSGIN_SIZE, &mh->mh_inprm_dma, BUS_DMA_WAITOK); if (mh->mh_inprm == NULL) { free(mh, M_DEVBUF); From owner-svn-src-head@freebsd.org Wed Jul 13 09:19:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAA97B9322B; Wed, 13 Jul 2016 09:19:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C19D15F0; Wed, 13 Jul 2016 09:19:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D9JYEk084794; Wed, 13 Jul 2016 09:19:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D9JYro084788; Wed, 13 Jul 2016 09:19:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130919.u6D9JYro084788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 09:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302726 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:19:35 -0000 Author: sephe Date: Wed Jul 13 09:19:33 2016 New Revision: 302726 URL: https://svnweb.freebsd.org/changeset/base/302726 Log: hyperv: Signal event input parameter is shared w/ MNF MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7087 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/hyperv_reg.h head/sys/dev/hyperv/vmbus/hyperv_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 09:19:33 2016 (r302726) @@ -551,8 +551,8 @@ typedef struct hv_vmbus_channel { hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; - struct hypercall_sigevt_in *ch_sigevt; - struct hyperv_dma ch_sigevt_dma; + struct hyperv_mon_param *ch_monprm; + struct hyperv_dma ch_monprm_dma; /* * From Win8, this field specifies the target virtual process Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 09:19:33 2016 (r302726) @@ -76,7 +76,7 @@ vmbus_channel_set_event(hv_vmbus_channel (uint32_t *)&monitor_page-> trigger_group[channel->monitor_group].u.pending); } else { - hypercall_signal_event(channel->ch_sigevt_dma.hv_paddr); + hypercall_signal_event(channel->ch_monprm_dma.hv_paddr); } } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:19:33 2016 (r302726) @@ -296,20 +296,20 @@ vmbus_channel_on_offer_internal(struct v if (offer->monitor_allocated) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; - new_channel->ch_sigevt = hyperv_dmamem_alloc( + new_channel->ch_monprm = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hypercall_sigevt_in), - &new_channel->ch_sigevt_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (new_channel->ch_sigevt == NULL) { - device_printf(sc->vmbus_dev, "sigevt alloc failed\n"); + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &new_channel->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (new_channel->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); /* XXX */ mtx_destroy(&new_channel->sc_lock); free(new_channel, M_DEVBUF); return; } - new_channel->ch_sigevt->hc_connid = VMBUS_CONNID_EVENT; + new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_sigevt->hc_connid = offer->connection_id; + new_channel->ch_monprm->mp_connid = offer->connection_id; new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/vmbus/hyperv.c Wed Jul 13 09:19:33 2016 (r302726) @@ -109,10 +109,10 @@ hypercall_post_message(bus_addr_t msg_pa } uint64_t -hypercall_signal_event(bus_addr_t sigevt_paddr) +hypercall_signal_event(bus_addr_t monprm_paddr) { return hypercall_md(hypercall_context.hc_addr, - HYPERCALL_SIGNAL_EVENT, sigevt_paddr, 0); + HYPERCALL_SIGNAL_EVENT, monprm_paddr, 0); } int Modified: head/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/vmbus/hyperv_reg.h Wed Jul 13 09:19:33 2016 (r302726) @@ -133,6 +133,15 @@ #define CPUID_LEAF_HV_HWFEATURES 0x40000006 /* + * Hyper-V Monitor Notification Facility + */ +struct hyperv_mon_param { + uint32_t mp_connid; + uint16_t mp_evtflag_ofs; + uint16_t mp_rsvd; +} __packed; + +/* * Hyper-V message types */ #define HYPERV_MSGTYPE_NONE 0 @@ -181,11 +190,8 @@ CTASSERT(sizeof(struct hypercall_postmsg /* * HYPERCALL_SIGNAL_EVENT + * + * struct hyperv_mon_param. */ -struct hypercall_sigevt_in { - uint32_t hc_connid; - uint16_t hc_evtflag_ofs; - uint16_t hc_rsvd; -} __packed; #endif /* !_HYPERV_REG_H_ */ Modified: head/sys/dev/hyperv/vmbus/hyperv_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv_var.h Wed Jul 13 09:15:12 2016 (r302725) +++ head/sys/dev/hyperv/vmbus/hyperv_var.h Wed Jul 13 09:19:33 2016 (r302726) @@ -39,6 +39,6 @@ extern u_int hyperv_features; extern u_int hyperv_recommends; uint64_t hypercall_post_message(bus_addr_t msg_paddr); -uint64_t hypercall_signal_event(bus_addr_t sigevt_paddr); +uint64_t hypercall_signal_event(bus_addr_t monprm_paddr); #endif /* !_HYPERV_VAR_H_ */ From owner-svn-src-head@freebsd.org Wed Jul 13 09:28:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2968B938D5; Wed, 13 Jul 2016 09:28:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B019213B1; Wed, 13 Jul 2016 09:28:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D9Sk0b088620; Wed, 13 Jul 2016 09:28:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D9SkSt088614; Wed, 13 Jul 2016 09:28:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130928.u6D9SkSt088614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 09:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302731 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:28:48 -0000 Author: sephe Date: Wed Jul 13 09:28:46 2016 New Revision: 302731 URL: https://svnweb.freebsd.org/changeset/base/302731 Log: hyperv/vmbus: Reorganize MNF event sending. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7088 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_reg.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 09:28:46 2016 (r302731) @@ -523,12 +523,13 @@ typedef struct hv_vmbus_channel { hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ + /* * These are based on the offer_msg.monitor_id. * Save it here for easy access. */ - uint8_t monitor_group; - uint8_t monitor_bit; + int ch_montrig_idx; /* MNF trig index */ + uint32_t ch_montrig_mask;/* MNF trig mask */ uint32_t ring_buffer_gpadl_handle; /* Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 09:28:46 2016 (r302731) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_channel_set_event(hv_vmbus_channel* channel); +static void vmbus_chan_send_event(hv_vmbus_channel* channel); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); static void vmbus_chan_task(void *, int); @@ -60,7 +60,7 @@ static void vmbus_chan_task_nobatch(void * @brief Trigger an event notification on the specified channel */ static void -vmbus_channel_set_event(hv_vmbus_channel *channel) +vmbus_chan_send_event(hv_vmbus_channel *channel) { struct vmbus_softc *sc = channel->vmbus_sc; uint32_t chanid = channel->ch_id; @@ -69,16 +69,12 @@ vmbus_channel_set_event(hv_vmbus_channel 1UL << (chanid & VMBUS_EVTFLAG_MASK)); if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - hv_vmbus_monitor_page *monitor_page; - - monitor_page = sc->vmbus_mnf2; - synch_set_bit(channel->monitor_bit, - (uint32_t *)&monitor_page-> - trigger_group[channel->monitor_group].u.pending); + atomic_set_int( + &sc->vmbus_mnf2->mnf_trigs[channel->ch_montrig_idx].mt_pending, + channel->ch_montrig_mask); } else { hypercall_signal_event(channel->ch_monprm_dma.hv_paddr); } - } static int @@ -622,9 +618,8 @@ hv_vmbus_channel_send_packet( &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } @@ -690,9 +685,8 @@ hv_vmbus_channel_send_packet_pagebuffer( &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } @@ -766,9 +760,8 @@ hv_vmbus_channel_send_packet_multipagebu &need_sig); /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) { - vmbus_channel_set_event(channel); - } + if (ret == 0 && need_sig) + vmbus_chan_send_event(channel); return (ret); } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:28:46 2016 (r302731) @@ -311,8 +311,14 @@ vmbus_channel_on_offer_internal(struct v if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_monprm->mp_connid = offer->connection_id; - new_channel->monitor_group = (uint8_t) offer->monitor_id / 32; - new_channel->monitor_bit = (uint8_t) offer->monitor_id % 32; + if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + new_channel->ch_montrig_idx = + offer->monitor_id / VMBUS_MONTRIG_LEN; + if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + panic("invalid monitor id %u", offer->monitor_id); + new_channel->ch_montrig_mask = + 1 << (offer->monitor_id % VMBUS_MONTRIG_LEN); + } /* Select default cpu for this channel. */ vmbus_channel_select_defcpu(new_channel); Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 13 09:28:46 2016 (r302731) @@ -835,7 +835,8 @@ vmbus_dma_alloc(struct vmbus_softc *sc) return ENOMEM; sc->vmbus_mnf2 = hyperv_dmamem_alloc(parent_dtag, PAGE_SIZE, 0, - PAGE_SIZE, &sc->vmbus_mnf2_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + sizeof(struct vmbus_mnf), &sc->vmbus_mnf2_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (sc->vmbus_mnf2 == NULL) return ENOMEM; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:28:46 2016 (r302731) @@ -72,6 +72,34 @@ struct vmbus_evtflags { CTASSERT(sizeof(struct vmbus_evtflags) == VMBUS_EVTFLAGS_SIZE); /* + * Hyper-V Monitor Notification Facility + */ + +struct vmbus_mon_trig { + uint32_t mt_pending; + uint32_t mt_armed; +} __packed; + +#define VMBUS_MONTRIGS_MAX 4 +#define VMBUS_MONTRIG_LEN 32 + +struct vmbus_mnf { + uint32_t mnf_state; + uint32_t mnf_rsvd1; + + struct vmbus_mon_trig mnf_trigs[VMBUS_MONTRIGS_MAX]; + uint8_t mnf_rsvd2[536]; + + uint16_t mnf_lat[VMBUS_MONTRIGS_MAX][VMBUS_MONTRIG_LEN]; + uint8_t mnf_rsvd3[256]; + + struct hyperv_mon_param + mnf_param[VMBUS_MONTRIGS_MAX][VMBUS_MONTRIG_LEN]; + uint8_t mnf_rsvd4[1984]; +} __packed; +CTASSERT(sizeof(struct vmbus_mnf) == PAGE_SIZE); + +/* * Channel */ Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Jul 13 09:26:33 2016 (r302730) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Jul 13 09:28:46 2016 (r302731) @@ -71,7 +71,7 @@ struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); u_long *vmbus_tx_evtflags; /* event flags to host */ - void *vmbus_mnf2; /* monitored by host */ + struct vmbus_mnf *vmbus_mnf2; /* monitored by host */ u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ From owner-svn-src-head@freebsd.org Wed Jul 13 09:36:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87ABCB93EB6; Wed, 13 Jul 2016 09:36:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DC5C1BBF; Wed, 13 Jul 2016 09:36:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D9akHJ092252; Wed, 13 Jul 2016 09:36:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D9akRP092251; Wed, 13 Jul 2016 09:36:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130936.u6D9akRP092251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 09:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302733 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:36:47 -0000 Author: sephe Date: Wed Jul 13 09:36:46 2016 New Revision: 302733 URL: https://svnweb.freebsd.org/changeset/base/302733 Log: hyperv/vmbus: Remove unused code MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7089 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 09:35:43 2016 (r302732) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 13 09:36:46 2016 (r302733) @@ -97,67 +97,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -typedef union { - uint32_t as_uint32_t; - struct { - uint32_t group_enable :4; - uint32_t rsvd_z :28; - } u; -} hv_vmbus_monitor_trigger_state; - -typedef union { - uint64_t as_uint64_t; - struct { - uint32_t pending; - uint32_t armed; - } u; -} hv_vmbus_monitor_trigger_group; - -typedef struct { - hv_vmbus_connection_id connection_id; - uint16_t flag_number; - uint16_t rsvd_z; -} hv_vmbus_monitor_parameter; - -/* - * hv_vmbus_monitor_page Layout - * ------------------------------------------------------ - * | 0 | trigger_state (4 bytes) | Rsvd1 (4 bytes) | - * | 8 | trigger_group[0] | - * | 10 | trigger_group[1] | - * | 18 | trigger_group[2] | - * | 20 | trigger_group[3] | - * | 28 | Rsvd2[0] | - * | 30 | Rsvd2[1] | - * | 38 | Rsvd2[2] | - * | 40 | next_check_time[0][0] | next_check_time[0][1] | - * | ... | - * | 240 | latency[0][0..3] | - * | 340 | Rsvz3[0] | - * | 440 | parameter[0][0] | - * | 448 | parameter[0][1] | - * | ... | - * | 840 | Rsvd4[0] | - * ------------------------------------------------------ - */ - -typedef struct { - hv_vmbus_monitor_trigger_state trigger_state; - uint32_t rsvd_z1; - - hv_vmbus_monitor_trigger_group trigger_group[4]; - uint64_t rsvd_z2[3]; - - int32_t next_check_time[4][32]; - - uint16_t latency[4][32]; - uint64_t rsvd_z3[32]; - - hv_vmbus_monitor_parameter parameter[4][32]; - - uint8_t rsvd_z4[1984]; -} hv_vmbus_monitor_page; - /* * Private, VM Bus functions */ From owner-svn-src-head@freebsd.org Wed Jul 13 09:44:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E0C3B975CD; Wed, 13 Jul 2016 09:44:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45C9618B8; Wed, 13 Jul 2016 09:44:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D9iOew095954; Wed, 13 Jul 2016 09:44:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D9iOVN095952; Wed, 13 Jul 2016 09:44:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130944.u6D9iOVN095952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 09:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302737 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:44:25 -0000 Author: sephe Date: Wed Jul 13 09:44:24 2016 New Revision: 302737 URL: https://svnweb.freebsd.org/changeset/base/302737 Log: hyperv/vmbus: Cleanup channel rescind MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7090 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:41:04 2016 (r302736) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 09:44:24 2016 (r302737) @@ -47,10 +47,10 @@ static void vmbus_chan_detach_task(void static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); /** * Channel message dispatch table @@ -60,7 +60,7 @@ vmbus_chanmsg_process[HV_CHANNEL_MESSAGE [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] = vmbus_channel_on_offer, [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] = - vmbus_channel_on_offer_rescind, + vmbus_chan_msgproc_chrescind, [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = vmbus_channel_on_offers_delivered, [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = @@ -326,33 +326,34 @@ vmbus_channel_on_offer_internal(struct v vmbus_channel_process_offer(new_channel); } -/** - * @brief Rescind offer handler. - * - * We queue a work item to process this offer - * synchronously. - * +/* * XXX pretty broken; need rework. */ static void -vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, +vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_rescind_offer *rescind; - hv_vmbus_channel* channel; + const struct vmbus_chanmsg_chrescind *note; + struct hv_vmbus_channel *chan; + + note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; + if (note->chm_chanid > VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n", + note->chm_chanid); + return; + } - rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u rescind\n", - rescind->child_rel_id); + device_printf(sc->vmbus_dev, "chan%u rescinded\n", + note->chm_chanid); } - channel = sc->vmbus_chmap[rescind->child_rel_id]; - if (channel == NULL) - return; - sc->vmbus_chmap[rescind->child_rel_id] = NULL; + chan = sc->vmbus_chmap[note->chm_chanid]; + if (chan == NULL) + return; + sc->vmbus_chmap[note->chm_chanid] = NULL; - taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); + taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task); } static void Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:41:04 2016 (r302736) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Wed Jul 13 09:44:24 2016 (r302737) @@ -117,10 +117,11 @@ struct vmbus_gpa_range { /* * Channel messages - * - Embedded in vmbus_message.msg_data, e.g. response. + * - Embedded in vmbus_message.msg_data, e.g. response and notification. * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ @@ -241,4 +242,10 @@ struct vmbus_chanmsg_chfree { uint32_t chm_chanid; } __packed; +/* VMBUS_CHANMSG_TYPE_CHRESCIND */ +struct vmbus_chanmsg_chrescind { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; +} __packed; + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Wed Jul 13 09:52:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B241B97B92; Wed, 13 Jul 2016 09:52:11 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B27D01518; Wed, 13 Jul 2016 09:52:10 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 8A4241FE024; Wed, 13 Jul 2016 11:52:08 +0200 (CEST) Subject: Re: svn commit: r302350 - in head: share/man/man9 sys/kern sys/sys To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Gleb Smirnoff References: <201607051847.u65IlIYf000901@repo.freebsd.org> <20160713084947.a4nfb6obr475pah6@mac> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: Date: Wed, 13 Jul 2016 11:56:01 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20160713084947.a4nfb6obr475pah6@mac> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 09:52:11 -0000 On 07/13/16 10:49, Roger Pau Monn wrote: > On Tue, Jul 05, 2016 at 06:47:18PM +0000, Gleb Smirnoff wrote: >> Author: glebius >> Date: Tue Jul 5 18:47:17 2016 >> New Revision: 302350 >> URL: https://svnweb.freebsd.org/changeset/base/302350 >> >> Log: >> The paradigm of a callout is that it has three consequent states: >> not scheduled -> scheduled -> running -> not scheduled. The API and the >> manual page assume that, some comments in the code assume that, and looks >> like some contributors to the code also did. The problem is that this >> paradigm isn't true. A callout can be scheduled and running at the same >> time, which makes API description ambigouous. In such case callout_stop() >> family of functions/macros should return 1 and 0 at the same time, since it >> successfully unscheduled future callout but the current one is running. >> Before this change we returned 1 in such a case, with an exception that >> if running callout was migrating we returned 0, unless CS_MIGRBLOCK was >> specified. >> >> With this change, we now return 0 in case if future callout was unscheduled, >> but another one is still in action, indicating to API users that resources >> are not yet safe to be freed. >> >> However, the sleepqueue code relies on getting 1 return code in that case, >> and there already was CS_MIGRBLOCK flag, that covered one of the edge cases. >> In the new return path we will also use this flag, to keep sleepqueue safe. >> >> Since the flag CS_MIGRBLOCK doesn't block migration and now isn't limited to >> migration edge case, rename it to CS_EXECUTING. >> >> This change fixes panics on a high loaded TCP server. >> >> Reviewed by: jch, hselasky, rrs, kib >> Approved by: re (gjb) >> Differential Revision: https://reviews.freebsd.org/D7042 > > This change triggers a KASSERT when resuming a Xen VM from suspension: > > panic: bogus refcnt 0 on lle 0xfffff800035b9c00 > cpuid = 0 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa800 > vpanic() at vpanic+0x182/frame 0xfffffe001d2fa880 > kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa8f0 > llentry_free() at llentry_free+0x136/frame 0xfffffe001d2fa920 > in_lltable_free_entry() at in_lltable_free_entry+0xb0/frame 0xfffffe001d2fa950 > arp_ifinit() at arp_ifinit+0x54/frame 0xfffffe001d2fa980 > netfront_backend_changed() at netfront_backend_changed+0x154/frame 0xfffffe001d2faa50 > xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfffffe001d2faa70 > fork_exit() at fork_exit+0x84/frame 0xfffffe001d2faab0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe001d2faab0 > --- trap 0, rip = 0, rsp = 0, rbp = 0 --- > > This seems to be caused by the following snipped in xen-netfront, which is > used by netfront in order to send a gratuitous ARP after recovering from > migration, in order for the bridge in the host to cache the MAC of the > domain. > > TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { > if (ifa->ifa_addr->sa_family == AF_INET) { > arp_ifinit(ifp, ifa); > } > } > > FWIW, this was working fine before this change, so I'm afraid this change > triggered some kind of bug in the lle entries. > > Roger. > Hi, > static void > nd6_llinfo_settimer_locked(struct llentry *ln, long tick) > { > int canceled; > > LLE_WLOCK_ASSERT(ln); > > if (tick < 0) { > ln->la_expire = 0; > ln->ln_ntick = 0; > canceled = callout_stop(&ln->lle_timer); > } else { > ln->la_expire = time_uptime + tick / hz; > LLE_ADDREF(ln); > if (tick > INT_MAX) { > ln->ln_ntick = tick - INT_MAX; > canceled = callout_reset(&ln->lle_timer, INT_MAX, > nd6_llinfo_timer, ln); > } else { > ln->ln_ntick = 0; > canceled = callout_reset(&ln->lle_timer, tick, > nd6_llinfo_timer, ln); > } > } > if (canceled > 0) > LLE_REMREF(ln); > } Like stated in D7042, there are dependencies in the code that expects callout_reset() to work like this: int callout_reset() { atomic_lock(); retval = callout_stop(); restart callout(); atomic_unlock(); return (retval); } As you can see in the piece of code above. r302350 fundamentally changes that. D7042 has many open questions that are not answered and I think it should be reverted from head and 11-stable until the discussions are complete. I believe the problems found should be fixed in the TCP stack, using locked callouts instead of unlocked. --HPS From owner-svn-src-head@freebsd.org Wed Jul 13 10:01:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B786B97ECE; Wed, 13 Jul 2016 10:01:32 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 254FF1BF4; Wed, 13 Jul 2016 10:01:32 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DA1VNX001038; Wed, 13 Jul 2016 10:01:31 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DA1Vco001037; Wed, 13 Jul 2016 10:01:31 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607131001.u6DA1Vco001037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 10:01:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302742 - head/contrib/one-true-awk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 10:01:32 -0000 Author: ache Date: Wed Jul 13 10:01:31 2016 New Revision: 302742 URL: https://svnweb.freebsd.org/changeset/base/302742 Log: After removing collation for [a-z] ranges in r302512, do it here too. I'll try to keep the change very minimal to not touch contribed code much. I'll send it upstream when it will be merged to main branches, but we need the change right now here. Modified: head/contrib/one-true-awk/b.c Modified: head/contrib/one-true-awk/b.c ============================================================================== --- head/contrib/one-true-awk/b.c Wed Jul 13 09:50:17 2016 (r302741) +++ head/contrib/one-true-awk/b.c Wed Jul 13 10:01:31 2016 (r302742) @@ -296,7 +296,11 @@ static int collate_range_cmp(int a, int return 0; s[0][0] = a; s[1][0] = b; +#ifdef __FreeBSD__ + return (strcmp(s[0], s[1])); +#else return (strcoll(s[0], s[1])); +#endif } char *cclenter(const char *argp) /* add a character class */ From owner-svn-src-head@freebsd.org Wed Jul 13 10:07:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66C86B9340E; Wed, 13 Jul 2016 10:07:32 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FA1818D9; Wed, 13 Jul 2016 10:07:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 45C141FE024; Wed, 13 Jul 2016 12:07:29 +0200 (CEST) Subject: Re: svn commit: r302350 - in head: share/man/man9 sys/kern sys/sys To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Gleb Smirnoff References: <201607051847.u65IlIYf000901@repo.freebsd.org> <20160713084947.a4nfb6obr475pah6@mac> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <8ed4b78f-71d3-9051-d435-ad0f9f3af124@selasky.org> Date: Wed, 13 Jul 2016 12:11:21 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 10:07:32 -0000 Hi, Can we agree on the following return values for callout_stop() and callout_reset() and their variants: If the callout was scheduled regardless of being serviced or not, .Dv CALLOUT_RET_CANCELLED is returned. If the callout was stopped and is still being serviced .Dv CALLOUT_RET_DRAINING is returned. If the callout was stopped and is no longer being serviced .Dv CALLOUT_RET_STOPPED is returned. --HPS From owner-svn-src-head@freebsd.org Wed Jul 13 11:54:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94194B97F9B; Wed, 13 Jul 2016 11:54:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [198.74.231.69]) by mx1.freebsd.org (Postfix) with ESMTP id 769C71EBC; Wed, 13 Jul 2016 11:54:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [198.74.231.63]) by cyrus.watson.org (Postfix) with ESMTPS id 7591946B51; Wed, 13 Jul 2016 07:54:02 -0400 (EDT) Date: Wed, 13 Jul 2016 12:54:01 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Garrett Cooper cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302577 - head/sys/dev/drm2 In-Reply-To: <201607111701.u6BH189R083052@repo.freebsd.org> Message-ID: References: <201607111701.u6BH189R083052@repo.freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 11:54:03 -0000 On Mon, 11 Jul 2016, Garrett Cooper wrote: > Add missing default case to capable(..) function definition > > By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN > aren't possible. Add in a KASSERT safety belt and return false in > !INVARIANTS case if an invalid value is passed in, as it would be a > programmer error. > > This fixes a -Wreturn-type error with gcc 5.3.0. > > Differential Revision: https://reviews.freebsd.org/D7188 > MFC after: 1 week > Reported by: devel/amd64-gcc (5.3.0) > Reviewed by: dumbbell > Sponsored by: EMC / Isilon Storage Division Per my comment in the review, I think a panic() here would be preferable to a KASSERT(), as it would come without perceptible runtime cost, and failstop the system if we were violating a design-time security invariant. Robert From owner-svn-src-head@freebsd.org Wed Jul 13 14:37:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76D76B98A7F; Wed, 13 Jul 2016 14:37:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 529911ADD; Wed, 13 Jul 2016 14:37:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DEbw7e006826; Wed, 13 Jul 2016 14:37:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DEbwiO006823; Wed, 13 Jul 2016 14:37:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607131437.u6DEbwiO006823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Jul 2016 14:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302770 - in head: sys/kern sys/sys usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 14:37:59 -0000 Author: kib Date: Wed Jul 13 14:37:58 2016 New Revision: 302770 URL: https://svnweb.freebsd.org/changeset/base/302770 Log: Trace timeval parameters to the getitimer(2) and setitimer(2) syscalls. Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7158 Modified: head/sys/kern/kern_time.c head/sys/sys/ktrace.h head/usr.bin/kdump/kdump.c Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Wed Jul 13 12:40:43 2016 (r302769) +++ head/sys/kern/kern_time.c Wed Jul 13 14:37:58 2016 (r302770) @@ -32,6 +32,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" + #include #include #include @@ -54,6 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include #include @@ -701,6 +706,10 @@ kern_getitimer(struct thread *td, u_int *aitv = p->p_stats->p_timer[which]; PROC_ITIMUNLOCK(p); } +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(aitv); +#endif return (0); } @@ -742,6 +751,10 @@ kern_setitimer(struct thread *td, u_int if (which > ITIMER_PROF) return (EINVAL); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(aitv); +#endif if (itimerfix(&aitv->it_value) || aitv->it_value.tv_sec > INT32_MAX / 2) return (EINVAL); @@ -786,6 +799,10 @@ kern_setitimer(struct thread *td, u_int p->p_stats->p_timer[which] = *aitv; PROC_ITIMUNLOCK(p); } +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(oitv); +#endif return (0); } Modified: head/sys/sys/ktrace.h ============================================================================== --- head/sys/sys/ktrace.h Wed Jul 13 12:40:43 2016 (r302769) +++ head/sys/sys/ktrace.h Wed Jul 13 14:37:58 2016 (r302770) @@ -270,6 +270,8 @@ void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *); #define ktrcaprights(s) \ ktrstruct("caprights", (s), sizeof(cap_rights_t)) +#define ktritimerval(s) \ + ktrstruct("itimerval", (s), sizeof(struct itimerval)) #define ktrsockaddr(s) \ ktrstruct("sockaddr", (s), ((struct sockaddr *)(s))->sa_len) #define ktrstat(s) \ Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Wed Jul 13 12:40:43 2016 (r302769) +++ head/usr.bin/kdump/kdump.c Wed Jul 13 14:37:58 2016 (r302770) @@ -109,6 +109,7 @@ void ktruser_malloc(void *); void ktruser_rtld(int, void *); void ktruser(int, void *); void ktrcaprights(cap_rights_t *); +void ktritimerval(struct itimerval *it); void ktrsockaddr(struct sockaddr *); void ktrstat(struct stat *); void ktrstruct(char *, size_t); @@ -1562,6 +1563,24 @@ ktrcaprights(cap_rights_t *rightsp) printf("\n"); } +static void +ktrtimeval(struct timeval *tv) +{ + + printf("{%ld, %ld}", (long)tv->tv_sec, tv->tv_usec); +} + +void +ktritimerval(struct itimerval *it) +{ + + printf("itimerval { .interval = "); + ktrtimeval(&it->it_interval); + printf(", .value = "); + ktrtimeval(&it->it_value); + printf(" }\n"); +} + void ktrsockaddr(struct sockaddr *sa) { @@ -1737,6 +1756,7 @@ ktrstruct(char *buf, size_t buflen) size_t namelen, datalen; int i; cap_rights_t rights; + struct itimerval it; struct stat sb; struct sockaddr_storage ss; @@ -1761,6 +1781,11 @@ ktrstruct(char *buf, size_t buflen) goto invalid; memcpy(&rights, data, datalen); ktrcaprights(&rights); + } else if (strcmp(name, "itimerval") == 0) { + if (datalen != sizeof(struct itimerval)) + goto invalid; + memcpy(&it, data, datalen); + ktritimerval(&it); } else if (strcmp(name, "stat") == 0) { if (datalen != sizeof(struct stat)) goto invalid; From owner-svn-src-head@freebsd.org Wed Jul 13 14:59:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08400B9721D; Wed, 13 Jul 2016 14:59:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C573E1F54; Wed, 13 Jul 2016 14:59:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DExHnS014007; Wed, 13 Jul 2016 14:59:17 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DExH9T014006; Wed, 13 Jul 2016 14:59:17 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607131459.u6DExH9T014006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Jul 2016 14:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302771 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 14:59:19 -0000 Author: pfg Date: Wed Jul 13 14:59:17 2016 New Revision: 302771 URL: https://svnweb.freebsd.org/changeset/base/302771 Log: mail(1): check for out of memory conditions when calling calloc(3). Suggested by: oshogbo MFC after: 3 days Modified: head/usr.bin/mail/cmd3.c Modified: head/usr.bin/mail/cmd3.c ============================================================================== --- head/usr.bin/mail/cmd3.c Wed Jul 13 14:37:58 2016 (r302770) +++ head/usr.bin/mail/cmd3.c Wed Jul 13 14:59:17 2016 (r302771) @@ -463,7 +463,8 @@ group(char **argv) gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NULL) { - gh = calloc(1, sizeof(*gh)); + if ((gh = calloc(1, sizeof(*gh))) == NULL) + err(1, "Out of memory"); gh->g_name = vcopy(gname); gh->g_list = NULL; gh->g_link = groups[h]; @@ -477,7 +478,8 @@ group(char **argv) */ for (ap = argv+1; *ap != NULL; ap++) { - gp = calloc(1, sizeof(*gp)); + if ((gp = calloc(1, sizeof(*gp))) == NULL) + err(1, "Out of memory"); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; @@ -702,7 +704,8 @@ alternates(char **namelist) } if (altnames != 0) (void)free(altnames); - altnames = calloc((unsigned)c, sizeof(char *)); + if ((altnames = calloc((unsigned)c, sizeof(char *))) == NULL) + err(1, "Out of memory"); for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) { cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char)); strcpy(cp, *ap); From owner-svn-src-head@freebsd.org Wed Jul 13 15:16:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A4F8B9783B; Wed, 13 Jul 2016 15:16:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1C61BD7; Wed, 13 Jul 2016 15:16:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DFGpgF021250; Wed, 13 Jul 2016 15:16:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DFGpkk021249; Wed, 13 Jul 2016 15:16:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607131516.u6DFGpkk021249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 13 Jul 2016 15:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302772 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 15:16:52 -0000 Author: avg Date: Wed Jul 13 15:16:51 2016 New Revision: 302772 URL: https://svnweb.freebsd.org/changeset/base/302772 Log: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of snapshot's root The change has been undone in r301275 on the assumption that it was no longer required. But that was incorrect, because in this case (and only in this case) the snapshot root vnode is looked up before z_parent is fixed up. MFC after: 5 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Wed Jul 13 14:59:17 2016 (r302771) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Wed Jul 13 15:16:51 2016 (r302772) @@ -1125,6 +1125,7 @@ domount: */ ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; + (*vpp)->v_flag &= ~VROOT; } ZFS_EXIT(zfsvfs); From owner-svn-src-head@freebsd.org Wed Jul 13 16:04:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0B14B987C1; Wed, 13 Jul 2016 16:04:00 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3D11C4C; Wed, 13 Jul 2016 16:04:00 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from zeppelin.tachypleus.net (75-101-50-44.static.sonic.net [75.101.50.44]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6DG3qcF018169 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 13 Jul 2016 09:03:52 -0700 Subject: Re: svn commit: r302691 - head/release To: "Ngie Cooper (yaneurabeya)" References: <201607130207.u6D27a1o021948@repo.freebsd.org> <0C504A08-DE3E-4AC9-855F-A684E339E500@gmail.com> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Nathan Whitehorn Message-ID: <06015759-1565-1f65-4590-c2b83aed76dd@freebsd.org> Date: Wed, 13 Jul 2016 09:03:52 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <0C504A08-DE3E-4AC9-855F-A684E339E500@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Sonic-CAuth: UmFuZG9tSVbnwEK8+uNc0W5Y838S+8uOIWqsSDepKDrCy4H/KkFpuW33x4J50ciKgqzPspMQpIwZ0Z9JKDafnFDNt0VD63B0V7TkiVV7BBc= X-Sonic-ID: C;nJybZBNJ5hGp+JtMTlz00w== M;rH/4ZBNJ5hGp+JtMTlz00w== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:04:00 -0000 On 07/12/16 19:20, Ngie Cooper (yaneurabeya) wrote: >> On Jul 12, 2016, at 19:07, Nathan Whitehorn wrote: >> >> Author: nwhitehorn >> Date: Wed Jul 13 02:07:36 2016 >> New Revision: 302691 >> URL: https://svnweb.freebsd.org/changeset/base/302691 >> >> Log: >> Reduce the set of things on the disc1 image to those on the bootonly image. >> Notably, this removes the toolchain from the CD-ROM image (it remains on DVD >> images) and pushes the CD-ROM image well below the 700 MB mark. >> >> MFC after: 10 days >> >> Modified: >> head/release/Makefile > There’s a lot more that could be done to be honest. > > Here are some other knobs that might help, depending on how people configure their custom installers. Yep, this is just a first pass to fix the low-hanging fruit: the 100+ MB worth of clang, which is much larger than, say, inetd or fortune. More optimization is great, of course (and I think Glen is working on it), though we should be careful not to compromise the live system on the CDs too much. -Nathan > > Cheers, > -Ngie > > WITHOUT_ACCT= > WITHOUT_AMD= > WITHOUT_APM= > WITHOUT_AT= > WITHOUT_ATM= > WITHOUT_AUTOFS= > WITHOUT_BHYVE= > WITHOUT_BOOTPARAMD= > WITHOUT_BOOTPD= > WITHOUT_BSNMP= > WITHOUT_CVS= > WITHOUT_FINGER= > WITHOUT_GAMES= > WITHOUT_GDB= > WITHOUT_GPIB= > WITHOUT_HAST= > WITHOUT_HESOID= > WITHOUT_HTML= > WITHOUT_HYPERV= > WITHOUT_I4B= > WITHOUT_INETD= > WITHOUT_IPFILTER= > WITHOUT_IPFW= > WITHOUT_IPX= > WITHOUT_ISCSI= > WITHOUT_LIB32= > WITHOUT_LPR= > WITHOUT_NS_CACHING= > WITHOUT_PC_SYSINSTALL= > WITHOUT_PF= > WITHOUT_QUOTAS= > WITHOUT_RADIUS_SUPPORT= > WITHOUT_RBOOTD= > WITHOUT_RCMDS= > WITHOUT_ROUTED= > WITHOUT_SVN= > WITHOUT_SVNLITE= > WITHOUT_TALK= > WITHOUT_TCP_WRAPPERS= > WITHOUT_TFTP= > WITHOUT_TIMED= > WITHOUT_UNBOUND= From owner-svn-src-head@freebsd.org Wed Jul 13 16:07:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D0C6B98824; Wed, 13 Jul 2016 16:07:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CFFC1E08; Wed, 13 Jul 2016 16:07:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-io0-x233.google.com with SMTP id 38so50639210iol.0; Wed, 13 Jul 2016 09:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YcZnxyGr++BasO4bDxyLfTnzJ9zFtVlFEwX0ltP65GE=; b=lrAsLlC3dm67HxNg+E9M1vdD3EF7Rd35j3ZG1LJC5oMknrTmxqxh9gIGh7IiAwrLGc jjCXpe0AIdGlbuN2QHas6WgFWNxZhT9E314Gpto7H1LRfjGTOtycTpiIMINTYr4ohEk+ oqmR4tJ//0lRsmEF7lN/u58jw/B02lKer2cxvq3pX1T49BIrn2cbrektkd9VQdfOE/Qr Jt+N59C38TBRU+4ERXshOte5mZdcJLRtVbcGNuezRVZlaZDOYrFPSYwc6N3CtJ2bTtbW +OVZJL46xY0gAQ5oBCZmdNTMsMEiHcTpcXiOgP/gQmUsqDYGydJ6D5j2iHsF0i9pIfMM /yFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YcZnxyGr++BasO4bDxyLfTnzJ9zFtVlFEwX0ltP65GE=; b=fAwhUeOD2a/yS11zCqlz3SH+JaOF6Sh+BqwnkmhBIP+2CqnK2SmZluuvNvGAOHzeKg oyef2iBNw+y9VOrjj7I4Eo2kszKs29tftRNGvfUMIGjOCvsOgnIrv30aGybaYq3USNer ePIuhs6sVjHn/NR5Ry4efvA92QVdq4RWPH4W4Lnzm7y6WAkxxVhxZWd0VniYvwagSWvT LPDDi8lGX0r1DbMD+K9/q2+zLsCEVoAe636iUo7jVmzW1EYz406NoQDhNGD2iNx/4sjS KD9XZaXRljKu+RVELRInQdHpffL9R66vGJut6XDoQY17kDNrGARdgVXP6eKXmR3hrTtB oX8A== X-Gm-Message-State: ALyK8tIutXAiRTzR9Z3w7AMss2D6awJHON/UFQXe4NK2Qvy0b7vmwnT1HBoQDCaetiepdpm7epLKW23tMRYSkg== X-Received: by 10.107.15.157 with SMTP id 29mr9328465iop.123.1468426077536; Wed, 13 Jul 2016 09:07:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.141.129 with HTTP; Wed, 13 Jul 2016 09:07:56 -0700 (PDT) In-Reply-To: <06015759-1565-1f65-4590-c2b83aed76dd@freebsd.org> References: <201607130207.u6D27a1o021948@repo.freebsd.org> <0C504A08-DE3E-4AC9-855F-A684E339E500@gmail.com> <06015759-1565-1f65-4590-c2b83aed76dd@freebsd.org> From: Adrian Chadd Date: Wed, 13 Jul 2016 09:07:56 -0700 Message-ID: Subject: Re: svn commit: r302691 - head/release To: Nathan Whitehorn Cc: "Ngie Cooper (yaneurabeya)" , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:07:58 -0000 ... does dynamically linking the toolchain reduce its size? -a From owner-svn-src-head@freebsd.org Wed Jul 13 16:08:29 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C548DB98870; Wed, 13 Jul 2016 16:08:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id B42081F9A; Wed, 13 Jul 2016 16:08:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id 57FCF1F89; Wed, 13 Jul 2016 16:08:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Wed, 13 Jul 2016 16:08:27 +0000 From: Glen Barber To: Nathan Whitehorn Cc: "Ngie Cooper (yaneurabeya)" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302691 - head/release Message-ID: <20160713160827.GP1520@FreeBSD.org> References: <201607130207.u6D27a1o021948@repo.freebsd.org> <0C504A08-DE3E-4AC9-855F-A684E339E500@gmail.com> <06015759-1565-1f65-4590-c2b83aed76dd@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CKf/2jVYos1l2hij" Content-Disposition: inline In-Reply-To: <06015759-1565-1f65-4590-c2b83aed76dd@freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:08:29 -0000 --CKf/2jVYos1l2hij Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 13, 2016 at 09:03:52AM -0700, Nathan Whitehorn wrote: > >There=E2=80=99s a lot more that could be done to be honest. > > > >Here are some other knobs that might help, depending on how > >people configure their custom installers. >=20 > Yep, this is just a first pass to fix the low-hanging fruit: the 100+ MB > worth of clang, which is much larger than, say, inetd or fortune. More > optimization is great, of course (and I think Glen is working on it), tho= ugh > we should be careful not to compromise the live system on the CDs too muc= h. Confirmed, working on this now. Glen --CKf/2jVYos1l2hij Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXhmd1AAoJEAMUWKVHj+KT39QQAJ9n+VYYExcO5oUt+66ygJaW O1GpSkPTRHgXXlvTHiWsxbBcmFESAhPppPWcMB2JtH7mEEp6N/RR0ikcoeuKnsi6 tEMgg/wiVGTWIsm/cgVhfiApEei5HNXXow++vHZV+Bt2EkKtyLGhTFTJ1VuyyQtr Cujw6K8Dpi5HpZp1kAPTuy/sW884KABpNwVJV0pUMo5Cbz+yoOVXGAn+RXa+ct+U dbOg1u0ANSFbHAXswxRWX5JGjAE2N3BuZifybXp6XIl0euec1n4mSBJ6kEnbCViB PauRN2CzUkrpao9uqJvDQvnWfMIN3wuyhl3laHLdbq03NjQ9wGlpciiyz6XxjXBI L/2+VVSFGjXRJAW43fzJBey2Gzr0Fg8GOpT0qOXdRP3nwhDmrf6jEhfgpCP2gfKz Y3epL2gvyiLe1CHEFuePlK9lAh0HbXaVZ5vKsLApu7zr+E0+QPGE3+Lhqghlhbeu 2SYfGgMDxyuDoyaOHOSBl4GcVkK6uMuicIcCyTuu971b9AOkaAeS6pE+m193BLXn Y1Q58lULsEvqkgrRSKzlz/qsSeKjYMMBRviQnle+ITPTUsUF6V4N1p1nyNr9I4VK V5o4B7OOeJWy0P8f8dhT1pRUIW2Vd172dEbtSDeEPIBT8/8wz5O2teNmjpLPLL3B 2oYpxZ+MEezASrjzxUE/ =P2Zp -----END PGP SIGNATURE----- --CKf/2jVYos1l2hij-- From owner-svn-src-head@freebsd.org Wed Jul 13 16:19:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E80B98BB3; Wed, 13 Jul 2016 16:19:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx2.freebsd.org", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3932E1973; Wed, 13 Jul 2016 16:19:46 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx2.freebsd.org (Postfix) with ESMTP id 58544448C; Wed, 13 Jul 2016 16:19:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Subject: Re: svn commit: r271300 - in head/sys: net netinet To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201409090418.s894IKMT007235@svn.freebsd.org> From: "Andrey V. Elsukov" Message-ID: <578669BC.1010202@FreeBSD.org> Date: Wed, 13 Jul 2016 19:18:04 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <201409090418.s894IKMT007235@svn.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="N7uKfB0JtiLALv56aRAraPdfHpTI6VOPd" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:19:46 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --N7uKfB0JtiLALv56aRAraPdfHpTI6VOPd Content-Type: multipart/mixed; boundary="4g5PdQ05NSDW09jb8KJ2QvHrVwrFKgCOv" From: "Andrey V. Elsukov" To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <578669BC.1010202@FreeBSD.org> Subject: Re: svn commit: r271300 - in head/sys: net netinet References: <201409090418.s894IKMT007235@svn.freebsd.org> In-Reply-To: <201409090418.s894IKMT007235@svn.freebsd.org> --4g5PdQ05NSDW09jb8KJ2QvHrVwrFKgCOv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09.09.14 08:18, Adrian Chadd wrote: > Author: adrian > Date: Tue Sep 9 04:18:20 2014 > New Revision: 271300 > URL: http://svnweb.freebsd.org/changeset/base/271300 >=20 > Log: > Update the IPv4 input path to handle reassembled frames and incoming = frames > with no RSS hash. > =20 > When doing RSS: > =20 > * Create a new IPv4 netisr which expects the frames to have been veri= fied; > it just directly dispatches to the IPv4 input path. > * Once IPv4 reassembly is done, re-calculate the RSS hash with the ne= w > IP and L3 header; then reinject it as appropriate. > * Update the IPv4 netisr to be a CPU affinity netisr with the RSS has= h > function (rss_soft_m2cpuid) - this will do a software hash if the > hardware doesn't provide one. > =20 > NICs that don't implement hardware RSS hashing will now benefit from = RSS > distribution - it'll inject into the correct destination netisr. > =20 > Note: the netisr distribution doesn't work out of the box - netisr do= esn't > query RSS for how many CPUs and the affinity setup. Yes, netisr like= ly > shouldn't really be doing CPU stuff anymore and should be "some kind = of > 'thing' that is a workqueue that may or may not have any CPU affinity= "; > that's for a later commit. > =20 > Differential Revision: https://reviews.freebsd.org/D527 > Reviewed by: grehan >=20 > Modified: > head/sys/net/netisr.h > head/sys/netinet/in_var.h > head/sys/netinet/ip_input.c >=20 > Modified: head/sys/netinet/ip_input.c Hi, I am sorry for addressing this old message, but it looks like you can not use the same IPCTL_XXX constant for several different oids. =2E.. > @@ -266,6 +292,46 @@ SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQDRO ^^^^ - there > CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_netinet_intr_queue_drops, "I"= , > "Number of packets dropped from the IP input queue"); > =20 > +SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_direct_queue_maxlen,= ^^^ - and there. > + CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet_intr_direct_queue_max= len, "I", > + "Maximum size of the IP direct input queue"); User applications use these constants to address specific oids and I don't think and don't see that the kernel calls several handlers for one oid. --=20 WBR, Andrey V. Elsukov --4g5PdQ05NSDW09jb8KJ2QvHrVwrFKgCOv-- --N7uKfB0JtiLALv56aRAraPdfHpTI6VOPd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXhmm9AAoJEAHF6gQQyKF6Gu8H/2pD3KygH9ApWnN+5K/a1ZRh o3dFQh8ds0eQ5+bAbNB7+62sO54RQHWZlF15KDoGJOmXg8QBy66nhxF/gdeQxkYa 7dnH2hK4A5E9TsEvWY/7BJXBpHWX5MVSb+klSps3cO66MZ74qsxn42HtYcyhsVzK wmvDKFelQI1cJLnP2VOT/VJtxsisWeeFDiOTLj46Que2NqKUJJ+VSs5umjx/ayQV nMcglh/UrnbwHwgQE89jcAnPk92GX4cPaP+rKQBU/TUZoZUJCgUzTBQjuxCm/MQs CzdE3DOgYDH8C7K5strS9ttGowg6raMcx9RdlCkeYsRr/WC4OlL7pHBYzodUVqo= =NIRd -----END PGP SIGNATURE----- --N7uKfB0JtiLALv56aRAraPdfHpTI6VOPd-- From owner-svn-src-head@freebsd.org Wed Jul 13 16:45:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F5A3B97609; Wed, 13 Jul 2016 16:45:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3647212B4; Wed, 13 Jul 2016 16:45:28 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DGjRtK055632; Wed, 13 Jul 2016 16:45:27 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DGjQck055624; Wed, 13 Jul 2016 16:45:26 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607131645.u6DGjQck055624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 13 Jul 2016 16:45:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302776 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:45:28 -0000 Author: pfg Date: Wed Jul 13 16:45:26 2016 New Revision: 302776 URL: https://svnweb.freebsd.org/changeset/base/302776 Log: mail(1): Bring some fixes from other BSDs. - Use varargs properly - Use pid_t - Better handling of error conditions on forked jobs. - Some prototype and warning cleanups. Obtained from: NetBSD (some originaly from OpenBSD) Modified: head/usr.bin/mail/cmd1.c head/usr.bin/mail/cmd2.c head/usr.bin/mail/cmd3.c head/usr.bin/mail/edit.c head/usr.bin/mail/extern.h head/usr.bin/mail/fio.c head/usr.bin/mail/getname.c head/usr.bin/mail/popen.c Modified: head/usr.bin/mail/cmd1.c ============================================================================== --- head/usr.bin/mail/cmd1.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/cmd1.c Wed Jul 13 16:45:26 2016 (r302776) @@ -439,7 +439,7 @@ folders(void) } if ((cmd = value("LISTER")) == NULL) cmd = "ls"; - (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL); + (void)run_command(cmd, 0, -1, -1, dirname, NULL); return (0); } Modified: head/usr.bin/mail/cmd2.c ============================================================================== --- head/usr.bin/mail/cmd2.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/cmd2.c Wed Jul 13 16:45:26 2016 (r302776) @@ -130,8 +130,9 @@ hitit: * so we can discard when the user quits. */ int -save(char str[]) +save(void *v) { + char *str = v; return (save1(str, 1, "save", saveignore)); } @@ -140,8 +141,9 @@ save(char str[]) * Copy a message to a file without affected its saved-ness */ int -copycmd(char str[]) +copycmd(void *v) { + char *str = v; return (save1(str, 0, "copy", saveignore)); } Modified: head/usr.bin/mail/cmd3.c ============================================================================== --- head/usr.bin/mail/cmd3.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/cmd3.c Wed Jul 13 16:45:26 2016 (r302776) @@ -79,7 +79,7 @@ dosh(char *str __unused) if ((sh = value("SHELL")) == NULL) sh = _PATH_CSHELL; - (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL); + (void)run_command(sh, 0, -1, -1, NULL); (void)signal(SIGINT, sigint); printf("\n"); return (0); @@ -102,7 +102,7 @@ bangexp(char *str, size_t strsize) n = sizeof(bangbuf); while (*cp != '\0') { if (*cp == '!') { - if (n < strlen(lastbang)) { + if (n < (int)strlen(lastbang)) { overf: printf("Command buffer overflow\n"); return (-1); Modified: head/usr.bin/mail/edit.c ============================================================================== --- head/usr.bin/mail/edit.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/edit.c Wed Jul 13 16:45:26 2016 (r302776) @@ -180,7 +180,7 @@ run_editor(FILE *fp, off_t size, int typ nf = NULL; if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL) edit = type == 'e' ? _PATH_EX : _PATH_VI; - if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) { + if (run_command(edit, 0, -1, -1, tempname, NULL) < 0) { (void)rm(tempname); goto out; } Modified: head/usr.bin/mail/extern.h ============================================================================== --- head/usr.bin/mail/extern.h Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/extern.h Wed Jul 13 16:45:26 2016 (r302776) @@ -49,7 +49,7 @@ char *copyin(char *, char **); char *detract(struct name *, int); char *expand(char *); char *getdeadletter(void); -char *getname(int); +char *getname(uid_t); char *hfield(const char *, struct message *); FILE *infix(struct header *, FILE *); char *ishfield(char [], char *, const char *); @@ -95,7 +95,7 @@ void collhup(int); void collint(int); void collstop(int); void commands(void); -int copycmd(char []); +int copycmd(void *v); int core(void); int count(struct name *); int delete(int []); @@ -130,7 +130,7 @@ int getfold(char *, int); int gethfield(FILE *, char [], int, char **); int getmsglist(char *, int *, int); int getrawlist(char [], char **, int); -int getuserid(char []); +uid_t getuserid(char []); int grabh(struct header *, int); int group(char **); void hangup(int); @@ -198,8 +198,8 @@ int respond(int *); int retfield(char *[]); int rexit(int); int rm(char *); -int run_command(char *, sigset_t *, int, int, char *, char *, char *); -int save(char []); +int run_command(char *, sigset_t *, int, int, ...); +int save(void *v); int save1(char [], int, const char *, struct ignoretab *); void savedeadletter(FILE *); int saveigfield(char *[]); @@ -223,7 +223,7 @@ void sort(char **); int source(char **); void spreserve(void); void sreset(void); -int start_command(char *, sigset_t *, int, int, char *, char *, char *); +int start_command(char *, sigset_t *, int, int, ...); void statusput(struct message *, FILE *, char *); void stop(int); int stouch(int []); Modified: head/usr.bin/mail/fio.c ============================================================================== --- head/usr.bin/mail/fio.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/fio.c Wed Jul 13 16:45:26 2016 (r302776) @@ -235,7 +235,7 @@ makemessage(FILE *f, int omsgCount) size -= (omsgCount + 1) * sizeof(struct message); (void)fflush(f); (void)lseek(fileno(f), (off_t)sizeof(*message), 0); - if (read(fileno(f), (char *)&message[omsgCount], size) != size) + if (read(fileno(f), (void *)&message[omsgCount], size) != size) errx(1, "Message temporary file corrupted"); message[msgCount].m_size = 0; message[msgCount].m_lines = 0; Modified: head/usr.bin/mail/getname.c ============================================================================== --- head/usr.bin/mail/getname.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/getname.c Wed Jul 13 16:45:26 2016 (r302776) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); * Search the passwd file for a uid. Return name on success, NULL on failure. */ char * -getname(int uid) +getname(uid_t uid) { struct passwd *pw; @@ -58,7 +58,7 @@ getname(int uid) * Convert the passed name to a user id and return it. Return -1 * on error. */ -int +uid_t getuserid(char name[]) { struct passwd *pw; Modified: head/usr.bin/mail/popen.c ============================================================================== --- head/usr.bin/mail/popen.c Wed Jul 13 16:24:02 2016 (r302775) +++ head/usr.bin/mail/popen.c Wed Jul 13 16:45:26 2016 (r302776) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include "rcv.h" #include #include +#include +#include #include "extern.h" #define READ 0 @@ -46,22 +48,23 @@ __FBSDID("$FreeBSD$"); struct fp { FILE *fp; int pipe; - int pid; + pid_t pid; struct fp *link; }; static struct fp *fp_head; struct child { - int pid; + pid_t pid; char done; char free; int status; struct child *link; }; -static struct child *child; -static struct child *findchild(int); +static struct child *child, *child_freelist = NULL; + static void delchild(struct child *); -static int file_pid(FILE *); +static pid_t file_pid(FILE *); +static pid_t start_commandv(char *, sigset_t *, int, int, va_list); FILE * Fopen(const char *path, const char *mode) @@ -90,6 +93,7 @@ Fdopen(int fd, const char *mode) int Fclose(FILE *fp) { + unregister_file(fp); return (fclose(fp)); } @@ -99,7 +103,7 @@ Popen(char *cmd, const char *mode) { int p[2]; int myside, hisside, fd0, fd1; - int pid; + pid_t pid; sigset_t nset; FILE *fp; @@ -109,15 +113,15 @@ Popen(char *cmd, const char *mode) (void)fcntl(p[WRITE], F_SETFD, 1); if (*mode == 'r') { myside = p[READ]; - fd0 = -1; - hisside = fd1 = p[WRITE]; + hisside = fd0 = fd1 = p[WRITE]; } else { myside = p[WRITE]; hisside = fd0 = p[READ]; fd1 = -1; } (void)sigemptyset(&nset); - if ((pid = start_command(cmd, &nset, fd0, fd1, NULL, NULL, NULL)) < 0) { + pid = start_command(value("SHELL"), &nset, fd0, fd1, "-c", cmd, NULL); + if (pid < 0) { (void)close(p[READ]); (void)close(p[WRITE]); return (NULL); @@ -158,7 +162,7 @@ close_all_files(void) } void -register_file(FILE *fp, int pipe, int pid) +register_file(FILE *fp, int pipe, pid_t pid) { struct fp *fpp; @@ -186,7 +190,7 @@ unregister_file(FILE *fp) /*NOTREACHED*/ } -int +pid_t file_pid(FILE *fp) { struct fp *p; @@ -200,29 +204,16 @@ file_pid(FILE *fp) /* * Run a command without a shell, with optional arguments and splicing - * of stdin and stdout. The command name can be a sequence of words. + * of stdin (-1 means none) and stdout. The command name can be a sequence + * of words. * Signals must be handled by the caller. - * "Mask" contains the signals to ignore in the new process. - * SIGINT is enabled unless it's in the mask. + * "nset" contains the signals to ignore in the new process. + * SIGINT is enabled unless it's in "nset". */ -/*VARARGS4*/ -int -run_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, - char *a1, char *a2) +static pid_t +start_commandv(char *cmd, sigset_t *nset, int infd, int outfd, va_list args) { - int pid; - - if ((pid = start_command(cmd, mask, infd, outfd, a0, a1, a2)) < 0) - return (-1); - return (wait_command(pid)); -} - -/*VARARGS4*/ -int -start_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0, - char *a1, char *a2) -{ - int pid; + pid_t pid; if ((pid = fork()) < 0) { warn("fork"); @@ -232,11 +223,10 @@ start_command(char *cmd, sigset_t *mask, char *argv[100]; int i = getrawlist(cmd, argv, sizeof(argv) / sizeof(*argv)); - if ((argv[i++] = a0) != NULL && - (argv[i++] = a1) != NULL && - (argv[i++] = a2) != NULL) - argv[i] = NULL; - prepare_child(mask, infd, outfd); + while ((argv[i++] = va_arg(args, char *))) + ; + argv[i] = NULL; + prepare_child(nset, infd, outfd); execvp(argv[0], argv); warn("%s", argv[0]); _exit(1); @@ -244,6 +234,32 @@ start_command(char *cmd, sigset_t *mask, return (pid); } +int +run_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) +{ + pid_t pid; + va_list args; + + va_start(args, outfd); + pid = start_commandv(cmd, nset, infd, outfd, args); + va_end(args); + if (pid < 0) + return -1; + return wait_command(pid); +} + +int +start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...) +{ + va_list args; + int r; + + va_start(args, outfd); + r = start_commandv(cmd, nset, infd, outfd, args); + va_end(args); + return r; +} + void prepare_child(sigset_t *nset, int infd, int outfd) { @@ -268,7 +284,7 @@ prepare_child(sigset_t *nset, int infd, } int -wait_command(int pid) +wait_command(pid_t pid) { if (wait_child(pid) < 0) { @@ -279,7 +295,7 @@ wait_command(int pid) } static struct child * -findchild(int pid) +findchild(pid_t pid, int dont_alloc) { struct child **cpp; @@ -287,9 +303,16 @@ findchild(int pid) cpp = &(*cpp)->link) ; if (*cpp == NULL) { - *cpp = malloc(sizeof(struct child)); - if (*cpp == NULL) - err(1, "Out of memory"); + if (dont_alloc) + return(NULL); + if (child_freelist) { + *cpp = child_freelist; + child_freelist = (*cpp)->link; + } else { + *cpp = malloc(sizeof(struct child)); + if (*cpp == NULL) + err(1, "malloc"); + } (*cpp)->pid = pid; (*cpp)->done = (*cpp)->free = 0; (*cpp)->link = NULL; @@ -305,19 +328,22 @@ delchild(struct child *cp) for (cpp = &child; *cpp != cp; cpp = &(*cpp)->link) ; *cpp = cp->link; - (void)free(cp); + cp->link = child_freelist; + child_freelist = cp; } /*ARGSUSED*/ void sigchild(int signo __unused) { - int pid; + pid_t pid; int status; struct child *cp; + int save_errno; + save_errno = errno; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { - cp = findchild(pid); + cp = findchild(pid, 1); if (cp->free) delchild(cp); else { @@ -325,6 +351,7 @@ sigchild(int signo __unused) cp->status = status; } } + errno = save_errno; } int wait_status; @@ -333,7 +360,7 @@ int wait_status; * Wait for a specific child to die. */ int -wait_child(int pid) +wait_child(pid_t pid) { sigset_t nset, oset; struct child *cp; @@ -342,7 +369,7 @@ wait_child(int pid) (void)sigaddset(&nset, SIGCHLD); (void)sigprocmask(SIG_BLOCK, &nset, &oset); - cp = findchild(pid); + cp = findchild(pid, 1); while (!cp->done) (void)sigsuspend(&oset); @@ -356,18 +383,19 @@ wait_child(int pid) * Mark a child as don't care. */ void -free_child(int pid) +free_child(pid_t pid) { + struct child *cp; sigset_t nset, oset; - struct child *cp = findchild(pid); (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - - if (cp->done) - delchild(cp); - else - cp->free = 1; + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + if ((cp = findchild(pid, 0)) != NULL) { + if (cp->done) + delchild(cp); + else + cp->free = 1; + } (void)sigprocmask(SIG_SETMASK, &oset, NULL); } From owner-svn-src-head@freebsd.org Wed Jul 13 16:49:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEFE9B976AA; Wed, 13 Jul 2016 16:49:49 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B38B14EE; Wed, 13 Jul 2016 16:49:49 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DGnmrc055814; Wed, 13 Jul 2016 16:49:48 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DGnm1d055813; Wed, 13 Jul 2016 16:49:48 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607131649.u6DGnm1d055813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 16:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302777 - head/contrib/tcsh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 16:49:49 -0000 Author: ache Date: Wed Jul 13 16:49:48 2016 New Revision: 302777 URL: https://svnweb.freebsd.org/changeset/base/302777 Log: After removing collation for [a-z] ranges in r302512, mimic system glob() here too. I try to keep the change minimal to not touch contribed code much. I'll send it upstream when it will be merged to the main branches, but we need this change now here. Modified: head/contrib/tcsh/glob.c Modified: head/contrib/tcsh/glob.c ============================================================================== --- head/contrib/tcsh/glob.c Wed Jul 13 16:45:26 2016 (r302776) +++ head/contrib/tcsh/glob.c Wed Jul 13 16:49:48 2016 (r302777) @@ -142,17 +142,23 @@ globcharcoll(__Char c1, __Char c2, int c c1 = towlower(c1); c2 = towlower(c2); } else { +#ifndef __FreeBSD__ /* This should not be here, but I'll rather leave it in than engage in a LC_COLLATE flamewar about a shell I don't use... */ if (iswlower(c1) && iswupper(c2)) return (1); if (iswupper(c1) && iswlower(c2)) return (-1); +#endif } s1[0] = c1; s2[0] = c2; s1[1] = s2[1] = '\0'; +#ifdef __FreeBSD__ + return wcscmp(s1, s2); +#else return wcscoll(s1, s2); +#endif # else /* not WIDE_STRINGS */ char s1[2], s2[2]; From owner-svn-src-head@freebsd.org Wed Jul 13 17:09:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72081B98148; Wed, 13 Jul 2016 17:09:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F12D16C6; Wed, 13 Jul 2016 17:09:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DH9L0L063380; Wed, 13 Jul 2016 17:09:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DH9K0N063373; Wed, 13 Jul 2016 17:09:20 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201607131709.u6DH9K0N063373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 13 Jul 2016 17:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302778 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 17:09:22 -0000 Author: asomers Date: Wed Jul 13 17:09:20 2016 New Revision: 302778 URL: https://svnweb.freebsd.org/changeset/base/302778 Log: pw should sanitize the argument of -w. Otherwise, it will silently disable the login for the selected account if the argument is unrecognizable. usr.sbin/pw/pw.h usr.sbin/pw/pw_conf.c usr.sbin/pw/pw_user.c Use separate rules to validate boolean parameters and passwd parameters. Error out if a password parameter cannot be parsed. usr.sbin/pw/tests/Makefile usr.sbin/pw/tests/crypt.c usr.sbin/pw/tests/pw_useradd.sh usr.sbin/pw/tests/pw_usermod.sh Add tests for the validation. Also, enhance existing password-related tests to actually validate that the correct hash is written to master.passwd. Reviewed by: bapt MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6840 Added: head/usr.sbin/pw/tests/crypt.c (contents, props changed) Modified: head/usr.sbin/pw/pw.h head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/Makefile head/usr.sbin/pw/tests/pw_useradd.sh head/usr.sbin/pw/tests/pw_usermod.sh Modified: head/usr.sbin/pw/pw.h ============================================================================== --- head/usr.sbin/pw/pw.h Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/pw.h Wed Jul 13 17:09:20 2016 (r302778) @@ -93,6 +93,7 @@ int groupadd(struct userconf *, char *na int nis_update(void); int boolean_val(char const * str, int dflt); +int passwd_val(char const * str, int dflt); char const *boolean_str(int val); char *newstr(char const * p); Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/pw_conf.c Wed Jul 13 17:09:20 2016 (r302778) @@ -186,6 +186,22 @@ boolean_val(char const * str, int dflt) for (i = 0; boolfalse[i]; i++) if (strcmp(str, boolfalse[i]) == 0) return 0; + } + return dflt; +} + +int +passwd_val(char const * str, int dflt) +{ + if ((str = unquote(str)) != NULL) { + int i; + + for (i = 0; booltrue[i]; i++) + if (strcmp(str, booltrue[i]) == 0) + return 1; + for (i = 0; boolfalse[i]; i++) + if (strcmp(str, boolfalse[i]) == 0) + return 0; /* * Special cases for defaultpassword @@ -194,6 +210,8 @@ boolean_val(char const * str, int dflt) return -1; if (strcmp(str, "none") == 0) return -2; + + errx(1, "Invalid value for default password"); } return dflt; } @@ -258,7 +276,7 @@ read_userconfig(char const * file) #endif switch (i) { case _UC_DEFAULTPWD: - config.default_password = boolean_val(q, 1); + config.default_password = passwd_val(q, 1); break; case _UC_REUSEUID: config.reuse_uids = boolean_val(q, 0); Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/pw_user.c Wed Jul 13 17:09:20 2016 (r302778) @@ -1315,7 +1315,7 @@ pw_user_add(int argc, char **argv, char mix_config(cmdcnf, cnf); if (default_passwd) - cmdcnf->default_password = boolean_val(default_passwd, + cmdcnf->default_password = passwd_val(default_passwd, cnf->default_password); if (genconf) { if (name != NULL) @@ -1717,7 +1717,7 @@ pw_user_mod(int argc, char **argv, char if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); - cnf->default_password = boolean_val(passwd, + cnf->default_password = passwd_val(passwd, cnf->default_password); pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun); edited = true; Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/tests/Makefile Wed Jul 13 17:09:20 2016 (r302778) @@ -2,6 +2,11 @@ PACKAGE= tests +BINDIR= ${TESTSDIR} + +PROGS+= crypt +LIBADD+= crypt + ATF_TESTS_SH= pw_etcdir \ pw_lock \ pw_config \ Added: head/usr.sbin/pw/tests/crypt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/crypt.c Wed Jul 13 17:09:20 2016 (r302778) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2016 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +int main(int argc, char** argv) +{ + char *salt, *pass, *hash; + + if (argc < 3) + errx(1, "Usage: crypt "); + salt = argv[1]; + pass = argv[2]; + + hash = crypt(pass, salt); + printf("%s", hash); + return (hash == NULL ? 1 : 0); +} Modified: head/usr.sbin/pw/tests/pw_useradd.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_useradd.sh Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/tests/pw_useradd.sh Wed Jul 13 17:09:20 2016 (r302778) @@ -235,9 +235,12 @@ atf_test_case user_add_password_from_h user_add_password_from_h_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -h 0 <<-EOF - $(echo test) + atf_check -s exit:0 ${PW} useradd foo -h 0 <<-EOF + $(echo mypassword) EOF + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "mypassword" } atf_test_case user_add_R @@ -325,17 +328,47 @@ user_add_already_exists_body() { ${PW} useradd foo } +atf_test_case user_add_w_error +user_add_w_error_body() { + populate_etc_skel + + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} useradd foo -w invalid_value +} + +atf_test_case user_add_w_no +user_add_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_none +user_add_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_random +user_add_w_random_body() { + populate_etc_skel + + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + atf_test_case user_add_w_yes user_add_w_yes_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd - atf_check -s exit:0 ${PW} usermod foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" } atf_test_case user_add_with_pw_conf @@ -380,6 +413,10 @@ atf_init_test_cases() { atf_add_test_case user_add_uid_too_large atf_add_test_case user_add_bad_shell atf_add_test_case user_add_already_exists + atf_add_test_case user_add_w_error + atf_add_test_case user_add_w_no + atf_add_test_case user_add_w_none + atf_add_test_case user_add_w_random atf_add_test_case user_add_w_yes atf_add_test_case user_add_with_pw_conf } Modified: head/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_usermod.sh Wed Jul 13 16:49:48 2016 (r302777) +++ head/usr.sbin/pw/tests/pw_usermod.sh Wed Jul 13 17:09:20 2016 (r302778) @@ -157,8 +157,9 @@ user_mod_h_body() { atf_check -s exit:0 ${PW} usermod foo -h 0 <<- EOF $(echo a) EOF - atf_check -s exit:0 -o not-match:"^foo:\*:.*" \ - grep "^foo" ${HOME}/master.passwd + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "a" atf_check -s exit:0 ${PW} usermod foo -h - <<- EOF $(echo b) EOF @@ -203,6 +204,56 @@ user_mod_uid_body() { atf_check -s exit:0 ${PW} usermod foo -u 5000 } +atf_test_case user_mod_w_error +user_mod_w_error_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} usermod foo -w invalid_value +} + +atf_test_case user_mod_w_no +user_mod_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_none +user_mod_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_random +user_mod_w_random_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + password=`${PW} usermod foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + +atf_test_case user_mod_w_yes +user_mod_w_yes_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w yes + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "foo" +} + + atf_init_test_cases() { atf_add_test_case user_mod atf_add_test_case user_mod_noupdate @@ -219,4 +270,9 @@ atf_init_test_cases() { atf_add_test_case user_mod_H atf_add_test_case user_mod_renamehome atf_add_test_case user_mod_uid + atf_add_test_case user_mod_w_error + atf_add_test_case user_mod_w_no + atf_add_test_case user_mod_w_none + atf_add_test_case user_mod_w_random + atf_add_test_case user_mod_w_yes } From owner-svn-src-head@freebsd.org Wed Jul 13 18:26:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA0A0B98752; Wed, 13 Jul 2016 18:26:06 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B961AFF; Wed, 13 Jul 2016 18:26:06 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DIQ5m9093293; Wed, 13 Jul 2016 18:26:05 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DIQ5WC093292; Wed, 13 Jul 2016 18:26:05 GMT (envelope-from des@FreeBSD.org) Message-Id: <201607131826.u6DIQ5WC093292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 13 Jul 2016 18:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302779 - head/contrib/ldns-host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 18:26:06 -0000 Author: des Date: Wed Jul 13 18:26:05 2016 New Revision: 302779 URL: https://svnweb.freebsd.org/changeset/base/302779 Log: merge upstream hg 06347b1f76fe (fix IXFR) PR: 209177 MFC after: 3 days Modified: head/contrib/ldns-host/ldns-host.c Directory Properties: head/contrib/ldns-host/ (props changed) Modified: head/contrib/ldns-host/ldns-host.c ============================================================================== --- head/contrib/ldns-host/ldns-host.c Wed Jul 13 17:09:20 2016 (r302778) +++ head/contrib/ldns-host/ldns-host.c Wed Jul 13 18:26:05 2016 (r302779) @@ -156,6 +156,19 @@ memerr: return LDNS_STATUS_MEM_ERR; } +static uint32_t +ldns_rr_soa_get_serial(const ldns_rr *rr) +{ + const ldns_rdf *rdf; + + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) return 0; + if (ldns_rr_rd_count(rr) != 7) return 0; + rdf = ldns_rr_rdf(rr, 2); + if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_INT32) return 0; + if (ldns_rdf_size(rdf) != 4) return 0; + return ldns_rdf2native_int32(rdf); +} + static ldns_status ldns_tcp_start(ldns_resolver *res, ldns_pkt *qpkt, int nameserver) { /* This routine is based on ldns_axfr_start, with the major @@ -873,18 +886,16 @@ dozonetransfer(ldns_resolver *res, ldns_ ldns_rdf *dname; ldns_rr_type rrtype; ldns_rr_list *rrl; - int i, nsoa = 0; + ldns_rr *rr; + size_t i, nsoa = 0; + uint32_t first_serial; rrtype = o_rrtype; o_rrtype = (o_mode == M_AXFR) ? LDNS_RR_TYPE_AXFR : LDNS_RR_TYPE_IXFR; dname = search(res, domain, &pkt, absolute, false); for (;;) { - rrl = ldns_pkt_answer(pkt); - for (i = ldns_rr_list_rr_count(rrl) - 1; i >= 0; i--) { - if (ldns_rr_get_type(ldns_rr_list_rr(rrl, i)) == LDNS_RR_TYPE_SOA) - nsoa++; - } + rrl = ldns_rr_list_clone(ldns_pkt_answer(pkt)); ldns_pkt_filter_answer(pkt, rrtype); report(res, dname != NULL ? dname : domain, pkt); if ((dname == NULL) || @@ -893,9 +904,29 @@ dozonetransfer(ldns_resolver *res, ldns_ ldns_tcp_close(res); return false; } - if (nsoa >= 2) { - ldns_tcp_close(res); - return true; + for (i = 0; i < ldns_rr_list_rr_count(rrl); i++) { + rr = ldns_rr_list_rr(rrl, i); + if (nsoa == 0) { + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_SOA) { + printf("; Transfer failed. " + "Didn't start with SOA answer.\n"); + ldns_tcp_close(res); + return false; + } + first_serial = ldns_rr_soa_get_serial(rr); + if ((o_mode == M_IXFR) && (first_serial <= o_ixfr_serial)) { + ldns_tcp_close(res); + return true; + } + } + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { + nsoa = nsoa < 2 ? nsoa + 1 : 1; + if ((nsoa == 2) && + (ldns_rr_soa_get_serial(rr) == first_serial)) { + ldns_tcp_close(res); + return true; + } + } } if (ldns_tcp_read(&nextpkt, res) != LDNS_STATUS_OK) { printf("; Transfer failed.\n"); @@ -904,6 +935,7 @@ dozonetransfer(ldns_resolver *res, ldns_ ldns_pkt_set_answerfrom(nextpkt, ldns_rdf_clone(ldns_pkt_answerfrom(pkt))); ldns_pkt_free(pkt); + ldns_rr_list_free(rrl); pkt = nextpkt; } } From owner-svn-src-head@freebsd.org Wed Jul 13 18:47:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3AE0B98B21; Wed, 13 Jul 2016 18:47:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF111632; Wed, 13 Jul 2016 18:47:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x234.google.com with SMTP id u186so28744509ita.0; Wed, 13 Jul 2016 11:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=RaGF21AB1QWoIX3QgdZjgbRsuIgavUw0ghXsLHbi7tA=; b=y7HcIXqel4RNTf5UXuCXva/XC8QjO0EcLRkVaB+h1vwjlg/xV+x6tR6OEMu5XGIU/F weP4l1AsSjFx/EQ+t2CAkalYghiYhedA4NhA4QtGhqwTT+8w+nIncLkrKs/D/FVN55BP psk+OjxX+WNh/WFGDgEGHCwN+ZgX0QK+Y4IkwPKaxsHeHDk0W4ix6h0Hcaunhz3sTIK9 wncweLAmf6iMB4I2dMEbka2bvm5eJdgfYCzQd3xtZrRrcEKE/pkzXNT4BsxJizybLv7w 34s70eBv6LbjxJQNglzneTHdtUoELOj64swVIo18yxiyJiCDSQ4vTp5OUYsJVPUKOYut iFHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=RaGF21AB1QWoIX3QgdZjgbRsuIgavUw0ghXsLHbi7tA=; b=SIOdvesfrD/T7s7QZBePaDBsMl6cohurKk/MJMXghIZ+VBbJJzPn6iih9tqVyqKmNi D4N7MMJe+N871f6Xe7JmozQO+snEcpyGDAzj2tBADDk+3NB2vDK+WBVJiFgjVauMiDYr b1pNXNsMu4fS8Xk3vidz6aqnbwauqZ8Aq6NEm4bRzmXWA2JXGqHC2tAptbloVTBd22Gg Gxo4odRaznUlAw8ae3ombQahL6STKQ1E/PydYk7WBKCcmjXro1Q+973rWqGhZ1H5stat wytcVVrEkNFxo7xDvo4WRQ2KjqXGy/eMp8MUCcmSTiBYR2Z9o4jyEECUbJPrA5oOAtwf 8Aeg== X-Gm-Message-State: ALyK8tLTvKsSsFd5uviBYBEqW7oF/q+Zw+9nDx5+S/WIfvGnOfP9sJ8gbomhnML4JFNnm4mHhor5AOBySjUKtA== X-Received: by 10.36.200.131 with SMTP id w125mr10061126itf.80.1468435649627; Wed, 13 Jul 2016 11:47:29 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.36.141.129 with HTTP; Wed, 13 Jul 2016 11:47:28 -0700 (PDT) In-Reply-To: <578669BC.1010202@FreeBSD.org> References: <201409090418.s894IKMT007235@svn.freebsd.org> <578669BC.1010202@FreeBSD.org> From: Adrian Chadd Date: Wed, 13 Jul 2016 11:47:28 -0700 X-Google-Sender-Auth: tQ1HurMw1ltbDJGm-KRqlNW085k Message-ID: Subject: Re: svn commit: r271300 - in head/sys: net netinet To: "Andrey V. Elsukov" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 18:47:30 -0000 ugh, hm. Wonder how I missed that. I'll go see about fixing it. -adrian On 13 July 2016 at 09:18, Andrey V. Elsukov wrote: > On 09.09.14 08:18, Adrian Chadd wrote: >> Author: adrian >> Date: Tue Sep 9 04:18:20 2014 >> New Revision: 271300 >> URL: http://svnweb.freebsd.org/changeset/base/271300 >> >> Log: >> Update the IPv4 input path to handle reassembled frames and incoming frames >> with no RSS hash. >> >> When doing RSS: >> >> * Create a new IPv4 netisr which expects the frames to have been verified; >> it just directly dispatches to the IPv4 input path. >> * Once IPv4 reassembly is done, re-calculate the RSS hash with the new >> IP and L3 header; then reinject it as appropriate. >> * Update the IPv4 netisr to be a CPU affinity netisr with the RSS hash >> function (rss_soft_m2cpuid) - this will do a software hash if the >> hardware doesn't provide one. >> >> NICs that don't implement hardware RSS hashing will now benefit from RSS >> distribution - it'll inject into the correct destination netisr. >> >> Note: the netisr distribution doesn't work out of the box - netisr doesn't >> query RSS for how many CPUs and the affinity setup. Yes, netisr likely >> shouldn't really be doing CPU stuff anymore and should be "some kind of >> 'thing' that is a workqueue that may or may not have any CPU affinity"; >> that's for a later commit. >> >> Differential Revision: https://reviews.freebsd.org/D527 >> Reviewed by: grehan >> >> Modified: >> head/sys/net/netisr.h >> head/sys/netinet/in_var.h >> head/sys/netinet/ip_input.c >> >> Modified: head/sys/netinet/ip_input.c > > Hi, I am sorry for addressing this old message, but it looks like you > can not use the same IPCTL_XXX constant for several different oids. > > ... >> @@ -266,6 +292,46 @@ SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQDRO > ^^^^ - there >> CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_netinet_intr_queue_drops, "I", >> "Number of packets dropped from the IP input queue"); >> >> +SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_direct_queue_maxlen, > ^^^ - and there. >> + CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet_intr_direct_queue_maxlen, "I", >> + "Maximum size of the IP direct input queue"); > > User applications use these constants to address specific oids and I > don't think and don't see that the kernel calls several handlers for one > oid. > > -- > WBR, Andrey V. Elsukov > From owner-svn-src-head@freebsd.org Wed Jul 13 18:51:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA863B98BE1; Wed, 13 Jul 2016 18:51:20 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D60618EC; Wed, 13 Jul 2016 18:51:20 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DIpJUL002216; Wed, 13 Jul 2016 18:51:19 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DIpJKT002214; Wed, 13 Jul 2016 18:51:19 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607131851.u6DIpJKT002214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 18:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302780 - head/contrib/libgnuregex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 18:51:20 -0000 Author: ache Date: Wed Jul 13 18:51:19 2016 New Revision: 302780 URL: https://svnweb.freebsd.org/changeset/base/302780 Log: After removing collation for [a-z] ranges in r302512, do it here too. Instead of trying to expand whole range at regcomp() stage as we do, GNU regex allocates separate ranges [start,end] set each character is checked against, so collation is possible and turned on for ranges here. When something like that will be implemented or our obsoleted regex code will be replaced to something like TRE, and in case we decide to use collation in [a-z] ranges, all changes related to r302512 can be backed out, but now we need consistency. Modified: head/contrib/libgnuregex/regcomp.c head/contrib/libgnuregex/regexec.c Modified: head/contrib/libgnuregex/regcomp.c ============================================================================== --- head/contrib/libgnuregex/regcomp.c Wed Jul 13 18:26:05 2016 (r302779) +++ head/contrib/libgnuregex/regcomp.c Wed Jul 13 18:51:19 2016 (r302780) @@ -2664,7 +2664,11 @@ build_range_exp (bitset_t sbcset, bracke return REG_ECOLLATE; cmp_buf[0] = start_wc; cmp_buf[4] = end_wc; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 4) > 0) +#else if (wcscoll (cmp_buf, cmp_buf + 4) > 0) +#endif return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2706,8 +2710,13 @@ build_range_exp (bitset_t sbcset, bracke for (wc = 0; wc < SBC_MAX; ++wc) { cmp_buf[2] = wc; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 + && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) +#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) +#endif bitset_set (sbcset, wc); } } Modified: head/contrib/libgnuregex/regexec.c ============================================================================== --- head/contrib/libgnuregex/regexec.c Wed Jul 13 18:26:05 2016 (r302779) +++ head/contrib/libgnuregex/regexec.c Wed Jul 13 18:51:19 2016 (r302780) @@ -3964,8 +3964,13 @@ check_node_accept_bytes (const re_dfa_t { cmp_buf[0] = cset->range_starts[i]; cmp_buf[4] = cset->range_ends[i]; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 + && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) +#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) +#endif { match_len = char_len; goto check_node_accept_bytes_match; From owner-svn-src-head@freebsd.org Wed Jul 13 19:03:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04566B98E55; Wed, 13 Jul 2016 19:03:01 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD6741F89; Wed, 13 Jul 2016 19:03:00 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DJ2xW5008281; Wed, 13 Jul 2016 19:02:59 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DJ2xAu008280; Wed, 13 Jul 2016 19:02:59 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607131902.u6DJ2xAu008280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 19:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302781 - head/gnu/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 19:03:01 -0000 Author: ache Date: Wed Jul 13 19:02:59 2016 New Revision: 302781 URL: https://svnweb.freebsd.org/changeset/base/302781 Log: After removing collation for [a-z] ranges in r302512, do it here too. Instead of trying to expand whole range at regcomp() stage as we do, GNU regex allocates separate ranges [start,end] set each character is checked against, so collation is possible and turned on for ranges here. When something like that will be implemented or our obsoleted regex code will be replaced to something like TRE, and in case we decide to use collation in [a-z] ranges, all changes related to r302512 can be backed out, but now we need consistency. Modified: head/gnu/usr.bin/grep/dfa.c Modified: head/gnu/usr.bin/grep/dfa.c ============================================================================== --- head/gnu/usr.bin/grep/dfa.c Wed Jul 13 18:51:19 2016 (r302780) +++ head/gnu/usr.bin/grep/dfa.c Wed Jul 13 19:02:59 2016 (r302781) @@ -2547,8 +2547,13 @@ match_mb_charset (struct dfa *d, int s, wcbuf[2] = work_mbc->range_sts[i]; wcbuf[4] = work_mbc->range_ends[i]; +#ifdef __FreeBSD__ + if (wcscmp(wcbuf, wcbuf+2) >= 0 && + wcscmp(wcbuf+4, wcbuf) >= 0) +#else if (wcscoll(wcbuf, wcbuf+2) >= 0 && wcscoll(wcbuf+4, wcbuf) >= 0) +#endif goto charset_matched; } From owner-svn-src-head@freebsd.org Wed Jul 13 19:16:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C709CB981B9; Wed, 13 Jul 2016 19:16:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79E2B18BF; Wed, 13 Jul 2016 19:16:33 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DJGWSM012091; Wed, 13 Jul 2016 19:16:32 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DJGWtq012089; Wed, 13 Jul 2016 19:16:32 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201607131916.u6DJGWtq012089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 13 Jul 2016 19:16:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302782 - in head/sys: dev/acpica i386/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 19:16:33 -0000 Author: jkim Date: Wed Jul 13 19:16:32 2016 New Revision: 302782 URL: https://svnweb.freebsd.org/changeset/base/302782 Log: Remove a tunable and always reset system clock while resuming with ACPI. Requested by: bde (long ago) Modified: head/sys/dev/acpica/acpi.c head/sys/i386/isa/pmtimer.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Wed Jul 13 19:02:59 2016 (r302781) +++ head/sys/dev/acpica/acpi.c Wed Jul 13 19:16:32 2016 (r302782) @@ -280,14 +280,6 @@ TUNABLE_INT("debug.acpi.default_register SYSCTL_INT(_debug_acpi, OID_AUTO, default_register_width, CTLFLAG_RDTUN, &acpi_ignore_reg_width, 1, "Ignore register widths set by FADT"); -#ifdef __amd64__ -/* Reset system clock while resuming. XXX Remove once tested. */ -static int acpi_reset_clock = 1; -TUNABLE_INT("debug.acpi.reset_clock", &acpi_reset_clock); -SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG_RW, - &acpi_reset_clock, 1, "Reset system clock while resuming."); -#endif - /* Allow users to override quirks. */ TUNABLE_INT("debug.acpi.quirks", &acpi_quirks); @@ -3027,9 +3019,6 @@ backout: static void acpi_resync_clock(struct acpi_softc *sc) { -#ifdef __amd64__ - if (!acpi_reset_clock) - return; /* * Warm up timecounter again and reset system clock. @@ -3037,7 +3026,6 @@ acpi_resync_clock(struct acpi_softc *sc) (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); inittodr(time_second + sc->acpi_sleep_delay); -#endif } /* Enable or disable the device's wake GPE. */ Modified: head/sys/i386/isa/pmtimer.c ============================================================================== --- head/sys/i386/isa/pmtimer.c Wed Jul 13 19:02:59 2016 (r302781) +++ head/sys/i386/isa/pmtimer.c Wed Jul 13 19:16:32 2016 (r302782) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -83,6 +84,9 @@ static int pmtimer_suspend(device_t dev) { + if (power_pm_get_type() == POWER_PM_TYPE_ACPI) + return (0); + microtime(&diff_time); inittodr(0); microtime(&suspend_time); @@ -96,6 +100,9 @@ pmtimer_resume(device_t dev) u_int second, minute, hour; struct timeval resume_time, tmp_time; + if (power_pm_get_type() == POWER_PM_TYPE_ACPI) + return (0); + /* modified for adjkerntz */ timer_restore(); /* restore the all timers */ inittodr(0); /* adjust time to RTC */ From owner-svn-src-head@freebsd.org Wed Jul 13 19:19:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F3A4B982C5; Wed, 13 Jul 2016 19:19:20 +0000 (UTC) (envelope-from badger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 381EE1A91; Wed, 13 Jul 2016 19:19:20 +0000 (UTC) (envelope-from badger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DJJJJx012414; Wed, 13 Jul 2016 19:19:19 GMT (envelope-from badger@FreeBSD.org) Received: (from badger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DJJIcu012408; Wed, 13 Jul 2016 19:19:18 GMT (envelope-from badger@FreeBSD.org) Message-Id: <201607131919.u6DJJIcu012408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: badger set sender to badger@FreeBSD.org using -f From: Eric Badger Date: Wed, 13 Jul 2016 19:19:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302783 - in head/sys: amd64/amd64 i386/i386 kern sys x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 19:19:20 -0000 Author: badger Date: Wed Jul 13 19:19:18 2016 New Revision: 302783 URL: https://svnweb.freebsd.org/changeset/base/302783 Log: Add explicit detection of KVM hypervisor Set vm_guest to a new enum value (VM_GUEST_KVM) when kvm is detected and use vm_guest in conditionals testing for KVM. Also, fix a conditional checking if we're running in a VM which caught only the generic VM case, but not more specific VMs (KVM, VMWare, etc.). (Spotted by: vangyzen). Differential revision: https://reviews.freebsd.org/D7172 Sponsored by: Dell Inc. Approved by: kib (mentor), vangyzen (mentor) Reviewed by: alc MFC after: 4 weeks Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/kern/subr_param.c head/sys/sys/systm.h head/sys/x86/x86/identcpu.c head/sys/x86/x86/local_apic.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/amd64/amd64/pmap.c Wed Jul 13 19:19:18 2016 (r302783) @@ -1224,7 +1224,7 @@ pmap_init(void) * include at least one feature that is only supported by older Intel * or newer AMD processors. */ - if (vm_guest == VM_GUEST_VM && (cpu_feature & CPUID_SS) == 0 && + if (vm_guest != VM_GUEST_NO && (cpu_feature & CPUID_SS) == 0 && (cpu_feature2 & (CPUID2_SSSE3 | CPUID2_SSE41 | CPUID2_AESNI | CPUID2_AVX | CPUID2_XSAVE)) == 0 && (amd_feature2 & (AMDID2_XOP | AMDID2_FMA4)) == 0) Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/i386/i386/pmap.c Wed Jul 13 19:19:18 2016 (r302783) @@ -794,7 +794,7 @@ pmap_init(void) * include at least one feature that is only supported by older Intel * or newer AMD processors. */ - if (vm_guest == VM_GUEST_VM && (cpu_feature & CPUID_SS) == 0 && + if (vm_guest != VM_GUEST_NO && (cpu_feature & CPUID_SS) == 0 && (cpu_feature2 & (CPUID2_SSSE3 | CPUID2_SSE41 | CPUID2_AESNI | CPUID2_AVX | CPUID2_XSAVE)) == 0 && (amd_feature2 & (AMDID2_XOP | AMDID2_FMA4)) == 0) Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/kern/subr_param.c Wed Jul 13 19:19:18 2016 (r302783) @@ -148,6 +148,7 @@ static const char *const vm_guest_sysctl "xen", "hv", "vmware", + "kvm", NULL }; CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/sys/systm.h Wed Jul 13 19:19:18 2016 (r302783) @@ -74,7 +74,7 @@ extern int vm_guest; /* Running as virt * Keep in sync with vm_guest_sysctl_names[]. */ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, - VM_GUEST_VMWARE, VM_LAST }; + VM_GUEST_VMWARE, VM_GUEST_KVM, VM_LAST }; #if defined(WITNESS) || defined(INVARIANT_SUPPORT) void kassert_panic(const char *fmt, ...) __printflike(1, 2); Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/x86/x86/identcpu.c Wed Jul 13 19:19:18 2016 (r302783) @@ -1300,6 +1300,8 @@ identify_hypervisor(void) vm_guest = VM_GUEST_VMWARE; else if (strcmp(hv_vendor, "Microsoft Hv") == 0) vm_guest = VM_GUEST_HV; + else if (strcmp(hv_vendor, "KVMKVMKVM") == 0) + vm_guest = VM_GUEST_KVM; } return; } Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Wed Jul 13 19:16:32 2016 (r302782) +++ head/sys/x86/x86/local_apic.c Wed Jul 13 19:19:18 2016 (r302783) @@ -499,8 +499,7 @@ native_lapic_init(vm_paddr_t addr) ver = lapic_read32(LAPIC_VERSION); if ((ver & APIC_VER_EOI_SUPPRESSION) != 0) { lapic_eoi_suppression = 1; - if (vm_guest == VM_GUEST_VM && - !strcmp(hv_vendor, "KVMKVMKVM")) { + if (vm_guest == VM_GUEST_KVM) { if (bootverbose) printf( "KVM -- disabling lapic eoi suppression\n"); From owner-svn-src-head@freebsd.org Wed Jul 13 19:41:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41EE9B98965; Wed, 13 Jul 2016 19:41:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 149281B1F; Wed, 13 Jul 2016 19:41:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DJfJuS022869; Wed, 13 Jul 2016 19:41:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DJfJdk022868; Wed, 13 Jul 2016 19:41:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201607131941.u6DJfJdk022868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 13 Jul 2016 19:41:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302784 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 19:41:20 -0000 Author: dim Date: Wed Jul 13 19:41:19 2016 New Revision: 302784 URL: https://svnweb.freebsd.org/changeset/base/302784 Log: Fix a page fault in ip6_setpktopt(), occurring when the pflog module is loaded, and syncthing is started, which uses setsockopt(IPV6_PKGINFO). This is because pflog interfaces do not normally have an IPv6 address, causing the ND_IFINFO() macro to dereference a NULL pointer. Reviewed by: ae PR: 210943 MFC after: 3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Wed Jul 13 19:19:18 2016 (r302783) +++ head/sys/netinet6/ip6_output.c Wed Jul 13 19:41:19 2016 (r302784) @@ -2659,8 +2659,8 @@ ip6_setpktopt(int optname, u_char *buf, if (ifp == NULL) return (ENXIO); } - if (ifp != NULL && ( - ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)) + if (ifp != NULL && (ifp->if_afdata[AF_INET6] == NULL || + (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) != 0)) return (ENETDOWN); if (ifp != NULL && From owner-svn-src-head@freebsd.org Wed Jul 13 20:44:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D744CB98C03; Wed, 13 Jul 2016 20:44:03 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A71A011F2; Wed, 13 Jul 2016 20:44:03 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DKi2cv045561; Wed, 13 Jul 2016 20:44:02 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DKi2mL045560; Wed, 13 Jul 2016 20:44:02 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607132044.u6DKi2mL045560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Wed, 13 Jul 2016 20:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302785 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 20:44:03 -0000 Author: jmcneill Date: Wed Jul 13 20:44:02 2016 New Revision: 302785 URL: https://svnweb.freebsd.org/changeset/base/302785 Log: H3/A83T: Use PLL_PERIPH/2 for AHB2 parent clock. Reviewed by: manu Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c Modified: head/sys/arm/allwinner/clk/aw_ahbclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_ahbclk.c Wed Jul 13 19:41:19 2016 (r302784) +++ head/sys/arm/allwinner/clk/aw_ahbclk.c Wed Jul 13 20:44:02 2016 (r302785) @@ -140,10 +140,14 @@ aw_ahbclk_init(struct clknode *clk, devi A83T_AHB1_CLK_SRC_SEL_SHIFT; break; case AW_H3_AHB2: + /* Set source to PLL_PERIPH/2 */ + index = H3_AHB2_CLK_CFG_PLL_PERIPH_DIV2; DEVICE_LOCK(sc); AHBCLK_READ(sc, &val); + val &= ~H3_AHB2_CLK_CFG; + val |= (index << H3_AHB2_CLK_CFG_SHIFT); + AHBCLK_WRITE(sc, val); DEVICE_UNLOCK(sc); - index = (val & H3_AHB2_CLK_CFG) >> H3_AHB2_CLK_CFG_SHIFT; break; default: return (ENXIO); @@ -189,12 +193,7 @@ aw_ahbclk_recalc_freq(struct clknode *cl pre_div = 1; break; case AW_H3_AHB2: - src_sel = (val & H3_AHB2_CLK_CFG) >> H3_AHB2_CLK_CFG_SHIFT; - if (src_sel == H3_AHB2_CLK_CFG_PLL_PERIPH_DIV2) - div = 2; - else - div = 1; - pre_div = 1; + div = pre_div = 1; break; default: div = 1 << ((val & A10_AHB_CLK_DIV_RATIO) >> From owner-svn-src-head@freebsd.org Wed Jul 13 20:46:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B13B6B98CE2; Wed, 13 Jul 2016 20:46:55 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EB8F1546; Wed, 13 Jul 2016 20:46:55 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DKks7V045709; Wed, 13 Jul 2016 20:46:54 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DKkswZ045707; Wed, 13 Jul 2016 20:46:54 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607132046.u6DKkswZ045707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Wed, 13 Jul 2016 20:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302786 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 20:46:55 -0000 Author: jmcneill Date: Wed Jul 13 20:46:54 2016 New Revision: 302786 URL: https://svnweb.freebsd.org/changeset/base/302786 Log: Allwinner Gigabit EMAC performance improvements. - Support DEVICE_POLLING - Increase TX descriptors to 1024 - Add support for passing a chain of mbufs to if_input, reducing the number of calls to mtx_unlock/mtx_lock under load. - Remove duplicate byteswap when setting TX_INT_CTL in TX descriptor. - Set undocumented "TX_NEXT_FRAME" bit in TX control 1 register. According to the A83T BSP, setting this bit allows the DMA engine to operate on a packet while receiving another. Tested on A83T (1000Mbps PHY) and H3 (100Mbps PHY). Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D7031 Modified: head/sys/arm/allwinner/if_awg.c head/sys/arm/allwinner/if_awgreg.h Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Wed Jul 13 20:44:02 2016 (r302785) +++ head/sys/arm/allwinner/if_awg.c Wed Jul 13 20:46:54 2016 (r302786) @@ -30,6 +30,8 @@ * Allwinner Gigabit Ethernet MAC (EMAC) controller */ +#include "opt_device_polling.h" + #include __FBSDID("$FreeBSD$"); @@ -77,7 +79,7 @@ __FBSDID("$FreeBSD$"); #define AWG_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED) #define DESC_ALIGN 4 -#define TX_DESC_COUNT 256 +#define TX_DESC_COUNT 1024 #define TX_DESC_SIZE (sizeof(struct emac_desc) * TX_DESC_COUNT) #define RX_DESC_COUNT 256 #define RX_DESC_SIZE (sizeof(struct emac_desc) * RX_DESC_COUNT) @@ -97,6 +99,7 @@ __FBSDID("$FreeBSD$"); #define RX_TX_PRI_DEFAULT 0 #define PAUSE_TIME_DEFAULT 0x400 #define TX_INTERVAL_DEFAULT 64 +#define RX_BATCH_DEFAULT 64 /* Burst length of RX and TX DMA transfers */ static int awg_burst_len = BURST_LEN_DEFAULT; @@ -114,6 +117,10 @@ TUNABLE_INT("hw.awg.pause_time", &awg_pa static int awg_tx_interval = TX_INTERVAL_DEFAULT; TUNABLE_INT("hw.awg.tx_interval", &awg_tx_interval); +/* Maximum number of mbufs to send to if_input */ +static int awg_rx_batch = RX_BATCH_DEFAULT; +TUNABLE_INT("hw.awg.rx_batch", &awg_rx_batch); + static struct ofw_compat_data compat_data[] = { { "allwinner,sun8i-a83t-emac", 1 }, { NULL, 0 } @@ -353,7 +360,7 @@ awg_setup_txdesc(struct awg_softc *sc, i status = TX_DESC_CTL; size = flags | len; if ((index & (awg_tx_interval - 1)) == 0) - size |= htole32(TX_INT_CTL); + size |= TX_INT_CTL; ++sc->tx.queued; } @@ -617,6 +624,20 @@ awg_setup_rxfilter(struct awg_softc *sc) } static void +awg_enable_intr(struct awg_softc *sc) +{ + /* Enable interrupts */ + WR4(sc, EMAC_INT_EN, RX_INT_EN | TX_INT_EN | TX_BUF_UA_INT_EN); +} + +static void +awg_disable_intr(struct awg_softc *sc) +{ + /* Disable interrupts */ + WR4(sc, EMAC_INT_EN, 0); +} + +static void awg_init_locked(struct awg_softc *sc) { struct mii_data *mii; @@ -640,11 +661,18 @@ awg_init_locked(struct awg_softc *sc) WR4(sc, EMAC_BASIC_CTL_1, val); /* Enable interrupts */ - WR4(sc, EMAC_INT_EN, RX_INT_EN | TX_INT_EN | TX_BUF_UA_INT_EN); +#ifdef DEVICE_POLLING + if ((if_getcapenable(ifp) & IFCAP_POLLING) == 0) + awg_enable_intr(sc); + else + awg_disable_intr(sc); +#else + awg_enable_intr(sc); +#endif /* Enable transmit DMA */ val = RD4(sc, EMAC_TX_CTL_1); - WR4(sc, EMAC_TX_CTL_1, val | TX_DMA_EN | TX_MD); + WR4(sc, EMAC_TX_CTL_1, val | TX_DMA_EN | TX_MD | TX_NEXT_FRAME); /* Enable receive DMA */ val = RD4(sc, EMAC_RX_CTL_1); @@ -703,7 +731,7 @@ awg_stop(struct awg_softc *sc) WR4(sc, EMAC_RX_CTL_0, val & ~RX_EN); /* Disable interrupts */ - WR4(sc, EMAC_INT_EN, 0); + awg_disable_intr(sc); /* Disable transmit DMA */ val = RD4(sc, EMAC_TX_CTL_1); @@ -718,15 +746,18 @@ awg_stop(struct awg_softc *sc) if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE); } -static void +static int awg_rxintr(struct awg_softc *sc) { if_t ifp; - struct mbuf *m, *m0; - int error, index, len; + struct mbuf *m, *m0, *mh, *mt; + int error, index, len, cnt, npkt; uint32_t status; ifp = sc->ifp; + mh = mt = NULL; + cnt = 0; + npkt = 0; bus_dmamap_sync(sc->rx.desc_tag, sc->rx.desc_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -760,9 +791,23 @@ awg_rxintr(struct awg_softc *sc) } } - AWG_UNLOCK(sc); - if_input(ifp, m); - AWG_LOCK(sc); + m->m_nextpkt = NULL; + if (mh == NULL) + mh = m; + else + mt->m_nextpkt = m; + mt = m; + ++cnt; + ++npkt; + + if (cnt == awg_rx_batch) { + AWG_UNLOCK(sc); + if_input(ifp, mh); + AWG_LOCK(sc); + mh = mt = NULL; + cnt = 0; + } + } if ((m0 = awg_alloc_mbufcl(sc)) != NULL) { @@ -779,7 +824,15 @@ awg_rxintr(struct awg_softc *sc) BUS_DMASYNC_PREWRITE); } + if (mh != NULL) { + AWG_UNLOCK(sc); + if_input(ifp, mh); + AWG_LOCK(sc); + } + sc->rx.cur = index; + + return (npkt); } static void @@ -845,6 +898,41 @@ awg_intr(void *arg) AWG_UNLOCK(sc); } +#ifdef DEVICE_POLLING +static int +awg_poll(if_t ifp, enum poll_cmd cmd, int count) +{ + struct awg_softc *sc; + uint32_t val; + int rx_npkts; + + sc = if_getsoftc(ifp); + rx_npkts = 0; + + AWG_LOCK(sc); + + if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) { + AWG_UNLOCK(sc); + return (0); + } + + rx_npkts = awg_rxintr(sc); + awg_txintr(sc); + if (!if_sendq_empty(ifp)) + awg_start_locked(sc); + + if (cmd == POLL_AND_CHECK_STATUS) { + val = RD4(sc, EMAC_INT_STA); + if (val != 0) + WR4(sc, EMAC_INT_STA, val); + } + + AWG_UNLOCK(sc); + + return (rx_npkts); +} +#endif + static int awg_ioctl(if_t ifp, u_long cmd, caddr_t data) { @@ -889,6 +977,25 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t break; case SIOCSIFCAP: mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); +#ifdef DEVICE_POLLING + if (mask & IFCAP_POLLING) { + if ((ifr->ifr_reqcap & IFCAP_POLLING) != 0) { + error = ether_poll_register(awg_poll, ifp); + if (error != 0) + break; + AWG_LOCK(sc); + awg_disable_intr(sc); + if_setcapenablebit(ifp, IFCAP_POLLING, 0); + AWG_UNLOCK(sc); + } else { + error = ether_poll_deregister(ifp); + AWG_LOCK(sc); + awg_enable_intr(sc); + if_setcapenablebit(ifp, 0, IFCAP_POLLING); + AWG_UNLOCK(sc); + } + } +#endif if (mask & IFCAP_VLAN_MTU) if_togglecapenable(ifp, IFCAP_VLAN_MTU); if (mask & IFCAP_RXCSUM) @@ -1374,6 +1481,9 @@ awg_attach(device_t dev) if_sethwassist(sc->ifp, CSUM_IP | CSUM_UDP | CSUM_TCP); if_setcapabilities(sc->ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM); if_setcapenable(sc->ifp, if_getcapabilities(sc->ifp)); +#ifdef DEVICE_POLLING + if_setcapabilitiesbit(sc->ifp, IFCAP_POLLING, 0); +#endif /* Attach MII driver */ error = mii_attach(dev, &sc->miibus, sc->ifp, awg_media_change, Modified: head/sys/arm/allwinner/if_awgreg.h ============================================================================== --- head/sys/arm/allwinner/if_awgreg.h Wed Jul 13 20:44:02 2016 (r302785) +++ head/sys/arm/allwinner/if_awgreg.h Wed Jul 13 20:46:54 2016 (r302786) @@ -65,6 +65,7 @@ #define EMAC_TX_CTL_1 0x14 #define TX_DMA_START (1 << 31) #define TX_DMA_EN (1 << 30) +#define TX_NEXT_FRAME (1 << 2) #define TX_MD (1 << 1) #define FLUSH_TX_FIFO (1 << 0) #define EMAC_TX_FLOW_CTL 0x1c From owner-svn-src-head@freebsd.org Wed Jul 13 21:27:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A374B97C56; Wed, 13 Jul 2016 21:27:12 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE6B1154E; Wed, 13 Jul 2016 21:27:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DLRBJP061211; Wed, 13 Jul 2016 21:27:11 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DLRBtd061210; Wed, 13 Jul 2016 21:27:11 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201607132127.u6DLRBtd061210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 13 Jul 2016 21:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302787 - head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 21:27:12 -0000 Author: vangyzen Date: Wed Jul 13 21:27:10 2016 New Revision: 302787 URL: https://svnweb.freebsd.org/changeset/base/302787 Log: zpool(8): update Hot Spares section to mention zfsd(8) Reviewed and reworded by: asomers MFC after: 3 days Sponsored by: Dell Inc. Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jul 13 20:46:54 2016 (r302786) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jul 13 21:27:10 2016 (r302787) @@ -465,6 +465,15 @@ place in the configuration, and is remov pools. .Pp Spares cannot replace log devices. +.Pp +This feature requires a userland helper. +FreeBSD provides +.Xr zfsd 8 +for this purpose. +It must be manually enabled by adding +.Va zfsd_enable="YES" +to +.Pa /etc/rc.conf . .Ss Intent Log The .Tn ZFS @@ -2023,7 +2032,8 @@ Discarded approximately 29 seconds of tr .El .Sh SEE ALSO .Xr zpool-features 7 , -.Xr zfs 8 +.Xr zfs 8 , +.Xr zfsd 8 .Sh AUTHORS This manual page is a .Xr mdoc 7 @@ -2040,9 +2050,3 @@ The .Xr mdoc 7 implementation of this manual page was initially written by .An Martin Matuska Aq mm@FreeBSD.org . -.Sh CAVEATS -The -.Cm spare -feature requires a utility to detect zpool degradation and initiate -disk replacement within the zpool. -FreeBSD does not provide such a utility at this time. From owner-svn-src-head@freebsd.org Wed Jul 13 21:53:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9EF0B9844C; Wed, 13 Jul 2016 21:53:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x235.google.com (mail-qt0-x235.google.com [IPv6:2607:f8b0:400d:c0d::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5E1D13E5; Wed, 13 Jul 2016 21:53:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x235.google.com with SMTP id 52so33497272qtq.3; Wed, 13 Jul 2016 14:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=B3NOXu1SxQtL0OVgJNV7boeT0Jp9zZVWycfG/uAzCdc=; b=rg/mq3YrsexEJ72zLQ4EwssL+xVmidL1KR3ov/I0zx7gp7b1/gkmDpLyrNv9EEQbjT eowIz0RRW2R01YPT20ZChOHmgqPYikkb6GWKeFjdJyx1INsquI8OOuGfBfh9FQwkKThl PUt9PW0xarukq/m9y62qu9P1l+xPntN75oWf0ECEoVdw3aB8oJ7rKOWbGvX5pYzm9f9K 0sdqm1bhE3W8Y8TDbsk0YhoghPbu3V4I5DgDe+GmpqHTLJvKX3heJHC+4yVKpeva5zXg n74rhtu1exJfbUBuqUDYbo5njqUvbNnzseD7HaAz2i71SA9xrGxcvQ0dpWB8yXj16J21 ajjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=B3NOXu1SxQtL0OVgJNV7boeT0Jp9zZVWycfG/uAzCdc=; b=df8WH+gcGwjSRjX8vlJsUGYQiVRbTKiYKy2jtLjP1YIwAeqnKXcpArDtdhjV+Rmnnw 6tCNNDH0h+4/Wd1lBkAlIpxky0y/rigz6YAzrogbBNQki6s/genFLuuOWp2ZgpGgpesp fXsjwWdVo5bDEy/6TwYF6hy9eC6EOADyRuuTt9Ioq+K37wF5JibJi5oph3gYDQwxPdh6 tNJsPltijd2fn9drWuezO0Ni8jWoVILzbr6VXaamP49B3YZ94gJJTaYQuO5QruY7TuWy F6WzaLRtFyqvgyCIhvsCGvB02Se0/SI61oDgO8JJbQe2qF7MwASrjqFBq5l/Xs2sfi8G bX4A== X-Gm-Message-State: ALyK8tLvpf3P6tU8wnfHCkDr38TVXQK2yvlPigSvO+GNFpLItHIPnf4LDnPNVLUN8hspIYmJjLBcNNqgYsnRCw== X-Received: by 10.237.36.38 with SMTP id r35mr15867913qtc.3.1468446824688; Wed, 13 Jul 2016 14:53:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.148.131 with HTTP; Wed, 13 Jul 2016 14:53:44 -0700 (PDT) In-Reply-To: <201607132127.u6DLRBtd061210@repo.freebsd.org> References: <201607132127.u6DLRBtd061210@repo.freebsd.org> From: Ngie Cooper Date: Wed, 13 Jul 2016 14:53:44 -0700 Message-ID: Subject: Re: svn commit: r302787 - head/cddl/contrib/opensolaris/cmd/zpool To: Eric van Gyzen Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 21:53:46 -0000 On Wed, Jul 13, 2016 at 2:27 PM, Eric van Gyzen wrote: > Author: vangyzen > Date: Wed Jul 13 21:27:10 2016 > New Revision: 302787 > URL: https://svnweb.freebsd.org/changeset/base/302787 > > Log: > zpool(8): update Hot Spares section to mention zfsd(8) I know it's childish, but it reminds me of these meme :)... http://i.imgur.com/MAJ2Y5p.jpg . Cheers :D, -Ngie From owner-svn-src-head@freebsd.org Wed Jul 13 22:53:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66F65B981FC; Wed, 13 Jul 2016 22:53:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 229FC12AC; Wed, 13 Jul 2016 22:53:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DMrUXU094065; Wed, 13 Jul 2016 22:53:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DMrUh5094064; Wed, 13 Jul 2016 22:53:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607132253.u6DMrUh5094064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 13 Jul 2016 22:53:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302788 - head/usr.sbin/acpi/acpidump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 22:53:31 -0000 Author: andrew Date: Wed Jul 13 22:53:30 2016 New Revision: 302788 URL: https://svnweb.freebsd.org/changeset/base/302788 Log: Fix the type used to hold the value returned from getopt. On arm64 char is unsigned so will never be -1. Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/acpi/acpidump/acpidump.c Modified: head/usr.sbin/acpi/acpidump/acpidump.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.c Wed Jul 13 21:27:10 2016 (r302787) +++ head/usr.sbin/acpi/acpidump/acpidump.c Wed Jul 13 22:53:30 2016 (r302788) @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) { ACPI_TABLE_HEADER *rsdt, *sdt; - char c, *progname; + int c; + char *progname; char *dsdt_input_file, *dsdt_output_file; dsdt_input_file = dsdt_output_file = NULL; From owner-svn-src-head@freebsd.org Wed Jul 13 23:03:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91DCBB985B9; Wed, 13 Jul 2016 23:03:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60F4319DB; Wed, 13 Jul 2016 23:03:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DN3YWj097698; Wed, 13 Jul 2016 23:03:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DN3YhJ097696; Wed, 13 Jul 2016 23:03:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607132303.u6DN3YhJ097696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 13 Jul 2016 23:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302789 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 23:03:35 -0000 Author: andrew Date: Wed Jul 13 23:03:34 2016 New Revision: 302789 URL: https://svnweb.freebsd.org/changeset/base/302789 Log: Add memmmap on arm64 so we can mmap /dev/mem and /dev/kmem. Obtained from: ABT Systems Ltd MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/mem.c head/sys/arm64/include/memdev.h Modified: head/sys/arm64/arm64/mem.c ============================================================================== --- head/sys/arm64/arm64/mem.c Wed Jul 13 22:53:30 2016 (r302788) +++ head/sys/arm64/arm64/mem.c Wed Jul 13 23:03:34 2016 (r302789) @@ -114,3 +114,19 @@ memrw(struct cdev *dev, struct uio *uio, return (error); } +/* + * allow user processes to MMAP some memory sections + * instead of going through read/write + */ +/* ARGSUSED */ +int +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) +{ + if (dev2unit(dev) == CDEV_MINOR_MEM) + *paddr = offset; + else if (dev2unit(dev) == CDEV_MINOR_KMEM) + *paddr = vtophys(offset); + /* else panic! */ + return (0); +} Modified: head/sys/arm64/include/memdev.h ============================================================================== --- head/sys/arm64/include/memdev.h Wed Jul 13 22:53:30 2016 (r302788) +++ head/sys/arm64/include/memdev.h Wed Jul 13 23:03:34 2016 (r302789) @@ -35,6 +35,6 @@ d_open_t memopen; d_read_t memrw; #define memioctl (d_ioctl_t *)NULL -#define memmmap (d_mmap_t *)NULL +d_mmap_t memmmap; #endif /* _MACHINE_MEMDEV_H_ */ From owner-svn-src-head@freebsd.org Wed Jul 13 23:49:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37293B98E33; Wed, 13 Jul 2016 23:49:47 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9AE71189; Wed, 13 Jul 2016 23:49:46 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DNnkKh012882; Wed, 13 Jul 2016 23:49:46 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DNnknJ012881; Wed, 13 Jul 2016 23:49:46 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201607132349.u6DNnknJ012881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Wed, 13 Jul 2016 23:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 23:49:47 -0000 Author: allanjude Date: Wed Jul 13 23:49:45 2016 New Revision: 302790 URL: https://svnweb.freebsd.org/changeset/base/302790 Log: bsdinstall: Prompt user to set the date and time after selecting timezone Not having the correct date and time makes many PKI based things not work In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start Submitted by: des (original patch) MFC after: 7 days Modified: head/usr.sbin/bsdinstall/scripts/time Modified: head/usr.sbin/bsdinstall/scripts/time ============================================================================== --- head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:03:34 2016 (r302789) +++ head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:49:45 2016 (r302790) @@ -26,4 +26,40 @@ # # $FreeBSD$ +# Select timezone chroot $BSDINSTALL_CHROOT tzsetup + +# Switch to target timezone +saved_TZ="$TZ" +TZ="${BSDINSTALL_CHROOT}/etc/localtime" +export TZ + +# Set date +exec 3>&1 +DATE=$(dialog --backtitle 'FreeBSD Installer' \ + --title 'Time & Date' \ + --ok-label 'Set Date' \ + --cancel-label 'Skip' \ + --date-format '%Y%m%d%H%M.%S' \ + --calendar '' 2 40 \ +2>&1 1>&3) && date $DATE +exec 3>&- + +# Set time +exec 3>&1 +TIME=$(dialog --backtitle 'FreeBSD Installer' \ + --title 'Time & Date' \ + --ok-label 'Set Time' \ + --cancel-label 'Skip' \ + --time-format '%H%M.%S' \ + --timebox '' 2 40 \ +2>&1 1>&3) && date $TIME +exec 3>&- + +# Switch back +if [ -n "$saved_TZ" ]; then + TZ="$saved_TZ" +else + unset TZ +fi +unset saved_TZ From owner-svn-src-head@freebsd.org Wed Jul 13 23:56:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFA44B98FA7; Wed, 13 Jul 2016 23:56:41 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7892D15F6; Wed, 13 Jul 2016 23:56:41 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x22c.google.com with SMTP id 52so34764631qtq.3; Wed, 13 Jul 2016 16:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Z0pV2YMDcpXVRtly1SBy5PmF8Kv7tpeVv3GMKoQrf1I=; b=K2TbRlFlPQMPGS4ojl8EbEXYC8lJ9J02ZROlOIsetHvO7lNUTe7iSf/CSIvkNCsQoW kvBGwNcSxDzavOIIJV0sb2A4ve1qOMmRDim6Dy9K4ITGXpJclSEi+OpoW7pz5M4EIvyw tTcVd3NB+4VGp17Gk3AI6lqbxYTIsvkJEUMBXREp2tCx7GuAjOJTMvAUIaDVdti4OS31 0Pn58z+RvKW6LpeoSiIc4AL3vz+nRz5U/4U24JBG/IGiRS8q2ezna6RObmp9jkMn3ekh RsVPPcH2VRohML091RYG3TxcdFvCAoKeBZZvtaq5YEjBfK/mqK+w8u9M68K8bF4Gyf1f 8/bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Z0pV2YMDcpXVRtly1SBy5PmF8Kv7tpeVv3GMKoQrf1I=; b=kahETeh5rOIr9IFsFrgqz6O4u9914Qusbt/d9TnhQARt3oJUHYaBKVf4W90RfnSZGt q1y5yxIYwDrjtNpsXMlPcD8XPluzzUW2RIZ5qIXc5dsjwD0d/OHBzonsV6ZArxX0fcQH dOrWJIWTcnRkOAb/tTj0zU++TZFSuyIwTrfV3u1A2b69PzKEJdLSvx8MUrK05ZvhhxYj jLvyr6VWU2j21btmkTqU+IDHrtPbE+D+VAmQoWJKzWQeLjiQOl1Yp0oQcuPsL5V11pi/ 6ah2h7liVIVo+K7Y1rBZofyKfL1GpE0Uj2ncBeTdcxQrobrpxf+dVPCJ73eb691S93A0 0zzg== X-Gm-Message-State: ALyK8tJWJJbIHqMxfjkn+eOfVbXJvMQI7HWkYzUTNg599pEgT3wFr2ALc2hbPWgkrGckntHGT3c6F6lm31SSJQ== X-Received: by 10.237.36.38 with SMTP id r35mr16634861qtc.3.1468454200354; Wed, 13 Jul 2016 16:56:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.148.131 with HTTP; Wed, 13 Jul 2016 16:56:39 -0700 (PDT) In-Reply-To: References: <201607111701.u6BH189R083052@repo.freebsd.org> From: Ngie Cooper Date: Wed, 13 Jul 2016 16:56:39 -0700 Message-ID: Subject: Re: svn commit: r302577 - head/sys/dev/drm2 To: Robert Watson Cc: Garrett Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 23:56:41 -0000 On Wed, Jul 13, 2016 at 4:54 AM, Robert Watson wrote: > On Mon, 11 Jul 2016, Garrett Cooper wrote: > >> Add missing default case to capable(..) function definition >> >> By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN >> aren't possible. Add in a KASSERT safety belt and return false in >> !INVARIANTS case if an invalid value is passed in, as it would be a >> programmer error. >> >> This fixes a -Wreturn-type error with gcc 5.3.0. >> >> Differential Revision: https://reviews.freebsd.org/D7188 >> MFC after: 1 week >> Reported by: devel/amd64-gcc (5.3.0) >> Reviewed by: dumbbell >> Sponsored by: EMC / Isilon Storage Division > > Per my comment in the review, I think a panic() here would be preferable to > a KASSERT(), as it would come without perceptible runtime cost, and failstop > the system if we were violating a design-time security invariant. Good point. I'll commit the change tonight. Thanks! -Ngie From owner-svn-src-head@freebsd.org Thu Jul 14 00:00:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626EFB9837C; Thu, 14 Jul 2016 00:00:40 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DAF7188C; Thu, 14 Jul 2016 00:00:40 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id s63so59342337qkb.2; Wed, 13 Jul 2016 17:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=KcTQHcqNTWU3yR3AU3YNGIlhnzAHQ1ynHL34f4KMFIQ=; b=UVa1pGUoAUS2CwNhi8EECwZjey9Y6zmdt+Ghf3Z0Z3+KFqL11Uw9aHj5FbYvzhfjIC MP7nt0xuQVEBJBJ6gojsPJO0OYIsqEsyJ2zB0mmJefdgWqM0o1waBCAgFyBuwLqsruA6 v7bJtCOFYqmy5CMQ77LLrkwuiEU0oLz6MWUTAPK4SjibbkN04XjU21+EPDRXkhHKoKWM LsfrfpQVdjhdQpLSB/pO+EvojJuNwT0dN9OCiKbbVCKhQlHpLK3MRPo/vlQQUQ6VYQK9 3rNi8yooBUXkazCXjHcnobKCq5M/owepbSPR/OC1zOggZ21OCSHypzLE99gQDver0oG7 n09Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=KcTQHcqNTWU3yR3AU3YNGIlhnzAHQ1ynHL34f4KMFIQ=; b=PyrfB2Z6FikONZHtJqi5zAYA5o1c1mtLZFNyT9T8cVjD9+C7JL56moC/9bOoPYVvW7 p7IQLWDGU7ZcVb029yQEoI3U18NKonr/UATyrdB/08NF+Ds21ZZHhA9547bV1LNXcudu RNqe5A0fOf7bW24ZDaTG6wx5mS47wP/gmMyS40vgnJUJTPtFPm6yEvt2t7zmha4WrdSA 8FLSyrahzYL6dwR546yuWrokQ7kV+zEiDWNe4hyD9k0GPMrjODmpJwmnSjBcFJGZ7XBo ye61SQZzLqhA+ykF44A6kTlViYJWONQEwmAFKBHqtVD6jdqS9PNNy/RPobWNWof+ivPY pkgA== X-Gm-Message-State: ALyK8tKXWVxBDymvBozPj1/ew+a2mt/Kb9L3gRuW9rhTDgpGet1flxQq712512BcDHO5ifhLJ+xSI/nf8yWIAw== X-Received: by 10.55.3.143 with SMTP id 137mr14328268qkd.154.1468454439092; Wed, 13 Jul 2016 17:00:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.148.131 with HTTP; Wed, 13 Jul 2016 17:00:38 -0700 (PDT) In-Reply-To: <201607131826.u6DIQ5WC093292@repo.freebsd.org> References: <201607131826.u6DIQ5WC093292@repo.freebsd.org> From: Ngie Cooper Date: Wed, 13 Jul 2016 17:00:38 -0700 Message-ID: Subject: Re: svn commit: r302779 - head/contrib/ldns-host To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:00:40 -0000 On Wed, Jul 13, 2016 at 11:26 AM, Dag-Erling Sm=C3=B8rgrav wrote: > Author: des > Date: Wed Jul 13 18:26:05 2016 > New Revision: 302779 > URL: https://svnweb.freebsd.org/changeset/base/302779 > > Log: > merge upstream hg 06347b1f76fe (fix IXFR) > > PR: 209177 > MFC after: 3 days > > Modified: > head/contrib/ldns-host/ldns-host.c > Directory Properties: > head/contrib/ldns-host/ (props changed) This change broke gcc. From https://jenkins.freebsd.org/job/FreeBSD_HEAD_sparc64/145 ... --- all_subdir_usr.bin/host --- cc1: warnings being treated as errors /builds/workspace/FreeBSD_HEAD_sparc64/src/usr.bin/host/../../contrib/ldns-= host/ldns-host.c: In function 'dozonetransfer': /builds/workspace/FreeBSD_HEAD_sparc64/src/usr.bin/host/../../contrib/ldns-= host/ldns-host.c:891: warning: 'first_serial' may be used uninitialized in this function *** [ldns-host.o] Error code 1 bmake[4]: stopped in /builds/workspace/FreeBSD_HEAD_sparc64/src/usr.bin/hos= t 1 error bmake[4]: stopped in /builds/workspace/FreeBSD_HEAD_sparc64/src/usr.bin/hos= t *** [all_subdir_usr.bin/host] Error code 2 Thanks, -Ngie From owner-svn-src-head@freebsd.org Thu Jul 14 00:18:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 092D4B98947; Thu, 14 Jul 2016 00:18:53 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3BAC1395; Thu, 14 Jul 2016 00:18:52 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from zeppelin.tachypleus.net (airbears2-136-152-142-124.airbears2.berkeley.edu [136.152.142.124]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6E0IjX4020574 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 13 Jul 2016 17:18:45 -0700 Subject: Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts To: Allan Jude , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607132349.u6DNnknJ012881@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> Date: Wed, 13 Jul 2016 17:18:45 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <201607132349.u6DNnknJ012881@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbNv2RdkaFRJkCiAV7wnY+SwX17EQQhZsCAYX/R3LAKadYQX29kMteqiiATGXP1DZno0PsrUgoxEx1PZURassmUVUgmLhOt1ag= X-Sonic-ID: C;OEvkhlhJ5hGfw5NwxPCmMQ== M;rIwph1hJ5hGfw5NwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:18:53 -0000 Can you please make this dialog default to "skip" for people with systems where the time is set correctly? I realize "OK" is usually a no-op, so the "just press enter" is maintained, but "skip" is even more of a no-op. -Nathan On 07/13/16 16:49, Allan Jude wrote: > Author: allanjude > Date: Wed Jul 13 23:49:45 2016 > New Revision: 302790 > URL: https://svnweb.freebsd.org/changeset/base/302790 > > Log: > bsdinstall: Prompt user to set the date and time after selecting timezone > > Not having the correct date and time makes many PKI based things not work > > In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start > > Submitted by: des (original patch) > MFC after: 7 days > > Modified: > head/usr.sbin/bsdinstall/scripts/time > > Modified: head/usr.sbin/bsdinstall/scripts/time > ============================================================================== > --- head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:03:34 2016 (r302789) > +++ head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:49:45 2016 (r302790) > @@ -26,4 +26,40 @@ > # > # $FreeBSD$ > > +# Select timezone > chroot $BSDINSTALL_CHROOT tzsetup > + > +# Switch to target timezone > +saved_TZ="$TZ" > +TZ="${BSDINSTALL_CHROOT}/etc/localtime" > +export TZ > + > +# Set date > +exec 3>&1 > +DATE=$(dialog --backtitle 'FreeBSD Installer' \ > + --title 'Time & Date' \ > + --ok-label 'Set Date' \ > + --cancel-label 'Skip' \ > + --date-format '%Y%m%d%H%M.%S' \ > + --calendar '' 2 40 \ > +2>&1 1>&3) && date $DATE > +exec 3>&- > + > +# Set time > +exec 3>&1 > +TIME=$(dialog --backtitle 'FreeBSD Installer' \ > + --title 'Time & Date' \ > + --ok-label 'Set Time' \ > + --cancel-label 'Skip' \ > + --time-format '%H%M.%S' \ > + --timebox '' 2 40 \ > +2>&1 1>&3) && date $TIME > +exec 3>&- > + > +# Switch back > +if [ -n "$saved_TZ" ]; then > + TZ="$saved_TZ" > +else > + unset TZ > +fi > +unset saved_TZ > From owner-svn-src-head@freebsd.org Thu Jul 14 00:32:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0144B98E24; Thu, 14 Jul 2016 00:32:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0ECD1DE6; Thu, 14 Jul 2016 00:32:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0WReu030777; Thu, 14 Jul 2016 00:32:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0WRaC030774; Thu, 14 Jul 2016 00:32:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607140032.u6E0WRaC030774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 00:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302792 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:32:29 -0000 Author: markj Date: Thu Jul 14 00:32:27 2016 New Revision: 302792 URL: https://svnweb.freebsd.org/changeset/base/302792 Log: Remove gcore's -s option. It has no effect and is always implicitly set since ptrace(2) stops the target process. Modified: head/usr.bin/gcore/extern.h head/usr.bin/gcore/gcore.1 head/usr.bin/gcore/gcore.c Modified: head/usr.bin/gcore/extern.h ============================================================================== --- head/usr.bin/gcore/extern.h Thu Jul 14 00:26:57 2016 (r302791) +++ head/usr.bin/gcore/extern.h Thu Jul 14 00:32:27 2016 (r302792) @@ -31,7 +31,6 @@ */ #define PFLAGS_FULL 0x01 -#define PFLAGS_RESUME 0x02 struct dumpers { int (*ident)(int efd, pid_t pid, char *binfile); Modified: head/usr.bin/gcore/gcore.1 ============================================================================== --- head/usr.bin/gcore/gcore.1 Thu Jul 14 00:26:57 2016 (r302791) +++ head/usr.bin/gcore/gcore.1 Thu Jul 14 00:32:27 2016 (r302792) @@ -28,7 +28,7 @@ .\" @(#)gcore.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 14, 2010 +.Dd July 13, 2016 .Dt GCORE 1 .Os .Sh NAME @@ -37,7 +37,6 @@ .Sh SYNOPSIS .Nm .Op Fl f -.Op Fl s .Op Fl c Ar core .Op Ar executable .Ar pid @@ -66,15 +65,6 @@ behavior. As a result, this flag should only be used when the behavior of the application and any devices it has mapped is fully understood and any side effects can be controlled or tolerated. -.It Fl s -Stop the process while gathering the core image, and resume it -when done. -This guarantees that the resulting core dump will -be in a consistent state. -The process is resumed even if it was -already stopped. -The same effect can be achieved manually with -.Xr kill 1 . .El .Sh FILES .Bl -tag -width /var/log/messages -compact Modified: head/usr.bin/gcore/gcore.c ============================================================================== --- head/usr.bin/gcore/gcore.c Thu Jul 14 00:26:57 2016 (r302791) +++ head/usr.bin/gcore/gcore.c Thu Jul 14 00:32:27 2016 (r302792) @@ -87,7 +87,7 @@ main(int argc, char *argv[]) pflags = 0; corefile = NULL; - while ((ch = getopt(argc, argv, "c:fs")) != -1) { + while ((ch = getopt(argc, argv, "c:f")) != -1) { switch (ch) { case 'c': corefile = optarg; @@ -95,9 +95,6 @@ main(int argc, char *argv[]) case 'f': pflags |= PFLAGS_FULL; break; - case 's': - pflags |= PFLAGS_RESUME; - break; default: usage(); break; From owner-svn-src-head@freebsd.org Thu Jul 14 00:38:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1839FB98FC9; Thu, 14 Jul 2016 00:38:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E416B11E6; Thu, 14 Jul 2016 00:38:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0c5Vl031025; Thu, 14 Jul 2016 00:38:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0c5W6031024; Thu, 14 Jul 2016 00:38:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607140038.u6E0c5W6031024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 00:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302793 - head/sys/x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:38:06 -0000 Author: markj Date: Thu Jul 14 00:38:04 2016 New Revision: 302793 URL: https://svnweb.freebsd.org/changeset/base/302793 Log: Allow ACPI wakeup code and page tables to be stored in non-contiguous pages. Since these pages are allocated from a narrow range of memory, this makes the allocation more likely to succeed. Suggested by: kib Reviewed by: jkim, kib MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D7154 Modified: head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Thu Jul 14 00:32:27 2016 (r302792) +++ head/sys/x86/acpica/acpi_wakeup.c Thu Jul 14 00:38:04 2016 (r302793) @@ -88,7 +88,7 @@ static cpuset_t suspcpus; static struct susppcb **susppcbs; #endif -static void *acpi_alloc_wakeup_handler(void); +static void *acpi_alloc_wakeup_handler(void **); static void acpi_stop_beep(void *); #ifdef SMP @@ -97,18 +97,14 @@ static void acpi_wakeup_cpus(struct acp #endif #ifdef __amd64__ -#define ACPI_PAGETABLES 3 +#define ACPI_WAKEPAGES 4 #else -#define ACPI_PAGETABLES 0 +#define ACPI_WAKEPAGES 1 #endif -#define WAKECODE_VADDR(sc) \ - ((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE)) -#define WAKECODE_PADDR(sc) \ - ((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE)) #define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ - addr = (type *)(WAKECODE_VADDR(sc) + offset); \ + addr = (type *)(sc->acpi_wakeaddr + (offset)); \ *addr = val; \ } while (0) @@ -125,7 +121,7 @@ static int acpi_wakeup_ap(struct acpi_softc *sc, int cpu) { struct pcb *pcb; - int vector = (WAKECODE_PADDR(sc) >> 12) & 0xff; + int vector = (sc->acpi_wakephys >> 12) & 0xff; int apic_id = cpu_apic_ids[cpu]; int ms; @@ -168,7 +164,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) /* setup a vector to our boot code */ *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; - *((volatile u_short *)WARMBOOT_SEG) = WAKECODE_PADDR(sc) >> 4; + *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ @@ -209,7 +205,7 @@ acpi_sleep_machdep(struct acpi_softc *sc if (acpi_resume_beep != 0) timer_spkr_acquire(); - AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc), 0); + AcpiSetFirmwareWakingVector(sc->acpi_wakephys, 0); intr_suspend(); @@ -309,11 +305,12 @@ acpi_wakeup_machdep(struct acpi_softc *s } static void * -acpi_alloc_wakeup_handler(void) +acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) { - void *wakeaddr; int i; + memset(wakepages, 0, ACPI_WAKEPAGES * sizeof(*wakepages)); + /* * Specify the region for our wakeup code. We want it in the low 1 MB * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA @@ -321,18 +318,18 @@ acpi_alloc_wakeup_handler(void) * and ROM area (0xa0000 and above). The temporary page tables must be * page-aligned. */ - wakeaddr = contigmalloc((ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); - if (wakeaddr == NULL) { - printf("%s: can't alloc wake memory\n", __func__); - return (NULL); + for (i = 0; i < ACPI_WAKEPAGES; i++) { + wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT, + 0x500, 0xa0000, PAGE_SIZE, 0ul); + if (wakepages[i] == NULL) { + printf("%s: can't alloc wake memory\n", __func__); + goto freepages; + } } if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST) == NULL) { printf("%s: can't register event handler\n", __func__); - contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, - M_DEVBUF); - return (NULL); + goto freepages; } susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); for (i = 0; i < mp_ncpus; i++) { @@ -340,39 +337,56 @@ acpi_alloc_wakeup_handler(void) susppcbs[i]->sp_fpususpend = alloc_fpusave(M_WAITOK); } - return (wakeaddr); + return (wakepages); + +freepages: + for (i = 0; i < ACPI_WAKEPAGES; i++) + if (wakepages[i] != NULL) + contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); + return (NULL); } void acpi_install_wakeup_handler(struct acpi_softc *sc) { - static void *wakeaddr = NULL; + static void *wakeaddr; + void *wakepages[ACPI_WAKEPAGES]; #ifdef __amd64__ uint64_t *pt4, *pt3, *pt2; + vm_paddr_t pt4pa, pt3pa, pt2pa; int i; #endif if (wakeaddr != NULL) return; - wakeaddr = acpi_alloc_wakeup_handler(); - if (wakeaddr == NULL) + if (acpi_alloc_wakeup_handler(wakepages) == NULL) return; + wakeaddr = wakepages[0]; sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; sc->acpi_wakephys = vtophys(wakeaddr); - bcopy(wakecode, (void *)WAKECODE_VADDR(sc), sizeof(wakecode)); +#ifdef __amd64__ + pt4 = wakepages[1]; + pt3 = wakepages[2]; + pt2 = wakepages[3]; + pt4pa = vtophys(pt4); + pt3pa = vtophys(pt3); + pt2pa = vtophys(pt2); +#endif + + bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); /* Patch GDT base address, ljmp targets. */ WAKECODE_FIXUP((bootgdtdesc + 2), uint32_t, - WAKECODE_PADDR(sc) + bootgdt); + sc->acpi_wakephys + bootgdt); WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t, - WAKECODE_PADDR(sc) + wakeup_32); + sc->acpi_wakephys + wakeup_32); #ifdef __amd64__ WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t, - WAKECODE_PADDR(sc) + wakeup_64); - WAKECODE_FIXUP(wakeup_pagetables, uint32_t, sc->acpi_wakephys); + sc->acpi_wakephys + wakeup_64); + WAKECODE_FIXUP(wakeup_pagetables, uint32_t, pt4pa); #endif /* Save pointers to some global data. */ @@ -384,33 +398,28 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); #endif -#else - /* Build temporary page tables below realmode code. */ - pt4 = wakeaddr; - pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t); - pt2 = pt3 + (PAGE_SIZE) / sizeof(uint64_t); - +#else /* __amd64__ */ /* Create the initial 1GB replicated page tables */ for (i = 0; i < 512; i++) { /* * Each slot of the level 4 pages points * to the same level 3 page */ - pt4[i] = (uint64_t)(sc->acpi_wakephys + PAGE_SIZE); + pt4[i] = (uint64_t)pt3pa; pt4[i] |= PG_V | PG_RW | PG_U; /* * Each slot of the level 3 pages points * to the same level 2 page */ - pt3[i] = (uint64_t)(sc->acpi_wakephys + (2 * PAGE_SIZE)); + pt3[i] = (uint64_t)pt2pa; pt3[i] |= PG_V | PG_RW | PG_U; /* The level 2 page slots are mapped with 2MB pages for 1GB. */ pt2[i] = i * (2 * 1024 * 1024); pt2[i] |= PG_V | PG_RW | PG_PS | PG_U; } -#endif +#endif /* !__amd64__ */ if (bootverbose) device_printf(sc->acpi_dev, "wakeup code va %#jx pa %#jx\n", From owner-svn-src-head@freebsd.org Thu Jul 14 00:40:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E33BB97082; Thu, 14 Jul 2016 00:40:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04D371380; Thu, 14 Jul 2016 00:40:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0eOM5031167; Thu, 14 Jul 2016 00:40:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0eO9F031166; Thu, 14 Jul 2016 00:40:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607140040.u6E0eO9F031166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 00:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302794 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:40:25 -0000 Author: markj Date: Thu Jul 14 00:40:24 2016 New Revision: 302794 URL: https://svnweb.freebsd.org/changeset/base/302794 Log: Move some gmirror metadata update messages to a higher debug level. These can be printed quite frequently from a mostly-idle mirror, cluttering the console. MFC after: 1 week Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Thu Jul 14 00:38:04 2016 (r302793) +++ head/sys/geom/mirror/g_mirror.c Thu Jul 14 00:40:24 2016 (r302794) @@ -829,7 +829,7 @@ g_mirror_idle(struct g_mirror_softc *sc, LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) continue; - G_MIRROR_DEBUG(1, "Disk %s (device %s) marked as clean.", + G_MIRROR_DEBUG(2, "Disk %s (device %s) marked as clean.", g_mirror_get_diskname(disk), sc->sc_name); disk->d_flags &= ~G_MIRROR_DISK_FLAG_DIRTY; g_mirror_update_metadata(disk); @@ -852,7 +852,7 @@ g_mirror_unidle(struct g_mirror_softc *s LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state != G_MIRROR_DISK_STATE_ACTIVE) continue; - G_MIRROR_DEBUG(1, "Disk %s (device %s) marked as dirty.", + G_MIRROR_DEBUG(2, "Disk %s (device %s) marked as dirty.", g_mirror_get_diskname(disk), sc->sc_name); disk->d_flags |= G_MIRROR_DISK_FLAG_DIRTY; g_mirror_update_metadata(disk); @@ -1924,12 +1924,12 @@ g_mirror_update_idle(struct g_mirror_sof if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOFAILSYNC) != 0) return; if (!sc->sc_idle && (disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) == 0) { - G_MIRROR_DEBUG(1, "Disk %s (device %s) marked as dirty.", + G_MIRROR_DEBUG(2, "Disk %s (device %s) marked as dirty.", g_mirror_get_diskname(disk), sc->sc_name); disk->d_flags |= G_MIRROR_DISK_FLAG_DIRTY; } else if (sc->sc_idle && (disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) != 0) { - G_MIRROR_DEBUG(1, "Disk %s (device %s) marked as clean.", + G_MIRROR_DEBUG(2, "Disk %s (device %s) marked as clean.", g_mirror_get_diskname(disk), sc->sc_name); disk->d_flags &= ~G_MIRROR_DISK_FLAG_DIRTY; } From owner-svn-src-head@freebsd.org Thu Jul 14 00:41:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43726B9711D; Thu, 14 Jul 2016 00:41:20 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 128EF1697; Thu, 14 Jul 2016 00:41:20 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0fJ0L031889; Thu, 14 Jul 2016 00:41:19 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0fJeh031888; Thu, 14 Jul 2016 00:41:19 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201607140041.u6E0fJeh031888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 14 Jul 2016 00:41:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302795 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:41:20 -0000 Author: allanjude Date: Thu Jul 14 00:41:19 2016 New Revision: 302795 URL: https://svnweb.freebsd.org/changeset/base/302795 Log: Make the new 'set date and time' dialog default to skip X-MFC-With: 302790 Requested by: nwhitehorn Modified: head/usr.sbin/bsdinstall/scripts/time Modified: head/usr.sbin/bsdinstall/scripts/time ============================================================================== --- head/usr.sbin/bsdinstall/scripts/time Thu Jul 14 00:40:24 2016 (r302794) +++ head/usr.sbin/bsdinstall/scripts/time Thu Jul 14 00:41:19 2016 (r302795) @@ -40,6 +40,7 @@ DATE=$(dialog --backtitle 'FreeBSD Insta --title 'Time & Date' \ --ok-label 'Set Date' \ --cancel-label 'Skip' \ + --defaultno \ --date-format '%Y%m%d%H%M.%S' \ --calendar '' 2 40 \ 2>&1 1>&3) && date $DATE @@ -51,6 +52,7 @@ TIME=$(dialog --backtitle 'FreeBSD Insta --title 'Time & Date' \ --ok-label 'Set Time' \ --cancel-label 'Skip' \ + --defaultno \ --time-format '%H%M.%S' \ --timebox '' 2 40 \ 2>&1 1>&3) && date $TIME From owner-svn-src-head@freebsd.org Thu Jul 14 00:41:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 286D3B97174; Thu, 14 Jul 2016 00:41:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D66491847; Thu, 14 Jul 2016 00:41:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0fcMJ033926; Thu, 14 Jul 2016 00:41:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0fbpC033924; Thu, 14 Jul 2016 00:41:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607140041.u6E0fbpC033924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 00:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302796 - in head: etc/defaults share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:41:39 -0000 Author: markj Date: Thu Jul 14 00:41:37 2016 New Revision: 302796 URL: https://svnweb.freebsd.org/changeset/base/302796 Log: Remove more references to mroute6d, which was removed in r298512. Modified: head/etc/defaults/rc.conf head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Thu Jul 14 00:41:19 2016 (r302795) +++ head/etc/defaults/rc.conf Thu Jul 14 00:41:37 2016 (r302796) @@ -512,12 +512,6 @@ rtadvd_enable="NO" # Set to YES to enab # this router becomes a possible candidate # IPv6 default router for local subnets. rtadvd_interfaces="" # Interfaces rtadvd sends RA packets. -mroute6d_enable="NO" # Do IPv6 multicast routing. -mroute6d_program="/usr/local/sbin/pim6dd" # Name of IPv6 multicast - # routing daemon. You need to - # install it from package or - # port. -mroute6d_flags="" # Flags to IPv6 multicast routing daemon. stf_interface_ipv4addr="" # Local IPv4 addr for 6to4 IPv6 over IPv4 # tunneling interface. Specify this entry # to enable 6to4 interface. Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Thu Jul 14 00:41:19 2016 (r302795) +++ head/share/man/man5/rc.conf.5 Thu Jul 14 00:41:37 2016 (r302796) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 8, 2016 +.Dd July 13, 2016 .Dt RC.CONF 5 .Os .Sh NAME @@ -2818,35 +2818,6 @@ these are the flags to pass to the routi .Pq Vt str The IPv6 equivalent of .Va routed_flags . -.It Va mroute6d_enable -.Pq Vt bool -If set to -.Dq Li YES , -run the IPv6 multicast routing daemon. -.Pp -Note that multicast routing daemons are no longer included in the -.Fx -base system, however, both -.Xr mrouted 8 -and -.Xr pim6dd 8 -may be installed from the -.Fx -Ports Collection. -.It Va mroute6d_flags -.Pq Vt str -If -.Va mroute6d_enable -is set to -.Dq Li YES , -these are the flags passed to the IPv6 multicast routing daemon. -.It Va mroute6d_program -.Pq Vt str -If -.Va mroute6d_enable -is set to -.Dq Li YES , -this is the path to the IPv6 multicast routing daemon. .It Va rtadvd_enable .Pq Vt bool If set to From owner-svn-src-head@freebsd.org Thu Jul 14 00:41:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3131CB971CE; Thu, 14 Jul 2016 00:41:57 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AF491A24; Thu, 14 Jul 2016 00:41:56 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (unknown [10.1.1.2]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 46DF61E28; Thu, 14 Jul 2016 00:41:55 +0000 (UTC) Subject: Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts To: Nathan Whitehorn , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607132349.u6DNnknJ012881@repo.freebsd.org> <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> From: Allan Jude Message-ID: Date: Wed, 13 Jul 2016 20:41:54 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EEct0IfWSXdXiXtkrXld5fVbbWhBBKrTo" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:41:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EEct0IfWSXdXiXtkrXld5fVbbWhBBKrTo Content-Type: multipart/mixed; boundary="c2xft71SlSKdiQkHRHLUwXIEojJsQQhWD" From: Allan Jude To: Nathan Whitehorn , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts References: <201607132349.u6DNnknJ012881@repo.freebsd.org> <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> In-Reply-To: <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> --c2xft71SlSKdiQkHRHLUwXIEojJsQQhWD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-07-13 20:18, Nathan Whitehorn wrote: > Can you please make this dialog default to "skip" for people with > systems where the time is set correctly? I realize "OK" is usually a > no-op, so the "just press enter" is maintained, but "skip" is even more= > of a no-op. > -Nathan >=20 > On 07/13/16 16:49, Allan Jude wrote: >> Author: allanjude >> Date: Wed Jul 13 23:49:45 2016 >> New Revision: 302790 >> URL: https://svnweb.freebsd.org/changeset/base/302790 >> >> Log: >> bsdinstall: Prompt user to set the date and time after selecting >> timezone >> Not having the correct date and time makes many PKI based things= >> not work >> In 10 and 11, it can mean that Unbound, ntpd, and sshd won't sta= rt >> Submitted by: des (original patch) >> MFC after: 7 days >> >> Modified: >> head/usr.sbin/bsdinstall/scripts/time >> Changed to --defaultno for both in r302795. --=20 Allan Jude --c2xft71SlSKdiQkHRHLUwXIEojJsQQhWD-- --EEct0IfWSXdXiXtkrXld5fVbbWhBBKrTo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJXht/SAAoJEBmVNT4SmAt+QzEP/3PlS0m2aCWVUQCQSQRBX1LN 0TKX397hmAf3tmnYkatnrqFpaopB+u0tIA1zIovu6LtUZUX/pE/B2XarLLs0Xju5 cKA5s22Cv4Wwpksfoa3OVl8owTDmDWPAE7vfThaQolkRpJQPFsVSek1WP/lU4BHp Uyyfn1hJgH/4SdGuKz6rDr+8NHVnfQhymHG13doF+/qlV4nHOhY2IKqxk5kKGkBK c4o4mBlzu3T+wqadWPe9UWH2wTNd2z4LPafGol72lhEIw4aoe93/zZjigDLp5ZV7 gilW4vOz1oE7hV+EkjWjHvjxLh3ywHHYlhefP7Xz8Rw7Lf8UwhsXkNgGlvoEZ17B irzP3Z3Zfqf3jG+n/+J2/CJt17qbrrLAAF0dXvWyvYqdKAjPfqyIXmCNekNdEPG/ 4i8uLr4HwplmPwqhZhK0akgfPCv37EwdYdBcr6E8YPZNM9qaIpbq1AfHq/iv+Lcv EVO4kwEAMaigCuVILyelwLVz6phnNcxbnHckRBptVkNqhbgahSyDSityjO6CkT4f WwQOU90vcDeHUP27zjM2zXo7ZHzkLNK2SS9xyL4JFmBWm90WaUjoPE/CP0Nba9km ZHr85ieMX/SRvhtSJVWh7YBIhun2XYJ3geouLYElNMis+FPcIuMNMGsGxrFuGeVC 5Sv1993KSZHPl6OBd6QR =lhRz -----END PGP SIGNATURE----- --EEct0IfWSXdXiXtkrXld5fVbbWhBBKrTo-- From owner-svn-src-head@freebsd.org Thu Jul 14 00:42:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96457B97368; Thu, 14 Jul 2016 00:42:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 649951C11; Thu, 14 Jul 2016 00:42:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E0gRGH034579; Thu, 14 Jul 2016 00:42:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E0gRnx034578; Thu, 14 Jul 2016 00:42:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607140042.u6E0gRnx034578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 00:42:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302797 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:42:28 -0000 Author: markj Date: Thu Jul 14 00:42:27 2016 New Revision: 302797 URL: https://svnweb.freebsd.org/changeset/base/302797 Log: Document DDB's "alltrace" and "show all trace" commands. MFC after: 3 days Modified: head/share/man/man4/ddb.4 Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Thu Jul 14 00:41:37 2016 (r302796) +++ head/share/man/man4/ddb.4 Thu Jul 14 00:42:27 2016 (r302797) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 6, 2016 +.Dd July 13, 2016 .Dt DDB 4 .Os .Sh NAME @@ -535,6 +535,11 @@ modifier will alter the display to show addresses for the process and not show other information. .\" .Pp +.It Ic show Cm all trace +.It Ic alltrace +.Xc +Show a stack trace for every thread in the system. +.Pp .It Ic show Cm all ttys Show all TTY's within the system. Output is similar to From owner-svn-src-head@freebsd.org Thu Jul 14 00:49:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA370B97423; Thu, 14 Jul 2016 00:49:12 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 959B21E1B; Thu, 14 Jul 2016 00:49:12 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from aurora.physics.berkeley.edu (aurora.physics.berkeley.edu [128.32.117.67]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6E0nAVX019633 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 13 Jul 2016 17:49:10 -0700 Subject: Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts To: Allan Jude , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607132349.u6DNnknJ012881@repo.freebsd.org> <929a22c0-e16a-7ddf-3303-025f25faed3a@freebsd.org> From: Nathan Whitehorn Message-ID: Date: Wed, 13 Jul 2016 17:49:09 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVaGKvK06/DtYtC+grZ92zjLaGroGuKBkNtWWF8fE0bpDq7PVwC1bvXiDlnoJX7/W5R6Cu6DEeYi0VHQ1HmauD4VY/htjMw6srA= X-Sonic-ID: C;Rl6xxlxJ5hGVBpNwxPCmMQ== M;lKrkxlxJ5hGVBpNwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 00:49:12 -0000 On 07/13/16 17:41, Allan Jude wrote: > On 2016-07-13 20:18, Nathan Whitehorn wrote: >> Can you please make this dialog default to "skip" for people with >> systems where the time is set correctly? I realize "OK" is usually a >> no-op, so the "just press enter" is maintained, but "skip" is even more >> of a no-op. >> -Nathan >> >> On 07/13/16 16:49, Allan Jude wrote: >>> Author: allanjude >>> Date: Wed Jul 13 23:49:45 2016 >>> New Revision: 302790 >>> URL: https://svnweb.freebsd.org/changeset/base/302790 >>> >>> Log: >>> bsdinstall: Prompt user to set the date and time after selecting >>> timezone >>> Not having the correct date and time makes many PKI based things >>> not work >>> In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start >>> Submitted by: des (original patch) >>> MFC after: 7 days >>> >>> Modified: >>> head/usr.sbin/bsdinstall/scripts/time >>> > Changed to --defaultno for both in r302795. > > Thanks! -Nathan From owner-svn-src-head@freebsd.org Thu Jul 14 01:00:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25DDCB9768A for ; Thu, 14 Jul 2016 01:00:39 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B13D11486 for ; Thu, 14 Jul 2016 01:00:38 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f43.google.com with SMTP id f93so51205600lfi.2 for ; Wed, 13 Jul 2016 18:00:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=GaZX3Zul7amFxu9OXBSO+o+VbSL2HHuNJ57ZuUh8dXA=; b=ZFjT+H0HPjS3MAokJWSTq1utUZji0NzilyAnntiGDffiVI/I2QvktZ7Ch8SKoECCRZ No89lslcOzzuY7+KJm01Zrzn+SOp7oMY2TC+lVAU5M5QwEe/mOyWZNHBgwinWiY8PFmF SSPlXFFAV7sykd4evzKxwCnEwrFl8hNmw+F9b/Xxd95ldfoGnTE1qjE63YWPid8QFkf6 Pb3tEDCokT7F3ugra0be93+Boc4+zTy3mWMzGg1773yCPTGKgS5XQMxDb3ADJEbtgVoA aX033DqZzbwKvEMF/y1pVv+zVzKL7ZTE97nB2QvptKOtPlHPy3WQjOZ1IpIZUQUmtvTe 6w/A== X-Gm-Message-State: ALyK8tIDE621vcAGQ1lq+M30RU9DTZf4b5VPQgnJfft9TOuduGXBAF19X+zCm6vd1u9Prg== X-Received: by 10.25.154.136 with SMTP id c130mr5564967lfe.87.1468458026291; Wed, 13 Jul 2016 18:00:26 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id o10sm2456631lfo.47.2016.07.13.18.00.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2016 18:00:25 -0700 (PDT) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [clang 3.8.0: powerpc has odd mix of signed wchar_t and unsigned char] To: Mark Millard References: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> <38CF2C28-3BD1-4D09-939F-4DD0C2E8B58F@dsl-only.net> Cc: svn-src-head@freebsd.org, FreeBSD Current , freebsd-stable@freebsd.org, freebsd-arm , FreeBSD PowerPC ML , Bruce Evans , FreeBSD Toolchain From: Andrey Chernov Message-ID: Date: Thu, 14 Jul 2016 04:00:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <38CF2C28-3BD1-4D09-939F-4DD0C2E8B58F@dsl-only.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 01:00:39 -0000 On 13.07.2016 11:53, Mark Millard wrote: > [The below does note that TARGET=powerpc has a mix of signed wchar_t and unsigned char types and most architectures have both being signed types.] POSIX says nothing about wchar_t and char should be the same (un)signed. It is arm ABI docs may say so only. They are different entities differently encoded and cross assigning between wchar_t and char is not recommended. > > On 2016-Jul-11, at 8:57 PM, Andrey Chernov wrote: > >> On 12.07.2016 5:44, Mark Millard wrote: >>> My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: >>> >>> A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion of >>> ___wchar_t (if that is distinct). >>> B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; not >>> necessarily a valid char value >>> C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; not >>> necessarily a valid char value >> >> It seems you are right about "not a valid char value", I'll back this >> change out. >> >>> As far as I know arm FreeBSD uses unsigned character types (of whatever >>> width). >> >> Probably it should be unsigned for other architectures too, clang does >> not generate negative values with L'' literals and locale use only >> positive values too. > > Looking around: > > # grep -i wchar sys/*/include/_types.h > sys/arm/include/_types.h:typedef unsigned int ___wchar_t; > sys/arm/include/_types.h:#define __WCHAR_MIN 0 /* min value for a wchar_t */ > sys/arm/include/_types.h:#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ > sys/arm64/include/_types.h:typedef unsigned int ___wchar_t; > sys/arm64/include/_types.h:#define __WCHAR_MIN 0 /* min value for a wchar_t */ > sys/arm64/include/_types.h:#define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ > sys/mips/include/_types.h:typedef int ___wchar_t; > sys/mips/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ > sys/mips/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ > sys/powerpc/include/_types.h:typedef int ___wchar_t; > sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ > sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ > sys/riscv/include/_types.h:typedef int ___wchar_t; > sys/riscv/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ > sys/riscv/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ > sys/sparc64/include/_types.h:typedef int ___wchar_t; > sys/sparc64/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ > sys/sparc64/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ > sys/x86/include/_types.h:typedef int ___wchar_t; > sys/x86/include/_types.h:#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ > sys/x86/include/_types.h:#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ > > So only arm and arm64 have unsigned wchar_t types. > > [NOTE: __CHAR16_TYPE__ and __CHAR32_TYPE__ are always unsigned: in C++11 terms char16_t is like std::uint_least16_t and char32_t is like std::uint_least32_t despite being distinct types. So __CHAR16_TYPE__ and __CHAR32_TYPE__ are ignored below.] > > The clang 3.8.0 compiler output has an odd mix for TARGET_ARCH=powerpc and TARGET_ARCH=powerpc64 . . . > > armv6 has unsigned types for both char and __WCHAR_TYPE__. > aarch64 has unsigned types for both char and __WCHAR_TYPE__. > powerpc has unsigned for char but signed for __WCHAR_TYPE__. > powerpc64 has unsigned for char but signed for __WCHAR_TYPE__. > amd64 has signed types for both char and __WCHAR_TYPE__. > i386 has signed types for both char and __WCHAR_TYPE__. > mips has signed types for both char and __WCHAR_TYPE__. > sparc64 has signed types for both char and __WCHAR_TYPE__. > (riscv is not covered by clang as I understand) > > The details via compiler #define's. . . > > # clang --target=armv6-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 4294967295U > #define __WCHAR_TYPE__ unsigned int > #define __WCHAR_UNSIGNED__ 1 > #define __WCHAR_WIDTH__ 32 > . . . > > # clang --target=aarch64-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 4294967295U > #define __WCHAR_TYPE__ unsigned int > #define __WCHAR_UNSIGNED__ 1 > #define __WCHAR_WIDTH__ 32 > . . . > > # clang --target=powerpc-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > Is powerpc wrong? > > # clang --target=powerpc64-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > Is powerpc64 wrong? > > > # clang --target=amd64-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . > > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > # clang --target=i386-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . > > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > > # clang --target=mips-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . > > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > # clang --target=sparc64-freebsd11 -std=c99 -E -dM - < /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . > > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . > > > > === > Mark Millard > markmi at dsl-only.net > From owner-svn-src-head@freebsd.org Thu Jul 14 01:16:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3255EB97DD7; Thu, 14 Jul 2016 01:16:09 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F37F61DCE; Thu, 14 Jul 2016 01:16:08 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E1G8lk045519; Thu, 14 Jul 2016 01:16:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E1G8lv045518; Thu, 14 Jul 2016 01:16:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607140116.u6E1G8lv045518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 14 Jul 2016 01:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302798 - head/etc/defaults X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 01:16:09 -0000 Author: cy Date: Thu Jul 14 01:16:07 2016 New Revision: 302798 URL: https://svnweb.freebsd.org/changeset/base/302798 Log: Restore lost comment from r301295. PR: 211027 Reported by: Trond.Endrestol@ximalas.info Pointy hat to: cy@ (me) MFC after: 3 days Modified: head/etc/defaults/periodic.conf Modified: head/etc/defaults/periodic.conf ============================================================================== --- head/etc/defaults/periodic.conf Thu Jul 14 00:42:27 2016 (r302797) +++ head/etc/defaults/periodic.conf Thu Jul 14 01:16:07 2016 (r302798) @@ -137,6 +137,7 @@ daily_status_mail_rejects_shorten="NO" # 480.leapfile-ntpd daily_ntpd_leapfile_enable="YES" # Fetch NTP leapfile daily_ntpd_avoid_congestion="YES" # Avoid congesting + # leapfile sources # 480.status-ntpd daily_status_ntpd_enable="NO" # Check NTP status From owner-svn-src-head@freebsd.org Thu Jul 14 02:25:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6336AB98281; Thu, 14 Jul 2016 02:25:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BF1B1CCD; Thu, 14 Jul 2016 02:25:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E2PTaN071061; Thu, 14 Jul 2016 02:25:29 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E2PTtk071060; Thu, 14 Jul 2016 02:25:29 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607140225.u6E2PTtk071060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 14 Jul 2016 02:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302799 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 02:25:30 -0000 Author: pfg Date: Thu Jul 14 02:25:29 2016 New Revision: 302799 URL: https://svnweb.freebsd.org/changeset/base/302799 Log: mail(1): Bring some fixes from other BSDs. Fix missing forked job changes from r302776 in wait_child(). Obtained from: NetBSD Modified: head/usr.bin/mail/popen.c Modified: head/usr.bin/mail/popen.c ============================================================================== --- head/usr.bin/mail/popen.c Thu Jul 14 01:16:07 2016 (r302798) +++ head/usr.bin/mail/popen.c Thu Jul 14 02:25:29 2016 (r302799) @@ -362,21 +362,30 @@ int wait_status; int wait_child(pid_t pid) { - sigset_t nset, oset; struct child *cp; + sigset_t nset, oset; + pid_t rv = 0; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); - (void)sigprocmask(SIG_BLOCK, &nset, &oset); - + (void)sigprocmask(SIG_BLOCK, &nset, &oset); + /* + * If we have not already waited on the pid (via sigchild) + * wait on it now. Otherwise, use the wait status stashed + * by sigchild. + */ cp = findchild(pid, 1); - - while (!cp->done) - (void)sigsuspend(&oset); - wait_status = cp->status; - delchild(cp); + if (cp == NULL || !cp->done) + rv = waitpid(pid, &wait_status, 0); + else + wait_status = cp->status; + if (cp != NULL) + delchild(cp); (void)sigprocmask(SIG_SETMASK, &oset, NULL); - return ((WIFEXITED(wait_status) && WEXITSTATUS(wait_status)) ? -1 : 0); + if (rv == -1 || (WIFEXITED(wait_status) && WEXITSTATUS(wait_status))) + return -1; + else + return 0; } /* From owner-svn-src-head@freebsd.org Thu Jul 14 05:14:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3F87B973AF; Thu, 14 Jul 2016 05:14:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3EB116A3; Thu, 14 Jul 2016 05:14:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E5ECi2033579; Thu, 14 Jul 2016 05:14:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E5ECLu033578; Thu, 14 Jul 2016 05:14:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140514.u6E5ECLu033578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 05:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302801 - head/sys/dev/hyperv/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 05:14:14 -0000 Author: sephe Date: Thu Jul 14 05:14:12 2016 New Revision: 302801 URL: https://svnweb.freebsd.org/changeset/base/302801 Log: hyperv/vmbus: Remove unused bits MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7091 Modified: head/sys/dev/hyperv/include/hyperv.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 04:30:42 2016 (r302800) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 05:14:12 2016 (r302801) @@ -192,13 +192,6 @@ typedef struct { uint64_t transaction_id; } __packed hv_vm_packet_descriptor; -typedef uint32_t hv_previous_packet_offset; - -typedef struct { - hv_previous_packet_offset previous_packet_start_offset; - hv_vm_packet_descriptor descriptor; -} __packed hv_vm_packet_header; - typedef struct { uint32_t byte_count; uint32_t byte_offset; @@ -213,91 +206,6 @@ typedef struct { hv_vm_transfer_page ranges[1]; } __packed hv_vm_transfer_page_packet_header; -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint32_t reserved; -} __packed hv_vm_gpadl_packet_header; - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint16_t transfer_page_set_id; - uint16_t reserved; -} __packed hv_vm_add_remove_transfer_page_set; - -/* - * This structure defines a range in guest - * physical space that can be made - * to look virtually contiguous. - */ - -typedef struct { - uint32_t byte_count; - uint32_t byte_offset; - uint64_t pfn_array[0]; -} __packed hv_gpa_range; - -/* - * This is the format for an Establish Gpadl packet, which contains a handle - * by which this GPADL will be known and a set of GPA ranges associated with - * it. This can be converted to a MDL by the guest OS. If there are multiple - * GPA ranges, then the resulting MDL will be "chained," representing multiple - * VA ranges. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint32_t range_count; - hv_gpa_range range[1]; -} __packed hv_vm_establish_gpadl; - -/* - * This is the format for a Teardown Gpadl packet, which indicates that the - * GPADL handle in the Establish Gpadl packet will never be referenced again. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - /* for alignment to a 8-byte boundary */ - uint32_t reserved; -} __packed hv_vm_teardown_gpadl; - -/* - * This is the format for a GPA-Direct packet, which contains a set of GPA - * ranges, in addition to commands and/or data. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t reserved; - uint32_t range_count; - hv_gpa_range range[1]; -} __packed hv_vm_data_gpa_direct; - -/* - * This is the format for a Additional data Packet. - */ -typedef struct { - hv_vm_packet_descriptor d; - uint64_t total_bytes; - uint32_t byte_offset; - uint32_t byte_count; - uint8_t data[1]; -} __packed hv_vm_additional_data; - -typedef union { - hv_vm_packet_descriptor simple_header; - hv_vm_transfer_page_packet_header transfer_page_header; - hv_vm_gpadl_packet_header gpadl_header; - hv_vm_add_remove_transfer_page_set add_remove_transfer_page_header; - hv_vm_establish_gpadl establish_gpadl_header; - hv_vm_teardown_gpadl teardown_gpadl_header; - hv_vm_data_gpa_direct data_gpa_direct_header; -} __packed hv_vm_packet_largest_possible_header; - typedef enum { HV_VMBUS_PACKET_TYPE_INVALID = 0x0, HV_VMBUS_PACKET_TYPES_SYNCH = 0x1, @@ -347,14 +255,6 @@ typedef struct { } __packed hv_vmbus_channel_msg_header; /* - * Query VMBus Version parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t version; -} __packed hv_vmbus_channel_query_vmbus_version; - -/* * Channel Offer parameters */ typedef struct { @@ -383,20 +283,6 @@ typedef struct { uint32_t connection_id; } __packed hv_vmbus_channel_offer_channel; -/* - * Rescind Offer parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_rescind_offer; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_relid_released; - #define HW_MACADDR_LEN 6 /* @@ -505,18 +391,6 @@ typedef enum { HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, } hv_vmbus_channel_state; -/* - * Connection identifier type - */ -typedef union { - uint32_t as_uint32_t; - struct { - uint32_t id:24; - uint32_t reserved:8; - } u; - -} __packed hv_vmbus_connection_id; - typedef struct hv_vmbus_channel { device_t ch_dev; struct vmbus_softc *vmbus_sc; From owner-svn-src-head@freebsd.org Thu Jul 14 05:25:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 854C6B97609; Thu, 14 Jul 2016 05:25:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 435511BAD; Thu, 14 Jul 2016 05:25:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E5PWXZ037332; Thu, 14 Jul 2016 05:25:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E5PV2B037320; Thu, 14 Jul 2016 05:25:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140525.u6E5PV2B037320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 05:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302802 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 05:25:33 -0000 Author: sephe Date: Thu Jul 14 05:25:31 2016 New Revision: 302802 URL: https://svnweb.freebsd.org/changeset/base/302802 Log: hyperv: hv_guid -> struct hyperv_guid. This paves way for the further cleanup/disentangle. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7092 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_if.m Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 05:25:31 2016 (r302802) @@ -121,25 +121,13 @@ typedef uint8_t hv_bool_uint8_t; ((HV_ALIGN_UP(addr+len, PAGE_SIZE) - \ HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) -typedef struct hv_guid { - uint8_t data[16]; -} __packed hv_guid; +struct hyperv_guid { + uint8_t hv_guid[16]; +} __packed; #define HYPERV_GUID_STRLEN 40 -int hyperv_guid2str(const struct hv_guid *, char *, size_t); - -#define HV_NIC_GUID \ - .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, \ - 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} - -#define HV_IDE_GUID \ - .data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \ - 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} - -#define HV_SCSI_GUID \ - .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \ - 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} +int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); /* * At the center of the Channel Management library is @@ -148,8 +136,8 @@ int hyperv_guid2str(const struct hv_guid */ typedef struct hv_vmbus_channel_offer { - hv_guid interface_type; - hv_guid interface_instance; + struct hyperv_guid interface_type; + struct hyperv_guid interface_instance; uint64_t interrupt_latency_in_100ns_units; uint32_t interface_revision; uint32_t server_context_area_size; /* in bytes */ @@ -477,8 +465,8 @@ typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ - struct hv_guid ch_guid_type; - struct hv_guid ch_guid_inst; + struct hyperv_guid ch_guid_type; + struct hyperv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 05:25:31 2016 (r302802) @@ -399,8 +399,8 @@ hn_ifmedia_sts(struct ifnet *ifp, struct } /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const hv_guid g_net_vsc_device_type = { - .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, +static const struct hyperv_guid g_net_vsc_device_type = { + .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} }; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Jul 14 05:25:31 2016 (r302802) @@ -180,14 +180,14 @@ enum hv_storage_type { #define HV_STORAGE_SUPPORTS_MULTI_CHANNEL 0x1 /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ -static const hv_guid gStorVscDeviceType={ - .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, +static const struct hyperv_guid gStorVscDeviceType={ + .hv_guid = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} }; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ -static const hv_guid gBlkVscDeviceType={ - .data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, +static const struct hyperv_guid gBlkVscDeviceType={ + .hv_guid = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} }; Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Thu Jul 14 05:25:31 2016 (r302802) @@ -39,7 +39,7 @@ #include "vmbus_if.h" /* Heartbeat Service */ -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }; Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Thu Jul 14 05:25:31 2016 (r302802) @@ -90,7 +90,7 @@ static int hv_kvp_log = 0; log(LOG_INFO, "hv_kvp: " __VA_ARGS__); \ } while (0) -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6} }; Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Thu Jul 14 05:25:31 2016 (r302802) @@ -43,7 +43,7 @@ #include "hv_util.h" #include "vmbus_if.h" -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, 0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB} }; Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Thu Jul 14 05:25:31 2016 (r302802) @@ -55,7 +55,7 @@ typedef struct { } time_sync_data; /* Time Synch Service */ -static const hv_guid service_guid = {.data = +static const struct hyperv_guid service_guid = {.hv_guid = {0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:25:31 2016 (r302802) @@ -128,9 +128,9 @@ vmbus_channel_process_offer(hv_vmbus_cha TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, - sizeof(hv_guid)) == 0 && + sizeof(struct hyperv_guid)) == 0 && memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, - sizeof(hv_guid)) == 0) + sizeof(struct hyperv_guid)) == 0) break; } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 05:25:31 2016 (r302802) @@ -56,8 +56,8 @@ typedef struct { typedef struct { uint32_t rel_id; hv_vmbus_channel_state state; - hv_guid interface_type; - hv_guid interface_instance; + struct hyperv_guid interface_type; + struct hyperv_guid interface_instance; uint32_t monitor_id; uint32_t server_monitor_pending; uint32_t server_monitor_latency; Modified: head/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hyperv.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/vmbus/hyperv.c Thu Jul 14 05:25:31 2016 (r302802) @@ -116,9 +116,9 @@ hypercall_signal_event(bus_addr_t monprm } int -hyperv_guid2str(const struct hv_guid *guid, char *buf, size_t sz) +hyperv_guid2str(const struct hyperv_guid *guid, char *buf, size_t sz) { - const uint8_t *d = guid->data; + const uint8_t *d = guid->hv_guid; return snprintf(buf, sz, "%02x%02x%02x%02x-" "%02x%02x-%02x%02x-%02x%02x-" Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 05:25:31 2016 (r302802) @@ -1051,11 +1051,12 @@ vmbus_get_version_method(device_t bus, d } static int -vmbus_probe_guid_method(device_t bus, device_t dev, const struct hv_guid *guid) +vmbus_probe_guid_method(device_t bus, device_t dev, + const struct hyperv_guid *guid) { const struct hv_vmbus_channel *chan = vmbus_get_channel(dev); - if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hv_guid)) == 0) + if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hyperv_guid)) == 0) return 0; return ENXIO; } Modified: head/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_if.m Thu Jul 14 05:14:12 2016 (r302801) +++ head/sys/dev/hyperv/vmbus/vmbus_if.m Thu Jul 14 05:25:31 2016 (r302802) @@ -32,7 +32,7 @@ INTERFACE vmbus; HEADER { - struct hv_guid; + struct hyperv_guid; }; METHOD uint32_t get_version { @@ -43,5 +43,5 @@ METHOD uint32_t get_version { METHOD int probe_guid { device_t bus; device_t dev; - const struct hv_guid *guid; + const struct hyperv_guid *guid; }; From owner-svn-src-head@freebsd.org Thu Jul 14 05:33:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88F7CB979BB; Thu, 14 Jul 2016 05:33:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470FD1667; Thu, 14 Jul 2016 05:33:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E5XXCc041848; Thu, 14 Jul 2016 05:33:33 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E5XX85041846; Thu, 14 Jul 2016 05:33:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140533.u6E5XX85041846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 05:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302803 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 05:33:34 -0000 Author: sephe Date: Thu Jul 14 05:33:33 2016 New Revision: 302803 URL: https://svnweb.freebsd.org/changeset/base/302803 Log: hyperv/vmbus: Move channel offer message definition to vmbus_reg.h - Avoid bit fields. - Avoid unnecessary indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7093 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:25:31 2016 (r302802) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:33:33 2016 (r302803) @@ -42,7 +42,7 @@ typedef void (*vmbus_chanmsg_proc_t) static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); static void vmbus_channel_on_offer_internal(struct vmbus_softc *, - const hv_vmbus_channel_offer_channel *offer); + const struct vmbus_chanmsg_choffer *); static void vmbus_chan_detach_task(void *, int); static void vmbus_channel_on_offer(struct vmbus_softc *, @@ -267,18 +267,16 @@ vmbus_channel_select_defcpu(struct hv_vm static void vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_offer_channel *offer; - /* New channel is offered by vmbus */ vmbus_scan_newchan(sc); - offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; - vmbus_channel_on_offer_internal(sc, offer); + vmbus_channel_on_offer_internal(sc, + (const struct vmbus_chanmsg_choffer *)msg->msg_data); } static void vmbus_channel_on_offer_internal(struct vmbus_softc *sc, - const hv_vmbus_channel_offer_channel *offer) + const struct vmbus_chanmsg_choffer *offer) { hv_vmbus_channel* new_channel; @@ -286,14 +284,14 @@ vmbus_channel_on_offer_internal(struct v * Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(sc); - new_channel->ch_id = offer->child_rel_id; - new_channel->ch_subidx = offer->offer.sub_channel_index; - new_channel->ch_guid_type = offer->offer.interface_type; - new_channel->ch_guid_inst = offer->offer.interface_instance; + new_channel->ch_id = offer->chm_chanid; + new_channel->ch_subidx = offer->chm_subidx; + new_channel->ch_guid_type = offer->chm_chtype; + new_channel->ch_guid_inst = offer->chm_chinst; /* Batch reading is on by default */ new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - if (offer->monitor_allocated) + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_monprm = hyperv_dmamem_alloc( @@ -309,15 +307,15 @@ vmbus_channel_on_offer_internal(struct v } new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_monprm->mp_connid = offer->connection_id; + new_channel->ch_monprm->mp_connid = offer->chm_connid; if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { new_channel->ch_montrig_idx = - offer->monitor_id / VMBUS_MONTRIG_LEN; + offer->chm_montrig / VMBUS_MONTRIG_LEN; if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) - panic("invalid monitor id %u", offer->monitor_id); + panic("invalid monitor trigger %u", offer->chm_montrig); new_channel->ch_montrig_mask = - 1 << (offer->monitor_id % VMBUS_MONTRIG_LEN); + 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } /* Select default cpu for this channel. */ Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Thu Jul 14 05:25:31 2016 (r302802) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Thu Jul 14 05:33:33 2016 (r302803) @@ -31,6 +31,7 @@ #include #include +#include /* XXX for hyperv_guid */ /* * Hyper-V SynIC message format. @@ -121,6 +122,7 @@ struct vmbus_gpa_range { * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHOFFER 1 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ @@ -248,4 +250,27 @@ struct vmbus_chanmsg_chrescind { uint32_t chm_chanid; } __packed; +/* VMBUS_CHANMSG_TYPE_CHOFFER */ +struct vmbus_chanmsg_choffer { + struct vmbus_chanmsg_hdr chm_hdr; + struct hyperv_guid chm_chtype; + struct hyperv_guid chm_chinst; + uint64_t chm_chlat; /* unit: 100ns */ + uint32_t chm_chrev; + uint32_t chm_svrctx_sz; + uint16_t chm_chflags; + uint16_t chm_mmio_sz; /* unit: MB */ + uint8_t chm_udata[120]; + uint16_t chm_subidx; + uint16_t chm_rsvd; + uint32_t chm_chanid; + uint8_t chm_montrig; + uint8_t chm_flags1; /* VMBUS_CHOFFER_FLAG1_ */ + uint16_t chm_flags2; + uint32_t chm_connid; +} __packed; +CTASSERT(sizeof(struct vmbus_chanmsg_choffer) <= VMBUS_MSG_DSIZE_MAX); + +#define VMBUS_CHOFFER_FLAG1_HASMNF 0x01 + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-head@freebsd.org Thu Jul 14 05:49:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF503B97DA5; Thu, 14 Jul 2016 05:49:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70AF51BB1; Thu, 14 Jul 2016 05:49:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E5nEx5045643; Thu, 14 Jul 2016 05:49:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E5nEa6045641; Thu, 14 Jul 2016 05:49:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140549.u6E5nEa6045641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 05:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302804 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 05:49:15 -0000 Author: sephe Date: Thu Jul 14 05:49:14 2016 New Revision: 302804 URL: https://svnweb.freebsd.org/changeset/base/302804 Log: hyperv/vmbus: Switch to vmbus channel message macros Prepare for more cleanup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7094 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:33:33 2016 (r302803) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:49:14 2016 (r302804) @@ -52,27 +52,30 @@ static void vmbus_channel_on_offers_deli static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, const struct vmbus_message *); -/** - * Channel message dispatch table +/* + * Vmbus channel message processing. */ + +#define VMBUS_CHANMSG_PROC(name, func) \ + [VMBUS_CHANMSG_TYPE_##name] = func +#define VMBUS_CHANMSG_PROC_WAKEUP(name) \ + VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) + static const vmbus_chanmsg_proc_t -vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = { - [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] = - vmbus_channel_on_offer, - [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] = - vmbus_chan_msgproc_chrescind, - [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = - vmbus_channel_on_offers_delivered, - [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_GPADL_CREATED] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = - vmbus_msghc_wakeup +vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) }; +#undef VMBUS_CHANMSG_PROC_WAKEUP +#undef VMBUS_CHANMSG_PROC + /** * @brief Allocate and initialize a vmbus channel object */ Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Thu Jul 14 05:33:33 2016 (r302803) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Thu Jul 14 05:49:14 2016 (r302804) @@ -125,6 +125,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_CHOFFER 1 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CHOFFER_DONE 4 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ #define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */ @@ -137,6 +138,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */ +#define VMBUS_CHANMSG_TYPE_MAX 22 struct vmbus_chanmsg_hdr { uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ From owner-svn-src-head@freebsd.org Thu Jul 14 06:00:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D031CB98104; Thu, 14 Jul 2016 06:00:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9219511AF; Thu, 14 Jul 2016 06:00:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E60eVA049380; Thu, 14 Jul 2016 06:00:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E60eE3049378; Thu, 14 Jul 2016 06:00:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140600.u6E60eE3049378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302805 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:00:41 -0000 Author: sephe Date: Thu Jul 14 06:00:40 2016 New Revision: 302805 URL: https://svnweb.freebsd.org/changeset/base/302805 Log: hyperv/vmbus: Remove unused bits MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7095 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 05:49:14 2016 (r302804) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 06:00:40 2016 (r302805) @@ -82,32 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) -/* - * Make maximum size of pipe payload of 16K - */ - -#define HV_MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384) - -/* - * Define pipe_mode values - */ - -#define HV_VMBUS_PIPE_TYPE_BYTE 0x00000000 -#define HV_VMBUS_PIPE_TYPE_MESSAGE 0x00000004 - -/* - * The size of the user defined data buffer for non-pipe offers - */ - -#define HV_MAX_USER_DEFINED_BYTES 120 - -/* - * The size of the user defined data buffer for pipe offers - */ - -#define HV_MAX_PIPE_USER_DEFINED_BYTES 116 - - #define HV_MAX_PAGE_BUFFER_COUNT 32 #define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 @@ -129,49 +103,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -/* - * At the center of the Channel Management library is - * the Channel Offer. This struct contains the - * fundamental information about an offer. - */ - -typedef struct hv_vmbus_channel_offer { - struct hyperv_guid interface_type; - struct hyperv_guid interface_instance; - uint64_t interrupt_latency_in_100ns_units; - uint32_t interface_revision; - uint32_t server_context_area_size; /* in bytes */ - uint16_t channel_flags; - uint16_t mmio_megabytes; /* in bytes * 1024 * 1024 */ - union - { - /* - * Non-pipes: The user has HV_MAX_USER_DEFINED_BYTES bytes. - */ - struct { - uint8_t user_defined[HV_MAX_USER_DEFINED_BYTES]; - } __packed standard; - - /* - * Pipes: The following structure is an integrated pipe protocol, which - * is implemented on top of standard user-defined data. pipe - * clients have HV_MAX_PIPE_USER_DEFINED_BYTES left for their - * own use. - */ - struct { - uint32_t pipe_mode; - uint8_t user_defined[HV_MAX_PIPE_USER_DEFINED_BYTES]; - } __packed pipe; - } u; - - /* - * Sub_channel_index, newly added in Win8. - */ - uint16_t sub_channel_index; - uint16_t padding; - -} __packed hv_vmbus_channel_offer; - typedef struct { uint16_t type; uint16_t data_offset8; @@ -213,64 +144,6 @@ typedef enum { #define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 -/* - * Version 1 messages - */ -typedef enum { - HV_CHANNEL_MESSAGE_INVALID = 0, - HV_CHANNEL_MESSAGE_OFFER_CHANNEL = 1, - HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER = 2, - HV_CHANNEL_MESSAGE_REQUEST_OFFERS = 3, - HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED = 4, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL = 5, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT = 6, - HV_CHANNEL_MESSAGE_CLOSE_CHANNEL = 7, - HV_CHANNEL_MESSAGEL_GPADL_HEADER = 8, - HV_CHANNEL_MESSAGE_GPADL_BODY = 9, - HV_CHANNEL_MESSAGE_GPADL_CREATED = 10, - HV_CHANNEL_MESSAGE_GPADL_TEARDOWN = 11, - HV_CHANNEL_MESSAGE_GPADL_TORNDOWN = 12, - HV_CHANNEL_MESSAGE_REL_ID_RELEASED = 13, - HV_CHANNEL_MESSAGE_INITIATED_CONTACT = 14, - HV_CHANNEL_MESSAGE_VERSION_RESPONSE = 15, - HV_CHANNEL_MESSAGE_UNLOAD = 16, - HV_CHANNEL_MESSAGE_COUNT -} hv_vmbus_channel_msg_type; - -typedef struct { - hv_vmbus_channel_msg_type message_type; - uint32_t padding; -} __packed hv_vmbus_channel_msg_header; - -/* - * Channel Offer parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - hv_vmbus_channel_offer offer; - uint32_t child_rel_id; - uint8_t monitor_id; - /* - * This field has been split into a bit field on Win7 - * and higher. - */ - uint8_t monitor_allocated:1; - uint8_t reserved:7; - /* - * Following fields were added in win7 and higher. - * Make sure to check the version before accessing these fields. - * - * If "is_dedicated_interrupt" is set, we must not set the - * associated bit in the channel bitmap while sending the - * interrupt to the host. - * - * connection_id is used in signaling the host. - */ - uint16_t is_dedicated_interrupt:1; - uint16_t reserved1:15; - uint32_t connection_id; -} __packed hv_vmbus_channel_offer_channel; - #define HW_MACADDR_LEN 6 /* Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 05:49:14 2016 (r302804) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:00:40 2016 (r302805) @@ -565,7 +565,7 @@ vmbus_chan_msgproc(struct vmbus_softc *s uint32_t msg_type; msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; - if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { + if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", msg_type); return; From owner-svn-src-head@freebsd.org Thu Jul 14 06:10:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E59FEB9840D; Thu, 14 Jul 2016 06:10:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99E2E181A; Thu, 14 Jul 2016 06:10:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6A083052985; Thu, 14 Jul 2016 06:10:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6A0w6052983; Thu, 14 Jul 2016 06:10:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140610.u6E6A0w6052983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302806 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:10:02 -0000 Author: sephe Date: Thu Jul 14 06:10:00 2016 New Revision: 302806 URL: https://svnweb.freebsd.org/changeset/base/302806 Log: hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7100 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:00:40 2016 (r302805) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:10:00 2016 (r302806) @@ -897,25 +897,23 @@ vmbus_event_flags_proc(struct vmbus_soft int f; for (f = 0; f < flag_cnt; ++f) { - uint32_t rel_id_base; + uint32_t chid_base; u_long flags; - int bit; + int chid_ofs; if (event_flags[f] == 0) continue; flags = atomic_swap_long(&event_flags[f], 0); - rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + chid_base = f << VMBUS_EVTFLAG_SHIFT; - while ((bit = ffsl(flags)) != 0) { + while ((chid_ofs = ffsl(flags)) != 0) { struct hv_vmbus_channel *channel; - uint32_t rel_id; - --bit; /* NOTE: ffsl is 1-based */ - flags &= ~(1UL << bit); + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); - rel_id = rel_id_base + bit; - channel = sc->vmbus_chmap[rel_id]; + channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:00:40 2016 (r302805) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:10:00 2016 (r302806) @@ -113,20 +113,18 @@ vmbus_channel_process_offer(hv_vmbus_cha { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; - uint32_t relid; - relid = new_channel->ch_id; /* * Make sure this is a new offer */ mtx_lock(&sc->vmbus_chlist_lock); - if (relid == 0) { + if (new_channel->ch_id == 0) { /* * XXX channel0 will not be processed; skip it. */ printf("VMBUS: got channel0 offer\n"); } else { - sc->vmbus_chmap[relid] = new_channel; + sc->vmbus_chmap[new_channel->ch_id] = new_channel; } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { From owner-svn-src-head@freebsd.org Thu Jul 14 06:10:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 489B8B98463; Thu, 14 Jul 2016 06:10:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1507A19DB; Thu, 14 Jul 2016 06:10:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6AGP0053038; Thu, 14 Jul 2016 06:10:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6AGvS053037; Thu, 14 Jul 2016 06:10:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607140610.u6E6AGvS053037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 14 Jul 2016 06:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302807 - head/contrib/ldns-host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:10:17 -0000 Author: ngie Date: Thu Jul 14 06:10:16 2016 New Revision: 302807 URL: https://svnweb.freebsd.org/changeset/base/302807 Log: Initialize first_serial to 0 in dozonetransfer(..) to fix -Wuninitialized warning MFC after: 3 days X-MFC with: r302779 Pointyhat to: des PR: 209177 Reported by: Jenkins (sparc64 job), gcc 4.2.1, gcc 5.3.0 Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/ldns-host/ldns-host.c Modified: head/contrib/ldns-host/ldns-host.c ============================================================================== --- head/contrib/ldns-host/ldns-host.c Thu Jul 14 06:10:00 2016 (r302806) +++ head/contrib/ldns-host/ldns-host.c Thu Jul 14 06:10:16 2016 (r302807) @@ -888,7 +888,7 @@ dozonetransfer(ldns_resolver *res, ldns_ ldns_rr_list *rrl; ldns_rr *rr; size_t i, nsoa = 0; - uint32_t first_serial; + uint32_t first_serial = 0; rrtype = o_rrtype; o_rrtype = (o_mode == M_AXFR) ? LDNS_RR_TYPE_AXFR : LDNS_RR_TYPE_IXFR; From owner-svn-src-head@freebsd.org Thu Jul 14 06:18:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FA38B9861D; Thu, 14 Jul 2016 06:18:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D8301E59; Thu, 14 Jul 2016 06:18:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6IBDh056792; Thu, 14 Jul 2016 06:18:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6IBgM056790; Thu, 14 Jul 2016 06:18:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140618.u6E6IBgM056790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302808 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:18:12 -0000 Author: sephe Date: Thu Jul 14 06:18:11 2016 New Revision: 302808 URL: https://svnweb.freebsd.org/changeset/base/302808 Log: hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7101 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:10:16 2016 (r302807) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:18:11 2016 (r302808) @@ -40,7 +40,6 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); static void vmbus_channel_on_offer_internal(struct vmbus_softc *, const struct vmbus_chanmsg_choffer *); static void vmbus_chan_detach_task(void *, int); @@ -76,32 +75,39 @@ vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE #undef VMBUS_CHANMSG_PROC_WAKEUP #undef VMBUS_CHANMSG_PROC -/** - * @brief Allocate and initialize a vmbus channel object - */ static struct hv_vmbus_channel * -hv_vmbus_allocate_channel(struct vmbus_softc *sc) +vmbus_chan_alloc(struct vmbus_softc *sc) { - struct hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; - channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO); - channel->vmbus_sc = sc; + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); - mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(&channel->sc_list_anchor); - TASK_INIT(&channel->ch_detach_task, 0, vmbus_chan_detach_task, channel); + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &chan->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(&chan->sc_lock, "vmbus multi channel", NULL, MTX_DEF); + TAILQ_INIT(&chan->sc_list_anchor); + TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); - return (channel); + return chan; } -/** - * @brief Release the resources used by the vmbus channel object - */ -void -hv_vmbus_free_vmbus_channel(hv_vmbus_channel* channel) +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) { - mtx_destroy(&channel->sc_lock); - free(channel, M_DEVBUF); + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); + mtx_destroy(&chan->sc_lock); + free(chan, M_DEVBUF); } /** @@ -200,7 +206,7 @@ vmbus_channel_process_offer(hv_vmbus_cha printf("VMBUS: duplicated primary channel%u\n", new_channel->ch_id); - hv_vmbus_free_vmbus_channel(new_channel); + vmbus_chan_free(new_channel); return; } @@ -284,7 +290,13 @@ vmbus_channel_on_offer_internal(struct v /* * Allocate the channel object and save this offer */ - new_channel = hv_vmbus_allocate_channel(sc); + new_channel = vmbus_chan_alloc(sc); + if (new_channel == NULL) { + device_printf(sc->vmbus_dev, "allocate chan%u failed\n", + offer->chm_chanid); + return; + } + new_channel->ch_id = offer->chm_chanid; new_channel->ch_subidx = offer->chm_subidx; new_channel->ch_guid_type = offer->chm_chtype; @@ -295,17 +307,6 @@ vmbus_channel_on_offer_internal(struct v if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; - new_channel->ch_monprm = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), - &new_channel->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (new_channel->ch_monprm == NULL) { - device_printf(sc->vmbus_dev, "monprm alloc failed\n"); - /* XXX */ - mtx_destroy(&new_channel->sc_lock); - free(new_channel, M_DEVBUF); - return; - } new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) new_channel->ch_monprm->mp_connid = offer->chm_connid; @@ -410,7 +411,7 @@ remove: mtx_unlock(&pri_chan->sc_lock); wakeup(pri_chan); - hv_vmbus_free_vmbus_channel(chan); + vmbus_chan_free(chan); } } @@ -445,7 +446,7 @@ hv_vmbus_release_unattached_channels(str /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(channel); } - hv_vmbus_free_vmbus_channel(channel); + vmbus_chan_free(channel); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 06:10:16 2016 (r302807) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 06:18:11 2016 (r302808) @@ -147,7 +147,6 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); void hv_vmbus_release_unattached_channels( struct vmbus_softc *); From owner-svn-src-head@freebsd.org Thu Jul 14 06:29:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A152DB988C5; Thu, 14 Jul 2016 06:29:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 630F7162E; Thu, 14 Jul 2016 06:29:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6TCXF060648; Thu, 14 Jul 2016 06:29:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6TCTY060647; Thu, 14 Jul 2016 06:29:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140629.u6E6TCTY060647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:29:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302809 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:29:13 -0000 Author: sephe Date: Thu Jul 14 06:29:12 2016 New Revision: 302809 URL: https://svnweb.freebsd.org/changeset/base/302809 Log: hyperv/vmbus: Move device register and channel free to the caller. This paves the way for more cleanup/disentangle. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7102 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:18:11 2016 (r302808) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:29:12 2016 (r302809) @@ -114,8 +114,8 @@ vmbus_chan_free(struct hv_vmbus_channel * @brief Process the offer by creating a channel/device * associated with this offer */ -static void -vmbus_channel_process_offer(hv_vmbus_channel *new_channel) +static int +vmbus_chan_add(hv_vmbus_channel *new_channel) { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; @@ -126,9 +126,13 @@ vmbus_channel_process_offer(hv_vmbus_cha mtx_lock(&sc->vmbus_chlist_lock); if (new_channel->ch_id == 0) { /* - * XXX channel0 will not be processed; skip it. + * XXX + * Chan0 will neither be processed nor should be offered; + * skip it. */ - printf("VMBUS: got channel0 offer\n"); + mtx_unlock(&sc->vmbus_chlist_lock); + device_printf(sc->vmbus_dev, "got chan0 offer\n"); + return EINVAL; } else { sc->vmbus_chmap[new_channel->ch_id] = new_channel; } @@ -201,27 +205,16 @@ vmbus_channel_process_offer(hv_vmbus_cha mtx_unlock(&channel->sc_lock); wakeup(channel); - return; + return 0; } - printf("VMBUS: duplicated primary channel%u\n", + device_printf(sc->vmbus_dev, "duplicated primary chan%u\n", new_channel->ch_id); - vmbus_chan_free(new_channel); - return; + return EINVAL; } new_channel->state = HV_CHANNEL_OPEN_STATE; - - /* - * Add the new device to the bus. This will kick off device-driver - * binding which eventually invokes the device driver's AddDevice() - * method. - * - * NOTE: - * Error is ignored here; don't have much to do if error really - * happens. - */ - hv_vmbus_child_device_register(new_channel); + return 0; } void @@ -286,6 +279,7 @@ vmbus_channel_on_offer_internal(struct v const struct vmbus_chanmsg_choffer *offer) { hv_vmbus_channel* new_channel; + int error; /* * Allocate the channel object and save this offer @@ -323,7 +317,24 @@ vmbus_channel_on_offer_internal(struct v /* Select default cpu for this channel. */ vmbus_channel_select_defcpu(new_channel); - vmbus_channel_process_offer(new_channel); + error = vmbus_chan_add(new_channel); + if (error) { + device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", + new_channel->ch_id, error); + vmbus_chan_free(new_channel); + return; + } + + if (HV_VMBUS_CHAN_ISPRIMARY(new_channel)) { + /* + * Add device for this primary channel. + * + * NOTE: + * Error is ignored here; don't have much to do if error + * really happens. + */ + hv_vmbus_child_device_register(new_channel); + } } /* From owner-svn-src-head@freebsd.org Thu Jul 14 06:40:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1593B98C87; Thu, 14 Jul 2016 06:40:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE2511CE6; Thu, 14 Jul 2016 06:40:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6egGF064610; Thu, 14 Jul 2016 06:40:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6egMa064608; Thu, 14 Jul 2016 06:40:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140640.u6E6egMa064608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302810 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:40:43 -0000 Author: sephe Date: Thu Jul 14 06:40:42 2016 New Revision: 302810 URL: https://svnweb.freebsd.org/changeset/base/302810 Log: hyperv/vmbus: Move new channel scan notification to device register And nuke now unnecessary function indirection. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7103 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:29:12 2016 (r302809) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:40:42 2016 (r302810) @@ -40,14 +40,12 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_internal(struct vmbus_softc *, - const struct vmbus_chanmsg_choffer *); static void vmbus_chan_detach_task(void *, int); -static void vmbus_channel_on_offer(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, const struct vmbus_message *); @@ -62,7 +60,7 @@ static void vmbus_chan_msgproc_chrescind static const vmbus_chanmsg_proc_t vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { - VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer), + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), @@ -259,28 +257,16 @@ vmbus_channel_select_defcpu(struct hv_vm vmbus_channel_cpu_set(chan, 0); } -/** - * @brief Handler for channel offers from Hyper-V/Azure - * - * Handler for channel offers from vmbus in parent partition. - */ -static void -vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) -{ - /* New channel is offered by vmbus */ - vmbus_scan_newchan(sc); - - vmbus_channel_on_offer_internal(sc, - (const struct vmbus_chanmsg_choffer *)msg->msg_data); -} - static void -vmbus_channel_on_offer_internal(struct vmbus_softc *sc, - const struct vmbus_chanmsg_choffer *offer) +vmbus_chan_msgproc_choffer(struct vmbus_softc *sc, + const struct vmbus_message *msg) { + const struct vmbus_chanmsg_choffer *offer; hv_vmbus_channel* new_channel; int error; + offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; + /* * Allocate the channel object and save this offer */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 06:29:12 2016 (r302809) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 06:40:42 2016 (r302810) @@ -994,6 +994,9 @@ hv_vmbus_child_device_register(struct hv device_t parent = sc->vmbus_dev; int error = 0; + /* New channel has been offered */ + vmbus_scan_newchan(sc); + chan->ch_dev = device_add_child(parent, NULL, -1); if (chan->ch_dev == NULL) { device_printf(parent, "device_add_child for chan%u failed\n", From owner-svn-src-head@freebsd.org Thu Jul 14 06:48:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 472BEB98109; Thu, 14 Jul 2016 06:48:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CF60156E; Thu, 14 Jul 2016 06:48:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6mOtX068230; Thu, 14 Jul 2016 06:48:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6mOw5068229; Thu, 14 Jul 2016 06:48:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140648.u6E6mOw5068229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302811 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:48:25 -0000 Author: sephe Date: Thu Jul 14 06:48:24 2016 New Revision: 302811 URL: https://svnweb.freebsd.org/changeset/base/302811 Log: hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7104 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:40:42 2016 (r302810) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:48:24 2016 (r302811) @@ -247,7 +247,7 @@ vmbus_channel_cpu_rr(struct hv_vmbus_cha } static void -vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) { /* * By default, pin the channel to cpu0. Devices having @@ -262,56 +262,54 @@ vmbus_chan_msgproc_choffer(struct vmbus_ const struct vmbus_message *msg) { const struct vmbus_chanmsg_choffer *offer; - hv_vmbus_channel* new_channel; + struct hv_vmbus_channel *chan; int error; offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; - /* - * Allocate the channel object and save this offer - */ - new_channel = vmbus_chan_alloc(sc); - if (new_channel == NULL) { + chan = vmbus_chan_alloc(sc); + if (chan == NULL) { device_printf(sc->vmbus_dev, "allocate chan%u failed\n", offer->chm_chanid); return; } - new_channel->ch_id = offer->chm_chanid; - new_channel->ch_subidx = offer->chm_subidx; - new_channel->ch_guid_type = offer->chm_chtype; - new_channel->ch_guid_inst = offer->chm_chinst; + chan->ch_id = offer->chm_chanid; + chan->ch_subidx = offer->chm_subidx; + chan->ch_guid_type = offer->chm_chtype; + chan->ch_guid_inst = offer->chm_chinst; /* Batch reading is on by default */ - new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) - new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; + chan->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_monprm->mp_connid = offer->chm_connid; + chan->ch_monprm->mp_connid = offer->chm_connid; - if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - new_channel->ch_montrig_idx = - offer->chm_montrig / VMBUS_MONTRIG_LEN; - if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + /* + * Setup MNF stuffs. + */ + chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_montrig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (chan->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) panic("invalid monitor trigger %u", offer->chm_montrig); - new_channel->ch_montrig_mask = + chan->ch_montrig_mask = 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } /* Select default cpu for this channel. */ - vmbus_channel_select_defcpu(new_channel); + vmbus_chan_cpu_default(chan); - error = vmbus_chan_add(new_channel); + error = vmbus_chan_add(chan); if (error) { device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", - new_channel->ch_id, error); - vmbus_chan_free(new_channel); + chan->ch_id, error); + vmbus_chan_free(chan); return; } - if (HV_VMBUS_CHAN_ISPRIMARY(new_channel)) { + if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { /* * Add device for this primary channel. * @@ -319,7 +317,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ * Error is ignored here; don't have much to do if error * really happens. */ - hv_vmbus_child_device_register(new_channel); + hv_vmbus_child_device_register(chan); } } From owner-svn-src-head@freebsd.org Thu Jul 14 06:53:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07638B98405 for ; Thu, 14 Jul 2016 06:53:19 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-154.reflexion.net [208.70.211.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBF061A6D for ; Thu, 14 Jul 2016 06:53:18 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 29233 invoked from network); 14 Jul 2016 06:47:14 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 14 Jul 2016 06:47:14 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.90.3) with SMTP; Thu, 14 Jul 2016 02:46:43 -0400 (EDT) Received: (qmail 29570 invoked from network); 14 Jul 2016 06:46:42 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 14 Jul 2016 06:46:42 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 3C1BDB1E001; Wed, 13 Jul 2016 23:46:29 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [clang 3.8.0: powerpc int instead of 32-bit SYSVR4's long and 64-bit ELF V2 long] From: Mark Millard In-Reply-To: Date: Wed, 13 Jul 2016 23:46:35 -0700 Cc: svn-src-head@freebsd.org, FreeBSD Current , freebsd-stable@freebsd.org, freebsd-arm , FreeBSD PowerPC ML , Bruce Evans , FreeBSD Toolchain Content-Transfer-Encoding: quoted-printable Message-Id: <3DFF1DC9-2AE6-498A-9FE0-4970E76F8AB5@dsl-only.net> References: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> <38CF2C28-3BD1-4D09-939F-4DD0C2E8B58F@dsl-only.net> To: Andrey Chernov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:53:19 -0000 On 2016-Jul-13, at 6:00 PM, Andrey Chernov wrote: > On 13.07.2016 11:53, Mark Millard wrote: >> [The below does note that TARGET=3Dpowerpc has a mix of signed = wchar_t and unsigned char types and most architectures have both being = signed types.] >=20 > POSIX says nothing about wchar_t and char should be the same = (un)signed. > It is arm ABI docs may say so only. They are different entities > differently encoded and cross assigning between wchar_t and char is = not > recommended. [My "odd" would better have been the longer phrase "unusual for FreeBSD" = for the signed type mismatch point.] C11 (9899:2011[2012]) and C++11 (14882:2011(E)) agree with your POSIX = note: no constraint to have the same signed type status as char. But when I then looked at the "System V Application Binary Interface = PowerpC Processor Supplement" (1995-Sept SunSoft document) that I = believe FreeBSD uses for powerpc (32-bit only: TARGET_ARCH=3Dpowerpc) it = has: typedef long wchar_t; as part of: Figure 6-39 (page labeled 6-38). While agreeing about the signed-type status for wchar_t this does not = agree with FreeBSD 11.0's use of int as the type: sys/powerpc/include/_types.h:typedef int ___wchar_t; sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ # clang --target=3Dpowerpc-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . I'm not as sure of which document is official for TARGET_ARCH=3Dpowerpc64 = but using "Power Architecture 64-bit ELF V2 ABI Specification" (Open = POWER ABI for Linux Supplement) as an example of what likely is common = for that context: 5.1.3 Types Defined in Standard header lists: typedef long wchar_t; which again does not agree with FreeBSD 11.0's use of int as the type: # clang --target=3Dpowerpc64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more . . . #define __WCHAR_MAX__ 2147483647 #define __WCHAR_TYPE__ int #define __WCHAR_WIDTH__ 32 . . . =3D=3D=3D Mark Millard markmi at dsl-only.net >=20 > On 2016-Jul-11, at 8:57 PM, Andrey Chernov = wrote: >=20 >> On 12.07.2016 5:44, Mark Millard wrote: >>> My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: >>>=20 >>> A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion = of >>> ___wchar_t (if that is distinct). >>> B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; = not >>> necessarily a valid char value >>> C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; = not >>> necessarily a valid char value >>=20 >> It seems you are right about "not a valid char value", I'll back this >> change out. >>=20 >>> As far as I know arm FreeBSD uses unsigned character types (of = whatever >>> width). >>=20 >> Probably it should be unsigned for other architectures too, clang = does >> not generate negative values with L'' literals and locale use = only >> positive values too. >=20 > Looking around: >=20 > # grep -i wchar sys/*/include/_types.h > sys/arm/include/_types.h:typedef unsigned int ___wchar_t; > sys/arm/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ > sys/arm/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ > sys/arm64/include/_types.h:typedef unsigned int ___wchar_t; > sys/arm64/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ > sys/arm64/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ > sys/mips/include/_types.h:typedef int ___wchar_t; > sys/mips/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/mips/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ > sys/powerpc/include/_types.h:typedef int ___wchar_t; > sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ > sys/riscv/include/_types.h:typedef int ___wchar_t; > sys/riscv/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/riscv/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ > sys/sparc64/include/_types.h:typedef int ___wchar_t; > sys/sparc64/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/sparc64/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ > sys/x86/include/_types.h:typedef int ___wchar_t; > sys/x86/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/x86/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >=20 > So only arm and arm64 have unsigned wchar_t types. >=20 > [NOTE: __CHAR16_TYPE__ and __CHAR32_TYPE__ are always unsigned: in = C++11 terms char16_t is like std::uint_least16_t and char32_t is like = std::uint_least32_t despite being distinct types. So __CHAR16_TYPE__ and = __CHAR32_TYPE__ are ignored below.] >=20 > The clang 3.8.0 compiler output has an odd mix for TARGET_ARCH=3Dpowerpc= and TARGET_ARCH=3Dpowerpc64 . . . >=20 > armv6 has unsigned types for both char and __WCHAR_TYPE__. > aarch64 has unsigned types for both char and __WCHAR_TYPE__. > powerpc has unsigned for char but signed for __WCHAR_TYPE__. > powerpc64 has unsigned for char but signed for __WCHAR_TYPE__. > amd64 has signed types for both char and __WCHAR_TYPE__. > i386 has signed types for both char and __WCHAR_TYPE__. > mips has signed types for both char and __WCHAR_TYPE__. > sparc64 has signed types for both char and __WCHAR_TYPE__. > (riscv is not covered by clang as I understand) >=20 > The details via compiler #define's. . . >=20 > # clang --target=3Darmv6-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 4294967295U > #define __WCHAR_TYPE__ unsigned int > #define __WCHAR_UNSIGNED__ 1 > #define __WCHAR_WIDTH__ 32 > . . . >=20 > # clang --target=3Daarch64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 4294967295U > #define __WCHAR_TYPE__ unsigned int > #define __WCHAR_UNSIGNED__ 1 > #define __WCHAR_WIDTH__ 32 > . . . >=20 > # clang --target=3Dpowerpc-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 > Is powerpc wrong? >=20 > # clang --target=3Dpowerpc64-freebsd11 -std=3Dc99 -E -dM - < = /dev/null | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > #define __CHAR_UNSIGNED__ 1 > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 > Is powerpc64 wrong? >=20 >=20 > # clang --target=3Damd64-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . >=20 > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 > # clang --target=3Di386-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more > . . . > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . >=20 > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 >=20 > # clang --target=3Dmips-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . >=20 > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 > # clang --target=3Dsparc64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more > . . . > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > . . . > #define __CHAR_BIT__ 8 > . . . (note the lack of __CHAR_UNSIGNED__) . . . >=20 > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . (note the lack of __WCHAR_UNSIGNED__) . . . >=20 >=20 >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 From owner-svn-src-head@freebsd.org Thu Jul 14 06:59:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0908BB9867D; Thu, 14 Jul 2016 06:59:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D88421E40; Thu, 14 Jul 2016 06:59:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E6x5A3071861; Thu, 14 Jul 2016 06:59:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E6x4Eh071856; Thu, 14 Jul 2016 06:59:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140659.u6E6x4Eh071856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 06:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302812 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 06:59:06 -0000 Author: sephe Date: Thu Jul 14 06:59:04 2016 New Revision: 302812 URL: https://svnweb.freebsd.org/changeset/base/302812 Log: hyperv/vmbus: Nuke the channel open state. Channel is either opened or not-opened. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7105 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 06:59:04 2016 (r302812) @@ -244,18 +244,9 @@ typedef struct { typedef void (*hv_vmbus_pfn_channel_callback)(void *context); -typedef enum { - HV_CHANNEL_OFFER_STATE, - HV_CHANNEL_OPENING_STATE, - HV_CHANNEL_OPEN_STATE, - HV_CHANNEL_OPENED_STATE, - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, -} hv_vmbus_channel_state; - typedef struct hv_vmbus_channel { device_t ch_dev; struct vmbus_softc *vmbus_sc; - hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ @@ -337,7 +328,8 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ - + volatile uint32_t ch_stflags; /* atomic-op */ + /* VMBUS_CHAN_ST_ */ struct hyperv_guid ch_guid_type; struct hyperv_guid ch_guid_inst; @@ -357,6 +349,9 @@ typedef struct hv_vmbus_channel { */ #define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 +#define VMBUS_CHAN_ST_OPENED_SHIFT 0 +#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) { Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 14 06:59:04 2016 (r302812) @@ -719,11 +719,6 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - if (!destroy_channel) { - sc->hn_prichan->state = - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE; - } - free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); hv_vmbus_channel_close(sc->hn_prichan); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 06:59:04 2016 (r302812) @@ -191,17 +191,9 @@ hv_vmbus_channel_open( return EINVAL; } - mtx_lock(&new_channel->sc_lock); - if (new_channel->state == HV_CHANNEL_OPEN_STATE) { - new_channel->state = HV_CHANNEL_OPENING_STATE; - } else { - mtx_unlock(&new_channel->sc_lock); - if(bootverbose) - printf("VMBUS: Trying to open channel <%p> which in " - "%d state.\n", new_channel, new_channel->state); - return (EINVAL); - } - mtx_unlock(&new_channel->sc_lock); + if (atomic_testandset_int(&new_channel->ch_stflags, + VMBUS_CHAN_ST_OPENED_SHIFT)) + panic("double-open chan%u", new_channel->ch_id); new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; @@ -223,8 +215,10 @@ hv_vmbus_channel_open( M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); KASSERT(out != NULL, ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) - return (ENOMEM); + if (out == NULL) { + ret = ENOMEM; + goto failed; + } in = ((uint8_t *) out + send_ring_buffer_size); @@ -265,7 +259,8 @@ hv_vmbus_channel_open( device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", new_channel->ch_id); - return ENXIO; + ret = ENXIO; + goto failed; } req = vmbus_msghc_dataptr(mh); @@ -284,7 +279,7 @@ hv_vmbus_channel_open( "chopen(chan%u) msg hypercall exec failed: %d\n", new_channel->ch_id, ret); vmbus_msghc_put(sc, mh); - return ret; + goto failed; } msg = vmbus_msghc_wait_result(sc, mh); @@ -294,17 +289,20 @@ hv_vmbus_channel_open( vmbus_msghc_put(sc, mh); if (status == 0) { - new_channel->state = HV_CHANNEL_OPENED_STATE; if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", new_channel->ch_id); } - } else { - device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->ch_id); - ret = ENXIO; + return 0; } - return (ret); + + device_printf(sc->vmbus_dev, "failed to open chan%u\n", + new_channel->ch_id); + ret = ENXIO; + +failed: + atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); + return ret; } /** @@ -487,7 +485,9 @@ hv_vmbus_channel_close_internal(hv_vmbus struct taskqueue *rxq = channel->rxq; int error; - channel->state = HV_CHANNEL_OPEN_STATE; + /* TODO: stringent check */ + atomic_clear_int(&channel->ch_stflags, VMBUS_CHAN_ST_OPENED); + sysctl_ctx_free(&channel->ch_sysctl_ctx); /* @@ -563,7 +563,7 @@ hv_vmbus_channel_close(hv_vmbus_channel */ TAILQ_FOREACH(sub_channel, &channel->sc_list_anchor, sc_list_entry) { - if (sub_channel->state != HV_CHANNEL_OPENED_STATE) + if ((sub_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) continue; hv_vmbus_channel_close_internal(sub_channel); } Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:59:04 2016 (r302812) @@ -191,8 +191,6 @@ vmbus_chan_add(hv_vmbus_channel *new_cha ch_link); mtx_unlock(&sc->vmbus_chlist_lock); - new_channel->state = HV_CHANNEL_OPEN_STATE; - /* * Bump up sub-channel count and notify anyone that is * interested in this sub-channel, after this sub-channel @@ -210,8 +208,6 @@ vmbus_chan_add(hv_vmbus_channel *new_cha new_channel->ch_id); return EINVAL; } - - new_channel->state = HV_CHANNEL_OPEN_STATE; return 0; } @@ -479,7 +475,7 @@ vmbus_select_outgoing_channel(struct hv_ cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { - if (new_channel->state != HV_CHANNEL_OPENED_STATE){ + if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { continue; } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 06:48:24 2016 (r302811) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 06:59:04 2016 (r302812) @@ -55,7 +55,6 @@ typedef struct { typedef struct { uint32_t rel_id; - hv_vmbus_channel_state state; struct hyperv_guid interface_type; struct hyperv_guid interface_instance; uint32_t monitor_id; From owner-svn-src-head@freebsd.org Thu Jul 14 07:09:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2C8CB988B7; Thu, 14 Jul 2016 07:09:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A65D01453; Thu, 14 Jul 2016 07:09:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E78xuX075462; Thu, 14 Jul 2016 07:08:59 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E78x32075461; Thu, 14 Jul 2016 07:08:59 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140708.u6E78x32075461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302813 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:09:01 -0000 Author: sephe Date: Thu Jul 14 07:08:59 2016 New Revision: 302813 URL: https://svnweb.freebsd.org/changeset/base/302813 Log: hyperv/vmbus: Cleanup vmbus_chan_add() MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7106 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 06:59:04 2016 (r302812) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:08:59 2016 (r302813) @@ -108,105 +108,85 @@ vmbus_chan_free(struct hv_vmbus_channel free(chan, M_DEVBUF); } -/** - * @brief Process the offer by creating a channel/device - * associated with this offer - */ static int -vmbus_chan_add(hv_vmbus_channel *new_channel) +vmbus_chan_add(struct hv_vmbus_channel *newchan) { - struct vmbus_softc *sc = new_channel->vmbus_sc; - hv_vmbus_channel* channel; + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; - /* - * Make sure this is a new offer - */ - mtx_lock(&sc->vmbus_chlist_lock); - if (new_channel->ch_id == 0) { + if (newchan->ch_id == 0) { /* * XXX * Chan0 will neither be processed nor should be offered; * skip it. */ - mtx_unlock(&sc->vmbus_chlist_lock); - device_printf(sc->vmbus_dev, "got chan0 offer\n"); + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); return EINVAL; - } else { - sc->vmbus_chmap[new_channel->ch_id] = new_channel; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; + } + sc->vmbus_chmap[newchan->ch_id] = newchan; + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); } - TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && - memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, + memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, sizeof(struct hyperv_guid)) == 0) break; } - - if (channel == NULL) { + if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); } mtx_unlock(&sc->vmbus_chlist_lock); - if (bootverbose) { - char logstr[64]; - - logstr[0] = '\0'; - if (channel != NULL) { - snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->ch_id); + if (prichan != NULL) { + if (newchan->ch_subidx == 0) { + device_printf(sc->vmbus_dev, "duplicated primary " + "chan%u\n", newchan->ch_id); + return EINVAL; } - device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", - new_channel->ch_id, - new_channel->ch_subidx, logstr); - } - if (channel != NULL) { /* - * Check if this is a sub channel. + * This is a sub-channel. */ - if (new_channel->ch_subidx != 0) { - /* - * It is a sub channel offer, process it. - */ - new_channel->primary_channel = channel; - new_channel->ch_dev = channel->ch_dev; - mtx_lock(&channel->sc_lock); - TAILQ_INSERT_TAIL(&channel->sc_list_anchor, - new_channel, sc_list_entry); - mtx_unlock(&channel->sc_lock); - - /* - * Insert the new channel to the end of the global - * channel list. - * - * NOTE: - * The new sub-channel MUST be inserted AFTER it's - * primary channel, so that the primary channel will - * be found in the above loop for its baby siblings. - */ - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, - ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); - - /* - * Bump up sub-channel count and notify anyone that is - * interested in this sub-channel, after this sub-channel - * is setup. - */ - mtx_lock(&channel->sc_lock); - channel->subchan_cnt++; - mtx_unlock(&channel->sc_lock); - wakeup(channel); + newchan->primary_channel = prichan; + newchan->ch_dev = prichan->ch_dev; + mtx_lock(&prichan->sc_lock); + TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, + sc_list_entry); + mtx_unlock(&prichan->sc_lock); - return 0; - } + /* + * Insert the new channel to the end of the global + * channel list. + * + * NOTE: + * The new sub-channel MUST be inserted AFTER it's + * primary channel, so that the primary channel will + * be found in the above loop for its baby siblings. + */ + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); - device_printf(sc->vmbus_dev, "duplicated primary chan%u\n", - new_channel->ch_id); - return EINVAL; + /* + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. + */ + mtx_lock(&prichan->sc_lock); + prichan->subchan_cnt++; + mtx_unlock(&prichan->sc_lock); + wakeup(prichan); } return 0; } From owner-svn-src-head@freebsd.org Thu Jul 14 07:24:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F884B98DE7; Thu, 14 Jul 2016 07:24:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3A4A1FE3; Thu, 14 Jul 2016 07:24:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E7O32Z082923; Thu, 14 Jul 2016 07:24:03 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E7O3k6082920; Thu, 14 Jul 2016 07:24:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140724.u6E7O3k6082920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302814 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:24:05 -0000 Author: sephe Date: Thu Jul 14 07:24:03 2016 New Revision: 302814 URL: https://svnweb.freebsd.org/changeset/base/302814 Log: hyperv/vmbus: Use sub-channel index to detect primary channel In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of channel setup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7108 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 07:08:59 2016 (r302813) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 07:24:03 2016 (r302814) @@ -336,7 +336,7 @@ typedef struct hv_vmbus_channel { struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; -#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) +#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) #define VMBUS_CHAN_FLAG_HASMNF 0x0001 /* Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 07:08:59 2016 (r302813) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 14 07:24:03 2016 (r302814) @@ -2957,7 +2957,7 @@ static void hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) { - KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), + KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), ("subchannel callback on primary channel")); KASSERT(chan->ch_subidx > 0, ("invalid channel subidx %u", Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:08:59 2016 (r302813) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:24:03 2016 (r302814) @@ -285,7 +285,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ return; } - if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { + if (VMBUS_CHAN_ISPRIMARY(chan)) { /* * Add device for this primary channel. * @@ -332,7 +332,7 @@ vmbus_chan_detach_task(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { + if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(chan); /* NOTE: DO NOT free primary channel for now */ @@ -413,7 +413,7 @@ hv_vmbus_release_unattached_channels(str channel = TAILQ_FIRST(&sc->vmbus_chlist); TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); - if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { + if (VMBUS_CHAN_ISPRIMARY(channel)) { /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(channel); } From owner-svn-src-head@freebsd.org Thu Jul 14 07:31:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CBEB9813A; Thu, 14 Jul 2016 07:31:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DD24197B; Thu, 14 Jul 2016 07:31:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E7VhHE083914; Thu, 14 Jul 2016 07:31:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E7VhTs083913; Thu, 14 Jul 2016 07:31:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140731.u6E7VhTs083913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302815 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:31:44 -0000 Author: sephe Date: Thu Jul 14 07:31:43 2016 New Revision: 302815 URL: https://svnweb.freebsd.org/changeset/base/302815 Log: hyperv/vmbus: Only add primary channels to vmbus channel list - Make the vmbus_chan_add more straightforward. - Partially fix the hv_vmbus_release_unattached_channels(). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7109 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:24:03 2016 (r302814) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:31:43 2016 (r302815) @@ -142,52 +142,55 @@ vmbus_chan_add(struct hv_vmbus_channel * sizeof(struct hyperv_guid)) == 0) break; } - if (prichan == NULL) { - /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); - } - mtx_unlock(&sc->vmbus_chlist_lock); - - if (prichan != NULL) { - if (newchan->ch_subidx == 0) { + if (VMBUS_CHAN_ISPRIMARY(newchan)) { + if (prichan == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); + return 0; + } else { + mtx_unlock(&sc->vmbus_chlist_lock); device_printf(sc->vmbus_dev, "duplicated primary " "chan%u\n", newchan->ch_id); return EINVAL; } - - /* - * This is a sub-channel. - */ - newchan->primary_channel = prichan; - newchan->ch_dev = prichan->ch_dev; - mtx_lock(&prichan->sc_lock); - TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, - sc_list_entry); - mtx_unlock(&prichan->sc_lock); - + } else { /* Sub-channel */ + if (prichan == NULL) { + mtx_unlock(&sc->vmbus_chlist_lock); + device_printf(sc->vmbus_dev, "no primary chan for " + "chan%u\n", newchan->ch_id); + return EINVAL; + } /* - * Insert the new channel to the end of the global - * channel list. + * Found the primary channel for this sub-channel and + * move on. * - * NOTE: - * The new sub-channel MUST be inserted AFTER it's - * primary channel, so that the primary channel will - * be found in the above loop for its baby siblings. - */ - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); - - /* - * Bump up sub-channel count and notify anyone that is - * interested in this sub-channel, after this sub-channel - * is setup. + * XXX refcnt prichan */ - mtx_lock(&prichan->sc_lock); - prichan->subchan_cnt++; - mtx_unlock(&prichan->sc_lock); - wakeup(prichan); } + mtx_unlock(&sc->vmbus_chlist_lock); + + /* + * This is a sub-channel; link it with the primary channel. + */ + KASSERT(!VMBUS_CHAN_ISPRIMARY(newchan), + ("new channel is not sub-channel")); + KASSERT(prichan != NULL, ("no primary channel")); + + newchan->primary_channel = prichan; + newchan->ch_dev = prichan->ch_dev; + + mtx_lock(&prichan->sc_lock); + TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, sc_list_entry); + /* + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. + */ + prichan->subchan_cnt++; + mtx_unlock(&prichan->sc_lock); + wakeup(prichan); + return 0; } @@ -370,10 +373,6 @@ vmbus_chan_detach_task(void *xchan, int } } remove: - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); - mtx_lock(&pri_chan->sc_lock); TAILQ_REMOVE(&pri_chan->sc_list_anchor, chan, sc_list_entry); KASSERT(pri_chan->subchan_cnt > 0, @@ -411,12 +410,10 @@ hv_vmbus_release_unattached_channels(str while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { channel = TAILQ_FIRST(&sc->vmbus_chlist); + KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); - if (VMBUS_CHAN_ISPRIMARY(channel)) { - /* Only primary channel owns the device */ - hv_vmbus_child_device_unregister(channel); - } + hv_vmbus_child_device_unregister(channel); vmbus_chan_free(channel); } bzero(sc->vmbus_chmap, From owner-svn-src-head@freebsd.org Thu Jul 14 07:39:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EBA4B98518; Thu, 14 Jul 2016 07:39:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59E891FAA; Thu, 14 Jul 2016 07:39:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E7dYmO087017; Thu, 14 Jul 2016 07:39:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E7dYXj087013; Thu, 14 Jul 2016 07:39:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140739.u6E7dYXj087013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302816 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:39:35 -0000 Author: sephe Date: Thu Jul 14 07:39:34 2016 New Revision: 302816 URL: https://svnweb.freebsd.org/changeset/base/302816 Log: hyperv/vmbus: Release vmbus channel lock before detach devices Device detach method may sleep. While I'm here, rename the function, fix indentation and function comment. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7110 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:39:34 2016 (r302816) @@ -398,27 +398,27 @@ vmbus_channel_on_offers_delivered(struct vmbus_scan_done(sc); } -/** - * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) +/* + * Detach all devices and destroy the corresponding primary channels. */ void -hv_vmbus_release_unattached_channels(struct vmbus_softc *sc) +vmbus_chan_destroy_all(struct vmbus_softc *sc) { - hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; mtx_lock(&sc->vmbus_chlist_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_chlist)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); - while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { - channel = TAILQ_FIRST(&sc->vmbus_chlist); - KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); - TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); + hv_vmbus_child_device_unregister(chan); + vmbus_chan_free(chan); - hv_vmbus_child_device_unregister(channel); - vmbus_chan_free(channel); + mtx_lock(&sc->vmbus_chlist_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(&sc->vmbus_chlist_lock); } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Thu Jul 14 07:39:34 2016 (r302816) @@ -146,9 +146,6 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -void hv_vmbus_release_unattached_channels( - struct vmbus_softc *); - int hv_vmbus_child_device_register( struct hv_vmbus_channel *chan); int hv_vmbus_child_device_unregister( Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:39:34 2016 (r302816) @@ -1239,7 +1239,7 @@ vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - hv_vmbus_release_unattached_channels(sc); + vmbus_chan_destroy_all(sc); vmbus_disconnect(sc); Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:31:43 2016 (r302815) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:39:34 2016 (r302816) @@ -138,6 +138,7 @@ void vmbus_handle_intr(struct trapframe void vmbus_et_intr(struct trapframe *); void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_chan_destroy_all(struct vmbus_softc *); struct vmbus_msghc *vmbus_msghc_get(struct vmbus_softc *, size_t); void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); From owner-svn-src-head@freebsd.org Thu Jul 14 07:48:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D23FB98724; Thu, 14 Jul 2016 07:48:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEEC5168B; Thu, 14 Jul 2016 07:48:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E7mRqt090790; Thu, 14 Jul 2016 07:48:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E7mQ4F090786; Thu, 14 Jul 2016 07:48:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140748.u6E7mQ4F090786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302817 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:48:28 -0000 Author: sephe Date: Thu Jul 14 07:48:26 2016 New Revision: 302817 URL: https://svnweb.freebsd.org/changeset/base/302817 Log: hyperv/vmbus: Field renaming to reflect reality MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7111 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 07:48:26 2016 (r302817) @@ -326,7 +326,7 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv3; struct task ch_detach_task; - TAILQ_ENTRY(hv_vmbus_channel) ch_link; + TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_t ch_subidx; /* subchan index */ volatile uint32_t ch_stflags; /* atomic-op */ /* VMBUS_CHAN_ST_ */ Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:48:26 2016 (r302817) @@ -134,8 +134,8 @@ vmbus_chan_add(struct hv_vmbus_channel * newchan->ch_id, newchan->ch_subidx); } - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + mtx_lock(&sc->vmbus_prichan_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, @@ -145,18 +145,19 @@ vmbus_chan_add(struct hv_vmbus_channel * if (VMBUS_CHAN_ISPRIMARY(newchan)) { if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); return 0; } else { - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); device_printf(sc->vmbus_dev, "duplicated primary " "chan%u\n", newchan->ch_id); return EINVAL; } } else { /* Sub-channel */ if (prichan == NULL) { - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); device_printf(sc->vmbus_dev, "no primary chan for " "chan%u\n", newchan->ch_id); return EINVAL; @@ -168,7 +169,7 @@ vmbus_chan_add(struct hv_vmbus_channel * * XXX refcnt prichan */ } - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); /* * This is a sub-channel; link it with the primary channel. @@ -406,20 +407,20 @@ vmbus_chan_destroy_all(struct vmbus_soft { struct hv_vmbus_channel *chan; - mtx_lock(&sc->vmbus_chlist_lock); - while ((chan = TAILQ_FIRST(&sc->vmbus_chlist)) != NULL) { + mtx_lock(&sc->vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); - TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); hv_vmbus_child_device_unregister(chan); vmbus_chan_free(chan); - mtx_lock(&sc->vmbus_chlist_lock); + mtx_lock(&sc->vmbus_prichan_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); } /** Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 07:48:26 2016 (r302817) @@ -1104,8 +1104,8 @@ vmbus_doattach(struct vmbus_softc *sc) mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); sc->vmbus_gpadl = VMBUS_GPADL_START; - mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF); - TAILQ_INIT(&sc->vmbus_chlist); + mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF); + TAILQ_INIT(&sc->vmbus_prichans); sc->vmbus_chmap = malloc( sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); @@ -1176,7 +1176,7 @@ cleanup: } free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); - mtx_destroy(&sc->vmbus_chlist_lock); + mtx_destroy(&sc->vmbus_prichan_lock); return (ret); } @@ -1258,7 +1258,7 @@ vmbus_detach(device_t dev) free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); - mtx_destroy(&sc->vmbus_chlist_lock); + mtx_destroy(&sc->vmbus_prichan_lock); return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:39:34 2016 (r302816) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 07:48:26 2016 (r302817) @@ -102,8 +102,9 @@ struct vmbus_softc { #define VMBUS_SCAN_CHCNT_DONE 0x80000000 uint32_t vmbus_scan_devcnt; - struct mtx vmbus_chlist_lock; - TAILQ_HEAD(, hv_vmbus_channel) vmbus_chlist; + /* Primary channels */ + struct mtx vmbus_prichan_lock; + TAILQ_HEAD(, hv_vmbus_channel) vmbus_prichans; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ From owner-svn-src-head@freebsd.org Thu Jul 14 07:59:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4DFB98D62; Thu, 14 Jul 2016 07:59:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 626D01DFD; Thu, 14 Jul 2016 07:59:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E7x1EX094416; Thu, 14 Jul 2016 07:59:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E7x1GW094415; Thu, 14 Jul 2016 07:59:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140759.u6E7x1GW094415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 07:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302818 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 07:59:02 -0000 Author: sephe Date: Thu Jul 14 07:59:01 2016 New Revision: 302818 URL: https://svnweb.freebsd.org/changeset/base/302818 Log: hyperv/vmbus: Fix the racy channel close. It is not safe to iterate the sub-channel list w/o lock on the close path, while it's even more difficult to hold the lock and iterate the sub-channel list. We leverage the vmbua_{get,rel}_subchan() functions to solve this dilemma. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7112 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 07:48:26 2016 (r302817) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 07:59:01 2016 (r302818) @@ -542,35 +542,40 @@ hv_vmbus_channel_close_internal(hv_vmbus M_DEVBUF); } -/** - * @brief Close the specified channel +/* + * Caller should make sure that all sub-channels have + * been added to 'chan' and all to-be-closed channels + * are not being opened. */ void -hv_vmbus_channel_close(hv_vmbus_channel *channel) +hv_vmbus_channel_close(struct hv_vmbus_channel *chan) { - hv_vmbus_channel* sub_channel; + int subchan_cnt; - if (channel->primary_channel != NULL) { + if (!VMBUS_CHAN_ISPRIMARY(chan)) { /* - * We only close multi-channels when the primary is - * closed. + * Sub-channel is closed when its primary channel + * is closed; done. */ return; } /* - * Close all multi-channels first. + * Close all sub-channels, if any. */ - TAILQ_FOREACH(sub_channel, &channel->sc_list_anchor, - sc_list_entry) { - if ((sub_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) - continue; - hv_vmbus_channel_close_internal(sub_channel); + subchan_cnt = chan->subchan_cnt; + if (subchan_cnt > 0) { + struct hv_vmbus_channel **subchan; + int i; + + subchan = vmbus_get_subchan(chan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + hv_vmbus_channel_close_internal(subchan[i]); + vmbus_rel_subchan(subchan, subchan_cnt); } - /* - * Then close the primary channel. - */ - hv_vmbus_channel_close_internal(channel); + + /* Then close the primary channel. */ + hv_vmbus_channel_close_internal(chan); } /** From owner-svn-src-head@freebsd.org Thu Jul 14 08:15:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFF42B93AC2; Thu, 14 Jul 2016 08:15:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D5661B08; Thu, 14 Jul 2016 08:15:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E8FDmQ001704; Thu, 14 Jul 2016 08:15:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E8FDh8001701; Thu, 14 Jul 2016 08:15:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140815.u6E8FDh8001701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 08:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302819 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 08:15:14 -0000 Author: sephe Date: Thu Jul 14 08:15:13 2016 New Revision: 302819 URL: https://svnweb.freebsd.org/changeset/base/302819 Log: hyperv/vmbus: Sub-channel related fields renaming And reorganize comment. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7113 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 14 08:15:13 2016 (r302819) @@ -293,30 +293,17 @@ typedef struct hv_vmbus_channel { uint32_t target_cpu; /* - * Support for multi-channels. - * The initial offer is considered the primary channel and this - * offer message will indicate if the host supports multi-channels. - * The guest is free to ask for multi-channels to be offerred and can - * open these multi-channels as a normal "primary" channel. However, - * all multi-channels will have the same type and instance guids as the - * primary channel. Requests sent on a given channel will result in a - * response on the same channel. + * If this is a primary channel, ch_subchan* fields + * contain sub-channels belonging to this primary + * channel. */ - - struct mtx sc_lock; - - /* - * Link list of all the multi-channels if this is a primary channel - */ - TAILQ_HEAD(, hv_vmbus_channel) sc_list_anchor; - TAILQ_ENTRY(hv_vmbus_channel) sc_list_entry; - int subchan_cnt; - - /* - * The primary channel this sub-channle belongs to. - * This will be NULL for the primary channel. - */ - struct hv_vmbus_channel *primary_channel; + struct mtx ch_subchan_lock; + TAILQ_HEAD(, hv_vmbus_channel) ch_subchans; + int ch_subchan_cnt; + + /* If this is a sub-channel */ + TAILQ_ENTRY(hv_vmbus_channel) ch_sublink; /* sub-channel link */ + struct hv_vmbus_channel *ch_prichan; /* owner primary chan */ /* * Driver private data Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Thu Jul 14 08:15:13 2016 (r302819) @@ -100,7 +100,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha uint16_t sub_ch_id; char name[16]; - hv_vmbus_channel* primary_ch = channel->primary_channel; + hv_vmbus_channel* primary_ch = channel->ch_prichan; if (primary_ch == NULL) { dev = channel->ch_dev; @@ -563,7 +563,7 @@ hv_vmbus_channel_close(struct hv_vmbus_c /* * Close all sub-channels, if any. */ - subchan_cnt = chan->subchan_cnt; + subchan_cnt = chan->ch_subchan_cnt; if (subchan_cnt > 0) { struct hv_vmbus_channel **subchan; int i; Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 07:59:01 2016 (r302818) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 08:15:13 2016 (r302819) @@ -90,8 +90,8 @@ vmbus_chan_alloc(struct vmbus_softc *sc) } chan->vmbus_sc = sc; - mtx_init(&chan->sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(&chan->sc_list_anchor); + mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); return chan; @@ -104,7 +104,7 @@ vmbus_chan_free(struct hv_vmbus_channel /* TODO: asset no longer on the primary channel's sub-channel list */ /* TODO: asset no longer on the vmbus channel list */ hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); - mtx_destroy(&chan->sc_lock); + mtx_destroy(&chan->ch_subchan_lock); free(chan, M_DEVBUF); } @@ -136,6 +136,10 @@ vmbus_chan_add(struct hv_vmbus_channel * mtx_lock(&sc->vmbus_prichan_lock); TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { + /* + * Sub-channel will have the same type GUID and instance + * GUID as its primary channel. + */ if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, @@ -178,18 +182,18 @@ vmbus_chan_add(struct hv_vmbus_channel * ("new channel is not sub-channel")); KASSERT(prichan != NULL, ("no primary channel")); - newchan->primary_channel = prichan; + newchan->ch_prichan = prichan; newchan->ch_dev = prichan->ch_dev; - mtx_lock(&prichan->sc_lock); - TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, sc_list_entry); + mtx_lock(&prichan->ch_subchan_lock); + TAILQ_INSERT_TAIL(&prichan->ch_subchans, newchan, ch_sublink); /* * Bump up sub-channel count and notify anyone that is * interested in this sub-channel, after this sub-channel * is setup. */ - prichan->subchan_cnt++; - mtx_unlock(&prichan->sc_lock); + prichan->ch_subchan_cnt++; + mtx_unlock(&prichan->ch_subchan_lock); wakeup(prichan); return 0; @@ -342,7 +346,7 @@ vmbus_chan_detach_task(void *xchan, int /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->vmbus_sc; - struct hv_vmbus_channel *pri_chan = chan->primary_channel; + struct hv_vmbus_channel *pri_chan = chan->ch_prichan; struct vmbus_chanmsg_chfree *req; struct vmbus_msghc *mh; int error; @@ -374,12 +378,12 @@ vmbus_chan_detach_task(void *xchan, int } } remove: - mtx_lock(&pri_chan->sc_lock); - TAILQ_REMOVE(&pri_chan->sc_list_anchor, chan, sc_list_entry); - KASSERT(pri_chan->subchan_cnt > 0, - ("invalid subchan_cnt %d", pri_chan->subchan_cnt)); - pri_chan->subchan_cnt--; - mtx_unlock(&pri_chan->sc_lock); + mtx_lock(&pri_chan->ch_subchan_lock); + TAILQ_REMOVE(&pri_chan->ch_subchans, chan, ch_sublink); + KASSERT(pri_chan->ch_subchan_cnt > 0, + ("invalid subchan_cnt %d", pri_chan->ch_subchan_cnt)); + pri_chan->ch_subchan_cnt--; + mtx_unlock(&pri_chan->ch_subchan_lock); wakeup(pri_chan); vmbus_chan_free(chan); @@ -442,7 +446,7 @@ vmbus_select_outgoing_channel(struct hv_ int cur_vcpu = 0; int smp_pro_id = PCPU_GET(cpuid); - if (TAILQ_EMPTY(&primary->sc_list_anchor)) { + if (TAILQ_EMPTY(&primary->ch_subchans)) { return outgoing_channel; } @@ -452,7 +456,8 @@ vmbus_select_outgoing_channel(struct hv_ cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); - TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { + /* XXX need lock */ + TAILQ_FOREACH(new_channel, &primary->ch_subchans, ch_sublink) { if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { continue; } @@ -488,13 +493,13 @@ vmbus_get_subchan(struct hv_vmbus_channe ret = malloc(subchan_cnt * sizeof(struct hv_vmbus_channel *), M_TEMP, M_WAITOK); - mtx_lock(&pri_chan->sc_lock); + mtx_lock(&pri_chan->ch_subchan_lock); - while (pri_chan->subchan_cnt < subchan_cnt) - mtx_sleep(pri_chan, &pri_chan->sc_lock, 0, "subch", 0); + while (pri_chan->ch_subchan_cnt < subchan_cnt) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "subch", 0); i = 0; - TAILQ_FOREACH(chan, &pri_chan->sc_list_anchor, sc_list_entry) { + TAILQ_FOREACH(chan, &pri_chan->ch_subchans, ch_sublink) { /* TODO: refcnt chan */ ret[i] = chan; @@ -503,9 +508,9 @@ vmbus_get_subchan(struct hv_vmbus_channe break; } KASSERT(i == subchan_cnt, ("invalid subchan count %d, should be %d", - pri_chan->subchan_cnt, subchan_cnt)); + pri_chan->ch_subchan_cnt, subchan_cnt)); - mtx_unlock(&pri_chan->sc_lock); + mtx_unlock(&pri_chan->ch_subchan_lock); return ret; } @@ -520,10 +525,10 @@ vmbus_rel_subchan(struct hv_vmbus_channe void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) { - mtx_lock(&pri_chan->sc_lock); - while (pri_chan->subchan_cnt > 0) - mtx_sleep(pri_chan, &pri_chan->sc_lock, 0, "dsubch", 0); - mtx_unlock(&pri_chan->sc_lock); + mtx_lock(&pri_chan->ch_subchan_lock); + while (pri_chan->ch_subchan_cnt > 0) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "dsubch", 0); + mtx_unlock(&pri_chan->ch_subchan_lock); } void From owner-svn-src-head@freebsd.org Thu Jul 14 08:18:13 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2542B93F15; Thu, 14 Jul 2016 08:18:13 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1CBC1F38; Thu, 14 Jul 2016 08:18:13 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E8ICwh001970; Thu, 14 Jul 2016 08:18:12 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E8ICRo001964; Thu, 14 Jul 2016 08:18:12 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140818.u6E8ICRo001964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 08:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302820 - in head/lib/libc: gen locale regex stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 08:18:14 -0000 Author: ache Date: Thu Jul 14 08:18:12 2016 New Revision: 302820 URL: https://svnweb.freebsd.org/changeset/base/302820 Log: Back out non-collating [a-z] ranges. Instead of changing whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and concentrace on fixing bugs in what we have now, too many small obstacles instead, counting ports. Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/gen/glob.c head/lib/libc/locale/collate.h head/lib/libc/locale/collcmp.c head/lib/libc/regex/regcomp.c head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/gen/fnmatch.c Thu Jul 14 08:18:12 2016 (r302820) @@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "collate.h" + #define EOS '\0' #define RANGE_MATCH 1 @@ -236,6 +238,8 @@ rangematch(const char *pattern, wchar_t wchar_t c, c2; size_t pclen; const char *origpat; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* * A bracket expression starting with an unquoted circumflex @@ -290,7 +294,11 @@ rangematch(const char *pattern, wchar_t if (flags & FNM_CASEFOLD) c2 = towlower(c2); - if (c <= test && test <= c2) + if (table->__collate_load_error ? + c <= test && test <= c2 : + __wcollate_range_cmp(table, c, test) <= 0 + && __wcollate_range_cmp(table, test, c2) <= 0 + ) ok = 1; } else if (c == test) ok = 1; Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/gen/glob.c Thu Jul 14 08:18:12 2016 (r302820) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "collate.h" + /* * glob(3) expansion limits. Stop the expansion if any of these limits * is reached. This caps the runtime in the face of DoS attacks. See @@ -802,6 +804,8 @@ match(Char *name, Char *pat, Char *paten { int ok, negate_range; Char c, k; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; while (pat < patend) { c = *pat++; @@ -826,7 +830,11 @@ match(Char *name, Char *pat, Char *paten ++pat; while (((c = *pat++) & M_MASK) != M_END) if ((*pat & M_MASK) == M_RNG) { - if (CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1])) + if (table->__collate_load_error ? + CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : + __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 + && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 + ) ok = 1; pat += 2; } else if (c == k) Modified: head/lib/libc/locale/collate.h ============================================================================== --- head/lib/libc/locale/collate.h Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/locale/collate.h Thu Jul 14 08:18:12 2016 (r302820) @@ -128,7 +128,8 @@ int __collate_load_tables(const char *); int __collate_equiv_value(locale_t, const wchar_t *, size_t); void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, int, const int **); -int __collate_range_cmp(int, int); +int __collate_range_cmp(struct xlocale_collate *, char, char); +int __wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, size_t); size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, Modified: head/lib/libc/locale/collcmp.c ============================================================================== --- head/lib/libc/locale/collcmp.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/locale/collcmp.c Thu Jul 14 08:18:12 2016 (r302820) @@ -33,13 +33,15 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include "collate.h" /* * Compare two characters using collate */ -int __collate_range_cmp(int c1, int c2) +int __collate_range_cmp(struct xlocale_collate *table, char c1, char c2) { char s1[2], s2[2]; @@ -47,5 +49,20 @@ int __collate_range_cmp(int c1, int c2) s1[1] = '\0'; s2[0] = c2; s2[1] = '\0'; - return (strcoll(s1, s2)); + struct _xlocale l = {{0}}; + l.components[XLC_COLLATE] = (struct xlocale_component *)table; + return (strcoll_l(s1, s2, &l)); +} + +int __wcollate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) +{ + wchar_t s1[2], s2[2]; + + s1[0] = c1; + s1[1] = L'\0'; + s2[0] = c2; + s2[1] = L'\0'; + struct _xlocale l = {{0}}; + l.components[XLC_COLLATE] = (struct xlocale_component *)table; + return (wcscoll_l(s1, s2, &l)); } Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/regex/regcomp.c Thu Jul 14 08:18:12 2016 (r302820) @@ -51,9 +51,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include "collate.h" + #include "utils.h" #include "regex2.h" @@ -764,6 +767,9 @@ p_b_term(struct parse *p, cset *cs) { char c; wint_t start, finish; + wint_t i; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* classify what we've got */ switch ((MORE()) ? PEEK() : '\0') { @@ -811,8 +817,18 @@ p_b_term(struct parse *p, cset *cs) if (start == finish) CHadd(p, cs, start); else { - (void)REQUIRE(start <= finish, REG_ERANGE); - CHaddrange(p, cs, start, finish); + if (table->__collate_load_error) { + (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); + CHaddrange(p, cs, start, finish); + } else { + (void)REQUIRE(__wcollate_range_cmp(table, start, finish) <= 0, REG_ERANGE); + for (i = 0; i <= UCHAR_MAX; i++) { + if ( __wcollate_range_cmp(table, start, i) <= 0 + && __wcollate_range_cmp(table, i, finish) <= 0 + ) + CHadd(p, cs, i); + } + } } break; } Modified: head/lib/libc/stdio/vfscanf.c ============================================================================== --- head/lib/libc/stdio/vfscanf.c Thu Jul 14 08:15:13 2016 (r302819) +++ head/lib/libc/stdio/vfscanf.c Thu Jul 14 08:18:12 2016 (r302820) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" +#include "collate.h" #include "libc_private.h" #include "local.h" #include "xlocale_private.h" @@ -815,7 +816,9 @@ match_failure: static const u_char * __sccl(char *tab, const u_char *fmt) { - int c, n, v; + int c, n, v, i; + struct xlocale_collate *table = + (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; /* first `clear' the whole table */ c = *fmt++; /* first char hat => negated scanset */ @@ -868,15 +871,29 @@ doswitch: * we just stored in the table (c). */ n = *fmt; - if (n == ']' || n < c) { + if (n == ']' + || (table->__collate_load_error ? n < c : + __wcollate_range_cmp(table, n, c) < 0 + ) + ) { c = '-'; break; /* resume the for(;;) */ } fmt++; - do { /* fill in the range */ - tab[++c] = v; - } while (c < n); + /* fill in the range */ + if (table->__collate_load_error) { + do { + tab[++c] = v; + } while (c < n); + } else { + for (i = 0; i < 256; i ++) + if (__wcollate_range_cmp(table, c, i) < 0 && + __wcollate_range_cmp(table, i, n) <= 0 + ) + tab[i] = v; + } #if 1 /* XXX another disgusting compatibility hack */ + c = n; /* * Alas, the V7 Unix scanf also treats formats * such as [a-c-e] as `the letters a through e'. From owner-svn-src-head@freebsd.org Thu Jul 14 08:41:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEDB7B9798B; Thu, 14 Jul 2016 08:41:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAC2711BE; Thu, 14 Jul 2016 08:41:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E8exVk012365; Thu, 14 Jul 2016 08:40:59 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E8ex0E012362; Thu, 14 Jul 2016 08:40:59 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607140840.u6E8ex0E012362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 14 Jul 2016 08:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302823 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 08:41:01 -0000 Author: sephe Date: Thu Jul 14 08:40:59 2016 New Revision: 302823 URL: https://svnweb.freebsd.org/changeset/base/302823 Log: hyperv/vmbus: Move bus related message processing into vmbus. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7125 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 08:20:17 2016 (r302822) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Thu Jul 14 08:40:59 2016 (r302823) @@ -37,13 +37,8 @@ #include #include -typedef void (*vmbus_chanmsg_proc_t) - (struct vmbus_softc *, const struct vmbus_message *); - static void vmbus_chan_detach_task(void *, int); -static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, const struct vmbus_message *); static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, @@ -52,27 +47,16 @@ static void vmbus_chan_msgproc_chrescind /* * Vmbus channel message processing. */ - -#define VMBUS_CHANMSG_PROC(name, func) \ - [VMBUS_CHANMSG_TYPE_##name] = func -#define VMBUS_CHANMSG_PROC_WAKEUP(name) \ - VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) - static const vmbus_chanmsg_proc_t -vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), - VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), - VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP), - VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) }; -#undef VMBUS_CHANMSG_PROC_WAKEUP -#undef VMBUS_CHANMSG_PROC - static struct hv_vmbus_channel * vmbus_chan_alloc(struct vmbus_softc *sc) { @@ -390,19 +374,6 @@ remove: } } -/** - * - * @brief Invoked when all offers have been delivered. - */ -static void -vmbus_channel_on_offers_delivered(struct vmbus_softc *sc, - const struct vmbus_message *msg __unused) -{ - - /* No more new channels for the channel request. */ - vmbus_scan_done(sc); -} - /* * Detach all devices and destroy the corresponding primary channels. */ @@ -538,13 +509,10 @@ vmbus_chan_msgproc(struct vmbus_softc *s uint32_t msg_type; msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; - if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { - device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", - msg_type); - return; - } + KASSERT(msg_type < VMBUS_CHANMSG_TYPE_MAX, + ("invalid message type %u", msg_type)); - msg_proc = vmbus_chanmsg_process[msg_type]; + msg_proc = vmbus_chan_msgprocs[msg_type]; if (msg_proc != NULL) msg_proc(sc, msg); } Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 08:20:17 2016 (r302822) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 14 08:40:59 2016 (r302823) @@ -98,7 +98,12 @@ static int vmbus_req_channels(struct v static void vmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); static void vmbus_scan_wait(struct vmbus_softc *); +static void vmbus_scan_newchan(struct vmbus_softc *); static void vmbus_scan_newdev(struct vmbus_softc *); +static void vmbus_scan_done(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chanmsg_handle(struct vmbus_softc *, + const struct vmbus_message *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); @@ -122,6 +127,12 @@ static const uint32_t vmbus_version[] = VMBUS_VERSION_WS2008 }; +static const vmbus_chanmsg_proc_t +vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER_DONE, vmbus_scan_done), + VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) +}; + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { @@ -480,7 +491,7 @@ vmbus_req_channels(struct vmbus_softc *s return error; } -void +static void vmbus_scan_newchan(struct vmbus_softc *sc) { mtx_lock(&sc->vmbus_scan_lock); @@ -489,8 +500,9 @@ vmbus_scan_newchan(struct vmbus_softc *s mtx_unlock(&sc->vmbus_scan_lock); } -void -vmbus_scan_done(struct vmbus_softc *sc) +static void +vmbus_scan_done(struct vmbus_softc *sc, + const struct vmbus_message *msg __unused) { mtx_lock(&sc->vmbus_scan_lock); sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE; @@ -560,6 +572,27 @@ vmbus_scan(struct vmbus_softc *sc) } static void +vmbus_chanmsg_handle(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; + if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { + device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", + msg_type); + return; + } + + msg_proc = vmbus_chanmsg_handlers[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); + + /* Channel specific processing */ + vmbus_chan_msgproc(sc, msg); +} + +static void vmbus_msg_task(void *xsc, int pending __unused) { struct vmbus_softc *sc = xsc; @@ -572,7 +605,7 @@ vmbus_msg_task(void *xsc, int pending __ break; } else if (msg->msg_type == HYPERV_MSGTYPE_CHANNEL) { /* Channel message */ - vmbus_chan_msgproc(sc, + vmbus_chanmsg_handle(sc, __DEVOLATILE(const struct vmbus_message *, msg)); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 08:20:17 2016 (r302822) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 14 08:40:59 2016 (r302823) @@ -52,6 +52,17 @@ #define VMBUS_CONNID_MESSAGE 1 #define VMBUS_CONNID_EVENT 2 +struct vmbus_message; +struct vmbus_softc; + +typedef void (*vmbus_chanmsg_proc_t)(struct vmbus_softc *, + const struct vmbus_message *); + +#define VMBUS_CHANMSG_PROC(name, func) \ + [VMBUS_CHANMSG_TYPE_##name] = func +#define VMBUS_CHANMSG_PROC_WAKEUP(name) \ + VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) + struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ @@ -151,9 +162,6 @@ const struct vmbus_message *vmbus_msghc_ void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); void vmbus_msghc_reset(struct vmbus_msghc *, size_t); -void vmbus_scan_done(struct vmbus_softc *); -void vmbus_scan_newchan(struct vmbus_softc *); - uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-head@freebsd.org Thu Jul 14 09:07:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3375B98434; Thu, 14 Jul 2016 09:07:26 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE4C3121D; Thu, 14 Jul 2016 09:07:26 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E97PcA020749; Thu, 14 Jul 2016 09:07:25 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E97PPI020743; Thu, 14 Jul 2016 09:07:25 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140907.u6E97PPI020743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302824 - in head/lib/libc: gen locale regex stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:07:27 -0000 Author: ache Date: Thu Jul 14 09:07:25 2016 New Revision: 302824 URL: https://svnweb.freebsd.org/changeset/base/302824 Log: 1) Eliminate possibility to call __*collate_range_cmp() with inclomplete locale (which cause core dump) by removing whole 'table' argument by which it passed. 2) Restore __collate_range_cmp() in __sccl(). 3) Collating [a-z] range in regcomp() only for single bytes locales (we can't do it now for other ones). In previous state only first 256 wchars are considered and all others are just silently dropped from the range. Modified: head/lib/libc/gen/fnmatch.c head/lib/libc/gen/glob.c head/lib/libc/locale/collate.h head/lib/libc/locale/collcmp.c head/lib/libc/regex/regcomp.c head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/gen/fnmatch.c Thu Jul 14 09:07:25 2016 (r302824) @@ -296,8 +296,8 @@ rangematch(const char *pattern, wchar_t if (table->__collate_load_error ? c <= test && test <= c2 : - __wcollate_range_cmp(table, c, test) <= 0 - && __wcollate_range_cmp(table, test, c2) <= 0 + __wcollate_range_cmp(c, test) <= 0 + && __wcollate_range_cmp(test, c2) <= 0 ) ok = 1; } else if (c == test) Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/gen/glob.c Thu Jul 14 09:07:25 2016 (r302824) @@ -832,8 +832,8 @@ match(Char *name, Char *pat, Char *paten if ((*pat & M_MASK) == M_RNG) { if (table->__collate_load_error ? CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : - __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 - && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 + __wcollate_range_cmp(CHAR(c), CHAR(k)) <= 0 + && __wcollate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0 ) ok = 1; pat += 2; Modified: head/lib/libc/locale/collate.h ============================================================================== --- head/lib/libc/locale/collate.h Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/locale/collate.h Thu Jul 14 09:07:25 2016 (r302824) @@ -128,8 +128,8 @@ int __collate_load_tables(const char *); int __collate_equiv_value(locale_t, const wchar_t *, size_t); void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, int, const int **); -int __collate_range_cmp(struct xlocale_collate *, char, char); -int __wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); +int __collate_range_cmp(char, char); +int __wcollate_range_cmp(wchar_t, wchar_t); size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, size_t); size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, Modified: head/lib/libc/locale/collcmp.c ============================================================================== --- head/lib/libc/locale/collcmp.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/locale/collcmp.c Thu Jul 14 09:07:25 2016 (r302824) @@ -34,14 +34,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "collate.h" /* * Compare two characters using collate */ -int __collate_range_cmp(struct xlocale_collate *table, char c1, char c2) +int __collate_range_cmp(char c1, char c2) { char s1[2], s2[2]; @@ -49,12 +48,10 @@ int __collate_range_cmp(struct xlocale_c s1[1] = '\0'; s2[0] = c2; s2[1] = '\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (strcoll_l(s1, s2, &l)); + return (strcoll(s1, s2)); } -int __wcollate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) +int __wcollate_range_cmp(wchar_t c1, wchar_t c2) { wchar_t s1[2], s2[2]; @@ -62,7 +59,5 @@ int __wcollate_range_cmp(struct xlocale_ s1[1] = L'\0'; s2[0] = c2; s2[1] = L'\0'; - struct _xlocale l = {{0}}; - l.components[XLC_COLLATE] = (struct xlocale_component *)table; - return (wcscoll_l(s1, s2, &l)); + return (wcscoll(s1, s2)); } Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/regex/regcomp.c Thu Jul 14 09:07:25 2016 (r302824) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -817,14 +816,14 @@ p_b_term(struct parse *p, cset *cs) if (start == finish) CHadd(p, cs, start); else { - if (table->__collate_load_error) { - (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); + if (table->__collate_load_error || MB_CUR_MAX > 1) { + (void)REQUIRE(start <= finish, REG_ERANGE); CHaddrange(p, cs, start, finish); } else { - (void)REQUIRE(__wcollate_range_cmp(table, start, finish) <= 0, REG_ERANGE); + (void)REQUIRE(__wcollate_range_cmp(start, finish) <= 0, REG_ERANGE); for (i = 0; i <= UCHAR_MAX; i++) { - if ( __wcollate_range_cmp(table, start, i) <= 0 - && __wcollate_range_cmp(table, i, finish) <= 0 + if ( __wcollate_range_cmp(start, i) <= 0 + && __wcollate_range_cmp(i, finish) <= 0 ) CHadd(p, cs, i); } Modified: head/lib/libc/stdio/vfscanf.c ============================================================================== --- head/lib/libc/stdio/vfscanf.c Thu Jul 14 08:40:59 2016 (r302823) +++ head/lib/libc/stdio/vfscanf.c Thu Jul 14 09:07:25 2016 (r302824) @@ -873,7 +873,7 @@ doswitch: n = *fmt; if (n == ']' || (table->__collate_load_error ? n < c : - __wcollate_range_cmp(table, n, c) < 0 + __collate_range_cmp(n, c) < 0 ) ) { c = '-'; @@ -887,8 +887,8 @@ doswitch: } while (c < n); } else { for (i = 0; i < 256; i ++) - if (__wcollate_range_cmp(table, c, i) < 0 && - __wcollate_range_cmp(table, i, n) <= 0 + if (__collate_range_cmp(c, i) <= 0 && + __collate_range_cmp(i, n) <= 0 ) tab[i] = v; } From owner-svn-src-head@freebsd.org Thu Jul 14 09:19:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 436A2B98666; Thu, 14 Jul 2016 09:19:55 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B67A1749; Thu, 14 Jul 2016 09:19:55 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9JsVX024617; Thu, 14 Jul 2016 09:19:54 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9JsDO024614; Thu, 14 Jul 2016 09:19:54 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140919.u6E9JsDO024614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:19:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302825 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:19:55 -0000 Author: ache Date: Thu Jul 14 09:19:53 2016 New Revision: 302825 URL: https://svnweb.freebsd.org/changeset/base/302825 Log: Back out non-collating [a-z] ranges (r302594). Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/usr.bin/tr/str.c head/usr.bin/tr/tr.1 head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/str.c ============================================================================== --- head/usr.bin/tr/str.c Thu Jul 14 09:07:25 2016 (r302824) +++ head/usr.bin/tr/str.c Thu Jul 14 09:19:53 2016 (r302825) @@ -53,7 +53,7 @@ static int backslash(STR *, int *); static int bracket(STR *); static void genclass(STR *); static void genequiv(STR *); -static int genrange(STR *); +static int genrange(STR *, int); static void genseq(STR *); wint_t @@ -93,7 +93,7 @@ next(STR *s) } /* We can start a range at any time. */ - if (s->str[0] == '-' && genrange(s)) + if (s->str[0] == '-' && genrange(s, is_octal)) return (next(s)); return (1); case RANGE: @@ -237,16 +237,18 @@ genequiv(STR *s) } static int -genrange(STR *s) +genrange(STR *s, int was_octal) { - int stopval; + int stopval, octal; char *savestart; + int n, cnt, *p; size_t clen; wchar_t wc; + octal = 0; savestart = s->str; if (*++s->str == '\\') - stopval = backslash(s, NULL); + stopval = backslash(s, &octal); else { clen = mbrtowc(&wc, s->str, MB_LEN_MAX, NULL); if (clen == (size_t)-1 || clen == (size_t)-2) @@ -254,13 +256,37 @@ genrange(STR *s) stopval = wc; s->str += clen; } - if (stopval < s->lastch) { + /* + * XXX Characters are not ordered according to collating sequence in + * multibyte locales. + */ + if (octal || was_octal || MB_CUR_MAX > 1) { + if (stopval < s->lastch) { + s->str = savestart; + return (0); + } + s->cnt = stopval - s->lastch + 1; + s->state = RANGE; + --s->lastch; + return (1); + } + if (charcoll((const void *)&stopval, (const void *)&(s->lastch)) < 0) { s->str = savestart; return (0); } - s->cnt = stopval - s->lastch + 1; - s->state = RANGE; - --s->lastch; + if ((s->set = p = malloc((NCHARS_SB + 1) * sizeof(int))) == NULL) + err(1, "genrange() malloc"); + for (cnt = 0; cnt < NCHARS_SB; cnt++) + if (charcoll((const void *)&cnt, (const void *)&(s->lastch)) >= 0 && + charcoll((const void *)&cnt, (const void *)&stopval) <= 0) + *p++ = cnt; + *p = OOBCH; + n = p - s->set; + + s->cnt = 0; + s->state = SET; + if (n > 1) + mergesort(s->set, n, sizeof(*(s->set)), charcoll); return (1); } Modified: head/usr.bin/tr/tr.1 ============================================================================== --- head/usr.bin/tr/tr.1 Thu Jul 14 09:07:25 2016 (r302824) +++ head/usr.bin/tr/tr.1 Thu Jul 14 09:19:53 2016 (r302825) @@ -164,6 +164,14 @@ as defined by the collation sequence. If either or both of the range endpoints are octal sequences, it represents the range of specific coded values between the range endpoints, inclusive. +.Pp +.Bf Em +See the +.Sx COMPATIBILITY +section below for an important note regarding +differences in the way the current +implementation interprets range expressions differently from +previous implementations. .Ef .It [:class:] Represents all characters belonging to the defined character class. @@ -299,16 +307,22 @@ Remove diacritical marks from all accent .Pp .Dl "tr \*q[=e=]\*q \*qe\*q" .Sh COMPATIBILITY +Previous .Fx implementations of .Nm did not order characters in range expressions according to the current -locale's collation order, making it possible to convert accented Latin -characters from upper to lower case using +locale's collation order, making it possible to convert unaccented Latin +characters (esp.\& as found in English text) from upper to lower case using the traditional .Ux idiom of .Dq Li "tr A-Z a-z" . +Since +.Nm +now obeys the locale's collation order, this idiom may not produce +correct results when there is not a 1:1 mapping between lower and +upper case, or when the order of characters within the two cases differs. As noted in the .Sx EXAMPLES section above, the character class expressions @@ -320,9 +334,6 @@ should be used instead of explicit chara and .Dq Li A-Z . .Pp -.Dq Li [=equiv=] -expression is implemented for single byte locales only. -.Pp System V has historically implemented character ranges using the syntax .Dq Li [c-c] instead of the Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Thu Jul 14 09:07:25 2016 (r302824) +++ head/usr.bin/tr/tr.c Thu Jul 14 09:19:53 2016 (r302825) @@ -68,8 +68,10 @@ static void usage(void); int main(int argc, char **argv) { + static int carray[NCHARS_SB]; struct cmap *map; struct cset *delete, *squeeze; + int n, *p; int Cflag, cflag, dflag, sflag, isstring2; wint_t ch, cnt, lastch; @@ -252,7 +254,7 @@ main(int argc, char **argv) (void)next(&s2); } endloop: - if (cflag || Cflag) { + if (cflag || (Cflag && MB_CUR_MAX > 1)) { /* * This is somewhat tricky: since the character set is * potentially huge, we need to avoid allocating a map @@ -270,11 +272,10 @@ endloop: if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { - if (next(&s2)) { + if (next(&s2)) cmap_add(map, cnt, s2.lastch); - if (sflag) - cset_add(squeeze, s2.lastch); - } + if (sflag) + cset_add(squeeze, s2.lastch); } else cmap_add(map, cnt, cnt); if ((s2.state == EOS || s2.state == INFINITE) && @@ -282,6 +283,30 @@ endloop: break; } cmap_default(map, s2.lastch); + } else if (Cflag) { + for (p = carray, cnt = 0; cnt < NCHARS_SB; cnt++) { + if (cmap_lookup(map, cnt) == OOBCH && iswrune(cnt)) + *p++ = cnt; + else + cmap_add(map, cnt, cnt); + } + n = p - carray; + if (Cflag && n > 1) + (void)mergesort(carray, n, sizeof(*carray), charcoll); + + s2.str = argv[1]; + s2.state = NORMAL; + for (cnt = 0; cnt < n; cnt++) { + (void)next(&s2); + cmap_add(map, carray[cnt], s2.lastch); + /* + * Chars taken from s2 can be different this time + * due to lack of complex upper/lower processing, + * so fill string2 again to not miss some. + */ + if (sflag) + cset_add(squeeze, s2.lastch); + } } cset_cache(squeeze); @@ -326,6 +351,16 @@ setup(char *arg, STR *str, int cflag, in return (cs); } +int +charcoll(const void *a, const void *b) +{ + static char sa[2], sb[2]; + + sa[0] = *(const int *)a; + sb[0] = *(const int *)b; + return (strcoll(sa, sb)); +} + static void usage(void) { From owner-svn-src-head@freebsd.org Thu Jul 14 09:24:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B736FB9896B; Thu, 14 Jul 2016 09:24:56 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82B901C42; Thu, 14 Jul 2016 09:24:56 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9OtLl028053; Thu, 14 Jul 2016 09:24:55 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9OtTv028052; Thu, 14 Jul 2016 09:24:55 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140924.u6E9OtTv028052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302826 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:24:56 -0000 Author: ache Date: Thu Jul 14 09:24:55 2016 New Revision: 302826 URL: https://svnweb.freebsd.org/changeset/base/302826 Log: Document incomplete support of [=equiv=] and collation for ranges. Modified: head/usr.bin/tr/tr.1 Modified: head/usr.bin/tr/tr.1 ============================================================================== --- head/usr.bin/tr/tr.1 Thu Jul 14 09:19:53 2016 (r302825) +++ head/usr.bin/tr/tr.1 Thu Jul 14 09:24:55 2016 (r302826) @@ -334,6 +334,10 @@ should be used instead of explicit chara and .Dq Li A-Z . .Pp +.Dq Li [=equiv=] +expression and collation for ranges +are implemented for single byte locales only. +.Pp System V has historically implemented character ranges using the syntax .Dq Li [c-c] instead of the From owner-svn-src-head@freebsd.org Thu Jul 14 09:26:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFFEDB98BDB; Thu, 14 Jul 2016 09:26:54 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C130F1F0D; Thu, 14 Jul 2016 09:26:54 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9QrVN028338; Thu, 14 Jul 2016 09:26:53 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9QrIt028337; Thu, 14 Jul 2016 09:26:53 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140926.u6E9QrIt028337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302827 - head/usr.bin/tr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:26:55 -0000 Author: ache Date: Thu Jul 14 09:26:53 2016 New Revision: 302827 URL: https://svnweb.freebsd.org/changeset/base/302827 Log: Optimize [Cc]flag case: don't repeatedly add the last character of string2 to squeeze cset when string2 reach its EOS state. Modified: head/usr.bin/tr/tr.c Modified: head/usr.bin/tr/tr.c ============================================================================== --- head/usr.bin/tr/tr.c Thu Jul 14 09:24:55 2016 (r302826) +++ head/usr.bin/tr/tr.c Thu Jul 14 09:26:53 2016 (r302827) @@ -272,10 +272,11 @@ endloop: if (Cflag && !iswrune(cnt)) continue; if (cmap_lookup(map, cnt) == OOBCH) { - if (next(&s2)) + if (next(&s2)) { cmap_add(map, cnt, s2.lastch); - if (sflag) - cset_add(squeeze, s2.lastch); + if (sflag) + cset_add(squeeze, s2.lastch); + } } else cmap_add(map, cnt, cnt); if ((s2.state == EOS || s2.state == INFINITE) && From owner-svn-src-head@freebsd.org Thu Jul 14 09:31:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1F4CB92025; Thu, 14 Jul 2016 09:31:53 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CFD51627; Thu, 14 Jul 2016 09:31:53 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9VqGF031367; Thu, 14 Jul 2016 09:31:52 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9VqG4031366; Thu, 14 Jul 2016 09:31:52 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140931.u6E9VqG4031366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302828 - head/contrib/one-true-awk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:31:53 -0000 Author: ache Date: Thu Jul 14 09:31:52 2016 New Revision: 302828 URL: https://svnweb.freebsd.org/changeset/base/302828 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/one-true-awk/b.c Modified: head/contrib/one-true-awk/b.c ============================================================================== --- head/contrib/one-true-awk/b.c Thu Jul 14 09:26:53 2016 (r302827) +++ head/contrib/one-true-awk/b.c Thu Jul 14 09:31:52 2016 (r302828) @@ -296,11 +296,7 @@ static int collate_range_cmp(int a, int return 0; s[0][0] = a; s[1][0] = b; -#ifdef __FreeBSD__ - return (strcmp(s[0], s[1])); -#else return (strcoll(s[0], s[1])); -#endif } char *cclenter(const char *argp) /* add a character class */ From owner-svn-src-head@freebsd.org Thu Jul 14 09:34:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 472AAB920CF; Thu, 14 Jul 2016 09:34:44 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F341F194D; Thu, 14 Jul 2016 09:34:43 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9YhBG032136; Thu, 14 Jul 2016 09:34:43 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9Yhrw032134; Thu, 14 Jul 2016 09:34:43 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140934.u6E9Yhrw032134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302829 - in head/bin/sh: . tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:34:44 -0000 Author: ache Date: Thu Jul 14 09:34:42 2016 New Revision: 302829 URL: https://svnweb.freebsd.org/changeset/base/302829 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/bin/sh/expand.c head/bin/sh/tests/builtins/case7.0 Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Jul 14 09:31:52 2016 (r302828) +++ head/bin/sh/expand.c Thu Jul 14 09:34:42 2016 (r302829) @@ -107,6 +107,7 @@ static void expmeta(char *, char *, stru static int expsortcmp(const void *, const void *); static int patmatch(const char *, const char *); static void cvtnum(int, char *); +static int collate_range_cmp(wchar_t, wchar_t); void emptyarglist(struct arglist *list) @@ -137,6 +138,16 @@ appendarglist(struct arglist *list, char list->args[list->count++] = str; } +static int +collate_range_cmp(wchar_t c1, wchar_t c2) +{ + static wchar_t s1[2], s2[2]; + + s1[0] = c1; + s2[0] = c2; + return (wcscoll(s1, s2)); +} + static char * stputs_quotes(const char *data, const char *syntax, char *p) { @@ -1348,7 +1359,9 @@ patmatch(const char *pattern, const char return 0; } else wc2 = (unsigned char)*p++; - if (wc <= chr && chr <= wc2) + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 + ) found = 1; } else { if (chr == wc) Modified: head/bin/sh/tests/builtins/case7.0 ============================================================================== --- head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:31:52 2016 (r302828) +++ head/bin/sh/tests/builtins/case7.0 Thu Jul 14 09:34:42 2016 (r302829) @@ -14,6 +14,11 @@ c1=e c2=$(printf '\366') case $c1$c2 in -[a-z][!a-z]) ;; +[a-z][a-z]) ;; +*) echo wrong at $LINENO ;; +esac + +case $c1$c2 in +[a-f][n-p]) ;; *) echo wrong at $LINENO ;; esac From owner-svn-src-head@freebsd.org Thu Jul 14 09:37:17 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB5FEB9227C; Thu, 14 Jul 2016 09:37:17 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B2911B13; Thu, 14 Jul 2016 09:37:17 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9bGt3032274; Thu, 14 Jul 2016 09:37:16 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9bGTC032273; Thu, 14 Jul 2016 09:37:16 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140937.u6E9bGTC032273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302830 - head/contrib/tcsh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:37:17 -0000 Author: ache Date: Thu Jul 14 09:37:16 2016 New Revision: 302830 URL: https://svnweb.freebsd.org/changeset/base/302830 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/tcsh/glob.c Modified: head/contrib/tcsh/glob.c ============================================================================== --- head/contrib/tcsh/glob.c Thu Jul 14 09:34:42 2016 (r302829) +++ head/contrib/tcsh/glob.c Thu Jul 14 09:37:16 2016 (r302830) @@ -142,23 +142,17 @@ globcharcoll(__Char c1, __Char c2, int c c1 = towlower(c1); c2 = towlower(c2); } else { -#ifndef __FreeBSD__ /* This should not be here, but I'll rather leave it in than engage in a LC_COLLATE flamewar about a shell I don't use... */ if (iswlower(c1) && iswupper(c2)) return (1); if (iswupper(c1) && iswlower(c2)) return (-1); -#endif } s1[0] = c1; s2[0] = c2; s1[1] = s2[1] = '\0'; -#ifdef __FreeBSD__ - return wcscmp(s1, s2); -#else return wcscoll(s1, s2); -#endif # else /* not WIDE_STRINGS */ char s1[2], s2[2]; From owner-svn-src-head@freebsd.org Thu Jul 14 09:40:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FF32B92464; Thu, 14 Jul 2016 09:40:44 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E52131DA9; Thu, 14 Jul 2016 09:40:43 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9ehCY033094; Thu, 14 Jul 2016 09:40:43 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9ehgs033093; Thu, 14 Jul 2016 09:40:43 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140940.u6E9ehgs033093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302831 - head/contrib/tcsh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:40:44 -0000 Author: ache Date: Thu Jul 14 09:40:42 2016 New Revision: 302831 URL: https://svnweb.freebsd.org/changeset/base/302831 Log: To mimic system glob, we definitely don't need manual upper/lower hack. The author clearly disagree in the comment, so this patch will be not submitted upstream. Modified: head/contrib/tcsh/glob.c Modified: head/contrib/tcsh/glob.c ============================================================================== --- head/contrib/tcsh/glob.c Thu Jul 14 09:37:16 2016 (r302830) +++ head/contrib/tcsh/glob.c Thu Jul 14 09:40:42 2016 (r302831) @@ -142,12 +142,14 @@ globcharcoll(__Char c1, __Char c2, int c c1 = towlower(c1); c2 = towlower(c2); } else { +#ifndef __FreeBSD__ /* This should not be here, but I'll rather leave it in than engage in a LC_COLLATE flamewar about a shell I don't use... */ if (iswlower(c1) && iswupper(c2)) return (1); if (iswupper(c1) && iswlower(c2)) return (-1); +#endif } s1[0] = c1; s2[0] = c2; From owner-svn-src-head@freebsd.org Thu Jul 14 09:45:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A2BDB92727; Thu, 14 Jul 2016 09:45:09 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E608D1307; Thu, 14 Jul 2016 09:45:08 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9j81R035880; Thu, 14 Jul 2016 09:45:08 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9j8D4035878; Thu, 14 Jul 2016 09:45:08 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140945.u6E9j8D4035878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302832 - head/contrib/libgnuregex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:45:09 -0000 Author: ache Date: Thu Jul 14 09:45:07 2016 New Revision: 302832 URL: https://svnweb.freebsd.org/changeset/base/302832 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/contrib/libgnuregex/regcomp.c head/contrib/libgnuregex/regexec.c Modified: head/contrib/libgnuregex/regcomp.c ============================================================================== --- head/contrib/libgnuregex/regcomp.c Thu Jul 14 09:40:42 2016 (r302831) +++ head/contrib/libgnuregex/regcomp.c Thu Jul 14 09:45:07 2016 (r302832) @@ -2664,11 +2664,7 @@ build_range_exp (bitset_t sbcset, bracke return REG_ECOLLATE; cmp_buf[0] = start_wc; cmp_buf[4] = end_wc; -#ifdef __FreeBSD__ - if (wcscmp (cmp_buf, cmp_buf + 4) > 0) -#else if (wcscoll (cmp_buf, cmp_buf + 4) > 0) -#endif return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2710,13 +2706,8 @@ build_range_exp (bitset_t sbcset, bracke for (wc = 0; wc < SBC_MAX; ++wc) { cmp_buf[2] = wc; -#ifdef __FreeBSD__ - if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 - && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) -#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) -#endif bitset_set (sbcset, wc); } } Modified: head/contrib/libgnuregex/regexec.c ============================================================================== --- head/contrib/libgnuregex/regexec.c Thu Jul 14 09:40:42 2016 (r302831) +++ head/contrib/libgnuregex/regexec.c Thu Jul 14 09:45:07 2016 (r302832) @@ -3964,13 +3964,8 @@ check_node_accept_bytes (const re_dfa_t { cmp_buf[0] = cset->range_starts[i]; cmp_buf[4] = cset->range_ends[i]; -#ifdef __FreeBSD__ - if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 - && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) -#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) -#endif { match_len = char_len; goto check_node_accept_bytes_match; From owner-svn-src-head@freebsd.org Thu Jul 14 09:47:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08505B9294C; Thu, 14 Jul 2016 09:47:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C935315B4; Thu, 14 Jul 2016 09:47:50 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E9lnPX036039; Thu, 14 Jul 2016 09:47:49 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E9lnCu036038; Thu, 14 Jul 2016 09:47:49 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607140947.u6E9lnCu036038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 14 Jul 2016 09:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302833 - head/gnu/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:47:51 -0000 Author: ache Date: Thu Jul 14 09:47:49 2016 New Revision: 302833 URL: https://svnweb.freebsd.org/changeset/base/302833 Log: Back out non-collating [a-z] ranges. Instead of changing the whole course to another POSIX-permitted way for consistency and uniformity I decide to completely ignore missing regex fucntionality and focus on fixing bugs in what we have now, too many small obstacles we have choicing other way, counting ports. Corresponding libc changes are backed out in r302824. Modified: head/gnu/usr.bin/grep/dfa.c Modified: head/gnu/usr.bin/grep/dfa.c ============================================================================== --- head/gnu/usr.bin/grep/dfa.c Thu Jul 14 09:45:07 2016 (r302832) +++ head/gnu/usr.bin/grep/dfa.c Thu Jul 14 09:47:49 2016 (r302833) @@ -2547,13 +2547,8 @@ match_mb_charset (struct dfa *d, int s, wcbuf[2] = work_mbc->range_sts[i]; wcbuf[4] = work_mbc->range_ends[i]; -#ifdef __FreeBSD__ - if (wcscmp(wcbuf, wcbuf+2) >= 0 && - wcscmp(wcbuf+4, wcbuf) >= 0) -#else if (wcscoll(wcbuf, wcbuf+2) >= 0 && wcscoll(wcbuf+4, wcbuf) >= 0) -#endif goto charset_matched; } From owner-svn-src-head@freebsd.org Thu Jul 14 09:53:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01532B92D6C for ; Thu, 14 Jul 2016 09:53:40 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-153.reflexion.net [208.70.211.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B39DE1A5F for ; Thu, 14 Jul 2016 09:53:39 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 3951 invoked from network); 14 Jul 2016 09:54:11 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 14 Jul 2016 09:54:11 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.90.3) with SMTP; Thu, 14 Jul 2016 05:53:37 -0400 (EDT) Received: (qmail 1143 invoked from network); 14 Jul 2016 09:53:36 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 14 Jul 2016 09:53:36 -0000 X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id BC0BEB1E001; Thu, 14 Jul 2016 02:53:29 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302601 - in head/sys: arm/include arm64/include [clang 3.8.0: powerpc int instead of 32-bit SYSVR4's long and 64-bit ELF V2 long] From: Mark Millard In-Reply-To: <3DFF1DC9-2AE6-498A-9FE0-4970E76F8AB5@dsl-only.net> Date: Thu, 14 Jul 2016 02:53:29 -0700 Cc: svn-src-head@freebsd.org, FreeBSD Current , freebsd-stable@freebsd.org, freebsd-arm , FreeBSD PowerPC ML , FreeBSD Toolchain , Bruce Evans Content-Transfer-Encoding: quoted-printable Message-Id: <580A746B-3F02-44FA-AB2E-20CC71A1E9D2@dsl-only.net> References: <46153340-D2F4-48BD-B738-4792BC25FA3F@dsl-only.net> <38CF2C28-3BD1-4D09-939F-4DD0C2E8B58F@dsl-only.net> <3DFF1DC9-2AE6-498A-9FE0-4970E76F8AB5@dsl-only.net> To: Andrey Chernov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 09:53:40 -0000 [Top post of a history note for powerpc and wchar_t's type in FreeBSD. = The history is from looking around in svn.] [The below is not a complaint or a request for a change. It just looks = like int for wchar_t for powerpc was a choice made long ago for simpler = code given FreeBSD's pre-existing structure.] int being used for powerpc wchar_t on FreeBSD goes back to at least = 2001-Jan-1. [FYI: "27 February, 2008: FreeBSD 7.0 is the first release = to officially support the FreeBSD/ppc port". So long before official = support.] wchar_t's type is one place where FreeBSD choose to override the powerpc = (and powerpc64) ABI standards (that indicate long, not int). I'm not = sure if this was implicit vs. explicitly realizing the ABI mismatch. = [The SYSVR4 32-bit powerpc ABI goes back to 1995.] I first traced the history back to 2002-Aug-23: -r102315 of = sys/sys/_types.h standardized FreeBSD on the following until the ARM = change: typedef int __ct_rune_t; typedef __ct_rune_t __rune_t; typedef __ct_rune_t __wchar_t; typedef __ct_rune_t __wint_t; Prior to this there was 2002-Aug-21's -r102227 = sys/powerpc/include/_types.h that used __int32_t. Prior to that had ansi.h and types.h instead of _types.h --and ansi.h = had: #define _BSD_WCHAR_T_ _BSD_CT_RUNE_T_ /* wchar_t (see below) = */ . . . #define _BSD_CT_RUNE_T_ int /* arg type for ctype = funcs */ Going back to sys/powerpc/include/ansi.h's -r70571 (2001-Jan-1 creation = in svn): #define _BSD_WCHAR_T_ int /* wchar_t */ And the comments back then say: . . . It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. . . . The reason an int was * chosen over a long is that the is*() and to*() routines take ints = (says * ANSI C), but they use __ct_rune_t instead of int. I've decided to not go any farther back in time (if there is prior = history for wchar_t for powerpc). Ignoring the temporary __int32_t use: FreeBSD has had its own powerpc = wchar_t type (int) for at least the last 15 years, at least when viewed = just relative to the powerpc ABI(s) FreeBSD is based on for powerpc. Modern gcc versions even have the FreeBSD wchar_t type correct for = powerpc variants in recent times: int. Previously some notation (L based = notation) used the wrong type for one of the powerpc variants (32-bit = vs. 64-bit), causing lots of false-positive compiler notices. gcc had = followed the ABI involved (long int) until the correction. =3D=3D=3D Mark Millard markmi at dsl-only.net On 2016-Jul-13, at 11:46 PM, Mark Millard = wrote: > On 2016-Jul-13, at 6:00 PM, Andrey Chernov = wrote: >=20 >> On 13.07.2016 11:53, Mark Millard wrote: >>> [The below does note that TARGET=3Dpowerpc has a mix of signed = wchar_t and unsigned char types and most architectures have both being = signed types.] >>=20 >> POSIX says nothing about wchar_t and char should be the same = (un)signed. >> It is arm ABI docs may say so only. They are different entities >> differently encoded and cross assigning between wchar_t and char is = not >> recommended. >=20 > [My "odd" would better have been the longer phrase "unusual for = FreeBSD" for the signed type mismatch point.] >=20 > C11 (9899:2011[2012]) and C++11 (14882:2011(E)) agree with your POSIX = note: no constraint to have the same signed type status as char. >=20 > But when I then looked at the "System V Application Binary Interface = PowerpC Processor Supplement" (1995-Sept SunSoft document) that I = believe FreeBSD uses for powerpc (32-bit only: TARGET_ARCH=3Dpowerpc) it = has: >=20 > typedef long wchar_t; >=20 > as part of: Figure 6-39 (page labeled 6-38). >=20 > While agreeing about the signed-type status for wchar_t this does not = agree with FreeBSD 11.0's use of int as the type: >=20 > sys/powerpc/include/_types.h:typedef int ___wchar_t; > sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ > sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >=20 > # clang --target=3Dpowerpc-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . >=20 > I'm not as sure of which document is official for = TARGET_ARCH=3Dpowerpc64 but using "Power Architecture 64-bit ELF V2 ABI = Specification" (Open POWER ABI for Linux Supplement) as an example of = what likely is common for that context: 5.1.3 Types Defined in Standard = header lists: >=20 > typedef long wchar_t; >=20 > which again does not agree with FreeBSD 11.0's use of int as the type: >=20 > # clang --target=3Dpowerpc64-freebsd11 -std=3Dc99 -E -dM - < = /dev/null | more > . . . > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > #define __WCHAR_WIDTH__ 32 > . . . >=20 >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 >=20 >>=20 >> On 2016-Jul-11, at 8:57 PM, Andrey Chernov = wrote: >>=20 >>> On 12.07.2016 5:44, Mark Millard wrote: >>>> My understanding of the criteria for __WCHAR_MIN and __WCHAR_MAX: >>>>=20 >>>> A) __WCHAR_MIN and __WCHAR_MAX: same type as the integer promotion = of >>>> ___wchar_t (if that is distinct). >>>> B) __WCHAR_MIN is the low value for ___wchar_t as an integer type; = not >>>> necessarily a valid char value >>>> C) __WCHAR_MAX is the high value for ___wchar_t as an integer type; = not >>>> necessarily a valid char value >>>=20 >>> It seems you are right about "not a valid char value", I'll back = this >>> change out. >>>=20 >>>> As far as I know arm FreeBSD uses unsigned character types (of = whatever >>>> width). >>>=20 >>> Probably it should be unsigned for other architectures too, clang = does >>> not generate negative values with L'' literals and locale use = only >>> positive values too. >>=20 >> Looking around: >>=20 >> # grep -i wchar sys/*/include/_types.h >> sys/arm/include/_types.h:typedef unsigned int ___wchar_t; >> sys/arm/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ >> sys/arm/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ >> sys/arm64/include/_types.h:typedef unsigned int ___wchar_t; >> sys/arm64/include/_types.h:#define __WCHAR_MIN 0 = /* min value for a wchar_t */ >> sys/arm64/include/_types.h:#define __WCHAR_MAX __UINT_MAX = /* max value for a wchar_t */ >> sys/mips/include/_types.h:typedef int ___wchar_t; >> sys/mips/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ >> sys/mips/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >> sys/powerpc/include/_types.h:typedef int ___wchar_t; >> sys/powerpc/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ >> sys/powerpc/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >> sys/riscv/include/_types.h:typedef int ___wchar_t; >> sys/riscv/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ >> sys/riscv/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >> sys/sparc64/include/_types.h:typedef int ___wchar_t; >> sys/sparc64/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ >> sys/sparc64/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >> sys/x86/include/_types.h:typedef int ___wchar_t; >> sys/x86/include/_types.h:#define __WCHAR_MIN __INT_MIN = /* min value for a wchar_t */ >> sys/x86/include/_types.h:#define __WCHAR_MAX __INT_MAX = /* max value for a wchar_t */ >>=20 >> So only arm and arm64 have unsigned wchar_t types. >>=20 >> [NOTE: __CHAR16_TYPE__ and __CHAR32_TYPE__ are always unsigned: in = C++11 terms char16_t is like std::uint_least16_t and char32_t is like = std::uint_least32_t despite being distinct types. So __CHAR16_TYPE__ and = __CHAR32_TYPE__ are ignored below.] >>=20 >> The clang 3.8.0 compiler output has an odd mix for = TARGET_ARCH=3Dpowerpc and TARGET_ARCH=3Dpowerpc64 . . . >>=20 >> armv6 has unsigned types for both char and __WCHAR_TYPE__. >> aarch64 has unsigned types for both char and __WCHAR_TYPE__. >> powerpc has unsigned for char but signed for __WCHAR_TYPE__. >> powerpc64 has unsigned for char but signed for __WCHAR_TYPE__. >> amd64 has signed types for both char and __WCHAR_TYPE__. >> i386 has signed types for both char and __WCHAR_TYPE__. >> mips has signed types for both char and __WCHAR_TYPE__. >> sparc64 has signed types for both char and __WCHAR_TYPE__. >> (riscv is not covered by clang as I understand) >>=20 >> The details via compiler #define's. . . >>=20 >> # clang --target=3Darmv6-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more >> . . . >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> #define __CHAR_UNSIGNED__ 1 >> . . . >> #define __WCHAR_MAX__ 4294967295U >> #define __WCHAR_TYPE__ unsigned int >> #define __WCHAR_UNSIGNED__ 1 >> #define __WCHAR_WIDTH__ 32 >> . . . >>=20 >> # clang --target=3Daarch64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more >> . . . >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> #define __CHAR_UNSIGNED__ 1 >> . . . >> #define __WCHAR_MAX__ 4294967295U >> #define __WCHAR_TYPE__ unsigned int >> #define __WCHAR_UNSIGNED__ 1 >> #define __WCHAR_WIDTH__ 32 >> . . . >>=20 >> # clang --target=3Dpowerpc-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more >> . . . >> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> #define __CHAR_UNSIGNED__ 1 >> . . . >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >> Is powerpc wrong? >>=20 >> # clang --target=3Dpowerpc64-freebsd11 -std=3Dc99 -E -dM - < = /dev/null | more >> . . . >> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> #define __CHAR_UNSIGNED__ 1 >> . . . >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >> Is powerpc64 wrong? >>=20 >>=20 >> # clang --target=3Damd64-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more >> . . . >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> . . . (note the lack of __CHAR_UNSIGNED__) . . . >>=20 >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >> # clang --target=3Di386-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more >> . . . >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> . . . (note the lack of __CHAR_UNSIGNED__) . . . >>=20 >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >>=20 >> # clang --target=3Dmips-freebsd11 -std=3Dc99 -E -dM - < /dev/null | = more >> . . . >> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> . . . (note the lack of __CHAR_UNSIGNED__) . . . >>=20 >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >> # clang --target=3Dsparc64-freebsd11 -std=3Dc99 -E -dM - < /dev/null = | more >> . . . >> #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ >> . . . >> #define __CHAR_BIT__ 8 >> . . . (note the lack of __CHAR_UNSIGNED__) . . . >>=20 >> #define __WCHAR_MAX__ 2147483647 >> #define __WCHAR_TYPE__ int >> #define __WCHAR_WIDTH__ 32 >> . . . (note the lack of __WCHAR_UNSIGNED__) . . . >>=20 >>=20 >>=20 >> =3D=3D=3D >> Mark Millard >> markmi at dsl-only.net From owner-svn-src-head@freebsd.org Thu Jul 14 11:03:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BB97B9928C; Thu, 14 Jul 2016 11:03:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAD021BE0; Thu, 14 Jul 2016 11:03:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EB36rQ065235; Thu, 14 Jul 2016 11:03:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EB36we065234; Thu, 14 Jul 2016 11:03:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141103.u6EB36we065234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302834 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:03:07 -0000 Author: avg Date: Thu Jul 14 11:03:05 2016 New Revision: 302834 URL: https://svnweb.freebsd.org/changeset/base/302834 Log: fix-up for configuration of AMD Family 10h processors borrowed from Linux http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c#L643 BIOS may configure Family 10h processors to convert WC+ cache type to CD. That can hurt performance of guest VMs using nested paging. Reviewed by: kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D6059 Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Thu Jul 14 09:47:49 2016 (r302833) +++ head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:03:05 2016 (r302834) @@ -94,6 +94,20 @@ init_amd(void) wrmsr(MSR_NB_CFG1, msr); } } + + /* + * BIOS may configure Family 10h processors to convert WC+ cache type + * to CD. That can hurt performance of guest VMs using nested paging. + * The relevant MSR bit is not documented in the BKDG, + * the fix is borrowed from Linux. + */ + if (CPUID_TO_FAMILY(cpu_id) == 0x10) { + if ((cpu_feature2 & CPUID2_HV) == 0) { + msr = rdmsr(0xc001102a); + msr &= ~((uint64_t)1 << 24); + wrmsr(0xc001102a, msr); + } + } } /* @@ -179,6 +193,7 @@ initializecpu(void) void initializecpucache(void) { + uint64_t msr; /* * CPUID with %eax = 1, %ebx returns From owner-svn-src-head@freebsd.org Thu Jul 14 11:13:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 617CFB9944C; Thu, 14 Jul 2016 11:13:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CCB81220; Thu, 14 Jul 2016 11:13:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBDQU5068844; Thu, 14 Jul 2016 11:13:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBDQY4068843; Thu, 14 Jul 2016 11:13:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141113.u6EBDQY4068843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302835 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:13:27 -0000 Author: avg Date: Thu Jul 14 11:13:26 2016 New Revision: 302835 URL: https://svnweb.freebsd.org/changeset/base/302835 Log: remove a stray change from r302834 MFC after: 3 weeks X-MFC with: r302834 Modified: head/sys/amd64/amd64/initcpu.c Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:03:05 2016 (r302834) +++ head/sys/amd64/amd64/initcpu.c Thu Jul 14 11:13:26 2016 (r302835) @@ -193,7 +193,6 @@ initializecpu(void) void initializecpucache(void) { - uint64_t msr; /* * CPUID with %eax = 1, %ebx returns From owner-svn-src-head@freebsd.org Thu Jul 14 11:39:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48B93B99D4D; Thu, 14 Jul 2016 11:39:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 078151F2E; Thu, 14 Jul 2016 11:39:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBdaP3076559; Thu, 14 Jul 2016 11:39:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBdatO076558; Thu, 14 Jul 2016 11:39:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141139.u6EBdatO076558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:39:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302836 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:39:37 -0000 Author: avg Date: Thu Jul 14 11:39:36 2016 New Revision: 302836 URL: https://svnweb.freebsd.org/changeset/base/302836 Log: MFV r302640: 6874 rollback and receive need to reset ZPL state to what's on disk illumos/illumos-gate@1fdcbd00c9cbac286b5f92e08877e8cb3c448420 https://github.com/illumos/illumos-gate/commit/1fdcbd00c9cbac286b5f92e08877e8cb3c448420 https://www.illumos.org/issues/6874 When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL doesn't completely reload the state from the DMU; some values remain cached in the zfsvfs_t. steps to reproduce: ``` #!/bin/bash -x zfs destroy -R test/fs zfs destroy -R test/recvd zfs create test/fs zfs snapshot test/fs@a zfs set userquota@$USER=1m test/fs zfs snapshot test/fs@b zfs send test/fs@a | zfs recv test/recvd zfs send -i @a test/fs@b | zfs recv test/recvd zfs userspace test/recvd 1. should show 1m quota dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024 sync dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024 2. should fail with ENOSPC sync zfs unmount test/recvd zfs mount test/recvd zfs userspace test/recvd 3. if bug above, now shows 1m quota dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024 4. if bug above, now fails with ENOSPC ``` Reviewed by: George Wilson Reviewed by: Paul Dagnelie Approved by: Garrett D'Amore Author: Matthew Ahrens MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 14 11:13:26 2016 (r302835) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 14 11:39:36 2016 (r302836) @@ -22,7 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -846,72 +846,46 @@ zfs_owner_overquota(zfsvfs_t *zfsvfs, zn return (zfs_fuid_overquota(zfsvfs, isgroup, fuid)); } -int -zfsvfs_create(const char *osname, zfsvfs_t **zfvp) +/* + * Associate this zfsvfs with the given objset, which must be owned. + * This will cache a bunch of on-disk state from the objset in the + * zfsvfs. + */ +static int +zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) { - objset_t *os; - zfsvfs_t *zfsvfs; - uint64_t zval; - int i, error; - uint64_t sa_obj; - - /* - * XXX: Fix struct statfs so this isn't necessary! - * - * The 'osname' is used as the filesystem's special node, which means - * it must fit in statfs.f_mntfromname, or else it can't be - * enumerated, so libzfs_mnttab_find() returns NULL, which causes - * 'zfs unmount' to think it's not mounted when it is. - */ - if (strlen(osname) >= MNAMELEN) - return (SET_ERROR(ENAMETOOLONG)); - - zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP); - - /* - * We claim to always be readonly so we can open snapshots; - * other ZPL code will prevent us from writing to snapshots. - */ - error = dmu_objset_own(osname, DMU_OST_ZFS, B_TRUE, zfsvfs, &os); - if (error) { - kmem_free(zfsvfs, sizeof (zfsvfs_t)); - return (error); - } + int error; + uint64_t val; - /* - * Initialize the zfs-specific filesystem structure. - * Should probably make this a kmem cache, shuffle fields, - * and just bzero up to z_hold_mtx[]. - */ - zfsvfs->z_vfs = NULL; - zfsvfs->z_parent = zfsvfs; zfsvfs->z_max_blksz = SPA_OLD_MAXBLOCKSIZE; zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE; zfsvfs->z_os = os; error = zfs_get_zplprop(os, ZFS_PROP_VERSION, &zfsvfs->z_version); - if (error) { - goto out; - } else if (zfsvfs->z_version > + if (error != 0) + return (error); + if (zfsvfs->z_version > zfs_zpl_version_map(spa_version(dmu_objset_spa(os)))) { (void) printf("Can't mount a version %lld file system " "on a version %lld pool\n. Pool must be upgraded to mount " "this file system.", (u_longlong_t)zfsvfs->z_version, (u_longlong_t)spa_version(dmu_objset_spa(os))); - error = SET_ERROR(ENOTSUP); - goto out; + return (SET_ERROR(ENOTSUP)); } - if ((error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &zval)) != 0) - goto out; - zfsvfs->z_norm = (int)zval; + error = zfs_get_zplprop(os, ZFS_PROP_NORMALIZE, &val); + if (error != 0) + return (error); + zfsvfs->z_norm = (int)val; - if ((error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &zval)) != 0) - goto out; - zfsvfs->z_utf8 = (zval != 0); + error = zfs_get_zplprop(os, ZFS_PROP_UTF8ONLY, &val); + if (error != 0) + return (error); + zfsvfs->z_utf8 = (val != 0); - if ((error = zfs_get_zplprop(os, ZFS_PROP_CASE, &zval)) != 0) - goto out; - zfsvfs->z_case = (uint_t)zval; + error = zfs_get_zplprop(os, ZFS_PROP_CASE, &val); + if (error != 0) + return (error); + zfsvfs->z_case = (uint_t)val; /* * Fold case on file systems that are always or sometimes case @@ -924,60 +898,99 @@ zfsvfs_create(const char *osname, zfsvfs zfsvfs->z_use_fuids = USE_FUIDS(zfsvfs->z_version, zfsvfs->z_os); zfsvfs->z_use_sa = USE_SA(zfsvfs->z_version, zfsvfs->z_os); + uint64_t sa_obj = 0; if (zfsvfs->z_use_sa) { /* should either have both of these objects or none */ error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_SA_ATTRS, 8, 1, &sa_obj); - if (error) - goto out; - } else { - /* - * Pre SA versions file systems should never touch - * either the attribute registration or layout objects. - */ - sa_obj = 0; + if (error != 0) + return (error); } error = sa_setup(os, sa_obj, zfs_attr_table, ZPL_END, &zfsvfs->z_attr_table); - if (error) - goto out; + if (error != 0) + return (error); if (zfsvfs->z_version >= ZPL_VERSION_SA) sa_register_update_callback(os, zfs_sa_upgrade); error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_ROOT_OBJ, 8, 1, &zfsvfs->z_root); - if (error) - goto out; + if (error != 0) + return (error); ASSERT(zfsvfs->z_root != 0); error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_UNLINKED_SET, 8, 1, &zfsvfs->z_unlinkedobj); - if (error) - goto out; + if (error != 0) + return (error); error = zap_lookup(os, MASTER_NODE_OBJ, zfs_userquota_prop_prefixes[ZFS_PROP_USERQUOTA], 8, 1, &zfsvfs->z_userquota_obj); - if (error && error != ENOENT) - goto out; + if (error == ENOENT) + zfsvfs->z_userquota_obj = 0; + else if (error != 0) + return (error); error = zap_lookup(os, MASTER_NODE_OBJ, zfs_userquota_prop_prefixes[ZFS_PROP_GROUPQUOTA], 8, 1, &zfsvfs->z_groupquota_obj); - if (error && error != ENOENT) - goto out; + if (error == ENOENT) + zfsvfs->z_groupquota_obj = 0; + else if (error != 0) + return (error); error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_FUID_TABLES, 8, 1, &zfsvfs->z_fuid_obj); - if (error && error != ENOENT) - goto out; + if (error == ENOENT) + zfsvfs->z_fuid_obj = 0; + else if (error != 0) + return (error); error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_SHARES_DIR, 8, 1, &zfsvfs->z_shares_dir); - if (error && error != ENOENT) - goto out; + if (error == ENOENT) + zfsvfs->z_shares_dir = 0; + else if (error != 0) + return (error); + + return (0); +} + +int +zfsvfs_create(const char *osname, zfsvfs_t **zfvp) +{ + objset_t *os; + zfsvfs_t *zfsvfs; + int error; + + /* + * XXX: Fix struct statfs so this isn't necessary! + * + * The 'osname' is used as the filesystem's special node, which means + * it must fit in statfs.f_mntfromname, or else it can't be + * enumerated, so libzfs_mnttab_find() returns NULL, which causes + * 'zfs unmount' to think it's not mounted when it is. + */ + if (strlen(osname) >= MNAMELEN) + return (SET_ERROR(ENAMETOOLONG)); + + zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP); + + /* + * We claim to always be readonly so we can open snapshots; + * other ZPL code will prevent us from writing to snapshots. + */ + error = dmu_objset_own(osname, DMU_OST_ZFS, B_TRUE, zfsvfs, &os); + if (error) { + kmem_free(zfsvfs, sizeof (zfsvfs_t)); + return (error); + } + + zfsvfs->z_vfs = NULL; + zfsvfs->z_parent = zfsvfs; mutex_init(&zfsvfs->z_znodes_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&zfsvfs->z_lock, NULL, MUTEX_DEFAULT, NULL); @@ -986,17 +999,19 @@ zfsvfs_create(const char *osname, zfsvfs rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); rw_init(&zfsvfs->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); - for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) + for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++) mutex_init(&zfsvfs->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL); + error = zfsvfs_init(zfsvfs, os); + if (error != 0) { + dmu_objset_disown(os, zfsvfs); + *zfvp = NULL; + kmem_free(zfsvfs, sizeof (zfsvfs_t)); + return (error); + } + *zfvp = zfsvfs; return (0); - -out: - dmu_objset_disown(os, zfsvfs); - *zfvp = NULL; - kmem_free(zfsvfs, sizeof (zfsvfs_t)); - return (error); } static int @@ -2198,7 +2213,6 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch { int err; znode_t *zp; - uint64_t sa_obj = 0; ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); @@ -2207,35 +2221,16 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch * We already own this, so just hold and rele it to update the * objset_t, as the one we had before may have been evicted. */ - VERIFY0(dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os)); - VERIFY3P(zfsvfs->z_os->os_dsl_dataset->ds_owner, ==, zfsvfs); - VERIFY(dsl_dataset_long_held(zfsvfs->z_os->os_dsl_dataset)); - dmu_objset_rele(zfsvfs->z_os, zfsvfs); - - /* - * Make sure version hasn't changed - */ - - err = zfs_get_zplprop(zfsvfs->z_os, ZFS_PROP_VERSION, - &zfsvfs->z_version); - - if (err) - goto bail; - - err = zap_lookup(zfsvfs->z_os, MASTER_NODE_OBJ, - ZFS_SA_ATTRS, 8, 1, &sa_obj); - - if (err && zfsvfs->z_version >= ZPL_VERSION_SA) - goto bail; + objset_t *os; + VERIFY0(dmu_objset_hold(osname, zfsvfs, &os)); + VERIFY3P(os->os_dsl_dataset->ds_owner, ==, zfsvfs); + VERIFY(dsl_dataset_long_held(os->os_dsl_dataset)); + dmu_objset_rele(os, zfsvfs); - if ((err = sa_setup(zfsvfs->z_os, sa_obj, - zfs_attr_table, ZPL_END, &zfsvfs->z_attr_table)) != 0) + err = zfsvfs_init(zfsvfs, os); + if (err != 0) goto bail; - if (zfsvfs->z_version >= ZPL_VERSION_SA) - sa_register_update_callback(zfsvfs->z_os, - zfs_sa_upgrade); - VERIFY(zfsvfs_setup(zfsvfs, B_FALSE) == 0); zfs_set_fuid_feature(zfsvfs); From owner-svn-src-head@freebsd.org Thu Jul 14 11:42:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C332B99EA8; Thu, 14 Jul 2016 11:42:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA3521485; Thu, 14 Jul 2016 11:42:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBgseL080139; Thu, 14 Jul 2016 11:42:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBgs4c080137; Thu, 14 Jul 2016 11:42:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141142.u6EBgs4c080137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302837 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:42:55 -0000 Author: avg Date: Thu Jul 14 11:42:53 2016 New Revision: 302837 URL: https://svnweb.freebsd.org/changeset/base/302837 Log: MFV r302641: 6844 dnode_next_offset can detect fictional holes illumos/illumos-gate@11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3 https://github.com/illumos/illumos-gate/commit/11ceac77ea8034bf2fe9bdd6d314f5d1e5ceeba3 https://www.illumos.org/issues/6844 dnode_next_offset is used in a variety of places to iterate over the holes or allocated blocks in a dnode. It operates under the premise that it can iterate over the blockpointers of a dnode in open context while holding only the dn_struct_rwlock as reader. Unfortunately, this premise does not hold. When we create the zio for a dbuf, we pass in the actual block pointer in the indirect block above that dbuf. When we later zero the bp in zio_write_compress, we are directly modifying the bp. The state of the bp is now inconsistent from the perspective of dnode_next_offset: the bp will appear to be a hole until zio_dva_allocate finally finishes filling it in. In the meantime, dnode_next_offset can detect a hole in the dnode when none exists. I was able to experimentally demonstrate this behavior with the following setup: 1. Create a file with 1 million dbufs. 2. Create a thread that randomly dirties L2 blocks by writing to the first L0 block under them. 3. Observe dnode_next_offset, waiting for it to skip over a hole in the middle of a file. 4. Do dnode_next_offset in a loop until we skip over such a non-existent hole. The fix is to ensure that it is valid to iterate over the indirect blocks in a dnode while holding the dn_struct_rwlock by passing the zio a copy of the BP and updating the actual BP in dbuf_write_ready while holding the lock. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Boris Protopopov Approved by: Dan McDonald Author: Alex Reece MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:39:36 2016 (r302836) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:42:53 2016 (r302837) @@ -2883,7 +2883,8 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * uint64_t fill = 0; int i; - ASSERT3P(db->db_blkptr, ==, bp); + ASSERT3P(db->db_blkptr, !=, NULL); + ASSERT3P(&db->db_data_pending->dr_bp_copy, ==, bp); DB_DNODE_ENTER(db); dn = DB_DNODE(db); @@ -2905,7 +2906,7 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * #ifdef ZFS_DEBUG if (db->db_blkid == DMU_SPILL_BLKID) { ASSERT(dn->dn_phys->dn_flags & DNODE_FLAG_SPILL_BLKPTR); - ASSERT(!(BP_IS_HOLE(db->db_blkptr)) && + ASSERT(!(BP_IS_HOLE(bp)) && db->db_blkptr == &dn->dn_phys->dn_spill); } #endif @@ -2946,6 +2947,10 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * bp->blk_fill = fill; mutex_exit(&db->db_mtx); + + rw_enter(&dn->dn_struct_rwlock, RW_WRITER); + *db->db_blkptr = *bp; + rw_exit(&dn->dn_struct_rwlock); } /* @@ -3124,6 +3129,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ zio_t *zio; int wp_flag = 0; + ASSERT(dmu_tx_is_syncing(tx)); + DB_DNODE_ENTER(db); dn = DB_DNODE(db); os = dn->dn_objset; @@ -3182,6 +3189,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ dmu_write_policy(os, dn, db->db_level, wp_flag, &zp); DB_DNODE_EXIT(db); + /* + * We copy the blkptr now (rather than when we instantiate the dirty + * record), because its value can change between open context and + * syncing context. We do not need to hold dn_struct_rwlock to read + * db_blkptr because we are in syncing context. + */ + dr->dr_bp_copy = *db->db_blkptr; + if (db->db_level == 0 && dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { /* @@ -3191,7 +3206,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ void *contents = (data != NULL) ? data->b_data : NULL; dr->dr_zio = zio_write(zio, os->os_spa, txg, - db->db_blkptr, contents, db->db.db_size, &zp, + &dr->dr_bp_copy, contents, db->db.db_size, &zp, dbuf_write_override_ready, NULL, dbuf_write_override_done, dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); mutex_enter(&db->db_mtx); @@ -3203,14 +3218,14 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF || zp.zp_checksum == ZIO_CHECKSUM_NOPARITY); dr->dr_zio = zio_write(zio, os->os_spa, txg, - db->db_blkptr, NULL, db->db.db_size, &zp, + &dr->dr_bp_copy, NULL, db->db.db_size, &zp, dbuf_write_nofill_ready, NULL, dbuf_write_nofill_done, db, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED | ZIO_FLAG_NODATA, &zb); } else { ASSERT(arc_released(data)); dr->dr_zio = arc_write(zio, os->os_spa, txg, - db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), + &dr->dr_bp_copy, data, DBUF_IS_L2CACHEABLE(db), DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, dbuf_write_physdone, dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jul 14 11:39:36 2016 (r302836) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jul 14 11:42:53 2016 (r302837) @@ -121,6 +121,9 @@ typedef struct dbuf_dirty_record { /* How much space was changed to dsl_pool_dirty_space() for this? */ unsigned int dr_accounted; + /* A copy of the bp that points to us */ + blkptr_t dr_bp_copy; + union dirty_types { struct dirty_indirect { From owner-svn-src-head@freebsd.org Thu Jul 14 11:48:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F25B99FD4; Thu, 14 Jul 2016 11:48:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89E6E16C5; Thu, 14 Jul 2016 11:48:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBmhxC080400; Thu, 14 Jul 2016 11:48:43 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBmhCk080392; Thu, 14 Jul 2016 11:48:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141148.u6EBmhCk080392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302838 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:48:44 -0000 Author: avg Date: Thu Jul 14 11:48:42 2016 New Revision: 302838 URL: https://svnweb.freebsd.org/changeset/base/302838 Log: MFV r302644: 6513 partially filled holes lose birth time illumos/illumos-gate@8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc https://github.com/illumos/illumos-gate/commit/8df0bcf0df7622a075cc6e52f659d2fcfdd08cdc https://www.illumos.org/issues/6513 If a ZFS object contains a hole at level one, and then a data block is created at level 0 underneath that l1 block, l0 holes will be created. However, these l0 holes do not have the birth time property set; as a result, incremental sends will not send those holes. Fix is to modify the dbuf_read code to fill in birth time data. Reviewed by: Matthew Ahrens Reviewed by: George Wilson Reviewed by: Boris Protopopov Approved by: Richard Lowe Author: Paul Dagnelie MFC after: 3 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jul 14 11:48:42 2016 (r302838) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 by Saso Kiselkov. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. */ @@ -784,6 +784,7 @@ typedef struct arc_write_callback arc_wr struct arc_write_callback { void *awcb_private; arc_done_func_t *awcb_ready; + arc_done_func_t *awcb_children_ready; arc_done_func_t *awcb_physdone; arc_done_func_t *awcb_done; arc_buf_t *awcb_buf; @@ -5106,6 +5107,15 @@ arc_write_ready(zio_t *zio) hdr->b_flags |= ARC_FLAG_IO_IN_PROGRESS; } +static void +arc_write_children_ready(zio_t *zio) +{ + arc_write_callback_t *callback = zio->io_private; + arc_buf_t *buf = callback->awcb_buf; + + callback->awcb_children_ready(zio, buf, callback->awcb_private); +} + /* * The SPA calls this callback for each physical write that happens on behalf * of a logical write. See the comment in dbuf_write_physdone() for details. @@ -5202,7 +5212,8 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, - const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, + const zio_prop_t *zp, arc_done_func_t *ready, + arc_done_func_t *children_ready, arc_done_func_t *physdone, arc_done_func_t *done, void *private, zio_priority_t priority, int zio_flags, const zbookmark_phys_t *zb) { @@ -5222,13 +5233,16 @@ arc_write(zio_t *pio, spa_t *spa, uint64 hdr->b_flags |= ARC_FLAG_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; + callback->awcb_children_ready = children_ready; callback->awcb_physdone = physdone; callback->awcb_done = done; callback->awcb_private = private; callback->awcb_buf = buf; zio = zio_write(pio, spa, txg, bp, buf->b_data, hdr->b_size, zp, - arc_write_ready, arc_write_physdone, arc_write_done, callback, + arc_write_ready, + (children_ready != NULL) ? arc_write_children_ready : NULL, + arc_write_physdone, arc_write_done, callback, priority, zio_flags, zb); return (zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jul 14 11:48:42 2016 (r302838) @@ -486,13 +486,49 @@ dbuf_verify(dmu_buf_impl_t *db) * If the blkptr isn't set but they have nonzero data, * it had better be dirty, otherwise we'll lose that * data when we evict this buffer. + * + * There is an exception to this rule for indirect blocks; in + * this case, if the indirect block is a hole, we fill in a few + * fields on each of the child blocks (importantly, birth time) + * to prevent hole birth times from being lost when you + * partially fill in a hole. */ if (db->db_dirtycnt == 0) { - uint64_t *buf = db->db.db_data; - int i; + if (db->db_level == 0) { + uint64_t *buf = db->db.db_data; + int i; - for (i = 0; i < db->db.db_size >> 3; i++) { - ASSERT(buf[i] == 0); + for (i = 0; i < db->db.db_size >> 3; i++) { + ASSERT(buf[i] == 0); + } + } else { + blkptr_t *bps = db->db.db_data; + ASSERT3U(1 << DB_DNODE(db)->dn_indblkshift, ==, + db->db.db_size); + /* + * We want to verify that all the blkptrs in the + * indirect block are holes, but we may have + * automatically set up a few fields for them. + * We iterate through each blkptr and verify + * they only have those fields set. + */ + for (int i = 0; + i < db->db.db_size / sizeof (blkptr_t); + i++) { + blkptr_t *bp = &bps[i]; + ASSERT(ZIO_CHECKSUM_IS_ZERO( + &bp->blk_cksum)); + ASSERT( + DVA_IS_EMPTY(&bp->blk_dva[0]) && + DVA_IS_EMPTY(&bp->blk_dva[1]) && + DVA_IS_EMPTY(&bp->blk_dva[2])); + ASSERT0(bp->blk_fill); + ASSERT0(bp->blk_pad[0]); + ASSERT0(bp->blk_pad[1]); + ASSERT(!BP_IS_EMBEDDED(bp)); + ASSERT(BP_IS_HOLE(bp)); + ASSERT0(bp->blk_phys_birth); + } } } } @@ -660,10 +696,31 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t BP_IS_HOLE(db->db_blkptr)))) { arc_buf_contents_t type = DBUF_GET_BUFC_TYPE(db); - DB_DNODE_EXIT(db); dbuf_set_data(db, arc_buf_alloc(db->db_objset->os_spa, db->db.db_size, db, type)); bzero(db->db.db_data, db->db.db_size); + + if (db->db_blkptr != NULL && db->db_level > 0 && + BP_IS_HOLE(db->db_blkptr) && + db->db_blkptr->blk_birth != 0) { + blkptr_t *bps = db->db.db_data; + for (int i = 0; i < ((1 << + DB_DNODE(db)->dn_indblkshift) / sizeof (blkptr_t)); + i++) { + blkptr_t *bp = &bps[i]; + ASSERT3U(BP_GET_LSIZE(db->db_blkptr), ==, + 1 << dn->dn_indblkshift); + BP_SET_LSIZE(bp, + BP_GET_LEVEL(db->db_blkptr) == 1 ? + dn->dn_datablksz : + BP_GET_LSIZE(db->db_blkptr)); + BP_SET_TYPE(bp, BP_GET_TYPE(db->db_blkptr)); + BP_SET_LEVEL(bp, + BP_GET_LEVEL(db->db_blkptr) - 1); + BP_SET_BIRTH(bp, db->db_blkptr->blk_birth, 0); + } + } + DB_DNODE_EXIT(db); db->db_state = DB_CACHED; mutex_exit(&db->db_mtx); return; @@ -2953,6 +3010,45 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * rw_exit(&dn->dn_struct_rwlock); } +/* ARGSUSED */ +/* + * This function gets called just prior to running through the compression + * stage of the zio pipeline. If we're an indirect block comprised of only + * holes, then we want this indirect to be compressed away to a hole. In + * order to do that we must zero out any information about the holes that + * this indirect points to prior to before we try to compress it. + */ +static void +dbuf_write_children_ready(zio_t *zio, arc_buf_t *buf, void *vdb) +{ + dmu_buf_impl_t *db = vdb; + dnode_t *dn; + blkptr_t *bp; + uint64_t i; + int epbs; + + ASSERT3U(db->db_level, >, 0); + DB_DNODE_ENTER(db); + dn = DB_DNODE(db); + epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; + + /* Determine if all our children are holes */ + for (i = 0, bp = db->db.db_data; i < 1 << epbs; i++, bp++) { + if (!BP_IS_HOLE(bp)) + break; + } + + /* + * If all the children are holes, then zero them all out so that + * we may get compressed away. + */ + if (i == 1 << epbs) { + /* didn't find any non-holes */ + bzero(db->db.db_data, db->db.db_size); + } + DB_DNODE_EXIT(db); +} + /* * The SPA will call this callback several times for each zio - once * for every physical child i/o (zio->io_phys_children times). This @@ -3207,7 +3303,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ dr->dr_zio = zio_write(zio, os->os_spa, txg, &dr->dr_bp_copy, contents, db->db.db_size, &zp, - dbuf_write_override_ready, NULL, dbuf_write_override_done, + dbuf_write_override_ready, NULL, NULL, + dbuf_write_override_done, dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); mutex_enter(&db->db_mtx); dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; @@ -3219,14 +3316,26 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ zp.zp_checksum == ZIO_CHECKSUM_NOPARITY); dr->dr_zio = zio_write(zio, os->os_spa, txg, &dr->dr_bp_copy, NULL, db->db.db_size, &zp, - dbuf_write_nofill_ready, NULL, dbuf_write_nofill_done, db, + dbuf_write_nofill_ready, NULL, NULL, + dbuf_write_nofill_done, db, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED | ZIO_FLAG_NODATA, &zb); } else { ASSERT(arc_released(data)); + + /* + * For indirect blocks, we want to setup the children + * ready callback so that we can properly handle an indirect + * block that only contains holes. + */ + arc_done_func_t *children_ready_cb = NULL; + if (db->db_level != 0) + children_ready_cb = dbuf_write_children_ready; + dr->dr_zio = arc_write(zio, os->os_spa, txg, &dr->dr_bp_copy, data, DBUF_IS_L2CACHEABLE(db), DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, + children_ready_cb, dbuf_write_physdone, dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jul 14 11:48:42 2016 (r302838) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. */ /* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Copyright (c) 2013, Joyent, Inc. All rights reserved. */ @@ -1607,10 +1607,11 @@ dmu_sync_late_arrival(zio_t *pio, objset dsa->dsa_zgd = zgd; dsa->dsa_tx = tx; - zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp, - zgd->zgd_db->db_data, zgd->zgd_db->db_size, zp, - dmu_sync_late_arrival_ready, NULL, dmu_sync_late_arrival_done, dsa, - ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, zb)); + zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), + zgd->zgd_bp, zgd->zgd_db->db_data, zgd->zgd_db->db_size, + zp, dmu_sync_late_arrival_ready, NULL, + NULL, dmu_sync_late_arrival_done, dsa, ZIO_PRIORITY_SYNC_WRITE, + ZIO_FLAG_CANFAIL, zb)); return (0); } @@ -1763,8 +1764,8 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s zio_nowait(arc_write(pio, os->os_spa, txg, bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, - NULL, dmu_sync_done, dsa, ZIO_PRIORITY_SYNC_WRITE, - ZIO_FLAG_CANFAIL, &zb)); + NULL, NULL, dmu_sync_done, dsa, + ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jul 14 11:48:42 2016 (r302838) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. @@ -1116,9 +1116,9 @@ dmu_objset_sync(objset_t *os, zio_t *pio zio = arc_write(pio, os->os_spa, tx->tx_txg, os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), - DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, - NULL, dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, - ZIO_FLAG_MUSTSUCCEED, &zb); + DMU_OS_IS_L2COMPRESSIBLE(os), + &zp, dmu_objset_write_ready, NULL, NULL, dmu_objset_write_done, + os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); /* * Sync special dnodes - the parent IO for the sync is the root block Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Thu Jul 14 11:48:42 2016 (r302838) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. */ @@ -60,20 +60,14 @@ dnode_increase_indirection(dnode_t *dn, dprintf("os=%p obj=%llu, increase to %d\n", dn->dn_objset, dn->dn_object, dn->dn_phys->dn_nlevels); - /* check for existing blkptrs in the dnode */ - for (i = 0; i < nblkptr; i++) - if (!BP_IS_HOLE(&dn->dn_phys->dn_blkptr[i])) - break; - if (i != nblkptr) { - /* transfer dnode's block pointers to new indirect block */ - (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED|DB_RF_HAVESTRUCT); - ASSERT(db->db.db_data); - ASSERT(arc_released(db->db_buf)); - ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size); - bcopy(dn->dn_phys->dn_blkptr, db->db.db_data, - sizeof (blkptr_t) * nblkptr); - arc_buf_freeze(db->db_buf); - } + /* transfer dnode's block pointers to new indirect block */ + (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED|DB_RF_HAVESTRUCT); + ASSERT(db->db.db_data); + ASSERT(arc_released(db->db_buf)); + ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size); + bcopy(dn->dn_phys->dn_blkptr, db->db.db_data, + sizeof (blkptr_t) * nblkptr); + arc_buf_freeze(db->db_buf); /* set dbuf's parent pointers to new indirect buf */ for (i = 0; i < nblkptr; i++) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Thu Jul 14 11:48:42 2016 (r302838) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -141,9 +141,11 @@ int arc_read(zio_t *pio, spa_t *spa, con arc_flags_t *arc_flags, const zbookmark_phys_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, - const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, - arc_done_func_t *done, void *priv, zio_priority_t priority, - int zio_flags, const zbookmark_phys_t *zb); + const zio_prop_t *zp, + arc_done_func_t *ready, arc_done_func_t *child_ready, + arc_done_func_t *physdone, arc_done_func_t *done, + void *priv, zio_priority_t priority, int zio_flags, + const zbookmark_phys_t *zb); void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jul 14 11:48:42 2016 (r302838) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -436,6 +436,7 @@ struct zio { /* Callback info */ zio_done_func_t *io_ready; + zio_done_func_t *io_children_ready; zio_done_func_t *io_physdone; zio_done_func_t *io_done; void *io_private; @@ -503,9 +504,10 @@ extern zio_t *zio_read(zio_t *pio, spa_t extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, const zio_prop_t *zp, - zio_done_func_t *ready, zio_done_func_t *physdone, zio_done_func_t *done, - void *priv, - zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); + zio_done_func_t *ready, zio_done_func_t *children_ready, + zio_done_func_t *physdone, zio_done_func_t *done, + void *priv, zio_priority_t priority, enum zio_flag flags, + const zbookmark_phys_t *zb); extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, zio_done_func_t *done, void *priv, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jul 14 11:42:53 2016 (r302837) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jul 14 11:48:42 2016 (r302838) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -766,9 +766,10 @@ zio_read(zio_t *pio, spa_t *spa, const b zio_t * zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, const zio_prop_t *zp, - zio_done_func_t *ready, zio_done_func_t *physdone, zio_done_func_t *done, - void *private, - zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb) + zio_done_func_t *ready, zio_done_func_t *children_ready, + zio_done_func_t *physdone, zio_done_func_t *done, + void *private, zio_priority_t priority, enum zio_flag flags, + const zbookmark_phys_t *zb) { zio_t *zio; @@ -787,6 +788,7 @@ zio_write(zio_t *pio, spa_t *spa, uint64 ZIO_DDT_CHILD_WRITE_PIPELINE : ZIO_WRITE_PIPELINE); zio->io_ready = ready; + zio->io_children_ready = children_ready; zio->io_physdone = physdone; zio->io_prop = *zp; @@ -1184,6 +1186,16 @@ zio_write_bp_init(zio_t *zio) if (!IO_IS_ALLOCATING(zio)) return (ZIO_PIPELINE_CONTINUE); + if (zio->io_children_ready != NULL) { + /* + * Now that all our children are ready, run the callback + * associated with this zio in case it wants to modify the + * data to be written. + */ + ASSERT3U(zp->zp_level, >, 0); + zio->io_children_ready(zio); + } + ASSERT(zio->io_child_type != ZIO_CHILD_DDT); if (zio->io_bp_override) { @@ -2113,9 +2125,9 @@ zio_write_gang_block(zio_t *pio) zio_nowait(zio_write(zio, spa, txg, &gbh->zg_blkptr[g], (char *)pio->io_data + (pio->io_size - resid), lsize, &zp, - zio_write_gang_member_ready, NULL, NULL, &gn->gn_child[g], - pio->io_priority, ZIO_GANG_CHILD_FLAGS(pio), - &pio->io_bookmark)); + zio_write_gang_member_ready, NULL, NULL, NULL, + &gn->gn_child[g], pio->io_priority, + ZIO_GANG_CHILD_FLAGS(pio), &pio->io_bookmark)); } /* @@ -2504,7 +2516,7 @@ zio_ddt_write(zio_t *zio) dio = zio_write(zio, spa, txg, bp, zio->io_orig_data, zio->io_orig_size, &czp, NULL, NULL, - zio_ddt_ditto_write_done, dde, zio->io_priority, + NULL, zio_ddt_ditto_write_done, dde, zio->io_priority, ZIO_DDT_CHILD_FLAGS(zio), &zio->io_bookmark); zio_push_transform(dio, zio->io_data, zio->io_size, 0, NULL); @@ -2525,7 +2537,8 @@ zio_ddt_write(zio_t *zio) ddt_phys_addref(ddp); } else { cio = zio_write(zio, spa, txg, bp, zio->io_orig_data, - zio->io_orig_size, zp, zio_ddt_child_write_ready, NULL, + zio->io_orig_size, zp, + zio_ddt_child_write_ready, NULL, NULL, zio_ddt_child_write_done, dde, zio->io_priority, ZIO_DDT_CHILD_FLAGS(zio), &zio->io_bookmark); From owner-svn-src-head@freebsd.org Thu Jul 14 11:51:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FC70B981CA; Thu, 14 Jul 2016 11:51:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2831518E1; Thu, 14 Jul 2016 11:51:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBp13t080557; Thu, 14 Jul 2016 11:51:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBp1FQ080556; Thu, 14 Jul 2016 11:51:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141151.u6EBp1FQ080556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302839 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:51:02 -0000 Author: avg Date: Thu Jul 14 11:51:01 2016 New Revision: 302839 URL: https://svnweb.freebsd.org/changeset/base/302839 Log: MFV r302650: 6940 Cannot unlink directories when over quota illumos/illumos-gate@99189164df06057fb968ca7be701bb1a0d5da8c9 https://github.com/illumos/illumos-gate/commit/99189164df06057fb968ca7be701bb1a0d5da8c9 https://www.illumos.org/issues/6940 Similar to #6334, but this time with empty directories: $ zfs create tank/quota $ zfs set quota=10M tank/quota $ zfs snapshot tank/quota@snap1 $ zfs set mountpoint=/mnt/tank/quota tank/quota $ mkdir /mnt/tank/quota/dir # create an empty directory $ mkfile 11M /mnt/tank/quota/11M /mnt/tank/quota/11M: initialized 9830400 of 11534336 bytes: Disc quota exceeded $ rmdir /mnt/tank/quota/dir # now unlink the empty directory rmdir: directory "/mnt/tank/quota/dir": Disc quota exceeded From user perspective, I would expect that ZFS is always able to remove files and directories even when the quota is exceeded. Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Simon Klinkert MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jul 14 11:48:42 2016 (r302838) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jul 14 11:51:01 2016 (r302839) @@ -2438,6 +2438,7 @@ top: dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); zfs_sa_upgrade_txholds(tx, zp); zfs_sa_upgrade_txholds(tx, dzp); + dmu_tx_mark_netfree(tx); error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT); if (error) { rw_exit(&zp->z_parent_lock); From owner-svn-src-head@freebsd.org Thu Jul 14 11:53:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26622B982C0; Thu, 14 Jul 2016 11:53:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED8A11C8D; Thu, 14 Jul 2016 11:53:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EBre6k083901; Thu, 14 Jul 2016 11:53:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EBreIF083900; Thu, 14 Jul 2016 11:53:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607141153.u6EBreIF083900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 14 Jul 2016 11:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302840 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 11:53:41 -0000 Author: avg Date: Thu Jul 14 11:53:39 2016 New Revision: 302840 URL: https://svnweb.freebsd.org/changeset/base/302840 Log: MFV r302645: 6878 Add scrub completion info to "zpool history" illumos/illumos-gate@1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100 https://github.com/illumos/illumos-gate/commit/1825bc56e5a1f7ef6f0dc3137f3b35f5850c1100 https://www.illumos.org/issues/6878 Summary of changes: * Replace generic "scan done" message with "scan aborted, restarting", "scan cancelled", or "scan done" * Log number of errors using spa_get_errlog_size * Refactor scan restarting check into static function Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Dan McDonald Author: Nav Ravindranath MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jul 14 11:51:01 2016 (r302839) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jul 14 11:53:39 2016 (r302840) @@ -56,7 +56,8 @@ typedef int (scan_cb_t)(dsl_pool_t *, co static scan_cb_t dsl_scan_scrub_cb; static void dsl_scan_cancel_sync(void *, dmu_tx_t *); -static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx); +static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *); +static boolean_t dsl_scan_restarting(dsl_scan_t *, dmu_tx_t *); unsigned int zfs_top_maxinflight = 32; /* maximum I/Os per top-level */ unsigned int zfs_resilver_delay = 2; /* number of ticks to delay resilver */ @@ -320,8 +321,15 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t else scn->scn_phys.scn_state = DSS_CANCELED; - spa_history_log_internal(spa, "scan done", tx, - "complete=%u", complete); + if (dsl_scan_restarting(scn, tx)) + spa_history_log_internal(spa, "scan aborted, restarting", tx, + "errors=%llu", spa_get_errlog_size(spa)); + else if (!complete) + spa_history_log_internal(spa, "scan cancelled", tx, + "errors=%llu", spa_get_errlog_size(spa)); + else + spa_history_log_internal(spa, "scan done", tx, + "errors=%llu", spa_get_errlog_size(spa)); if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) { mutex_enter(&spa->spa_scrub_lock); @@ -1476,8 +1484,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * * that we can restart an old-style scan while the pool is being * imported (see dsl_scan_init). */ - if (scn->scn_restart_txg != 0 && - scn->scn_restart_txg <= tx->tx_txg) { + if (dsl_scan_restarting(scn, tx)) { pool_scan_func_t func = POOL_SCAN_SCRUB; dsl_scan_done(scn, B_FALSE, tx); if (vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) @@ -1904,3 +1911,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_ return (dsl_sync_task(spa_name(spa), dsl_scan_setup_check, dsl_scan_setup_sync, &func, 0, ZFS_SPACE_CHECK_NONE)); } + +static boolean_t +dsl_scan_restarting(dsl_scan_t *scn, dmu_tx_t *tx) +{ + return (scn->scn_restart_txg != 0 && + scn->scn_restart_txg <= tx->tx_txg); +} From owner-svn-src-head@freebsd.org Thu Jul 14 13:55:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 828DEB9920F; Thu, 14 Jul 2016 13:55:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 506441324; Thu, 14 Jul 2016 13:55:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EDtcbJ028694; Thu, 14 Jul 2016 13:55:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EDtcFr028693; Thu, 14 Jul 2016 13:55:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607141355.u6EDtcFr028693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 14 Jul 2016 13:55:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302841 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 13:55:39 -0000 Author: ngie Date: Thu Jul 14 13:55:38 2016 New Revision: 302841 URL: https://svnweb.freebsd.org/changeset/base/302841 Log: Always panic if an invalid capability is passed to `capable(..)` instead of just with INVARIANTS rwatson's point was valid in the sense that if the data passed at runtime is invalid, it should always trip the invariant, not just in the debug case. This is a deterrent against malicious input, or input caused by hardware errors. MFC after: 4 days X-MFC with: r302577 Requested by: rwatson Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/drm2/drm_os_freebsd.h Modified: head/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- head/sys/dev/drm2/drm_os_freebsd.h Thu Jul 14 11:53:39 2016 (r302840) +++ head/sys/dev/drm2/drm_os_freebsd.h Thu Jul 14 13:55:38 2016 (r302841) @@ -439,8 +439,7 @@ capable(enum __drm_capabilities cap) case CAP_SYS_ADMIN: return DRM_SUSER(curthread); default: - KASSERT(false, - ("%s: unhandled capability: %0x", __func__, cap)); + panic("%s: unhandled capability: %0x", __func__, cap); return (false); } } From owner-svn-src-head@freebsd.org Thu Jul 14 13:56:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D0CDB99256; Thu, 14 Jul 2016 13:56:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4833714D3; Thu, 14 Jul 2016 13:56:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x231.google.com with SMTP id pp5so22277457pac.3; Thu, 14 Jul 2016 06:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=lwBRv9zXXlHVVYjLcpXSlz4OnX+2+r5YaBgpGIW77xE=; b=RJUTg35Fup8JrmGp19mcHVPGyFW6PCRVWukuYlWiGK0iRciM9sHVyRD8q7DpSIdDXc 0IeI2yd8Om9wSLdkDn3AA+sUqsLWJuwBz7UX/XDG03AZk5dw12X3w2n55qsBXg2il+m6 NmjPehMdrPYyl3OZBW2uf4cfla1LRRdj/uJC76vJ1W2VFW2ndbMysvNyvsB3GqZ2kqbY 0pdGGJ6iVLk4Fn61G2h0COsIOXJprcML+Tgu7CCuvjLGkQnXFwoY1sylL+DagK+j3FOD ZEu+Ah8S8eVgkStgzYkBNVlIT2LYIqxvH7Ey5jC9hBjlHNHjMiYZ1xcmA4MGcRcuHx07 TonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=lwBRv9zXXlHVVYjLcpXSlz4OnX+2+r5YaBgpGIW77xE=; b=X15rpNuDOzzdc+xJa2L9Re6FuZxVjnLJ1qBffetMieJ1162Eu1XUiC1J9iYbLXxcYn mA1g6yawWwMF2MpPRCjPRNokukMPqJMDD4GtxEiCAIpbW+/j9+XyWHYACyLWVMYNna4U g7aA1gv7d3Qq3/EYiArs9kF5jaQ3nbXRVq5RYslPE5KEgRixW0P7wfeBZ3w9ntCnmoC0 Uc4jak1JL221QeG87pXyojT8vTaZV5ktF88G7+Xel+uBOLWS0NmVKk9sNmPJ9n/RSb88 kgGmz6ztc65MmMpjDBoP9ruio/i4YhtVrixSyXxiD3GOfT3jz1OTnqSWKh24TqmH87mT YpFw== X-Gm-Message-State: ALyK8tJI3rO+CFGE37pMY69TNxNqBeLANaDsJR2JrwiL9LRYbXMdR/Fs8RS1ZWzVdx9ZZA== X-Received: by 10.66.126.178 with SMTP id mz18mr23079181pab.15.1468504560523; Thu, 14 Jul 2016 06:56:00 -0700 (PDT) Received: from [192.168.20.9] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id xs12sm5198826pac.7.2016.07.14.06.55.59 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jul 2016 06:55:59 -0700 (PDT) Subject: Re: svn commit: r302577 - head/sys/dev/drm2 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_A5308244-9F74-4BCE-8078-D3DCDB3D56F1"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Thu, 14 Jul 2016 06:55:58 -0700 Cc: Garrett Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: <095A682C-C8C0-4BAF-947C-A74A250EB2F6@gmail.com> References: <201607111701.u6BH189R083052@repo.freebsd.org> To: Robert Watson X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 13:56:01 -0000 --Apple-Mail=_A5308244-9F74-4BCE-8078-D3DCDB3D56F1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jul 13, 2016, at 16:56, Ngie Cooper wrote: >=20 > On Wed, Jul 13, 2016 at 4:54 AM, Robert Watson = wrote: >> On Mon, 11 Jul 2016, Garrett Cooper wrote: >>=20 >>> Add missing default case to capable(..) function definition >>>=20 >>> By definition (enum __drm_capabilities), cases other than = CAP_SYS_ADMIN >>> aren't possible. Add in a KASSERT safety belt and return false in >>> !INVARIANTS case if an invalid value is passed in, as it would be a >>> programmer error. >>>=20 >>> This fixes a -Wreturn-type error with gcc 5.3.0. >>>=20 >>> Differential Revision: https://reviews.freebsd.org/D7188 >>> MFC after: 1 week >>> Reported by: devel/amd64-gcc (5.3.0) >>> Reviewed by: dumbbell >>> Sponsored by: EMC / Isilon Storage Division >>=20 >> Per my comment in the review, I think a panic() here would be = preferable to >> a KASSERT(), as it would come without perceptible runtime cost, and = failstop >> the system if we were violating a design-time security invariant. >=20 > Good point. I'll commit the change tonight. Fixed in r302841. Thanks! --Apple-Mail=_A5308244-9F74-4BCE-8078-D3DCDB3D56F1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXh5nuAAoJEPWDqSZpMIYVYSgP/12rl0/lQBR6m4+rWiOnAwTF ilYY7fsjP3t1BoHaEHbdfed1OeO7dLajLRxlMO1KHkjZVhPFi+Eu3P/JOG6hU5Qd vNCHEHva2g/EBAUXCLAG2jMW1fW5IUfKxn6sfTAyeFs/+WM/DwnQfdU4OaZ4r5VL PPkvBG+X1l634vm61640OtVBCldB+8nGXMuEvhPbJvMClpI0hVZHv/rZAlYXi3yG +XDxWlCJWsztERHZb5LaGezYlwaUOFSDIRXebq88EdwdYpOTRdR65UUX4ir6BL1G phzOadilojBgN/vkzvCnSHwsDRhlLhrU4PR0gUx9MCHi2rqXnoeYgYGuyv+iN6ZP PkDJ8F+C2smEVMdBK2SQASTKicX+vte5ruxBSQEnDumbnNad4/Y+/g0C5l7gxBmm en3GN4lAYGKDnvL5H0UpP7zgecElnHaMYCwtc0XsiW1r1a6yoBmsRNRyJhazUDia YvB5FdlySqFMSLGAh84+4AKTD8czfybZOKBQb4UdCxkgdToz/vMgiGRNn4DjF+H7 EWLLYgq6VeubMW6zGWtMU5cAW90PhscUAgrWIGftZyVKnsWj3kfk5Oc2qXGJqeUz XXShIrvv7V9Lu1EIk+382sqNamO9cPnuruLPz8m/ZyMiGTvytNlL/y7atZiimTUu W9yINceOT9W/yqkge2La =V5NS -----END PGP SIGNATURE----- --Apple-Mail=_A5308244-9F74-4BCE-8078-D3DCDB3D56F1-- From owner-svn-src-head@freebsd.org Thu Jul 14 14:16:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1AB4B997AA; Thu, 14 Jul 2016 14:16:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82BF31170; Thu, 14 Jul 2016 14:16:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EEGKi5036445; Thu, 14 Jul 2016 14:16:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EEGKVg036444; Thu, 14 Jul 2016 14:16:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607141416.u6EEGKVg036444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 14 Jul 2016 14:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302842 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 14:16:21 -0000 Author: ngie Date: Thu Jul 14 14:16:20 2016 New Revision: 302842 URL: https://svnweb.freebsd.org/changeset/base/302842 Log: Don't delete usr/share/local/kk_KZ.UTF-8 with "make delete-old" after r302329 kk_KZ.UTF-8 was originally removed in r290494, but restored as an alias to en_US.UTF-8 in r302329 MFC after: 1 week X-MFC with: r302329 PR: 211046 Reported by: dhw, O. Hartman Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Jul 14 13:55:38 2016 (r302841) +++ head/ObsoleteFiles.inc Thu Jul 14 14:16:20 2016 (r302842) @@ -460,13 +460,6 @@ OLD_FILES+=usr/share/locale/kk_KZ.PT154/ OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_NUMERIC OLD_FILES+=usr/share/locale/kk_KZ.PT154/LC_TIME OLD_DIRS+=usr/share/locale/kk_KZ.PT154/ -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_COLLATE -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_CTYPE -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MESSAGES -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_MONETARY -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_NUMERIC -OLD_FILES+=usr/share/locale/kk_KZ.UTF-8/LC_TIME -OLD_DIRS+=usr/share/locale/kk_KZ.UTF-8 OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_COLLATE OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_CTYPE OLD_FILES+=usr/share/locale/la_LN.ISO8859-1/LC_TIME From owner-svn-src-head@freebsd.org Thu Jul 14 14:35:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CF2AB99D0F; Thu, 14 Jul 2016 14:35:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF52F1D9E; Thu, 14 Jul 2016 14:35:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EEZQPU043697; Thu, 14 Jul 2016 14:35:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EEZQW0043695; Thu, 14 Jul 2016 14:35:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607141435.u6EEZQW0043695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 14 Jul 2016 14:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302843 - head/sys/amd64/vmm/io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 14:35:27 -0000 Author: mav Date: Thu Jul 14 14:35:25 2016 New Revision: 302843 URL: https://svnweb.freebsd.org/changeset/base/302843 Log: Increase number of I/O APIC pins from 24 to 32 to give PCI up to 16 IRQs. Move HPET to the top of the supported 0-31 range. Proposed by: jhb@, grehan@ Modified: head/sys/amd64/vmm/io/vhpet.c head/sys/amd64/vmm/io/vioapic.c Modified: head/sys/amd64/vmm/io/vhpet.c ============================================================================== --- head/sys/amd64/vmm/io/vhpet.c Thu Jul 14 14:16:20 2016 (r302842) +++ head/sys/amd64/vmm/io/vhpet.c Thu Jul 14 14:35:25 2016 (r302843) @@ -715,8 +715,10 @@ vhpet_init(struct vm *vm) vhpet->freq_sbt = bttosbt(bt); pincount = vioapic_pincount(vm); - if (pincount >= 24) - allowed_irqs = 0x00f00000; /* irqs 20, 21, 22 and 23 */ + if (pincount >= 32) + allowed_irqs = 0xff000000; /* irqs 24-31 */ + else if (pincount >= 20) + allowed_irqs = 0xf << (pincount - 4); /* 4 upper irqs */ else allowed_irqs = 0; Modified: head/sys/amd64/vmm/io/vioapic.c ============================================================================== --- head/sys/amd64/vmm/io/vioapic.c Thu Jul 14 14:16:20 2016 (r302842) +++ head/sys/amd64/vmm/io/vioapic.c Thu Jul 14 14:35:25 2016 (r302843) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #define IOREGSEL 0x00 #define IOWIN 0x10 -#define REDIR_ENTRIES 24 +#define REDIR_ENTRIES 32 #define RTBL_RO_BITS ((uint64_t)(IOART_REM_IRR | IOART_DELIVS)) struct vioapic { From owner-svn-src-head@freebsd.org Thu Jul 14 15:09:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B676B97531; Thu, 14 Jul 2016 15:09:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E914411C3; Thu, 14 Jul 2016 15:09:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EF99p6054798; Thu, 14 Jul 2016 15:09:09 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EF99K6054797; Thu, 14 Jul 2016 15:09:09 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607141509.u6EF99K6054797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 14 Jul 2016 15:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302845 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 15:09:10 -0000 Author: pfg Date: Thu Jul 14 15:09:08 2016 New Revision: 302845 URL: https://svnweb.freebsd.org/changeset/base/302845 Log: mail(1): check for out of memory conditions when calling calloc(3). X-MFC with: r302771 Modified: head/usr.bin/mail/vars.c Modified: head/usr.bin/mail/vars.c ============================================================================== --- head/usr.bin/mail/vars.c Thu Jul 14 14:48:40 2016 (r302844) +++ head/usr.bin/mail/vars.c Thu Jul 14 15:09:08 2016 (r302845) @@ -56,7 +56,8 @@ assign(const char *name, const char *val h = hash(name); vp = lookup(name); if (vp == NULL) { - vp = calloc(1, sizeof(*vp)); + if ((vp = calloc(1, sizeof(*vp))) == NULL) + err(1, "Out of memory"); vp->v_name = vcopy(name); vp->v_link = variables[h]; variables[h] = vp; From owner-svn-src-head@freebsd.org Thu Jul 14 16:52:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7171BB999C2; Thu, 14 Jul 2016 16:52:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C0A71FB2; Thu, 14 Jul 2016 16:52:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EGqIlB096277; Thu, 14 Jul 2016 16:52:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EGqIBM096276; Thu, 14 Jul 2016 16:52:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141652.u6EGqIBM096276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 16:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302847 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 16:52:19 -0000 Author: andrew Date: Thu Jul 14 16:52:18 2016 New Revision: 302847 URL: https://svnweb.freebsd.org/changeset/base/302847 Log: Remove support for the arm64 pre-INTRNG interrupt framework from the PCI driver. Support for this was removed in r302375. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Thu Jul 14 15:39:31 2016 (r302846) +++ head/sys/dev/pci/pci_host_generic.c Thu Jul 14 16:52:18 2016 (r302847) @@ -724,8 +724,6 @@ generic_pcie_alloc_msi(device_t pci, dev NULL); return (intr_alloc_msi(pci, child, msi_parent, count, maxcount, irqs)); -#elif defined(__aarch64__) - return (arm_alloc_msi(pci, child, count, maxcount, irqs)); #else return (ENXIO); #endif @@ -740,8 +738,6 @@ generic_pcie_release_msi(device_t pci, d ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, NULL); return (intr_release_msi(pci, child, msi_parent, count, irqs)); -#elif defined(__aarch64__) - return (arm_release_msi(pci, child, count, irqs)); #else return (ENXIO); #endif @@ -757,8 +753,6 @@ generic_pcie_map_msi(device_t pci, devic ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, NULL); return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); -#elif defined(__aarch64__) - return (arm_map_msi(pci, child, irq, addr, data)); #else return (ENXIO); #endif @@ -773,8 +767,6 @@ generic_pcie_alloc_msix(device_t pci, de ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, NULL); return (intr_alloc_msix(pci, child, msi_parent, irq)); -#elif defined(__aarch64__) - return (arm_alloc_msix(pci, child, irq)); #else return (ENXIO); #endif @@ -789,8 +781,6 @@ generic_pcie_release_msix(device_t pci, ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, NULL); return (intr_release_msix(pci, child, msi_parent, irq)); -#elif defined(__aarch64__) - return (arm_release_msix(pci, child, irq)); #else return (ENXIO); #endif From owner-svn-src-head@freebsd.org Thu Jul 14 17:05:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9C97B99E48; Thu, 14 Jul 2016 17:05:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8164F1B8B; Thu, 14 Jul 2016 17:05:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EH5Pu0000443; Thu, 14 Jul 2016 17:05:25 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EH5P20000440; Thu, 14 Jul 2016 17:05:25 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141705.u6EH5P20000440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 17:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302848 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:05:26 -0000 Author: andrew Date: Thu Jul 14 17:05:25 2016 New Revision: 302848 URL: https://svnweb.freebsd.org/changeset/base/302848 Log: Remove the non-INTRNG support from the GICv3 interrupt controller driver. This is no longer needed. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_fdt.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Thu Jul 14 16:52:18 2016 (r302847) +++ head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:05:25 2016 (r302848) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); static bus_read_ivar_t gic_v3_read_ivar; -#ifdef INTRNG static pic_disable_intr_t gic_v3_disable_intr; static pic_enable_intr_t gic_v3_enable_intr; static pic_map_intr_t gic_v3_map_intr; @@ -90,18 +89,6 @@ static u_int gic_irq_cpu; static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; static u_int sgi_first_unused = GIC_FIRST_SGI; #endif -#else -/* Device and PIC methods */ -static int gic_v3_bind(device_t, u_int, u_int); -static void gic_v3_dispatch(device_t, struct trapframe *); -static void gic_v3_eoi(device_t, u_int); -static void gic_v3_mask_irq(device_t, u_int); -static void gic_v3_unmask_irq(device_t, u_int); -#ifdef SMP -static void gic_v3_init_secondary(device_t); -static void gic_v3_ipi_send(device_t, cpuset_t, u_int); -#endif -#endif static device_method_t gic_v3_methods[] = { /* Device interface */ @@ -110,7 +97,6 @@ static device_method_t gic_v3_methods[] /* Bus interface */ DEVMETHOD(bus_read_ivar, gic_v3_read_ivar), -#ifdef INTRNG /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, gic_v3_disable_intr), DEVMETHOD(pic_enable_intr, gic_v3_enable_intr), @@ -126,18 +112,6 @@ static device_method_t gic_v3_methods[] DEVMETHOD(pic_ipi_send, gic_v3_ipi_send), DEVMETHOD(pic_ipi_setup, gic_v3_ipi_setup), #endif -#else - /* PIC interface */ - DEVMETHOD(pic_bind, gic_v3_bind), - DEVMETHOD(pic_dispatch, gic_v3_dispatch), - DEVMETHOD(pic_eoi, gic_v3_eoi), - DEVMETHOD(pic_mask, gic_v3_mask_irq), - DEVMETHOD(pic_unmask, gic_v3_unmask_irq), -#ifdef SMP - DEVMETHOD(pic_init_secondary, gic_v3_init_secondary), - DEVMETHOD(pic_ipi_send, gic_v3_ipi_send), -#endif -#endif /* End */ DEVMETHOD_END @@ -188,7 +162,6 @@ static gic_v3_initseq_t gic_v3_secondary }; #endif -#ifdef INTRNG uint32_t gic_r_read_4(device_t dev, bus_size_t offset) { @@ -224,7 +197,6 @@ gic_r_write_8(device_t dev, bus_size_t o sc = device_get_softc(dev); bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); } -#endif /* * Device interface. @@ -238,10 +210,8 @@ gic_v3_attach(device_t dev) int rid; int err; size_t i; -#ifdef INTRNG u_int irq; const char *name; -#endif sc = device_get_softc(dev); sc->gic_registered = FALSE; @@ -290,7 +260,6 @@ gic_v3_attach(device_t dev) if (sc->gic_nirqs > GIC_I_NUM_MAX) sc->gic_nirqs = GIC_I_NUM_MAX; -#ifdef INTRNG sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs, M_GIC_V3, M_WAITOK | M_ZERO); name = device_get_nameunit(dev); @@ -318,7 +287,6 @@ gic_v3_attach(device_t dev) return (err); } } -#endif /* Get the number of supported interrupt identifier bits */ sc->gic_idbits = GICD_TYPER_IDBITS(typer); @@ -334,14 +302,6 @@ gic_v3_attach(device_t dev) if (err != 0) return (err); } - /* - * Full success. - * Now register PIC to the interrupts handling layer. - */ -#ifndef INTRNG - arm_register_root_pic(dev, sc->gic_nirqs); - sc->gic_registered = TRUE; -#endif return (0); } @@ -394,7 +354,6 @@ gic_v3_read_ivar(device_t dev, device_t return (ENOENT); } -#ifdef INTRNG int arm_gic_v3_intr(void *arg) { @@ -914,215 +873,6 @@ gic_v3_ipi_setup(device_t dev, u_int ipi return (0); } #endif /* SMP */ -#else /* INTRNG */ -/* - * PIC interface. - */ - -static int -gic_v3_bind(device_t dev, u_int irq, u_int cpuid) -{ - uint64_t aff; - struct gic_v3_softc *sc; - - sc = device_get_softc(dev); - - if (irq <= GIC_LAST_PPI) { - /* Can't bind PPI to another CPU but it's not an error */ - return (0); - } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) { - aff = CPU_AFFINITY(cpuid); - gic_d_write(sc, 4, GICD_IROUTER(irq), aff); - return (0); - } else if (irq >= GIC_FIRST_LPI) - return (lpi_migrate(dev, irq, cpuid)); - - return (EINVAL); -} - -static void -gic_v3_dispatch(device_t dev, struct trapframe *frame) -{ - uint64_t active_irq; - - while (1) { - if (CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) { - /* - * Hardware: Cavium ThunderX - * Chip revision: Pass 1.0 (early version) - * Pass 1.1 (production) - * ERRATUM: 22978, 23154 - */ - __asm __volatile( - "nop;nop;nop;nop;nop;nop;nop;nop; \n" - "mrs %0, ICC_IAR1_EL1 \n" - "nop;nop;nop;nop; \n" - "dsb sy \n" - : "=&r" (active_irq)); - } else { - active_irq = gic_icc_read(IAR1); - } - - if (__predict_false(active_irq == ICC_IAR1_EL1_SPUR)) - break; - - if (__predict_true((active_irq >= GIC_FIRST_PPI && - active_irq <= GIC_LAST_SPI) || active_irq >= GIC_FIRST_LPI)) { - arm_dispatch_intr(active_irq, frame); - continue; - } - - if (active_irq <= GIC_LAST_SGI) { - gic_icc_write(EOIR1, (uint64_t)active_irq); - arm_dispatch_intr(active_irq, frame); - continue; - } - } -} - -static void -gic_v3_eoi(device_t dev, u_int irq) -{ - - gic_icc_write(EOIR1, (uint64_t)irq); -} - -static void -gic_v3_mask_irq(device_t dev, u_int irq) -{ - struct gic_v3_softc *sc; - - sc = device_get_softc(dev); - - if (irq <= GIC_LAST_PPI) { /* SGIs and PPIs in corresponding Re-Distributor */ - gic_r_write(sc, 4, - GICR_SGI_BASE_SIZE + GICD_ICENABLER(irq), GICD_I_MASK(irq)); - gic_v3_wait_for_rwp(sc, REDIST); - } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) { /* SPIs in distributor */ - gic_r_write(sc, 4, GICD_ICENABLER(irq), GICD_I_MASK(irq)); - gic_v3_wait_for_rwp(sc, DIST); - } else if (irq >= GIC_FIRST_LPI) { /* LPIs */ - lpi_mask_irq(dev, irq); - } else - panic("%s: Unsupported IRQ number %u", __func__, irq); -} - -static void -gic_v3_unmask_irq(device_t dev, u_int irq) -{ - struct gic_v3_softc *sc; - - sc = device_get_softc(dev); - - if (irq <= GIC_LAST_PPI) { /* SGIs and PPIs in corresponding Re-Distributor */ - gic_r_write(sc, 4, - GICR_SGI_BASE_SIZE + GICD_ISENABLER(irq), GICD_I_MASK(irq)); - gic_v3_wait_for_rwp(sc, REDIST); - } else if (irq >= GIC_FIRST_SPI && irq <= GIC_LAST_SPI) { /* SPIs in distributor */ - gic_d_write(sc, 4, GICD_ISENABLER(irq), GICD_I_MASK(irq)); - gic_v3_wait_for_rwp(sc, DIST); - } else if (irq >= GIC_FIRST_LPI) { /* LPIs */ - lpi_unmask_irq(dev, irq); - } else - panic("%s: Unsupported IRQ number %u", __func__, irq); -} - -#ifdef SMP -static void -gic_v3_init_secondary(device_t dev) -{ - struct gic_v3_softc *sc; - gic_v3_initseq_t *init_func; - int err; - - sc = device_get_softc(dev); - - /* Train init sequence for boot CPU */ - for (init_func = gic_v3_secondary_init; *init_func != NULL; init_func++) { - err = (*init_func)(sc); - if (err != 0) { - device_printf(dev, - "Could not initialize GIC for CPU%u\n", - PCPU_GET(cpuid)); - return; - } - } - - /* - * Try to initialize ITS. - * If there is no driver attached this routine will fail but that - * does not mean failure here as only LPIs will not be functional - * on the current CPU. - */ - if (its_init_cpu(NULL) != 0) { - device_printf(dev, - "Could not initialize ITS for CPU%u. " - "No LPIs will arrive on this CPU\n", - PCPU_GET(cpuid)); - } - - /* - * ARM64TODO: Unmask timer PPIs. To be removed when appropriate - * mechanism is implemented. - * Activate the timer interrupts: virtual (27), secure (29), - * and non-secure (30). Use hardcoded values here as there - * should be no defines for them. - */ - gic_v3_unmask_irq(dev, 27); - gic_v3_unmask_irq(dev, 29); - gic_v3_unmask_irq(dev, 30); -} - -static void -gic_v3_ipi_send(device_t dev, cpuset_t cpuset, u_int ipi) -{ - u_int cpu; - uint64_t aff, tlist; - uint64_t val; - uint64_t aff_mask; - - /* Set affinity mask to match level 3, 2 and 1 */ - aff_mask = CPU_AFF1_MASK | CPU_AFF2_MASK | CPU_AFF3_MASK; - - /* Iterate through all CPUs in set */ - while (!CPU_EMPTY(&cpuset)) { - aff = tlist = 0; - for (cpu = 0; cpu < mp_ncpus; cpu++) { - /* Compose target list for single AFF3:AFF2:AFF1 set */ - if (CPU_ISSET(cpu, &cpuset)) { - if (!tlist) { - /* - * Save affinity of the first CPU to - * send IPI to for later comparison. - */ - aff = CPU_AFFINITY(cpu); - tlist |= (1UL << CPU_AFF0(aff)); - CPU_CLR(cpu, &cpuset); - } - /* Check for same Affinity level 3, 2 and 1 */ - if ((aff & aff_mask) == (CPU_AFFINITY(cpu) & aff_mask)) { - tlist |= (1UL << CPU_AFF0(CPU_AFFINITY(cpu))); - /* Clear CPU in cpuset from target list */ - CPU_CLR(cpu, &cpuset); - } - } - } - if (tlist) { - KASSERT((tlist & ~ICC_SGI1R_EL1_TL_MASK) == 0, - ("Target list too long for GICv3 IPI")); - /* Send SGI to CPUs in target list */ - val = tlist; - val |= (uint64_t)CPU_AFF3(aff) << ICC_SGI1R_EL1_AFF3_SHIFT; - val |= (uint64_t)CPU_AFF2(aff) << ICC_SGI1R_EL1_AFF2_SHIFT; - val |= (uint64_t)CPU_AFF1(aff) << ICC_SGI1R_EL1_AFF1_SHIFT; - val |= (uint64_t)(ipi & ICC_SGI1R_EL1_SGIID_MASK) << - ICC_SGI1R_EL1_SGIID_SHIFT; - gic_icc_write(SGI1R, val); - } - } -} -#endif -#endif /* !INTRNG */ /* * Helper routines Modified: head/sys/arm64/arm64/gic_v3_fdt.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_fdt.c Thu Jul 14 16:52:18 2016 (r302847) +++ head/sys/arm64/arm64/gic_v3_fdt.c Thu Jul 14 17:05:25 2016 (r302848) @@ -116,9 +116,7 @@ gic_v3_fdt_attach(device_t dev) { struct gic_v3_softc *sc; pcell_t redist_regions; -#ifdef INTRNG intptr_t xref; -#endif int err; sc = device_get_softc(dev); @@ -137,7 +135,6 @@ gic_v3_fdt_attach(device_t dev) if (err != 0) goto error; -#ifdef INTRNG xref = OF_xref_from_node(ofw_bus_get_node(dev)); sc->gic_pic = intr_pic_register(dev, xref); if (sc->gic_pic == NULL) { @@ -151,7 +148,6 @@ gic_v3_fdt_attach(device_t dev) err = ENXIO; goto error; } -#endif /* * Try to register ITS to this GIC. @@ -165,10 +161,8 @@ gic_v3_fdt_attach(device_t dev) } } -#ifdef INTRNG if (device_get_children(dev, &sc->gic_children, &sc->gic_nchildren) != 0) sc->gic_nchildren = 0; -#endif return (err); @@ -302,37 +296,3 @@ gic_v3_ofw_bus_attach(device_t dev) return (bus_generic_attach(dev)); } - -#ifndef INTRNG -static int gic_v3_its_fdt_probe(device_t dev); - -static device_method_t gic_v3_its_fdt_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, gic_v3_its_fdt_probe), - - /* End */ - DEVMETHOD_END -}; - -DEFINE_CLASS_1(its, gic_v3_its_fdt_driver, gic_v3_its_fdt_methods, - sizeof(struct gic_v3_its_softc), gic_v3_its_driver); - -static devclass_t gic_v3_its_fdt_devclass; - -EARLY_DRIVER_MODULE(its, gic, gic_v3_its_fdt_driver, - gic_v3_its_fdt_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); - -static int -gic_v3_its_fdt_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_is_compatible(dev, GIC_V3_ITS_COMPSTR)) - return (ENXIO); - - device_set_desc(dev, GIC_V3_ITS_DEVSTR); - return (BUS_PROBE_DEFAULT); -} -#endif Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 16:52:18 2016 (r302847) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:05:25 2016 (r302848) @@ -36,21 +36,12 @@ DECLARE_CLASS(gic_v3_driver); -#ifndef INTRNG -#define LPI_FLAGS_CONF_FLUSH (1UL << 0) -#define LPI_CONFTAB_SIZE PAGE_SIZE_64K -/* 1 bit per LPI + 1 KB more for the obligatory PPI, SGI, SPI stuff */ -#define LPI_PENDTAB_SIZE ((LPI_CONFTAB_SIZE / 8) + 0x400) -#endif - -#ifdef INTRNG struct gic_v3_irqsrc { struct intr_irqsrc gi_isrc; uint32_t gi_irq; enum intr_polarity gi_pol; enum intr_trigger gi_trig; }; -#endif struct redist_lpis { vm_offset_t conf_base; @@ -87,17 +78,13 @@ struct gic_v3_softc { boolean_t gic_registered; -#ifdef INTRNG int gic_nchildren; device_t *gic_children; struct intr_pic *gic_pic; struct gic_v3_irqsrc *gic_irqs; -#endif }; -#ifdef INTRNG #define GIC_INTR_ISRC(sc, irq) (&sc->gic_irqs[irq].gi_isrc) -#endif MALLOC_DECLARE(M_GIC_V3); @@ -115,12 +102,10 @@ int gic_v3_attach(device_t dev); int gic_v3_detach(device_t dev); int arm_gic_v3_intr(void *); -#ifdef INTRNG uint32_t gic_r_read_4(device_t, bus_size_t); uint64_t gic_r_read_8(device_t, bus_size_t); void gic_r_write_4(device_t, bus_size_t, uint32_t var); void gic_r_write_8(device_t, bus_size_t, uint64_t var); -#endif /* * ITS @@ -130,9 +115,6 @@ void gic_r_write_8(device_t, bus_size_t, struct lpi_chunk { u_int lpi_base; u_int lpi_free; /* First free LPI in set */ -#ifndef INTRNG - u_int *lpi_col_ids; -#endif u_int lpi_num; /* Total number of LPIs in chunk */ u_int lpi_busy; /* Number of busy LPIs in chink */ }; @@ -150,64 +132,6 @@ struct its_dev { vm_offset_t itt; size_t itt_size; }; -#ifndef INTRNG -TAILQ_HEAD(its_dev_list, its_dev); - -/* ITS private table description */ -struct its_ptab { - vm_offset_t ptab_vaddr; /* Virtual Address of table */ - size_t ptab_pgsz; /* Page size */ - size_t ptab_npages; /* Number of pages */ -}; - -/* ITS collection description. */ -struct its_col { - uint64_t col_target; /* Target Re-Distributor */ - uint64_t col_id; /* Collection ID */ -}; - -/* ITS command. Each command is 32 bytes long */ -struct its_cmd { - uint64_t cmd_dword[4]; /* ITS command double word */ -}; - -#define GIC_V3_ITS_DEVSTR "ARM GIC Interrupt Translation Service" -#define GIC_V3_ITS_COMPSTR "arm,gic-v3-its" - -DECLARE_CLASS(gic_v3_its_driver); - -/* ITS commands encoding */ -#define ITS_CMD_MOVI (0x01) -#define ITS_CMD_SYNC (0x05) -#define ITS_CMD_MAPD (0x08) -#define ITS_CMD_MAPC (0x09) -#define ITS_CMD_MAPVI (0x0a) -#define ITS_CMD_MAPI (0x0b) -#define ITS_CMD_INV (0x0c) -#define ITS_CMD_INVALL (0x0d) -/* Command */ -#define CMD_COMMAND_MASK (0xFFUL) -/* PCI device ID */ -#define CMD_DEVID_SHIFT (32) -#define CMD_DEVID_MASK (0xFFFFFFFFUL << CMD_DEVID_SHIFT) -/* Size of IRQ ID bitfield */ -#define CMD_SIZE_MASK (0xFFUL) -/* Virtual LPI ID */ -#define CMD_ID_MASK (0xFFFFFFFFUL) -/* Physical LPI ID */ -#define CMD_PID_SHIFT (32) -#define CMD_PID_MASK (0xFFFFFFFFUL << CMD_PID_SHIFT) -/* Collection */ -#define CMD_COL_MASK (0xFFFFUL) -/* Target (CPU or Re-Distributor) */ -#define CMD_TARGET_SHIFT (16) -#define CMD_TARGET_MASK (0xFFFFFFFFUL << CMD_TARGET_SHIFT) -/* Interrupt Translation Table address */ -#define CMD_ITT_MASK (0xFFFFFFFFFF00UL) -/* Valid command bit */ -#define CMD_VALID_SHIFT (63) -#define CMD_VALID_MASK (1UL << CMD_VALID_SHIFT) -#endif /* INTRNG */ /* * ITS command descriptor. @@ -264,61 +188,6 @@ struct its_cmd_desc { #define ITS_TARGET_NONE 0xFBADBEEF -#ifndef INTRNG -#define ITS_CMDQ_SIZE PAGE_SIZE_64K -#define ITS_CMDQ_NENTRIES (ITS_CMDQ_SIZE / sizeof(struct its_cmd)) - -#define ITS_FLAGS_CMDQ_FLUSH (1UL << 0) - -struct gic_v3_its_softc { - device_t dev; - struct resource * its_res; - - struct its_cmd * its_cmdq_base; /* ITS command queue base */ - struct its_cmd * its_cmdq_write; /* ITS command queue write ptr */ - struct its_ptab its_ptabs[GITS_BASER_NUM];/* ITS private tables */ - struct its_col * its_cols[MAXCPU];/* Per-CPU collections */ - - uint64_t its_flags; - -#ifndef INTRNG - struct its_dev_list its_dev_list; -#endif - - bitstr_t * its_lpi_bitmap; - uint32_t its_lpi_maxid; - - struct mtx its_dev_lock; - struct mtx its_cmd_lock; - - uint32_t its_socket; /* Socket number ITS is attached to */ -}; - -/* Stuff that is specific to the vendor's implementation */ -typedef uint32_t (*its_devbits_func_t)(device_t); - -struct its_quirks { - uint64_t cpuid; - uint64_t cpuid_mask; - its_devbits_func_t devbits_func; -}; - -extern devclass_t gic_v3_its_devclass; - -int gic_v3_its_detach(device_t); - -int gic_v3_its_alloc_msix(device_t, device_t, int *); -int gic_v3_its_release_msix(device_t, device_t, int); -int gic_v3_its_alloc_msi(device_t, device_t, int, int *); -int gic_v3_its_release_msi(device_t, device_t, int, int *); -int gic_v3_its_map_msi(device_t, device_t, int, uint64_t *, uint32_t *); - -int its_init_cpu(struct gic_v3_its_softc *); - -int lpi_migrate(device_t, uint32_t, u_int); -void lpi_unmask_irq(device_t, uint32_t); -void lpi_mask_irq(device_t, uint32_t); -#endif /* * GIC Distributor accessors. * Notice that only GIC sofc can be passed. From owner-svn-src-head@freebsd.org Thu Jul 14 17:10:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC3DDB99FF5; Thu, 14 Jul 2016 17:10:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEFF51EB1; Thu, 14 Jul 2016 17:10:55 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EHAs0Q003312; Thu, 14 Jul 2016 17:10:54 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EHAsfM003310; Thu, 14 Jul 2016 17:10:54 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141710.u6EHAsfM003310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 17:10:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302849 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:10:56 -0000 Author: andrew Date: Thu Jul 14 17:10:54 2016 New Revision: 302849 URL: https://svnweb.freebsd.org/changeset/base/302849 Log: Move structures only used by the GICv3 ITS driver from a shared header to the ITS driver file. There is no need for other drivers to need to know about these structures. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3_var.h head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:05:25 2016 (r302848) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:10:54 2016 (r302849) @@ -108,87 +108,6 @@ void gic_r_write_4(device_t, bus_size_t, void gic_r_write_8(device_t, bus_size_t, uint64_t var); /* - * ITS - */ - -/* LPI chunk owned by ITS device */ -struct lpi_chunk { - u_int lpi_base; - u_int lpi_free; /* First free LPI in set */ - u_int lpi_num; /* Total number of LPIs in chunk */ - u_int lpi_busy; /* Number of busy LPIs in chink */ -}; - -/* ITS device */ -struct its_dev { - TAILQ_ENTRY(its_dev) entry; - /* PCI device */ - device_t pci_dev; - /* Device ID (i.e. PCI device ID) */ - uint32_t devid; - /* List of assigned LPIs */ - struct lpi_chunk lpis; - /* Virtual address of ITT */ - vm_offset_t itt; - size_t itt_size; -}; - -/* - * ITS command descriptor. - * Idea for command description passing taken from Linux. - */ -struct its_cmd_desc { - uint8_t cmd_type; - - union { - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t id; - } cmd_desc_movi; - - struct { - struct its_col *col; - } cmd_desc_sync; - - struct { - struct its_col *col; - uint8_t valid; - } cmd_desc_mapc; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - uint32_t id; - } cmd_desc_mapvi; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - } cmd_desc_mapi; - - struct { - struct its_dev *its_dev; - uint8_t valid; - } cmd_desc_mapd; - - struct { - struct its_dev *its_dev; - struct its_col *col; - uint32_t pid; - } cmd_desc_inv; - - struct { - struct its_col *col; - } cmd_desc_invall; - }; -}; - -#define ITS_TARGET_NONE 0xFBADBEEF - -/* * GIC Distributor accessors. * Notice that only GIC sofc can be passed. */ Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Thu Jul 14 17:05:25 2016 (r302848) +++ head/sys/arm64/arm64/gicv3_its.c Thu Jul 14 17:10:54 2016 (r302849) @@ -123,6 +123,83 @@ MALLOC_DEFINE(M_GICV3_ITS, "GICv3 ITS", #define CMD_VALID_SHIFT (63) #define CMD_VALID_MASK (1UL << CMD_VALID_SHIFT) +#define ITS_TARGET_NONE 0xFBADBEEF + +/* LPI chunk owned by ITS device */ +struct lpi_chunk { + u_int lpi_base; + u_int lpi_free; /* First free LPI in set */ + u_int lpi_num; /* Total number of LPIs in chunk */ + u_int lpi_busy; /* Number of busy LPIs in chink */ +}; + +/* ITS device */ +struct its_dev { + TAILQ_ENTRY(its_dev) entry; + /* PCI device */ + device_t pci_dev; + /* Device ID (i.e. PCI device ID) */ + uint32_t devid; + /* List of assigned LPIs */ + struct lpi_chunk lpis; + /* Virtual address of ITT */ + vm_offset_t itt; + size_t itt_size; +}; + +/* + * ITS command descriptor. + * Idea for command description passing taken from Linux. + */ +struct its_cmd_desc { + uint8_t cmd_type; + + union { + struct { + struct its_dev *its_dev; + struct its_col *col; + uint32_t id; + } cmd_desc_movi; + + struct { + struct its_col *col; + } cmd_desc_sync; + + struct { + struct its_col *col; + uint8_t valid; + } cmd_desc_mapc; + + struct { + struct its_dev *its_dev; + struct its_col *col; + uint32_t pid; + uint32_t id; + } cmd_desc_mapvi; + + struct { + struct its_dev *its_dev; + struct its_col *col; + uint32_t pid; + } cmd_desc_mapi; + + struct { + struct its_dev *its_dev; + uint8_t valid; + } cmd_desc_mapd; + + struct { + struct its_dev *its_dev; + struct its_col *col; + uint32_t pid; + } cmd_desc_inv; + + struct { + struct its_col *col; + } cmd_desc_invall; + }; +}; + /* ITS command. Each command is 32 bytes long */ struct its_cmd { uint64_t cmd_dword[4]; /* ITS command double word */ From owner-svn-src-head@freebsd.org Thu Jul 14 17:16:12 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3389CB991B0; Thu, 14 Jul 2016 17:16:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDA12156C; Thu, 14 Jul 2016 17:16:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EHGBlp004125; Thu, 14 Jul 2016 17:16:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EHGAN0004120; Thu, 14 Jul 2016 17:16:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607141716.u6EHGAN0004120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 14 Jul 2016 17:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302850 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:16:12 -0000 Author: mav Date: Thu Jul 14 17:16:10 2016 New Revision: 302850 URL: https://svnweb.freebsd.org/changeset/base/302850 Log: Make PCI interupts allocation static when using bootrom (UEFI). This makes factual interrupt routing match one shipped with UEFI firmware. With old firmware this make legacy interrupts work reliable for functions 0 of PCI slots 3-6. Updated UEFI image fixes problem completely. Modified: head/usr.sbin/bhyve/ioapic.c head/usr.sbin/bhyve/ioapic.h head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_irq.c head/usr.sbin/bhyve/pci_irq.h Modified: head/usr.sbin/bhyve/ioapic.c ============================================================================== --- head/usr.sbin/bhyve/ioapic.c Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/ioapic.c Thu Jul 14 17:16:10 2016 (r302850) @@ -29,11 +29,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include "ioapic.h" +#include "pci_emul.h" +#include "pci_lpc.h" /* * Assign PCI INTx interrupts to I/O APIC pins in a round-robin @@ -64,11 +67,15 @@ ioapic_init(struct vmctx *ctx) } int -ioapic_pci_alloc_irq(void) +ioapic_pci_alloc_irq(struct pci_devinst *pi) { static int last_pin; if (pci_pins == 0) return (-1); + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + return (16 + (4 + pi->pi_slot + pi->pi_lintr.pin) % 8); + } return (16 + (last_pin++ % pci_pins)); } Modified: head/usr.sbin/bhyve/ioapic.h ============================================================================== --- head/usr.sbin/bhyve/ioapic.h Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/ioapic.h Thu Jul 14 17:16:10 2016 (r302850) @@ -30,10 +30,12 @@ #ifndef _IOAPIC_H_ #define _IOAPIC_H_ +struct pci_devinst; + /* * Allocate a PCI IRQ from the I/O APIC. */ void ioapic_init(struct vmctx *ctx); -int ioapic_pci_alloc_irq(void); +int ioapic_pci_alloc_irq(struct pci_devinst *pi); #endif Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_emul.c Thu Jul 14 17:16:10 2016 (r302850) @@ -1504,7 +1504,7 @@ pci_lintr_route(struct pci_devinst *pi) * is not yet assigned. */ if (ii->ii_ioapic_irq == 0) - ii->ii_ioapic_irq = ioapic_pci_alloc_irq(); + ii->ii_ioapic_irq = ioapic_pci_alloc_irq(pi); assert(ii->ii_ioapic_irq > 0); /* @@ -1512,7 +1512,7 @@ pci_lintr_route(struct pci_devinst *pi) * not yet assigned. */ if (ii->ii_pirq_pin == 0) - ii->ii_pirq_pin = pirq_alloc_pin(pi->pi_vmctx); + ii->ii_pirq_pin = pirq_alloc_pin(pi); assert(ii->ii_pirq_pin > 0); pi->pi_lintr.ioapic_irq = ii->ii_ioapic_irq; Modified: head/usr.sbin/bhyve/pci_irq.c ============================================================================== --- head/usr.sbin/bhyve/pci_irq.c Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_irq.c Thu Jul 14 17:16:10 2016 (r302850) @@ -193,19 +193,25 @@ pci_irq_deassert(struct pci_devinst *pi) } int -pirq_alloc_pin(struct vmctx *ctx) +pirq_alloc_pin(struct pci_devinst *pi) { + struct vmctx *ctx = pi->pi_vmctx; int best_count, best_irq, best_pin, irq, pin; pirq_cold = 0; - /* First, find the least-used PIRQ pin. */ - best_pin = 0; - best_count = pirqs[0].use_count; - for (pin = 1; pin < nitems(pirqs); pin++) { - if (pirqs[pin].use_count < best_count) { - best_pin = pin; - best_count = pirqs[pin].use_count; + if (lpc_bootrom()) { + /* For external bootrom use fixed mapping. */ + best_pin = (4 + pi->pi_slot + pi->pi_lintr.pin) % 8; + } else { + /* Find the least-used PIRQ pin. */ + best_pin = 0; + best_count = pirqs[0].use_count; + for (pin = 1; pin < nitems(pirqs); pin++) { + if (pirqs[pin].use_count < best_count) { + best_pin = pin; + best_count = pirqs[pin].use_count; + } } } pirqs[best_pin].use_count++; Modified: head/usr.sbin/bhyve/pci_irq.h ============================================================================== --- head/usr.sbin/bhyve/pci_irq.h Thu Jul 14 17:10:54 2016 (r302849) +++ head/usr.sbin/bhyve/pci_irq.h Thu Jul 14 17:16:10 2016 (r302850) @@ -37,7 +37,7 @@ void pci_irq_deassert(struct pci_devinst void pci_irq_init(struct vmctx *ctx); void pci_irq_reserve(int irq); void pci_irq_use(int irq); -int pirq_alloc_pin(struct vmctx *ctx); +int pirq_alloc_pin(struct pci_devinst *pi); int pirq_irq(int pin); uint8_t pirq_read(int pin); void pirq_write(struct vmctx *ctx, int pin, uint8_t val); From owner-svn-src-head@freebsd.org Thu Jul 14 17:16:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8892B99222; Thu, 14 Jul 2016 17:16:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81EDE16D7; Thu, 14 Jul 2016 17:16:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EHGpai004192; Thu, 14 Jul 2016 17:16:51 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EHGpBI004190; Thu, 14 Jul 2016 17:16:51 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141716.u6EHGpBI004190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 17:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302851 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:16:52 -0000 Author: andrew Date: Thu Jul 14 17:16:51 2016 New Revision: 302851 URL: https://svnweb.freebsd.org/changeset/base/302851 Log: Move gic_v3_irqsrc into the GICv3 driver source as it's only needed there. Remove unused macros from the GICv3 header. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:16:10 2016 (r302850) +++ head/sys/arm64/arm64/gic_v3.c Thu Jul 14 17:16:51 2016 (r302851) @@ -134,6 +134,13 @@ enum gic_v3_xdist { REDIST, }; +struct gic_v3_irqsrc { + struct intr_irqsrc gi_isrc; + uint32_t gi_irq; + enum intr_polarity gi_pol; + enum intr_trigger gi_trig; +}; + /* Helper routines starting with gic_v3_ */ static int gic_v3_dist_init(struct gic_v3_softc *); static int gic_v3_redist_alloc(struct gic_v3_softc *); Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:16:10 2016 (r302850) +++ head/sys/arm64/arm64/gic_v3_var.h Thu Jul 14 17:16:51 2016 (r302851) @@ -36,12 +36,7 @@ DECLARE_CLASS(gic_v3_driver); -struct gic_v3_irqsrc { - struct intr_irqsrc gi_isrc; - uint32_t gi_irq; - enum intr_polarity gi_pol; - enum intr_trigger gi_trig; -}; +struct gic_v3_irqsrc; struct redist_lpis { vm_offset_t conf_base; @@ -140,27 +135,4 @@ void gic_r_write_8(device_t, bus_size_t, reg, val); \ }) -#define PCI_DEVID_GENERIC(pci_dev) \ -({ \ - ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) | \ - (pci_get_bus(pci_dev) << PCI_RID_BUS_SHIFT) | \ - (pci_get_slot(pci_dev) << PCI_RID_SLOT_SHIFT) | \ - (pci_get_function(pci_dev) << PCI_RID_FUNC_SHIFT)); \ -}) - -/* - * Request number of maximum MSI-X vectors for this device. - * Device can ask for less vectors than maximum supported but not more. - */ -#define PCI_MSIX_NUM(pci_dev) \ -({ \ - struct pci_devinfo *dinfo; \ - pcicfgregs *cfg; \ - \ - dinfo = device_get_ivars(pci_dev); \ - cfg = &dinfo->cfg; \ - \ - cfg->msix.msix_msgnum; \ -}) - #endif /* _GIC_V3_VAR_H_ */ From owner-svn-src-head@freebsd.org Thu Jul 14 17:23:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53248B99424; Thu, 14 Jul 2016 17:23:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 177F11D9C; Thu, 14 Jul 2016 17:23:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EHNnIr007684; Thu, 14 Jul 2016 17:23:49 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EHNnHi007683; Thu, 14 Jul 2016 17:23:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141723.u6EHNnHi007683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 17:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302852 - head/sys/arm64/cavium X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:23:50 -0000 Author: andrew Date: Thu Jul 14 17:23:49 2016 New Revision: 302852 URL: https://svnweb.freebsd.org/changeset/base/302852 Log: Remove the non-INTRNG support from the ThunderX PCIe drivers. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c ============================================================================== --- head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Thu Jul 14 17:16:51 2016 (r302851) +++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Thu Jul 14 17:23:49 2016 (r302852) @@ -109,7 +109,6 @@ thunder_pem_fdt_probe(device_t dev) return (ENXIO); } -#ifdef INTRNG static int thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) @@ -162,44 +161,6 @@ thunder_pem_fdt_map_msi(device_t pci, de NULL); return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); } -#else -static int -thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, - int *irqs) -{ - - return (arm_alloc_msi(pci, child, count, maxcount, irqs)); -} - -static int -thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs) -{ - - return (arm_release_msi(pci, child, count, irqs)); -} - -static int -thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq) -{ - - return (arm_alloc_msix(pci, child, irq)); -} - -static int -thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq) -{ - - return (arm_release_msix(pci, child, irq)); -} - -static int -thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, - uint32_t *data) -{ - - return (arm_map_msi(pci, child, irq, addr, data)); -} -#endif static int thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type, From owner-svn-src-head@freebsd.org Thu Jul 14 17:31:30 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE974B99581; Thu, 14 Jul 2016 17:31:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A20D814FF; Thu, 14 Jul 2016 17:31:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EHVTLE011397; Thu, 14 Jul 2016 17:31:29 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EHVTZD011393; Thu, 14 Jul 2016 17:31:29 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607141731.u6EHVTZD011393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 14 Jul 2016 17:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302853 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 17:31:31 -0000 Author: andrew Date: Thu Jul 14 17:31:29 2016 New Revision: 302853 URL: https://svnweb.freebsd.org/changeset/base/302853 Log: Finish removing the non-INTRNG support from sys/arm64. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/autoconf.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/arm64/nexus.c head/sys/arm64/include/intr.h Modified: head/sys/arm64/arm64/autoconf.c ============================================================================== --- head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/autoconf.c Thu Jul 14 17:31:29 2016 (r302853) @@ -81,12 +81,8 @@ static void configure_final(void *dummy) { -#ifdef INTRNG /* Enable interrupt reception on this CPU */ intr_enable(); -#else - arm_enable_intr(); -#endif cninit_finish(); if (bootverbose) Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/mp_machdep.c Thu Jul 14 17:31:29 2016 (r302853) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef INTRNG #include "pic_if.h" typedef void intr_ipi_send_t(void *, cpuset_t, u_int); @@ -86,7 +85,6 @@ static struct intr_ipi ipi_sources[INTR_ static struct intr_ipi *intr_ipi_lookup(u_int); static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *, void *); -#endif /* INTRNG */ boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *); @@ -214,18 +212,12 @@ release_aps(void *dummy __unused) { int cpu, i; -#ifdef INTRNG intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL); intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL); intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL); intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL); intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL); intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL); -#else - /* Setup the IPI handler */ - for (i = 0; i < INTR_IPI_COUNT; i++) - arm_setup_ipihandler(ipi_handler, i); -#endif atomic_store_rel_int(&aps_ready, 1); /* Wake up the other CPUs */ @@ -253,9 +245,6 @@ void init_secondary(uint64_t cpu) { struct pcpu *pcpup; -#ifndef INTRNG - int i; -#endif pcpup = &__pcpu[cpu]; /* @@ -282,15 +271,7 @@ init_secondary(uint64_t cpu) */ identify_cpu(); -#ifdef INTRNG intr_pic_init_secondary(); -#else - /* Configure the interrupt controller */ - arm_init_secondary(); - - for (i = 0; i < INTR_IPI_COUNT; i++) - arm_unmask_ipi(i); -#endif /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -322,7 +303,6 @@ init_secondary(uint64_t cpu) /* NOTREACHED */ } -#ifdef INTRNG /* * Send IPI thru interrupt controller. */ @@ -378,7 +358,6 @@ intr_ipi_send(cpuset_t cpus, u_int ipi) ii->ii_send(ii->ii_send_arg, cpus, ipi); } -#endif static void ipi_ast(void *dummy __unused) @@ -432,44 +411,6 @@ ipi_stop(void *dummy __unused) CTR0(KTR_SMP, "IPI_STOP (restart)"); } -#ifndef INTRNG -static int -ipi_handler(void *arg) -{ - u_int cpu, ipi; - - arg = (void *)((uintptr_t)arg & ~(1 << 16)); - KASSERT((uintptr_t)arg < INTR_IPI_COUNT, - ("Invalid IPI %ju", (uintptr_t)arg)); - - cpu = PCPU_GET(cpuid); - ipi = (uintptr_t)arg; - - switch(ipi) { - case IPI_AST: - ipi_ast(NULL); - break; - case IPI_PREEMPT: - ipi_preempt(NULL); - break; - case IPI_RENDEZVOUS: - ipi_rendezvous(NULL); - break; - case IPI_STOP: - case IPI_STOP_HARD: - ipi_stop(NULL); - break; - case IPI_HARDCLOCK: - ipi_hardclock(NULL); - break; - default: - panic("Unknown IPI %#0x on cpu %d", ipi, curcpu); - } - - return (FILTER_HANDLED); -} -#endif - struct cpu_group * cpu_topo(void) { @@ -624,7 +565,6 @@ cpu_mp_setmaxid(void) mp_maxid = 0; } -#ifdef INTRNG /* * Lookup IPI source. */ @@ -768,4 +708,3 @@ ipi_selected(cpuset_t cpus, u_int ipi) CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi); intr_ipi_send(cpus, ipi); } -#endif /* INTRNG */ Modified: head/sys/arm64/arm64/nexus.c ============================================================================== --- head/sys/arm64/arm64/nexus.c Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/arm64/nexus.c Thu Jul 14 17:31:29 2016 (r302853) @@ -271,13 +271,9 @@ nexus_config_intr(device_t dev, int irq, enum intr_polarity pol) { -#ifdef INTRNG /* TODO: This is wrong, it's needed for ACPI */ device_printf(dev, "bus_config_intr is obsolete and not supported!\n"); return (EOPNOTSUPP); -#else - return (intr_irq_config(irq, trig, pol)); -#endif } static int @@ -294,12 +290,7 @@ nexus_setup_intr(device_t dev, device_t if (error) return (error); -#ifdef INTRNG error = intr_setup_irq(child, res, filt, intr, arg, flags, cookiep); -#else - error = arm_setup_intr(device_get_nameunit(child), filt, intr, - arg, rman_get_start(res), flags, cookiep); -#endif return (error); } @@ -308,11 +299,7 @@ static int nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { -#ifdef INTRNG return (intr_teardown_irq(child, r, ih)); -#else - return (intr_irq_remove_handler(child, rman_get_start(r), ih)); -#endif } #ifdef SMP @@ -320,11 +307,7 @@ static int nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu) { -#ifdef INTRNG return (intr_bind_irq(child, irq, cpu)); -#else - return (intr_irq_bind(rman_get_start(irq), cpu)); -#endif } #endif @@ -447,22 +430,8 @@ static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, pcell_t *intr) { -#ifdef INTRNG - return (INTR_IRQ_INVALID); -#else - int irq; - - if (icells == 3) { - irq = intr[1]; - if (intr[0] == 0) - irq += 32; /* SPI */ - else - irq += 16; /* PPI */ - } else - irq = intr[0]; - return (irq); -#endif + return (INTR_IRQ_INVALID); } #endif Modified: head/sys/arm64/include/intr.h ============================================================================== --- head/sys/arm64/include/intr.h Thu Jul 14 17:23:49 2016 (r302852) +++ head/sys/arm64/include/intr.h Thu Jul 14 17:31:29 2016 (r302853) @@ -29,8 +29,6 @@ #ifndef _MACHINE_INTR_H_ #define _MACHINE_INTR_H_ -#ifdef INTRNG - #ifdef FDT #include #endif @@ -50,33 +48,4 @@ arm_irq_memory_barrier(uintptr_t irq) void intr_ipi_dispatch(u_int, struct trapframe *); #endif -#else -int intr_irq_config(u_int, enum intr_trigger, enum intr_polarity); -void intr_irq_handler(struct trapframe *); -int intr_irq_remove_handler(device_t, u_int, void *); - -void arm_dispatch_intr(u_int, struct trapframe *); -int arm_enable_intr(void); -void arm_mask_irq(u_int); -void arm_register_root_pic(device_t, u_int); -void arm_register_msi_pic(device_t); -int arm_alloc_msi(device_t, device_t, int, int, int *); -int arm_release_msi(device_t, device_t, int, int *); -int arm_alloc_msix(device_t, device_t, int *); -int arm_release_msix(device_t, device_t, int); -int arm_map_msi(device_t, device_t, int, uint64_t *, uint32_t *); -int arm_map_msix(device_t, device_t, int, uint64_t *, uint32_t *); -int arm_setup_intr(const char *, driver_filter_t *, driver_intr_t, - void *, u_int, enum intr_type, void **); -void arm_unmask_irq(u_int); - -#ifdef SMP -int intr_irq_bind(u_int, int); - -void arm_init_secondary(void); -void arm_setup_ipihandler(driver_filter_t *, u_int); -void arm_unmask_ipi(u_int); -#endif -#endif - #endif /* _MACHINE_INTR_H */ From owner-svn-src-head@freebsd.org Thu Jul 14 18:49:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5D7EB99D9D; Thu, 14 Jul 2016 18:49:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A88A918AC; Thu, 14 Jul 2016 18:49:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EIn5o0038325; Thu, 14 Jul 2016 18:49:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EIn53i038324; Thu, 14 Jul 2016 18:49:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607141849.u6EIn53i038324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Jul 2016 18:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302854 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 18:49:06 -0000 Author: markj Date: Thu Jul 14 18:49:05 2016 New Revision: 302854 URL: https://svnweb.freebsd.org/changeset/base/302854 Log: Let DDB's buf printer handle NULL pointers in the buf page array. A buf's b_pages and b_npages fields may be inconsistent after a panic. For instance, vfs_vmio_invalidate() sets b_npages to zero only after all pages are unwired and their page array entries are cleared. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Jul 14 17:31:29 2016 (r302853) +++ head/sys/kern/vfs_bio.c Thu Jul 14 18:49:05 2016 (r302854) @@ -4725,8 +4725,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) for (i = 0; i < bp->b_npages; i++) { vm_page_t m; m = bp->b_pages[i]; - db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, - (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); + if (m != NULL) + db_printf("(%p, 0x%lx, 0x%lx)", m->object, + (u_long)m->pindex, + (u_long)VM_PAGE_TO_PHYS(m)); + else + db_printf("( ??? )"); if ((i + 1) < bp->b_npages) db_printf(","); } From owner-svn-src-head@freebsd.org Thu Jul 14 19:51:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EF16B99029; Thu, 14 Jul 2016 19:51:56 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0246C1DB3; Thu, 14 Jul 2016 19:51:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EJptuG064004; Thu, 14 Jul 2016 19:51:55 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EJptPs064003; Thu, 14 Jul 2016 19:51:55 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201607141951.u6EJptPs064003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 14 Jul 2016 19:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302855 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 19:51:56 -0000 Author: jamie Date: Thu Jul 14 19:51:54 2016 New Revision: 302855 URL: https://svnweb.freebsd.org/changeset/base/302855 Log: Wait for jails to complete startup if jail_parallel_start is YES, instead of assuming they'll take less than one second. PR: 203172 Submitted by: dmitry2004@yandex.ru Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Thu Jul 14 18:49:05 2016 (r302854) +++ head/etc/rc.d/jail Thu Jul 14 19:51:54 2016 (r302855) @@ -440,7 +440,7 @@ jail_status() jail_start() { - local _j _jv _jid _jl _id _name + local _j _jv _jid _id _name if [ $# = 0 ]; then return @@ -470,29 +470,30 @@ jail_start() # Start jails in parallel and then check jail id when # jail_parallel_start is YES. # - _jl= for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) parse_options $_j $_jv || continue - _jl="$_jl $_j" eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - $command $rc_flags $command_args \ - >/dev/null 2>&1 /var/run/jail_${_j}.id - else - echo " cannot start jail " \ - "\"${_hostname:-${_j}}\": " - fi + ( + _tmp=`mktemp -t jail_${_j}` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 /var/run/jail_${_j}.id + else + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + ) & done + wait else # # Start jails one-by-one when jail_parallel_start is NO. From owner-svn-src-head@freebsd.org Thu Jul 14 19:56:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBC35B990BA; Thu, 14 Jul 2016 19:56:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A857D113E; Thu, 14 Jul 2016 19:56:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x22c.google.com with SMTP id 52so48488464qtq.3; Thu, 14 Jul 2016 12:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AFBClSO6MTxUrznxc2yNa1Ar6ooSoJk+eGquZMC0+dk=; b=wWDxHzOTmFAhJqt+Gj5qdvcpf8N60ayTPlcE8bCMamSsG/QMvivVrntl1M05mrrZOc knNQiOFu4H3N5UMvWe0rsHWeasgZLK5BQ36KWBwo/xZ3kKL+QumT9STR8aKjqW/TSanE 4C5A3H7+/EL7TsscC9taGaPWf+urQZugcXqluyCB7jSIBiwY6JNh3wpw1U45fDw5qohn 2gXOzZakVh74X9leXaG44P5RGqHmlCqi5YdceFShqcgF2Gxezck4YK1/xkDnedayZ8DF L0GjAJAVTh0tDxVpJOawcobu6btKR19SJFf/+Bf2wY+OQ4AwW1PHbJeSXd65aiOQMvPe Ud9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AFBClSO6MTxUrznxc2yNa1Ar6ooSoJk+eGquZMC0+dk=; b=aLQvmwGET+vq76eAAAysJCimmZzLm2u5QAMV1XcnHdabzWUx1tHrh2rIRRq6NikGDW SO6QLRtxhybAqdSYhN3aPx34EsUWdW85UZpfmjiquEMpRlPHWokRgTtrTr3YQ4S8mW2v Mf84NuATMyFhU7K4bi+Nan7TcXIkMK0uJol3Mci/zQGuGu6tWQ1Cu9GEWJzXcDu+R0TE 4/DZyGNXDYaj7puHgbh2J4XyIOJgkGj8NcT1ZABEpP9A3mkLIxsfpLA+8FpCGkQgbHSi ExjlS/7/ibvx/c1tb44XmFw4UTVPt3spbc5YGPp8Pi11IiI3WHCTAxoR+YPnNlBpbQKw QFTQ== X-Gm-Message-State: ALyK8tKqiCYFqUJFEX/tUj8KqwfzRAJuq0jF+ddrusIKQwTZIof0mjxvK1JKhBvccPPwNlU65CFuiwlMPrrxJw== X-Received: by 10.200.40.235 with SMTP id j40mr22598631qtj.99.1468526179710; Thu, 14 Jul 2016 12:56:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.148.131 with HTTP; Thu, 14 Jul 2016 12:56:19 -0700 (PDT) In-Reply-To: <201607141951.u6EJptPs064003@repo.freebsd.org> References: <201607141951.u6EJptPs064003@repo.freebsd.org> From: Ngie Cooper Date: Thu, 14 Jul 2016 12:56:19 -0700 Message-ID: Subject: Re: svn commit: r302855 - head/etc/rc.d To: Jamie Gritton Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 19:56:21 -0000 On Thu, Jul 14, 2016 at 12:51 PM, Jamie Gritton wrote: > Author: jamie > Date: Thu Jul 14 19:51:54 2016 > New Revision: 302855 > URL: https://svnweb.freebsd.org/changeset/base/302855 > > Log: > Wait for jails to complete startup if jail_parallel_start is YES, > instead of assuming they'll take less than one second. > > PR: 203172 > Submitted by: dmitry2004@yandex.ru MFC after: ? From owner-svn-src-head@freebsd.org Thu Jul 14 20:15:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0747BB997C2; Thu, 14 Jul 2016 20:15:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D67C11160; Thu, 14 Jul 2016 20:15:56 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EKFu4p072062; Thu, 14 Jul 2016 20:15:56 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EKFtni072059; Thu, 14 Jul 2016 20:15:55 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201607142015.u6EKFtni072059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 14 Jul 2016 20:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302856 - head/usr.sbin/jail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 20:15:57 -0000 Author: jamie Date: Thu Jul 14 20:15:55 2016 New Revision: 302856 URL: https://svnweb.freebsd.org/changeset/base/302856 Log: Fix up the order in which jail creation processes are run, to preserve the config file's order in the non-parallel-start case. PR: 209112 MFC after: 3 days Modified: head/usr.sbin/jail/command.c head/usr.sbin/jail/jailp.h head/usr.sbin/jail/state.c Modified: head/usr.sbin/jail/command.c ============================================================================== --- head/usr.sbin/jail/command.c Thu Jul 14 19:51:54 2016 (r302855) +++ head/usr.sbin/jail/command.c Thu Jul 14 20:15:55 2016 (r302856) @@ -92,9 +92,13 @@ next_command(struct cfjail *j) int create_failed, stopping; if (paralimit == 0) { - requeue(j, &runnable); + if (j->flags & JF_FROM_RUNQ) + requeue_head(j, &runnable); + else + requeue(j, &runnable); return 1; } + j->flags &= ~JF_FROM_RUNQ; create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED; stopping = (j->flags & JF_STOP) != 0; comparam = *j->comparam; @@ -160,20 +164,23 @@ next_command(struct cfjail *j) int finish_command(struct cfjail *j) { + struct cfjail *rj; int error; if (!(j->flags & JF_SLEEPQ)) return 0; j->flags &= ~JF_SLEEPQ; - if (*j->comparam == IP_STOP_TIMEOUT) - { + if (*j->comparam == IP_STOP_TIMEOUT) { j->flags &= ~JF_TIMEOUT; j->pstatus = 0; return 0; } paralimit++; - if (!TAILQ_EMPTY(&runnable)) - requeue(TAILQ_FIRST(&runnable), &ready); + if (!TAILQ_EMPTY(&runnable)) { + rj = TAILQ_FIRST(&runnable); + rj->flags |= JF_FROM_RUNQ; + requeue(rj, &ready); + } error = 0; if (j->flags & JF_TIMEOUT) { j->flags &= ~JF_TIMEOUT; @@ -259,7 +266,7 @@ next_proc(int nonblock) } /* - * Run a single command for a jail, possible inside the jail. + * Run a single command for a jail, possibly inside the jail. */ static int run_command(struct cfjail *j) Modified: head/usr.sbin/jail/jailp.h ============================================================================== --- head/usr.sbin/jail/jailp.h Thu Jul 14 19:51:54 2016 (r302855) +++ head/usr.sbin/jail/jailp.h Thu Jul 14 20:15:55 2016 (r302856) @@ -64,6 +64,7 @@ #define JF_PERSIST 0x0100 /* Jail is temporarily persistent */ #define JF_TIMEOUT 0x0200 /* A command (or process kill) timed out */ #define JF_SLEEPQ 0x0400 /* Waiting on a command and/or timeout */ +#define JF_FROM_RUNQ 0x0800 /* Has already been on the run queue */ #define JF_OP_MASK (JF_START | JF_SET | JF_STOP) #define JF_RESTART (JF_START | JF_STOP) @@ -223,6 +224,7 @@ extern struct cfjail *next_jail(void); extern int start_state(const char *target, int docf, unsigned state, int running); extern void requeue(struct cfjail *j, struct cfjails *queue); +extern void requeue_head(struct cfjail *j, struct cfjails *queue); extern void yyerror(const char *); extern int yylex(void); Modified: head/usr.sbin/jail/state.c ============================================================================== --- head/usr.sbin/jail/state.c Thu Jul 14 19:51:54 2016 (r302855) +++ head/usr.sbin/jail/state.c Thu Jul 14 20:15:55 2016 (r302856) @@ -397,6 +397,14 @@ requeue(struct cfjail *j, struct cfjails } } +void +requeue_head(struct cfjail *j, struct cfjails *queue) +{ + TAILQ_REMOVE(j->queue, j, tq); + TAILQ_INSERT_HEAD(queue, j, tq); + j->queue = queue; +} + /* * Add a dependency edge between two jails. */ From owner-svn-src-head@freebsd.org Thu Jul 14 20:17:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AC95B9986B; Thu, 14 Jul 2016 20:17:09 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3BC1333; Thu, 14 Jul 2016 20:17:09 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6EKH8gQ072162; Thu, 14 Jul 2016 20:17:08 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6EKH80w072161; Thu, 14 Jul 2016 20:17:08 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201607142017.u6EKH80w072161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 14 Jul 2016 20:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302857 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 20:17:09 -0000 Author: jamie Date: Thu Jul 14 20:17:08 2016 New Revision: 302857 URL: https://svnweb.freebsd.org/changeset/base/302857 Log: Start jails non-parallel if jail_parallel_start is NO. This was true for an explicitly specified jail list; now it's also true for all jails. PR: 209112 MFC after: 3 days Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Thu Jul 14 20:15:55 2016 (r302856) +++ head/etc/rc.d/jail Thu Jul 14 20:17:08 2016 (r302857) @@ -451,6 +451,9 @@ jail_start() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" + if ! checkyesno jail_parallel_start; then + command_args="$command_args -p1" + fi _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do @@ -458,7 +461,7 @@ jail_start() echo $_id > /var/run/jail_${_name}.id done else - tail -1 $_tmp + cat $_tmp fi rm -f $_tmp echo '.' @@ -545,7 +548,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command $rc_flags $command_args $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi @@ -568,7 +571,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi From owner-svn-src-head@freebsd.org Thu Jul 14 20:41:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D95C1B99E8E; Thu, 14 Jul 2016 20:41:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 6EB461158; Thu, 14 Jul 2016 20:41:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 894701049B83; Fri, 15 Jul 2016 06:41:01 +1000 (AEST) Date: Fri, 15 Jul 2016 06:41:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302854 - head/sys/kern In-Reply-To: <201607141849.u6EIn53i038324@repo.freebsd.org> Message-ID: <20160715053515.S2290@besplex.bde.org> References: <201607141849.u6EIn53i038324@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=M8SwUHEs c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=elF9NkvWo_qpgCsjwWgA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 20:41:11 -0000 > Log: > Let DDB's buf printer handle NULL pointers in the buf page array. I noticed some other bugs in this code: > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Thu Jul 14 17:31:29 2016 (r302853) > +++ head/sys/kern/vfs_bio.c Thu Jul 14 18:49:05 2016 (r302854) > @@ -4725,8 +4725,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) > for (i = 0; i < bp->b_npages; i++) { > vm_page_t m; 2 style bugs. > m = bp->b_pages[i]; > - db_printf("(%p, 0x%lx, 0x%lx)", (void *)m->object, > - (u_long)m->pindex, (u_long)VM_PAGE_TO_PHYS(m)); > + if (m != NULL) > + db_printf("(%p, 0x%lx, 0x%lx)", m->object, This loses the careful cast of m->object to void *. %p gives undefined behaviour on pointers that are not void *. All other nearby %p's and most elsewhere have this bug. %p is a bad format anyway. On exotic arches, the cast might actually change the representation, but %p is only useful in debugging code and there you would usually prefer to see the raw bits. %p also gives little control over the format (none in userland, and undocumented extensions in the kernel). To get control of the format, the value can be printed using %<...>j[dx...] after casting to (uintmax_t)(uintptr_t)(void *) (sometimes to const/volatile void *). This cast is even uglier but more needed. It may still corrupt the resolution. To get full control, pointers should be printed by copying there bits and printing the array. The explicit 0x prefix should only be used in tabular formats. Here the value is often 0. This should be printed using %#. > + (u_long)m->pindex, This is broken on all 32-bit systems. pindex is 64 bits to handle large file offsets (64-bit file offset needs 52-bit pindex with 4K pages). The casts truncates to 32 bits. > + (u_long)VM_PAGE_TO_PHYS(m)); This is broken on 32-bit systems with large physical adress spaces (only i386 with PAE?). vm_paddr_t is 64 bits to handle large physical offsets. i386 with PAE needs only 44. This reduces to 32. printf format checking gives too many printf format bugs from bad fixes using bogus casts to make the arg type match the format. > + else > + db_printf("( ??? )"); Perhaps just "()". "???" looks like an error. There shouldn't be any spaces near the parentheses since that is not English style and the nonzero case doesn't use them. I think the parentheses should be braces. We're printing a (sub)struct and C uses braces for structs. Also, the array could be in brackets. It is now delimited by a ':' and a newline. > if ((i + 1) < bp->b_npages) Style bug (extra parentheses). > db_printf(","); > } Other bugs in this function: - no cast to void * for bp, b_bufobj, b_data, b_dep, b_kvabase - b*flags is uint32_t is cast to u_int. The cast is only needed with 16-bit ints, but BSD never supported them and POSIX has required >= 32 bit ints since 2001. - formatting in both the source and output for one line was broken by adding b_dep. It and the previous line were limit to 4 fields to keep the output line lengths below 80 on 32 bit arches. There are many %p formats and possibly large integers, so this formatting probably never worked on 64- bit arches. b_dep is a 5th field on a line. The source formatting is obfuscated so that it is not obviously too long in the output. - after printing 2 lines ending in b_dep using 1 db_printf(), we use another db_printf() for the next line. I prefer 1 printf() in 1 source line per output line. - related fields are mostly grouped logically. The newer fields b_bufobj and b_dep are not. b_dep on the 3rd line would be better. I might express the arrays b_data and b_kvasize as %p[%d] with the size not named. This gives more chance of 4 fields/line fitting. Bruce From owner-svn-src-head@freebsd.org Thu Jul 14 21:19:33 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DE53B9986F; Thu, 14 Jul 2016 21:19:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 61E931A2D; Thu, 14 Jul 2016 21:19:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id A65ACD40E08; Fri, 15 Jul 2016 07:19:23 +1000 (AEST) Date: Fri, 15 Jul 2016 07:19:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302854 - head/sys/kern In-Reply-To: <20160715053515.S2290@besplex.bde.org> Message-ID: <20160715071816.Q2585@besplex.bde.org> References: <201607141849.u6EIn53i038324@repo.freebsd.org> <20160715053515.S2290@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=OcugPLCY2xZCMrbkqiUA:9 a=CjuIK1q_8ugA:10 a=Alg2kp3KGRUA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 21:19:33 -0000 On Fri, 15 Jul 2016, Bruce Evans wrote: >> Log: >> Let DDB's buf printer handle NULL pointers in the buf page array. > > I noticed some other bugs in this code: Oops, that was supposed to be a private reply. Bruce From owner-svn-src-head@freebsd.org Thu Jul 14 23:14:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C78E4B99001; Thu, 14 Jul 2016 23:14:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95FF61242; Thu, 14 Jul 2016 23:14:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ENEAuL038787; Thu, 14 Jul 2016 23:14:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ENEAKF038786; Thu, 14 Jul 2016 23:14:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607142314.u6ENEAKF038786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Jul 2016 23:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302858 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 23:14:11 -0000 Author: jhb Date: Thu Jul 14 23:14:10 2016 New Revision: 302858 URL: https://svnweb.freebsd.org/changeset/base/302858 Log: Move nested include of inside _KERNEL. This removes namespace pollution for userland brought in by r299122. PR: 210319 Submitted by: knu MFC after: 1 week Modified: head/sys/sys/cpuset.h Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Thu Jul 14 20:17:08 2016 (r302857) +++ head/sys/sys/cpuset.h Thu Jul 14 23:14:10 2016 (r302858) @@ -35,7 +35,6 @@ #include #include -#include #define _NCPUBITS _BITSET_BITS #define _NCPUWORDS __bitset_words(CPU_SETSIZE) @@ -92,6 +91,8 @@ #define CPUSET_DEFAULT 0 #ifdef _KERNEL +#include + LIST_HEAD(setlist, cpuset); /* From owner-svn-src-head@freebsd.org Thu Jul 14 23:20:07 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00E08B991E5; Thu, 14 Jul 2016 23:20:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0CA21569; Thu, 14 Jul 2016 23:20:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ENK6Re039060; Thu, 14 Jul 2016 23:20:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ENK5RV039058; Thu, 14 Jul 2016 23:20:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607142320.u6ENK5RV039058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Jul 2016 23:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302859 - in head: sys/kern usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 23:20:07 -0000 Author: jhb Date: Thu Jul 14 23:20:05 2016 New Revision: 302859 URL: https://svnweb.freebsd.org/changeset/base/302859 Log: Include command line arguments in core dump process info. Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command line arguments. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D7116 Modified: head/sys/kern/imgact_elf.c head/usr.bin/gcore/elfcore.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Thu Jul 14 23:14:10 2016 (r302858) +++ head/sys/kern/imgact_elf.c Thu Jul 14 23:20:05 2016 (r302859) @@ -1823,8 +1823,12 @@ typedef vm_offset_t elf_ps_strings_t; static void __elfN(note_prpsinfo)(void *arg, struct sbuf *sb, size_t *sizep) { + struct sbuf sbarg; + size_t len; + char *cp, *end; struct proc *p; elf_prpsinfo_t *psinfo; + int error; p = (struct proc *)arg; if (sb != NULL) { @@ -1833,13 +1837,43 @@ __elfN(note_prpsinfo)(void *arg, struct psinfo->pr_version = PRPSINFO_VERSION; psinfo->pr_psinfosz = sizeof(elf_prpsinfo_t); strlcpy(psinfo->pr_fname, p->p_comm, sizeof(psinfo->pr_fname)); - /* - * XXX - We don't fill in the command line arguments properly - * yet. - */ - strlcpy(psinfo->pr_psargs, p->p_comm, - sizeof(psinfo->pr_psargs)); - + PROC_LOCK(p); + if (p->p_args != NULL) { + len = sizeof(psinfo->pr_psargs) - 1; + if (len > p->p_args->ar_length) + len = p->p_args->ar_length; + memcpy(psinfo->pr_psargs, p->p_args->ar_args, len); + PROC_UNLOCK(p); + error = 0; + } else { + _PHOLD(p); + PROC_UNLOCK(p); + sbuf_new(&sbarg, psinfo->pr_psargs, + sizeof(psinfo->pr_psargs), SBUF_FIXEDLEN); + error = proc_getargv(curthread, p, &sbarg); + PRELE(p); + if (sbuf_finish(&sbarg) == 0) + len = sbuf_len(&sbarg) - 1; + else + len = sizeof(psinfo->pr_psargs) - 1; + sbuf_delete(&sbarg); + } + if (error || len == 0) + strlcpy(psinfo->pr_psargs, p->p_comm, + sizeof(psinfo->pr_psargs)); + else { + KASSERT(len < sizeof(psinfo->pr_psargs), + ("len is too long: %zu vs %zu", len, + sizeof(psinfo->pr_psargs))); + cp = psinfo->pr_psargs; + end = cp + len - 1; + for (;;) { + cp = memchr(cp, '\0', end - cp); + if (cp == NULL) + break; + *cp = ' '; + } + } sbuf_bcat(sb, psinfo, sizeof(*psinfo)); free(psinfo, M_TEMP); } Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Thu Jul 14 23:14:10 2016 (r302858) +++ head/usr.bin/gcore/elfcore.c Thu Jul 14 23:20:05 2016 (r302859) @@ -548,6 +548,7 @@ readmap(pid_t pid) static void * elf_note_prpsinfo(void *arg, size_t *sizep) { + char *cp, *end; pid_t pid; elfcore_prpsinfo_t *psinfo; struct kinfo_proc kip; @@ -571,7 +572,20 @@ elf_note_prpsinfo(void *arg, size_t *siz if (kip.ki_pid != pid) err(1, "kern.proc.pid.%u", pid); strlcpy(psinfo->pr_fname, kip.ki_comm, sizeof(psinfo->pr_fname)); - strlcpy(psinfo->pr_psargs, psinfo->pr_fname, sizeof(psinfo->pr_psargs)); + name[2] = KERN_PROC_ARGS; + len = sizeof(psinfo->pr_psargs) - 1; + if (sysctl(name, 4, psinfo->pr_psargs, &len, NULL, 0) == 0 && len > 0) { + cp = psinfo->pr_psargs; + end = cp + len - 1; + for (;;) { + cp = memchr(cp, '\0', end - cp); + if (cp == NULL) + break; + *cp = ' '; + } + } else + strlcpy(psinfo->pr_psargs, kip.ki_comm, + sizeof(psinfo->pr_psargs)); *sizep = sizeof(*psinfo); return (psinfo); From owner-svn-src-head@freebsd.org Thu Jul 14 23:22:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92247B9934F; Thu, 14 Jul 2016 23:22:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70F3E180C; Thu, 14 Jul 2016 23:22:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (d-24-153-62-176.cpe.metrocast.net [24.153.62.176]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 28108B91F; Thu, 14 Jul 2016 19:22:02 -0400 (EDT) Subject: Re: svn commit: r302859 - in head: sys/kern usr.bin/gcore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607142320.u6ENK5RV039058@repo.freebsd.org> From: John Baldwin Message-ID: <5f863f6c-b862-4a42-f250-0a06b5a03253@FreeBSD.org> Date: Thu, 14 Jul 2016 19:22:01 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201607142320.u6ENK5RV039058@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 14 Jul 2016 19:22:02 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 23:22:03 -0000 On 7/14/16 7:20 PM, John Baldwin wrote: > Author: jhb > Date: Thu Jul 14 23:20:05 2016 > New Revision: 302859 > URL: https://svnweb.freebsd.org/changeset/base/302859 > > Log: > Include command line arguments in core dump process info. > > Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command > line arguments. > > Reviewed by: kib > Differential Revision: https://reviews.freebsd.org/D7116 Meant to include an MFC after tag. The effect is that gdb will now display the command line from a core dump rather than just the command name (albeit truncated to 80 characters). lldb doesn't grok NT_PRSINFO on FreeBSD yet so is unaffected. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 14 23:28:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 571A2B993E2; Thu, 14 Jul 2016 23:28:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F6641B5E; Thu, 14 Jul 2016 23:28:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ENSrCK042876; Thu, 14 Jul 2016 23:28:53 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ENSrTw042875; Thu, 14 Jul 2016 23:28:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607142328.u6ENSrTw042875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Jul 2016 23:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302860 - head/lib/librt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 23:28:54 -0000 Author: jhb Date: Thu Jul 14 23:28:53 2016 New Revision: 302860 URL: https://svnweb.freebsd.org/changeset/base/302860 Log: Fix aio system call wrappers in librt. - Update aio_return/waitcomplete wrappers for the ssize_t return type. - Fix the aio_return() wrapper to fail with EINVAL on a pending job. This matches the semantics of the in-kernel system call. Also, aio_return() returns errors via errno, not via the return value. Reviewed by: kib (earlier version) MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7120 Modified: head/lib/librt/aio.c Modified: head/lib/librt/aio.c ============================================================================== --- head/lib/librt/aio.c Thu Jul 14 23:20:05 2016 (r302859) +++ head/lib/librt/aio.c Thu Jul 14 23:28:53 2016 (r302860) @@ -54,8 +54,8 @@ typedef void (*aio_func)(union sigval va extern int __sys_aio_read(struct aiocb *iocb); extern int __sys_aio_write(struct aiocb *iocb); -extern int __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); -extern int __sys_aio_return(struct aiocb *iocb); +extern ssize_t __sys_aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout); +extern ssize_t __sys_aio_return(struct aiocb *iocb); extern int __sys_aio_error(struct aiocb *iocb); extern int __sys_aio_fsync(int op, struct aiocb *iocb); @@ -136,12 +136,13 @@ __aio_write(struct aiocb *iocb) return aio_io(iocb, &__sys_aio_write); } -int +ssize_t __aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout) { + ssize_t ret; int err; - int ret = __sys_aio_waitcomplete(iocbp, timeout); + ret = __sys_aio_waitcomplete(iocbp, timeout); if (*iocbp) { if ((*iocbp)->aio_sigevent.sigev_notify == SIGEV_THREAD) { err = errno; @@ -155,13 +156,20 @@ __aio_waitcomplete(struct aiocb **iocbp, return (ret); } -int +ssize_t __aio_return(struct aiocb *iocb) { if (iocb->aio_sigevent.sigev_notify == SIGEV_THREAD) { - if (__sys_aio_error(iocb) == EINPROGRESS) - return (EINPROGRESS); + if (__sys_aio_error(iocb) == EINPROGRESS) { + /* + * Fail with EINVAL to match the semantics of + * __sys_aio_return() for an in-progress + * request. + */ + errno = EINVAL; + return (-1); + } __sigev_list_lock(); __sigev_delete(SI_ASYNCIO, (sigev_id_t)iocb); __sigev_list_unlock(); From owner-svn-src-head@freebsd.org Thu Jul 14 23:35:57 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19260B995E4; Thu, 14 Jul 2016 23:35:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEBE411D0; Thu, 14 Jul 2016 23:35:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6ENZtbV046383; Thu, 14 Jul 2016 23:35:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6ENZt6N046382; Thu, 14 Jul 2016 23:35:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607142335.u6ENZt6N046382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Jul 2016 23:35:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302861 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 23:35:57 -0000 Author: jhb Date: Thu Jul 14 23:35:55 2016 New Revision: 302861 URL: https://svnweb.freebsd.org/changeset/base/302861 Log: Fix rendering issues. - Use Ta to separate column headers. - Correct width of the 'Code' column in the last table. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7118 Modified: head/share/man/man3/siginfo.3 Modified: head/share/man/man3/siginfo.3 ============================================================================== --- head/share/man/man3/siginfo.3 Thu Jul 14 23:28:53 2016 (r302860) +++ head/share/man/man3/siginfo.3 Thu Jul 14 23:35:55 2016 (r302861) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2012 +.Dd July 14, 2016 .Dt SIGINFO 3 .Os .Sh NAME @@ -54,7 +54,7 @@ In either case, the system returns the i .Vt siginfo_t , which includes the following information: .Bl -column ".Vt union signal" ".Va si_overrun" -.It Sy "Type Member Description" +.It Sy Type Ta Sy Member Ta Sy Description .It Vt int Ta Va si_signo Ta signal number .It Vt int Ta Va si_errno Ta @@ -107,7 +107,7 @@ for use as values of that are signal-specific or non-signal-specific reasons why the signal was generated: .Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED" -.It Sy "Signal Code Reason" +.It Sy Signal Ta Sy Code Ta Sy Reason .It Dv SIGILL Ta Dv ILL_ILLOPC Ta illegal opcode .It Ta Dv ILL_ILLOPN Ta @@ -206,7 +206,7 @@ signal sent by .Pp In addition, the following signal-specific information is available: .Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED" -.It Sy "Signal Member Value" +.It Sy Signal Ta Sy Member Ta Sy Value .It Dv SIGILL Ta Va si_addr Ta address of faulting instruction .It Ta Va si_trapno Ta @@ -240,8 +240,8 @@ or .El .Pp Finally, the following code-specific information is available: -.Bl -column ".Dv SI_QUEUE" ".Va si_overrun" -.It Sy "Code Member Value" +.Bl -column ".Dv SI_ASYNCIO" ".Va si_overrun" +.It Sy Code Ta Sy Member Ta Sy Value .It Dv SI_USER Ta Va si_pid Ta the process ID that sent the signal .It Ta Va si_uid Ta From owner-svn-src-head@freebsd.org Fri Jul 15 04:31:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5DCAB98ED1; Fri, 15 Jul 2016 04:31:48 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id A387E17DD; Fri, 15 Jul 2016 04:31:48 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A27031DE4; Fri, 15 Jul 2016 04:31:48 +0000 (UTC) Date: Fri, 15 Jul 2016 04:31:48 +0000 From: Alexey Dokuchaev To: Bruce Evans Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org Subject: Re: svn commit: r302854 - head/sys/kern Message-ID: <20160715043148.GA46325@FreeBSD.org> References: <201607141849.u6EIn53i038324@repo.freebsd.org> <20160715053515.S2290@besplex.bde.org> <20160715071816.Q2585@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160715071816.Q2585@besplex.bde.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:31:48 -0000 On Fri, Jul 15, 2016 at 07:19:22AM +1000, Bruce Evans wrote: > On Fri, 15 Jul 2016, Bruce Evans wrote: > >> Log: > >> Let DDB's buf printer handle NULL pointers in the buf page array. > > > > I noticed some other bugs in this code: > > Oops, that was supposed to be a private reply. I'm glad it leaked: %p abuse is unfortunately not that rare, and getting developers' attention is a good thing. E.g., every time I do kldstat(8) on my PowerPC box I sigh: % kldstat Id Refs Address Size Name 1 7 0x100000 e0c378 kernel 2 1 0xd20dd000 1d000 tmpfs.ko 3 2 0xd2114000 18000 geom_sched.ko 4 1 0xd2131000 13000 gsched_rr.ko ./danfe From owner-svn-src-head@freebsd.org Fri Jul 15 04:42:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C47FB97419; Fri, 15 Jul 2016 04:42:10 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B21113A; Fri, 15 Jul 2016 04:42:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F4g9Ca060122; Fri, 15 Jul 2016 04:42:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F4g8F6060118; Fri, 15 Jul 2016 04:42:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150442.u6F4g8F6060118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 04:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302864 - in head/sys: conf dev/hyperv/vmbus modules/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:42:10 -0000 Author: sephe Date: Fri Jul 15 04:42:08 2016 New Revision: 302864 URL: https://svnweb.freebsd.org/changeset/base/302864 Log: hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7126 Deleted: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Fri Jul 15 02:29:10 2016 (r302863) +++ head/sys/conf/files.amd64 Fri Jul 15 04:42:08 2016 (r302864) @@ -271,7 +271,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv -dev/hyperv/vmbus/hv_channel_mgmt.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 Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Jul 15 02:29:10 2016 (r302863) +++ head/sys/conf/files.i386 Fri Jul 15 04:42:08 2016 (r302864) @@ -247,7 +247,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv -dev/hyperv/vmbus/hv_channel_mgmt.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 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 02:29:10 2016 (r302863) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 04:42:08 2016 (r302864) @@ -53,8 +53,28 @@ __FBSDID("$FreeBSD$"); static void vmbus_chan_send_event(hv_vmbus_channel* channel); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); + static void vmbus_chan_task(void *, int); static void vmbus_chan_task_nobatch(void *, int); +static void vmbus_chan_detach_task(void *, int); + +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); + +/* + * Vmbus channel message processing. + */ +static const vmbus_chanmsg_proc_t +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) +}; /** * @brief Trigger an event notification on the specified channel @@ -984,3 +1004,463 @@ vmbus_chan_update_evtflagcnt(struct vmbu } } } + +static struct hv_vmbus_channel * +vmbus_chan_alloc(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); + + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &chan->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); + TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); + + return chan; +} + +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) +{ + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); + mtx_destroy(&chan->ch_subchan_lock); + free(chan, M_DEVBUF); +} + +static int +vmbus_chan_add(struct hv_vmbus_channel *newchan) +{ + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; + + if (newchan->ch_id == 0) { + /* + * XXX + * Chan0 will neither be processed nor should be offered; + * skip it. + */ + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); + return EINVAL; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; + } + sc->vmbus_chmap[newchan->ch_id] = newchan; + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); + } + + mtx_lock(&sc->vmbus_prichan_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { + /* + * Sub-channel will have the same type GUID and instance + * GUID as its primary channel. + */ + if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, + sizeof(struct hyperv_guid)) == 0 && + memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, + sizeof(struct hyperv_guid)) == 0) + break; + } + if (VMBUS_CHAN_ISPRIMARY(newchan)) { + if (prichan == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); + return 0; + } else { + mtx_unlock(&sc->vmbus_prichan_lock); + device_printf(sc->vmbus_dev, "duplicated primary " + "chan%u\n", newchan->ch_id); + return EINVAL; + } + } else { /* Sub-channel */ + if (prichan == NULL) { + mtx_unlock(&sc->vmbus_prichan_lock); + device_printf(sc->vmbus_dev, "no primary chan for " + "chan%u\n", newchan->ch_id); + return EINVAL; + } + /* + * Found the primary channel for this sub-channel and + * move on. + * + * XXX refcnt prichan + */ + } + mtx_unlock(&sc->vmbus_prichan_lock); + + /* + * This is a sub-channel; link it with the primary channel. + */ + KASSERT(!VMBUS_CHAN_ISPRIMARY(newchan), + ("new channel is not sub-channel")); + KASSERT(prichan != NULL, ("no primary channel")); + + newchan->ch_prichan = prichan; + newchan->ch_dev = prichan->ch_dev; + + mtx_lock(&prichan->ch_subchan_lock); + TAILQ_INSERT_TAIL(&prichan->ch_subchans, newchan, ch_sublink); + /* + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. + */ + prichan->ch_subchan_cnt++; + mtx_unlock(&prichan->ch_subchan_lock); + wakeup(prichan); + + return 0; +} + +void +vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) +{ + KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); + + if (chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WS2008 || + chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WIN7) { + /* Only cpu0 is supported */ + cpu = 0; + } + + chan->target_cpu = cpu; + chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + + if (bootverbose) { + printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", + chan->ch_id, + chan->target_cpu, chan->target_vcpu); + } +} + +void +vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +{ + static uint32_t vmbus_chan_nextcpu; + int cpu; + + cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; + vmbus_channel_cpu_set(chan, cpu); +} + +static void +vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) +{ + /* + * By default, pin the channel to cpu0. Devices having + * special channel-cpu mapping requirement should call + * vmbus_channel_cpu_{set,rr}(). + */ + vmbus_channel_cpu_set(chan, 0); +} + +static void +vmbus_chan_msgproc_choffer(struct vmbus_softc *sc, + const struct vmbus_message *msg) +{ + const struct vmbus_chanmsg_choffer *offer; + struct hv_vmbus_channel *chan; + int error; + + offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; + + chan = vmbus_chan_alloc(sc); + if (chan == NULL) { + device_printf(sc->vmbus_dev, "allocate chan%u failed\n", + offer->chm_chanid); + return; + } + + chan->ch_id = offer->chm_chanid; + chan->ch_subidx = offer->chm_subidx; + chan->ch_guid_type = offer->chm_chtype; + chan->ch_guid_inst = offer->chm_chinst; + + /* Batch reading is on by default */ + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; + + chan->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; + if (sc->vmbus_version != VMBUS_VERSION_WS2008) + chan->ch_monprm->mp_connid = offer->chm_connid; + + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + /* + * Setup MNF stuffs. + */ + chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_montrig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (chan->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + panic("invalid monitor trigger %u", offer->chm_montrig); + chan->ch_montrig_mask = + 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); + } + + /* Select default cpu for this channel. */ + vmbus_chan_cpu_default(chan); + + error = vmbus_chan_add(chan); + if (error) { + device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", + chan->ch_id, error); + vmbus_chan_free(chan); + return; + } + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Add device for this primary channel. + * + * NOTE: + * Error is ignored here; don't have much to do if error + * really happens. + */ + hv_vmbus_child_device_register(chan); + } +} + +/* + * XXX pretty broken; need rework. + */ +static void +vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc, + const struct vmbus_message *msg) +{ + const struct vmbus_chanmsg_chrescind *note; + struct hv_vmbus_channel *chan; + + note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; + if (note->chm_chanid > VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n", + note->chm_chanid); + return; + } + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u rescinded\n", + note->chm_chanid); + } + + chan = sc->vmbus_chmap[note->chm_chanid]; + if (chan == NULL) + return; + sc->vmbus_chmap[note->chm_chanid] = NULL; + + taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task); +} + +static void +vmbus_chan_detach_task(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* Only primary channel owns the device */ + hv_vmbus_child_device_unregister(chan); + /* NOTE: DO NOT free primary channel for now */ + } else { + struct vmbus_softc *sc = chan->vmbus_sc; + struct hv_vmbus_channel *pri_chan = chan->ch_prichan; + struct vmbus_chanmsg_chfree *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chfree(chan%u)\n", + chan->ch_id); + goto remove; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; + req->chm_chanid = chan->ch_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chfree(chan%u) failed: %d", + chan->ch_id, error); + /* NOTE: Move on! */ + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u freed\n", + chan->ch_id); + } + } +remove: + mtx_lock(&pri_chan->ch_subchan_lock); + TAILQ_REMOVE(&pri_chan->ch_subchans, chan, ch_sublink); + KASSERT(pri_chan->ch_subchan_cnt > 0, + ("invalid subchan_cnt %d", pri_chan->ch_subchan_cnt)); + pri_chan->ch_subchan_cnt--; + mtx_unlock(&pri_chan->ch_subchan_lock); + wakeup(pri_chan); + + vmbus_chan_free(chan); + } +} + +/* + * Detach all devices and destroy the corresponding primary channels. + */ +void +vmbus_chan_destroy_all(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + mtx_lock(&sc->vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); + + hv_vmbus_child_device_unregister(chan); + vmbus_chan_free(chan); + + mtx_lock(&sc->vmbus_prichan_lock); + } + bzero(sc->vmbus_chmap, + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); + mtx_unlock(&sc->vmbus_prichan_lock); +} + +/** + * @brief Select the best outgoing channel + * + * The channel whose vcpu binding is closest to the currect vcpu will + * be selected. + * If no multi-channel, always select primary channel + * + * @param primary - primary channel + */ +struct hv_vmbus_channel * +vmbus_select_outgoing_channel(struct hv_vmbus_channel *primary) +{ + hv_vmbus_channel *new_channel = NULL; + hv_vmbus_channel *outgoing_channel = primary; + int old_cpu_distance = 0; + int new_cpu_distance = 0; + int cur_vcpu = 0; + int smp_pro_id = PCPU_GET(cpuid); + + if (TAILQ_EMPTY(&primary->ch_subchans)) { + return outgoing_channel; + } + + if (smp_pro_id >= MAXCPU) { + return outgoing_channel; + } + + cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); + + /* XXX need lock */ + TAILQ_FOREACH(new_channel, &primary->ch_subchans, ch_sublink) { + if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { + continue; + } + + if (new_channel->target_vcpu == cur_vcpu){ + return new_channel; + } + + old_cpu_distance = ((outgoing_channel->target_vcpu > cur_vcpu) ? + (outgoing_channel->target_vcpu - cur_vcpu) : + (cur_vcpu - outgoing_channel->target_vcpu)); + + new_cpu_distance = ((new_channel->target_vcpu > cur_vcpu) ? + (new_channel->target_vcpu - cur_vcpu) : + (cur_vcpu - new_channel->target_vcpu)); + + if (old_cpu_distance < new_cpu_distance) { + continue; + } + + outgoing_channel = new_channel; + } + + return(outgoing_channel); +} + +struct hv_vmbus_channel ** +vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +{ + struct hv_vmbus_channel **ret, *chan; + int i; + + ret = malloc(subchan_cnt * sizeof(struct hv_vmbus_channel *), M_TEMP, + M_WAITOK); + + mtx_lock(&pri_chan->ch_subchan_lock); + + while (pri_chan->ch_subchan_cnt < subchan_cnt) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "subch", 0); + + i = 0; + TAILQ_FOREACH(chan, &pri_chan->ch_subchans, ch_sublink) { + /* TODO: refcnt chan */ + ret[i] = chan; + + ++i; + if (i == subchan_cnt) + break; + } + KASSERT(i == subchan_cnt, ("invalid subchan count %d, should be %d", + pri_chan->ch_subchan_cnt, subchan_cnt)); + + mtx_unlock(&pri_chan->ch_subchan_lock); + + return ret; +} + +void +vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +{ + + free(subchan, M_TEMP); +} + +void +vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +{ + mtx_lock(&pri_chan->ch_subchan_lock); + while (pri_chan->ch_subchan_cnt > 0) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "dsubch", 0); + mtx_unlock(&pri_chan->ch_subchan_lock); +} + +void +vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; + KASSERT(msg_type < VMBUS_CHANMSG_TYPE_MAX, + ("invalid message type %u", msg_type)); + + msg_proc = vmbus_chan_msgprocs[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); +} Modified: head/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- head/sys/modules/hyperv/vmbus/Makefile Fri Jul 15 02:29:10 2016 (r302863) +++ head/sys/modules/hyperv/vmbus/Makefile Fri Jul 15 04:42:08 2016 (r302864) @@ -5,7 +5,6 @@ KMOD= hv_vmbus SRCS= hv_channel.c \ - hv_channel_mgmt.c \ hv_ring_buffer.c \ hyperv.c \ hyperv_busdma.c \ From owner-svn-src-head@freebsd.org Fri Jul 15 04:43:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45DBFB974BD; Fri, 15 Jul 2016 04:43:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 164481302; Fri, 15 Jul 2016 04:43:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F4hccA060829; Fri, 15 Jul 2016 04:43:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F4hcan060828; Fri, 15 Jul 2016 04:43:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607150443.u6F4hcan060828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 15 Jul 2016 04:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302865 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:43:39 -0000 Author: cy Date: Fri Jul 15 04:43:38 2016 New Revision: 302865 URL: https://svnweb.freebsd.org/changeset/base/302865 Log: When building multiple kernels using KERNCONF, non-existent KERNCONF files will produce an error and buildkernel will fail. Previously missing KERNCONF files silently failed giving no indication as to why, only to subsequently discover during installkernel that the desired kernel was never built in the first place. Reviewed by: ngie@ MFC after: 1 week Differential Revision: D7167 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jul 15 04:42:08 2016 (r302864) +++ head/Makefile.inc1 Fri Jul 15 04:43:38 2016 (r302865) @@ -1140,6 +1140,8 @@ BUILDKERNELS+= ${_kernel} .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) INSTALLKERNEL= ${_kernel} .endif +.else +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} .endif .endfor From owner-svn-src-head@freebsd.org Fri Jul 15 04:50:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9474DB9763D; Fri, 15 Jul 2016 04:50:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B45E16CC; Fri, 15 Jul 2016 04:50:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F4oe5f061799; Fri, 15 Jul 2016 04:50:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F4oeDE061798; Fri, 15 Jul 2016 04:50:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607150450.u6F4oeDE061798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 15 Jul 2016 04:50:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302866 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:50:41 -0000 Author: cy Date: Fri Jul 15 04:50:40 2016 New Revision: 302866 URL: https://svnweb.freebsd.org/changeset/base/302866 Log: Document that missing KERNCONF files will now cause buildkernel to fail. Suggested by: ngie@ Differential Revision: D7167 Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jul 15 04:43:38 2016 (r302865) +++ head/UPDATING Fri Jul 15 04:50:40 2016 (r302866) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160714: + As of r302865 when building multiple kernels using KERNCONF, + non-existent KERNCONF files will produce an error and buildkernel + will fail. Previous to r302865 missing KERNCONF files silently + failed giving no indication as to why, only to subsequently discover + during installkernel that the desired kernel was never built in the + first place. + 20160622: The libc stub for the pipe(2) system call has been replaced with a wrapper which calls the pipe2(2) system call and the pipe(2) is now From owner-svn-src-head@freebsd.org Fri Jul 15 04:54:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDEA4B977C3; Fri, 15 Jul 2016 04:54:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACBEF1A1F; Fri, 15 Jul 2016 04:54:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F4s73U064503; Fri, 15 Jul 2016 04:54:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F4s7Sp064502; Fri, 15 Jul 2016 04:54:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150454.u6F4s7Sp064502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 04:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302867 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:54:09 -0000 Author: sephe Date: Fri Jul 15 04:54:07 2016 New Revision: 302867 URL: https://svnweb.freebsd.org/changeset/base/302867 Log: hyperv/vmbus: Remove unused struct MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7127 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:50:40 2016 (r302866) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:54:07 2016 (r302867) @@ -45,29 +45,6 @@ typedef struct { uint32_t length; } hv_vmbus_sg_buffer_list; -typedef struct { - uint32_t current_interrupt_mask; - uint32_t current_read_index; - uint32_t current_write_index; - uint32_t bytes_avail_to_read; - uint32_t bytes_avail_to_write; -} hv_vmbus_ring_buffer_debug_info; - -typedef struct { - uint32_t rel_id; - struct hyperv_guid interface_type; - struct hyperv_guid interface_instance; - uint32_t monitor_id; - uint32_t server_monitor_pending; - uint32_t server_monitor_latency; - uint32_t server_monitor_connection_id; - uint32_t client_monitor_pending; - uint32_t client_monitor_latency; - uint32_t client_monitor_connection_id; - hv_vmbus_ring_buffer_debug_info inbound; - hv_vmbus_ring_buffer_debug_info outbound; -} hv_vmbus_channel_debug_info; - /* * The format must be the same as hv_vm_data_gpa_direct */ From owner-svn-src-head@freebsd.org Fri Jul 15 04:54:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8164B9782C; Fri, 15 Jul 2016 04:54:43 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C3CC1BB0; Fri, 15 Jul 2016 04:54:43 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id Nv8zbK5iA32mrNv90boYwk; Thu, 14 Jul 2016 22:54:36 -0600 X-Authority-Analysis: v=2.2 cv=ROzxJMq+ c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=71zuUyp6xY4KTf1MVSQA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id BC08C13752; Thu, 14 Jul 2016 21:07:31 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u6F4sXK8006100; Thu, 14 Jul 2016 21:54:33 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201607150454.u6F4sXK8006100@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302865 - head In-Reply-To: Message from Cy Schubert of "Fri, 15 Jul 2016 04:43:38 -0000." <201607150443.u6F4hcan060828@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 14 Jul 2016 21:54:33 -0700 X-CMAE-Envelope: MS4wfCbwcFu/jwPBmxgGhxxeVj74ArwS7aG/8X13M8ouAtZ78sbneIiSR1HUWPekuix3PqOnnLEn3eMUPiGo/tQbDkUvP6RNEISFpJdcAwV1UnJreK1cZ0zg vO7vB/qKhH04CbKvWSC99eanqwiXexPA6lWbOOm0KsZkbM+ccIGdA0SCwbRWANrEDQdONH30FMOSNebwqHPWe1nqLWwC5jwDUE7/OrGKpDkMwwMsLvAg3B+A UBoF6FIR43h2/vVqdrjf2SheipYzOKLjg6jUyO5xPspuMeLIFiZdOMRB2uywhhIc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:54:43 -0000 In message <201607150443.u6F4hcan060828@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Fri Jul 15 04:43:38 2016 > New Revision: 302865 > URL: https://svnweb.freebsd.org/changeset/base/302865 > > Log: > When building multiple kernels using KERNCONF, non-existent KERNCONF > files will produce an error and buildkernel will fail. Previously missing > KERNCONF files silently failed giving no indication as to why, only to > subsequently discover during installkernel that the desired kernel was > never built in the first place. > > Reviewed by: ngie@ > MFC after: 1 week > Differential Revision: D7167 > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > ============================================================================= > = > --- head/Makefile.inc1 Fri Jul 15 04:42:08 2016 (r302864) > +++ head/Makefile.inc1 Fri Jul 15 04:43:38 2016 (r302865) > @@ -1140,6 +1140,8 @@ BUILDKERNELS+= ${_kernel} > .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) > INSTALLKERNEL= ${_kernel} > .endif > +.else > +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} > .endif > .endfor > > Ngie@ suggested that this also be a relnotes candidate. I'm not sure if I'd go so far. I'll leave it open for discussion or if re@ wants to. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Jul 15 04:55:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E596B9789B; Fri, 15 Jul 2016 04:55:21 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AEBAC1D14; Fri, 15 Jul 2016 04:55:20 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id Nv9jbK5vp32mrNv9kboZ2o; Thu, 14 Jul 2016 22:55:20 -0600 X-Authority-Analysis: v=2.2 cv=ROzxJMq+ c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=U3usrQ-RuHvZcFjJsbwA:9 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 387E013789; Thu, 14 Jul 2016 21:08:17 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id u6F4tJMe006142; Thu, 14 Jul 2016 21:55:19 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201607150455.u6F4tJMe006142@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302866 - head In-Reply-To: Message from Cy Schubert of "Fri, 15 Jul 2016 04:50:40 -0000." <201607150450.u6F4oeDE061798@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 14 Jul 2016 21:55:19 -0700 X-CMAE-Envelope: MS4wfJHy5liJxo20qk91xqS+III360kS7u360IiCCT1B2uHaz8HpdxlkXBPlRfcULx2sveexnwy6J15JCmeZy7ly/Ov7zuJrrKoAwvOOzxbML3M40l373PN7 lcB8yEz78SJWHpo7F0DwmPZS4qY1JCIv8ufs3/4gpnRkdwCo2X1FrJ9zv7ggjwiEYUD9wnv3dqBygo0Nq5pyBmNuUJFidq8bKMu5v/yrG1alFJ+KbZdXLdC2 vBrJMblPo/N2ECCf90cxU8HD2mfYpd2BfzO1IamWv8oIeTIrr8xC0KKRWwT90v7U X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 04:55:21 -0000 In message <201607150450.u6F4oeDE061798@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Fri Jul 15 04:50:40 2016 > New Revision: 302866 > URL: https://svnweb.freebsd.org/changeset/base/302866 > > Log: > Document that missing KERNCONF files will now cause buildkernel to fail. > > Suggested by: ngie@ > Differential Revision: D7167 > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================= > = > --- head/UPDATING Fri Jul 15 04:43:38 2016 (r302865) > +++ head/UPDATING Fri Jul 15 04:50:40 2016 (r302866) > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20160714: > + As of r302865 when building multiple kernels using KERNCONF, > + non-existent KERNCONF files will produce an error and buildkernel > + will fail. Previous to r302865 missing KERNCONF files silently > + failed giving no indication as to why, only to subsequently discover > + during installkernel that the desired kernel was never built in the > + first place. > + > 20160622: > The libc stub for the pipe(2) system call has been replaced with > a wrapper which calls the pipe2(2) system call and the pipe(2) is now > X-MFC with: r302865. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Jul 15 05:06:16 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0AADB97C95; Fri, 15 Jul 2016 05:06:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1F261587; Fri, 15 Jul 2016 05:06:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F56FB8068387; Fri, 15 Jul 2016 05:06:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F56FGn068383; Fri, 15 Jul 2016 05:06:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150506.u6F56FGn068383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302868 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:06:16 -0000 Author: sephe Date: Fri Jul 15 05:06:15 2016 New Revision: 302868 URL: https://svnweb.freebsd.org/changeset/base/302868 Log: hyperv/vmbus: Function rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7129 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:06:15 2016 (r302868) @@ -1233,7 +1233,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ * Error is ignored here; don't have much to do if error * really happens. */ - hv_vmbus_child_device_register(chan); + vmbus_add_child(chan); } } @@ -1274,7 +1274,7 @@ vmbus_chan_detach_task(void *xchan, int if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->vmbus_sc; @@ -1336,7 +1336,7 @@ vmbus_chan_destroy_all(struct vmbus_soft TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); mtx_unlock(&sc->vmbus_prichan_lock); - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); vmbus_chan_free(chan); mtx_lock(&sc->vmbus_prichan_lock); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:06:15 2016 (r302868) @@ -123,9 +123,4 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -int hv_vmbus_child_device_register( - struct hv_vmbus_channel *chan); -int hv_vmbus_child_device_unregister( - struct hv_vmbus_channel *chan); - #endif /* __HYPERV_PRIV_H__ */ Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 05:06:15 2016 (r302868) @@ -1021,7 +1021,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } int -hv_vmbus_child_device_register(struct hv_vmbus_channel *chan) +vmbus_add_child(struct hv_vmbus_channel *chan) { struct vmbus_softc *sc = chan->vmbus_sc; device_t parent = sc->vmbus_dev; @@ -1046,7 +1046,7 @@ done: } int -hv_vmbus_child_device_unregister(struct hv_vmbus_channel *chan) +vmbus_delete_child(struct hv_vmbus_channel *chan) { int error; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 15 04:54:07 2016 (r302867) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 15 05:06:15 2016 (r302868) @@ -146,6 +146,8 @@ struct vmbus_msghc; void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); void vmbus_handle_intr(struct trapframe *); +int vmbus_add_child(struct hv_vmbus_channel *); +int vmbus_delete_child(struct hv_vmbus_channel *); void vmbus_et_intr(struct trapframe *); From owner-svn-src-head@freebsd.org Fri Jul 15 05:15:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 173EAB97FF1; Fri, 15 Jul 2016 05:15:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCDFD1D7F; Fri, 15 Jul 2016 05:15:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F5FLpk072239; Fri, 15 Jul 2016 05:15:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F5FLu5072237; Fri, 15 Jul 2016 05:15:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150515.u6F5FLu5072237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302869 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:15:23 -0000 Author: sephe Date: Fri Jul 15 05:15:21 2016 New Revision: 302869 URL: https://svnweb.freebsd.org/changeset/base/302869 Log: hyperv/vmbus: Remove unused function definition/declaration. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7131 Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:06:15 2016 (r302868) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:15:21 2016 (r302869) @@ -261,16 +261,6 @@ static uint32_t copy_from_ring_buffer( uint32_t dest_len, uint32_t start_read_offset); - -/** - * @brief Get the interrupt mask for the specified ring buffer. - */ -uint32_t -hv_vmbus_get_ring_buffer_interrupt_mask(hv_vmbus_ring_buffer_info *rbi) -{ - return rbi->ring_buffer->interrupt_mask; -} - /** * @brief Initialize the ring buffer. */ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:06:15 2016 (r302868) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:15:21 2016 (r302869) @@ -110,13 +110,6 @@ int hv_ring_buffer_read( uint32_t buffer_len, uint32_t offset); -uint32_t hv_vmbus_get_ring_buffer_interrupt_mask( - hv_vmbus_ring_buffer_info *ring_info); - -void hv_vmbus_dump_ring_info( - hv_vmbus_ring_buffer_info *ring_info, - char *prefix); - void hv_ring_buffer_read_begin( hv_vmbus_ring_buffer_info *ring_info); From owner-svn-src-head@freebsd.org Fri Jul 15 05:29:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1B4EB99353; Fri, 15 Jul 2016 05:29:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EBD51500; Fri, 15 Jul 2016 05:29:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F5T4Yi075959; Fri, 15 Jul 2016 05:29:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F5T4pa075956; Fri, 15 Jul 2016 05:29:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150529.u6F5T4pa075956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302870 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:29:05 -0000 Author: sephe Date: Fri Jul 15 05:29:04 2016 New Revision: 302870 URL: https://svnweb.freebsd.org/changeset/base/302870 Log: hyperv/vmbus: Use iovec for bufring scatter/gather list. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7134 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:15:21 2016 (r302869) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:29:04 2016 (r302870) @@ -616,7 +616,7 @@ hv_vmbus_channel_send_packet( uint64_t aligned_data; uint32_t packet_len_aligned; boolean_t need_sig; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct iovec iov[3]; packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); @@ -630,17 +630,16 @@ hv_vmbus_channel_send_packet( desc.length8 = (uint16_t) (packet_len_aligned >> 3); desc.transaction_id = request_id; - buffer_list[0].data = &desc; - buffer_list[0].length = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = &desc; + iov[0].iov_len = sizeof(hv_vm_packet_descriptor); - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -668,7 +667,7 @@ hv_vmbus_channel_send_packet_pagebuffer( uint32_t packet_len; uint32_t page_buflen; uint32_t packetLen_aligned; - hv_vmbus_sg_buffer_list buffer_list[4]; + struct iovec iov[4]; hv_vmbus_channel_packet_page_buffer desc; uint32_t descSize; uint64_t alignedData = 0; @@ -694,20 +693,19 @@ hv_vmbus_channel_send_packet_pagebuffer( desc.transaction_id = request_id; desc.range_count = page_count; - buffer_list[0].data = &desc; - buffer_list[0].length = descSize; + iov[0].iov_base = &desc; + iov[0].iov_len = descSize; - buffer_list[1].data = page_buffers; - buffer_list[1].length = page_buflen; + iov[1].iov_base = page_buffers; + iov[1].iov_len = page_buflen; - buffer_list[2].data = buffer; - buffer_list[2].length = buffer_len; + iov[2].iov_base = buffer; + iov[2].iov_len = buffer_len; - buffer_list[3].data = &alignedData; - buffer_list[3].length = packetLen_aligned - packet_len; + iov[3].iov_base = &alignedData; + iov[3].iov_len = packetLen_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 4, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -735,7 +733,7 @@ hv_vmbus_channel_send_packet_multipagebu uint32_t packet_len_aligned; uint32_t pfn_count; uint64_t aligned_data = 0; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct iovec iov[3]; hv_vmbus_channel_packet_multipage_buffer desc; pfn_count = @@ -772,17 +770,16 @@ hv_vmbus_channel_send_packet_multipagebu memcpy(desc.range.pfn_array, multi_page_buffer->pfn_array, pfn_count * sizeof(uint64_t)); - buffer_list[0].data = &desc; - buffer_list[0].length = desc_size; + iov[0].iov_base = &desc; + iov[0].iov_len = desc_size; - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:15:21 2016 (r302869) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 15 05:29:04 2016 (r302870) @@ -252,7 +252,7 @@ hv_ring_buffer_needsig_on_write( static uint32_t copy_to_ring_buffer( hv_vmbus_ring_buffer_info* ring_info, uint32_t start_write_offset, - char* src, + const uint8_t *src, uint32_t src_len); static uint32_t copy_from_ring_buffer( @@ -297,8 +297,8 @@ void hv_ring_buffer_cleanup(hv_vmbus_rin int hv_ring_buffer_write( hv_vmbus_ring_buffer_info* out_ring_info, - hv_vmbus_sg_buffer_list sg_buffers[], - uint32_t sg_buffer_count, + const struct iovec iov[], + uint32_t iovlen, boolean_t *need_sig) { int i = 0; @@ -310,8 +310,8 @@ hv_ring_buffer_write( volatile uint32_t next_write_location; uint64_t prev_indices = 0; - for (i = 0; i < sg_buffer_count; i++) { - total_bytes_to_write += sg_buffers[i].length; + for (i = 0; i < iovlen; i++) { + total_bytes_to_write += iov[i].iov_len; } total_bytes_to_write += sizeof(uint64_t); @@ -340,10 +340,9 @@ hv_ring_buffer_write( old_write_location = next_write_location; - for (i = 0; i < sg_buffer_count; i++) { + for (i = 0; i < iovlen; i++) { next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, (char *) sg_buffers[i].data, - sg_buffers[i].length); + next_write_location, iov[i].iov_base, iov[i].iov_len); } /* @@ -482,11 +481,11 @@ hv_ring_buffer_read( * * Assume there is enough room. Handles wrap-around in dest case only! */ -uint32_t +static uint32_t copy_to_ring_buffer( hv_vmbus_ring_buffer_info* ring_info, uint32_t start_write_offset, - char* src, + const uint8_t *src, uint32_t src_len) { char *ring_buffer = get_ring_buffer(ring_info); Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:15:21 2016 (r302869) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 05:29:04 2016 (r302870) @@ -35,16 +35,12 @@ #include #include #include +#include #include struct vmbus_softc; -typedef struct { - void* data; - uint32_t length; -} hv_vmbus_sg_buffer_list; - /* * The format must be the same as hv_vm_data_gpa_direct */ @@ -95,8 +91,8 @@ void hv_ring_buffer_cleanup( int hv_ring_buffer_write( hv_vmbus_ring_buffer_info *ring_info, - hv_vmbus_sg_buffer_list sg_buffers[], - uint32_t sg_buff_count, + const struct iovec iov[], + uint32_t iovlen, boolean_t *need_sig); int hv_ring_buffer_peek( From owner-svn-src-head@freebsd.org Fri Jul 15 05:40:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A98C8B9951E; Fri, 15 Jul 2016 05:40:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 813F2196B; Fri, 15 Jul 2016 05:40:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F5eY5e079628; Fri, 15 Jul 2016 05:40:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F5eYSh079626; Fri, 15 Jul 2016 05:40:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150540.u6F5eYSh079626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302871 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:40:35 -0000 Author: sephe Date: Fri Jul 15 05:40:34 2016 New Revision: 302871 URL: https://svnweb.freebsd.org/changeset/base/302871 Log: hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7139 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:29:04 2016 (r302870) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:40:34 2016 (r302871) @@ -409,6 +409,9 @@ int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_t gpadl_handle); +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); + struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:29:04 2016 (r302870) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:40:34 2016 (r302871) @@ -330,26 +330,33 @@ failed: */ int hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, - void *contig_buffer, uint32_t size, uint32_t *gpadl0) + void *contig_buffer, uint32_t size, uint32_t *gpadl) { - struct vmbus_softc *sc = channel->vmbus_sc; + return vmbus_chan_gpadl_connect(channel, + hv_get_phys_addr(contig_buffer), size, gpadl); +} + +int +vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, + int size, uint32_t *gpadl0) +{ + struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_gpadl_conn *req; const struct vmbus_message *msg; size_t reqsz; uint32_t gpadl, status; int page_count, range_len, i, cnt, error; - uint64_t page_id, paddr; + uint64_t page_id; /* * Preliminary checks. */ KASSERT((size & PAGE_MASK) == 0, - ("invalid GPA size %u, not multiple page size", size)); + ("invalid GPA size %d, not multiple page size", size)); page_count = size >> PAGE_SHIFT; - paddr = hv_get_phys_addr(contig_buffer); KASSERT((paddr & PAGE_MASK) == 0, ("GPA is not page aligned %jx", (uintmax_t)paddr)); page_id = paddr >> PAGE_SHIFT; @@ -390,13 +397,13 @@ hv_vmbus_channel_establish_gpadl(struct if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpadl->chan%u\n", - channel->ch_id); + chan->ch_id); return EIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; - req->chm_chanid = channel->ch_id; + req->chm_chanid = chan->ch_id; req->chm_gpadl = gpadl; req->chm_range_len = range_len; req->chm_range_cnt = 1; @@ -409,7 +416,7 @@ hv_vmbus_channel_establish_gpadl(struct if (error) { device_printf(sc->vmbus_dev, "gpadl->chan%u msg hypercall exec failed: %d\n", - channel->ch_id, error); + chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -445,12 +452,12 @@ hv_vmbus_channel_establish_gpadl(struct if (status != 0) { device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", channel->ch_id, status); + "status %u\n", chan->ch_id, status); return EIO; } else { if (bootverbose) { device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", channel->ch_id); + "succeeded\n", chan->ch_id); } } return 0; From owner-svn-src-head@freebsd.org Fri Jul 15 05:51:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 672F3B998DA; Fri, 15 Jul 2016 05:51:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4357A131C; Fri, 15 Jul 2016 05:51:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F5pwK3086586; Fri, 15 Jul 2016 05:51:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F5pwKZ086584; Fri, 15 Jul 2016 05:51:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150551.u6F5pwKZ086584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302872 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:51:59 -0000 Author: sephe Date: Fri Jul 15 05:51:58 2016 New Revision: 302872 URL: https://svnweb.freebsd.org/changeset/base/302872 Log: hyperv/vmbus: Busdma-fy channel bufring. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7140 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:40:34 2016 (r302871) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:51:58 2016 (r302872) @@ -257,13 +257,6 @@ typedef struct hv_vmbus_channel { int ch_montrig_idx; /* MNF trig index */ uint32_t ch_montrig_mask;/* MNF trig mask */ - uint32_t ring_buffer_gpadl_handle; - /* - * Allocated memory for ring buffer - */ - void* ring_buffer_pages; - unsigned long ring_buffer_size; - uint32_t ring_buffer_page_count; /* * send to parent */ @@ -312,6 +305,10 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv2; void *hv_chan_priv3; + void *ch_bufring; /* TX+RX bufrings */ + struct hyperv_dma ch_bufring_dma; + uint32_t ch_bufring_gpadl; + struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_t ch_subidx; /* subchan index */ Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:40:34 2016 (r302871) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:51:58 2016 (r302872) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -202,7 +203,7 @@ hv_vmbus_channel_open( struct vmbus_msghc *mh; uint32_t status; int ret = 0; - void *in, *out; + uint8_t *br; if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, @@ -210,6 +211,10 @@ hv_vmbus_channel_open( user_data_len, new_channel->ch_id); return EINVAL; } + KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + ("send bufring size is not multiple page")); + KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + ("recv bufring size is not multiple page")); if (atomic_testandset_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) @@ -230,46 +235,43 @@ hv_vmbus_channel_open( vmbus_chan_task_nobatch, new_channel); } - /* Allocate the ring buffer */ - out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), - M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - KASSERT(out != NULL, - ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) { + /* + * Allocate the TX+RX bufrings. + * XXX should use ch_dev dtag + */ + br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, send_ring_buffer_size + recv_ring_buffer_size, + &new_channel->ch_bufring_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (br == NULL) { + device_printf(sc->vmbus_dev, "bufring allocation failed\n"); ret = ENOMEM; goto failed; } + new_channel->ch_bufring = br; - in = ((uint8_t *) out + send_ring_buffer_size); - - new_channel->ring_buffer_pages = out; - new_channel->ring_buffer_page_count = (send_ring_buffer_size + - recv_ring_buffer_size) >> PAGE_SHIFT; - new_channel->ring_buffer_size = send_ring_buffer_size + - recv_ring_buffer_size; - - hv_vmbus_ring_buffer_init( - &new_channel->outbound, - out, - send_ring_buffer_size); - - hv_vmbus_ring_buffer_init( - &new_channel->inbound, - in, - recv_ring_buffer_size); + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(&new_channel->outbound, + br, send_ring_buffer_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(&new_channel->inbound, + br + send_ring_buffer_size, recv_ring_buffer_size); /* Create sysctl tree for this channel */ vmbus_channel_sysctl_create(new_channel); - /** - * Establish the gpadl for the ring buffer + /* + * Connect the bufrings, both RX and TX, to this channel. */ - new_channel->ring_buffer_gpadl_handle = 0; - - ret = hv_vmbus_channel_establish_gpadl(new_channel, - new_channel->outbound.ring_buffer, + ret = vmbus_chan_gpadl_connect(new_channel, + new_channel->ch_bufring_dma.hv_paddr, send_ring_buffer_size + recv_ring_buffer_size, - &new_channel->ring_buffer_gpadl_handle); + &new_channel->ch_bufring_gpadl); + if (ret != 0) { + device_printf(sc->vmbus_dev, + "failed to connect bufring GPADL to chan%u\n", + new_channel->ch_id); + goto failed; + } /* * Open channel w/ the bufring GPADL on the target CPU. @@ -287,7 +289,7 @@ hv_vmbus_channel_open( req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; req->chm_chanid = new_channel->ch_id; req->chm_openid = new_channel->ch_id; - req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; + req->chm_gpadl = new_channel->ch_bufring_gpadl; req->chm_vcpuid = new_channel->target_vcpu; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) @@ -321,6 +323,16 @@ hv_vmbus_channel_open( ret = ENXIO; failed: + if (new_channel->ch_bufring_gpadl) { + hv_vmbus_channel_teardown_gpdal(new_channel, + new_channel->ch_bufring_gpadl); + new_channel->ch_bufring_gpadl = 0; + } + if (new_channel->ch_bufring != NULL) { + hyperv_dmamem_free(&new_channel->ch_bufring_dma, + new_channel->ch_bufring); + new_channel->ch_bufring = NULL; + } atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); return ret; } @@ -554,9 +566,10 @@ hv_vmbus_channel_close_internal(hv_vmbus } /* Tear down the gpadl for the channel's ring buffer */ - if (channel->ring_buffer_gpadl_handle) { + if (channel->ch_bufring_gpadl) { hv_vmbus_channel_teardown_gpdal(channel, - channel->ring_buffer_gpadl_handle); + channel->ch_bufring_gpadl); + channel->ch_bufring_gpadl = 0; } /* TODO: Send a msg to release the childRelId */ @@ -565,8 +578,11 @@ hv_vmbus_channel_close_internal(hv_vmbus hv_ring_buffer_cleanup(&channel->outbound); hv_ring_buffer_cleanup(&channel->inbound); - contigfree(channel->ring_buffer_pages, channel->ring_buffer_size, - M_DEVBUF); + if (channel->ch_bufring != NULL) { + hyperv_dmamem_free(&channel->ch_bufring_dma, + channel->ch_bufring); + channel->ch_bufring = NULL; + } } /* From owner-svn-src-head@freebsd.org Fri Jul 15 05:57:14 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AFCDB99AEF; Fri, 15 Jul 2016 05:57:14 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22AAA15D7; Fri, 15 Jul 2016 05:57:14 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x22d.google.com with SMTP id ks6so36108941pab.0; Thu, 14 Jul 2016 22:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=LUocLKHnfWUf4ZICol7LUpZP+tSvdN/+II9onM4pWbM=; b=wL8ZTxxXDWp3OJfn0d3JYAoOXO7YkdijnIQ9xsj0N7pPHa0WXdoEoTHKFwqwLDbixt cPBXi6bMAYe2LJwV0JJy+mKzAbM+QUTbtCY5eAG/AYG+QYoiPsGs+puZP09Ki8f50Sy7 sC6H05VVRPs7WrKzInnBPNubQr2ghbRA9ODHkmzsfRGK9cTRymhpywJnWy5gaLMEsNyG ZZGy1XtPnhQYJCoLOjQGpDMLkMFDt9FxKeFtxPyihe9uPeR2C5aVjfpE1rdVVsrWOkEW 9xSOjnS8ml5xwc3LlpzGtOGnPAt4en0Ai1NXTE6tYKVN9HvXIo9+k856GKggZM8YyXja 1/0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=LUocLKHnfWUf4ZICol7LUpZP+tSvdN/+II9onM4pWbM=; b=dG5OJH3bqhxmJuD/fP/x4TGT7OA01anWHKRvtdjIJ8wrpCqk5GNqNeHdyZ4MogYkPS sS0gpGM/tWAVIZlIdWGRoINwO3VNS4Qq3WHfcWi+kVOY/lwcjYwqOn9CuPOqaBUOtp4e /XRFKj4pXrVAlSQxIMlYYvEsYzK0iGFkXKCzMI3Bw7X54IuRKy9WnbqEiWje5UKENPIL ohFphFmW4PYMXGUpd8a3GDKhK1r42rMDC/zQjPWEMrkC4ebdWiL5r+dnkoeS8tgZ7kam d1jU2+IyghdcJ7Co9OFNI2RDjn879vd8DH31j/0CUuYPGO6be+OdDqLKCU5H/6xJto2D CAyw== X-Gm-Message-State: ALyK8tJEsUnIUqdvFsrwG+v23mKFrDjZMS7gIYKVds5hkIpdlwx/ri80SABClHPBEpSr5Q== X-Received: by 10.66.227.194 with SMTP id sc2mr28789613pac.120.1468562233142; Thu, 14 Jul 2016 22:57:13 -0700 (PDT) Received: from [29.136.107.169] ([172.58.40.223]) by smtp.gmail.com with ESMTPSA id xs12sm1189068pac.7.2016.07.14.22.57.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jul 2016 22:57:12 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r302865 - head From: Ngie Cooper X-Mailer: iPhone Mail (13F69) In-Reply-To: <201607150443.u6F4hcan060828@repo.freebsd.org> Date: Thu, 14 Jul 2016 22:57:11 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4FF7F120-4379-41EC-9664-3B13710341CB@gmail.com> References: <201607150443.u6F4hcan060828@repo.freebsd.org> To: Cy Schubert X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:57:14 -0000 > On Jul 14, 2016, at 21:43, Cy Schubert wrote: >=20 > Author: cy > Date: Fri Jul 15 04:43:38 2016 > New Revision: 302865 > URL: https://svnweb.freebsd.org/changeset/base/302865 >=20 > Log: > When building multiple kernels using KERNCONF, non-existent KERNCONF > files will produce an error and buildkernel will fail. Previously missing= > KERNCONF files silently failed giving no indication as to why, only to > subsequently discover during installkernel that the desired kernel was > never built in the first place. >=20 > Reviewed by: ngie@ > MFC after: 1 week > Differential Revision: D7167 Relnotes: yes > Modified: > head/Makefile.inc1 >=20 > Modified: head/Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/Makefile.inc1 Fri Jul 15 04:42:08 2016 (r302864) > +++ head/Makefile.inc1 Fri Jul 15 04:43:38 2016 (r302865) > @@ -1140,6 +1140,8 @@ BUILDKERNELS+=3D ${_kernel} > .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) > INSTALLKERNEL=3D ${_kernel} > .endif > +.else > +.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} > .endif > .endfor >=20 >=20 From owner-svn-src-head@freebsd.org Fri Jul 15 05:59:28 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A14F7B99C1A; Fri, 15 Jul 2016 05:59:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E234177A; Fri, 15 Jul 2016 05:59:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F5xR6G086872; Fri, 15 Jul 2016 05:59:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F5xR9Y086869; Fri, 15 Jul 2016 05:59:27 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150559.u6F5xR9Y086869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 05:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302873 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 05:59:28 -0000 Author: sephe Date: Fri Jul 15 05:59:27 2016 New Revision: 302873 URL: https://svnweb.freebsd.org/changeset/base/302873 Log: hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist. Mainly for compatibility. While I'm here, rename cpuid related fields in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7141 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:51:58 2016 (r302872) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:59:27 2016 (r302873) @@ -274,16 +274,13 @@ typedef struct hv_vmbus_channel { struct hyperv_mon_param *ch_monprm; struct hyperv_dma ch_monprm_dma; + int ch_cpuid; /* owner cpu */ /* - * From Win8, this field specifies the target virtual process - * on which to deliver the interrupt from the host to guest. - * Before Win8, all channel interrupts would only be - * delivered on cpu 0. Setting this value to 0 would preserve - * the earlier behavior. + * Virtual cpuid for ch_cpuid; it is used to communicate cpuid + * related information w/ Hyper-V. If MSR_HV_VP_INDEX does not + * exist, ch_vcpuid will always be 0 for compatibility. */ - uint32_t target_vcpu; - /* The corresponding CPUID in the guest */ - uint32_t target_cpu; + uint32_t ch_vcpuid; /* * If this is a primary channel, ch_subchan* fields Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:51:58 2016 (r302872) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:59:27 2016 (r302873) @@ -157,7 +157,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha &channel->ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); + "cpu", CTLFLAG_RD, &channel->ch_cpuid, 0, "owner CPU id"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, channel, 0, vmbus_channel_sysctl_monalloc, "I", @@ -226,7 +226,7 @@ hv_vmbus_channel_open( vmbus_chan_update_evtflagcnt(sc, new_channel); new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, - new_channel->target_cpu); + new_channel->ch_cpuid); if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { TASK_INIT(&new_channel->channel_task, 0, vmbus_chan_task, new_channel); @@ -290,7 +290,7 @@ hv_vmbus_channel_open( req->chm_chanid = new_channel->ch_id; req->chm_openid = new_channel->ch_id; req->chm_gpadl = new_channel->ch_bufring_gpadl; - req->chm_vcpuid = new_channel->target_vcpu; + req->chm_vcpuid = new_channel->ch_vcpuid; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) memcpy(req->chm_udata, user_data, user_data_len); @@ -1005,7 +1005,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu int flag_cnt; flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid); for (;;) { int old_flag_cnt; @@ -1017,8 +1017,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu if (bootverbose) { device_printf(sc->vmbus_dev, "channel%u update cpu%d flag_cnt to %d\n", - chan->ch_id, - chan->target_cpu, flag_cnt); + chan->ch_id, chan->ch_cpuid, flag_cnt); } break; } @@ -1162,13 +1161,12 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch cpu = 0; } - chan->target_cpu = cpu; - chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + chan->ch_cpuid = cpu; + chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", - chan->ch_id, - chan->target_cpu, chan->target_vcpu); + chan->ch_id, chan->ch_cpuid, chan->ch_vcpuid); } } @@ -1401,17 +1399,17 @@ vmbus_select_outgoing_channel(struct hv_ continue; } - if (new_channel->target_vcpu == cur_vcpu){ + if (new_channel->ch_vcpuid == cur_vcpu){ return new_channel; } - old_cpu_distance = ((outgoing_channel->target_vcpu > cur_vcpu) ? - (outgoing_channel->target_vcpu - cur_vcpu) : - (cur_vcpu - outgoing_channel->target_vcpu)); - - new_cpu_distance = ((new_channel->target_vcpu > cur_vcpu) ? - (new_channel->target_vcpu - cur_vcpu) : - (cur_vcpu - new_channel->target_vcpu)); + old_cpu_distance = ((outgoing_channel->ch_vcpuid > cur_vcpu) ? + (outgoing_channel->ch_vcpuid - cur_vcpu) : + (cur_vcpu - outgoing_channel->ch_vcpuid)); + + new_cpu_distance = ((new_channel->ch_vcpuid > cur_vcpu) ? + (new_channel->ch_vcpuid - cur_vcpu) : + (cur_vcpu - new_channel->ch_vcpuid)); if (old_cpu_distance < new_cpu_distance) { continue; Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 05:51:58 2016 (r302872) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 15 05:59:27 2016 (r302873) @@ -726,19 +726,11 @@ vmbus_synic_setup(void *xsc) uint32_t sint; if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { - /* - * Save virtual processor id. - */ + /* Save virtual processor id. */ VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); } else { - /* - * XXX - * Virtual processoor id is only used by a pretty broken - * channel selection code from storvsc. It's nothing - * critical even if CPUID_HV_MSR_VP_INDEX is not set; keep - * moving on. - */ - VMBUS_PCPU_GET(sc, vcpuid, cpu) = cpu; + /* Set virtual processor id to 0 for compatibility. */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = 0; } /* From owner-svn-src-head@freebsd.org Fri Jul 15 06:08:49 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2C2BB99E46; Fri, 15 Jul 2016 06:08:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DEAF1CC8; Fri, 15 Jul 2016 06:08:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F68mGB090858; Fri, 15 Jul 2016 06:08:48 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F68mTZ090856; Fri, 15 Jul 2016 06:08:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150608.u6F68mTZ090856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302874 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:08:49 -0000 Author: sephe Date: Fri Jul 15 06:08:48 2016 New Revision: 302874 URL: https://svnweb.freebsd.org/changeset/base/302874 Log: hyperv/vmbus: Field rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7146 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 05:59:27 2016 (r302873) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:08:48 2016 (r302874) @@ -242,7 +242,7 @@ typedef struct { uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; -typedef void (*hv_vmbus_pfn_channel_callback)(void *context); +typedef void (*vmbus_chan_callback_t)(void *); typedef struct hv_vmbus_channel { device_t ch_dev; @@ -266,10 +266,10 @@ typedef struct hv_vmbus_channel { */ hv_vmbus_ring_buffer_info inbound; - struct taskqueue * rxq; - struct task channel_task; - hv_vmbus_pfn_channel_callback on_channel_callback; - void* channel_callback_context; + struct taskqueue *ch_tq; + struct task ch_task; + vmbus_chan_callback_t ch_cb; + void *ch_cbarg; struct hyperv_mon_param *ch_monprm; struct hyperv_dma ch_monprm_dma; @@ -362,9 +362,8 @@ int hv_vmbus_channel_open( uint32_t recv_ring_buffer_size, void* user_data, uint32_t user_data_len, - hv_vmbus_pfn_channel_callback - pfn_on_channel_callback, - void* context); + vmbus_chan_callback_t cb, + void *cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 05:59:27 2016 (r302873) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:08:48 2016 (r302874) @@ -193,8 +193,8 @@ hv_vmbus_channel_open( uint32_t recv_ring_buffer_size, void* user_data, uint32_t user_data_len, - hv_vmbus_pfn_channel_callback pfn_on_channel_callback, - void* context) + vmbus_chan_callback_t cb, + void *cbarg) { struct vmbus_softc *sc = new_channel->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; @@ -220,19 +220,19 @@ hv_vmbus_channel_open( VMBUS_CHAN_ST_OPENED_SHIFT)) panic("double-open chan%u", new_channel->ch_id); - new_channel->on_channel_callback = pfn_on_channel_callback; - new_channel->channel_callback_context = context; + new_channel->ch_cb = cb; + new_channel->ch_cbarg = cbarg; vmbus_chan_update_evtflagcnt(sc, new_channel); - new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, + new_channel->ch_tq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, new_channel->ch_cpuid); if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task, + new_channel); } else { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task_nobatch, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, + new_channel); } /* @@ -521,7 +521,7 @@ hv_vmbus_channel_close_internal(hv_vmbus struct vmbus_softc *sc = channel->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *rxq = channel->rxq; + struct taskqueue *tq = channel->ch_tq; int error; /* TODO: stringent check */ @@ -530,11 +530,11 @@ hv_vmbus_channel_close_internal(hv_vmbus sysctl_ctx_free(&channel->ch_sysctl_ctx); /* - * set rxq to NULL to avoid more requests be scheduled + * Set ch_tq to NULL to avoid more requests be scheduled */ - channel->rxq = NULL; - taskqueue_drain(rxq, &channel->channel_task); - channel->on_channel_callback = NULL; + channel->ch_tq = NULL; + taskqueue_drain(tq, &channel->ch_task); + channel->ch_cb = NULL; /** * Send a closing message @@ -895,11 +895,8 @@ static void vmbus_chan_task(void *xchan, int pending __unused) { struct hv_vmbus_channel *chan = xchan; - void (*callback)(void *); - void *arg; - - arg = chan->channel_callback_context; - callback = chan->on_channel_callback; + vmbus_chan_callback_t cb = chan->ch_cb; + void *cbarg = chan->ch_cbarg; /* * Optimize host to guest signaling by ensuring: @@ -916,7 +913,7 @@ vmbus_chan_task(void *xchan, int pending for (;;) { uint32_t left; - callback(arg); + cb(cbarg); left = hv_ring_buffer_read_end(&chan->inbound); if (left == 0) { @@ -932,7 +929,7 @@ vmbus_chan_task_nobatch(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - chan->on_channel_callback(chan->channel_callback_context); + chan->ch_cb(chan->ch_cbarg); } static __inline void @@ -961,12 +958,12 @@ vmbus_event_flags_proc(struct vmbus_soft channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ - if (channel == NULL || channel->rxq == NULL) + if (channel == NULL || channel->ch_tq == NULL) continue; if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) hv_ring_buffer_read_begin(&channel->inbound); - taskqueue_enqueue(channel->rxq, &channel->channel_task); + taskqueue_enqueue(channel->ch_tq, &channel->ch_task); } } } From owner-svn-src-head@freebsd.org Fri Jul 15 06:16:41 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33789B9911E; Fri, 15 Jul 2016 06:16:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA38113DC; Fri, 15 Jul 2016 06:16:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6GePK094393; Fri, 15 Jul 2016 06:16:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6GeRL094391; Fri, 15 Jul 2016 06:16:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150616.u6F6GeRL094391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302875 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:16:41 -0000 Author: sephe Date: Fri Jul 15 06:16:39 2016 New Revision: 302875 URL: https://svnweb.freebsd.org/changeset/base/302875 Log: hyperv/vmbus: Redefine channel packet. The channel packet header will be shared w/ PRP (physical region page) list channel packet and SG (scatter gather) list channel packet. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7155 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:08:48 2016 (r302874) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:16:39 2016 (r302875) @@ -634,27 +634,28 @@ hv_vmbus_channel_send_packet( uint32_t flags) { int ret = 0; - hv_vm_packet_descriptor desc; + struct vmbus_chanpkt pkt; uint32_t packet_len; uint64_t aligned_data; uint32_t packet_len_aligned; boolean_t need_sig; struct iovec iov[3]; - packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; - packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); + packet_len = sizeof(pkt) + buffer_len; + packet_len_aligned = roundup2(packet_len, VMBUS_CHANPKT_SIZE_ALIGN); aligned_data = 0; - /* Setup the descriptor */ - desc.type = type; /* HV_VMBUS_PACKET_TYPE_DATA_IN_BAND; */ - desc.flags = flags; /* HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED */ - /* in 8-bytes granularity */ - desc.data_offset8 = sizeof(hv_vm_packet_descriptor) >> 3; - desc.length8 = (uint16_t) (packet_len_aligned >> 3); - desc.transaction_id = request_id; + /* + * Setup channel packet. + */ + pkt.cp_hdr.cph_type = type; + pkt.cp_hdr.cph_flags = flags; + pkt.cp_hdr.cph_data_ofs = sizeof(pkt) >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = packet_len_aligned >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = request_id; - iov[0].iov_base = &desc; - iov[0].iov_len = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); iov[1].iov_base = buffer; iov[1].iov_len = buffer_len; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:08:48 2016 (r302874) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:16:39 2016 (r302875) @@ -117,6 +117,25 @@ struct vmbus_gpa_range { } __packed; /* + * Channel packets + */ + +#define VMBUS_CHANPKT_SIZE_SHIFT 3 +#define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) + +struct vmbus_chanpkt_hdr { + uint16_t cph_type; + uint16_t cph_data_ofs; /* in 8 bytes */ + uint16_t cph_len; /* in 8 bytes */ + uint16_t cph_flags; + uint64_t cph_xactid; +} __packed; + +struct vmbus_chanpkt { + struct vmbus_chanpkt_hdr cp_hdr; +} __packed; + +/* * Channel messages * - Embedded in vmbus_message.msg_data, e.g. response and notification. * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. From owner-svn-src-head@freebsd.org Fri Jul 15 06:19:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C788B991D1; Fri, 15 Jul 2016 06:19:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 8D936164F; Fri, 15 Jul 2016 06:19:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r302324 - head/lib/libc/locale To: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607031500.u63F0Cr8099783@repo.freebsd.org> From: Jung-uk Kim Message-ID: <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> Date: Fri, 15 Jul 2016 02:19:41 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607031500.u63F0Cr8099783@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8VKp8BQbf4tFP5btmwxJdRNMnbIePo5V8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:19:48 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8VKp8BQbf4tFP5btmwxJdRNMnbIePo5V8 Content-Type: multipart/mixed; boundary="72V63sDQJTrPap2BWubo39vqeOPrXWKp0" From: Jung-uk Kim To: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> Subject: Re: svn commit: r302324 - head/lib/libc/locale References: <201607031500.u63F0Cr8099783@repo.freebsd.org> In-Reply-To: <201607031500.u63F0Cr8099783@repo.freebsd.org> --72V63sDQJTrPap2BWubo39vqeOPrXWKp0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/03/16 11:00 AM, Baptiste Daroussin wrote: > Author: bapt > Date: Sun Jul 3 15:00:12 2016 > New Revision: 302324 > URL: https://svnweb.freebsd.org/changeset/base/302324 >=20 > Log: > Fix a bad test resulting in a segfault with ISO-8859-5 locales > =20 > Reported by: Lauri Tirkkonen from Illumos > Approved by: re@ (gjb) >=20 > Modified: > head/lib/libc/locale/collate.c >=20 > Modified: head/lib/libc/locale/collate.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 (r302323) > +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 (r302324) > @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * > if ((sptr =3D *state) !=3D NULL) { > *pri =3D *sptr; > sptr++; > - if ((sptr =3D=3D *state) || (sptr =3D=3D NULL)) > + if ((sptr =3D=3D *state) || (*sptr =3D=3D 0)) > *state =3D NULL; > else > *state =3D sptr; I had a serious regression with ko_KR.UTF-8 locale after this commit. MATE is unusable because mate-panel is busy looping and eating 100% CPU. GNOME 3 does not start at all, i.e., nothing but mouse cursor on black screen. After reverting this commit, everything is back to normal. Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. Thanks, Jung-uk Kim --72V63sDQJTrPap2BWubo39vqeOPrXWKp0-- --8VKp8BQbf4tFP5btmwxJdRNMnbIePo5V8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXiICDAAoJEHyflib82/FGeagH/RdAwND1dtvbvXCGhO6R5aB8 fR5DE7AxSNJSxcKMGRTL8U+d5nxymLziJboZUZxZPp38UvCu1V17r4kJD5ZOtq9D UgNd3VdZ+OOdVl5hGhZugTNpZe6JUrnILVcMpQN13XvqnTi621Q8LpsmHPDojxWA 8lJNUjeHT5hLD7Le+Yq3me/xiNGrIFk5HvijBtUuQzr5eYvjc9Tm/a/afpXoGrdW /MbJ2IMd8UKwSfW+ALWiJqI8H9NJB76dRG0FjF8/mFtI7nCKm9F1uXx5eYk/rMVO tAslCF7ErJGiAUi90ArfoXCJghO71LNYAqlrGyUTg8ENX7yZtYsAVAjNWdgxPR0= =Hksi -----END PGP SIGNATURE----- --8VKp8BQbf4tFP5btmwxJdRNMnbIePo5V8-- From owner-svn-src-head@freebsd.org Fri Jul 15 06:22:27 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55651B99399; Fri, 15 Jul 2016 06:22:27 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E66E1A9B; Fri, 15 Jul 2016 06:22:27 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id y134so12047196pfg.0; Thu, 14 Jul 2016 23:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:reply-to:subject:references:to:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=WI996//FBc68HO5TG8ovMAx4SIkWLZCHYndewP7jB9M=; b=Fr0xawFiJVtqPaYveM4BwnoEN0va55kZCGNU2UQh2cGcsRIIIJCiy1Ljjq96sQkrAA sY8zpkj6u+VHHbwkvZ7yvjxSy+ptULOEzwMvSxSg1A2w4wEeSpJENux8VJ+ajJFROCl8 nFibnCQoN9U47E2jgtSq0MeuwSA0k6x+ohtkth+8nm44b/gXHOdPrrCQF9Prn+slKk++ JY3V8Y2SvUsqS3LyILWJyvfC3OLO5daytLDdlJq9aLYL2jCc2koTUoKN62obXvpJdB4r bA9HmI8UfXjTe4rL04TrtfCVMNUkCE30g6RYWnRjpsUinnwzpIak4tBWkd2xdBJKWmOg /WKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:reply-to:subject:references:to:cc:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=WI996//FBc68HO5TG8ovMAx4SIkWLZCHYndewP7jB9M=; b=fUoe1n3hk3o3SP/atmd+ew40zMeQBFY1m8rb5vQtcm6AENmltqhnmZe31RG9IS5jwr K+68XSJP4jpwoIwaWFNQzUE9ZzcXuE9cDup0OZ/zer7/HTBwd8l2Tj0Dn8swMkk77LrG NqEc6JPd08wjgaZjXI54hxwXof7NO9mEioybpZuUiwi4OJpNPAiUoxl0PNN51T2oIvh3 pNxEQAr7ZiX4QfR2BhRGScpsEyEj2dtIHo3xRccNA/ELElw5sbPkRWW9viAcwR6oMCT7 MmyiaZTZFSbjoyJOImcsnwkS7EKhIpkiyHbMvc4gwpVECd6a42id4/XVCaxXo5HYXzYm Kl5w== X-Gm-Message-State: ALyK8tJOR04JYXUMTIBY4rLAtr16fpqJfkUYE7xy+qFrO4uk4LRe8EGovgelgxE50dgf+w== X-Received: by 10.98.158.218 with SMTP id f87mr18868424pfk.121.1468563745829; Thu, 14 Jul 2016 23:22:25 -0700 (PDT) Received: from ?IPv6:2001:44b8:31ae:7b01:f985:3c4b:2a0c:8bea? (2001-44b8-31ae-7b01-f985-3c4b-2a0c-8bea.static.ipv6.internode.on.net. [2001:44b8:31ae:7b01:f985:3c4b:2a0c:8bea]) by smtp.gmail.com with ESMTPSA id s12sm6858775pfj.57.2016.07.14.23.22.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 23:22:25 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r302324 - head/lib/libc/locale References: <201607031500.u63F0Cr8099783@repo.freebsd.org> <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> To: Jung-uk Kim , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: Baptiste Daroussin From: Kubilay Kocak Message-ID: <677f087c-1270-8435-83c7-a240ed2599b2@FreeBSD.org> Date: Fri, 15 Jul 2016 16:22:19 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Thunderbird/47.0 MIME-Version: 1.0 In-Reply-To: <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:22:27 -0000 On 15/07/2016 4:19 PM, Jung-uk Kim wrote: > On 07/03/16 11:00 AM, Baptiste Daroussin wrote: >> Author: bapt >> Date: Sun Jul 3 15:00:12 2016 >> New Revision: 302324 >> URL: https://svnweb.freebsd.org/changeset/base/302324 >> >> Log: >> Fix a bad test resulting in a segfault with ISO-8859-5 locales >> >> Reported by: Lauri Tirkkonen from Illumos >> Approved by: re@ (gjb) >> >> Modified: >> head/lib/libc/locale/collate.c >> >> Modified: head/lib/libc/locale/collate.c >> ============================================================================== >> --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 (r302323) >> +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 (r302324) >> @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * >> if ((sptr = *state) != NULL) { >> *pri = *sptr; >> sptr++; >> - if ((sptr == *state) || (sptr == NULL)) >> + if ((sptr == *state) || (*sptr == 0)) >> *state = NULL; >> else >> *state = sptr; > > I had a serious regression with ko_KR.UTF-8 locale after this commit. > MATE is unusable because mate-panel is busy looping and eating 100% CPU. > GNOME 3 does not start at all, i.e., nothing but mouse cursor on black > screen. After reverting this commit, everything is back to normal. > Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. > > Thanks, > > Jung-uk Kim > Please report a bug so it can be tracked and not forgotten: Add re@ and original committer to cc Set mfc-stable11 to ? Add keyword: regression From owner-svn-src-head@freebsd.org Fri Jul 15 06:29:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73BE9B9947E; Fri, 15 Jul 2016 06:29:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FEEA1D51; Fri, 15 Jul 2016 06:29:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6TKWG098108; Fri, 15 Jul 2016 06:29:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6TJOG098098; Fri, 15 Jul 2016 06:29:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150629.u6F6TJOG098098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302876 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:29:21 -0000 Author: sephe Date: Fri Jul 15 06:29:19 2016 New Revision: 302876 URL: https://svnweb.freebsd.org/changeset/base/302876 Log: hyperv/vmbus: Rework sglist sending. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7156 Added: head/sys/dev/hyperv/include/vmbus.h (contents, props changed) Modified: head/sys/dev/hyperv/include/hyperv.h 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/hv_rndis_filter.h head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:29:19 2016 (r302876) @@ -82,7 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) -#define HV_MAX_PAGE_BUFFER_COUNT 32 #define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 #define HV_ALIGN_UP(value, align) \ @@ -227,12 +226,6 @@ typedef struct { typedef struct { int length; int offset; - uint64_t pfn; -} __packed hv_vmbus_page_buffer; - -typedef struct { - int length; - int offset; uint64_t pfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT]; } __packed hv_vmbus_multipage_buffer; @@ -375,14 +368,6 @@ int hv_vmbus_channel_send_packet( hv_vmbus_packet_type type, uint32_t flags); -int hv_vmbus_channel_send_packet_pagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_page_buffer page_buffers[], - uint32_t page_count, - void* buffer, - uint32_t buffer_len, - uint64_t request_id); - int hv_vmbus_channel_send_packet_multipagebuffer( hv_vmbus_channel* channel, hv_vmbus_multipage_buffer* multi_page_buffer, Added: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:29:19 2016 (r302876) @@ -0,0 +1,49 @@ +/*- + * 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_H_ +#define _VMBUS_H_ + +#include + +/* This is actually vmbus_gpa_range.gpa_page[1] */ +struct vmbus_gpa { + uint32_t gpa_len; + uint32_t gpa_ofs; + uint64_t gpa_page; +} __packed; + +#define VMBUS_CHAN_SGLIST_MAX 32 + +struct hv_vmbus_channel; + +int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, + uint64_t xactid); + +#endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:29:19 2016 (r302876) @@ -816,9 +816,8 @@ hv_nv_on_send(struct hv_vmbus_channel *c send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size = pkt->send_buf_section_size; - if (pkt->page_buf_count) { - ret = hv_vmbus_channel_send_packet_pagebuffer(chan, - pkt->page_buffers, pkt->page_buf_count, + if (pkt->gpa_cnt) { + ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } else { ret = hv_vmbus_channel_send_packet(chan, Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Jul 15 06:29:19 2016 (r302876) @@ -57,6 +57,7 @@ #include #include +#include #define HN_USE_TXDESC_BUFRING @@ -1082,8 +1083,6 @@ struct hv_vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) -#define NETVSC_PACKET_MAXPAGE 32 - #define NETVSC_VLAN_PRIO_MASK 0xe000 #define NETVSC_VLAN_PRIO_SHIFT 13 @@ -1132,8 +1131,8 @@ typedef struct netvsc_packet_ { void *rndis_mesg; uint32_t tot_data_buf_len; void *data; - uint32_t page_buf_count; - hv_vmbus_page_buffer page_buffers[NETVSC_PACKET_MAXPAGE]; + uint32_t gpa_cnt; + struct vmbus_gpa gpa[VMBUS_CHAN_SGLIST_MAX]; } netvsc_packet; typedef struct { Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 06:29:19 2016 (r302876) @@ -154,7 +154,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE #define HN_TX_DATA_SEGCNT_MAX \ - (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) + (VMBUS_CHAN_SGLIST_MAX - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) #define HN_DIRECT_TX_SIZE_DEF 128 @@ -998,7 +998,7 @@ hn_encap(struct hn_tx_ring *txr, struct packet->send_buf_section_idx = send_buf_section_idx; packet->send_buf_section_size = packet->tot_data_buf_len; - packet->page_buf_count = 0; + packet->gpa_cnt = 0; txr->hn_tx_chimney++; goto done; } @@ -1024,24 +1024,24 @@ hn_encap(struct hn_tx_ring *txr, struct } *m_head0 = m_head; - packet->page_buf_count = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; + packet->gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; /* send packet with page buffer */ - packet->page_buffers[0].pfn = atop(txd->rndis_msg_paddr); - packet->page_buffers[0].offset = txd->rndis_msg_paddr & PAGE_MASK; - packet->page_buffers[0].length = rndis_msg_size; + packet->gpa[0].gpa_page = atop(txd->rndis_msg_paddr); + packet->gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; + packet->gpa[0].gpa_len = rndis_msg_size; /* * Fill the page buffers with mbuf info starting at index * HV_RF_NUM_TX_RESERVED_PAGE_BUFS. */ for (i = 0; i < nsegs; ++i) { - hv_vmbus_page_buffer *pb = &packet->page_buffers[ + struct vmbus_gpa *gpa = &packet->gpa[ i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; - pb->pfn = atop(segs[i].ds_addr); - pb->offset = segs[i].ds_addr & PAGE_MASK; - pb->length = segs[i].ds_len; + gpa->gpa_page = atop(segs[i].ds_addr); + gpa->gpa_ofs = segs[i].ds_addr & PAGE_MASK; + gpa->gpa_len = segs[i].ds_len; } packet->send_buf_section_idx = Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:29:19 2016 (r302876) @@ -248,26 +248,23 @@ hv_rf_send_request(rndis_device *device, packet->is_data_pkt = FALSE; packet->tot_data_buf_len = request->request_msg.msg_len; - packet->page_buf_count = 1; + packet->gpa_cnt = 1; - packet->page_buffers[0].pfn = + packet->gpa[0].gpa_page = hv_get_phys_addr(&request->request_msg) >> PAGE_SHIFT; - packet->page_buffers[0].length = request->request_msg.msg_len; - packet->page_buffers[0].offset = + packet->gpa[0].gpa_len = request->request_msg.msg_len; + packet->gpa[0].gpa_ofs = (unsigned long)&request->request_msg & (PAGE_SIZE - 1); - if (packet->page_buffers[0].offset + - packet->page_buffers[0].length > PAGE_SIZE) { - packet->page_buf_count = 2; - packet->page_buffers[0].length = - PAGE_SIZE - packet->page_buffers[0].offset; - packet->page_buffers[1].pfn = + if (packet->gpa[0].gpa_ofs + packet->gpa[0].gpa_len > PAGE_SIZE) { + packet->gpa_cnt = 2; + packet->gpa[0].gpa_len = PAGE_SIZE - packet->gpa[0].gpa_ofs; + packet->gpa[1].gpa_page = hv_get_phys_addr((char*)&request->request_msg + - packet->page_buffers[0].length) >> PAGE_SHIFT; - packet->page_buffers[1].offset = 0; - packet->page_buffers[1].length = - request->request_msg.msg_len - - packet->page_buffers[0].length; + packet->gpa[0].gpa_len) >> PAGE_SHIFT; + packet->gpa[1].gpa_ofs = 0; + packet->gpa[1].gpa_len = request->request_msg.msg_len - + packet->gpa[0].gpa_len; } packet->compl.send.send_completion_context = request; /* packet */ @@ -289,7 +286,7 @@ hv_rf_send_request(rndis_device *device, memcpy(dest, &request->request_msg, request->request_msg.msg_len); packet->send_buf_section_idx = send_buf_section_idx; packet->send_buf_section_size = packet->tot_data_buf_len; - packet->page_buf_count = 0; + packet->gpa_cnt = 0; goto sendit; } /* Failed to allocate chimney send buffer; move on */ Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Fri Jul 15 06:29:19 2016 (r302876) @@ -74,7 +74,6 @@ typedef struct rndis_request_ { /* Simplify allocation by having a netvsc packet inline */ netvsc_packet pkt; - hv_vmbus_page_buffer buffer; /* * The max request size is sizeof(rndis_msg) + PAGE_SIZE. Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:29:19 2016 (r302876) @@ -672,70 +672,44 @@ hv_vmbus_channel_send_packet( return (ret); } -/** - * @brief Send a range of single-page buffer packets using - * a GPADL Direct packet type - */ int -hv_vmbus_channel_send_packet_pagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_page_buffer page_buffers[], - uint32_t page_count, - void* buffer, - uint32_t buffer_len, - uint64_t request_id) +vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid) { - - int ret = 0; - boolean_t need_sig; - uint32_t packet_len; - uint32_t page_buflen; - uint32_t packetLen_aligned; - struct iovec iov[4]; - hv_vmbus_channel_packet_page_buffer desc; - uint32_t descSize; - uint64_t alignedData = 0; - - if (page_count > HV_MAX_PAGE_BUFFER_COUNT) - return (EINVAL); - - /* - * Adjust the size down since hv_vmbus_channel_packet_page_buffer - * is the largest size we support - */ - descSize = __offsetof(hv_vmbus_channel_packet_page_buffer, range); - page_buflen = sizeof(hv_vmbus_page_buffer) * page_count; - packet_len = descSize + page_buflen + buffer_len; - packetLen_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); - - /* Setup the descriptor */ - desc.type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; - desc.flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; - /* in 8-bytes granularity */ - desc.data_offset8 = (descSize + page_buflen) >> 3; - desc.length8 = (uint16_t) (packetLen_aligned >> 3); - desc.transaction_id = request_id; - desc.range_count = page_count; - - iov[0].iov_base = &desc; - iov[0].iov_len = descSize; - - iov[1].iov_base = page_buffers; - iov[1].iov_len = page_buflen; - - iov[2].iov_base = buffer; - iov[2].iov_len = buffer_len; - - iov[3].iov_base = &alignedData; - iov[3].iov_len = packetLen_aligned - packet_len; - - ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_sig); - - /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) - vmbus_chan_send_event(channel); - - return (ret); + struct vmbus_chanpkt_sglist pkt; + int pktlen, pad_pktlen, hlen, error; + struct iovec iov[4]; + boolean_t send_evt; + uint64_t pad = 0; + + KASSERT(sglen < VMBUS_CHAN_SGLIST_MAX, + ("invalid sglist len %d", sglen)); + + hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); + pktlen = hlen + dlen; + pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + + pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; + pkt.cp_hdr.cph_flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; + pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = xactid; + pkt.cp_rsvd = 0; + pkt.cp_gpa_cnt = sglen; + + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); + iov[1].iov_base = sg; + iov[1].iov_len = sizeof(struct vmbus_gpa) * sglen; + iov[2].iov_base = data; + iov[2].iov_len = dlen; + iov[3].iov_base = &pad; + iov[3].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + if (!error && send_evt) + vmbus_chan_send_event(chan); + return error; } /** Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 06:29:19 2016 (r302876) @@ -44,20 +44,6 @@ struct vmbus_softc; /* * The format must be the same as hv_vm_data_gpa_direct */ -typedef struct hv_vmbus_channel_packet_page_buffer { - uint16_t type; - uint16_t data_offset8; - uint16_t length8; - uint16_t flags; - uint64_t transaction_id; - uint32_t reserved; - uint32_t range_count; - hv_vmbus_page_buffer range[HV_MAX_PAGE_BUFFER_COUNT]; -} __packed hv_vmbus_channel_packet_page_buffer; - -/* - * The format must be the same as hv_vm_data_gpa_direct - */ typedef struct hv_vmbus_channel_packet_multipage_buffer { uint16_t type; uint16_t data_offset8; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:16:39 2016 (r302875) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:29:19 2016 (r302876) @@ -30,8 +30,9 @@ #define _VMBUS_REG_H_ #include -#include #include /* XXX for hyperv_guid */ +#include +#include /* * Hyper-V SynIC message format. @@ -135,6 +136,13 @@ struct vmbus_chanpkt { struct vmbus_chanpkt_hdr cp_hdr; } __packed; +struct vmbus_chanpkt_sglist { + struct vmbus_chanpkt_hdr cp_hdr; + uint32_t cp_rsvd; + uint32_t cp_gpa_cnt; + struct vmbus_gpa cp_gpa[]; +} __packed; + /* * Channel messages * - Embedded in vmbus_message.msg_data, e.g. response and notification. From owner-svn-src-head@freebsd.org Fri Jul 15 06:39:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5CD4B997AD; Fri, 15 Jul 2016 06:39:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F38C1765; Fri, 15 Jul 2016 06:39:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6daVH001845; Fri, 15 Jul 2016 06:39:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6dZSV001837; Fri, 15 Jul 2016 06:39:35 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607150639.u6F6dZSV001837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 15 Jul 2016 06:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302877 - in head/sys/dev/ath: . ath_hal ath_hal/ar5212 ath_rate/sample X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:39:38 -0000 Author: adrian Date: Fri Jul 15 06:39:35 2016 New Revision: 302877 URL: https://svnweb.freebsd.org/changeset/base/302877 Log: [ath] [ath_hal] break out the duration calculation to optionally include SIFS. The pre-11n calculations include SIFS, but the 11n ones don't. The reason is that (mostly) the 11n hardware is doing the SIFS calculation for us but the pre-11n hardware isn't. This means that we're over-shooting the times in the duration field for non-11n frames on 11n hardware, which is OK, if not a little inefficient. Now, this is all fine for what the hardware needs for doing duration math for ACK, RTS/CTS, frame length, etc, but it isn't useful for doing PHY duration calculations. Ie, given a frame to TX and its timestamp, what would the end of the actual transmission time be; and similar for an RX timestamp and figuring out its original length. So, this adds a new field to the duration routines which requests SIFS or no SIFS to be included. All the callers currently will call it requesting SIFS, so this /should/ be a glorious no-op. I'm however planning some future work around airtime fairness and positioning which requires these routines to have SIFS be optional. Notably though, the 11n version doesn't do any SIFS addition at the moment. I'll go and tweak and verify all of the packet durations before I go and flip that part on. Tested: * AR9330, STA mode * AR9330, AP mode * AR9380, STA mode Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c head/sys/dev/ath/ath_rate/sample/sample.h head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tdma.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/ath_hal/ah.c Fri Jul 15 06:39:35 2016 (r302877) @@ -284,7 +284,8 @@ ath_hal_reverseBits(uint32_t val, uint32 */ uint32_t ath_hal_pkt_txtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, - uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble) + uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble, + HAL_BOOL includeSifs) { uint8_t rc; int numStreams; @@ -293,7 +294,8 @@ ath_hal_pkt_txtime(struct ath_hal *ah, c /* Legacy rate? Return the old way */ if (! IS_HT_RATE(rc)) - return ath_hal_computetxtime(ah, rates, frameLen, rateix, shortPreamble); + return ath_hal_computetxtime(ah, rates, frameLen, rateix, + shortPreamble, includeSifs); /* 11n frame - extract out the number of spatial streams */ numStreams = HT_RC_2_STREAMS(rc); @@ -301,7 +303,9 @@ ath_hal_pkt_txtime(struct ath_hal *ah, c ("number of spatial streams needs to be 1..3: MCS rate 0x%x!", rateix)); - return ath_computedur_ht(frameLen, rc, numStreams, isht40, shortPreamble); + /* XXX TODO: Add SIFS */ + return ath_computedur_ht(frameLen, rc, numStreams, isht40, + shortPreamble); } static const uint16_t ht20_bps[32] = { @@ -350,7 +354,7 @@ ath_computedur_ht(uint32_t frameLen, uin uint16_t ath_hal_computetxtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, uint16_t rateix, - HAL_BOOL shortPreamble) + HAL_BOOL shortPreamble, HAL_BOOL includeSifs) { uint32_t bitsPerSymbol, numBits, numSymbols, phyTime, txTime; uint32_t kbps; @@ -373,8 +377,10 @@ ath_hal_computetxtime(struct ath_hal *ah if (shortPreamble && rates->info[rateix].shortPreamble) phyTime >>= 1; numBits = frameLen << 3; - txTime = CCK_SIFS_TIME + phyTime + txTime = phyTime + ((numBits * 1000)/kbps); + if (includeSifs) + txTime += CCK_SIFS_TIME; break; case IEEE80211_T_OFDM: bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; @@ -382,9 +388,10 @@ ath_hal_computetxtime(struct ath_hal *ah numBits = OFDM_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME - + OFDM_PREAMBLE_TIME + txTime = OFDM_PREAMBLE_TIME + (numSymbols * OFDM_SYMBOL_TIME); + if (includeSifs) + txTime += OFDM_SIFS_TIME; break; case IEEE80211_T_OFDM_HALF: bitsPerSymbol = (kbps * OFDM_HALF_SYMBOL_TIME) / 1000; @@ -392,9 +399,10 @@ ath_hal_computetxtime(struct ath_hal *ah numBits = OFDM_HALF_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_HALF_SIFS_TIME - + OFDM_HALF_PREAMBLE_TIME + txTime = OFDM_HALF_PREAMBLE_TIME + (numSymbols * OFDM_HALF_SYMBOL_TIME); + if (includeSifs) + txTime += OFDM_HALF_SIFS_TIME; break; case IEEE80211_T_OFDM_QUARTER: bitsPerSymbol = (kbps * OFDM_QUARTER_SYMBOL_TIME) / 1000; @@ -402,9 +410,10 @@ ath_hal_computetxtime(struct ath_hal *ah numBits = OFDM_QUARTER_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); - txTime = OFDM_QUARTER_SIFS_TIME - + OFDM_QUARTER_PREAMBLE_TIME + txTime = OFDM_QUARTER_PREAMBLE_TIME + (numSymbols * OFDM_QUARTER_SYMBOL_TIME); + if (includeSifs) + txTime += OFDM_QUARTER_SIFS_TIME; break; case IEEE80211_T_TURBO: bitsPerSymbol = (kbps * TURBO_SYMBOL_TIME) / 1000; @@ -412,9 +421,10 @@ ath_hal_computetxtime(struct ath_hal *ah numBits = TURBO_PLCP_BITS + (frameLen << 3); numSymbols = howmany(numBits, bitsPerSymbol); - txTime = TURBO_SIFS_TIME - + TURBO_PREAMBLE_TIME + txTime = TURBO_PREAMBLE_TIME + (numSymbols * TURBO_SYMBOL_TIME); + if (includeSifs) + txTime += TURBO_SIFS_TIME; break; default: HALDEBUG(ah, HAL_DEBUG_PHYIO, @@ -588,9 +598,9 @@ ath_hal_setupratetable(struct ath_hal *a * 2Mb/s rate which will work but is suboptimal */ rt->info[i].lpAckDuration = ath_hal_computetxtime(ah, rt, - WLAN_CTRL_FRAME_SIZE, cix, AH_FALSE); + WLAN_CTRL_FRAME_SIZE, cix, AH_FALSE, AH_TRUE); rt->info[i].spAckDuration = ath_hal_computetxtime(ah, rt, - WLAN_CTRL_FRAME_SIZE, cix, AH_TRUE); + WLAN_CTRL_FRAME_SIZE, cix, AH_TRUE, AH_TRUE); } #undef N } Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/ath_hal/ah.h Fri Jul 15 06:39:35 2016 (r302877) @@ -1626,7 +1626,8 @@ extern int ath_hal_get_curmode(struct at */ extern uint32_t __ahdecl ath_hal_pkt_txtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t frameLen, - uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble); + uint16_t rateix, HAL_BOOL isht40, HAL_BOOL shortPreamble, + HAL_BOOL includeSifs); /* * Calculate the duration of an 11n frame. @@ -1639,7 +1640,8 @@ extern uint32_t __ahdecl ath_computedur_ */ extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, const HAL_RATE_TABLE *rates, uint32_t frameLen, - uint16_t rateix, HAL_BOOL shortPreamble); + uint16_t rateix, HAL_BOOL shortPreamble, + HAL_BOOL includeSifs); /* * Adjust the TSF. Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c Fri Jul 15 06:39:35 2016 (r302877) @@ -2735,7 +2735,7 @@ ar5212SetRateDurationTable(struct ath_ha AR_RATE_DURATION(rt->info[i].rateCode), ath_hal_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, - rt->info[i].controlRate, AH_FALSE)); + rt->info[i].controlRate, AH_FALSE, AH_TRUE)); if (!IEEE80211_IS_CHAN_TURBO(chan)) { /* 11g Table is used to cover the CCK rates. */ rt = ar5212GetRateTable(ah, HAL_MODE_11G); @@ -2748,7 +2748,8 @@ ar5212SetRateDurationTable(struct ath_ha OS_REG_WRITE(ah, reg, ath_hal_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, - rt->info[i].controlRate, AH_FALSE)); + rt->info[i].controlRate, AH_FALSE, + AH_TRUE)); /* cck rates have short preamble option also */ if (rt->info[i].shortPreamble) { reg += rt->info[i].shortPreamble << 2; @@ -2756,7 +2757,7 @@ ar5212SetRateDurationTable(struct ath_ha ath_hal_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, rt->info[i].controlRate, - AH_TRUE)); + AH_TRUE, AH_TRUE)); } } } Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/ath_rate/sample/sample.h Fri Jul 15 06:39:35 2016 (r302877) @@ -212,9 +212,9 @@ static unsigned calc_usecs_unicast_packe if (rts) /* SIFS + CTS */ ctsduration += rt->info[cix].spAckDuration; - /* XXX assumes short preamble */ + /* XXX assumes short preamble, include SIFS */ ctsduration += ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, - is_ht40, 0); + is_ht40, 0, 1); if (cts) /* SIFS + ACK */ ctsduration += rt->info[cix].spAckDuration; @@ -223,9 +223,9 @@ static unsigned calc_usecs_unicast_packe } tt += t_difs; - /* XXX assumes short preamble */ + /* XXX assumes short preamble, include SIFS */ tt += (long_retries+1)*ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, - is_ht40, 0); + is_ht40, 0, 1); tt += (long_retries+1)*(t_sifs + rt->info[rix].spAckDuration); Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/if_ath_beacon.c Fri Jul 15 06:39:35 2016 (r302877) @@ -347,7 +347,7 @@ ath_beacon_setup(struct ath_softc *sc, s rc[0].tx_power_cap = 0x3f; rc[0].PktDuration = ath_hal_computetxtime(ah, rt, roundup(m->m_len, 4), - rix, 0); + rix, 0, AH_TRUE); ath_hal_set11nratescenario(ah, ds, 0, 0, rc, 4, flags); } Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/if_ath_tdma.c Fri Jul 15 06:39:35 2016 (r302877) @@ -288,7 +288,8 @@ ath_tdma_config(struct ath_softc *sc, st /* XXX short preamble assumed */ /* XXX non-11n rate assumed */ sc->sc_tdmaguard = ath_hal_computetxtime(ah, sc->sc_currates, - vap->iv_ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE); + vap->iv_ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE, + AH_TRUE); } ath_hal_intrset(ah, 0); @@ -430,7 +431,8 @@ ath_tdma_update(struct ieee80211_node *n rix, !! (rs->rs_flags & HAL_RX_2040), (rix & 0x80) ? - (! (rs->rs_flags & HAL_RX_GI)) : rt->info[rix].shortPreamble); + (! (rs->rs_flags & HAL_RX_GI)) : rt->info[rix].shortPreamble, + AH_TRUE); /* NB: << 9 is to cvt to TU and /2 */ nextslot = (rstamp - txtime) + (sc->sc_tdmabintval << 9); Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/if_ath_tx.c Fri Jul 15 06:39:35 2016 (r302877) @@ -1131,7 +1131,8 @@ ath_tx_calc_duration(struct ath_softc *s dur += ath_hal_computetxtime(ah, rt, bf->bf_nextfraglen, - rix, shortPreamble); + rix, shortPreamble, + AH_TRUE); } if (isfrag) { /* @@ -1201,14 +1202,14 @@ ath_tx_calc_ctsduration(struct ath_hal * if (flags & HAL_TXDESC_RTSENA) /* SIFS + CTS */ ctsduration += rt->info[cix].spAckDuration; ctsduration += ath_hal_computetxtime(ah, - rt, pktlen, rix, AH_TRUE); + rt, pktlen, rix, AH_TRUE, AH_TRUE); if ((flags & HAL_TXDESC_NOACK) == 0) /* SIFS + ACK */ ctsduration += rt->info[rix].spAckDuration; } else { if (flags & HAL_TXDESC_RTSENA) /* SIFS + CTS */ ctsduration += rt->info[cix].lpAckDuration; ctsduration += ath_hal_computetxtime(ah, - rt, pktlen, rix, AH_FALSE); + rt, pktlen, rix, AH_FALSE, AH_TRUE); if ((flags & HAL_TXDESC_NOACK) == 0) /* SIFS + ACK */ ctsduration += rt->info[rix].lpAckDuration; } Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Fri Jul 15 06:29:19 2016 (r302876) +++ head/sys/dev/ath/if_ath_tx_ht.c Fri Jul 15 06:39:35 2016 (r302877) @@ -296,8 +296,6 @@ ath_tx_rate_fill_rcflags(struct ath_soft * can receive (at least) 1 stream STBC, AND it's * MCS 0-7, AND we have at least two chains enabled, * enable STBC. - * - * XXX TODO: .. and the rate is an 11n rate? */ if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC && ni->ni_vap->iv_flags_ht & IEEE80211_FHT_STBC_TX && @@ -621,8 +619,9 @@ ath_rateseries_setup(struct ath_softc *s if (shortPreamble) series[i].Rate |= rt->info[rc[i].rix].shortPreamble; + /* XXX TODO: don't include SIFS */ series[i].PktDuration = ath_hal_computetxtime(ah, - rt, pktlen, rc[i].rix, shortPreamble); + rt, pktlen, rc[i].rix, shortPreamble, AH_TRUE); } } } From owner-svn-src-head@freebsd.org Fri Jul 15 06:41:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A6CBB99905; Fri, 15 Jul 2016 06:41:01 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F353C1A40; Fri, 15 Jul 2016 06:41:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6f0Co001964; Fri, 15 Jul 2016 06:41:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6exmn001954; Fri, 15 Jul 2016 06:40:59 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150640.u6F6exmn001954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302878 - in head/sys/dev/hyperv: include storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:41:01 -0000 Author: sephe Date: Fri Jul 15 06:40:59 2016 New Revision: 302878 URL: https://svnweb.freebsd.org/changeset/base/302878 Log: hyeprv/vmbus: Rework prplist sending. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7175 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:40:59 2016 (r302878) @@ -82,18 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) -#define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 - -#define HV_ALIGN_UP(value, align) \ - (((value) & (align-1)) ? \ - (((value) + (align-1)) & ~(align-1) ) : (value)) - -#define HV_ALIGN_DOWN(value, align) ( (value) & ~(align-1) ) - -#define HV_NUM_PAGES_SPANNED(addr, len) \ - ((HV_ALIGN_UP(addr+len, PAGE_SIZE) - \ - HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -224,12 +212,6 @@ typedef struct { } __packed hv_vmbus_ring_buffer; typedef struct { - int length; - int offset; - uint64_t pfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT]; -} __packed hv_vmbus_multipage_buffer; - -typedef struct { hv_vmbus_ring_buffer* ring_buffer; struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ @@ -368,13 +350,6 @@ int hv_vmbus_channel_send_packet( hv_vmbus_packet_type type, uint32_t flags); -int hv_vmbus_channel_send_packet_multipagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_multipage_buffer* multi_page_buffer, - void* buffer, - uint32_t buffer_len, - uint64_t request_id); - int hv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, /* must be phys and virt contiguous */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:40:59 2016 (r302878) @@ -31,6 +31,15 @@ #include +/* + * GPA stuffs. + */ +struct vmbus_gpa_range { + uint32_t gpa_len; + uint32_t gpa_ofs; + uint64_t gpa_page[0]; +} __packed; + /* This is actually vmbus_gpa_range.gpa_page[1] */ struct vmbus_gpa { uint32_t gpa_len; @@ -39,11 +48,15 @@ struct vmbus_gpa { } __packed; #define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); +int vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, + uint64_t xactid); #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:40:59 2016 (r302878) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_vstorage.h" #include "vmbus_if.h" @@ -100,7 +101,7 @@ struct hv_sgl_page_pool{ boolean_t is_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * HV_MAX_MULTIPAGE_BUFFER_COUNT +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * VMBUS_CHAN_PRPLIST_MAX enum storvsc_request_type { WRITE_TYPE, @@ -108,10 +109,16 @@ enum storvsc_request_type { UNKNOWN_TYPE }; +struct hvs_gpa_range { + struct vmbus_gpa_range gpa_range; + uint64_t gpa_page[VMBUS_CHAN_PRPLIST_MAX]; +} __packed; + struct hv_storvsc_request { LIST_ENTRY(hv_storvsc_request) link; struct vstor_packet vstor_packet; - hv_vmbus_multipage_buffer data_buf; + int prp_cnt; + struct hvs_gpa_range prp_list; void *sense_data; uint8_t sense_info_len; uint8_t retries; @@ -674,21 +681,18 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet->u.vm_srb.sense_info_len = sense_buffer_size; - vstor_packet->u.vm_srb.transfer_len = request->data_buf.length; + vstor_packet->u.vm_srb.transfer_len = + request->prp_list.gpa_range.gpa_len; vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; outgoing_channel = vmbus_select_outgoing_channel(sc->hs_chan); mtx_unlock(&request->softc->hs_lock); - if (request->data_buf.length) { - ret = hv_vmbus_channel_send_packet_multipagebuffer( - outgoing_channel, - &request->data_buf, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request); - + if (request->prp_list.gpa_range.gpa_len) { + ret = vmbus_chan_send_prplist(outgoing_channel, + &request->prp_list.gpa_range, request->prp_cnt, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } else { ret = hv_vmbus_channel_send_packet( outgoing_channel, @@ -954,7 +958,7 @@ storvsc_attach(device_t dev) /* * Pre-create SG list, each SG list with - * HV_MAX_MULTIPAGE_BUFFER_COUNT segments, each + * VMBUS_CHAN_PRPLIST_MAX segments, each * segment has one page buffer */ for (i = 0; i < STORVSC_MAX_IO_REQUESTS; i++) { @@ -962,10 +966,10 @@ storvsc_attach(device_t dev) M_DEVBUF, M_WAITOK|M_ZERO); sgl_node->sgl_data = - sglist_alloc(HV_MAX_MULTIPAGE_BUFFER_COUNT, + sglist_alloc(VMBUS_CHAN_PRPLIST_MAX, M_WAITOK|M_ZERO); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { tmp_buff = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK|M_ZERO); @@ -1052,7 +1056,7 @@ cleanup: while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1115,7 +1119,7 @@ storvsc_detach(device_t dev) while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++){ + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++){ if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1666,6 +1670,7 @@ create_storvsc_request(union ccb *ccb, s uint32_t pfn_num = 0; uint32_t pfn; uint64_t not_aligned_seg_bits = 0; + struct hvs_gpa_range *prplist; /* refer to struct vmscsi_req for meanings of these two fields */ reqp->vstor_packet.u.vm_srb.port = @@ -1709,22 +1714,23 @@ create_storvsc_request(union ccb *ccb, s return (0); } - reqp->data_buf.length = csio->dxfer_len; + prplist = &reqp->prp_list; + prplist->gpa_range.gpa_len = csio->dxfer_len; switch (ccb->ccb_h.flags & CAM_DATA_MASK) { case CAM_DATA_VADDR: { bytes_to_copy = csio->dxfer_len; phys_addr = vtophys(csio->data_ptr); - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; while (bytes_to_copy != 0) { int bytes, page_offset; phys_addr = - vtophys(&csio->data_ptr[reqp->data_buf.length - + vtophys(&csio->data_ptr[prplist->gpa_range.gpa_len - bytes_to_copy]); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[pfn_num] = pfn; + prplist->gpa_page[pfn_num] = pfn; page_offset = phys_addr & PAGE_MASK; bytes = min(PAGE_SIZE - page_offset, bytes_to_copy); @@ -1732,6 +1738,7 @@ create_storvsc_request(union ccb *ccb, s bytes_to_copy -= bytes; pfn_num++; } + reqp->prp_cnt = pfn_num; break; } @@ -1748,10 +1755,10 @@ create_storvsc_request(union ccb *ccb, s printf("Storvsc: get SG I/O operation, %d\n", reqp->vstor_packet.u.vm_srb.data_in); - if (storvsc_sg_count > HV_MAX_MULTIPAGE_BUFFER_COUNT){ + if (storvsc_sg_count > VMBUS_CHAN_PRPLIST_MAX){ printf("Storvsc: %d segments is too much, " "only support %d segments\n", - storvsc_sg_count, HV_MAX_MULTIPAGE_BUFFER_COUNT); + storvsc_sg_count, VMBUS_CHAN_PRPLIST_MAX); return (EINVAL); } @@ -1804,10 +1811,10 @@ create_storvsc_request(union ccb *ccb, s phys_addr = vtophys(storvsc_sglist[0].ds_addr); } - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[0] = pfn; + prplist->gpa_page[0] = pfn; for (i = 1; i < storvsc_sg_count; i++) { if (reqp->not_aligned_seg_bits & (1 << i)) { @@ -1819,27 +1826,31 @@ create_storvsc_request(union ccb *ccb, s } pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; } + reqp->prp_cnt = i; } else { phys_addr = vtophys(storvsc_sglist[0].ds_addr); - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; for (i = 0; i < storvsc_sg_count; i++) { phys_addr = vtophys(storvsc_sglist[i].ds_addr); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; } + reqp->prp_cnt = i; /* check the last segment cross boundary or not */ offset = phys_addr & PAGE_MASK; if (offset) { + /* Add one more PRP entry */ phys_addr = vtophys(storvsc_sglist[i-1].ds_addr + PAGE_SIZE - offset); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; + reqp->prp_cnt++; } reqp->bounce_sgl_count = 0; Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:40:59 2016 (r302878) @@ -712,78 +712,46 @@ vmbus_chan_send_sglist(struct hv_vmbus_c return error; } -/** - * @brief Send a multi-page buffer packet using a GPADL Direct packet type - */ int -hv_vmbus_channel_send_packet_multipagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_multipage_buffer* multi_page_buffer, - void* buffer, - uint32_t buffer_len, - uint64_t request_id) -{ - - int ret = 0; - uint32_t desc_size; - boolean_t need_sig; - uint32_t packet_len; - uint32_t packet_len_aligned; - uint32_t pfn_count; - uint64_t aligned_data = 0; - struct iovec iov[3]; - hv_vmbus_channel_packet_multipage_buffer desc; - - pfn_count = - HV_NUM_PAGES_SPANNED( - multi_page_buffer->offset, - multi_page_buffer->length); - - if ((pfn_count == 0) || (pfn_count > HV_MAX_MULTIPAGE_BUFFER_COUNT)) - return (EINVAL); - /* - * Adjust the size down since hv_vmbus_channel_packet_multipage_buffer - * is the largest size we support - */ - desc_size = - sizeof(hv_vmbus_channel_packet_multipage_buffer) - - ((HV_MAX_MULTIPAGE_BUFFER_COUNT - pfn_count) * - sizeof(uint64_t)); - packet_len = desc_size + buffer_len; - packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); - - /* - * Setup the descriptor - */ - desc.type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; - desc.flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; - desc.data_offset8 = desc_size >> 3; /* in 8-bytes granularity */ - desc.length8 = (uint16_t) (packet_len_aligned >> 3); - desc.transaction_id = request_id; - desc.range_count = 1; - - desc.range.length = multi_page_buffer->length; - desc.range.offset = multi_page_buffer->offset; - - memcpy(desc.range.pfn_array, multi_page_buffer->pfn_array, - pfn_count * sizeof(uint64_t)); - - iov[0].iov_base = &desc; - iov[0].iov_len = desc_size; - - iov[1].iov_base = buffer; - iov[1].iov_len = buffer_len; - - iov[2].iov_base = &aligned_data; - iov[2].iov_len = packet_len_aligned - packet_len; - - ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); - - /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) - vmbus_chan_send_event(channel); - - return (ret); +vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, + uint64_t xactid) +{ + struct vmbus_chanpkt_prplist pkt; + int pktlen, pad_pktlen, hlen, error; + struct iovec iov[4]; + boolean_t send_evt; + uint64_t pad = 0; + + KASSERT(prp_cnt < VMBUS_CHAN_PRPLIST_MAX, + ("invalid prplist entry count %d", prp_cnt)); + + hlen = __offsetof(struct vmbus_chanpkt_prplist, + cp_range[0].gpa_page[prp_cnt]); + pktlen = hlen + dlen; + pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + + pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; + pkt.cp_hdr.cph_flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; + pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = xactid; + pkt.cp_rsvd = 0; + pkt.cp_range_cnt = 1; + + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); + iov[1].iov_base = prp; + iov[1].iov_len = __offsetof(struct vmbus_gpa_range, gpa_page[prp_cnt]); + iov[2].iov_base = data; + iov[2].iov_len = dlen; + iov[3].iov_base = &pad; + iov[3].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + if (!error && send_evt) + vmbus_chan_send_event(chan); + return error; } /** Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 15 06:40:59 2016 (r302878) @@ -42,20 +42,6 @@ struct vmbus_softc; /* - * The format must be the same as hv_vm_data_gpa_direct - */ -typedef struct hv_vmbus_channel_packet_multipage_buffer { - uint16_t type; - uint16_t data_offset8; - uint16_t length8; - uint16_t flags; - uint64_t transaction_id; - uint32_t reserved; - uint32_t range_count; /* Always 1 in this case */ - hv_vmbus_multipage_buffer range; -} __packed hv_vmbus_channel_packet_multipage_buffer; - -/* * Private, VM Bus functions */ struct sysctl_ctx_list; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:39:35 2016 (r302877) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 06:40:59 2016 (r302878) @@ -109,15 +109,6 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG #define VMBUS_CHAN_MAX (VMBUS_EVTFLAG_LEN * VMBUS_EVTFLAGS_MAX) /* - * GPA range. - */ -struct vmbus_gpa_range { - uint32_t gpa_len; - uint32_t gpa_ofs; - uint64_t gpa_page[]; -} __packed; - -/* * Channel packets */ @@ -143,6 +134,13 @@ struct vmbus_chanpkt_sglist { struct vmbus_gpa cp_gpa[]; } __packed; +struct vmbus_chanpkt_prplist { + struct vmbus_chanpkt_hdr cp_hdr; + uint32_t cp_rsvd; + uint32_t cp_range_cnt; + struct vmbus_gpa_range cp_range[]; +} __packed; + /* * Channel messages * - Embedded in vmbus_message.msg_data, e.g. response and notification. From owner-svn-src-head@freebsd.org Fri Jul 15 06:49:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88343B99A39; Fri, 15 Jul 2016 06:49:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47EEF1DE2; Fri, 15 Jul 2016 06:49:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6nkHI005493; Fri, 15 Jul 2016 06:49:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6njNU005486; Fri, 15 Jul 2016 06:49:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150649.u6F6njNU005486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:49:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302879 - in head/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:49:47 -0000 Author: sephe Date: Fri Jul 15 06:49:45 2016 New Revision: 302879 URL: https://svnweb.freebsd.org/changeset/base/302879 Log: hyperv/vmbus: Move channel packet flags definition to vmbus.h MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7176 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:49:45 2016 (r302879) @@ -129,8 +129,6 @@ typedef enum { HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd } hv_vmbus_packet_type; -#define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 - #define HW_MACADDR_LEN 6 /* Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:49:45 2016 (r302879) @@ -47,6 +47,8 @@ struct vmbus_gpa { uint64_t gpa_page; } __packed; +#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ + #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:49:45 2016 (r302879) @@ -185,8 +185,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -279,8 +278,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -474,8 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ /* Send the init request */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) return (-1); @@ -604,8 +601,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* * TODO: BUGBUG - We have to wait for the above msg since the netvsp * uses KMCL which acknowledges packet (completion packet) - * since our Vmbus always set the - * HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag + * since our Vmbus always set the VMBUS_CHANPKT_FLAG_RC flag */ /* sema_wait(&NetVscChannel->channel_init_sema); */ @@ -822,8 +818,7 @@ hv_nv_on_send(struct hv_vmbus_channel *c } else { ret = hv_vmbus_channel_send_packet(chan, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); } return (ret); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:49:45 2016 (r302879) @@ -1168,8 +1168,7 @@ hv_rf_on_device_add(struct hn_softc *sc, ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:49:45 2016 (r302879) @@ -362,7 +362,7 @@ storvsc_send_multichannel_request(struct VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); /* wait for 5 seconds */ ret = sema_timedwait(&request->synch_sema, 5 * hz); @@ -433,7 +433,7 @@ hv_storvsc_channel_init(struct storvsc_s VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) goto cleanup; @@ -467,7 +467,7 @@ hv_storvsc_channel_init(struct storvsc_s VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) goto cleanup; @@ -510,7 +510,7 @@ hv_storvsc_channel_init(struct storvsc_s VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); if ( ret != 0) goto cleanup; @@ -546,7 +546,7 @@ hv_storvsc_channel_init(struct storvsc_s VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; @@ -636,7 +636,7 @@ hv_storvsc_host_reset(struct storvsc_sof VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)&sc->hs_reset_req, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; @@ -700,7 +700,7 @@ hv_storvsc_io_request(struct storvsc_sof VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_FLAG_RC); } mtx_lock(&request->softc->hs_lock); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:40:59 2016 (r302878) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:49:45 2016 (r302879) @@ -690,7 +690,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; - pkt.cp_hdr.cph_flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_xactid = xactid; @@ -732,7 +732,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; - pkt.cp_hdr.cph_flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_xactid = xactid; From owner-svn-src-head@freebsd.org Fri Jul 15 06:53:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B32AB99D14; Fri, 15 Jul 2016 06:53:51 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id AC8BF1382; Fri, 15 Jul 2016 06:53:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r302324 - head/lib/libc/locale To: koobs@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607031500.u63F0Cr8099783@repo.freebsd.org> <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> <677f087c-1270-8435-83c7-a240ed2599b2@FreeBSD.org> Cc: Baptiste Daroussin From: Jung-uk Kim Message-ID: <75d6cece-4b8a-8b47-5993-577b955a03ba@FreeBSD.org> Date: Fri, 15 Jul 2016 02:53:42 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <677f087c-1270-8435-83c7-a240ed2599b2@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4Tpdaki2hhPMwQ8cGPkdj8fEvCNvLeRbi" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:53:51 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --4Tpdaki2hhPMwQ8cGPkdj8fEvCNvLeRbi Content-Type: multipart/mixed; boundary="3GoadeKG0dIdHqH1ELkKcDS2xq7FHugab" From: Jung-uk Kim To: koobs@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: Baptiste Daroussin Message-ID: <75d6cece-4b8a-8b47-5993-577b955a03ba@FreeBSD.org> Subject: Re: svn commit: r302324 - head/lib/libc/locale References: <201607031500.u63F0Cr8099783@repo.freebsd.org> <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> <677f087c-1270-8435-83c7-a240ed2599b2@FreeBSD.org> In-Reply-To: <677f087c-1270-8435-83c7-a240ed2599b2@FreeBSD.org> --3GoadeKG0dIdHqH1ELkKcDS2xq7FHugab Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/15/16 02:22 AM, Kubilay Kocak wrote: > On 15/07/2016 4:19 PM, Jung-uk Kim wrote: >> On 07/03/16 11:00 AM, Baptiste Daroussin wrote: >>> Author: bapt >>> Date: Sun Jul 3 15:00:12 2016 >>> New Revision: 302324 >>> URL: https://svnweb.freebsd.org/changeset/base/302324 >>> >>> Log: >>> Fix a bad test resulting in a segfault with ISO-8859-5 locales >>> =20 >>> Reported by: Lauri Tirkkonen from Illumos >>> Approved by: re@ (gjb) >>> >>> Modified: >>> head/lib/libc/locale/collate.c >>> >>> Modified: head/lib/libc/locale/collate.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 (r302323)= >>> +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 (r302324)= >>> @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * >>> if ((sptr =3D *state) !=3D NULL) { >>> *pri =3D *sptr; >>> sptr++; >>> - if ((sptr =3D=3D *state) || (sptr =3D=3D NULL)) >>> + if ((sptr =3D=3D *state) || (*sptr =3D=3D 0)) >>> *state =3D NULL; >>> else >>> *state =3D sptr; >> >> I had a serious regression with ko_KR.UTF-8 locale after this commit. >> MATE is unusable because mate-panel is busy looping and eating 100% CP= U. >> GNOME 3 does not start at all, i.e., nothing but mouse cursor on blac= k >> screen. After reverting this commit, everything is back to normal. >> Please investigate. IMHO, this must be fixed before 11.0-BETA2 build.= >> >> Thanks, >> >> Jung-uk Kim >> >=20 > Please report a bug so it can be tracked and not forgotten: >=20 > Add re@ and original committer to cc > Set mfc-stable11 to ? > Add keyword: regression Done: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211135 Jung-uk Kim --3GoadeKG0dIdHqH1ELkKcDS2xq7FHugab-- --4Tpdaki2hhPMwQ8cGPkdj8fEvCNvLeRbi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXiIh+AAoJEHyflib82/FG/4QH/0Xrz61VfNVMtEIxpL/eoIT+ KI7vs61izqIp6RKUctf37wrErI9x0sdy3LCFAU1hIvBksrIJ1be1GtfRLr1drVv/ 8RLv29Rom9zgtipr2pbf8th3n9sQbwRfPjf6ljTwO4HTwwtmvrGM6F8j7RHS1VIP tWU12tbSJ8x6IC3Fqnn/o5NAAaagWbzaKqXw0MNdegBOwLoYV6mmFzqGjuwmKpoS mNBoS+5oxXUMpQ5gJoXQ6mV8+NvyTyb0SS+rdB+OTjtlC2JIB0LZFm2wJstfb5Yf LW3Ax+CoeWW5gFeD0cZTW10pVPelKs8P072UZ5/aUx7JBC85mUdjjFi/37i8Deg= =T/yS -----END PGP SIGNATURE----- --4Tpdaki2hhPMwQ8cGPkdj8fEvCNvLeRbi-- From owner-svn-src-head@freebsd.org Fri Jul 15 06:58:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A21E3B99DC6; Fri, 15 Jul 2016 06:58:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F77115AC; Fri, 15 Jul 2016 06:58:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F6wMlj009434; Fri, 15 Jul 2016 06:58:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F6wL22009422; Fri, 15 Jul 2016 06:58:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150658.u6F6wL22009422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 06:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302880 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 06:58:23 -0000 Author: sephe Date: Fri Jul 15 06:58:21 2016 New Revision: 302880 URL: https://svnweb.freebsd.org/changeset/base/302880 Log: hyperv/vmbus: Move channel packet types definition to vmbus.h MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7177 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 06:58:21 2016 (r302880) @@ -112,23 +112,6 @@ typedef struct { hv_vm_transfer_page ranges[1]; } __packed hv_vm_transfer_page_packet_header; -typedef enum { - HV_VMBUS_PACKET_TYPE_INVALID = 0x0, - HV_VMBUS_PACKET_TYPES_SYNCH = 0x1, - HV_VMBUS_PACKET_TYPE_ADD_TRANSFER_PAGE_SET = 0x2, - HV_VMBUS_PACKET_TYPE_REMOVE_TRANSFER_PAGE_SET = 0x3, - HV_VMBUS_PACKET_TYPE_ESTABLISH_GPADL = 0x4, - HV_VMBUS_PACKET_TYPE_TEAR_DOWN_GPADL = 0x5, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND = 0x6, - HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES = 0x7, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPADL = 0x8, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT = 0x9, - HV_VMBUS_PACKET_TYPE_CANCEL_REQUEST = 0xa, - HV_VMBUS_PACKET_TYPE_COMPLETION = 0xb, - HV_VMBUS_PACKET_TYPE_DATA_USING_ADDITIONAL_PACKETS = 0xc, - HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd -} hv_vmbus_packet_type; - #define HW_MACADDR_LEN 6 /* @@ -345,8 +328,8 @@ int hv_vmbus_channel_send_packet( void* buffer, uint32_t buffer_len, uint64_t request_id, - hv_vmbus_packet_type type, - uint32_t flags); + uint16_t type, + uint16_t flags); int hv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:58:21 2016 (r302880) @@ -47,10 +47,15 @@ struct vmbus_gpa { uint64_t gpa_page; } __packed; -#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ +#define VMBUS_CHANPKT_TYPE_INBAND 0x0006 +#define VMBUS_CHANPKT_TYPE_RXBUF 0x0007 +#define VMBUS_CHANPKT_TYPE_GPA 0x0009 +#define VMBUS_CHANPKT_TYPE_COMP 0x000b -#define VMBUS_CHAN_SGLIST_MAX 32 -#define VMBUS_CHAN_PRPLIST_MAX 32 +#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ + +#define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 06:58:21 2016 (r302880) @@ -185,7 +185,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -278,7 +278,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -338,7 +338,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); /* * If we failed here, we might as well return and have a leak @@ -406,7 +406,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -472,7 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ /* Send the init request */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) return (-1); @@ -515,7 +515,7 @@ hv_nv_send_ndis_config(struct hn_softc * /* Send the configuration packet */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (ret != 0) return (-EINVAL); @@ -594,7 +594,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (ret != 0) { goto cleanup; } @@ -818,7 +818,7 @@ hv_nv_on_send(struct hv_vmbus_channel *c } else { ret = hv_vmbus_channel_send_packet(chan, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); } return (ret); @@ -847,7 +847,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * All inbound packets other than send completion should be * xfer page packet. */ - if (pkt->type != HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES) { + if (pkt->type != VMBUS_CHANPKT_TYPE_RXBUF) { device_printf(dev, "packet type %d is invalid!\n", pkt->type); return; } @@ -918,7 +918,7 @@ hv_nv_on_receive_completion(struct hv_vm retry_send_cmplt: /* Send the completion */ ret = hv_vmbus_channel_send_packet(chan, &rx_comp_msg, - sizeof(nvsp_msg), tid, HV_VMBUS_PACKET_TYPE_COMPLETION, 0); + sizeof(nvsp_msg), tid, VMBUS_CHANPKT_TYPE_COMP, 0); if (ret == 0) { /* success */ /* no-op */ @@ -1003,14 +1003,14 @@ hv_nv_on_channel_callback(void *xchan) if (bytes_rxed > 0) { desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { - case HV_VMBUS_PACKET_TYPE_COMPLETION: + case VMBUS_CHANPKT_TYPE_COMP: hv_nv_on_send_completion(net_dev, chan, desc); break; - case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: + case VMBUS_CHANPKT_TYPE_RXBUF: hv_nv_on_receive(net_dev, sc, chan, desc); break; - case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND: + case VMBUS_CHANPKT_TYPE_INBAND: hv_nv_send_table(sc, desc); break; default: Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 06:58:21 2016 (r302880) @@ -1168,7 +1168,7 @@ hv_rf_on_device_add(struct hn_softc *sc, ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, VMBUS_CHANPKT_FLAG_RC); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 06:58:21 2016 (r302880) @@ -361,7 +361,7 @@ storvsc_send_multichannel_request(struct vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); /* wait for 5 seconds */ @@ -432,7 +432,7 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) @@ -466,7 +466,7 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) @@ -509,7 +509,7 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if ( ret != 0) @@ -545,7 +545,7 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { @@ -635,7 +635,7 @@ hv_storvsc_host_reset(struct storvsc_sof vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)&sc->hs_reset_req, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { @@ -699,7 +699,7 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); } mtx_lock(&request->softc->hs_lock); Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 06:58:21 2016 (r302880) @@ -35,6 +35,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -87,7 +88,7 @@ hv_heartbeat_cb(void *context) HV_ICMSGHDRFLAG_RESPONSE; hv_vmbus_channel_send_packet(channel, buf, recvlen, requestid, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } } Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 06:58:21 2016 (r302880) @@ -578,7 +578,7 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e error = hv_vmbus_channel_send_packet(sc->util_sc.channel, sc->rcv_buf, sc->host_msg_len, sc->host_msg_id, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (error) hv_kvp_log_info("%s: hv_kvp_respond_host: sendpacket error:%d\n", Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 06:58:21 2016 (r302880) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -106,7 +107,7 @@ hv_shutdown_cb(void *context) hv_vmbus_channel_send_packet(channel, buf, recv_len, request_id, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } if (execute_shutdown) Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 06:58:21 2016 (r302880) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -164,7 +165,7 @@ hv_timesync_cb(void *context) hv_vmbus_channel_send_packet(channel, time_buf, recvlen, requestId, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } } Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:49:45 2016 (r302879) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:58:21 2016 (r302880) @@ -630,8 +630,8 @@ hv_vmbus_channel_send_packet( void* buffer, uint32_t buffer_len, uint64_t request_id, - hv_vmbus_packet_type type, - uint32_t flags) + uint16_t type, + uint16_t flags) { int ret = 0; struct vmbus_chanpkt pkt; @@ -689,7 +689,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c pktlen = hlen + dlen; pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); - pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; @@ -731,7 +731,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ pktlen = hlen + dlen; pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); - pkt.cp_hdr.cph_type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; From owner-svn-src-head@freebsd.org Fri Jul 15 07:07:19 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B851B99F83; Fri, 15 Jul 2016 07:07:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D85451A11; Fri, 15 Jul 2016 07:07:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F77IbZ013011; Fri, 15 Jul 2016 07:07:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F77ImE013010; Fri, 15 Jul 2016 07:07:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150707.u6F77ImE013010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:07:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302881 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:07:19 -0000 Author: sephe Date: Fri Jul 15 07:07:17 2016 New Revision: 302881 URL: https://svnweb.freebsd.org/changeset/base/302881 Log: hyperv/vmbus: Cleanup channel sending MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7178 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 06:58:21 2016 (r302880) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:07:17 2016 (r302881) @@ -621,55 +621,37 @@ hv_vmbus_channel_close(struct hv_vmbus_c hv_vmbus_channel_close_internal(chan); } -/** - * @brief Send the specified buffer on the given channel - */ int -hv_vmbus_channel_send_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint64_t request_id, - uint16_t type, - uint16_t flags) +hv_vmbus_channel_send_packet(struct hv_vmbus_channel *chan, + void *data, uint32_t dlen, uint64_t xactid, uint16_t type, uint16_t flags) { - int ret = 0; struct vmbus_chanpkt pkt; - uint32_t packet_len; - uint64_t aligned_data; - uint32_t packet_len_aligned; - boolean_t need_sig; - struct iovec iov[3]; - - packet_len = sizeof(pkt) + buffer_len; - packet_len_aligned = roundup2(packet_len, VMBUS_CHANPKT_SIZE_ALIGN); - aligned_data = 0; + int pktlen, pad_pktlen, hlen, error; + uint64_t pad = 0; + struct iovec iov[3]; + boolean_t send_evt; + + hlen = sizeof(pkt); + pktlen = hlen + dlen; + pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); - /* - * Setup channel packet. - */ pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; - pkt.cp_hdr.cph_data_ofs = sizeof(pkt) >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = packet_len_aligned >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_xactid = request_id; + pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = xactid; iov[0].iov_base = &pkt; - iov[0].iov_len = sizeof(pkt); - - iov[1].iov_base = buffer; - iov[1].iov_len = buffer_len; + iov[0].iov_len = hlen; + iov[1].iov_base = data; + iov[1].iov_len = dlen; + iov[2].iov_base = &pad; + iov[2].iov_len = pad_pktlen - pktlen; - iov[2].iov_base = &aligned_data; - iov[2].iov_len = packet_len_aligned - packet_len; - - ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); - - /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) - vmbus_chan_send_event(channel); - - return (ret); + error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); + if (!error && send_evt) + vmbus_chan_send_event(chan); + return error; } int From owner-svn-src-head@freebsd.org Fri Jul 15 07:16:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74DEBB99100; Fri, 15 Jul 2016 07:16:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D4C31E5D; Fri, 15 Jul 2016 07:16:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F7GlG3016692; Fri, 15 Jul 2016 07:16:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F7GkGX016682; Fri, 15 Jul 2016 07:16:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150716.u6F7GkGX016682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302882 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:16:48 -0000 Author: sephe Date: Fri Jul 15 07:16:46 2016 New Revision: 302882 URL: https://svnweb.freebsd.org/changeset/base/302882 Log: hyperv/vmbus: Function rename And reorder the error prone parameters list. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7191 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:16:46 2016 (r302882) @@ -323,14 +323,6 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_send_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint64_t request_id, - uint16_t type, - uint16_t flags); - int hv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, /* must be phys and virt contiguous */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:16:46 2016 (r302882) @@ -59,6 +59,8 @@ struct vmbus_gpa { struct hv_vmbus_channel; +int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, + uint16_t flags, void *data, int dlen, uint64_t xactid); int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 07:16:46 2016 (r302882) @@ -183,9 +183,9 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -276,9 +276,9 @@ hv_nv_init_send_buffer_with_net_vsp(stru /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -335,10 +335,9 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = NETVSC_RECEIVE_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, - revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), + (uint64_t)(uintptr_t)revoke_pkt); /* * If we failed here, we might as well return and have a leak @@ -403,10 +402,10 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id = NETVSC_SEND_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + (uint64_t)(uintptr_t)revoke_pkt); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -470,9 +469,9 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; /* Send the init request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) return (-1); @@ -513,9 +512,8 @@ hv_nv_send_ndis_config(struct hn_softc * = 1; /* Send the configuration packet */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) return (-EINVAL); @@ -592,9 +590,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* Send the init request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -816,9 +813,9 @@ hv_nv_on_send(struct hv_vmbus_channel *c ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } else { - ret = hv_vmbus_channel_send_packet(chan, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } return (ret); @@ -917,8 +914,8 @@ hv_nv_on_receive_completion(struct hv_vm retry_send_cmplt: /* Send the completion */ - ret = hv_vmbus_channel_send_packet(chan, &rx_comp_msg, - sizeof(nvsp_msg), tid, VMBUS_CHANPKT_TYPE_COMP, 0); + ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, 0, + &rx_comp_msg, sizeof(nvsp_msg), tid); if (ret == 0) { /* success */ /* no-op */ Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Jul 15 07:16:46 2016 (r302882) @@ -1166,9 +1166,9 @@ hv_rf_on_device_add(struct hn_softc *sc, init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = net_dev->num_channel - 1; - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 07:16:46 2016 (r302882) @@ -356,13 +356,9 @@ storvsc_send_multichannel_request(struct vstor_packet->flags = REQUEST_COMPLETION_FLAG; vstor_packet->u.multi_channels_cnt = request_channels_cnt; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); /* wait for 5 seconds */ ret = sema_timedwait(&request->synch_sema, 5 * hz); @@ -427,13 +423,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) goto cleanup; @@ -461,13 +453,9 @@ hv_storvsc_channel_init(struct storvsc_s /* revision is only significant for Windows guests */ vstor_packet->u.version.revision = 0; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) goto cleanup; @@ -504,13 +492,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->operation = VSTOR_OPERATION_QUERYPROPERTIES; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if ( ret != 0) goto cleanup; @@ -540,13 +524,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) { goto cleanup; @@ -631,12 +611,10 @@ hv_storvsc_host_reset(struct storvsc_sof vstor_packet->operation = VSTOR_OPERATION_RESETBUS; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet(dev->channel, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)&sc->hs_reset_req, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(dev->channel, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, + (uint64_t)(uintptr_t)&sc->hs_reset_req); if (ret != 0) { goto cleanup; @@ -694,13 +672,9 @@ hv_storvsc_io_request(struct storvsc_sof &request->prp_list.gpa_range, request->prp_cnt, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } else { - ret = hv_vmbus_channel_send_packet( - outgoing_channel, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(outgoing_channel, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } mtx_lock(&request->softc->hs_lock); Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 07:16:46 2016 (r302882) @@ -87,8 +87,8 @@ hv_heartbeat_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, buf, recvlen, requestid, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + buf, recvlen, requestid); } } Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 07:16:46 2016 (r302882) @@ -575,11 +575,9 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e hv_icmsg_hdrp->status = error; hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - error = hv_vmbus_channel_send_packet(sc->util_sc.channel, - sc->rcv_buf, - sc->host_msg_len, sc->host_msg_id, - VMBUS_CHANPKT_TYPE_INBAND, 0); - + error = vmbus_chan_send(sc->util_sc.channel, + VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, + sc->host_msg_id); if (error) hv_kvp_log_info("%s: hv_kvp_respond_host: sendpacket error:%d\n", __func__, error); Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 07:16:46 2016 (r302882) @@ -105,9 +105,8 @@ hv_shutdown_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, buf, - recv_len, request_id, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + buf, recv_len, request_id); } if (execute_shutdown) Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 07:16:46 2016 (r302882) @@ -163,9 +163,8 @@ hv_timesync_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, time_buf, - recvlen, requestId, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + time_buf, recvlen, requestId); } } Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:07:17 2016 (r302881) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:16:46 2016 (r302882) @@ -622,8 +622,8 @@ hv_vmbus_channel_close(struct hv_vmbus_c } int -hv_vmbus_channel_send_packet(struct hv_vmbus_channel *chan, - void *data, uint32_t dlen, uint64_t xactid, uint16_t type, uint16_t flags) +vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, + void *data, int dlen, uint64_t xactid) { struct vmbus_chanpkt pkt; int pktlen, pad_pktlen, hlen, error; From owner-svn-src-head@freebsd.org Fri Jul 15 07:26:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FBCAB99441; Fri, 15 Jul 2016 07:26:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46CB51699; Fri, 15 Jul 2016 07:26:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F7QVCT020604; Fri, 15 Jul 2016 07:26:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F7QVDh020602; Fri, 15 Jul 2016 07:26:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150726.u6F7QVDh020602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302883 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:26:32 -0000 Author: sephe Date: Fri Jul 15 07:26:31 2016 New Revision: 302883 URL: https://svnweb.freebsd.org/changeset/base/302883 Log: hyperv/vmbus: Field rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7193 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:16:46 2016 (r302882) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:26:31 2016 (r302883) @@ -637,8 +637,8 @@ vmbus_chan_send(struct hv_vmbus_channel pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_xactid = xactid; iov[0].iov_base = &pkt; @@ -673,8 +673,8 @@ vmbus_chan_send_sglist(struct hv_vmbus_c pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_gpa_cnt = sglen; @@ -715,8 +715,8 @@ vmbus_chan_send_prplist(struct hv_vmbus_ pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_range_cnt = 1; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:16:46 2016 (r302882) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:26:31 2016 (r302883) @@ -117,8 +117,8 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG struct vmbus_chanpkt_hdr { uint16_t cph_type; - uint16_t cph_data_ofs; /* in 8 bytes */ - uint16_t cph_len; /* in 8 bytes */ + uint16_t cph_hlen; /* header len, in 8 bytes */ + uint16_t cph_tlen; /* total len, in 8 bytes */ uint16_t cph_flags; uint64_t cph_xactid; } __packed; From owner-svn-src-head@freebsd.org Fri Jul 15 07:35:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD82B9972E; Fri, 15 Jul 2016 07:35:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C52B1D03; Fri, 15 Jul 2016 07:35:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F7Z1sA024163; Fri, 15 Jul 2016 07:35:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F7Z1Ik024161; Fri, 15 Jul 2016 07:35:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150735.u6F7Z1Ik024161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302884 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:35:02 -0000 Author: sephe Date: Fri Jul 15 07:35:01 2016 New Revision: 302884 URL: https://svnweb.freebsd.org/changeset/base/302884 Log: hyperv/vmbus: Factor out macros to do channel packet length conversion. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7194 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:26:31 2016 (r302883) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:35:01 2016 (r302884) @@ -633,12 +633,12 @@ vmbus_chan_send(struct hv_vmbus_channel hlen = sizeof(pkt); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; - pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; iov[0].iov_base = &pkt; @@ -669,12 +669,12 @@ vmbus_chan_send_sglist(struct hv_vmbus_c hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_gpa_cnt = sglen; @@ -711,12 +711,12 @@ vmbus_chan_send_prplist(struct hv_vmbus_ hlen = __offsetof(struct vmbus_chanpkt_prplist, cp_range[0].gpa_page[prp_cnt]); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_hlen = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_tlen = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_range_cnt = 1; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:26:31 2016 (r302883) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:35:01 2016 (r302884) @@ -115,6 +115,14 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG #define VMBUS_CHANPKT_SIZE_SHIFT 3 #define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) +#define VMBUS_CHANPKT_SETLEN(pktlen, len) \ +do { \ + (pktlen) = (len) >> VMBUS_CHANPKT_SIZE_SHIFT; \ +} while (0) + +#define VMBUS_CHANPKT_TOTLEN(tlen) \ + roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) + struct vmbus_chanpkt_hdr { uint16_t cph_type; uint16_t cph_hlen; /* header len, in 8 bytes */ From owner-svn-src-head@freebsd.org Fri Jul 15 07:45:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C824CB99C7F; Fri, 15 Jul 2016 07:45:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A233515E8; Fri, 15 Jul 2016 07:45:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F7jVCj028063; Fri, 15 Jul 2016 07:45:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F7jUS1028051; Fri, 15 Jul 2016 07:45:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150745.u6F7jUS1028051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302885 - in head/sys/dev/hyperv: include storvsc utilities vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:45:32 -0000 Author: sephe Date: Fri Jul 15 07:45:30 2016 New Revision: 302885 URL: https://svnweb.freebsd.org/changeset/base/302885 Log: hyperv/vmbus: Cleanup channel receiving. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7202 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:45:30 2016 (r302885) @@ -298,13 +298,6 @@ hv_set_channel_read_state(hv_vmbus_chann channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } -int hv_vmbus_channel_recv_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id); - int hv_vmbus_channel_recv_packet_raw( hv_vmbus_channel* channel, void* buffer, Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:45:30 2016 (r302885) @@ -59,6 +59,9 @@ struct vmbus_gpa { struct hv_vmbus_channel; +int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, + uint64_t *xactid); + int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid); int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 07:45:30 2016 (r302885) @@ -778,12 +778,10 @@ hv_storvsc_on_channel_callback(void *xch struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - ret = hv_vmbus_channel_recv_packet( - channel, - packet, - roundup2(VSTOR_PKT_SIZE, 8), - &bytes_recvd, - &request_id); + bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8); + ret = vmbus_chan_recv(channel, packet, &bytes_recvd, &request_id); + KASSERT(ret != ENOBUFS, ("storvsc recvbuf is not large enough")); + /* XXX check bytes_recvd to make sure that it contains enough data */ while ((ret == 0) && (bytes_recvd > 0)) { request = (struct hv_storvsc_request *)(uintptr_t)request_id; @@ -817,12 +815,16 @@ hv_storvsc_on_channel_callback(void *xch break; } } - ret = hv_vmbus_channel_recv_packet( - channel, - packet, - roundup2(VSTOR_PKT_SIZE, 8), - &bytes_recvd, - &request_id); + + bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8), + ret = vmbus_chan_recv(channel, packet, &bytes_recvd, + &request_id); + KASSERT(ret != ENOBUFS, + ("storvsc recvbuf is not large enough")); + /* + * XXX check bytes_recvd to make sure that it contains + * enough data + */ } } Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Fri Jul 15 07:45:30 2016 (r302885) @@ -52,7 +52,7 @@ hv_heartbeat_cb(void *context) { uint8_t* buf; hv_vmbus_channel* channel; - uint32_t recvlen; + int recvlen; uint64_t requestid; int ret; @@ -64,8 +64,10 @@ hv_heartbeat_cb(void *context) buf = softc->receive_buffer; channel = softc->channel; - ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, &recvlen, - &requestid); + recvlen = PAGE_SIZE; + ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ if ((ret == 0) && recvlen > 0) { Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Fri Jul 15 07:45:30 2016 (r302885) @@ -626,8 +626,10 @@ hv_kvp_process_request(void *context, in kvp_buf = sc->util_sc.receive_buffer; channel = sc->util_sc.channel; - ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, - &recvlen, &requestid); + recvlen = 2 * PAGE_SIZE; + ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ while ((ret == 0) && (recvlen > 0)) { @@ -691,9 +693,11 @@ hv_kvp_process_request(void *context, in /* * Try reading next buffer */ - recvlen = 0; - ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, - &recvlen, &requestid); + recvlen = 2 * PAGE_SIZE; + ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ + hv_kvp_log_info("%s: read: context %p, ret =%d, recvlen=%d\n", __func__, context, ret, recvlen); } Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Fri Jul 15 07:45:30 2016 (r302885) @@ -67,8 +67,11 @@ hv_shutdown_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; channel = softc->channel; - ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, - &recv_len, &request_id); + + recv_len = PAGE_SIZE; + ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id); + KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough")); + /* XXX check recv_len to make sure that it contains enough data */ if ((ret == 0) && recv_len > 0) { Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Fri Jul 15 07:45:30 2016 (r302885) @@ -144,8 +144,10 @@ hv_timesync_cb(void *context) channel = softc->util_sc.channel; time_buf = softc->util_sc.receive_buffer; - ret = hv_vmbus_channel_recv_packet(channel, time_buf, - PAGE_SIZE, &recvlen, &requestId); + recvlen = PAGE_SIZE; + ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId); + KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ if ((ret == 0) && recvlen > 0) { icmsghdrp = (struct hv_vmbus_icmsg_hdr *) &time_buf[ Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:45:30 2016 (r302885) @@ -736,45 +736,33 @@ vmbus_chan_send_prplist(struct hv_vmbus_ return error; } -/** - * @brief Retrieve the user packet on the specified channel - */ int -hv_vmbus_channel_recv_packet( - hv_vmbus_channel* channel, - void* Buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id) +vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0, + uint64_t *xactid) { - int ret; - uint32_t user_len; - uint32_t packet_len; - hv_vm_packet_descriptor desc; + struct vmbus_chanpkt_hdr pkt; + int error, dlen, hlen; - *buffer_actual_len = 0; - *request_id = 0; + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; - ret = hv_ring_buffer_peek(&channel->inbound, &desc, - sizeof(hv_vm_packet_descriptor)); - if (ret != 0) - return (0); - - packet_len = desc.length8 << 3; - user_len = packet_len - (desc.data_offset8 << 3); - - *buffer_actual_len = user_len; + hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); + dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; - if (user_len > buffer_len) - return (EINVAL); + if (*dlen0 < dlen) { + /* Return the size of this packet. */ + *dlen0 = dlen; + return ENOBUFS; + } - *request_id = desc.transaction_id; + *xactid = pkt.cph_xactid; + *dlen0 = dlen; - /* Copy over the packet to the user buffer */ - ret = hv_ring_buffer_read(&channel->inbound, Buffer, user_len, - (desc.data_offset8 << 3)); + error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen); + KASSERT(!error, ("hv_ring_buffer_read failed")); - return (0); + return 0; } /** Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:35:01 2016 (r302884) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:45:30 2016 (r302885) @@ -120,6 +120,9 @@ do { \ (pktlen) = (len) >> VMBUS_CHANPKT_SIZE_SHIFT; \ } while (0) +#define VMBUS_CHANPKT_GETLEN(pktlen) \ + (((int)(pktlen)) << VMBUS_CHANPKT_SIZE_SHIFT) + #define VMBUS_CHANPKT_TOTLEN(tlen) \ roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) From owner-svn-src-head@freebsd.org Fri Jul 15 07:53:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52F20B99E35; Fri, 15 Jul 2016 07:53:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24F8D1A9F; Fri, 15 Jul 2016 07:53:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F7rkIu031584; Fri, 15 Jul 2016 07:53:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F7rj2j031579; Fri, 15 Jul 2016 07:53:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150753.u6F7rj2j031579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 07:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302886 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 07:53:47 -0000 Author: sephe Date: Fri Jul 15 07:53:45 2016 New Revision: 302886 URL: https://svnweb.freebsd.org/changeset/base/302886 Log: hyperv/vmbus: Cleanup channel packet receiving. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7204 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:45:30 2016 (r302885) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:53:45 2016 (r302886) @@ -90,28 +90,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -typedef struct { - uint16_t type; - uint16_t data_offset8; - uint16_t length8; - uint16_t flags; - uint64_t transaction_id; -} __packed hv_vm_packet_descriptor; - -typedef struct { - uint32_t byte_count; - uint32_t byte_offset; -} __packed hv_vm_transfer_page; - -typedef struct { - hv_vm_packet_descriptor d; - uint16_t transfer_page_set_id; - hv_bool_uint8_t sender_owns_set; - uint8_t reserved; - uint32_t range_count; - hv_vm_transfer_page ranges[1]; -} __packed hv_vm_transfer_page_packet_header; - #define HW_MACADDR_LEN 6 /* @@ -298,13 +276,6 @@ hv_set_channel_read_state(hv_vmbus_chann channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } -int hv_vmbus_channel_recv_packet_raw( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id); - int hv_vmbus_channel_open( hv_vmbus_channel* channel, uint32_t send_ring_buffer_size, Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:45:30 2016 (r302885) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 07:53:45 2016 (r302886) @@ -47,6 +47,19 @@ struct vmbus_gpa { uint64_t gpa_page; } __packed; +#define VMBUS_CHANPKT_SIZE_SHIFT 3 + +#define VMBUS_CHANPKT_GETLEN(pktlen) \ + (((int)(pktlen)) << VMBUS_CHANPKT_SIZE_SHIFT) + +struct vmbus_chanpkt_hdr { + uint16_t cph_type; /* VMBUS_CHANPKT_TYPE_ */ + uint16_t cph_hlen; /* header len, in 8 bytes */ + uint16_t cph_tlen; /* total len, in 8 bytes */ + uint16_t cph_flags; /* VMBUS_CHANPKT_FLAG_ */ + uint64_t cph_xactid; +} __packed; + #define VMBUS_CHANPKT_TYPE_INBAND 0x0006 #define VMBUS_CHANPKT_TYPE_RXBUF 0x0007 #define VMBUS_CHANPKT_TYPE_GPA 0x0009 @@ -54,6 +67,23 @@ struct vmbus_gpa { #define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ +#define VMBUS_CHANPKT_CONST_DATA(pkt) \ + (const void *)((const uint8_t *)(pkt) + \ + VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen)) + +struct vmbus_rxbuf_desc { + uint32_t rb_len; + uint32_t rb_ofs; +} __packed; + +struct vmbus_chanpkt_rxbuf { + struct vmbus_chanpkt_hdr cp_hdr; + uint16_t cp_rxbuf_id; + uint16_t cp_rsvd; + uint32_t cp_rxbuf_cnt; + struct vmbus_rxbuf_desc cp_rxbuf[]; +} __packed; + #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 @@ -61,6 +91,8 @@ struct hv_vmbus_channel; int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); +int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt, int *pktlen); int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 07:45:30 2016 (r302885) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 07:53:45 2016 (r302886) @@ -64,12 +64,12 @@ static int hv_nv_destroy_send_buffer(ne static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); static int hv_nv_connect_to_vsp(struct hn_softc *sc); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); + struct hv_vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, struct hv_vmbus_channel *chan, - hv_vm_packet_descriptor *pkt); + const struct vmbus_chanpkt_hdr *pkt); /* * @@ -726,13 +726,12 @@ hv_nv_on_device_remove(struct hn_softc * */ static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, - hv_vm_packet_descriptor *pkt) + const struct vmbus_chanpkt_hdr *pkt) { - nvsp_msg *nvsp_msg_pkt; + const nvsp_msg *nvsp_msg_pkt; netvsc_packet *net_vsc_pkt; - nvsp_msg_pkt = - (nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); if (nvsp_msg_pkt->hdr.msg_type == nvsp_msg_type_init_complete || nvsp_msg_pkt->hdr.msg_type @@ -749,7 +748,7 @@ hv_nv_on_send_completion(netvsc_dev *net nvsp_msg_1_type_send_rndis_pkt_complete) { /* Get the send context */ net_vsc_pkt = - (netvsc_packet *)(unsigned long)pkt->transaction_id; + (netvsc_packet *)(unsigned long)pkt->cph_xactid; if (NULL != net_vsc_pkt) { if (net_vsc_pkt->send_buf_section_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { @@ -829,10 +828,10 @@ hv_nv_on_send(struct hv_vmbus_channel *c */ static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, - struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) + struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { - hv_vm_transfer_page_packet_header *vm_xfer_page_pkt; - nvsp_msg *nvsp_msg_pkt; + const struct vmbus_chanpkt_rxbuf *pkt; + const nvsp_msg *nvsp_msg_pkt; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; device_t dev = sc->hn_dev; @@ -840,43 +839,31 @@ hv_nv_on_receive(netvsc_dev *net_dev, st int i = 0; int status = nvsp_status_success; - /* - * All inbound packets other than send completion should be - * xfer page packet. - */ - if (pkt->type != VMBUS_CHANPKT_TYPE_RXBUF) { - device_printf(dev, "packet type %d is invalid!\n", pkt->type); - return; - } - - nvsp_msg_pkt = (nvsp_msg *)((unsigned long)pkt - + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkthdr); /* Make sure this is a valid nvsp packet */ if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) { - device_printf(dev, "packet hdr type %d is invalid!\n", - pkt->type); + device_printf(dev, "packet hdr type %u is invalid!\n", + nvsp_msg_pkt->hdr.msg_type); return; } - vm_xfer_page_pkt = (hv_vm_transfer_page_packet_header *)pkt; + pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (vm_xfer_page_pkt->transfer_page_set_id != - NETVSC_RECEIVE_BUFFER_ID) { - device_printf(dev, "transfer_page_set_id %d is invalid!\n", - vm_xfer_page_pkt->transfer_page_set_id); + if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { + device_printf(dev, "rxbuf_id %d is invalid!\n", + pkt->cp_rxbuf_id); return; } - count = vm_xfer_page_pkt->range_count; + count = pkt->cp_rxbuf_cnt; /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { net_vsc_pkt->status = nvsp_status_success; - net_vsc_pkt->data = (void *)((unsigned long)net_dev->rx_buf + - vm_xfer_page_pkt->ranges[i].byte_offset); - net_vsc_pkt->tot_data_buf_len = - vm_xfer_page_pkt->ranges[i].byte_count; + net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + + pkt->cp_rxbuf[i].rb_ofs); + net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; hv_rf_on_receive(net_dev, chan, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { @@ -889,8 +876,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * messages (not just data messages) will trigger a response * message back to the host. */ - hv_nv_on_receive_completion(chan, vm_xfer_page_pkt->d.transaction_id, - status); + hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid, status); } /* @@ -934,19 +920,19 @@ retry_send_cmplt: * Net VSC receiving vRSS send table from VSP */ static void -hv_nv_send_table(struct hn_softc *sc, hv_vm_packet_descriptor *pkt) +hv_nv_send_table(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { netvsc_dev *net_dev; - nvsp_msg *nvsp_msg_pkt; + const nvsp_msg *nvsp_msg_pkt; int i; - uint32_t count, *table; + uint32_t count; + const uint32_t *table; net_dev = hv_nv_get_inbound_net_device(sc); if (!net_dev) return; - nvsp_msg_pkt = - (nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg5_type_send_indirection_table) { @@ -962,8 +948,8 @@ hv_nv_send_table(struct hn_softc *sc, hv return; } - table = (uint32_t *) - ((unsigned long)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + + table = (const uint32_t *) + ((const uint8_t *)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset); for (i = 0; i < count; i++) @@ -980,44 +966,40 @@ hv_nv_on_channel_callback(void *xchan) device_t dev = chan->ch_dev; struct hn_softc *sc = device_get_softc(dev); netvsc_dev *net_dev; - uint32_t bytes_rxed; - uint64_t request_id; - hv_vm_packet_descriptor *desc; - uint8_t *buffer; + void *buffer; int bufferlen = NETVSC_PACKET_SIZE; - int ret = 0; net_dev = hv_nv_get_inbound_net_device(sc); if (net_dev == NULL) return; buffer = chan->hv_chan_rdbuf; - do { - ret = hv_vmbus_channel_recv_packet_raw(chan, - buffer, bufferlen, &bytes_rxed, &request_id); + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); if (ret == 0) { if (bytes_rxed > 0) { - desc = (hv_vm_packet_descriptor *)buffer; - switch (desc->type) { + switch (pkt->cph_type) { case VMBUS_CHANPKT_TYPE_COMP: hv_nv_on_send_completion(net_dev, chan, - desc); + pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(net_dev, sc, chan, desc); + hv_nv_on_receive(net_dev, sc, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: - hv_nv_send_table(sc, desc); + hv_nv_send_table(sc, pkt); break; default: device_printf(dev, - "hv_cb recv unknow type %d " - " packet\n", desc->type); + "unknown chan pkt %u\n", + pkt->cph_type); break; } - } else { - break; } } else if (ret == ENOBUFS) { /* Handle large packet */ @@ -1036,6 +1018,9 @@ hv_nv_on_channel_callback(void *xchan) break; } bufferlen = bytes_rxed; + } else { + /* No more packets */ + break; } } while (1); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:45:30 2016 (r302885) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:53:45 2016 (r302886) @@ -751,7 +751,7 @@ vmbus_chan_recv(struct hv_vmbus_channel dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; if (*dlen0 < dlen) { - /* Return the size of this packet. */ + /* Return the size of this packet's data. */ *dlen0 = dlen; return ENOBUFS; } @@ -759,49 +759,37 @@ vmbus_chan_recv(struct hv_vmbus_channel *xactid = pkt.cph_xactid; *dlen0 = dlen; + /* Skip packet header */ error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen); KASSERT(!error, ("hv_ring_buffer_read failed")); return 0; } -/** - * @brief Retrieve the raw packet on the specified channel - */ int -hv_vmbus_channel_recv_packet_raw( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id) +vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) { - int ret; - uint32_t packetLen; - hv_vm_packet_descriptor desc; - - *buffer_actual_len = 0; - *request_id = 0; - - ret = hv_ring_buffer_peek( - &channel->inbound, &desc, - sizeof(hv_vm_packet_descriptor)); - - if (ret != 0) - return (0); + struct vmbus_chanpkt_hdr pkt; + int error, pktlen; - packetLen = desc.length8 << 3; - *buffer_actual_len = packetLen; + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; - if (packetLen > buffer_len) - return (ENOBUFS); - - *request_id = desc.transaction_id; + pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); + if (*pktlen0 < pktlen) { + /* Return the size of this packet. */ + *pktlen0 = pktlen; + return ENOBUFS; + } + *pktlen0 = pktlen; - /* Copy over the entire packet to the user buffer */ - ret = hv_ring_buffer_read(&channel->inbound, buffer, packetLen, 0); + /* Include packet header */ + error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0); + KASSERT(!error, ("hv_ring_buffer_read failed")); - return (0); + return 0; } static void Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:45:30 2016 (r302885) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 15 07:53:45 2016 (r302886) @@ -112,7 +112,6 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG * Channel packets */ -#define VMBUS_CHANPKT_SIZE_SHIFT 3 #define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) #define VMBUS_CHANPKT_SETLEN(pktlen, len) \ @@ -120,20 +119,9 @@ do { \ (pktlen) = (len) >> VMBUS_CHANPKT_SIZE_SHIFT; \ } while (0) -#define VMBUS_CHANPKT_GETLEN(pktlen) \ - (((int)(pktlen)) << VMBUS_CHANPKT_SIZE_SHIFT) - #define VMBUS_CHANPKT_TOTLEN(tlen) \ roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) -struct vmbus_chanpkt_hdr { - uint16_t cph_type; - uint16_t cph_hlen; /* header len, in 8 bytes */ - uint16_t cph_tlen; /* total len, in 8 bytes */ - uint16_t cph_flags; - uint64_t cph_xactid; -} __packed; - struct vmbus_chanpkt { struct vmbus_chanpkt_hdr cp_hdr; } __packed; From owner-svn-src-head@freebsd.org Fri Jul 15 08:06:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64F44B991B7; Fri, 15 Jul 2016 08:06:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DF981F25; Fri, 15 Jul 2016 08:06:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F86nmL035603; Fri, 15 Jul 2016 08:06:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F86nOb035599; Fri, 15 Jul 2016 08:06:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150806.u6F86nOb035599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302887 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:06:50 -0000 Author: sephe Date: Fri Jul 15 08:06:48 2016 New Revision: 302887 URL: https://svnweb.freebsd.org/changeset/base/302887 Log: hyperv/hn: Busdma-fy rxbuf and chimney sending buffer Nuke unused channel GPADL API. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7211 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 07:53:45 2016 (r302886) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:06:48 2016 (r302887) @@ -287,14 +287,6 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_establish_gpadl( - hv_vmbus_channel* channel, - /* must be phys and virt contiguous */ - void* contig_buffer, - /* page-size multiple */ - uint32_t size, - uint32_t* gpadl_handle); - int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_t gpadl_handle); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 07:53:45 2016 (r302886) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:06:48 2016 (r302887) @@ -152,19 +152,27 @@ hv_nv_init_rx_buffer_with_net_vsp(struct return (ENODEV); } - net_dev->rx_buf = contigmalloc(net_dev->rx_buf_size, M_NETVSC, - M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); + net_dev->rx_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), + PAGE_SIZE, 0, net_dev->rx_buf_size, &net_dev->rxbuf_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (net_dev->rx_buf == NULL) { + device_printf(sc->hn_dev, "allocate rxbuf failed\n"); + return ENOMEM; + } /* - * Establish the GPADL handle for this buffer on this channel. - * Note: This call uses the vmbus connection rather than the - * channel to establish the gpadl handle. - * GPADL: Guest physical address descriptor list. - */ - ret = hv_vmbus_channel_establish_gpadl( - sc->hn_prichan, net_dev->rx_buf, - net_dev->rx_buf_size, &net_dev->rx_buf_gpadl_handle); + * Connect the RXBUF GPADL to the primary channel. + * + * NOTE: + * Only primary channel has RXBUF connected to it. Sub-channels + * just share this RXBUF. + */ + ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + net_dev->rxbuf_dma.hv_paddr, net_dev->rx_buf_size, + &net_dev->rx_buf_gpadl_handle); if (ret != 0) { + device_printf(sc->hn_dev, "rxbuf gpadl connect failed: %d\n", + ret); goto cleanup; } @@ -243,22 +251,27 @@ hv_nv_init_send_buffer_with_net_vsp(stru return (ENODEV); } - net_dev->send_buf = contigmalloc(net_dev->send_buf_size, M_NETVSC, - M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); + net_dev->send_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), + PAGE_SIZE, 0, net_dev->send_buf_size, &net_dev->txbuf_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (net_dev->send_buf == NULL) { - ret = ENOMEM; - goto cleanup; + device_printf(sc->hn_dev, "allocate chimney txbuf failed\n"); + return ENOMEM; } /* - * Establish the gpadl handle for this buffer on this channel. - * Note: This call uses the vmbus connection rather than the - * channel to establish the gpadl handle. + * Connect chimney sending buffer GPADL to the primary channel. + * + * NOTE: + * Only primary channel has chimney sending buffer connected to it. + * Sub-channels just share this chimney sending buffer. */ - ret = hv_vmbus_channel_establish_gpadl(sc->hn_prichan, - net_dev->send_buf, net_dev->send_buf_size, + ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + net_dev->txbuf_dma.hv_paddr, net_dev->send_buf_size, &net_dev->send_buf_gpadl_handle); if (ret != 0) { + device_printf(sc->hn_dev, "chimney sending buffer gpadl " + "connect failed: %d\n", ret); goto cleanup; } @@ -364,7 +377,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ if (net_dev->rx_buf) { /* Free up the receive buffer */ - contigfree(net_dev->rx_buf, net_dev->rx_buf_size, M_NETVSC); + hyperv_dmamem_free(&net_dev->rxbuf_dma, net_dev->rx_buf); net_dev->rx_buf = NULL; } @@ -432,7 +445,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne if (net_dev->send_buf) { /* Free up the receive buffer */ - contigfree(net_dev->send_buf, net_dev->send_buf_size, M_NETVSC); + hyperv_dmamem_free(&net_dev->txbuf_dma, net_dev->send_buf); net_dev->send_buf = NULL; } Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Jul 15 07:53:45 2016 (r302886) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Jul 15 08:06:48 2016 (r302887) @@ -57,6 +57,7 @@ #include #include +#include #include #define HN_USE_TXDESC_BUFRING @@ -1075,6 +1076,8 @@ typedef struct netvsc_dev_ { uint32_t num_channel; + struct hyperv_dma rxbuf_dma; + struct hyperv_dma txbuf_dma; uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 07:53:45 2016 (r302886) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:06:48 2016 (r302887) @@ -337,17 +337,6 @@ failed: return ret; } -/** - * @brief Establish a GPADL for the specified buffer - */ -int -hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, - void *contig_buffer, uint32_t size, uint32_t *gpadl) -{ - return vmbus_chan_gpadl_connect(channel, - hv_get_phys_addr(contig_buffer), size, gpadl); -} - int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl0) From owner-svn-src-head@freebsd.org Fri Jul 15 08:08:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C91DB9923B; Fri, 15 Jul 2016 08:08:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1DDB1220; Fri, 15 Jul 2016 08:08:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F88DB4035702; Fri, 15 Jul 2016 08:08:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F88Dod035696; Fri, 15 Jul 2016 08:08:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150808.u6F88Dod035696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302888 - in head/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:08:15 -0000 Author: sephe Date: Fri Jul 15 08:08:13 2016 New Revision: 302888 URL: https://svnweb.freebsd.org/changeset/base/302888 Log: hyperv/hn: Busdma-fy rxbuf and chimney sending buffer Nuke unused channel GPADL API. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7211 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:08:13 2016 (r302888) @@ -287,22 +287,8 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_teardown_gpdal( - hv_vmbus_channel* channel, - uint32_t gpadl_handle); - -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, - bus_addr_t paddr, int size, uint32_t *gpadl); - struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); -void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); -void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); -struct hv_vmbus_channel ** - vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); -void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:08:13 2016 (r302888) @@ -89,6 +89,20 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); +int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, + uint32_t gpadl); + +void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); + +struct hv_vmbus_channel ** + vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan); + + int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:08:13 2016 (r302888) @@ -363,7 +363,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -430,7 +430,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:08:13 2016 (r302888) @@ -1586,7 +1586,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_drain_subchan(sc->hn_prichan); + vmbus_subchan_drain(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); @@ -2950,7 +2950,7 @@ hn_channel_attach(struct hn_softc *sc, s } /* Bind channel to a proper CPU */ - vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); + vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); } static void @@ -2973,7 +2973,7 @@ hn_subchan_setup(struct hn_softc *sc) int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); + subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { @@ -2983,7 +2983,7 @@ hn_subchan_setup(struct hn_softc *sc) } /* Release the sub-channels */ - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_subchan_rel(subchan, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:08:13 2016 (r302888) @@ -315,7 +315,7 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); new_channel->hv_chan_priv1 = sc; - vmbus_channel_cpu_rr(new_channel); + vmbus_chan_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -377,14 +377,14 @@ storvsc_send_multichannel_request(struct } /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hs_chan, request_channels_cnt); + subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); /* Attach the sub-channels. */ for (i = 0; i < request_channels_cnt; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_rel_subchan(subchan, request_channels_cnt); + vmbus_subchan_rel(subchan, request_channels_cnt); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -574,7 +574,7 @@ hv_storvsc_connect_vsp(struct storvsc_so * Open the channel */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); - vmbus_channel_cpu_rr(sc->hs_chan); + vmbus_chan_cpu_rr(sc->hs_chan); ret = hv_vmbus_channel_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:06:48 2016 (r302887) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:08:13 2016 (r302888) @@ -324,7 +324,7 @@ hv_vmbus_channel_open( failed: if (new_channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(new_channel, + vmbus_chan_gpadl_disconnect(new_channel, new_channel->ch_bufring_gpadl); new_channel->ch_bufring_gpadl = 0; } @@ -468,7 +468,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus * Disconnect the GPA from the target channel */ int -hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) +vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) { struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; @@ -556,8 +556,7 @@ hv_vmbus_channel_close_internal(hv_vmbus /* Tear down the gpadl for the channel's ring buffer */ if (channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(channel, - channel->ch_bufring_gpadl); + vmbus_chan_gpadl_disconnect(channel, channel->ch_bufring_gpadl); channel->ch_bufring_gpadl = 0; } @@ -600,10 +599,10 @@ hv_vmbus_channel_close(struct hv_vmbus_c struct hv_vmbus_channel **subchan; int i; - subchan = vmbus_get_subchan(chan, subchan_cnt); + subchan = vmbus_subchan_get(chan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) hv_vmbus_channel_close_internal(subchan[i]); - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_subchan_rel(subchan, subchan_cnt); } /* Then close the primary channel. */ @@ -1038,7 +1037,7 @@ vmbus_chan_add(struct hv_vmbus_channel * } void -vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) +vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); @@ -1058,13 +1057,13 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } void -vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan) { static uint32_t vmbus_chan_nextcpu; int cpu; cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; - vmbus_channel_cpu_set(chan, cpu); + vmbus_chan_cpu_set(chan, cpu); } static void @@ -1073,9 +1072,9 @@ vmbus_chan_cpu_default(struct hv_vmbus_c /* * By default, pin the channel to cpu0. Devices having * special channel-cpu mapping requirement should call - * vmbus_channel_cpu_{set,rr}(). + * vmbus_chan_cpu_{set,rr}(). */ - vmbus_channel_cpu_set(chan, 0); + vmbus_chan_cpu_set(chan, 0); } static void @@ -1309,7 +1308,7 @@ vmbus_select_outgoing_channel(struct hv_ } struct hv_vmbus_channel ** -vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt) { struct hv_vmbus_channel **ret, *chan; int i; @@ -1340,14 +1339,14 @@ vmbus_get_subchan(struct hv_vmbus_channe } void -vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) { free(subchan, M_TEMP); } void -vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan) { mtx_lock(&pri_chan->ch_subchan_lock); while (pri_chan->ch_subchan_cnt > 0) From owner-svn-src-head@freebsd.org Fri Jul 15 08:13:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 633BBB99467; Fri, 15 Jul 2016 08:13:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37F07166C; Fri, 15 Jul 2016 08:13:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F8Djoo039188; Fri, 15 Jul 2016 08:13:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F8Divh039182; Fri, 15 Jul 2016 08:13:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150813.u6F8Divh039182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:13:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302889 - in head/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:13:46 -0000 Author: sephe Date: Fri Jul 15 08:13:44 2016 New Revision: 302889 URL: https://svnweb.freebsd.org/changeset/base/302889 Log: hyperv/vmbus: Back out r302888 temporarily Committed by accident w/ duplicated commit log MFC after: 1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:13:44 2016 (r302889) @@ -287,8 +287,22 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); +int hv_vmbus_channel_teardown_gpdal( + hv_vmbus_channel* channel, + uint32_t gpadl_handle); + +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); + struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); +void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); +struct hv_vmbus_channel ** + vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); + /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:13:44 2016 (r302889) @@ -89,20 +89,6 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, - bus_addr_t paddr, int size, uint32_t *gpadl); -int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, - uint32_t gpadl); - -void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu); -void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); - -struct hv_vmbus_channel ** - vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt); -void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan); - - int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:13:44 2016 (r302889) @@ -363,7 +363,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -430,7 +430,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, + ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:13:44 2016 (r302889) @@ -1586,7 +1586,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_subchan_drain(sc->hn_prichan); + vmbus_drain_subchan(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); @@ -2950,7 +2950,7 @@ hn_channel_attach(struct hn_softc *sc, s } /* Bind channel to a proper CPU */ - vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); + vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); } static void @@ -2973,7 +2973,7 @@ hn_subchan_setup(struct hn_softc *sc) int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); + subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { @@ -2983,7 +2983,7 @@ hn_subchan_setup(struct hn_softc *sc) } /* Release the sub-channels */ - vmbus_subchan_rel(subchan, subchan_cnt); + vmbus_rel_subchan(subchan, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:13:44 2016 (r302889) @@ -315,7 +315,7 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); new_channel->hv_chan_priv1 = sc; - vmbus_chan_cpu_rr(new_channel); + vmbus_channel_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -377,14 +377,14 @@ storvsc_send_multichannel_request(struct } /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); + subchan = vmbus_get_subchan(sc->hs_chan, request_channels_cnt); /* Attach the sub-channels. */ for (i = 0; i < request_channels_cnt; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_subchan_rel(subchan, request_channels_cnt); + vmbus_rel_subchan(subchan, request_channels_cnt); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -574,7 +574,7 @@ hv_storvsc_connect_vsp(struct storvsc_so * Open the channel */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); - vmbus_chan_cpu_rr(sc->hs_chan); + vmbus_channel_cpu_rr(sc->hs_chan); ret = hv_vmbus_channel_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:08:13 2016 (r302888) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:13:44 2016 (r302889) @@ -324,7 +324,7 @@ hv_vmbus_channel_open( failed: if (new_channel->ch_bufring_gpadl) { - vmbus_chan_gpadl_disconnect(new_channel, + hv_vmbus_channel_teardown_gpdal(new_channel, new_channel->ch_bufring_gpadl); new_channel->ch_bufring_gpadl = 0; } @@ -468,7 +468,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus * Disconnect the GPA from the target channel */ int -vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) +hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) { struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; @@ -556,7 +556,8 @@ hv_vmbus_channel_close_internal(hv_vmbus /* Tear down the gpadl for the channel's ring buffer */ if (channel->ch_bufring_gpadl) { - vmbus_chan_gpadl_disconnect(channel, channel->ch_bufring_gpadl); + hv_vmbus_channel_teardown_gpdal(channel, + channel->ch_bufring_gpadl); channel->ch_bufring_gpadl = 0; } @@ -599,10 +600,10 @@ hv_vmbus_channel_close(struct hv_vmbus_c struct hv_vmbus_channel **subchan; int i; - subchan = vmbus_subchan_get(chan, subchan_cnt); + subchan = vmbus_get_subchan(chan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) hv_vmbus_channel_close_internal(subchan[i]); - vmbus_subchan_rel(subchan, subchan_cnt); + vmbus_rel_subchan(subchan, subchan_cnt); } /* Then close the primary channel. */ @@ -1037,7 +1038,7 @@ vmbus_chan_add(struct hv_vmbus_channel * } void -vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu) +vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); @@ -1057,13 +1058,13 @@ vmbus_chan_cpu_set(struct hv_vmbus_chann } void -vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan) +vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) { static uint32_t vmbus_chan_nextcpu; int cpu; cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; - vmbus_chan_cpu_set(chan, cpu); + vmbus_channel_cpu_set(chan, cpu); } static void @@ -1072,9 +1073,9 @@ vmbus_chan_cpu_default(struct hv_vmbus_c /* * By default, pin the channel to cpu0. Devices having * special channel-cpu mapping requirement should call - * vmbus_chan_cpu_{set,rr}(). + * vmbus_channel_cpu_{set,rr}(). */ - vmbus_chan_cpu_set(chan, 0); + vmbus_channel_cpu_set(chan, 0); } static void @@ -1308,7 +1309,7 @@ vmbus_select_outgoing_channel(struct hv_ } struct hv_vmbus_channel ** -vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) { struct hv_vmbus_channel **ret, *chan; int i; @@ -1339,14 +1340,14 @@ vmbus_subchan_get(struct hv_vmbus_channe } void -vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) { free(subchan, M_TEMP); } void -vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan) +vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) { mtx_lock(&pri_chan->ch_subchan_lock); while (pri_chan->ch_subchan_cnt > 0) From owner-svn-src-head@freebsd.org Fri Jul 15 08:23:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1EF1B9991B; Fri, 15 Jul 2016 08:23:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF6771C99; Fri, 15 Jul 2016 08:23:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F8NYTY042773; Fri, 15 Jul 2016 08:23:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F8NXRw042767; Fri, 15 Jul 2016 08:23:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150823.u6F8NXRw042767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302890 - in head/sys/dev/hyperv: include netvsc storvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:23:35 -0000 Author: sephe Date: Fri Jul 15 08:23:33 2016 New Revision: 302890 URL: https://svnweb.freebsd.org/changeset/base/302890 Log: hyperv/vmbus: Function rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7212 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/include/hyperv.h Fri Jul 15 08:23:33 2016 (r302890) @@ -287,22 +287,8 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_teardown_gpdal( - hv_vmbus_channel* channel, - uint32_t gpadl_handle); - -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, - bus_addr_t paddr, int size, uint32_t *gpadl); - struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); -void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); -void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); -struct hv_vmbus_channel ** - vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); -void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 08:23:33 2016 (r302890) @@ -89,6 +89,20 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); +int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, + uint32_t gpadl); + +void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); + +struct hv_vmbus_channel ** + vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan); + + int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Jul 15 08:23:33 2016 (r302890) @@ -363,7 +363,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -430,7 +430,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Jul 15 08:23:33 2016 (r302890) @@ -1586,7 +1586,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_drain_subchan(sc->hn_prichan); + vmbus_subchan_drain(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); @@ -2950,7 +2950,7 @@ hn_channel_attach(struct hn_softc *sc, s } /* Bind channel to a proper CPU */ - vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); + vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); } static void @@ -2973,7 +2973,7 @@ hn_subchan_setup(struct hn_softc *sc) int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); + subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { @@ -2983,7 +2983,7 @@ hn_subchan_setup(struct hn_softc *sc) } /* Release the sub-channels */ - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_subchan_rel(subchan, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Jul 15 08:23:33 2016 (r302890) @@ -315,7 +315,7 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); new_channel->hv_chan_priv1 = sc; - vmbus_channel_cpu_rr(new_channel); + vmbus_chan_cpu_rr(new_channel); ret = hv_vmbus_channel_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -377,14 +377,14 @@ storvsc_send_multichannel_request(struct } /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hs_chan, request_channels_cnt); + subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); /* Attach the sub-channels. */ for (i = 0; i < request_channels_cnt; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_rel_subchan(subchan, request_channels_cnt); + vmbus_subchan_rel(subchan, request_channels_cnt); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -574,7 +574,7 @@ hv_storvsc_connect_vsp(struct storvsc_so * Open the channel */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); - vmbus_channel_cpu_rr(sc->hs_chan); + vmbus_chan_cpu_rr(sc->hs_chan); ret = hv_vmbus_channel_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:13:44 2016 (r302889) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:23:33 2016 (r302890) @@ -324,7 +324,7 @@ hv_vmbus_channel_open( failed: if (new_channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(new_channel, + vmbus_chan_gpadl_disconnect(new_channel, new_channel->ch_bufring_gpadl); new_channel->ch_bufring_gpadl = 0; } @@ -468,7 +468,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus * Disconnect the GPA from the target channel */ int -hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) +vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) { struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; @@ -556,8 +556,7 @@ hv_vmbus_channel_close_internal(hv_vmbus /* Tear down the gpadl for the channel's ring buffer */ if (channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(channel, - channel->ch_bufring_gpadl); + vmbus_chan_gpadl_disconnect(channel, channel->ch_bufring_gpadl); channel->ch_bufring_gpadl = 0; } @@ -600,10 +599,10 @@ hv_vmbus_channel_close(struct hv_vmbus_c struct hv_vmbus_channel **subchan; int i; - subchan = vmbus_get_subchan(chan, subchan_cnt); + subchan = vmbus_subchan_get(chan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) hv_vmbus_channel_close_internal(subchan[i]); - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_subchan_rel(subchan, subchan_cnt); } /* Then close the primary channel. */ @@ -1038,7 +1037,7 @@ vmbus_chan_add(struct hv_vmbus_channel * } void -vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) +vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); @@ -1058,13 +1057,13 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } void -vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan) { static uint32_t vmbus_chan_nextcpu; int cpu; cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; - vmbus_channel_cpu_set(chan, cpu); + vmbus_chan_cpu_set(chan, cpu); } static void @@ -1073,9 +1072,9 @@ vmbus_chan_cpu_default(struct hv_vmbus_c /* * By default, pin the channel to cpu0. Devices having * special channel-cpu mapping requirement should call - * vmbus_channel_cpu_{set,rr}(). + * vmbus_chan_cpu_{set,rr}(). */ - vmbus_channel_cpu_set(chan, 0); + vmbus_chan_cpu_set(chan, 0); } static void @@ -1309,7 +1308,7 @@ vmbus_select_outgoing_channel(struct hv_ } struct hv_vmbus_channel ** -vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt) { struct hv_vmbus_channel **ret, *chan; int i; @@ -1340,14 +1339,14 @@ vmbus_get_subchan(struct hv_vmbus_channe } void -vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) { free(subchan, M_TEMP); } void -vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan) { mtx_lock(&pri_chan->ch_subchan_lock); while (pri_chan->ch_subchan_cnt > 0) From owner-svn-src-head@freebsd.org Fri Jul 15 08:31:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F1CBB99C8A; Fri, 15 Jul 2016 08:31:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF4B6120F; Fri, 15 Jul 2016 08:31:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F8Vshx045081; Fri, 15 Jul 2016 08:31:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F8VsKX045080; Fri, 15 Jul 2016 08:31:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150831.u6F8VsKX045080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302891 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:31:55 -0000 Author: sephe Date: Fri Jul 15 08:31:53 2016 New Revision: 302891 URL: https://svnweb.freebsd.org/changeset/base/302891 Log: hyperv/vmbus: Cosmetic vmbus channel close cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7213 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:23:33 2016 (r302890) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:31:53 2016 (r302891) @@ -505,41 +505,45 @@ vmbus_chan_gpadl_disconnect(struct hv_vm } static void -hv_vmbus_channel_close_internal(hv_vmbus_channel *channel) +vmbus_chan_close_internal(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *tq = channel->ch_tq; + struct taskqueue *tq = chan->ch_tq; int error; /* TODO: stringent check */ - atomic_clear_int(&channel->ch_stflags, VMBUS_CHAN_ST_OPENED); - - sysctl_ctx_free(&channel->ch_sysctl_ctx); + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); /* - * Set ch_tq to NULL to avoid more requests be scheduled + * Free this channel's sysctl tree attached to its device's + * sysctl tree. */ - channel->ch_tq = NULL; - taskqueue_drain(tq, &channel->ch_task); - channel->ch_cb = NULL; + sysctl_ctx_free(&chan->ch_sysctl_ctx); - /** - * Send a closing message + /* + * Set ch_tq to NULL to avoid more requests be scheduled. + * XXX pretty broken; need rework. */ + chan->ch_tq = NULL; + taskqueue_drain(tq, &chan->ch_task); + chan->ch_cb = NULL; + /* + * Close this channel. + */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chclose(chan%u)\n", - channel->ch_id); + chan->ch_id); return; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; - req->chm_chanid = channel->ch_id; + req->chm_chanid = chan->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -547,29 +551,28 @@ hv_vmbus_channel_close_internal(hv_vmbus if (error) { device_printf(sc->vmbus_dev, "chclose(chan%u) msg hypercall exec failed: %d\n", - channel->ch_id, error); + chan->ch_id, error); return; } else if (bootverbose) { - device_printf(sc->vmbus_dev, "close chan%u\n", - channel->ch_id); + device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); } - /* Tear down the gpadl for the channel's ring buffer */ - if (channel->ch_bufring_gpadl) { - vmbus_chan_gpadl_disconnect(channel, channel->ch_bufring_gpadl); - channel->ch_bufring_gpadl = 0; + /* + * Disconnect the TX+RX bufrings from this channel. + */ + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; } - /* TODO: Send a msg to release the childRelId */ - - /* cleanup the ring buffers for this channel */ - hv_ring_buffer_cleanup(&channel->outbound); - hv_ring_buffer_cleanup(&channel->inbound); - - if (channel->ch_bufring != NULL) { - hyperv_dmamem_free(&channel->ch_bufring_dma, - channel->ch_bufring); - channel->ch_bufring = NULL; + /* + * Destroy the TX+RX bufrings. + */ + hv_ring_buffer_cleanup(&chan->outbound); + hv_ring_buffer_cleanup(&chan->inbound); + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; } } @@ -601,12 +604,12 @@ hv_vmbus_channel_close(struct hv_vmbus_c subchan = vmbus_subchan_get(chan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) - hv_vmbus_channel_close_internal(subchan[i]); + vmbus_chan_close_internal(subchan[i]); vmbus_subchan_rel(subchan, subchan_cnt); } /* Then close the primary channel. */ - hv_vmbus_channel_close_internal(chan); + vmbus_chan_close_internal(chan); } int From owner-svn-src-head@freebsd.org Fri Jul 15 08:40:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13F42B9A077; Fri, 15 Jul 2016 08:40:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCC8116C1; Fri, 15 Jul 2016 08:40:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F8eM1o046769; Fri, 15 Jul 2016 08:40:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F8eMfH046768; Fri, 15 Jul 2016 08:40:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607150840.u6F8eMfH046768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 15 Jul 2016 08:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302892 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 08:40:24 -0000 Author: sephe Date: Fri Jul 15 08:40:22 2016 New Revision: 302892 URL: https://svnweb.freebsd.org/changeset/base/302892 Log: hyperv/vmbus: Cleanup channel sysctl tree creation MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7214 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:31:53 2016 (r302891) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Fri Jul 15 08:40:22 2016 (r302892) @@ -99,88 +99,106 @@ vmbus_chan_send_event(hv_vmbus_channel * } static int -vmbus_channel_sysctl_monalloc(SYSCTL_HANDLER_ARGS) +vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) { struct hv_vmbus_channel *chan = arg1; - int alloc = 0; + int mnf = 0; if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) - alloc = 1; - return sysctl_handle_int(oidp, &alloc, 0, req); + mnf = 1; + return sysctl_handle_int(oidp, &mnf, 0, req); } static void -vmbus_channel_sysctl_create(hv_vmbus_channel* channel) +vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan) { - device_t dev; - struct sysctl_oid *devch_sysctl; - struct sysctl_oid *devch_id_sysctl, *devch_sub_sysctl; - struct sysctl_oid *devch_id_in_sysctl, *devch_id_out_sysctl; + struct sysctl_oid *ch_tree, *chid_tree, *br_tree; struct sysctl_ctx_list *ctx; uint32_t ch_id; - uint16_t sub_ch_id; char name[16]; - - hv_vmbus_channel* primary_ch = channel->ch_prichan; - if (primary_ch == NULL) { - dev = channel->ch_dev; - ch_id = channel->ch_id; - } else { - dev = primary_ch->ch_dev; - ch_id = primary_ch->ch_id; - sub_ch_id = channel->ch_subidx; - } - ctx = &channel->ch_sysctl_ctx; + /* + * Add sysctl nodes related to this channel to this + * channel's sysctl ctx, so that they can be destroyed + * independently upon close of this channel, which can + * happen even if the device is not detached. + */ + ctx = &chan->ch_sysctl_ctx; sysctl_ctx_init(ctx); - /* This creates dev.DEVNAME.DEVUNIT.channel tree */ - devch_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - /* This creates dev.DEVNAME.DEVUNIT.channel.CHANID tree */ + + /* + * Create dev.NAME.UNIT.channel tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(chan->ch_dev)), + OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID tree. + */ + if (VMBUS_CHAN_ISPRIMARY(chan)) + ch_id = chan->ch_id; + else + ch_id = chan->ch_prichan->ch_id; snprintf(name, sizeof(name), "%d", ch_id); - devch_id_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_sysctl), - OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - - if (primary_ch != NULL) { - devch_sub_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - snprintf(name, sizeof(name), "%d", sub_ch_id); - devch_id_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_sub_sysctl), - OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - - SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, "chanid", CTLFLAG_RD, - &channel->ch_id, 0, "channel id"); - } - SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, &channel->ch_cpuid, 0, "owner CPU id"); - SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, - channel, 0, vmbus_channel_sysctl_monalloc, "I", - "is monitor allocated to this channel"); - - devch_id_in_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, - "in", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - devch_id_out_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, - "out", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - hv_ring_buffer_stat(ctx, - SYSCTL_CHILDREN(devch_id_in_sysctl), - &(channel->inbound), - "inbound ring buffer stats"); - hv_ring_buffer_stat(ctx, - SYSCTL_CHILDREN(devch_id_out_sysctl), - &(channel->outbound), - "outbound ring buffer stats"); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + if (!VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Create dev.NAME.UNIT.channel.CHANID.sub tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), + OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID.sub.SUBIDX tree. + * + * NOTE: + * chid_tree is changed to this new sysctl tree. + */ + snprintf(name, sizeof(name), "%d", chan->ch_subidx); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "chanid", CTLFLAG_RD, &chan->ch_id, 0, "channel id"); + } + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "cpu", CTLFLAG_RD, &chan->ch_cpuid, 0, "owner CPU id"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "mnf", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + chan, 0, vmbus_chan_sysctl_mnf, "I", + "has monitor notification facilities"); + + /* + * Create sysctl tree for RX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "in", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->inbound, "inbound ring buffer stats"); + } + + /* + * Create sysctl tree for TX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "out", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->outbound, "outbound ring buffer stats"); + } } /** @@ -257,7 +275,7 @@ hv_vmbus_channel_open( br + send_ring_buffer_size, recv_ring_buffer_size); /* Create sysctl tree for this channel */ - vmbus_channel_sysctl_create(new_channel); + vmbus_chan_sysctl_create(new_channel); /* * Connect the bufrings, both RX and TX, to this channel. From owner-svn-src-head@freebsd.org Fri Jul 15 09:09:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FD69B9AAC9; Fri, 15 Jul 2016 09:09:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 1518A1AAE; Fri, 15 Jul 2016 09:09:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id BDEA11A3BA7; Fri, 15 Jul 2016 18:36:32 +1000 (AEST) Date: Fri, 15 Jul 2016 18:36:27 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev cc: Bruce Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org Subject: Re: svn commit: r302854 - head/sys/kern In-Reply-To: <20160715043148.GA46325@FreeBSD.org> Message-ID: <20160715162551.K4083@besplex.bde.org> References: <201607141849.u6EIn53i038324@repo.freebsd.org> <20160715053515.S2290@besplex.bde.org> <20160715071816.Q2585@besplex.bde.org> <20160715043148.GA46325@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=OtmysHLt c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=uvFeHlsgAt-Obz8DlucA:9 a=XEdQnlJqkQbL6iXS:21 a=Q9srNOqwCFmcLF--:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 09:09:55 -0000 On Fri, 15 Jul 2016, Alexey Dokuchaev wrote: > On Fri, Jul 15, 2016 at 07:19:22AM +1000, Bruce Evans wrote: >> On Fri, 15 Jul 2016, Bruce Evans wrote: >>>> Log: >>>> Let DDB's buf printer handle NULL pointers in the buf page array. >>> >>> I noticed some other bugs in this code: >> >> Oops, that was supposed to be a private reply. > > I'm glad it leaked: %p abuse is unfortunately not that rare, and getting > developers' attention is a good thing. E.g., every time I do kldstat(8) > on my PowerPC box I sigh: > > % kldstat > Id Refs Address Size Name > 1 7 0x100000 e0c378 kernel > 2 1 0xd20dd000 1d000 tmpfs.ko > 3 2 0xd2114000 18000 geom_sched.ko > 4 1 0xd2131000 13000 gsched_rr.ko I think some mail program further broke the formatting -- it omitted leading spaces so nothing lines up. After fixing this, only the narrow Address for Id 1 messes up the alignment. Output on amd64 shows another problem. All kernel pointers are above 0xf000000000000000, so %p prints them all with the same width, but this width is is too wide -- the 'f's provide no useful info. Also, kldstat hard-codes the i386 width of 2+8 in the header, so the Size and Name columns are consistently misaligned on amd64. %p is more usable in the kernel. One of its undocumented features there is that field widths work with it. This is sometimes used to avoid the above bug. Kernel ddb used to use %8p for all pointers. The 8 in this is hard-coded for 32-bit arches, so was wrong in another way. ddb now uses %p and hard-codes the width of this in the header as 2+8 or 2+16 depending on __LP64__ and is more broken than before for small pointer values. The only important table where this is used is in ps. Spaces in this table is wasted to print just 1 pointer -- the relatively useless wchan. I sometimes compress kernel pointers in output and trace buffers by omitting leading 1 or 0 bits and trailing 0 bits as well as leading 0x. User ps is documented to trim even non-redundant leading parts of the address for *wchan (0x80324000 -> 324000 in the example), but the code hasn't matched the man page since 2001. In 4.4BSD-Lite2, this as implemented using &~ KERNBASE. That wasn't portable. The first fix replaced the 32-bit %08lx format. Now the format is %0lx. This moves the bugs much as in ddb ps, except it doesn't use %p and doesn't print the 0x prefix. Bruce From owner-svn-src-head@freebsd.org Fri Jul 15 09:14:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77CC1B9ACC9; Fri, 15 Jul 2016 09:14:42 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB8541FDC; Fri, 15 Jul 2016 09:14:41 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-lf0-x22b.google.com with SMTP id b199so83341774lfe.0; Fri, 15 Jul 2016 02:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3t4jtgv+l2YkwldAzKCQi8BhyKHATMgnvcmiFIPTgdw=; b=WY4oSixhPJS7aiu/a5z0FqjJ1WDwVRmuzKVaJOnTftbwWh2JXcNqezck46c1nmXOOh xeCWaJdlMWbdwMyjW82ySU+VU0PWXNVZ5jUG+GfCabAJY0lotvRY+A+8DMFiuaNx2gYh 0V2B50QuoWfFkkXDVSpSBY3WvPIyJ73e5QdmQ/UwNUSkE8SZuz63D434CSnW+alDlNqA S99kKj0PqoLI641kteTO+lwaaFO47egy2/T+X2pM5wH4iFb3ZaUShVoo5w8Xu+hpKmNf 5MtFjHT8G97UYAQ6u6s4UYSJruDHKDqQGLJn1AdHmIESXb8++EQ8klxISgmnkYFfMIr8 84dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=3t4jtgv+l2YkwldAzKCQi8BhyKHATMgnvcmiFIPTgdw=; b=VN7b7L7VS9z2XX222c+yc6q2y7Be9ycEGS3EO/eK32oam8/rWp0LxRw8USAKEqIu7V XJzYtLsjIBc2HUxOyi5ycQE4fdZizmLaNwZM2pEuN3Mbat8APt0DAA/k+u/KqeZT1rnu oxTg8ZDFkG6rIt9V5/lRxzIMKt+tO/5KzfjjlYLDarALEVW8YJCOw8gNWJ9TnVIgwL55 pYvWQksvGtJj8c9fO3wnxVz6xODupYtLC5EBy5ai2F2gQVlRxKhsFpOTv2MpmDEEJcJi cyP02Vh4LeJ1PM2HNwN9rESinahImocgTCqyUwGdVfoKfRM7U+1ZbfdiwsWXDhzthGio MpcQ== X-Gm-Message-State: ALyK8tIhbyOnD2FEzvy01ouDvEUWsRa3pU4XRWsGnkEOjY/hZqjZfW6/hBLCy08nYVzvGA== X-Received: by 10.46.32.10 with SMTP id g10mr9660453ljg.42.1468574079356; Fri, 15 Jul 2016 02:14:39 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id 67sm1744594ljj.8.2016.07.15.02.14.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2016 02:14:38 -0700 (PDT) Sender: Baptiste Daroussin Date: Fri, 15 Jul 2016 11:14:37 +0200 From: Baptiste Daroussin To: Jung-uk Kim Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302324 - head/lib/libc/locale Message-ID: <20160715091437.lczsxhxffxvp2bq3@ivaldir.etoilebsd.net> References: <201607031500.u63F0Cr8099783@repo.freebsd.org> <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="llh3fvk5woixeh53" Content-Disposition: inline In-Reply-To: <3a667ad2-f7d1-7720-3929-99c12245733e@FreeBSD.org> User-Agent: Mutt/1.6.1-neo (2016-06-11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 09:14:42 -0000 --llh3fvk5woixeh53 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 15, 2016 at 02:19:41AM -0400, Jung-uk Kim wrote: > On 07/03/16 11:00 AM, Baptiste Daroussin wrote: > > Author: bapt > > Date: Sun Jul 3 15:00:12 2016 > > New Revision: 302324 > > URL: https://svnweb.freebsd.org/changeset/base/302324 > >=20 > > Log: > > Fix a bad test resulting in a segfault with ISO-8859-5 locales > > =20 > > Reported by: Lauri Tirkkonen from Illumos > > Approved by: re@ (gjb) > >=20 > > Modified: > > head/lib/libc/locale/collate.c > >=20 > > Modified: head/lib/libc/locale/collate.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/lib/libc/locale/collate.c Sun Jul 3 11:45:54 2016 (r302323) > > +++ head/lib/libc/locale/collate.c Sun Jul 3 15:00:12 2016 (r302324) > > @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * > > if ((sptr =3D *state) !=3D NULL) { > > *pri =3D *sptr; > > sptr++; > > - if ((sptr =3D=3D *state) || (sptr =3D=3D NULL)) > > + if ((sptr =3D=3D *state) || (*sptr =3D=3D 0)) > > *state =3D NULL; > > else > > *state =3D sptr; >=20 > I had a serious regression with ko_KR.UTF-8 locale after this commit. > MATE is unusable because mate-panel is busy looping and eating 100% CPU. > GNOME 3 does not start at all, i.e., nothing but mouse cursor on black > screen. After reverting this commit, everything is back to normal. > Please investigate. IMHO, this must be fixed before 11.0-BETA2 build. >=20 > Thanks, >=20 > Jung-uk Kim >=20 Yes sorry about that, I'm aware of it and working on a fix... Bapt --llh3fvk5woixeh53 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXiKl7AAoJEGOJi9zxtz5aqSUP/A1JRIOh/9sRMU//abPp5vkP RrInAaY3YsfkgUwstXQmy7ImJgT9KPVaWRMu2cJ+NXdQtfpzUVUP8o7LcvRX5F4h /8mlGo4Uv+40OU7Dl2C2ZyRewEj1kyMVdJ/7TEQ+XA52rfUPYUvT8H5YJzQVKhnl GZWgDsEIvs5k7a5ShglKVAto9YmXa09M1mNTDFiwoXG7H63V08pIGa67V/fBc/gb ViEi7xWFduNvYw6c/O0jF/1m8u71nwxxiIiOReScg++qbUXhamZWQnmkSnQqDspN EgyJUeIYK4fEQmu1SHuARV/iM/iR+v6DeW02dI3j/4oHq7a0/5fz6giE1StFZTLb mPl4GhbC6mI/eEhm+gI8TdjszvlKXpFGnj8G60uaHjSSzMhUF0xLnOJAcRNorY3M bzduhF9kASFwgBEstTG20eZl+o5O/RQa+u0/xE9LgQig24lziHch4Dyrkc2U+G/v 9a3dQKjnswJ5cwBfh+lWv9MoeFHQX58NHf+1Yy48YHhXX3RqQ136zA2GHVMcQJer zvasrBMvkxqZOXP4RJDaisokLjBxs4kGAo24Ta9vZf3NL0Z3yU1iOS/pghS33RbD KVffMCXhKh9UoZ/6r0XSFG+e0HS2zEjXo1ZB3F1ou8XB3yKeMxu5Fkm4YEI7S2Gk w+qmHQckWuRbTY9i/wRd =g9c5 -----END PGP SIGNATURE----- --llh3fvk5woixeh53-- From owner-svn-src-head@freebsd.org Fri Jul 15 09:23:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19C63B9AF1E; Fri, 15 Jul 2016 09:23:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D825216C7; Fri, 15 Jul 2016 09:23:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F9NJAi064890; Fri, 15 Jul 2016 09:23:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F9NJLS064889; Fri, 15 Jul 2016 09:23:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607150923.u6F9NJLS064889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 15 Jul 2016 09:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302893 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 09:23:20 -0000 Author: kib Date: Fri Jul 15 09:23:18 2016 New Revision: 302893 URL: https://svnweb.freebsd.org/changeset/base/302893 Log: Do not allow creation of char or block special nodes with VNOVAL dev_t. As was reported on http://seclists.org/oss-sec/2016/q3/68, tmpfs code contains assertion that rdev != VNOVAL. On FreeBSD, there is no other consequences except triggering the assert. To be compatible with systems where device nodes have some significance, reject mknod(2) call with dev == VNOVAL at the syscall level. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Jul 15 08:40:22 2016 (r302892) +++ head/sys/kern/vfs_syscalls.c Fri Jul 15 09:23:18 2016 (r302893) @@ -1167,6 +1167,8 @@ kern_mknodat(struct thread *td, int fd, case S_IFCHR: case S_IFBLK: error = priv_check(td, PRIV_VFS_MKNOD_DEV); + if (error == 0 && dev == VNOVAL) + error = EINVAL; break; case S_IFMT: error = priv_check(td, PRIV_VFS_MKNOD_BAD); From owner-svn-src-head@freebsd.org Fri Jul 15 09:28:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07A49B973F2; Fri, 15 Jul 2016 09:28:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8E9A1BED; Fri, 15 Jul 2016 09:28:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6F9SWtX065101; Fri, 15 Jul 2016 09:28:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6F9SW3h065100; Fri, 15 Jul 2016 09:28:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201607150928.u6F9SW3h065100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 15 Jul 2016 09:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302894 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 09:28:34 -0000 Author: glebius Date: Fri Jul 15 09:28:32 2016 New Revision: 302894 URL: https://svnweb.freebsd.org/changeset/base/302894 Log: Fix regression introduced by r302350. The change of return value for a callout that wasn't scheduled at all was unintentional and yielded in several panics. PR: 210884 Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Fri Jul 15 09:23:18 2016 (r302893) +++ head/sys/kern/kern_timeout.c Fri Jul 15 09:28:32 2016 (r302894) @@ -1381,7 +1381,7 @@ again: CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", c, c->c_func, c->c_arg); CC_UNLOCK(cc); - return (cancelled); + return (0); } c->c_iflags &= ~CALLOUT_PENDING; From owner-svn-src-head@freebsd.org Fri Jul 15 13:25:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DF9EB988E7; Fri, 15 Jul 2016 13:25:48 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F95617B0; Fri, 15 Jul 2016 13:25:48 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FDPl2i053087; Fri, 15 Jul 2016 13:25:47 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FDPl21053086; Fri, 15 Jul 2016 13:25:47 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607151325.u6FDPl21053086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 15 Jul 2016 13:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302896 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 13:25:48 -0000 Author: andrew Date: Fri Jul 15 13:25:47 2016 New Revision: 302896 URL: https://svnweb.freebsd.org/changeset/base/302896 Log: Implement bus_print_child to print the resources used by the ITS driver. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/gic_v3_fdt.c Modified: head/sys/arm64/arm64/gic_v3_fdt.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_fdt.c Fri Jul 15 09:44:48 2016 (r302895) +++ head/sys/arm64/arm64/gic_v3_fdt.c Fri Jul 15 13:25:47 2016 (r302896) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); */ static int gic_v3_fdt_probe(device_t); static int gic_v3_fdt_attach(device_t); +static int gic_v3_fdt_print_child(device_t, device_t); static struct resource *gic_v3_ofw_bus_alloc_res(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); @@ -64,6 +65,7 @@ static device_method_t gic_v3_fdt_method DEVMETHOD(device_attach, gic_v3_fdt_attach), /* Bus interface */ + DEVMETHOD(bus_print_child, gic_v3_fdt_print_child), DEVMETHOD(bus_alloc_resource, gic_v3_ofw_bus_alloc_res), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), @@ -183,6 +185,20 @@ struct gic_v3_ofw_devinfo { struct resource_list di_rl; }; +static int +gic_v3_fdt_print_child(device_t bus, device_t child) +{ + struct gic_v3_ofw_devinfo *di = device_get_ivars(child); + struct resource_list *rl = &di->di_rl; + int retval = 0; + + retval += bus_print_child_header(bus, child); + retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); + retval += bus_print_child_footer(bus, child); + + return (retval); +} + static const struct ofw_bus_devinfo * gic_v3_ofw_get_devinfo(device_t bus __unused, device_t child) { From owner-svn-src-head@freebsd.org Fri Jul 15 14:25:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9431CB99EE0; Fri, 15 Jul 2016 14:25:54 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CEF71306; Fri, 15 Jul 2016 14:25:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 31BF71FE024; Fri, 15 Jul 2016 16:25:51 +0200 (CEST) Subject: Re: svn commit: r302894 - head/sys/kern To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607150928.u6F9SW3h065100@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <23f60f35-db99-ea20-837b-becd9c5c1887@selasky.org> Date: Fri, 15 Jul 2016 16:29:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201607150928.u6F9SW3h065100@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 14:25:54 -0000 On 07/15/16 11:28, Gleb Smirnoff wrote: > Author: glebius > Date: Fri Jul 15 09:28:32 2016 > New Revision: 302894 > URL: https://svnweb.freebsd.org/changeset/base/302894 > > Log: > Fix regression introduced by r302350. The change of return value for a > callout that wasn't scheduled at all was unintentional and yielded in > several panics. > > PR: 210884 > > Modified: > head/sys/kern/kern_timeout.c > > Modified: head/sys/kern/kern_timeout.c > ============================================================================== > --- head/sys/kern/kern_timeout.c Fri Jul 15 09:23:18 2016 (r302893) > +++ head/sys/kern/kern_timeout.c Fri Jul 15 09:28:32 2016 (r302894) > @@ -1381,7 +1381,7 @@ again: > CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", > c, c->c_func, c->c_arg); > CC_UNLOCK(cc); > - return (cancelled); > + return (0); > } > > c->c_iflags &= ~CALLOUT_PENDING; > > Hi, I think r302894 and r302350 changes the return value of the following case, which is not described in the commit message? Is this also a regression? In this revision: > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?view=markup&pathrev=296320 Assume we enter _callout_stop_safe() having the following assertions: (c->c_iflags & CALLOUT_PENDING) == 0 (satisfied) cc_exec_curr(cc, direct) != c (satisfied) Then we exit returning (-1). In this revision: > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?view=markup&pathrev=296320#l1253 After your changes, entering the same function under the same conditions: cc_exec_curr(cc, direct) == c (not satisifed) (c->c_iflags & CALLOUT_PENDING) == 0 (satisfied) Then we exit returning (0). > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?revision=302894&view=markup#l1384 If we call callout_stop() on a never scheduled callout, we now get a return value of 0 instead of -1, which by manual page definition is wrong ???? Am I wrong? Do others see this too? --HPS From owner-svn-src-head@freebsd.org Fri Jul 15 14:57:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F32D8B9A835; Fri, 15 Jul 2016 14:57:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BAE2D14DC; Fri, 15 Jul 2016 14:57:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id j185so160336651oih.0; Fri, 15 Jul 2016 07:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6ckV2C1dS6lZziiWiPqH7SkeIv53KuVB7NjeeS8Y/GI=; b=ypp+RgcaT6am8AiRGz7jirIckD68b0uihAc/goKLbt9u56eIGeNCxgvFiGZze656Vv N+rSrJrbbVGj9mPeHmFJT24faCMqwZs3uS2NUK1w5V6YBTJ4QuqlYqiY38CsElZpilo3 d9bZYQHhINv8nSNNFfr31wKcX2rcG+ZH9TFqYRTawBswSP1138NuuZOoQnnM+PBjJeI5 Ql+Tp9qyctuVDjTgUZR+vhNcfbMTXPSGfCYn/50jjDBZIGH0L0ZiQJ16LCMe2jf5oWKZ 2HUqGTIs7ZCdnlcriqwqjNVAP+NcgAILrDHhmRPSsiDub0YqfFdGxjtR9Zo0MHU2GNKb RVEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6ckV2C1dS6lZziiWiPqH7SkeIv53KuVB7NjeeS8Y/GI=; b=U79ycbjB0klBt39Nq8CVQDKXS4B8tiKE1q6d0OXhr0nwhj+Pz+s6lRFxT4QgKhKH5S m4/JunAjz1pJbtE5+ZapbS/sLZks3fMi+lHn+EE60FnbeYtjn8LVJ/SQp8Ve1P0ByymW lLDQp7mxKL5k+CnnrEJ6gPvSF3qqS4+5gp4XkafImWbL9mEYyd35xv1XNhUfwoC55bDq ttuB/9ioPebD6LAkomkrNP2XMeIKJCsJLhqZ7ngmDIzA8/PdHVz5fXtRwa2ZaLTfk6ux 0wdqJns2VoDhRYlHgHomqTrE88NJqUAogTaIJqPSkfF1NqEabTNVWNwvE6YspJwKVRhT ltFQ== X-Gm-Message-State: ALyK8tJzG7t854KAWElMAXt5d2APHdlv+I1RXh6rmd16DHtpjQX4do/WnoD3V3njJb3O+JM47NAkDY+C0+IQAA== X-Received: by 10.202.230.84 with SMTP id d81mr8824589oih.182.1468594667463; Fri, 15 Jul 2016 07:57:47 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.202.198.16 with HTTP; Fri, 15 Jul 2016 07:57:46 -0700 (PDT) In-Reply-To: <201410032036.s93KaAjb075845@svn.freebsd.org> References: <201410032036.s93KaAjb075845@svn.freebsd.org> From: Alan Somers Date: Fri, 15 Jul 2016 08:57:46 -0600 X-Google-Sender-Auth: W9Vrn1AMo8ZT27u0NaF5JpWthI4 Message-ID: Subject: Re: svn commit: r272484 - in head: . cddl/lib/libzfs cddl/lib/libzpool To: Xin LI Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 14:57:49 -0000 On Fri, Oct 3, 2014 at 2:36 PM, Xin LI wrote: > Author: delphij > Date: Fri Oct 3 20:36:09 2014 > New Revision: 272484 > URL: https://svnweb.freebsd.org/changeset/base/272484 > > Log: > Add dependencies to various libraries to libzfs and libzpool. > > Submitted by: sef > > Modified: > head/Makefile.inc1 > head/cddl/lib/libzfs/Makefile > head/cddl/lib/libzpool/Makefile > > Modified: head/Makefile.inc1 > ============================================================================== > --- head/Makefile.inc1 Fri Oct 3 20:34:55 2014 (r272483) > +++ head/Makefile.inc1 Fri Oct 3 20:36:09 2014 (r272484) > @@ -1531,7 +1531,9 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 > lib/ncurses/ncurses lib/ncurses/ncursesw \ > lib/libopie lib/libpam ${_lib_libthr} \ > lib/libradius lib/libsbuf lib/libtacplus \ > + lib/libgeom \ > ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ > + ${_cddl_lib_libuutil} \ > ${_cddl_lib_libavl} \ > ${_cddl_lib_libzfs_core} \ > lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ > @@ -1543,6 +1545,8 @@ gnu/lib/libstdc++__L: lib/msun__L > gnu/lib/libsupc++__L: gnu/lib/libstdc++__L > .endif > > +lib/libgeom__L: lib/libexpat__L > + > .if defined(WITH_ATF) || ${MK_TESTS} != "no" > .if !defined(WITH_ATF) > # Ensure that the ATF libraries will be built during make libraries, even > @@ -1580,9 +1584,11 @@ lib/libopie__L lib/libtacplus__L: lib/li > _cddl_lib_libumem= cddl/lib/libumem > _cddl_lib_libnvpair= cddl/lib/libnvpair > _cddl_lib_libavl= cddl/lib/libavl > +_cddl_lib_libuutil= cddl/lib/libuutil > _cddl_lib_libzfs_core= cddl/lib/libzfs_core > _cddl_lib= cddl/lib > cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L > +cddl/lib/libzfs__L: lib/libgeom__L > .endif > > .if ${MK_CRYPT} != "no" > Is there a reason that lib/libgeom__L doesn't depend on lib/libsbuf__L, or was that an oversight? Also, ldd shows that libzfs.so has a lot of dependencies that aren't listed here: libmd, libumem, libuutil, etc. Should they be added? I apologize if I'm being dumb; I don't have a good understanding of how the prebuilt libs works. -Alan From owner-svn-src-head@freebsd.org Fri Jul 15 15:07:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF33FB9AA49; Fri, 15 Jul 2016 15:07:25 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6AF61B24; Fri, 15 Jul 2016 15:07:25 +0000 (UTC) (envelope-from robak@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FF7OQo090317; Fri, 15 Jul 2016 15:07:24 GMT (envelope-from robak@FreeBSD.org) Received: (from robak@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FF7OGH090313; Fri, 15 Jul 2016 15:07:24 GMT (envelope-from robak@FreeBSD.org) Message-Id: <201607151507.u6FF7OGH090313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: robak set sender to robak@FreeBSD.org using -f From: Bartek Rutkowski Date: Fri, 15 Jul 2016 15:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302897 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:07:26 -0000 Author: robak (ports committer) Date: Fri Jul 15 15:07:24 2016 New Revision: 302897 URL: https://svnweb.freebsd.org/changeset/base/302897 Log: Add new System Hardening menu and options to bsdinstall. This patch add new 'hardening' file responsible for new bsdinstall 'System Hardening' menu allowing users to set some sane and carefully picked system security options (like random process id's, hiding other users/groups processes and others). All options are OFF by default in this patch due to POLA principle with intention to turn change some of them to ON by default in future. Reviewed by: adrian, allanjude, bdrewery, nwhitehorn Approved by: adrian, allanjude MFC after: 7 days Added: head/usr.sbin/bsdinstall/scripts/hardening (contents, props changed) Modified: head/usr.sbin/bsdinstall/scripts/Makefile head/usr.sbin/bsdinstall/scripts/auto head/usr.sbin/bsdinstall/scripts/config Modified: head/usr.sbin/bsdinstall/scripts/Makefile ============================================================================== --- head/usr.sbin/bsdinstall/scripts/Makefile Fri Jul 15 13:25:47 2016 (r302896) +++ head/usr.sbin/bsdinstall/scripts/Makefile Fri Jul 15 15:07:24 2016 (r302897) @@ -1,6 +1,6 @@ # $FreeBSD$ -SCRIPTS= auto adduser checksum config docsinstall entropy hostname jail \ +SCRIPTS= auto adduser checksum config docsinstall entropy hardening hostname jail \ keymap mirrorselect mount netconfig netconfig_ipv4 netconfig_ipv6 \ rootpass script services time umount wlanconfig zfsboot BINDIR= ${LIBEXECDIR}/bsdinstall Modified: head/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- head/usr.sbin/bsdinstall/scripts/auto Fri Jul 15 13:25:47 2016 (r302896) +++ head/usr.sbin/bsdinstall/scripts/auto Fri Jul 15 15:07:24 2016 (r302897) @@ -385,6 +385,7 @@ if [ "$NETCONFIG_DONE" != yes ]; then fi bsdinstall time bsdinstall services +bsdinstall hardening dialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \ "Would you like to add users to the installed system now?" 0 0 && \ @@ -401,6 +402,7 @@ finalconfig() { "Hostname" "Set system hostname" \ "Network" "Networking configuration" \ "Services" "Set daemons to run on startup" \ + "System Hardening" "Set security options" \ "Time Zone" "Set system timezone" \ "Handbook" "Install FreeBSD Handbook (requires network)" 2>&1 1>&3) exec 3>&- @@ -426,6 +428,10 @@ finalconfig() { bsdinstall services finalconfig ;; + "System Hardening") + bsdinstall hardening + finalconfig + ;; "Time Zone") bsdinstall time finalconfig Modified: head/usr.sbin/bsdinstall/scripts/config ============================================================================== --- head/usr.sbin/bsdinstall/scripts/config Fri Jul 15 13:25:47 2016 (r302896) +++ head/usr.sbin/bsdinstall/scripts/config Fri Jul 15 15:07:24 2016 (r302897) @@ -32,6 +32,9 @@ cat $BSDINSTALL_TMPETC/rc.conf.* >> $BSDINSTALL_TMPETC/rc.conf rm $BSDINSTALL_TMPETC/rc.conf.* +cat $BSDINSTALL_CHROOT/etc/sysctl.conf $BSDINSTALL_TMPETC/sysctl.conf.hardening >> $BSDINSTALL_TMPETC/sysctl.conf +rm $BSDINSTALL_TMPETC/sysctl.conf.* + cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf Added: head/usr.sbin/bsdinstall/scripts/hardening ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bsdinstall/scripts/hardening Fri Jul 15 15:07:24 2016 (r302897) @@ -0,0 +1,79 @@ +#!/bin/sh +#- +# Copyright (c) 2016 Bartek Rutkowski +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +: ${DIALOG_OK=0} + +echo -n > $BSDINSTALL_TMPETC/rc.conf.services + +exec 3>&1 +FEATURES=$( dialog --backtitle "FreeBSD Installer" \ + --title "System Hardening" --nocancel --notags --separate-output \ + --checklist "Choose system security hardening options:" \ + 0 0 0 \ + "hide_uids" "Hide processes running as other users" ${hide_uids:-off} \ + "hide_gids" "Hide processes running as other groups" ${hide_gids:-off} \ + "read_msgbuf" "Disable reading kernel message buffer for unprivileged users" ${read_msgbuf:-off} \ + "proc_debug" "Disable process debugging facilities for unprivileged users" ${proc_debug:-off} \ + "random_pid" "Randomize the PID of newly created processes" ${random_id:-off} \ + "stack_guard" "Insert stack guard page ahead of the growable segments" ${stack_guard:-off} \ + "clear_tmp" "Clean the /tmp filesystem on system startup" ${clear_tmp:-off} \ + "disable_syslogd" "Disable opening Syslogd network socket (disables remote logging)" ${disable_syslogd:-off} \ + "disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \ +2>&1 1>&3 ) +exec 3>&- + +for feature in $FEATURES; do + if [ "$feature" = "hide_uids" ]; then + echo security.bsd.see_other_uids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "hide_gids" ]; then + echo security.bsd.see_other_gids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "read_msgbuf" ]; then + echo security.bsd.unprivileged_read_msgbuf=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "proc_debug" ]; then + echo security.bsd.unprivileged_proc_debug=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "random_id" ]; then + echo kern.randompid=$(jot -r 1 9999) >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "stack_guard" ]; then + echo security.bsd.stack_guard_page=1 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening + fi + if [ "$feature" = "clear_tmp" ]; then + echo 'clear_tmp_enable="YES"' >> $BSDINSTALL_TMPETC/rc.conf.hardening + fi + if [ "$feature" = "disable_syslogd" ]; then + echo 'syslogd_flags="-ss"' >> $BSDINSTALL_TMPETC/rc.conf.hardening + fi + if [ "$feature" = "disable_sendmail" ]; then + echo 'sendmail_enable="NONE"' >> $BSDINSTALL_TMPETC/rc.conf.hardening + fi +done + From owner-svn-src-head@freebsd.org Fri Jul 15 15:09:50 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19E87B9AABB; Fri, 15 Jul 2016 15:09:50 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7E531CFF; Fri, 15 Jul 2016 15:09:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FF9mih090433; Fri, 15 Jul 2016 15:09:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FF9mBU090431; Fri, 15 Jul 2016 15:09:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607151509.u6FF9mBU090431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 15 Jul 2016 15:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302898 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:09:50 -0000 Author: cy Date: Fri Jul 15 15:09:48 2016 New Revision: 302898 URL: https://svnweb.freebsd.org/changeset/base/302898 Log: Revert r302865 and it's sister r302866 as r302865 causes some breakage. Reported by: Guy Yur Modified: head/Makefile.inc1 head/UPDATING Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jul 15 15:07:24 2016 (r302897) +++ head/Makefile.inc1 Fri Jul 15 15:09:48 2016 (r302898) @@ -1140,8 +1140,6 @@ BUILDKERNELS+= ${_kernel} .if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) INSTALLKERNEL= ${_kernel} .endif -.else -.error Missing KERNCONF ${KERNCONFDIR}/${_kernel} .endif .endfor Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jul 15 15:07:24 2016 (r302897) +++ head/UPDATING Fri Jul 15 15:09:48 2016 (r302898) @@ -31,14 +31,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20160714: - As of r302865 when building multiple kernels using KERNCONF, - non-existent KERNCONF files will produce an error and buildkernel - will fail. Previous to r302865 missing KERNCONF files silently - failed giving no indication as to why, only to subsequently discover - during installkernel that the desired kernel was never built in the - first place. - 20160622: The libc stub for the pipe(2) system call has been replaced with a wrapper which calls the pipe2(2) system call and the pipe(2) is now From owner-svn-src-head@freebsd.org Fri Jul 15 15:12:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0D34B9ACC8; Fri, 15 Jul 2016 15:12:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD93A1438; Fri, 15 Jul 2016 15:12:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FFCwxX093834; Fri, 15 Jul 2016 15:12:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FFCv8P093824; Fri, 15 Jul 2016 15:12:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607151512.u6FFCv8P093824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Jul 2016 15:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302899 - in head: lib/libc/sys share/man/man3 share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:12:59 -0000 Author: jhb Date: Fri Jul 15 15:12:56 2016 New Revision: 302899 URL: https://svnweb.freebsd.org/changeset/base/302899 Log: Add documentation for the sigevent structure. - Add a sigevent(3) manpage to give a general overview of the sigevent structure and the available notification mechanisms. - Document that AIO requests contain a nested sigevent structure that can be used to request completion notification. - Expand the sigevent details in other manuals to note details such as the extra values stored in a queued signal's information or in a posted kevent. Reviewed by: kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7122 Added: head/share/man/man3/sigevent.3 (contents, props changed) Modified: head/lib/libc/sys/aio_fsync.2 head/lib/libc/sys/aio_mlock.2 head/lib/libc/sys/aio_read.2 head/lib/libc/sys/aio_write.2 head/lib/libc/sys/lio_listio.2 head/lib/libc/sys/mq_notify.2 head/lib/libc/sys/timer_create.2 head/share/man/man3/Makefile head/share/man/man4/aio.4 Modified: head/lib/libc/sys/aio_fsync.2 ============================================================================== --- head/lib/libc/sys/aio_fsync.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/aio_fsync.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2013 +.Dd July 15, 2016 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -71,6 +71,29 @@ while it is in progress. .Pp If the request could not be enqueued (generally due to invalid arguments), the call returns without having enqueued the request. +.Pp +The +.Fa iocb->aio_sigevent +structure can be used to request notification of the request's +completion as described in +.Xr aio 4 . +.Sh RESTRICTIONS +The asynchronous I/O Control Block structure pointed to by +.Fa iocb +must remain valid until the +operation has completed. +For this reason, use of auto (stack) variables +for these objects is discouraged. +.Pp +The asynchronous I/O control buffer +.Fa iocb +should be zeroed before the +.Fn aio_fsync +call to avoid passing bogus context information to the kernel. +.Pp +Modifications of the Asynchronous I/O Control Block structure or the +buffer contents after the request has been enqueued, but before the +request has completed, are not allowed. .Sh RETURN VALUES .Rv -std aio_fsync .Sh ERRORS @@ -80,6 +103,10 @@ system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The request was not queued because of system resource limitations. +.It Bq Er EINVAL +The asynchronous notification method in +.Fa iocb->aio_sigevent.sigev_notify +is invalid or not supported. .It Bq Er ENOSYS The .Fn aio_fsync @@ -138,6 +165,7 @@ system calls. .Xr aio_waitcomplete 2 , .Xr aio_write 2 , .Xr fsync 2 , +.Xr sigevent 3 , .Xr siginfo 3 , .Xr aio 4 .Sh STANDARDS Modified: head/lib/libc/sys/aio_mlock.2 ============================================================================== --- head/lib/libc/sys/aio_mlock.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/aio_mlock.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 3, 2013 +.Dd July 15, 2016 .Dt AIO_MLOCK 2 .Os .Sh NAME @@ -64,6 +64,12 @@ If the request could not be enqueued (ge .Xr aio 4 limits), then the call returns without having enqueued the request. +.Pp +The +.Fa iocb->aio_sigevent +structure can be used to request notification of the request's +completion as described in +.Xr aio 4 . .Sh RESTRICTIONS The Asynchronous I/O Control Block structure pointed to by .Fa iocb @@ -92,6 +98,10 @@ system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The request was not queued because of system resource limitations. +.It Bq Er EINVAL +The asynchronous notification method in +.Fa iocb->aio_sigevent.sigev_notify +is invalid or not supported. .It Bq Er ENOSYS The .Fn aio_mlock @@ -116,6 +126,7 @@ if the request was explicitly cancelled .Xr aio_error 2 , .Xr aio_return 2 , .Xr mlock 2 , +.Xr sigevent 3 , .Xr aio 4 .Sh PORTABILITY The Modified: head/lib/libc/sys/aio_read.2 ============================================================================== --- head/lib/libc/sys/aio_read.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/aio_read.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 17, 1998 +.Dd July 15, 2016 .Dt AIO_READ 2 .Os .Sh NAME @@ -79,6 +79,12 @@ If the request is successfully enqueued, .Fa iocb->aio_offset can be modified during the request as context, so this value must not be referenced after the request is enqueued. +.Pp +The +.Fa iocb->aio_sigevent +structure can be used to request notification of the request's +completion as described in +.Xr aio 4 . .Sh RESTRICTIONS The Asynchronous I/O Control Block structure pointed to by .Fa iocb @@ -115,6 +121,10 @@ system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The request was not queued because of system resource limitations. +.It Bq Er EINVAL +The asynchronous notification method in +.Fa iocb->aio_sigevent.sigev_notify +is invalid or not supported. .It Bq Er ENOSYS The .Fn aio_read @@ -191,6 +201,7 @@ would be invalid. .Xr aio_suspend 2 , .Xr aio_waitcomplete 2 , .Xr aio_write 2 , +.Xr sigevent 3 , .Xr siginfo 3 , .Xr aio 4 .Sh STANDARDS Modified: head/lib/libc/sys/aio_write.2 ============================================================================== --- head/lib/libc/sys/aio_write.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/aio_write.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 1999 +.Dd July 15, 2016 .Dt AIO_WRITE 2 .Os .Sh NAME @@ -85,6 +85,12 @@ If the request is successfully enqueued, .Fa iocb->aio_offset can be modified during the request as context, so this value must not be referenced after the request is enqueued. +.Pp +The +.Fa iocb->aio_sigevent +structure can be used to request notification of the request's +completion as described in +.Xr aio 4 . .Sh RESTRICTIONS The Asynchronous I/O Control Block structure pointed to by .Fa iocb @@ -119,6 +125,10 @@ system call will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The request was not queued because of system resource limitations. +.It Bq Er EINVAL +The asynchronous notification method in +.Fa iocb->aio_sigevent.sigev_notify +is invalid or not supported. .It Bq Er ENOSYS The .Fn aio_write @@ -186,6 +196,7 @@ would be invalid. .Xr aio_return 2 , .Xr aio_suspend 2 , .Xr aio_waitcomplete 2 , +.Xr sigevent 3 , .Xr siginfo 3 , .Xr aio 4 .Sh STANDARDS Modified: head/lib/libc/sys/lio_listio.2 ============================================================================== --- head/lib/libc/sys/lio_listio.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/lio_listio.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2003 +.Dd July 15, 2016 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -83,14 +83,52 @@ If .Fa mode is .Dv LIO_NOWAIT , -the requests are processed asynchronously, and the signal specified by .Fa sig -is sent when all operations have completed. +can be used to request asynchronous notification when all operations have +completed. If .Fa sig is .Dv NULL , -the calling process is not notified of I/O completion. +no notification is sent. +.Pp +For +.Dv SIGEV_KEVENT +notifications, +the posted kevent will contain: +.Bl -column ".Va filter" +.It Sy Member Ta Sy Value +.It Va ident Ta Fa list +.It Va filter Ta Dv EVFILT_LIO +.It Va udata Ta +value stored in +.Fa sig->sigev_value +.El +.Pp +For +.Dv SIGEV_SIGNO +and +.Dv SIGEV_THREAD_ID +notifications, +the information for the queued signal will include +.Dv SI_ASYNCIO +in the +.Va si_code +field and the value stored in +.Fa sig->sigev_value +in the +.Va si_value +field. +.Pp +For +.Dv SIGEV_THREAD +notifications, +the value stored in +.Fa sig->sigev_value +is passed to the +.Fa sig->sigev_notify_function +as described in +.Xr sigevent 3 . .Pp The order in which the requests are carried out is not specified; in particular, there is no guarantee that they will be executed in @@ -136,6 +174,10 @@ or .Fa nent is greater than .Dv AIO_LISTIO_MAX . +.It Bq Er EINVAL +The asynchronous notification method in +.Fa sig->sigev_notify +is invalid or not supported. .It Bq Er EINTR A signal interrupted the system call before it could be completed. .It Bq Er EIO @@ -166,6 +208,7 @@ structure individually by calling .Xr aio_write 2 , .Xr read 2 , .Xr write 2 , +.Xr sigevent 3 , .Xr siginfo 3 , .Xr aio 4 .Sh STANDARDS Modified: head/lib/libc/sys/mq_notify.2 ============================================================================== --- head/lib/libc/sys/mq_notify.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/mq_notify.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 29, 2005 +.Dd July 15, 2016 .Dt MQ_NOTIFY 2 .Os .Sh NAME @@ -77,18 +77,27 @@ is .Dv SIGEV_NONE , then no signal will be posted, but the error status and the return status for the operation will be set appropriately. -If -.Fa notification->sigev_notify -is -.Dv SIGEV_SIGNAL , -then the signal specified in +For +.Dv SIGEV_SIGNO +and +.Dv SIGEV_THREAD_ID +notifications, +the signal specified in .Fa notification->sigev_signo -will be sent to the process. -The signal will be queued to the process and the value specified in +will be sent to the calling process +.Pq Dv SIGEV_SIGNO +or to the thread whose LWP ID is +.Fa notification->sigev_notify_thread_id +.Pq Dv SIGEV_THREAD_ID . +The information for the queued signal will include: +.Bl -column ".Va si_value" +.It Sy Member Ta Sy Value +.It Va si_code Ta Dv SI_MESGQ +.It Va si_value Ta +the value stored in .Fa notification->sigev_value -will be the -.Va si_value -component of the generated signal. +.It Va si_mqd Ta Fa mqdes +.El .Pp If .Fa notification @@ -123,11 +132,16 @@ The argument is not a valid message queue descriptor. .It Bq Er EBUSY Process is already registered for notification by the message queue. +.It Bq Er EINVAL +The asynchronous notification method in +.Fa notification->sigev_notify +is invalid or not supported. .El .Sh SEE ALSO .Xr mq_open 2 , .Xr mq_send 2 , .Xr mq_timedsend 2 , +.Xr sigevent 3 , .Xr siginfo 3 .Sh STANDARDS The Modified: head/lib/libc/sys/timer_create.2 ============================================================================== --- head/lib/libc/sys/timer_create.2 Fri Jul 15 15:09:48 2016 (r302898) +++ head/lib/libc/sys/timer_create.2 Fri Jul 15 15:12:56 2016 (r302899) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2009 +.Dd July 15, 2016 .Dt TIMER_CREATE 2 .Os .Sh NAME @@ -74,6 +74,36 @@ structure. This structure, allocated by the application, defines the asynchronous notification to occur when the timer expires. +.Pp +If +.Fa evp->sigev_notify +is +.Dv SIGEV_SIGNO +or +.Dv SIGEV_THREAD_ID , +the signal specified in +.Fa evp->sigev_signo +will be sent to the calling process +.Pq Dv SIGEV_SIGNO +or to the thread whose LWP ID is +.Fa evp->sigev_notify_thread_id +.Pq Dv SIGEV_THREAD_ID . +The information for the queued signal will include: +.Bl -column ".Va si_value" +.It Sy Member Ta Sy Value +.It Va si_code Ta Dv SI_TIMER +.It Va si_value Ta +the value stored in +.Fa evp->sigev_value +.It Va si_timerid Ta timer ID +.It Va si_overrun Ta timer overrun count +.It Va si_errno Ta +If timer overrun is +.Brq Dv DELAYTIMER_MAX , +an error code defined in +.In errno.h +.El +.Pp If the .Fa evp argument is @@ -88,12 +118,14 @@ member having the value .Dv SIGEV_SIGNAL , the .Va sigev_signo -having a default signal number, and the +having a default signal number +.Pq Dv SIGALRM , +and the .Va sigev_value member having the value of the timer ID. .Pp -The implementations supports a +This implementation supports a .Fa clock_id of .Dv CLOCK_REALTIME @@ -144,6 +176,8 @@ The calling process has already created this implementation. .It Bq Er EINVAL The specified clock ID is not supported. +.It Bq Er EINVAL +The specified asynchronous notification method is not supported. .It Bq Er EFAULT Any arguments point outside the allocated address space or there is a memory protection fault. @@ -152,6 +186,7 @@ memory protection fault. .Xr clock_getres 2 , .Xr timer_delete 2 , .Xr timer_getoverrun 2 , +.Xr sigevent 3 , .Xr siginfo 3 .Sh STANDARDS The Modified: head/share/man/man3/Makefile ============================================================================== --- head/share/man/man3/Makefile Fri Jul 15 15:09:48 2016 (r302898) +++ head/share/man/man3/Makefile Fri Jul 15 15:12:56 2016 (r302899) @@ -15,6 +15,7 @@ MAN= assert.3 \ offsetof.3 \ ${PTHREAD_MAN} \ queue.3 \ + sigevent.3 \ siginfo.3 \ stdarg.3 \ sysexits.3 \ Added: head/share/man/man3/sigevent.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/sigevent.3 Fri Jul 15 15:12:56 2016 (r302899) @@ -0,0 +1,127 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2016 John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 15, 2016 +.Dt SIGEVENT 3 +.Os +.Sh NAME +.Nm sigevent +.Nd "asynchronous event notification" +.Sh SYNOPSIS +.In signal.h +.Sh DESCRIPTION +Some operations permit threads to request asychronous notification of events +via a +.Vt struct sigevent +structure. +This structure contains several fields that describe the requested notification: +.Bl -column ".Vt void (*)(union sigval)" ".Va sigev_notify_kevent_flags" +.It Sy Type Ta Sy Member Ta Sy Description +.It Vt int Ta sigev_notify Ta notification method +.It Vt int Ta sigev_signo Ta signal number +.It Vt union sigval Ta sigev_value Ta signal value +.It Vt int Ta sigev_notify_kqueue Ta +.Xr kqueue 2 +file descriptor +.It Vt unsigned short Ta sigev_notify_kevent_flags Ta kevent flags +.It Vt lwpid_t Ta sigev_notify_thread_id Ta LWP ID +.It Vt void (*)(union sigval) Ta sigev_notify_function Ta +callback function pointer +.It Vt pthread_attr_t * Ta sigev_notify_attributes Ta +callback thread attributes +.El +.Pp +The +.Va sigev_notify +field specifies the notification method used when the event triggers: +.Bl -tag -width ".Dv SIGEV_THREAD_ID" +.It Dv SIGEV_NONE +No notification is sent. +.It Dv SIGEV_SIGNAL +The signal +.Va sigev_signo +is queued as a real-time signal to the calling process. +The value stored in +.Va sigev_value +will be present in the +.Va si_value +of the +.Vt siginfo_t +structure of the queued signal. +.It Dv SIGEV_THREAD +The notification function in +.Va sigev_notify_function +is called in a separate thread context. +The thread is created with the attributes specified in +.Va *sigev_notify_attributes . +The value stored in +.Va sigev_value +is passed as the sole argument to +.Va sigev_notify_function . +If +.Va sigev_notify_attributes +is +.Dv NULL , +the thread is created with default attributes. +.It Dv SIGEV_KEVENT +A new kevent is posted to the kqueue +.Va sigev_notify_kqueue . +The +.Va udata +member of the kevent structure contains the value stored in +.Va sigev_value . +The meaning of other fields in the kevent are specific to the type of triggered +event. +.It Dv SIGEV_THREAD_ID +The signal +.Va sigev_signo +is queued to the thread whose LWP ID is +.Va sigev_notify_thread_id . +The value stored in +.Va sigev_value +will be present in the +.Va si_value +of the +.Vt siginfo_t +structure of the queued signal. +.El +.Sh NOTES +Note that programs wishing to use +.Dv SIGEV_THREAD +notifications must link against the +.Lb librt . +.Sh SEE ALSO +.Xr aio_read 2 , +.Xr mq_notify 2 , +.Xr timer_create 2 , +.Xr siginfo 3 +.Sh STANDARDS +The +.Vt struct sigevent +type conforms to +.St -p1003.1-2004 . Modified: head/share/man/man4/aio.4 ============================================================================== --- head/share/man/man4/aio.4 Fri Jul 15 15:09:48 2016 (r302898) +++ head/share/man/man4/aio.4 Fri Jul 15 15:12:56 2016 (r302899) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2016 +.Dd July 15, 2016 .Dt AIO 4 .Os .Sh NAME @@ -137,6 +137,54 @@ The number of outstanding asynchronous I The maximum number of outstanding asynchronous I/O requests permitted system-wide. .El +.Pp +Asynchronous I/O control buffers should be zeroed before initializing +individual fields. +This ensures all fields are initialized. +.Pp +All asynchronous I/O control buffers contain a +.Vt sigevent +structure in the +.Va aio_sigevent +field which can be used to request notification when an operation completes. +.Pp +For +.Dv SIGEV_KEVENT +notifications, +the posted kevent will contain: +.Bl -column ".Va filter" +.It Sy Member Ta Sy Value +.It Va ident Ta asynchronous I/O control buffer pointer +.It Va filter Ta Dv EVFILT_AIO +.It Va udata Ta +value stored in +.Va aio_sigevent.sigev_value +.El +.Pp +For +.Dv SIGEV_SIGNO +and +.Dv SIGEV_THREAD_ID +notifications, +the information for the queued signal will include +.Dv SI_ASYNCIO +in the +.Va si_code +field and the value stored in +.Va sigevent.sigev_value +in the +.Va si_value +field. +.Pp +For +.Dv SIGEV_THREAD +notifications, +the value stored in +.Va aio_sigevent.sigev_value +is passed to the +.Va aio_sigevent.sigev_notify_function +as described in +.Xr sigevent 3 . .Sh SEE ALSO .Xr aio_cancel 2 , .Xr aio_error 2 , @@ -146,6 +194,7 @@ system-wide. .Xr aio_waitcomplete 2 , .Xr aio_write 2 , .Xr lio_listio 2 , +.Xr sigevent 3 , .Xr sysctl 8 .Sh HISTORY The From owner-svn-src-head@freebsd.org Fri Jul 15 15:28:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5019EB9911D; Fri, 15 Jul 2016 15:28:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00D3A1C91; Fri, 15 Jul 2016 15:28:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FFSYRJ097918; Fri, 15 Jul 2016 15:28:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FFSYhU097917; Fri, 15 Jul 2016 15:28:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607151528.u6FFSYhU097917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Jul 2016 15:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302900 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:28:35 -0000 Author: jhb Date: Fri Jul 15 15:28:33 2016 New Revision: 302900 URL: https://svnweb.freebsd.org/changeset/base/302900 Log: Add a test for user signal delivery. This test verifies we get the correct ptrace event details when a signal is posted to a traced process from userland. Reviewed by: kib (part of D7044) Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Fri Jul 15 15:12:56 2016 (r302899) +++ head/tests/sys/kern/ptrace_test.c Fri Jul 15 15:28:33 2016 (r302900) @@ -1355,6 +1355,67 @@ ATF_TC_BODY(ptrace__lwp_events_exec, tc) ATF_REQUIRE(errno == ECHILD); } +static void +handler(int sig __unused) +{ +} + +static void +signal_main(void) +{ + + signal(SIGINFO, handler); + raise(SIGINFO); + exit(0); +} + +/* + * Verify that the expected ptrace event is reported for a signal. + */ +ATF_TC_WITHOUT_HEAD(ptrace__siginfo); +ATF_TC_BODY(ptrace__siginfo, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + signal_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next event should be for the SIGINFO. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGINFO); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE(pl.pl_event == PL_EVENT_SIGNAL); + ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI); + ATF_REQUIRE(pl.pl_siginfo.si_code == SI_LWP); + ATF_REQUIRE(pl.pl_siginfo.si_pid == wpid); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -1376,6 +1437,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__new_child_pl_syscall_code_thread); ATF_TP_ADD_TC(tp, ptrace__lwp_events); ATF_TP_ADD_TC(tp, ptrace__lwp_events_exec); + ATF_TP_ADD_TC(tp, ptrace__siginfo); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Fri Jul 15 15:32:11 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B46ABB99287; Fri, 15 Jul 2016 15:32:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60FB9132C; Fri, 15 Jul 2016 15:32:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FFWA8w000873; Fri, 15 Jul 2016 15:32:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FFW9JE000862; Fri, 15 Jul 2016 15:32:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607151532.u6FFW9JE000862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 15 Jul 2016 15:32:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302902 - in head: lib/libc/sys sys/kern sys/sys tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:32:11 -0000 Author: jhb Date: Fri Jul 15 15:32:09 2016 New Revision: 302902 URL: https://svnweb.freebsd.org/changeset/base/302902 Log: Add a mask of optional ptrace() events. ptrace() now stores a mask of optional events in p_ptevents. Currently this mask is a single integer, but it can be expanded into an array of integers in the future. Two new ptrace requests can be used to manipulate the event mask: PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK sets the current event mask. The current set of events include: - PTRACE_EXEC: trace calls to execve(). - PTRACE_SCE: trace system call entries. - PTRACE_SCX: trace syscam call exits. - PTRACE_FORK: trace forks and auto-attach to new child processes. - PTRACE_LWP: trace LWP events. The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have been replaced by PTRACE_SCE and PTRACE_SCX. PTRACE_FORK replaces P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS. The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for compatibility but now simply toggle corresponding flags in the event mask. While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both modify the event mask and continue the traced process. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7044 Modified: head/lib/libc/sys/ptrace.2 head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/subr_syscall.c head/sys/kern/sys_process.c head/sys/sys/proc.h head/sys/sys/ptrace.h head/tests/sys/kern/ptrace_test.c Modified: head/lib/libc/sys/ptrace.2 ============================================================================== --- head/lib/libc/sys/ptrace.2 Fri Jul 15 15:30:09 2016 (r302901) +++ head/lib/libc/sys/ptrace.2 Fri Jul 15 15:32:09 2016 (r302902) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd December 29, 2015 +.Dd July 15, 2016 .Dt PTRACE 2 .Os .Sh NAME @@ -58,8 +58,9 @@ The signal may be a normal process signa traced process behavior, or use of the .Xr kill 2 system call; alternatively, it may be generated by the tracing facility -as a result of attaching, system calls, or stepping by the tracing -process. +as a result of attaching, stepping by the tracing +process, +or an event in the traced process. The tracing process may choose to intercept the signal, using it to observe process behavior (such as .Dv SIGTRAP ) , @@ -69,6 +70,111 @@ The system call is the mechanism by which all this happens. .Pp +A traced process may report additional signal stops corresponding to +events in the traced process. +These additional signal stops are reported as +.Dv SIGTRAP +signals. +The tracing process can use the +.Dv PT_LWPINFO +request to determine which events are associated with a +.Dv SIGTRAP +signal. +Note that multiple events may be associated with a single signal. +For example, events indicated by the +.Dv PL_FLAG_BORN , +.Dv PL_FLAG_FORKED , +and +.Dv PL_FLAG_EXEC +flags are also reported as a system call exit event +.Pq Dv PL_FLAG_SCX . +.Pp +Each traced process has a tracing event mask. +An event in the traced process only reports a +.Dv SIGTRAP +signal stop if the corresponding flag is set in the tracing event mask. +The current set of tracing event flags include: +.Bl -tag -width ".Dv PTRACE_SYSCALL" +.It Dv PTRACE_EXEC +Report a stop for a successful invocation of +.Xr execve 2 . +This event is indicated by the +.Dv PL_FLAG_EXEC +flag in the +.Va pl_flags +member of +.Vt "struct ptrace_lwpinfo" . +.It Dv PTRACE_SCE +Report a stop on each system call entry. +This event is indicated by the +.Dv PL_FLAG_SCE +flag in the +.Va pl_flags +member of +.Vt "struct ptrace_lwpinfo" . +.It Dv PTRACE_SCX +Report a stop on each system call exit. +This event is indicated by the +.Dv PL_FLAG_SCX +flag in the +.Va pl_flags +member of +.Vt "struct ptrace_lwpinfo" . +.It Dv PTRACE_SYSCALL +Report stops for both system call entry and exit. +.It Dv PTRACE_FORK +This event flag controls tracing for new child processes of a traced process. +.Pp +When this event flag is enabled, +new child processes will enable tracing and stop before executing their +first instruction. +The new child process will include the +.Dv PL_FLAG_CHILD +flag in the +.Va pl_flags +member of +.Vt "struct ptrace_lwpinfo" . +The traced process will report a stop that includes the +.Dv PL_FLAG_FORKED +flag. +The process ID of the new child process will also be present in the +.Va pl_child_pid +member of +.Vt "struct ptrace_lwpinfo" . +Note that new child processes will be attached with the default +tracing event mask; +they do not inherit the event mask of the traced process. +.Pp +When this event flag is not enabled, +new child processes will execute without tracing enabled. +.It Dv PTRACE_LWP +This event flag controls tracing of LWP +.Pq kernel thread +creation and destruction. +When this event is enabled, +new LWPs will stop and report an event with +.Dv PL_FLAG_BORN +set before executing their first instruction, +and exiting LWPs will stop and report an event with +.Dv PL_FLAG_EXITED +set before completing their termination. +.Pp +Note that new processes do not report an event for the creation of their +initial thread, +and exiting processes do not report an event for the termination of the +last thread. +.El +.Pp +The default tracing event mask when attaching to a process via +.Dv PT_ATTACH , +.Dv PT_TRACE_ME , +or +.Dv PTRACE_FORK +includes only +.Dv PTRACE_EXEC +events. +All other event flags are disabled. +.Pp The .Fa request argument specifies what operation is being performed; the meaning of @@ -368,21 +474,20 @@ The process identifier of the new proces member of .Vt "struct ptrace_lwpinfo" . .It PL_FLAG_CHILD -The flag is set for first event reported from a new child, which is -automatically attached due to -.Dv PT_FOLLOW_FORK -enabled. +The flag is set for first event reported from a new child which is +automatically attached when +.Dv PTRACE_FORK +is enabled. .It PL_FLAG_BORN -This flag is set for the first event reported from a new LWP when LWP -events are enabled via -.Dv PT_LWP_EVENTS . +This flag is set for the first event reported from a new LWP when +.Dv PTRACE_LWP +is enabled. It is reported along with -.Dv PL_FLAG_SCX -and is always reported if LWP events are enabled. +.Dv PL_FLAG_SCX . .It PL_FLAG_EXITED This flag is set for the last event reported by an exiting LWP when -LWP events are enabled via -.Dv PT_LWP_EVENTS . +.Dv PTRACE_LWP +is enabled. Note that this event is not reported when the last LWP in a process exits. The termination of the last thread is reported via a normal process exit event. @@ -456,50 +561,72 @@ This request will suspend the specified .It PT_RESUME This request will resume the specified thread. .It PT_TO_SCE -This request will trace the specified process on each system call entry. +This request will set the +.Dv PTRACE_SCE +event flag to trace all future system call entries and continue the process. +The +.Fa addr +and +.Fa data +arguments are used the same as for +.Dv PT_CONTINUE. .It PT_TO_SCX -This request will trace the specified process on each system call exit. +This request will set the +.Dv PTRACE_SCX +event flag to trace all future system call exits and continue the process. +The +.Fa addr +and +.Fa data +arguments are used the same as for +.Dv PT_CONTINUE. .It PT_SYSCALL -This request will trace the specified process -on each system call entry and exit. +This request will set the +.Dv PTRACE_SYSCALL +event flag to trace all future system call entries and exits and continue +the process. +The +.Fa addr +and +.Fa data +arguments are used the same as for +.Dv PT_CONTINUE. .It PT_FOLLOW_FORK This request controls tracing for new child processes of a traced process. If .Fa data is non-zero, -then new child processes will enable tracing and stop before executing their -first instruction. +.Dv PTRACE_FORK +is set in the traced process's event tracing mask. If .Fa data -is zero, then new child processes will execute without tracing enabled. -By default, tracing is not enabled for new child processes. -Child processes do not inherit this property. -The traced process will set the -.Dv PL_FLAG_FORKED -flag upon exit from a system call that creates a new process. +is zero, +.Dv PTRACE_FORK +is cleared from the traced process's event tracing mask. .It PT_LWP_EVENTS This request controls tracing of LWP creation and destruction. If .Fa data is non-zero, -then LWPs will stop to report creation and destruction events. +.Dv PTRACE_LWP +is set in the traced process's event tracing mask. If .Fa data is zero, -then LWP creation and destruction events will not be reported. -By default, tracing is not enabled for LWP events. -Child processes do not inherit this property. -New LWPs will stop to report an event with -.Dv PL_FLAG_BORN -set before executing their first instruction. -Exiting LWPs will stop to report an event with -.Dv PL_FLAG_EXITED -set before completing their termination. -.Pp -Note that new processes do not report an event for the creation of their -initial thread, -and exiting processes do not report an event for the termination of the -last thread. +.Dv PTRACE_LWP +is cleared from the traced process's event tracing mask. +.It PT_GET_EVENT_MASK +This request reads the traced process's event tracing mask into the +integer pointed to by +.Fa addr . +The size of the integer must be passed in +.Fa data . +.It PT_SET_EVENT_MASK +This request sets the traced process's event tracing mask from the +integer pointed to by +.Fa addr . +The size of the integer must be passed in +.Fa data . .It PT_VM_TIMESTAMP This request returns the generation number or timestamp of the memory map of the traced process as the return value from Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/kern_exec.c Fri Jul 15 15:32:09 2016 (r302902) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -903,7 +904,8 @@ exec_fail_dealloc: if (error == 0) { PROC_LOCK(p); - td->td_dbgflags |= TDB_EXEC; + if (p->p_ptevents & PTRACE_EXEC) + td->td_dbgflags |= TDB_EXEC; PROC_UNLOCK(p); /* Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/kern_exit.c Fri Jul 15 15:32:09 2016 (r302902) @@ -338,6 +338,7 @@ exit1(struct thread *td, int rval, int s PROC_LOCK(p); stopprofclock(p); p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); + p->p_ptevents = 0; /* * Stop the real interval timer. If the handler is currently @@ -475,6 +476,7 @@ exit1(struct thread *td, int rval, int s */ clear_orphan(q); q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE); + q->p_ptevents = 0; FOREACH_THREAD_IN_PROC(q, tdt) tdt->td_dbgflags &= ~TDB_SUSPEND; kern_psignal(q, SIGKILL); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/kern_fork.c Fri Jul 15 15:32:09 2016 (r302902) @@ -720,8 +720,7 @@ do_fork(struct thread *td, struct fork_r * but before we wait for the debugger. */ _PHOLD(p2); - if ((p1->p_flag & (P_TRACED | P_FOLLOWFORK)) == (P_TRACED | - P_FOLLOWFORK)) { + if (p1->p_ptevents & PTRACE_FORK) { /* * Arrange for debugger to receive the fork event. * @@ -1068,14 +1067,14 @@ fork_return(struct thread *td, struct tr if (td->td_dbgflags & TDB_STOPATFORK) { sx_xlock(&proctree_lock); PROC_LOCK(p); - if ((p->p_pptr->p_flag & (P_TRACED | P_FOLLOWFORK)) == - (P_TRACED | P_FOLLOWFORK)) { + if (p->p_pptr->p_ptevents & PTRACE_FORK) { /* * If debugger still wants auto-attach for the * parent's children, do it now. */ dbg = p->p_pptr->p_pptr; p->p_flag |= P_TRACED; + p->p_ptevents = PTRACE_DEFAULT; p->p_oppid = p->p_pptr->p_pid; CTR2(KTR_PTRACE, "fork_return: attaching to new child pid %d: oppid %d", @@ -1102,7 +1101,7 @@ fork_return(struct thread *td, struct tr PROC_LOCK(p); td->td_dbgflags |= TDB_SCX; _STOPEVENT(p, S_SCX, td->td_dbg_sc_code); - if ((p->p_stops & S_PT_SCX) != 0 || + if ((p->p_ptevents & PTRACE_SCX) != 0 || (td->td_dbgflags & TDB_BORN) != 0) ptracestop(td, SIGTRAP); td->td_dbgflags &= ~(TDB_SCX | TDB_BORN); Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/kern_sig.c Fri Jul 15 15:32:09 2016 (r302902) @@ -2191,9 +2191,10 @@ tdsendsignal(struct proc *p, struct thre !((prop & SA_CONT) && (p->p_flag & P_STOPPED_SIG))) return (ret); /* - * SIGKILL: Remove procfs STOPEVENTs. + * SIGKILL: Remove procfs STOPEVENTs and ptrace events. */ if (sig == SIGKILL) { + p->p_ptevents = 0; /* from procfs_ioctl.c: PIOCBIC */ p->p_stops = 0; /* from procfs_ioctl.c: PIOCCONT */ Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/kern_thr.c Fri Jul 15 15:32:09 2016 (r302902) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -254,7 +255,7 @@ thread_create(struct thread *td, struct thread_unlock(td); if (P_SHOULDSTOP(p)) newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - if (p->p_flag2 & P2_LWP_EVENTS) + if (p->p_ptevents & PTRACE_LWP) newtd->td_dbgflags |= TDB_BORN; /* @@ -354,7 +355,7 @@ kern_thr_exit(struct thread *td) p->p_pendingexits++; td->td_dbgflags |= TDB_EXIT; - if (p->p_flag & P_TRACED && p->p_flag2 & P2_LWP_EVENTS) + if (p->p_ptevents & PTRACE_LWP) ptracestop(td, SIGTRAP); PROC_UNLOCK(p); tidhash_remove(td); Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/subr_syscall.c Fri Jul 15 15:32:09 2016 (r302902) @@ -87,7 +87,7 @@ syscallenter(struct thread *td, struct s PROC_LOCK(p); td->td_dbg_sc_code = sa->code; td->td_dbg_sc_narg = sa->narg; - if (p->p_stops & S_PT_SCE) + if (p->p_ptevents & PTRACE_SCE) ptracestop((td), SIGTRAP); PROC_UNLOCK(p); } @@ -208,7 +208,7 @@ syscallret(struct thread *td, int error, */ if (traced && ((td->td_dbgflags & (TDB_FORK | TDB_EXEC)) != 0 || - (p->p_stops & S_PT_SCX) != 0)) + (p->p_ptevents & PTRACE_SCX) != 0)) ptracestop(td, SIGTRAP); td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); PROC_UNLOCK(p); Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/kern/sys_process.c Fri Jul 15 15:32:09 2016 (r302902) @@ -586,6 +586,7 @@ sys_ptrace(struct thread *td, struct ptr struct ptrace_lwpinfo32 pl32; struct ptrace_vm_entry32 pve32; #endif + int ptevents; } r; void *addr; int error = 0; @@ -600,6 +601,7 @@ sys_ptrace(struct thread *td, struct ptr AUDIT_ARG_VALUE(uap->data); addr = &r; switch (uap->req) { + case PT_GET_EVENT_MASK: case PT_GETREGS: case PT_GETFPREGS: case PT_GETDBREGS: @@ -614,6 +616,12 @@ sys_ptrace(struct thread *td, struct ptr case PT_SETDBREGS: error = COPYIN(uap->addr, &r.dbreg, sizeof r.dbreg); break; + case PT_SET_EVENT_MASK: + if (uap->data != sizeof(r.ptevents)) + error = EINVAL; + else + error = copyin(uap->addr, &r.ptevents, uap->data); + break; case PT_IO: error = COPYIN(uap->addr, &r.piod, sizeof r.piod); break; @@ -647,7 +655,12 @@ sys_ptrace(struct thread *td, struct ptr case PT_GETDBREGS: error = COPYOUT(&r.dbreg, uap->addr, sizeof r.dbreg); break; + case PT_GET_EVENT_MASK: + /* NB: The size in uap->data is validated in kern_ptrace(). */ + error = copyout(&r.ptevents, uap->addr, uap->data); + break; case PT_LWPINFO: + /* NB: The size in uap->data is validated in kern_ptrace(). */ error = copyout(&r.pl, uap->addr, uap->data); break; } @@ -711,6 +724,8 @@ kern_ptrace(struct thread *td, int req, case PT_SYSCALL: case PT_FOLLOW_FORK: case PT_LWP_EVENTS: + case PT_GET_EVENT_MASK: + case PT_SET_EVENT_MASK: case PT_DETACH: sx_xlock(&proctree_lock); proctree_locked = 1; @@ -885,6 +900,7 @@ kern_ptrace(struct thread *td, int req, case PT_TRACE_ME: /* set my trace flag and "owner" so it can read/write me */ p->p_flag |= P_TRACED; + p->p_ptevents = PTRACE_DEFAULT; if (p->p_flag & P_PPWAIT) p->p_flag |= P_PPTRACE; p->p_oppid = p->p_pptr->p_pid; @@ -903,6 +919,7 @@ kern_ptrace(struct thread *td, int req, * on a "detach". */ p->p_flag |= P_TRACED; + p->p_ptevents = PTRACE_DEFAULT; p->p_oppid = p->p_pptr->p_pid; if (p->p_pptr != td->td_proc) { proc_reparent(p, td->td_proc); @@ -941,24 +958,50 @@ kern_ptrace(struct thread *td, int req, case PT_FOLLOW_FORK: CTR3(KTR_PTRACE, "PT_FOLLOW_FORK: pid %d %s -> %s", p->p_pid, - p->p_flag & P_FOLLOWFORK ? "enabled" : "disabled", + p->p_ptevents & PTRACE_FORK ? "enabled" : "disabled", data ? "enabled" : "disabled"); if (data) - p->p_flag |= P_FOLLOWFORK; + p->p_ptevents |= PTRACE_FORK; else - p->p_flag &= ~P_FOLLOWFORK; + p->p_ptevents &= ~PTRACE_FORK; break; case PT_LWP_EVENTS: CTR3(KTR_PTRACE, "PT_LWP_EVENTS: pid %d %s -> %s", p->p_pid, - p->p_flag2 & P2_LWP_EVENTS ? "enabled" : "disabled", + p->p_ptevents & PTRACE_LWP ? "enabled" : "disabled", data ? "enabled" : "disabled"); if (data) - p->p_flag2 |= P2_LWP_EVENTS; + p->p_ptevents |= PTRACE_LWP; else - p->p_flag2 &= ~P2_LWP_EVENTS; + p->p_ptevents &= ~PTRACE_LWP; + break; + + case PT_GET_EVENT_MASK: + if (data != sizeof(p->p_ptevents)) { + error = EINVAL; + break; + } + CTR2(KTR_PTRACE, "PT_GET_EVENT_MASK: pid %d mask %#x", p->p_pid, + p->p_ptevents); + *(int *)addr = p->p_ptevents; break; + case PT_SET_EVENT_MASK: + if (data != sizeof(p->p_ptevents)) { + error = EINVAL; + break; + } + tmp = *(int *)addr; + if ((tmp & ~(PTRACE_EXEC | PTRACE_SCE | PTRACE_SCX | + PTRACE_FORK | PTRACE_LWP)) != 0) { + error = EINVAL; + break; + } + CTR3(KTR_PTRACE, "PT_SET_EVENT_MASK: pid %d mask %#x -> %#x", + p->p_pid, p->p_ptevents, tmp); + p->p_ptevents = tmp; + break; + case PT_STEP: case PT_CONTINUE: case PT_TO_SCE: @@ -991,24 +1034,24 @@ kern_ptrace(struct thread *td, int req, } switch (req) { case PT_TO_SCE: - p->p_stops |= S_PT_SCE; + p->p_ptevents |= PTRACE_SCE; CTR4(KTR_PTRACE, - "PT_TO_SCE: pid %d, stops = %#x, PC = %#lx, sig = %d", - p->p_pid, p->p_stops, + "PT_TO_SCE: pid %d, events = %#x, PC = %#lx, sig = %d", + p->p_pid, p->p_ptevents, (u_long)(uintfptr_t)addr, data); break; case PT_TO_SCX: - p->p_stops |= S_PT_SCX; + p->p_ptevents |= PTRACE_SCX; CTR4(KTR_PTRACE, - "PT_TO_SCX: pid %d, stops = %#x, PC = %#lx, sig = %d", - p->p_pid, p->p_stops, + "PT_TO_SCX: pid %d, events = %#x, PC = %#lx, sig = %d", + p->p_pid, p->p_ptevents, (u_long)(uintfptr_t)addr, data); break; case PT_SYSCALL: - p->p_stops |= S_PT_SCE | S_PT_SCX; + p->p_ptevents |= PTRACE_SYSCALL; CTR4(KTR_PTRACE, - "PT_SYSCALL: pid %d, stops = %#x, PC = %#lx, sig = %d", - p->p_pid, p->p_stops, + "PT_SYSCALL: pid %d, events = %#x, PC = %#lx, sig = %d", + p->p_pid, p->p_ptevents, (u_long)(uintfptr_t)addr, data); break; case PT_CONTINUE: @@ -1027,7 +1070,7 @@ kern_ptrace(struct thread *td, int req, * parent. Otherwise the debugee will be set * as an orphan of the debugger. */ - p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); + p->p_flag &= ~(P_TRACED | P_WAITED); if (p->p_oppid != p->p_pptr->p_pid) { PROC_LOCK(p->p_pptr); sigqueue_take(p->p_ksi); @@ -1044,7 +1087,7 @@ kern_ptrace(struct thread *td, int req, CTR2(KTR_PTRACE, "PT_DETACH: pid %d, sig %d", p->p_pid, data); p->p_oppid = 0; - p->p_stops = 0; + p->p_ptevents = 0; /* should we send SIGCHLD? */ /* childproc_continued(p); */ Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/sys/proc.h Fri Jul 15 15:32:09 2016 (r302902) @@ -582,6 +582,7 @@ struct proc { u_int p_stype; /* (c) Stop event type. */ char p_step; /* (c) Process is stopped. */ u_char p_pfsflags; /* (c) Procfs flags. */ + u_int p_ptevents; /* (c) ptrace() event mask. */ struct nlminfo *p_nlminfo; /* (?) Only used by/for lockd. */ struct kaioinfo *p_aioinfo; /* (y) ASYNC I/O info. */ struct thread *p_singlethread;/* (c + j) If single threading this is it */ @@ -672,7 +673,7 @@ struct proc { #define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */ #define P_CONTROLT 0x00002 /* Has a controlling terminal. */ #define P_KPROC 0x00004 /* Kernel process. */ -#define P_FOLLOWFORK 0x00008 /* Attach parent debugger to children. */ +#define P_UNUSED3 0x00008 /* --available-- */ #define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */ #define P_PROFIL 0x00020 /* Has started profiling. */ #define P_STOPPROF 0x00040 /* Has thread requesting to stop profiling. */ @@ -711,7 +712,6 @@ struct proc { #define P2_NOTRACE 0x00000002 /* No ptrace(2) attach or coredumps. */ #define P2_NOTRACE_EXEC 0x00000004 /* Keep P2_NOPTRACE on exec(2). */ #define P2_AST_SU 0x00000008 /* Handles SU ast for kthreads. */ -#define P2_LWP_EVENTS 0x00000010 /* Report LWP events via ptrace(2). */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ Modified: head/sys/sys/ptrace.h ============================================================================== --- head/sys/sys/ptrace.h Fri Jul 15 15:30:09 2016 (r302901) +++ head/sys/sys/ptrace.h Fri Jul 15 15:32:09 2016 (r302902) @@ -66,6 +66,9 @@ #define PT_FOLLOW_FORK 23 #define PT_LWP_EVENTS 24 /* report LWP birth and exit */ +#define PT_GET_EVENT_MASK 25 /* get mask of optional events */ +#define PT_SET_EVENT_MASK 26 /* set mask of optional events */ + #define PT_GETREGS 33 /* get general-purpose registers */ #define PT_SETREGS 34 /* set general-purpose registers */ #define PT_GETFPREGS 35 /* get floating-point registers */ @@ -79,6 +82,16 @@ #define PT_FIRSTMACH 64 /* for machine-specific requests */ #include /* machine-specific requests, if any */ +/* Events used with PT_GET_EVENT_MASK and PT_SET_EVENT_MASK */ +#define PTRACE_EXEC 0x0001 +#define PTRACE_SCE 0x0002 +#define PTRACE_SCX 0x0004 +#define PTRACE_SYSCALL (PTRACE_SCE | PTRACE_SCX) +#define PTRACE_FORK 0x0008 +#define PTRACE_LWP 0x0010 + +#define PTRACE_DEFAULT (PTRACE_EXEC) + struct ptrace_io_desc { int piod_op; /* I/O operation */ void *piod_offs; /* child offset */ @@ -136,13 +149,6 @@ struct ptrace_vm_entry { #ifdef _KERNEL -/* - * The flags below are used for ptrace(2) tracing and have no relation - * to procfs. They are stored in struct proc's p_stops member. - */ -#define S_PT_SCE 0x000010000 -#define S_PT_SCX 0x000020000 - int ptrace_set_pc(struct thread *_td, unsigned long _addr); int ptrace_single_step(struct thread *_td); int ptrace_clear_single_step(struct thread *_td); Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Fri Jul 15 15:30:09 2016 (r302901) +++ head/tests/sys/kern/ptrace_test.c Fri Jul 15 15:32:09 2016 (r302902) @@ -1416,6 +1416,139 @@ ATF_TC_BODY(ptrace__siginfo, tc) ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that the expected ptrace events are reported for PTRACE_EXEC. + */ +ATF_TC_WITHOUT_HEAD(ptrace__ptrace_exec_disable); +ATF_TC_BODY(ptrace__ptrace_exec_disable, tc) +{ + pid_t fpid, wpid; + int events, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exec_thread(NULL); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + events = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Should get one event at exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +ATF_TC_WITHOUT_HEAD(ptrace__ptrace_exec_enable); +ATF_TC_BODY(ptrace__ptrace_exec_enable, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int events, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exec_thread(NULL); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + events = PTRACE_EXEC; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next event should be for the child process's exec. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_EXEC | PL_FLAG_SCX)) == + (PL_FLAG_EXEC | PL_FLAG_SCX)); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +ATF_TC_WITHOUT_HEAD(ptrace__event_mask); +ATF_TC_BODY(ptrace__event_mask, tc) +{ + pid_t fpid, wpid; + int events, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + exit(0); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + /* PT_FOLLOW_FORK should toggle the state of PTRACE_FORK. */ + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, fpid, NULL, 1) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + ATF_REQUIRE(events & PTRACE_FORK); + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, fpid, NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + ATF_REQUIRE(!(events & PTRACE_FORK)); + + /* PT_LWP_EVENTS should toggle the state of PTRACE_LWP. */ + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, fpid, NULL, 1) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + ATF_REQUIRE(events & PTRACE_LWP); + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, fpid, NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + ATF_REQUIRE(!(events & PTRACE_LWP)); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Should get one event at exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -1438,6 +1571,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__lwp_events); ATF_TP_ADD_TC(tp, ptrace__lwp_events_exec); ATF_TP_ADD_TC(tp, ptrace__siginfo); + ATF_TP_ADD_TC(tp, ptrace__ptrace_exec_disable); + ATF_TP_ADD_TC(tp, ptrace__ptrace_exec_enable); + ATF_TP_ADD_TC(tp, ptrace__event_mask); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Fri Jul 15 15:37:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24EE8B994E6; Fri, 15 Jul 2016 15:37:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9AD016F7; Fri, 15 Jul 2016 15:37:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FFbtGp001719; Fri, 15 Jul 2016 15:37:55 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FFbstr001713; Fri, 15 Jul 2016 15:37:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607151537.u6FFbstr001713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 15 Jul 2016 15:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302903 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:37:56 -0000 Author: pfg Date: Fri Jul 15 15:37:54 2016 New Revision: 302903 URL: https://svnweb.freebsd.org/changeset/base/302903 Log: mail(1): Update more prototypes. Also rename delete and undelete_messages to deletecmd and undeletecmd respectively in an attempt to sync with other BSDs. Obtained from: OpenBSD Modified: head/usr.bin/mail/cmd1.c head/usr.bin/mail/cmd2.c head/usr.bin/mail/cmd3.c head/usr.bin/mail/cmdtab.c head/usr.bin/mail/extern.h head/usr.bin/mail/names.c Modified: head/usr.bin/mail/cmd1.c ============================================================================== --- head/usr.bin/mail/cmd1.c Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/cmd1.c Fri Jul 15 15:37:54 2016 (r302903) @@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$"); * User commands. */ -extern const struct cmd cmdtab[]; - /* * Print the current active headings. * Don't change dot if invoker didn't give an argument. @@ -54,8 +52,9 @@ extern const struct cmd cmdtab[]; static int screen; int -headers(int *msgvec) +headers(void *v) { + int *msgvec = v; int n, mesg, flag, size; struct message *mp; @@ -93,8 +92,9 @@ headers(int *msgvec) * Scroll to the next/previous screen */ int -scroll(char arg[]) +scroll(void *v) { + char *arg = v; int s, size; int cur[1]; @@ -146,8 +146,9 @@ screensize(void) * in the passed message list. */ int -from(int *msgvec) +from(void *v) { + int *msgvec = v; int *ip; for (ip = msgvec; *ip != 0; ip++) @@ -220,6 +221,7 @@ pdot(void) int pcmdlist(void) { + extern const struct cmd cmdtab[]; const struct cmd *cp; int cc; @@ -242,8 +244,9 @@ pcmdlist(void) * Paginate messages, honor ignored fields. */ int -more(int *msgvec) +more(void *v) { + int *msgvec = v; return (type1(msgvec, 1, 1)); } @@ -252,8 +255,9 @@ more(int *msgvec) * Paginate messages, even printing ignored fields. */ int -More(int *msgvec) +More(void *v) { + int *msgvec = v; return (type1(msgvec, 0, 1)); } @@ -262,8 +266,9 @@ More(int *msgvec) * Type out messages, honor ignored fields. */ int -type(int *msgvec) +type(void *v) { + int *msgvec = v; return (type1(msgvec, 1, 0)); } @@ -272,8 +277,9 @@ type(int *msgvec) * Type out messages, even printing ignored fields. */ int -Type(int *msgvec) +Type(void *v) { + int *msgvec = v; return (type1(msgvec, 0, 0)); } @@ -355,8 +361,9 @@ brokpipe(int signo __unused) * and defaults to 5. */ int -top(int *msgvec) +top(void *v) { + int *msgvec = v; int *ip; struct message *mp; int c, topl, lines, lineb; @@ -396,8 +403,9 @@ top(int *msgvec) * get mboxed. */ int -stouch(int msgvec[]) +stouch(void *v) { + int *msgvec = v; int *ip; for (ip = msgvec; *ip != 0; ip++) { @@ -412,8 +420,9 @@ stouch(int msgvec[]) * Make sure all passed messages get mboxed. */ int -mboxit(int msgvec[]) +mboxit(void *v) { + int *msgvec = v; int *ip; for (ip = msgvec; *ip != 0; ip++) { Modified: head/usr.bin/mail/cmd2.c ============================================================================== --- head/usr.bin/mail/cmd2.c Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/cmd2.c Fri Jul 15 15:37:54 2016 (r302903) @@ -53,9 +53,10 @@ extern int wait_status; * If given as first command with no arguments, print first message. */ int -next(int *msgvec) +next(void *v) { struct message *mp; + int *msgvec = v; int *ip, *ip2, list[2], mdot; if (*msgvec != 0) { @@ -210,8 +211,9 @@ save1(char str[], int mark, const char * * file name, minus header and trailing blank line. */ int -swrite(char str[]) +swrite(void *v) { + char *str = v; return (save1(str, 1, "write", ignoreall)); } @@ -226,7 +228,7 @@ swrite(char str[]) */ char * -snarf(char linebuf[], int *flag) +snarf(char *linebuf, int *flag) { char *cp; @@ -262,8 +264,9 @@ snarf(char linebuf[], int *flag) * Delete messages. */ int -delete(int msgvec[]) +deletecmd(void *v) { + int *msgvec = v; delm(msgvec); return (0); @@ -273,8 +276,9 @@ delete(int msgvec[]) * Delete messages, then type the new dot. */ int -deltype(int msgvec[]) +deltype(void *v) { + int *msgvec = v; int list[2]; int lastdot; @@ -335,10 +339,11 @@ delm(int *msgvec) * Undelete the indicated messages. */ int -undelete_messages(int *msgvec) +undeletecmd(void *v) { - struct message *mp; + int *msgvec = v; int *ip; + struct message *mp; for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { mp = &message[*ip - 1]; @@ -412,8 +417,9 @@ clob1(int n) * If no arguments, print the current list of retained fields. */ int -retfield(char *list[]) +retfield(void *v) { + char **list = v; return (ignore1(list, ignore + 1, "retained")); } @@ -423,33 +429,36 @@ retfield(char *list[]) * If no arguments, print the current list of ignored fields. */ int -igfield(char *list[]) +igfield(void *v) { + char **list = v; return (ignore1(list, ignore, "ignored")); } int -saveretfield(char *list[]) +saveretfield(void *v) { + char **list = v; return (ignore1(list, saveignore + 1, "retained")); } int -saveigfield(char *list[]) +saveigfield(void *v) { + char **list = v; return (ignore1(list, saveignore, "ignored")); } int -ignore1(char *list[], struct ignoretab *tab, const char *which) +ignore1(char **list, struct ignoretab *tab, const char *which) { char field[LINESIZE]; - int h; - struct ignore *igp; char **ap; + struct ignore *igp; + int h; if (*list == NULL) return (igshow(tab, which)); Modified: head/usr.bin/mail/cmd3.c ============================================================================== --- head/usr.bin/mail/cmd3.c Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/cmd3.c Fri Jul 15 15:37:54 2016 (r302903) @@ -163,8 +163,9 @@ help(void) * Change user's working directory. */ int -schdir(char **arglist) +schdir(void *v) { + char **arglist = v; char *cp; if (*arglist == NULL) { @@ -182,8 +183,10 @@ schdir(char **arglist) } int -respond(int *msgvec) +respond(void *v) { + int *msgvec = v; + if (value("Replyall") == NULL && value("flipr") == NULL) return (dorespond(msgvec)); else @@ -280,8 +283,9 @@ reedit(char *subj) * back to the system mailbox. */ int -preserve(int *msgvec) +preserve(void *v) { + int *msgvec = v; int *ip, mesg; struct message *mp; @@ -303,8 +307,9 @@ preserve(int *msgvec) * Mark all given messages as unread. */ int -unread(int msgvec[]) +unread(void *v) { + int *msgvec = v; int *ip; for (ip = msgvec; *ip != 0; ip++) { @@ -319,8 +324,9 @@ unread(int msgvec[]) * Print the size of each message. */ int -messize(int *msgvec) +messize(void *v) { + int *msgvec = v; struct message *mp; int *ip, mesg; @@ -337,7 +343,7 @@ messize(int *msgvec) * by returning an error. */ int -rexit(int e __unused) +rexit(void *v) { if (sourcing) return (1); @@ -350,8 +356,9 @@ rexit(int e __unused) * of csh. */ int -set(char **arglist) +set(void *v) { + char **arglist = v; struct var *vp; char *cp, *cp2; char varbuf[BUFSIZ], **ap, **p; @@ -396,8 +403,9 @@ set(char **arglist) * Unset a bunch of variable values. */ int -unset(char **arglist) +unset(void *v) { + char **arglist = v; struct var *vp, *vp2; int errs, h; char **ap; @@ -435,8 +443,9 @@ unset(char **arglist) * Put add users to a group. */ int -group(char **argv) +group(void *v) { + char **argv = v; struct grouphead *gh; struct group *gp; char **ap, *gname, **p; Modified: head/usr.bin/mail/cmdtab.c ============================================================================== --- head/usr.bin/mail/cmdtab.c Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/cmdtab.c Fri Jul 15 15:37:54 2016 (r302903) @@ -58,10 +58,10 @@ const struct cmd cmdtab[] = { { "top", top, MSGLIST, 0, MMNDEL }, { "touch", stouch, W|MSGLIST, 0, MMNDEL }, { "preserve", preserve, W|MSGLIST, 0, MMNDEL }, - { "delete", delete, W|P|MSGLIST, 0, MMNDEL }, + { "delete", deletecmd, W|P|MSGLIST, 0, MMNDEL }, { "dp", deltype, W|MSGLIST, 0, MMNDEL }, { "dt", deltype, W|MSGLIST, 0, MMNDEL }, - { "undelete", undelete_messages, P|MSGLIST, MDELETED,MMNDEL }, + { "undelete", undeletecmd, P|MSGLIST, MDELETED,MMNDEL }, { "unset", unset, M|RAWLIST, 1, 1000 }, { "mail", sendmail, R|M|I|STRLIST, 0, 0 }, { "mbox", mboxit, W|MSGLIST, 0, 0 }, Modified: head/usr.bin/mail/extern.h ============================================================================== --- head/usr.bin/mail/extern.h Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/extern.h Fri Jul 15 15:37:54 2016 (r302903) @@ -32,11 +32,11 @@ */ struct name *cat(struct name *, struct name *); -struct name *delname(struct name *, char []); +struct name *delname(struct name *, char *); struct name *elide(struct name *); -struct name *extract(char [], int); +struct name *extract(char *, int); struct name *gexpand(struct name *, struct grouphead *, int, int); -struct name *nalloc(char [], int); +struct name *nalloc(char *, int); struct name *outof(struct name *, FILE *, struct header *); struct name *put(struct name *, struct name *); struct name *tailof(struct name *); @@ -52,11 +52,11 @@ char *getdeadletter(void); char *getname(uid_t); char *hfield(const char *, struct message *); FILE *infix(struct header *, FILE *); -char *ishfield(char [], char *, const char *); +char *ishfield(char *, char *, const char *); char *name1(struct message *, int); char *nameof(struct message *, int); char *nextword(char *, char *); -char *readtty(const char *, char []); +char *readtty(const char *, char *); char *reedit(char *); FILE *run_editor(FILE *, off_t, int, int); char *salloc(int); @@ -64,18 +64,18 @@ char *savestr(char *); FILE *setinput(struct message *); char *skin(char *); char *skip_comment(char *); -char *snarf(char [], int *); +char *snarf(char *, int *); char *username(void); char *value(const char *); char *vcopy(const char *); -char *yankword(char *, char []); -char *yanklogin(char *, char []); +char *yankword(char *, char *); +char *yanklogin(char *, char *); int Fclose(FILE *); -int More(int *); +int More(void *); int Pclose(FILE *); int Respond(int *); -int Type(int *); -int doRespond(int []); +int Type(void *); +int doRespond(int *); int dorespond(int *); void alter(char *); int alternates(char **); @@ -98,9 +98,9 @@ void commands(void); int copycmd(void *v); int core(void); int count(struct name *); -int delete(int []); -int delm(int []); -int deltype(int []); +int deletecmd(void *); +int delm(int *); +int deltype(void *); void demail(void); int diction(const void *, const void *); int dosh(char *); @@ -111,51 +111,51 @@ void edstop(void); int elsecmd(void); int endifcmd(void); int evalcol(int); -int execute(char [], int); -int exwrite(char [], FILE *, int); +int execute(char *, int); +int exwrite(char *, FILE *, int); void fail(const char *, const char *); int file(char **); struct grouphead * - findgroup(char []); + findgroup(char *); void findmail(char *, char *, int); int first(int, int); void fixhead(struct header *, struct name *); void fmt(const char *, struct name *, FILE *, int); int folders(void); -int forward(char [], FILE *, char *, int); +int forward(char *, FILE *, char *, int); void free_child(int); -int from(int *); +int from(void *); off_t fsize(FILE *); int getfold(char *, int); -int gethfield(FILE *, char [], int, char **); +int gethfield(FILE *, char *, int, char **); int getmsglist(char *, int *, int); -int getrawlist(char [], char **, int); -uid_t getuserid(char []); +int getrawlist(char *, char **, int); +uid_t getuserid(char *); int grabh(struct header *, int); -int group(char **); +int group(void *); void hangup(int); int hash(const char *); void hdrstop(int); -int headers(int *); +int headers(void *); int help(void); void holdsigs(void); int ifcmd(char **); int igcomp(const void *, const void *); -int igfield(char *[]); -int ignore1(char *[], struct ignoretab *, const char *); +int igfield(void *); +int ignore1(char **, struct ignoretab *, const char *); int igshow(struct ignoretab *, const char *); int inc(void *); int incfile(void); void intr(int); -int isdate(char []); -int isdir(char []); +int isdate(char *); +int isdir(char *); int isfileaddr(char *); -int ishead(char []); +int ishead(char *); int isign(const char *, struct ignoretab []); int isprefix(const char *, const char *); void istrncpy(char *, const char *, size_t); const struct cmd * - lex(char []); + lex(char *); void load(char *); struct var * lookup(const char *); @@ -164,26 +164,26 @@ int mail(struct name *, void mail1(struct header *, int); void makemessage(FILE *, int); void mark(int); -int markall(char [], int); +int markall(char *, int); int matchsender(char *, int); int matchfield(char *, int); -int mboxit(int []); +int mboxit(void *); int member(char *, struct ignoretab *); void mesedit(FILE *, int); -void mespipe(FILE *, char []); -int messize(int *); +void mespipe(FILE *, char *); +int messize(void *); int metamess(int, int); -int more(int *); +int more(void *); int newfileinfo(int); -int next(int *); +int next(void *); int null(int); -void parse(char [], struct headline *, char []); +void parse(char *, struct headline *, char *); int pcmdlist(void); int pdot(void); void prepare_child(sigset_t *, int, int); -int preserve(int *); +int preserve(void *); void prettyprint(struct name *); -void printgroup(char []); +void printgroup(char *); void printhead(int); int puthead(struct header *, FILE *, int); int putline(FILE *, char *, int); @@ -194,25 +194,25 @@ int readline(FILE *, char *, int); void register_file(FILE *, int, int); void regret(int); void relsesigs(void); -int respond(int *); -int retfield(char *[]); -int rexit(int); +int respond(void *); +int retfield(void *); +int rexit(void *); int rm(char *); int run_command(char *, sigset_t *, int, int, ...); int save(void *v); -int save1(char [], int, const char *, struct ignoretab *); +int save1(char *, int, const char *, struct ignoretab *); void savedeadletter(FILE *); -int saveigfield(char *[]); -int savemail(char [], FILE *); -int saveretfield(char *[]); +int saveigfield(void *); +int savemail(char *, FILE *); +int saveretfield(void *); int scan(char **); void scaninit(void); -int schdir(char **); +int schdir(void *); int screensize(void); -int scroll(char []); +int scroll(void *); int sendmessage(struct message *, FILE *, struct ignoretab *, char *); int sendmail(char *); -int set(char **); +int set(void *); int setfile(char *); void setmsize(int); void setptr(FILE *, off_t); @@ -226,21 +226,21 @@ void sreset(void); int start_command(char *, sigset_t *, int, int, ...); void statusput(struct message *, FILE *, char *); void stop(int); -int stouch(int []); -int swrite(char []); +int stouch(void *); +int swrite(void *); void tinit(void); -int top(int *); +int top(void *); void touch(struct message *); void ttyint(int); void ttystop(int); -int type(int *); +int type(void *); int type1(int *, int, int); -int undelete_messages(int *); +int undeletecmd(void *); void unmark(int); char **unpack(struct name *); -int unread(int []); +int unread(void *); void unregister_file(FILE *); -int unset(char **); +int unset(void *); int unstack(void); void vfree(char *); int visual(int *); Modified: head/usr.bin/mail/names.c ============================================================================== --- head/usr.bin/mail/names.c Fri Jul 15 15:32:09 2016 (r302902) +++ head/usr.bin/mail/names.c Fri Jul 15 15:37:54 2016 (r302903) @@ -85,7 +85,7 @@ tailof(struct name *name) * Return the list or NULL if none found. */ struct name * -extract(char line[], int ntype) +extract(char *line, int ntype) { char *cp, *nbuf; struct name *top, *np, *t; @@ -158,7 +158,7 @@ detract(struct name *np, int ntype) * Throw away things between ()'s, and take anything between <>. */ char * -yankword(char *ap, char wbuf[]) +yankword(char *ap, char *wbuf) { char *cp, *cp2; @@ -203,7 +203,7 @@ yankword(char *ap, char wbuf[]) * and look for words before metacharacters %, @, !. */ char * -yanklogin(char *ap, char wbuf[]) +yanklogin(char *ap, char *wbuf) { char *cp, *cp2, *cp_temp; int n; From owner-svn-src-head@freebsd.org Fri Jul 15 15:38:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EB20B995E6; Fri, 15 Jul 2016 15:38:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id C9AA31A73; Fri, 15 Jul 2016 15:38:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 875EB426C7C; Sat, 16 Jul 2016 01:09:06 +1000 (AEST) Date: Sat, 16 Jul 2016 01:09:06 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302782 - in head/sys: dev/acpica i386/isa In-Reply-To: <201607131916.u6DJGWtq012089@repo.freebsd.org> Message-ID: <20160716001505.D851@besplex.bde.org> References: <201607131916.u6DJGWtq012089@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=OtmysHLt c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=IG6YGgIWsljFNfMaqHwA:9 a=jpSLBrrbTFekDcD2:21 a=7TyxCO5FwVo02m-o:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:38:55 -0000 On Wed, 13 Jul 2016, Jung-uk Kim wrote: > Log: > Remove a tunable and always reset system clock while resuming with ACPI. > > Requested by: bde (long ago) Thanks. > Modified: > head/sys/dev/acpica/acpi.c > head/sys/i386/isa/pmtimer.c This also prevents the reset by pmtimer if acpi is active. This leaves pmtimer doing nothing if acpi is active. pmtimer is supposed to do a much more complete reset (reset more accurately, and fix up callouts), but the callout code has not compiled since before it was committed. It is too broken to have ever been in conf/options* or conf/NOTES, so this bug is not normally noticed. i386 with acpi should be work without pmtimer now. Non-{amd64,i386} with acpi but with pmtimer non implemented might work now. pmtimer is in i386's GENERIC, but this is probably not needed now When the clock is not reset on resume, the system time is off by about the length of the suspension. It can be reset from userland using much the same sequence as for booting, except the error will be larger so more forceful stepping is required (kill ntpd and then use ntpdate; submit a bug report if the threatened removal of ntpdate is implemented). The large step from this is harmful to running programs and is better done in the kernel before letting them run, but letting them run before the step is harmful, and doing this in userland at least gets the step right. The standard /etc/resume script is clueless about this (and about almost everything -- it is empty except for about 2 hints for old hardware. An active ntpd is also clueless about such large steps, at least for the old version that I use. When the clock is reset by pmtimer on resume, the system time is off by about 0-1 seconds plus the drift of the RTC while suspended. When the clock is reset by pmtimer on resume, the system time is off by about 0-2 seconds plus the drift of the RTC while suspended. The extra accuracy provided by pmtimer is not very useful, since an error of more than a few milliseconds is enough to confuse ntpd, at least for the old version of ntpd that I use. Smaller errors are actually more harmful unless they are fairly small, since ntpd will slew the clock for all errors. I used to use -x to force it to slew the clock for all errors. This is worse than useless for recovery after suspension. A documented, it takes 14 days to recover from an error of just 600 seconds. In the old version, it was not limited to 600 seconds. It was also broken (it competed with the kernel part of itself to slew the clock, and made a mess), but I fixed that. In the current version, it is limited to 600 seconds and the fix is apparently to turn off the kernel time discipline. So I no longer use -x. This didn't work for long suspends either. ntpd was confused and aborted because the necessary step was considered preposterous. I can't find the threshold for this. Initially it is 900 seconds. Long callouts are also broken by suspensions. E.g., "sleep 86400" sleeps for 1 day plus the accumulated suspension time, not for 1 day as specified, because its misimplemented using something like a callout. If callouts worked then the error would be limited to the accumulated leap seconds adjustment. The uncompilable code in pmtimer tries to fix this. This has nothing to do with pmtimer, except that the error is largest after suspension and the KPI doesn't allow telling upper layers to do it for only some clock adjustments. Bruce From owner-svn-src-head@freebsd.org Fri Jul 15 15:55:37 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F131B9A1F5; Fri, 15 Jul 2016 15:55:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EAC7185C; Fri, 15 Jul 2016 15:55:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FFtahr009004; Fri, 15 Jul 2016 15:55:36 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FFtagT009003; Fri, 15 Jul 2016 15:55:36 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607151555.u6FFtagT009003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Jul 2016 15:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302904 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 15:55:37 -0000 Author: tuexen Date: Fri Jul 15 15:55:36 2016 New Revision: 302904 URL: https://svnweb.freebsd.org/changeset/base/302904 Log: Fix a bug which results in a core dump when running netstat with the -W option and having a listening SCTP socket. The bug was introduced in r279122 when adding support for libxo. MFC after: 3 days Modified: head/usr.bin/netstat/sctp.c Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Fri Jul 15 15:37:54 2016 (r302903) +++ head/usr.bin/netstat/sctp.c Fri Jul 15 15:55:36 2016 (r302904) @@ -529,7 +529,7 @@ retry: "{:state/CLOSED}", " "); } else { xo_emit("{P:/%-45.45s} " - "{:state:LISTEN}", " "); + "{:state/LISTEN}", " "); } } else { if (process_closed) { From owner-svn-src-head@freebsd.org Fri Jul 15 16:03:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACD22B9A51A for ; Fri, 15 Jul 2016 16:03:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73B5D1EE1 for ; Fri, 15 Jul 2016 16:03:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x229.google.com with SMTP id b62so108061338iod.3 for ; Fri, 15 Jul 2016 09:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XuZ6CYwYvMJPz81jjEO3d4MazGhEKvKia6ZTDa0nWhU=; b=e8GMILg6EwwWLDIbMvS6zAFJ4PzzjqVJCnJ296yZKYCAs8NaDLUE02l6CRBa57Rr5/ BeUzvA7hGvXJ1+BUrspcnB0/4qUxdZr0EQFsowTkWrtrq3yOkcrn3dl3dilyY4LVjTse 2wJx1Ua9YgpKcms218ljyzF0vCz0UNRtxswMmXIBFOFRqme6H5389G8QbT7S85yi/EuW m/J7yumuRmI7zm6RgqJoSS+8snWYLIZJXGlLpRzLrGqxV23rVTfrYgKgJMIn9pBSAfhD HZof4bU+mYKGZKx/XCilbrIVB1tQvh54G6euD7E5SZTWgdnVdnyaNfI/833PCaiG7OCV 6KLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XuZ6CYwYvMJPz81jjEO3d4MazGhEKvKia6ZTDa0nWhU=; b=EDO/RBYoAl56G+6T2E9qav++Td/wKvvPISzxKBLYSbZkP7or3HvIZbL5uSjNXsfmHh xAahztczsYLXePQNwLA1jZXL4XTHtbAuyH0DuMkH3zKmkJ8pw8b5BSHROL3EuXAoR3qq NDQfUK944g9IHlkQ8Kbgi4xO4I2vduWBCF3tjmFlWjoIgta1LvEz3jV4TcnYgamy6YR7 hmzv81Q4yjgJPC38RUSPqv2HxJxge8+Gie65fSMn53jK1F1CzEVAWHhAZttZQ/4Zh6LL ufsZBSXFRktUieeQBn7AlWmReziHEYasnWMwo2wTmrqumWS+q68oi94o3qxz5rjG8SB5 a3cg== X-Gm-Message-State: ALyK8tIr5OED16U6rfaTwCil2T8+E0rOE/mwnfmKJPRhpCKRSxXQHzLpn8kQjfAd3FcFk3sgdoWBaJCvYRW36A== X-Received: by 10.107.133.93 with SMTP id h90mr21648520iod.16.1468598635399; Fri, 15 Jul 2016 09:03:55 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.137.131 with HTTP; Fri, 15 Jul 2016 09:03:55 -0700 (PDT) X-Originating-IP: [69.53.245.200] In-Reply-To: <20160716001505.D851@besplex.bde.org> References: <201607131916.u6DJGWtq012089@repo.freebsd.org> <20160716001505.D851@besplex.bde.org> From: Warner Losh Date: Fri, 15 Jul 2016 10:03:55 -0600 X-Google-Sender-Auth: GqUmNPiK5o4icMPyqdUv2GDKAa8 Message-ID: Subject: Re: svn commit: r302782 - in head/sys: dev/acpica i386/isa To: Bruce Evans Cc: Jung-uk Kim , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 16:03:56 -0000 On Fri, Jul 15, 2016 at 9:09 AM, Bruce Evans wrote: > pmtimer is in i386's GENERIC, but this is probably not needed now I think it's time to relegate pmtimer to the apm power stuff and make sure that ACPI has the right hooks to do anything it currently isn't doing correctly. pmtimer was originally written for apm and was never really brought forward into the ACPI era... Warner From owner-svn-src-head@freebsd.org Fri Jul 15 17:09:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE349B99E00; Fri, 15 Jul 2016 17:09:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B8B81993; Fri, 15 Jul 2016 17:09:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FH9Urc035547; Fri, 15 Jul 2016 17:09:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FH9UqO035545; Fri, 15 Jul 2016 17:09:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201607151709.u6FH9UqO035545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 15 Jul 2016 17:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302906 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 17:09:31 -0000 Author: ae Date: Fri Jul 15 17:09:30 2016 New Revision: 302906 URL: https://svnweb.freebsd.org/changeset/base/302906 Log: Add net.inet6.ip6.intr_queue_maxlen sysctl. It can be used to change netisr queue limit for IPv6 at runtime. Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6.h head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/in6.h ============================================================================== --- head/sys/netinet6/in6.h Fri Jul 15 16:37:36 2016 (r302905) +++ head/sys/netinet6/in6.h Fri Jul 15 17:09:30 2016 (r302906) @@ -637,7 +637,10 @@ struct ip6_mtuinfo { * receiving IF. */ #define IPV6CTL_RFC6204W3 50 /* Accept defroute even when forwarding enabled */ -#define IPV6CTL_MAXID 51 +#define IPV6CTL_INTRQMAXLEN 51 /* max length of IPv6 netisr queue */ +#define IPV6CTL_INTRDQMAXLEN 52 /* max length of direct IPv6 netisr + * queue */ +#define IPV6CTL_MAXID 53 #endif /* __BSD_VISIBLE */ /* Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Jul 15 16:37:36 2016 (r302905) +++ head/sys/netinet6/ip6_input.c Fri Jul 15 17:09:30 2016 (r302906) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -145,6 +146,24 @@ static struct netisr_handler ip6_nh = { #endif }; +static int +sysctl_netinet6_intr_queue_maxlen(SYSCTL_HANDLER_ARGS) +{ + int error, qlimit; + + netisr_getqlimit(&ip6_nh, &qlimit); + error = sysctl_handle_int(oidp, &qlimit, 0, req); + if (error || !req->newptr) + return (error); + if (qlimit < 1) + return (EINVAL); + return (netisr_setqlimit(&ip6_nh, qlimit)); +} +SYSCTL_DECL(_net_inet6_ip6); +SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_INTRQMAXLEN, intr_queue_maxlen, + CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet6_intr_queue_maxlen, "I", + "Maximum size of the IPv6 input queue"); + #ifdef RSS static struct netisr_handler ip6_direct_nh = { .nh_name = "ip6_direct", @@ -154,6 +173,24 @@ static struct netisr_handler ip6_direct_ .nh_policy = NETISR_POLICY_CPU, .nh_dispatch = NETISR_DISPATCH_HYBRID, }; + +static int +sysctl_netinet6_intr_direct_queue_maxlen(SYSCTL_HANDLER_ARGS) +{ + int error, qlimit; + + netisr_getqlimit(&ip6_direct_nh, &qlimit); + error = sysctl_handle_int(oidp, &qlimit, 0, req); + if (error || !req->newptr) + return (error); + if (qlimit < 1) + return (EINVAL); + return (netisr_setqlimit(&ip6_direct_nh, qlimit)); +} +SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_INTRDQMAXLEN, intr_direct_queue_maxlen, + CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet6_intr_direct_queue_maxlen, + "I", "Maximum size of the IPv6 direct input queue"); + #endif VNET_DEFINE(struct pfil_head, inet6_pfil_hook); From owner-svn-src-head@freebsd.org Fri Jul 15 17:40:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04445B9A7F8; Fri, 15 Jul 2016 17:40:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8D2E126D; Fri, 15 Jul 2016 17:40:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FHeZHP047730; Fri, 15 Jul 2016 17:40:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FHeZmM047729; Fri, 15 Jul 2016 17:40:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607151740.u6FHeZmM047729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Jul 2016 17:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302907 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 17:40:36 -0000 Author: tuexen Date: Fri Jul 15 17:40:34 2016 New Revision: 302907 URL: https://svnweb.freebsd.org/changeset/base/302907 Log: When calling netstat -Laptcp the local address values are not aligned with the corresponding entry in the table header. r295136 increased the value width from 14 to 32 without the corresponding change to the table header. This commit adds the change to the table header width. MFC after: 3 days Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Fri Jul 15 17:09:30 2016 (r302906) +++ head/usr.bin/netstat/inet.c Fri Jul 15 17:40:34 2016 (r302907) @@ -418,10 +418,10 @@ protopr(u_long off, const char *name, in "Tcpcb"); if (Lflag) xo_emit((Aflag && !Wflag) ? - "{T:/%-5.5s} {T:/%-14.14s} {T:/%-18.18s}" : + "{T:/%-5.5s} {T:/%-32.32s} {T:/%-18.18s}" : ((!Wflag || af1 == AF_INET) ? - "{T:/%-5.5s} {T:/%-14.14s} {T:/%-22.22s}" : - "{T:/%-5.5s} {T:/%-14.14s} {T:/%-45.45s}"), + "{T:/%-5.5s} {T:/%-32.32s} {T:/%-22.22s}" : + "{T:/%-5.5s} {T:/%-32.32s} {T:/%-45.45s}"), "Proto", "Listen", "Local Address"); else if (Tflag) xo_emit((Aflag && !Wflag) ? From owner-svn-src-head@freebsd.org Fri Jul 15 19:07:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F738B9A83E; Fri, 15 Jul 2016 19:07:01 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53C671606; Fri, 15 Jul 2016 19:07:01 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FJ70Au081937; Fri, 15 Jul 2016 19:07:00 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FJ70PP081936; Fri, 15 Jul 2016 19:07:00 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607151907.u6FJ70PP081936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 15 Jul 2016 19:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302908 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 19:07:01 -0000 Author: bdrewery Date: Fri Jul 15 19:07:00 2016 New Revision: 302908 URL: https://svnweb.freebsd.org/changeset/base/302908 Log: Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases. The root of the problem here is that TAILQ_FOREACH_FROM will default to the head of the list if passed NULL, which will be the case if there are no libraries loaded after this one. Thus all libraries, including the current, were iterated in that case rather than none. This was broken in r294373. Reviewed by: markj (earlier version), cem, kib, ngie MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7216 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Fri Jul 15 17:40:34 2016 (r302907) +++ head/libexec/rtld-elf/rtld.c Fri Jul 15 19:07:00 2016 (r302908) @@ -3291,7 +3291,7 @@ do_dlsym(void *handle, const char *name, handle == RTLD_SELF) { /* ... caller included */ if (handle == RTLD_NEXT) obj = globallist_next(obj); - TAILQ_FOREACH_FROM(obj, &obj_list, next) { + for (; obj != NULL; obj = TAILQ_NEXT(obj, next)) { if (obj->marker) continue; res = symlook_obj(&req, obj); From owner-svn-src-head@freebsd.org Fri Jul 15 19:12:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 577CBB9AAC0; Fri, 15 Jul 2016 19:12:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 2053C1CD3; Fri, 15 Jul 2016 19:12:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 0BC7A1A6B3E; Sat, 16 Jul 2016 05:12:55 +1000 (AEST) Date: Sat, 16 Jul 2016 05:12:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Bruce Evans , Jung-uk Kim , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r302782 - in head/sys: dev/acpica i386/isa In-Reply-To: Message-ID: <20160716034343.V1727@besplex.bde.org> References: <201607131916.u6DJGWtq012089@repo.freebsd.org> <20160716001505.D851@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=OtmysHLt c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=zm8i689NDrxu0cr7Vz0A:9 a=CjuIK1q_8ugA:10 a=Oa0T6EYmKFNB-xRHvYM1:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 19:12:58 -0000 On Fri, 15 Jul 2016, Warner Losh wrote: > On Fri, Jul 15, 2016 at 9:09 AM, Bruce Evans wrote: >> pmtimer is in i386's GENERIC, but this is probably not needed now > > I think it's time to relegate pmtimer to the apm power stuff and make sure that > ACPI has the right hooks to do anything it currently isn't doing > correctly. pmtimer > was originally written for apm and was never really brought forward into the > ACPI era... I thought that pmtimer was only for apm. Since it not mentioned in any man page, it is not clear what it is for. However, it is documented in i386/conf/NOTES as "Adjust system timer at wakeup time". According to that, it is a bug for acpi to do its own adjustment and not use pmtimer. However, pmtimer only exists on i386 with isa and it doesn't actually adjust _the_ system timer there or have any dependencies on i386 or isa except for foot shooting. What it actually does is: - restore all hardware timers using blind calls between dummy device drivers. This is broken if an attached driver calls an unattached one, but usually on x86, all the drivers are attached so this reduces to spelling boolean true using only 100-200 lines of driver code. The i386 and isa dependencies in pm are only needed to spell true there. This spelling of true depends on i386 requiring isa. That is: true := isa_parent_is_attached(). - restore the system (software) timer using MI code - try to fix up callups using broken ifdefed out MI code. The recent commit makes the comment not match the code in another way. Now the conditon for using pmtimer is 'if (true || !acpi_is_attached())'. Bruce From owner-svn-src-head@freebsd.org Fri Jul 15 19:43:26 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0047EB9839F; Fri, 15 Jul 2016 19:43:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0F801DFD; Fri, 15 Jul 2016 19:43:25 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FJhOAW096945; Fri, 15 Jul 2016 19:43:24 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FJhOUv096943; Fri, 15 Jul 2016 19:43:24 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607151943.u6FJhOUv096943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 15 Jul 2016 19:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302911 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 19:43:26 -0000 Author: pfg Date: Fri Jul 15 19:43:24 2016 New Revision: 302911 URL: https://svnweb.freebsd.org/changeset/base/302911 Log: mail(1): Avoid closing negative file descriptors. CID: 1008105, 1008106 MFC after: 1 week Modified: head/usr.bin/mail/quit.c head/usr.bin/mail/v7.local.c Modified: head/usr.bin/mail/quit.c ============================================================================== --- head/usr.bin/mail/quit.c Fri Jul 15 19:14:28 2016 (r302910) +++ head/usr.bin/mail/quit.c Fri Jul 15 19:43:24 2016 (r302911) @@ -228,7 +228,8 @@ quit(void) return; } (void)Fclose(obuf); - (void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if ((fd = open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)) >= 0) + (void)close(fd); if ((obuf = Fopen(mbox, "r+")) == NULL) { warn("%s", mbox); (void)Fclose(ibuf); Modified: head/usr.bin/mail/v7.local.c ============================================================================== --- head/usr.bin/mail/v7.local.c Fri Jul 15 19:14:28 2016 (r302910) +++ head/usr.bin/mail/v7.local.c Fri Jul 15 19:43:24 2016 (r302911) @@ -68,9 +68,12 @@ findmail(char *user, char *buf, int bufl void demail(void) { + int fd; if (value("keep") != NULL || rm(mailname) < 0) - (void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if ((fd = open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600)) >= + 0) + (void)close(fd); } /* From owner-svn-src-head@freebsd.org Fri Jul 15 20:21:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21356B990C2; Fri, 15 Jul 2016 20:21:32 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com [IPv6:2607:f8b0:400d:c0d::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCAED1752; Fri, 15 Jul 2016 20:21:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x234.google.com with SMTP id w38so65425664qtb.0; Fri, 15 Jul 2016 13:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MPNH5c9b4x6TZoYYb3VBq9PNw9tA9OvG+YrJ7+hM8Mo=; b=e6cEqqRj9Z1DPKiBur4qf58dNHOkBmfBNkHsCzFRwORqkyrU6bA1RE2vYKiqaiLRVK RlGjk1D4B8Kd5mzQGRbfWw+ik7vOOmNA4/JGstl1a8LZpWEWcmCz4trSiH7O2B5DxUaG tYvozlPZ7G0Id5DTKxM5mX1yha6ATScZqAURB47rKl+o7/nXcl9xDt1n5KCTzkQ3Qw1/ pHhztL2I9MFr1wvHKF6TGU312YJp2yf6BWV1TZ3fc8LBdHqJApsexDGLsZkZ4nwqqU/p LU9CoFYSdMZHr7bBvytaKJyOK9mwgWN/pTiVJstb6sDjBaKhCUQ8fYiyXYl9vaXe9qI4 pvdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MPNH5c9b4x6TZoYYb3VBq9PNw9tA9OvG+YrJ7+hM8Mo=; b=hQveYA9xHQoqW6s6OqGIUplOBYG7CUXrWgrBUD9+6bobp7crthBBhJ6QrUqnwdl8el 3NxehHFLCMwpCiD18KQKMjftvscdiP2h8jDmNVxBceQhRzjG8306SjuibVLDtLprG5TN oxx1JqlIRWiCvpTM3WcEXUcNLE4mcdIVkMGbOk7Y3NO5O7fPqp5oqdRBYuw/m5DFhM8i oU1/srPOZjlTyAYko6x4oRHJa8Y2xJ1nkU6TbfNzJ7GfOrRynQnK8lo3OvLO29lsdmV9 h5TLrLbMGE5VSsfN5TVsXrxZlatuCOqDgJRuqbOCuS7kc464NsXx0piJyZyFnDnXGXnU gq6g== X-Gm-Message-State: ALyK8tKn0HR9S2qQE8ho1XonJfPIv4QkYuQzvGTC1B8OV+5ESxlM2i/ea9Dd5P8x7gwZPfq5QVMZ7kZVGj6Vuw== X-Received: by 10.200.50.20 with SMTP id x20mr31979622qta.71.1468614090701; Fri, 15 Jul 2016 13:21:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.148.131 with HTTP; Fri, 15 Jul 2016 13:21:30 -0700 (PDT) In-Reply-To: <201607151532.u6FFW9JE000862@repo.freebsd.org> References: <201607151532.u6FFW9JE000862@repo.freebsd.org> From: Ngie Cooper Date: Fri, 15 Jul 2016 13:21:30 -0700 Message-ID: Subject: Re: svn commit: r302902 - in head: lib/libc/sys sys/kern sys/sys tests/sys/kern To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 20:21:32 -0000 On Fri, Jul 15, 2016 at 8:32 AM, John Baldwin wrote: > Author: jhb > Date: Fri Jul 15 15:32:09 2016 > New Revision: 302902 > URL: https://svnweb.freebsd.org/changeset/base/302902 > > Log: > Add a mask of optional ptrace() events. > > ptrace() now stores a mask of optional events in p_ptevents. Currently > this mask is a single integer, but it can be expanded into an array of > integers in the future. > > Two new ptrace requests can be used to manipulate the event mask: > PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK > sets the current event mask. > > The current set of events include: > - PTRACE_EXEC: trace calls to execve(). > - PTRACE_SCE: trace system call entries. > - PTRACE_SCX: trace syscam call exits. > - PTRACE_FORK: trace forks and auto-attach to new child processes. > - PTRACE_LWP: trace LWP events. > > The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have > been replaced by PTRACE_SCE and PTRACE_SCX. PTRACE_FORK replaces > P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS. > > The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for > compatibility but now simply toggle corresponding flags in the > event mask. > > While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both > modify the event mask and continue the traced process. > > Reviewed by: kib > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D7044 This broke linux(4): https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/3597/ . Thanks, -Ngie From owner-svn-src-head@freebsd.org Fri Jul 15 20:27:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C5EEB991E3; Fri, 15 Jul 2016 20:27:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 194301C4E; Fri, 15 Jul 2016 20:27:22 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FKRLjE011764; Fri, 15 Jul 2016 20:27:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FKRLCk011763; Fri, 15 Jul 2016 20:27:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607152027.u6FKRLCk011763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 15 Jul 2016 20:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302914 - head/usr.bin/mail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 20:27:22 -0000 Author: pfg Date: Fri Jul 15 20:27:21 2016 New Revision: 302914 URL: https://svnweb.freebsd.org/changeset/base/302914 Log: mail(1): Minor declaration updates. Missing from r302903. Modified: head/usr.bin/mail/util.c Modified: head/usr.bin/mail/util.c ============================================================================== --- head/usr.bin/mail/util.c Fri Jul 15 20:26:28 2016 (r302913) +++ head/usr.bin/mail/util.c Fri Jul 15 20:27:21 2016 (r302914) @@ -214,7 +214,7 @@ gethfield(FILE *f, char linebuf[], int r */ char* -ishfield(char linebuf[], char *colon, const char *field) +ishfield(char *linebuf, char *colon, const char *field) { char *cp = colon; From owner-svn-src-head@freebsd.org Fri Jul 15 23:03:21 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A54B2B9969B; Fri, 15 Jul 2016 23:03:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ED5D182C; Fri, 15 Jul 2016 23:03:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FN3KZx070505; Fri, 15 Jul 2016 23:03:20 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FN3KsI070504; Fri, 15 Jul 2016 23:03:20 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607152303.u6FN3KsI070504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 15 Jul 2016 23:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302916 - head/lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 23:03:21 -0000 Author: bapt Date: Fri Jul 15 23:03:20 2016 New Revision: 302916 URL: https://svnweb.freebsd.org/changeset/base/302916 Log: Revert 302324 and properly fix the crash with ISO-8859-5 locales PR: 211135 Reported by: jkim Tested by: jkim MFC after: 2 days Modified: head/lib/libc/locale/collate.c Modified: head/lib/libc/locale/collate.c ============================================================================== --- head/lib/libc/locale/collate.c Fri Jul 15 21:30:19 2016 (r302915) +++ head/lib/libc/locale/collate.c Fri Jul 15 23:03:20 2016 (r302916) @@ -310,7 +310,7 @@ _collate_lookup(struct xlocale_collate * if ((sptr = *state) != NULL) { *pri = *sptr; sptr++; - if ((sptr == *state) || (*sptr == 0)) + if ((sptr == *state) || (sptr == NULL)) *state = NULL; else *state = sptr; @@ -451,6 +451,7 @@ _collate_wxfrm(struct xlocale_collate *t errno = EINVAL; goto fail; } + state = NULL; pri = COLLATE_MAX_PRIORITY; } if (room) { @@ -469,6 +470,7 @@ _collate_wxfrm(struct xlocale_collate *t errno = EINVAL; goto fail; } + state = NULL; continue; } if (room) { @@ -597,6 +599,7 @@ _collate_sxfrm(struct xlocale_collate *t errno = EINVAL; goto fail; } + state = NULL; pri = COLLATE_MAX_PRIORITY; } @@ -622,6 +625,7 @@ _collate_sxfrm(struct xlocale_collate *t errno = EINVAL; goto fail; } + state = NULL; continue; } From owner-svn-src-head@freebsd.org Fri Jul 15 23:13:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C4DBB999BD; Fri, 15 Jul 2016 23:13:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 267EC1EE4; Fri, 15 Jul 2016 23:13:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FNDvWN074547; Fri, 15 Jul 2016 23:13:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FNDvTD074546; Fri, 15 Jul 2016 23:13:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607152313.u6FNDvTD074546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 15 Jul 2016 23:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302917 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 23:13:58 -0000 Author: tuexen Date: Fri Jul 15 23:13:57 2016 New Revision: 302917 URL: https://svnweb.freebsd.org/changeset/base/302917 Log: Ensure that the -a, -W, -L options for SCTP behave similar as for TCP. MFC after: 3 days Modified: head/usr.bin/netstat/sctp.c Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Fri Jul 15 23:03:20 2016 (r302916) +++ head/usr.bin/netstat/sctp.c Fri Jul 15 23:13:57 2016 (r302917) @@ -447,7 +447,8 @@ sctp_process_inpcb(struct xsctp_inpcb *x first = 0; } xladdr = (struct xsctp_laddr *)(buf + *offset); - if (Lflag && !is_listening) { + if ((!aflag && is_listening) || + (Lflag && !is_listening)) { sctp_skip_xinpcb_ifneed(buf, buflen, offset); return; } @@ -513,8 +514,10 @@ retry: xo_open_instance("local-address"); if (xladdr_total == 0) { - xo_emit("{:protocol/%-6.6s/%s} {:type/%-5.5s/%s} ", - pname, tname); + if (!Lflag) { + xo_emit("{:protocol/%-6.6s/%s} " + "{:type/%-5.5s/%s} ", pname, tname); + } } else { xo_emit("\n"); xo_emit(Lflag ? "{P:/%-21.21s} " : "{P:/%-12.12s} ", From owner-svn-src-head@freebsd.org Fri Jul 15 23:24:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55EDAB99D65; Fri, 15 Jul 2016 23:24:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10B4917A8; Fri, 15 Jul 2016 23:24:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FNO1n5078281; Fri, 15 Jul 2016 23:24:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FNO06N078279; Fri, 15 Jul 2016 23:24:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607152324.u6FNO06N078279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 15 Jul 2016 23:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302918 - head/lib/libc/tests/string X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 23:24:02 -0000 Author: bapt Date: Fri Jul 15 23:24:00 2016 New Revision: 302918 URL: https://svnweb.freebsd.org/changeset/base/302918 Log: Add a regression test about the crash with strxfrm and ISO8859-5 locales Added: head/lib/libc/tests/string/strxfrm_test.c (contents, props changed) Modified: head/lib/libc/tests/string/Makefile Modified: head/lib/libc/tests/string/Makefile ============================================================================== --- head/lib/libc/tests/string/Makefile Fri Jul 15 23:13:57 2016 (r302917) +++ head/lib/libc/tests/string/Makefile Fri Jul 15 23:24:00 2016 (r302918) @@ -5,6 +5,7 @@ ATF_TESTS_C+= stpncpy_test ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= wcscasecmp_test ATF_TESTS_C+= wcsnlen_test +ATF_TESTS_C+= strxfrm_test # TODO: popcount, stresep Added: head/lib/libc/tests/string/strxfrm_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/string/strxfrm_test.c Fri Jul 15 23:24:00 2016 (r302918) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2016 Baptiste Daroussin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(iso_8859_5); +ATF_TC_BODY(iso_8859_5, tc) +{ + char s1[8]; + const char s2[] = { 0xa1, 0 }; + + setlocale(LC_ALL, "ru_RU.ISO8859-5"); + strxfrm(s1, s2, 0x8); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, iso_8859_5); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Fri Jul 15 23:26:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96796B99DE4; Fri, 15 Jul 2016 23:26:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67A2919A8; Fri, 15 Jul 2016 23:26:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FNQXRh078406; Fri, 15 Jul 2016 23:26:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FNQX1o078405; Fri, 15 Jul 2016 23:26:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607152326.u6FNQX1o078405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 15 Jul 2016 23:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302919 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 23:26:34 -0000 Author: kib Date: Fri Jul 15 23:26:33 2016 New Revision: 302919 URL: https://svnweb.freebsd.org/changeset/base/302919 Log: In ptrace_vm_entry(), do not call vmspace_free() while owning a vm object lock. The vmspace_free() operations might need to lock map, object etc on last dereference. Postpone the free until object's inspection is done. Reported and tested by: will Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Fri Jul 15 23:24:00 2016 (r302918) +++ head/sys/kern/sys_process.c Fri Jul 15 23:26:33 2016 (r302919) @@ -433,7 +433,6 @@ ptrace_vm_entry(struct thread *td, struc } while (0); vm_map_unlock_read(map); - vmspace_free(vm); pve->pve_fsid = VNOVAL; pve->pve_fileid = VNOVAL; @@ -478,6 +477,7 @@ ptrace_vm_entry(struct thread *td, struc free(freepath, M_TEMP); } } + vmspace_free(vm); if (error == 0) CTR3(KTR_PTRACE, "PT_VM_ENTRY: pid %d, entry %d, start %p", p->p_pid, pve->pve_entry, pve->pve_start); From owner-svn-src-head@freebsd.org Fri Jul 15 23:43:25 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39ACFB9A262; Fri, 15 Jul 2016 23:43:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 115971344; Fri, 15 Jul 2016 23:43:24 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6FNhOx2085435; Fri, 15 Jul 2016 23:43:24 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6FNhOWQ085433; Fri, 15 Jul 2016 23:43:24 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607152343.u6FNhOWQ085433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 15 Jul 2016 23:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302920 - head/lib/libc/tests/string X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 23:43:25 -0000 Author: bapt Date: Fri Jul 15 23:43:23 2016 New Revision: 302920 URL: https://svnweb.freebsd.org/changeset/base/302920 Log: Add a regression test to make sure the Russian collation is actually working when importing collation support from Dragonfly/Illumos amdmi3@ tested the collation branch and reported an issue with Russian collation. John Marino fixed the issue in Dragonfly and I merged it back to FreeBSD. Now that Illumos is working on merging our fixes they (Lauri Tirkkonen) found issues with the commit that fixes the russian collation in UTF-8 that resulted in a crash with strxfrm(3) and the ISO-8859-5 locale (fixed in FreeBSD r302916). This small test was written to ensure we do not bring back the old issue with russian collation while fixing the other issue. Added: head/lib/libc/tests/string/wcscoll_test.c (contents, props changed) Modified: head/lib/libc/tests/string/Makefile Modified: head/lib/libc/tests/string/Makefile ============================================================================== --- head/lib/libc/tests/string/Makefile Fri Jul 15 23:26:33 2016 (r302919) +++ head/lib/libc/tests/string/Makefile Fri Jul 15 23:43:23 2016 (r302920) @@ -6,6 +6,7 @@ ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= wcscasecmp_test ATF_TESTS_C+= wcsnlen_test ATF_TESTS_C+= strxfrm_test +ATF_TESTS_C+= wcscoll_test # TODO: popcount, stresep Added: head/lib/libc/tests/string/wcscoll_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/string/wcscoll_test.c Fri Jul 15 23:43:23 2016 (r302920) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2016 Baptiste Daroussin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +static int +cmp(const void *a, const void *b) +{ + const wchar_t wa[2] = { *(const wchar_t *)a, 0 }; + const wchar_t wb[2] = { *(const wchar_t *)b, 0 }; + + return (wcscoll(wa, wb)); +} + +ATF_TC_WITHOUT_HEAD(russian_collation); +ATF_TC_BODY(russian_collation, tc) +{ + wchar_t c[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё"; + wchar_t res[] = L"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяЯ"; + + ATF_CHECK_MSG(setlocale(LC_ALL, "ru_RU.UTF-8") != NULL, + "Fail to set locale to \"ru_RU.UTF-8\""); + qsort(c, wcslen(c), sizeof(wchar_t), cmp); + ATF_CHECK_MSG(wcscmp(c, res) == 0, + "Bad collation, expected: '%ls' got '%ls'", res, c); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, russian_collation); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Sat Jul 16 00:54:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD217B9922A; Sat, 16 Jul 2016 00:54:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 828E81EF5; Sat, 16 Jul 2016 00:54:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G0skHl011303; Sat, 16 Jul 2016 00:54:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G0skWl011302; Sat, 16 Jul 2016 00:54:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607160054.u6G0skWl011302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 16 Jul 2016 00:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302921 - head/sys/i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 00:54:47 -0000 Author: jhb Date: Sat Jul 16 00:54:46 2016 New Revision: 302921 URL: https://svnweb.freebsd.org/changeset/base/302921 Log: Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL. Suggested by: kib Modified: head/sys/i386/linux/linux_ptrace.c Modified: head/sys/i386/linux/linux_ptrace.c ============================================================================== --- head/sys/i386/linux/linux_ptrace.c Fri Jul 15 23:43:23 2016 (r302920) +++ head/sys/i386/linux/linux_ptrace.c Sat Jul 16 00:54:46 2016 (r302921) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #define PTRACE_ATTACH 16 #define PTRACE_DETACH 17 -#define PTRACE_SYSCALL 24 +#define LINUX_PTRACE_SYSCALL 24 #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 @@ -473,7 +473,7 @@ linux_ptrace(struct thread *td, struct l break; } - case PTRACE_SYSCALL: + case LINUX_PTRACE_SYSCALL: /* fall through */ default: printf("linux: ptrace(%u, ...) not implemented\n", From owner-svn-src-head@freebsd.org Sat Jul 16 07:01:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB596B99F59; Sat, 16 Jul 2016 07:01:52 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B4D91EB1; Sat, 16 Jul 2016 07:01:52 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bOJbp-000AqL-CS; Sat, 16 Jul 2016 10:01:57 +0300 Date: Sat, 16 Jul 2016 10:01:57 +0300 From: Slawa Olhovchenkov To: Allan Jude Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302790 - head/usr.sbin/bsdinstall/scripts Message-ID: <20160716070157.GL20831@zxy.spb.ru> References: <201607132349.u6DNnknJ012881@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607132349.u6DNnknJ012881@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 07:01:52 -0000 On Wed, Jul 13, 2016 at 11:49:46PM +0000, Allan Jude wrote: > Author: allanjude > Date: Wed Jul 13 23:49:45 2016 > New Revision: 302790 > URL: https://svnweb.freebsd.org/changeset/base/302790 > > Log: > bsdinstall: Prompt user to set the date and time after selecting timezone > > Not having the correct date and time makes many PKI based things not work > > In 10 and 11, it can mean that Unbound, ntpd, and sshd won't start Can you do more sofistical -- using current date and time as start value? PS: this is don't resolve case of cmos-less machines. > Submitted by: des (original patch) > MFC after: 7 days > > Modified: > head/usr.sbin/bsdinstall/scripts/time > > Modified: head/usr.sbin/bsdinstall/scripts/time > ============================================================================== > --- head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:03:34 2016 (r302789) > +++ head/usr.sbin/bsdinstall/scripts/time Wed Jul 13 23:49:45 2016 (r302790) > @@ -26,4 +26,40 @@ > # > # $FreeBSD$ > > +# Select timezone > chroot $BSDINSTALL_CHROOT tzsetup > + > +# Switch to target timezone > +saved_TZ="$TZ" > +TZ="${BSDINSTALL_CHROOT}/etc/localtime" > +export TZ > + > +# Set date > +exec 3>&1 > +DATE=$(dialog --backtitle 'FreeBSD Installer' \ > + --title 'Time & Date' \ > + --ok-label 'Set Date' \ > + --cancel-label 'Skip' \ > + --date-format '%Y%m%d%H%M.%S' \ > + --calendar '' 2 40 \ > +2>&1 1>&3) && date $DATE > +exec 3>&- > + > +# Set time > +exec 3>&1 > +TIME=$(dialog --backtitle 'FreeBSD Installer' \ > + --title 'Time & Date' \ > + --ok-label 'Set Time' \ > + --cancel-label 'Skip' \ > + --time-format '%H%M.%S' \ > + --timebox '' 2 40 \ > +2>&1 1>&3) && date $TIME > +exec 3>&- > + > +# Switch back > +if [ -n "$saved_TZ" ]; then > + TZ="$saved_TZ" > +else > + unset TZ > +fi > +unset saved_TZ > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Sat Jul 16 07:48:02 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 693F5B9AA6F; Sat, 16 Jul 2016 07:48:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32D4813B8; Sat, 16 Jul 2016 07:48:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G7m10J063199; Sat, 16 Jul 2016 07:48:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G7m1CN063198; Sat, 16 Jul 2016 07:48:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607160748.u6G7m1CN063198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Jul 2016 07:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302928 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 07:48:02 -0000 Author: tuexen Date: Sat Jul 16 07:48:01 2016 New Revision: 302928 URL: https://svnweb.freebsd.org/changeset/base/302928 Log: Address a potential memory leak found a the clang static code analyzer running on the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_auth.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Jul 16 06:41:02 2016 (r302927) +++ head/sys/netinet/sctp_auth.c Sat Jul 16 07:48:01 2016 (r302928) @@ -542,7 +542,7 @@ sctp_insert_sharedkey(struct sctp_keyhea } } /* shouldn't reach here */ - return (0); + return (EINVAL); } void @@ -622,8 +622,11 @@ sctp_copy_skeylist(const struct sctp_key LIST_FOREACH(skey, src, next) { new_skey = sctp_copy_sharedkey(skey); if (new_skey != NULL) { - (void)sctp_insert_sharedkey(dest, new_skey); - count++; + if (sctp_insert_sharedkey(dest, new_skey)) { + sctp_free_sharedkey(new_skey); + } else { + count++; + } } } return (count); From owner-svn-src-head@freebsd.org Sat Jul 16 08:04:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 894E5B99103; Sat, 16 Jul 2016 08:04:01 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5321A1C47; Sat, 16 Jul 2016 08:04:01 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G840Tw070442; Sat, 16 Jul 2016 08:04:00 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G840pr070441; Sat, 16 Jul 2016 08:04:00 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201607160804.u6G840pr070441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Sat, 16 Jul 2016 08:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302929 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 08:04:01 -0000 Author: cperciva Date: Sat Jul 16 08:04:00 2016 New Revision: 302929 URL: https://svnweb.freebsd.org/changeset/base/302929 Log: Now that potentially buggy versions of Xen are automatically detected (see r302635), there is no need to force msix interrupt migration off via loader.conf. Reverts: r302184 MFC after: 3 days Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Sat Jul 16 07:48:01 2016 (r302928) +++ head/release/tools/ec2.conf Sat Jul 16 08:04:00 2016 (r302929) @@ -72,12 +72,6 @@ vm_extra_pre_umount() { # nodes, but apply the workaround just in case. echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf - # Some EC2 instances run on a version of Xen which has a bug relating - # to the migration of MSI-X interrupts; this is visible as SR-IOV - # networking (aka. "EC2 Enhanced Networking") not being able to pass - # packets. Disable MSI-X interrupt migration to work around this bug. - echo 'machdep.disable_msix_migration="1"' >> ${DESTDIR}/boot/loader.conf - # The first time the AMI boots, the installed "first boot" scripts # should be allowed to run: # * ec2_configinit (download and process EC2 user-data) From owner-svn-src-head@freebsd.org Sat Jul 16 08:11:44 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB092B992AD; Sat, 16 Jul 2016 08:11:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 718BB1F82; Sat, 16 Jul 2016 08:11:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G8BhO8073979; Sat, 16 Jul 2016 08:11:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G8BhKr073978; Sat, 16 Jul 2016 08:11:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607160811.u6G8BhKr073978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Jul 2016 08:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302930 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 08:11:44 -0000 Author: tuexen Date: Sat Jul 16 08:11:43 2016 New Revision: 302930 URL: https://svnweb.freebsd.org/changeset/base/302930 Log: Don't free a data chunk twice. Found by the clang static code analyzer running for the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Jul 16 08:04:00 2016 (r302929) +++ head/sys/netinet/sctp_indata.c Sat Jul 16 08:11:43 2016 (r302930) @@ -961,11 +961,6 @@ place_chunk: * should not happen since the FSN is a TSN and it * should have been dropped earlier. */ - if (chk->data) { - sctp_m_freem(chk->data); - chk->data = NULL; - } - sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_5); From owner-svn-src-head@freebsd.org Sat Jul 16 09:08:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEFA4B9A3A9; Sat, 16 Jul 2016 09:08:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA2418F8; Sat, 16 Jul 2016 09:08:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G98XLc092658; Sat, 16 Jul 2016 09:08:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G98XP9092656; Sat, 16 Jul 2016 09:08:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607160908.u6G98XP9092656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 16 Jul 2016 09:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302932 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 09:08:34 -0000 Author: mav Date: Sat Jul 16 09:08:33 2016 New Revision: 302932 URL: https://svnweb.freebsd.org/changeset/base/302932 Log: Increase I82545_MAX_TXSEGS from 20 to 64 and add checks for it. There seems no hard limit on number of segments per packet in the chip, and 20 appeared insufficient. Hope 64 will be enough, but if not -- add check to report that and drop the packet instead of corrupting stack. Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/pci_e82545.c Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Sat Jul 16 08:17:14 2016 (r302931) +++ head/usr.sbin/bhyve/Makefile Sat Jul 16 09:08:33 2016 (r302932) @@ -29,6 +29,7 @@ SRCS= \ mptbl.c \ pci_ahci.c \ pci_e82545.c \ + pci_e82580.c \ pci_emul.c \ pci_fbuf.c \ pci_hostbridge.c \ Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Sat Jul 16 08:17:14 2016 (r302931) +++ head/usr.sbin/bhyve/pci_e82545.c Sat Jul 16 09:08:33 2016 (r302932) @@ -109,12 +109,8 @@ __FBSDID("$FreeBSD$"); #define E1000_ICR_SRPD 0x00010000 -/* - * XXX does this actually have a limit on the 82545 ? - * There is a limit on the max number of bytes, but perhaps not - * on descriptors ?? - */ -#define I82545_MAX_TXSEGS 20 +/* This is an arbitrary number. There is no hard limit on the chip. */ +#define I82545_MAX_TXSEGS 64 /* Legacy receive descriptor */ struct e1000_rx_desc { @@ -1050,15 +1046,18 @@ e82545_transmit_backend(struct e82545_so } static void -e82545_transmit_done(struct e82545_softc *sc, union e1000_tx_udesc **txwb, - int nwb) +e82545_transmit_done(struct e82545_softc *sc, uint16_t head, uint16_t tail, + uint16_t dsize, int *tdwb) { - int i; + union e1000_tx_udesc *dsc; - /* Write-back tx descriptor status */ - for (i = 0; i < nwb; i++) - txwb[i]->td.upper.data |= E1000_TXD_STAT_DD; - /* XXX wmb() */ + for ( ; head != tail; head = (head + 1) % dsize) { + dsc = &sc->esc_txdesc[head]; + if (dsc->td.lower.data & E1000_TXD_CMD_RS) { + dsc->td.upper.data |= E1000_TXD_STAT_DD; + *tdwb = 1; + } + } } static int @@ -1068,22 +1067,21 @@ e82545_transmit(struct e82545_softc *sc, uint8_t *hdr, *hdrp; struct iovec iovb[I82545_MAX_TXSEGS + 2]; struct iovec tiov[I82545_MAX_TXSEGS + 2]; - union e1000_tx_udesc *txwb[I82545_MAX_TXSEGS]; struct e1000_context_desc *cd; struct ck_info ckinfo[2]; struct iovec *iov; union e1000_tx_udesc *dsc; - int desc, dtype, len, ntype, nwb, iovcnt, tlen, hdrlen, vlen, tcp, tso; + int desc, dtype, len, ntype, iovcnt, tlen, hdrlen, vlen, tcp, tso; int mss, paylen, seg, tiovcnt, left, now, nleft, nnow, pv, pvoff; uint32_t tcpsum, tcpseq; - uint16_t ipcs, tcpcs, ipid; + uint16_t ipcs, tcpcs, ipid, ohead; ckinfo[0].ck_valid = ckinfo[1].ck_valid = 0; iovcnt = 0; tlen = 0; - nwb = 0; ntype = 0; tso = 0; + ohead = head; /* iovb[0/1] may be used for writable copy of headers. */ iov = &iovb[2]; @@ -1104,11 +1102,8 @@ e82545_transmit(struct e82545_softc *sc, head, dsc->td.buffer_addr, dsc->td.upper.data, dsc->td.lower.data); /* Save context and return */ - /* XXX ignore DD processing here */ sc->esc_txctx = dsc->cd; - *rhead = (head + 1) % dsize; - return (1); - break; + goto done; case E1000_TXD_TYP_L: DPRINTF("tx legacy desc idx %d: %08x%08x\r\n", head, dsc->td.upper.data, dsc->td.lower.data); @@ -1142,16 +1137,14 @@ e82545_transmit(struct e82545_softc *sc, (dsc->td.lower.data & E1000_TXD_CMD_IFCS) == 0) len -= 2; tlen += len; - iov[iovcnt].iov_base = paddr_guest2host(sc->esc_ctx, - dsc->td.buffer_addr, len); - iov[iovcnt].iov_len = len; + if (iovcnt < I82545_MAX_TXSEGS) { + iov[iovcnt].iov_base = paddr_guest2host( + sc->esc_ctx, dsc->td.buffer_addr, len); + iov[iovcnt].iov_len = len; + } iovcnt++; } - /* Record the descriptor addres if write-back requested */ - if (dsc->td.lower.data & E1000_TXD_CMD_RS) - txwb[nwb++] = dsc; - /* * Pull out info that is valid in the final descriptor * and exit descriptor loop. @@ -1197,6 +1190,12 @@ e82545_transmit(struct e82545_softc *sc, } } + if (iovcnt > I82545_MAX_TXSEGS) { + WPRINTF("tx too many descriptors (%d > %d) -- dropped\r\n", + iovcnt, I82545_MAX_TXSEGS); + goto done; + } + hdrlen = vlen = 0; /* Estimate writable space for VLAN header insertion. */ if ((sc->esc_CTRL & E1000_CTRL_VME) && @@ -1356,12 +1355,10 @@ e82545_transmit(struct e82545_softc *sc, } done: - /* Record if tx descs were written back */ - e82545_transmit_done(sc, txwb, nwb); - if (nwb) - *tdwb = 1; + head = (head + 1) % dsize; + e82545_transmit_done(sc, ohead, head, dsize, tdwb); - *rhead = (head + 1) % dsize; + *rhead = head; return (desc + 1); } From owner-svn-src-head@freebsd.org Sat Jul 16 09:44:32 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF27DB9AC1B; Sat, 16 Jul 2016 09:44:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A3D17DC; Sat, 16 Jul 2016 09:44:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6G9iV7w007407; Sat, 16 Jul 2016 09:44:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6G9iVWW007406; Sat, 16 Jul 2016 09:44:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607160944.u6G9iVWW007406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 16 Jul 2016 09:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302933 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 09:44:33 -0000 Author: mav Date: Sat Jul 16 09:44:31 2016 New Revision: 302933 URL: https://svnweb.freebsd.org/changeset/base/302933 Log: Revert unwanted change leaked into r302932. Modified: head/usr.sbin/bhyve/Makefile Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Sat Jul 16 09:08:33 2016 (r302932) +++ head/usr.sbin/bhyve/Makefile Sat Jul 16 09:44:31 2016 (r302933) @@ -29,7 +29,6 @@ SRCS= \ mptbl.c \ pci_ahci.c \ pci_e82545.c \ - pci_e82580.c \ pci_emul.c \ pci_fbuf.c \ pci_hostbridge.c \ From owner-svn-src-head@freebsd.org Sat Jul 16 12:25:38 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C6EFB99966; Sat, 16 Jul 2016 12:25:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6CE1B38; Sat, 16 Jul 2016 12:25:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GCPbu1066471; Sat, 16 Jul 2016 12:25:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GCPb5g066470; Sat, 16 Jul 2016 12:25:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607161225.u6GCPb5g066470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 16 Jul 2016 12:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302935 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 12:25:38 -0000 Author: tuexen Date: Sat Jul 16 12:25:37 2016 New Revision: 302935 URL: https://svnweb.freebsd.org/changeset/base/302935 Log: Deal with a portential memory allocation failure, which was reported by the clang static code analyzer. Joint work with rrs@. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Jul 16 10:50:28 2016 (r302934) +++ head/sys/netinet/sctp_indata.c Sat Jul 16 12:25:37 2016 (r302935) @@ -753,7 +753,7 @@ sctp_handle_old_data(struct sctp_tcb *st */ struct sctp_tmit_chunk *chk, *lchk, *tchk; uint32_t fsn; - struct sctp_queued_to_read *nc = NULL; + struct sctp_queued_to_read *nc; int cnt_added; if (control->first_frag_seen == 0) { @@ -768,6 +768,11 @@ restart: TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) { if (chk->rec.data.fsn_num == fsn) { /* Ok lets add it */ + sctp_alloc_a_readq(stcb, nc); + if (nc == NULL) { + break; + } + memset(nc, 0, sizeof(struct sctp_queued_to_read)); TAILQ_REMOVE(&control->reasm, chk, sctp_next); sctp_add_chk_to_control(control, strm, stcb, asoc, chk); fsn++; @@ -781,7 +786,6 @@ restart: * on the control queue to a new * control. */ - sctp_alloc_a_readq(stcb, nc); sctp_build_readq_entry_from_ctl(nc, control); tchk = TAILQ_FIRST(&control->reasm); if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { @@ -826,16 +830,19 @@ restart: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); - if ((nc) && (nc->first_frag_seen)) { + if (!TAILQ_EMPTY(&nc->reasm) && (nc->first_frag_seen)) { /* * Switch to the new guy and * continue */ control = nc; - nc = NULL; goto restart; + } else { + sctp_free_a_readq(stcb, nc); } return (1); + } else { + sctp_free_a_readq(stcb, nc); } } else { /* Can't add more */ From owner-svn-src-head@freebsd.org Sat Jul 16 13:25:00 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17AC9B9A784; Sat, 16 Jul 2016 13:25:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB2F116D7; Sat, 16 Jul 2016 13:24:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GDOxoS088388; Sat, 16 Jul 2016 13:24:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GDOxSG088387; Sat, 16 Jul 2016 13:24:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607161324.u6GDOxSG088387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Jul 2016 13:24:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302936 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 13:25:00 -0000 Author: kib Date: Sat Jul 16 13:24:58 2016 New Revision: 302936 URL: https://svnweb.freebsd.org/changeset/base/302936 Log: Another issue reported on http://seclists.org/oss-sec/2016/q3/68 is that struct kevent member ident has uintptr_t type, which is silently truncated to int in the call to fget(). Explicitely check for the valid range. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Jul 16 12:25:37 2016 (r302935) +++ head/sys/kern/kern_event.c Sat Jul 16 13:24:58 2016 (r302936) @@ -1183,8 +1183,11 @@ kqueue_register(struct kqueue *kq, struc findkn: if (fops->f_isfd) { KASSERT(td != NULL, ("td is NULL")); - error = fget(td, kev->ident, - cap_rights_init(&rights, CAP_EVENT), &fp); + if (kev->ident > INT_MAX) + error = EBADF; + else + error = fget(td, kev->ident, + cap_rights_init(&rights, CAP_EVENT), &fp); if (error) goto done; From owner-svn-src-head@freebsd.org Sat Jul 16 13:26:20 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05CEAB9A824; Sat, 16 Jul 2016 13:26:20 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7EA61881; Sat, 16 Jul 2016 13:26:19 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GDQI3L088489; Sat, 16 Jul 2016 13:26:18 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GDQIgG088484; Sat, 16 Jul 2016 13:26:18 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607161326.u6GDQIgG088484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 16 Jul 2016 13:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302937 - in head/bin/sh: . tests/expansion X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 13:26:20 -0000 Author: ache Date: Sat Jul 16 13:26:18 2016 New Revision: 302937 URL: https://svnweb.freebsd.org/changeset/base/302937 Log: Path generation was not according to collate Approved by: jilles Added: head/bin/sh/tests/expansion/pathname6.0 (contents, props changed) Modified: head/bin/sh/expand.c head/bin/sh/tests/expansion/Makefile head/bin/sh/tests/expansion/pathname1.0 head/bin/sh/tests/expansion/pathname2.0 Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sat Jul 16 13:24:58 2016 (r302936) +++ head/bin/sh/expand.c Sat Jul 16 13:26:18 2016 (r302937) @@ -1196,7 +1196,7 @@ expsortcmp(const void *p1, const void *p const char *s1 = *(const char * const *)p1; const char *s2 = *(const char * const *)p2; - return (strcmp(s1, s2)); + return (strcoll(s1, s2)); } Modified: head/bin/sh/tests/expansion/Makefile ============================================================================== --- head/bin/sh/tests/expansion/Makefile Sat Jul 16 13:24:58 2016 (r302936) +++ head/bin/sh/tests/expansion/Makefile Sat Jul 16 13:26:18 2016 (r302937) @@ -66,6 +66,7 @@ ${PACKAGE}FILES+= pathname2.0 ${PACKAGE}FILES+= pathname3.0 ${PACKAGE}FILES+= pathname4.0 ${PACKAGE}FILES+= pathname5.0 +${PACKAGE}FILES+= pathname6.0 ${PACKAGE}FILES+= plus-minus1.0 ${PACKAGE}FILES+= plus-minus2.0 ${PACKAGE}FILES+= plus-minus3.0 Modified: head/bin/sh/tests/expansion/pathname1.0 ============================================================================== --- head/bin/sh/tests/expansion/pathname1.0 Sat Jul 16 13:24:58 2016 (r302936) +++ head/bin/sh/tests/expansion/pathname1.0 Sat Jul 16 13:26:18 2016 (r302937) @@ -1,5 +1,9 @@ # $FreeBSD$ +unset LC_ALL +LC_COLLATE=C +export LC_COLLATE + failures=0 check() { Modified: head/bin/sh/tests/expansion/pathname2.0 ============================================================================== --- head/bin/sh/tests/expansion/pathname2.0 Sat Jul 16 13:24:58 2016 (r302936) +++ head/bin/sh/tests/expansion/pathname2.0 Sat Jul 16 13:26:18 2016 (r302937) @@ -1,5 +1,9 @@ # $FreeBSD$ +unset LC_ALL +LC_COLLATE=C +export LC_COLLATE + failures=0 check() { Added: head/bin/sh/tests/expansion/pathname6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/expansion/pathname6.0 Sat Jul 16 13:26:18 2016 (r302937) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +unset LC_ALL +LC_COLLATE=en_US.US-ASCII +export LC_COLLATE + +failures=0 + +check() { + testcase=$1 + expect=$2 + eval "set -- $testcase" + actual="$*" + if [ "$actual" != "$expect" ]; then + failures=$((failures+1)) + printf '%s\n' "For $testcase, expected $expect actual $actual" + fi +} + +set -e +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +trap 'rm -rf $T' 0 +cd -P $T + +touch A B a b + +check '*' 'a A b B' + +exit $((failures != 0)) From owner-svn-src-head@freebsd.org Sat Jul 16 18:06:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31999B9AEF2; Sat, 16 Jul 2016 18:06:43 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D365212D1; Sat, 16 Jul 2016 18:06:42 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GI6ft0092480; Sat, 16 Jul 2016 18:06:41 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GI6fr5092479; Sat, 16 Jul 2016 18:06:41 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607161806.u6GI6fr5092479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sat, 16 Jul 2016 18:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302939 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 18:06:43 -0000 Author: jmcneill Date: Sat Jul 16 18:06:41 2016 New Revision: 302939 URL: https://svnweb.freebsd.org/changeset/base/302939 Log: Add support for Allwinner H3 EMAC. H3 EMAC is the same as A83T/A64 except the SoC includes an (optional) internal 10/100 PHY. Both internal and external PHYs are supported on H3 with this driver. Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sat Jul 16 15:52:14 2016 (r302938) +++ head/sys/arm/allwinner/if_awg.c Sat Jul 16 18:06:41 2016 (r302939) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -69,9 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include "miibus_if.h" +#include "gpio_if.h" -#define RD4(sc, reg) bus_read_4((sc)->res[0], (reg)) -#define WR4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) +#define RD4(sc, reg) bus_read_4((sc)->res[_RES_EMAC], (reg)) +#define WR4(sc, reg, val) bus_write_4((sc)->res[_RES_EMAC], (reg), (val)) #define AWG_LOCK(sc) mtx_lock(&(sc)->mtx) #define AWG_UNLOCK(sc) mtx_unlock(&(sc)->mtx); @@ -101,6 +103,25 @@ __FBSDID("$FreeBSD$"); #define TX_INTERVAL_DEFAULT 64 #define RX_BATCH_DEFAULT 64 +/* syscon EMAC clock register */ +#define EMAC_CLK_EPHY_ADDR (0x1f << 20) /* H3 */ +#define EMAC_CLK_EPHY_ADDR_SHIFT 20 +#define EMAC_CLK_EPHY_LED_POL (1 << 17) /* H3 */ +#define EMAC_CLK_EPHY_SHUTDOWN (1 << 16) /* H3 */ +#define EMAC_CLK_EPHY_SELECT (1 << 15) /* H3 */ +#define EMAC_CLK_RMII_EN (1 << 13) +#define EMAC_CLK_ETXDC (0x7 << 10) +#define EMAC_CLK_ETXDC_SHIFT 10 +#define EMAC_CLK_ERXDC (0x1f << 5) +#define EMAC_CLK_ERXDC_SHIFT 5 +#define EMAC_CLK_PIT (0x1 << 2) +#define EMAC_CLK_PIT_MII (0 << 2) +#define EMAC_CLK_PIT_RGMII (1 << 2) +#define EMAC_CLK_SRC (0x3 << 0) +#define EMAC_CLK_SRC_MII (0 << 0) +#define EMAC_CLK_SRC_EXT_RGMII (1 << 0) +#define EMAC_CLK_SRC_RGMII (2 << 0) + /* Burst length of RX and TX DMA transfers */ static int awg_burst_len = BURST_LEN_DEFAULT; TUNABLE_INT("hw.awg.burst_len", &awg_burst_len); @@ -121,8 +142,14 @@ TUNABLE_INT("hw.awg.tx_interval", &awg_t static int awg_rx_batch = RX_BATCH_DEFAULT; TUNABLE_INT("hw.awg.rx_batch", &awg_rx_batch); +enum awg_type { + EMAC_A83T = 1, + EMAC_H3, +}; + static struct ofw_compat_data compat_data[] = { - { "allwinner,sun8i-a83t-emac", 1 }, + { "allwinner,sun8i-a83t-emac", EMAC_A83T }, + { "allwinner,sun8i-h3-emac", EMAC_H3 }, { NULL, 0 } }; @@ -151,8 +178,15 @@ struct awg_rxring { u_int cur; }; +enum { + _RES_EMAC, + _RES_IRQ, + _RES_SYSCON, + _RES_NITEMS +}; + struct awg_softc { - struct resource *res[2]; + struct resource *res[_RES_NITEMS]; struct mtx mtx; if_t ifp; device_t miibus; @@ -162,6 +196,7 @@ struct awg_softc { u_int mdc_div_ratio_m; int link; int if_flags; + enum awg_type type; struct awg_txring tx; struct awg_rxring rx; @@ -170,6 +205,7 @@ struct awg_softc { static struct resource_spec awg_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE | RF_OPTIONAL }, { -1, 0 } }; @@ -1016,49 +1052,73 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t } static int -awg_setup_extres(device_t dev) +awg_setup_phy(device_t dev) { struct awg_softc *sc; - hwreset_t rst_ahb; - clk_t clk_ahb, clk_tx, clk_tx_parent; - regulator_t reg; + clk_t clk_tx, clk_tx_parent; const char *tx_parent_name; char *phy_type; phandle_t node; - uint64_t freq; - int error, div; + uint32_t reg, tx_delay, rx_delay; + int error; sc = device_get_softc(dev); node = ofw_bus_get_node(dev); - rst_ahb = NULL; - clk_ahb = NULL; - clk_tx = NULL; - clk_tx_parent = NULL; - reg = NULL; - phy_type = NULL; - /* Get AHB clock and reset resources */ - error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); - if (error != 0) { - device_printf(dev, "cannot get ahb reset\n"); - goto fail; - } - error = clk_get_by_ofw_name(dev, 0, "ahb", &clk_ahb); - if (error != 0) { - device_printf(dev, "cannot get ahb clock\n"); - goto fail; - } - - /* Configure PHY for MII or RGMII mode */ - if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type)) { - if (bootverbose) - device_printf(dev, "PHY type: %s\n", phy_type); + if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type) == 0) + return (0); + if (bootverbose) + device_printf(dev, "PHY type: %s, conf mode: %s\n", phy_type, + sc->res[_RES_SYSCON] != NULL ? "reg" : "clk"); + + if (sc->res[_RES_SYSCON] != NULL) { + reg = bus_read_4(sc->res[_RES_SYSCON], 0); + reg &= ~(EMAC_CLK_PIT | EMAC_CLK_SRC | EMAC_CLK_RMII_EN); + if (strcmp(phy_type, "rgmii") == 0) + reg |= EMAC_CLK_PIT_RGMII | EMAC_CLK_SRC_RGMII; + else if (strcmp(phy_type, "rmii") == 0) + reg |= EMAC_CLK_RMII_EN; + else + reg |= EMAC_CLK_PIT_MII | EMAC_CLK_SRC_MII; + + if (OF_getencprop(node, "tx-delay", &tx_delay, + sizeof(tx_delay)) > 0) { + reg &= ~EMAC_CLK_ETXDC; + reg |= (tx_delay << EMAC_CLK_ETXDC_SHIFT); + } + if (OF_getencprop(node, "rx-delay", &rx_delay, + sizeof(rx_delay)) > 0) { + reg &= ~EMAC_CLK_ERXDC; + reg |= (rx_delay << EMAC_CLK_ERXDC_SHIFT); + } + + if (sc->type == EMAC_H3) { + if (OF_hasprop(node, "allwinner,use-internal-phy")) { + reg |= EMAC_CLK_EPHY_SELECT; + reg &= ~EMAC_CLK_EPHY_SHUTDOWN; + if (OF_hasprop(node, + "allwinner,leds-active-low")) + reg |= EMAC_CLK_EPHY_LED_POL; + else + reg &= ~EMAC_CLK_EPHY_LED_POL; + + /* Set internal PHY addr to 1 */ + reg &= ~EMAC_CLK_EPHY_ADDR; + reg |= (1 << EMAC_CLK_EPHY_ADDR_SHIFT); + } else { + reg &= ~EMAC_CLK_EPHY_SELECT; + } + } + + if (bootverbose) + device_printf(dev, "EMAC clock: 0x%08x\n", reg); + bus_write_4(sc->res[_RES_SYSCON], 0, reg); + } else { if (strcmp(phy_type, "rgmii") == 0) tx_parent_name = "emac_int_tx"; else tx_parent_name = "mii_phy_tx"; - OF_prop_free(phy_type); /* Get the TX clock */ error = clk_get_by_ofw_name(dev, 0, "tx", &clk_tx); @@ -1090,12 +1150,63 @@ awg_setup_extres(device_t dev) } } - /* Enable AHB clock */ + error = 0; + +fail: + OF_prop_free(phy_type); + return (error); +} + +static int +awg_setup_extres(device_t dev) +{ + struct awg_softc *sc; + hwreset_t rst_ahb, rst_ephy; + clk_t clk_ahb, clk_ephy; + regulator_t reg; + phandle_t node; + uint64_t freq; + int error, div; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + rst_ahb = rst_ephy = NULL; + clk_ahb = clk_ephy = NULL; + reg = NULL; + + /* Get AHB clock and reset resources */ + error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb); + if (error != 0) { + device_printf(dev, "cannot get ahb reset\n"); + goto fail; + } + if (hwreset_get_by_ofw_name(dev, 0, "ephy", &rst_ephy) != 0) + rst_ephy = NULL; + error = clk_get_by_ofw_name(dev, 0, "ahb", &clk_ahb); + if (error != 0) { + device_printf(dev, "cannot get ahb clock\n"); + goto fail; + } + if (clk_get_by_ofw_name(dev, 0, "ephy", &clk_ephy) != 0) + clk_ephy = NULL; + + /* Configure PHY for MII or RGMII mode */ + if (awg_setup_phy(dev) != 0) + goto fail; + + /* Enable clocks */ error = clk_enable(clk_ahb); if (error != 0) { device_printf(dev, "cannot enable ahb clock\n"); goto fail; } + if (clk_ephy != NULL) { + error = clk_enable(clk_ephy); + if (error != 0) { + device_printf(dev, "cannot enable ephy clock\n"); + goto fail; + } + } /* De-assert reset */ error = hwreset_deassert(rst_ahb); @@ -1103,6 +1214,13 @@ awg_setup_extres(device_t dev) device_printf(dev, "cannot de-assert ahb reset\n"); goto fail; } + if (rst_ephy != NULL) { + error = hwreset_deassert(rst_ephy); + if (error != 0) { + device_printf(dev, "cannot de-assert ephy reset\n"); + goto fail; + } + } /* Enable PHY regulator if applicable */ if (regulator_get_by_ofw_property(dev, 0, "phy-supply", ®) == 0) { @@ -1135,22 +1253,20 @@ awg_setup_extres(device_t dev) } if (bootverbose) - device_printf(dev, "AHB frequency %llu Hz, MDC div: 0x%x\n", - freq, sc->mdc_div_ratio_m); + device_printf(dev, "AHB frequency %ju Hz, MDC div: 0x%x\n", + (uintmax_t)freq, sc->mdc_div_ratio_m); return (0); fail: - OF_prop_free(phy_type); - if (reg != NULL) regulator_release(reg); - if (clk_tx_parent != NULL) - clk_release(clk_tx_parent); - if (clk_tx != NULL) - clk_release(clk_tx); + if (clk_ephy != NULL) + clk_release(clk_ephy); if (clk_ahb != NULL) clk_release(clk_ahb); + if (rst_ephy != NULL) + hwreset_release(rst_ephy); if (rst_ahb != NULL) hwreset_release(rst_ahb); return (error); @@ -1226,6 +1342,52 @@ awg_dump_regs(device_t dev) } #endif +#define GPIO_ACTIVE_LOW 1 + +static int +awg_phy_reset(device_t dev) +{ + pcell_t gpio_prop[4], delay_prop[3]; + phandle_t node, gpio_node; + device_t gpio; + uint32_t pin, flags; + uint32_t pin_value; + + node = ofw_bus_get_node(dev); + if (OF_getencprop(node, "allwinner,reset-gpio", gpio_prop, + sizeof(gpio_prop)) <= 0) + return (0); + + if (OF_getencprop(node, "allwinner,reset-delays-us", delay_prop, + sizeof(delay_prop)) <= 0) + return (ENXIO); + + gpio_node = OF_node_from_xref(gpio_prop[0]); + if ((gpio = OF_device_from_xref(gpio_prop[0])) == NULL) + return (ENXIO); + + if (GPIO_MAP_GPIOS(gpio, node, gpio_node, nitems(gpio_prop) - 1, + gpio_prop + 1, &pin, &flags) != 0) + return (ENXIO); + + pin_value = GPIO_PIN_LOW; + if (OF_hasprop(node, "allwinner,reset-active-low")) + pin_value = GPIO_PIN_HIGH; + + if (flags & GPIO_ACTIVE_LOW) + pin_value = !pin_value; + + GPIO_PIN_SETFLAGS(gpio, pin, GPIO_PIN_OUTPUT); + GPIO_PIN_SET(gpio, pin, pin_value); + DELAY(delay_prop[0]); + GPIO_PIN_SET(gpio, pin, !pin_value); + DELAY(delay_prop[1]); + GPIO_PIN_SET(gpio, pin, pin_value); + DELAY(delay_prop[2]); + + return (0); +} + static int awg_reset(device_t dev) { @@ -1234,6 +1396,12 @@ awg_reset(device_t dev) sc = device_get_softc(dev); + /* Reset PHY if necessary */ + if (awg_phy_reset(dev) != 0) { + device_printf(dev, "failed to reset PHY\n"); + return (ENXIO); + } + /* Soft reset all registers and logic */ WR4(sc, EMAC_BASIC_CTL_1, BASIC_CTL_SOFT_RST); @@ -1431,6 +1599,7 @@ awg_attach(device_t dev) int error; sc = device_get_softc(dev); + sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; node = ofw_bus_get_node(dev); if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) { @@ -1461,8 +1630,8 @@ awg_attach(device_t dev) return (error); /* Install interrupt handler */ - error = bus_setup_intr(dev, sc->res[1], INTR_TYPE_NET | INTR_MPSAFE, - NULL, awg_intr, sc, &sc->ih); + error = bus_setup_intr(dev, sc->res[_RES_IRQ], + INTR_TYPE_NET | INTR_MPSAFE, NULL, awg_intr, sc, &sc->ih); if (error != 0) { device_printf(dev, "cannot setup interrupt handler\n"); return (error); From owner-svn-src-head@freebsd.org Sat Jul 16 18:28:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D1A3B9B768; Sat, 16 Jul 2016 18:28:46 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDB541D37; Sat, 16 Jul 2016 18:28:45 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GISjck099669; Sat, 16 Jul 2016 18:28:45 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GISjir099668; Sat, 16 Jul 2016 18:28:45 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201607161828.u6GISjir099668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sat, 16 Jul 2016 18:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302940 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 18:28:46 -0000 Author: allanjude Date: Sat Jul 16 18:28:44 2016 New Revision: 302940 URL: https://svnweb.freebsd.org/changeset/base/302940 Log: Fix encrypted MBR install The pools are exported and reimported in order to write the bootcode This causes an error when the bootpool is later mounted by common code The bootpool is now imported with the -N flag to prevent mounting Reported by: Michael Dexter MFC after: 5 days Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 18:06:41 2016 (r302939) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 18:28:44 2016 (r302940) @@ -1384,8 +1384,9 @@ zfs_create_boot() "-o altroot=\"$BSDINSTALL_CHROOT\"" "$zroot_name" || return $FAILURE if [ "$ZFSBOOT_BOOT_POOL" ]; then + # Import the bootpool, but do not mount it yet f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \ - "-o altroot=\"$BSDINSTALL_CHROOT\"" \ + "-o altroot=\"$BSDINSTALL_CHROOT\" -N" \ "$bootpool_name" || return $FAILURE fi fi From owner-svn-src-head@freebsd.org Sat Jul 16 19:35:05 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76513B9A8A6; Sat, 16 Jul 2016 19:35:05 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CDE31E24; Sat, 16 Jul 2016 19:35:05 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6GJZ4ro025940; Sat, 16 Jul 2016 19:35:04 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6GJZ4kx025939; Sat, 16 Jul 2016 19:35:04 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201607161935.u6GJZ4kx025939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sat, 16 Jul 2016 19:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302941 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2016 19:35:05 -0000 Author: allanjude Date: Sat Jul 16 19:35:04 2016 New Revision: 302941 URL: https://svnweb.freebsd.org/changeset/base/302941 Log: A failed installation once restarted will often error out If an encrypted install is attempted and fails for any reason, the disk cannot be erased by the installer because the partition is in use by GELI At the start of the installation process, all ZFS pools are exported and all GELI instances are detached, to allow a restarted install to proceed PR: 210814 Reported by: jonathan MFC after: 10 days Modified: head/usr.sbin/bsdinstall/scripts/zfsboot Modified: head/usr.sbin/bsdinstall/scripts/zfsboot ============================================================================== --- head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 18:28:44 2016 (r302940) +++ head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 19:35:04 2016 (r302941) @@ -224,6 +224,7 @@ ZFS_UNMOUNT='zfs unmount "%s"' ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s' ZPOOL_DESTROY='zpool destroy "%s"' ZPOOL_EXPORT='zpool export "%s"' +ZPOOL_EXPORT_F='zpool export -f "%s"' ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"' ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"' ZPOOL_SET='zpool set %s "%s"' @@ -783,6 +784,14 @@ zfs_create_diskpart() # NOTE: `-F' required to destroy if partitions still exist. # NOTE: Failure is ok here, blank disk will have nothing to destroy. # + f_dprintf "$funcname: Exporting ZFS pools..." + zpool list -Ho name | while read z_name; do + f_eval_catch -d $funcname zpool "$ZPOOL_EXPORT_F" $z_name + done + f_dprintf "$funcname: Detaching all GELI providers..." + geli status | tail -n +2 | while read g_name g_status g_component; do + f_eval_catch -d $funcname geli "$GELI_DETACH_F" $g_name + done f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk" f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk