From owner-svn-src-head@freebsd.org Sun Jul 17 08:31: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 9786CB9BF7B; Sun, 17 Jul 2016 08:31:22 +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 5D8DD1ACA; Sun, 17 Jul 2016 08:31:22 +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 u6H8VLXY009006; Sun, 17 Jul 2016 08:31:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6H8VLVl009005; Sun, 17 Jul 2016 08:31:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607170831.u6H8VLVl009005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 17 Jul 2016 08:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302942 - 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: Sun, 17 Jul 2016 08:31:22 -0000 Author: tuexen Date: Sun Jul 17 08:31:21 2016 New Revision: 302942 URL: https://svnweb.freebsd.org/changeset/base/302942 Log: Add missing sctps_reasmusrmsgs counter. 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 19:35:04 2016 (r302941) +++ head/sys/netinet/sctp_indata.c Sun Jul 17 08:31:21 2016 (r302942) @@ -823,6 +823,7 @@ restart: if (control->on_strm_q) { TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); control->on_strm_q = 0; + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); } if (control->on_read_q == 0) { sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -1028,6 +1029,7 @@ sctp_deliver_reasm_check(struct sctp_tcb control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); control->on_strm_q = 0; } @@ -1082,6 +1084,7 @@ done_un: control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); control->on_strm_q = 0; } @@ -1127,6 +1130,7 @@ deliver_more: control, control->on_strm_q); } #endif + SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); control->on_strm_q = 0; } From owner-svn-src-head@freebsd.org Sun Jul 17 09:40: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 7BCF9B9AC86; Sun, 17 Jul 2016 09:40:00 +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 3A71C1315; Sun, 17 Jul 2016 09:40: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 u6H9dxOO034666; Sun, 17 Jul 2016 09:39:59 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6H9dxtm034665; Sun, 17 Jul 2016 09:39:59 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607170939.u6H9dxtm034665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 17 Jul 2016 09:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302943 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 09:40:00 -0000 Author: ache Date: Sun Jul 17 09:39:59 2016 New Revision: 302943 URL: https://svnweb.freebsd.org/changeset/base/302943 Log: 1) This file full of direct char <-> wchar_t assignment, not converted, cut them down. This hack still remains: * 2. Illegal byte sequences in filenames are handled by treating them as * single-byte characters with a values of such bytes of the sequence * cast to wchar_t. 2) Reword the comment in the hack above to reflect implementation. 3) Protect signed wchar_t from sign extension when a signed char is assigned to it in the hack above. 3) Corresponding backward hack in g_Ctoc() was not implemented, so all pathes with illegal byte sequences are skipped as result, implement it now. 4) globtilde() forget to convert expanded user home dir from multibyte to wchar. 5) Protect globtilde() from long expansion truncation. 6) Results was not sorted according to collate as POSIX requires. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sun Jul 17 08:31:21 2016 (r302942) +++ head/lib/libc/gen/glob.c Sun Jul 17 09:39:59 2016 (r302943) @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); * 1. Patterns with illegal byte sequences match nothing - even if * GLOB_NOCHECK is specified. * 2. Illegal byte sequences in filenames are handled by treating them as - * single-byte characters with a value of the first byte of the sequence + * single-byte characters with a values of such bytes of the sequence * cast to wchar_t. * 3. State-dependent encodings are not currently supported. */ @@ -113,23 +113,21 @@ struct glob_limit { size_t l_string_cnt; }; -#define DOLLAR '$' -#define DOT '.' -#define EOS '\0' -#define LBRACKET '[' -#define NOT '!' -#define QUESTION '?' -#define QUOTE '\\' -#define RANGE '-' -#define RBRACKET ']' -#define SEP '/' -#define STAR '*' -#define TILDE '~' -#define UNDERSCORE '_' -#define LBRACE '{' -#define RBRACE '}' -#define SLASH '/' -#define COMMA ',' +#define DOT L'.' +#define EOS L'\0' +#define LBRACKET L'[' +#define NOT L'!' +#define QUESTION L'?' +#define QUOTE L'\\' +#define RANGE L'-' +#define RBRACKET L']' +#define SEP L'/' +#define STAR L'*' +#define TILDE L'~' +#define LBRACE L'{' +#define RBRACE L'}' +#define SLASH L'/' +#define COMMA L',' #ifndef DEBUG @@ -154,12 +152,12 @@ typedef char Char; #define CHAR(c) ((Char)((c)&M_CHAR)) #define META(c) ((Char)((c)|M_QUOTE)) -#define M_ALL META('*') -#define M_END META(']') -#define M_NOT META('!') -#define M_ONE META('?') -#define M_RNG META('-') -#define M_SET META('[') +#define M_ALL META(L'*') +#define M_END META(L']') +#define M_NOT META(L'!') +#define M_ONE META(L'?') +#define M_RNG META(L'-') +#define M_SET META(L'[') #define ismeta(c) (((c)&M_QUOTE) != 0) @@ -233,8 +231,8 @@ glob(const char * __restrict pattern, in /* Protect the quoted characters. */ memset(&mbs, 0, sizeof(mbs)); while (bufend - bufnext >= MB_CUR_MAX) { - if (*patnext == QUOTE) { - if (*++patnext == EOS) { + if (*patnext == '\\') { + if (*++patnext == '\0') { *bufnext++ = QUOTE | M_PROTECT; continue; } @@ -401,9 +399,15 @@ static const Char * globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) { struct passwd *pwd; - char *h; + char *h, *sc; const Char *p; Char *b, *eb; + wchar_t wc; + wchar_t wbuf[MAXPATHLEN]; + wchar_t *wbufend, *dc; + size_t clen; + mbstate_t mbs; + int too_long; if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) return (pattern); @@ -412,13 +416,17 @@ globtilde(const Char *pattern, Char *pat * Copy up to the end of the string or / */ eb = &patbuf[patbuf_len - 1]; - for (p = pattern + 1, h = (char *) patbuf; - h < (char *)eb && *p && *p != SLASH; *h++ = *p++) + for (p = pattern + 1, b = patbuf; + b < eb && *p != EOS && *p != SLASH; *b++ = *p++) continue; - *h = EOS; + if (*p != EOS && *p != SLASH) + return (pattern); + + *b = EOS; + h = NULL; - if (((char *) patbuf)[0] == EOS) { + if (patbuf[0] == EOS) { /* * handle a plain ~ or ~/ by expanding $HOME first (iff * we're not running setuid or setgid) and then trying @@ -438,20 +446,55 @@ globtilde(const Char *pattern, Char *pat /* * Expand a ~user */ - if ((pwd = getpwnam((char*) patbuf)) == NULL) + if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf)) || + (pwd = getpwnam((char *)wbuf)) == NULL) return (pattern); else h = pwd->pw_dir; } /* Copy the home directory */ - for (b = patbuf; b < eb && *h; *b++ = *h++) + dc = wbuf; + sc = h; + wbufend = wbuf + MAXPATHLEN - 1; + too_long = 1; + memset(&mbs, 0, sizeof(mbs)); + while (dc <= wbufend) { + clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs); + if (clen == (size_t)-1 || clen == (size_t)-2) { + /* XXX See initial comment #2. */ + wc = (unsigned char)*sc; + clen = 1; + memset(&mbs, 0, sizeof(mbs)); + } + if ((*dc++ = wc) == EOS) { + too_long = 0; + break; + } + sc += clen; + } + if (too_long) + return (pattern); + + dc = wbuf; + for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++) continue; + if (*dc != EOS) + return (pattern); /* Append the rest of the pattern */ - while (b < eb && (*b++ = *p++) != EOS) - continue; - *b = EOS; + if (*p != EOS) { + too_long = 1; + while (b <= eb) { + if ((*b++ = *p++) == EOS) { + too_long = 0; + break; + } + } + if (too_long) + return (pattern); + } else + *b = EOS; return (patbuf); } @@ -553,7 +596,7 @@ glob0(const Char *pattern, glob_t *pglob static int compare(const void *p, const void *q) { - return (strcmp(*(char **)p, *(char **)q)); + return (strcoll(*(char **)p, *(char **)q)); } static int @@ -699,7 +742,7 @@ glob3(Char *pathbuf, Char *pathend, Char } /* Initial DOT must be matched literally. */ - if (dp->d_name[0] == DOT && *pattern != DOT) + if (dp->d_name[0] == '.' && *pattern != DOT) continue; memset(&mbs, 0, sizeof(mbs)); dc = pathend; @@ -707,7 +750,8 @@ glob3(Char *pathbuf, Char *pathend, Char while (dc < pathend_last) { clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) { - wc = *sc; + /* XXX See initial comment #2. */ + wc = (unsigned char)*sc; clen = 1; memset(&mbs, 0, sizeof(mbs)); } @@ -831,10 +875,12 @@ match(Char *name, Char *pat, Char *paten 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(CHAR(c), CHAR(k)) <= 0 - && __wcollate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0 - ) + CHAR(c) <= CHAR(k) && + CHAR(k) <= CHAR(pat[1]) : + __wcollate_range_cmp(CHAR(c), + CHAR(k)) <= 0 && + __wcollate_range_cmp(CHAR(k), + CHAR(pat[1])) <= 0) ok = 1; pat += 2; } else if (c == k) @@ -873,7 +919,7 @@ g_opendir(Char *str, glob_t *pglob) { char buf[MAXPATHLEN]; - if (!*str) + if (*str == EOS) strcpy(buf, "."); else { if (g_Ctoc(str, buf, sizeof(buf))) @@ -934,9 +980,13 @@ g_Ctoc(const Char *str, char *buf, size_ memset(&mbs, 0, sizeof(mbs)); while (len >= MB_CUR_MAX) { clen = wcrtomb(buf, *str, &mbs); - if (clen == (size_t)-1) - return (1); - if (*str == L'\0') + if (clen == (size_t)-1) { + /* XXX See initial comment #2. */ + *buf = (char)*str; + clen = 1; + memset(&mbs, 0, sizeof(mbs)); + } + if (*buf == '\0') return (0); str++; buf += clen; From owner-svn-src-head@freebsd.org Sun Jul 17 11:25: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 C6862B9CACD; Sun, 17 Jul 2016 11:25:25 +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 8E95D15D6; Sun, 17 Jul 2016 11:25:25 +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 u6HBPOX4074624; Sun, 17 Jul 2016 11:25:24 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HBPOpJ074623; Sun, 17 Jul 2016 11:25:24 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607171125.u6HBPOpJ074623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 17 Jul 2016 11:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302944 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 11:25:25 -0000 Author: ache Date: Sun Jul 17 11:25:24 2016 New Revision: 302944 URL: https://svnweb.freebsd.org/changeset/base/302944 Log: In g_Ctoc() apply CHAR() macro to *str to strip all flags. It gains nothing right now, but some architectures theoretically may 64-bit wchar_t and the code looks more correct. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sun Jul 17 09:39:59 2016 (r302943) +++ head/lib/libc/gen/glob.c Sun Jul 17 11:25:24 2016 (r302944) @@ -979,14 +979,14 @@ g_Ctoc(const Char *str, char *buf, size_ memset(&mbs, 0, sizeof(mbs)); while (len >= MB_CUR_MAX) { - clen = wcrtomb(buf, *str, &mbs); + clen = wcrtomb(buf, CHAR(*str), &mbs); if (clen == (size_t)-1) { /* XXX See initial comment #2. */ - *buf = (char)*str; + *buf = (char)CHAR(*str); clen = 1; memset(&mbs, 0, sizeof(mbs)); } - if (*buf == '\0') + if (CHAR(*str) == EOS) return (0); str++; buf += clen; From owner-svn-src-head@freebsd.org Sun Jul 17 11:43: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 BB848B9CF47; Sun, 17 Jul 2016 11:43:28 +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 7EFC21E15; Sun, 17 Jul 2016 11:43:28 +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 u6HBhRNg082115; Sun, 17 Jul 2016 11:43:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HBhRH6082114; Sun, 17 Jul 2016 11:43:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607171143.u6HBhRH6082114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 17 Jul 2016 11:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302945 - 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: Sun, 17 Jul 2016 11:43:28 -0000 Author: tuexen Date: Sun Jul 17 11:43:27 2016 New Revision: 302945 URL: https://svnweb.freebsd.org/changeset/base/302945 Log: Don't duplicate code for SCTP, just use the ones used for UDP and TCP. This fixes a bug with link local addresses. This will require and upcoming change in the kernel to bring SCTP to the same behaviour as UDP and 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 Sun Jul 17 11:25:24 2016 (r302944) +++ head/usr.bin/netstat/sctp.c Sun Jul 17 11:43:27 2016 (r302945) @@ -104,93 +104,14 @@ struct xraddr_entry { LIST_ENTRY(xraddr_entry) xraddr_entries; }; -/* - * Construct an Internet address representation. - * If numeric_addr has been supplied, give - * numeric value, otherwise try for symbolic name. - */ #ifdef INET -static char * -inetname(struct in_addr *inp) -{ - char *cp; - static char line[MAXHOSTNAMELEN]; - struct hostent *hp; - struct netent *np; - - cp = 0; - if (!numeric_addr && inp->s_addr != INADDR_ANY) { - int net = inet_netof(*inp); - int lna = inet_lnaof(*inp); - - if (lna == INADDR_ANY) { - np = getnetbyaddr(net, AF_INET); - if (np) - cp = np->n_name; - } - if (cp == NULL) { - hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET); - if (hp) { - cp = hp->h_name; - trimdomain(cp, strlen(cp)); - } - } - } - if (inp->s_addr == INADDR_ANY) - strcpy(line, "*"); - else if (cp) { - strlcpy(line, cp, sizeof(line)); - } else { - inp->s_addr = ntohl(inp->s_addr); -#define C(x) ((u_int)((x) & 0xff)) - sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), - C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); - inp->s_addr = htonl(inp->s_addr); - } - return (line); -} +char * +inetname(struct in_addr *inp); #endif #ifdef INET6 -static char ntop_buf[INET6_ADDRSTRLEN]; - -static char * -inet6name(struct in6_addr *in6p) -{ - char *cp; - static char line[50]; - struct hostent *hp; - static char domain[MAXHOSTNAMELEN]; - static int first = 1; - - if (first && !numeric_addr) { - first = 0; - if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (cp = strchr(domain, '.'))) - (void) strcpy(domain, cp + 1); - else - domain[0] = 0; - } - cp = 0; - if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) { - hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6); - if (hp) { - if ((cp = strchr(hp->h_name, '.')) && - !strcmp(cp + 1, domain)) - *cp = 0; - cp = hp->h_name; - } - } - if (IN6_IS_ADDR_UNSPECIFIED(in6p)) - strcpy(line, "*"); - else if (cp) - strcpy(line, cp); - else - sprintf(line, "%s", - inet_ntop(AF_INET6, (void *)in6p, ntop_buf, - sizeof(ntop_buf))); - return (line); -} +char * +inet6name(struct in6_addr *in6p); #endif static void From owner-svn-src-head@freebsd.org Sun Jul 17 12:31: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 5EA37B9A618; Sun, 17 Jul 2016 12:31: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 2B8861701; Sun, 17 Jul 2016 12:31: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 u6HCVVP9000706; Sun, 17 Jul 2016 12:31:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HCVVbb000705; Sun, 17 Jul 2016 12:31:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607171231.u6HCVVbb000705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Jul 2016 12:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302946 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 12:31:32 -0000 Author: mav Date: Sun Jul 17 12:31:31 2016 New Revision: 302946 URL: https://svnweb.freebsd.org/changeset/base/302946 Log: Do not consider the last interrupt shared if there are enough interrupts for all channels. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Jul 17 11:43:27 2016 (r302945) +++ head/sys/dev/ahci/ahci.c Sun Jul 17 12:31:31 2016 (r302946) @@ -416,7 +416,8 @@ ahci_setup_interrupt(device_t dev) else if (ctlr->numirqs == 1 || i >= ctlr->channels || (ctlr->ccc && i == ctlr->cccv)) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ALL; - else if (i == ctlr->numirqs - 1) + else if (ctlr->channels > ctlr->numirqs && + i == ctlr->numirqs - 1) ctlr->irqs[i].mode = AHCI_IRQ_MODE_AFTER; else ctlr->irqs[i].mode = AHCI_IRQ_MODE_ONE; From owner-svn-src-head@freebsd.org Sun Jul 17 12:45: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 2ADE7B9AAC2; Sun, 17 Jul 2016 12:45:59 +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 F11C51DB2; Sun, 17 Jul 2016 12:45:58 +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 u6HCjwe9004576; Sun, 17 Jul 2016 12:45:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HCjwGa004575; Sun, 17 Jul 2016 12:45:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607171245.u6HCjwGa004575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Jul 2016 12:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302947 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 12:45:59 -0000 Author: mav Date: Sun Jul 17 12:45:58 2016 New Revision: 302947 URL: https://svnweb.freebsd.org/changeset/base/302947 Log: In AHCI_IRQ_MODE_AFTER mode do not clear interrupts below. This is probably a NOP change since IS register is not activery used for interrupts below the shared, but it looked odd to clear interrupts we did not handle. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Jul 17 12:31:31 2016 (r302946) +++ head/sys/dev/ahci/ahci.c Sun Jul 17 12:45:58 2016 (r302947) @@ -466,6 +466,7 @@ ahci_intr(void *data) } else { /* AHCI_IRQ_MODE_AFTER */ unit = irq->r_irq_rid - 1; is = ATA_INL(ctlr->r_mem, AHCI_IS); + is &= (0xffffffff << unit); } /* CCC interrupt is edge triggered. */ if (ctlr->ccc) From owner-svn-src-head@freebsd.org Sun Jul 17 13:10: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 1BAA3B9C0FB; Sun, 17 Jul 2016 13:10:59 +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 D8F2B18A6; Sun, 17 Jul 2016 13:10:58 +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 u6HDAwNA012606; Sun, 17 Jul 2016 13:10:58 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HDAw0E012605; Sun, 17 Jul 2016 13:10:58 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607171310.u6HDAw0E012605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 17 Jul 2016 13:10:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302948 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 13:10:59 -0000 Author: ache Date: Sun Jul 17 13:10:57 2016 New Revision: 302948 URL: https://svnweb.freebsd.org/changeset/base/302948 Log: Reflect pathnames sorting in collation order. Modified: head/lib/libc/gen/glob.3 Modified: head/lib/libc/gen/glob.3 ============================================================================== --- head/lib/libc/gen/glob.3 Sun Jul 17 12:45:58 2016 (r302947) +++ head/lib/libc/gen/glob.3 Sun Jul 17 13:10:57 2016 (r302948) @@ -194,7 +194,7 @@ If is set, backslash escaping is disabled. .It Dv GLOB_NOSORT By default, the pathnames are sorted in ascending -.Tn ASCII +collation order; this flag prevents that sorting (speeding up .Fn glob ) . From owner-svn-src-head@freebsd.org Sun Jul 17 13:14: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 65DBDB9C22C; Sun, 17 Jul 2016 13:14:53 +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 237521C4C; Sun, 17 Jul 2016 13:14:53 +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 u6HDEqf3015352; Sun, 17 Jul 2016 13:14:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HDEpbx015348; Sun, 17 Jul 2016 13:14:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607171314.u6HDEpbx015348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 17 Jul 2016 13:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302949 - 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: Sun, 17 Jul 2016 13:14:53 -0000 Author: tuexen Date: Sun Jul 17 13:14:51 2016 New Revision: 302949 URL: https://svnweb.freebsd.org/changeset/base/302949 Log: Fix the PR-SCTP behaviour. This is done by rrs@. MFC after: 3 days Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_constants.h Sun Jul 17 13:14:51 2016 (r302949) @@ -345,6 +345,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTT_FROM_NON_DATA 0 #define SCTP_RTT_FROM_DATA 1 +#define PR_SCTP_UNORDERED_FLAG 0x0001 /* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ #define SCTP_FIRST_MBUF_RESV 68 Modified: head/sys/netinet/sctp_header.h ============================================================================== --- head/sys/netinet/sctp_header.h Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_header.h Sun Jul 17 13:14:51 2016 (r302949) @@ -397,7 +397,7 @@ struct sctp_strseq { struct sctp_strseq_mid { uint16_t stream; - uint16_t reserved; + uint16_t flags; uint32_t msg_id; }; Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_indata.c Sun Jul 17 13:14:51 2016 (r302949) @@ -5283,10 +5283,11 @@ sctp_kick_prsctp_reorder_queue(struct sc } } + static void sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, struct sctp_association *asoc, - uint16_t stream, uint32_t seq) + uint16_t stream, uint32_t seq, int ordered, int old) { struct sctp_queued_to_read *control; struct sctp_stream_in *strm; @@ -5301,7 +5302,7 @@ sctp_flush_reassm_for_str_seq(struct sct * queue. */ strm = &asoc->strmin[stream]; - control = find_reasm_entry(strm, (uint32_t) seq, 0, 0); + control = find_reasm_entry(strm, (uint32_t) seq, ordered, old); if (control == NULL) { /* Not found */ return; @@ -5433,6 +5434,7 @@ sctp_handle_forward_tsn(struct sctp_tcb unsigned int num_str; uint32_t sequence; uint16_t stream; + uint16_t ordered, flags; int old; struct sctp_strseq *stseq, strseqbuf; struct sctp_strseq_mid *stseq_m, strseqbuf_m; @@ -5458,6 +5460,12 @@ sctp_handle_forward_tsn(struct sctp_tcb } stream = ntohs(stseq_m->stream); sequence = ntohl(stseq_m->msg_id); + flags = ntohs(stseq_m->flags); + if (flags & PR_SCTP_UNORDERED_FLAG) { + ordered = 0; + } else { + ordered = 1; + } } else { stseq = (struct sctp_strseq *)sctp_m_getptr(m, offset, sizeof(struct sctp_strseq), @@ -5468,6 +5476,7 @@ sctp_handle_forward_tsn(struct sctp_tcb } stream = ntohs(stseq->stream); sequence = (uint32_t) ntohs(stseq->sequence); + ordered = 1; } /* Convert */ @@ -5493,7 +5502,7 @@ sctp_handle_forward_tsn(struct sctp_tcb asoc->fragmented_delivery_inprogress = 0; } strm = &asoc->strmin[stream]; - sctp_flush_reassm_for_str_seq(stcb, asoc, stream, sequence); + sctp_flush_reassm_for_str_seq(stcb, asoc, stream, sequence, ordered, old); TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { if ((ctl->sinfo_stream == stream) && (ctl->sinfo_ssn == sequence)) { Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Jul 17 13:10:57 2016 (r302948) +++ head/sys/netinet/sctp_output.c Sun Jul 17 13:14:51 2016 (r302949) @@ -10383,7 +10383,7 @@ sctp_fill_in_rest: /* no more to look at */ break; } - if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { + if ((at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) && old) { /* We don't report these */ continue; } @@ -10504,7 +10504,7 @@ sctp_fill_in_rest: tp1 = TAILQ_NEXT(at, sctp_next); if (tp1 == NULL) break; - if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) { + if (old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) { /* We don't report these */ i--; at = tp1; @@ -10519,8 +10519,11 @@ sctp_fill_in_rest: strseq++; } else { strseq_m->stream = ntohs(at->rec.data.stream_number); - strseq_m->reserved = ntohs(0); strseq_m->msg_id = ntohl(at->rec.data.stream_seq); + if (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) + strseq_m->flags = ntohs(PR_SCTP_UNORDERED_FLAG); + else + strseq_m->flags = 0; strseq_m++; } at = tp1; From owner-svn-src-head@freebsd.org Sun Jul 17 13:33: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 B05A7B9CA23; Sun, 17 Jul 2016 13:33: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 75C3B1848; Sun, 17 Jul 2016 13:33:36 +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 u6HDXZH1022643; Sun, 17 Jul 2016 13:33:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HDXZcP022642; Sun, 17 Jul 2016 13:33:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607171333.u6HDXZcP022642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 17 Jul 2016 13:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302950 - 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: Sun, 17 Jul 2016 13:33:36 -0000 Author: tuexen Date: Sun Jul 17 13:33:35 2016 New Revision: 302950 URL: https://svnweb.freebsd.org/changeset/base/302950 Log: Add a constant required by RFC 7496. MFC after: 3 days Modified: head/sys/netinet/sctp_uio.h Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Sun Jul 17 13:14:51 2016 (r302949) +++ head/sys/netinet/sctp_uio.h Sun Jul 17 13:33:35 2016 (r302950) @@ -259,7 +259,8 @@ struct sctp_snd_all_completes { /* The lower four bits is an enumeration of PR-SCTP policies */ #define SCTP_PR_SCTP_NONE 0x0000/* Reliable transfer */ #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */ -#define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_PRIO 0x0002/* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_BUF SCTP_PR_SCTP_PRIO /* For backwards compatibility */ #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */ #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_RTX #define SCTP_PR_SCTP_ALL 0x000f/* Used for aggregated stats */ From owner-svn-src-head@freebsd.org Sun Jul 17 13:43: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 2351BB9CBB3; Sun, 17 Jul 2016 13:43:02 +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 F1A0E1CA1; Sun, 17 Jul 2016 13:43:01 +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 u6HDh15W026196; Sun, 17 Jul 2016 13:43:01 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HDh1dM026194; Sun, 17 Jul 2016 13:43:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201607171343.u6HDh1dM026194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 17 Jul 2016 13:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302951 - 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: Sun, 17 Jul 2016 13:43:02 -0000 Author: mmel Date: Sun Jul 17 13:43:00 2016 New Revision: 302951 URL: https://svnweb.freebsd.org/changeset/base/302951 Log: OFWPCI: Improve resource handling. - add new rman for prefetchable memory. Is used only if given 'ranges' property contains prefetchable memory range. - not all ranges in 'ranges' property are subject for rman's filling. Tegra for example, have two addition records which are used for 'pci 'register' -> 'assigned-address' -> 'ranges' machinery. Add sc_ranges_mask for masking not rman related ranges. - consistently pass unknown (not managed at this level) resources allocation/release/adjust requests to parent. MFC after: 3 weeks Modified: head/sys/dev/ofw/ofwpci.c head/sys/dev/ofw/ofwpci.h Modified: head/sys/dev/ofw/ofwpci.c ============================================================================== --- head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:33:35 2016 (r302950) +++ head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:00 2016 (r302951) @@ -94,6 +94,7 @@ static phandle_t ofw_pci_get_node(device * local methods */ static int ofw_pci_fill_ranges(phandle_t, struct ofw_pci_range *); +static struct rman *ofw_pci_get_rman(struct ofw_pci_softc *, int, u_int); /* * Driver methods. @@ -137,7 +138,7 @@ ofw_pci_init(device_t dev) phandle_t node; u_int32_t busrange[2]; struct ofw_pci_range *rp; - int error; + int i, error; struct ofw_pci_cell_info *cell_info; node = ofw_bus_get_node(dev); @@ -201,17 +202,27 @@ ofw_pci_init(device_t dev) } sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "PCI Memory"; + sc->sc_mem_rman.rm_descr = "PCI Non Prefetchable Memory"; error = rman_init(&sc->sc_mem_rman); if (error != 0) { device_printf(dev, "rman_init() failed. error = %d\n", error); goto out; } - for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && - rp->pci_hi != 0; rp++) { + sc->sc_pmem_rman.rm_type = RMAN_ARRAY; + sc->sc_pmem_rman.rm_descr = "PCI Prefetchable Memory"; + error = rman_init(&sc->sc_pmem_rman); + if (error != 0) { + device_printf(dev, "rman_init() failed. error = %d\n", error); + goto out; + } + + for (i = 0; i < sc->sc_nrange; i++) { error = 0; + rp = sc->sc_range + i; + if (sc->sc_range_mask & ((uint64_t)1 << i)) + continue; switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; @@ -221,8 +232,14 @@ ofw_pci_init(device_t dev) break; case OFW_PCI_PHYS_HI_SPACE_MEM32: case OFW_PCI_PHYS_HI_SPACE_MEM64: - error = rman_manage_region(&sc->sc_mem_rman, rp->pci, - rp->pci + rp->size - 1); + if (rp->pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + sc->sc_have_pmem = 1; + error = rman_manage_region(&sc->sc_pmem_rman, + rp->pci, rp->pci + rp->size - 1); + } else { + error = rman_manage_region(&sc->sc_mem_rman, + rp->pci, rp->pci + rp->size - 1); + } break; } @@ -244,6 +261,7 @@ out: free(sc->sc_range, M_DEVBUF); rman_fini(&sc->sc_io_rman); rman_fini(&sc->sc_mem_rman); + rman_fini(&sc->sc_pmem_rman); return (error); } @@ -385,28 +403,16 @@ ofw_pci_alloc_resource(device_t bus, dev struct rman *rm; int needactivate; + needactivate = flags & RF_ACTIVE; flags &= ~RF_ACTIVE; sc = device_get_softc(bus); - switch (type) { - case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; - break; - - case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; - break; - - case SYS_RES_IRQ: - return (bus_alloc_resource(bus, type, rid, start, end, count, - flags)); - - default: - device_printf(bus, "unknown resource request from %s\n", - device_get_nameunit(child)); - return (NULL); + rm = ofw_pci_get_rman(sc, type, flags); + if (rm == NULL) { + return (bus_generic_alloc_resource(bus, child, type, rid, + start, end, count, flags)); } rv = rman_reserve_resource(rm, start, end, count, flags, child); @@ -435,15 +441,24 @@ static int ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + struct ofw_pci_softc *sc; + struct rman *rm; + int error; - if (rman_get_flags(res) & RF_ACTIVE) { - int error; + sc = device_get_softc(bus); + + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + if (rm == NULL) { + return (bus_generic_release_resource(bus, child, type, rid, + res)); + } + KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); + if (rman_get_flags(res) & RF_ACTIVE) { error = bus_deactivate_resource(child, type, rid, res); if (error != 0) return (error); } - return (rman_release_resource(res)); } @@ -454,63 +469,62 @@ ofw_pci_activate_resource(device_t bus, struct ofw_pci_softc *sc; bus_space_handle_t handle; bus_space_tag_t tag; + struct ofw_pci_range *rp; + vm_paddr_t start; + int space; int rv; sc = device_get_softc(bus); - if (type == SYS_RES_IRQ) { - return (bus_activate_resource(bus, type, rid, res)); + if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) { + return (bus_generic_activate_resource(bus, child, type, rid, + res)); } - if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - struct ofw_pci_range *rp; - vm_paddr_t start; - int space; - - start = (vm_paddr_t)rman_get_start(res); - - /* - * Map this through the ranges list - */ - for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && - rp->pci_hi != 0; rp++) { - if (start < rp->pci || start >= rp->pci + rp->size) - continue; - - switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { - case OFW_PCI_PHYS_HI_SPACE_IO: - space = SYS_RES_IOPORT; - break; - case OFW_PCI_PHYS_HI_SPACE_MEM32: - case OFW_PCI_PHYS_HI_SPACE_MEM64: - space = SYS_RES_MEMORY; - break; - default: - space = -1; - } - if (type == space) { - start += (rp->host - rp->pci); - break; + start = (vm_paddr_t)rman_get_start(res); + + /* + * Map this through the ranges list + */ + for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && + rp->pci_hi != 0; rp++) { + if (start < rp->pci || start >= rp->pci + rp->size) + continue; + + switch (rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) { + case OFW_PCI_PHYS_HI_SPACE_IO: + space = SYS_RES_IOPORT; + break; + case OFW_PCI_PHYS_HI_SPACE_MEM32: + case OFW_PCI_PHYS_HI_SPACE_MEM64: + space = SYS_RES_MEMORY; + break; + default: + space = -1; } + + if (type == space) { + start += (rp->host - rp->pci); + break; } + } - if (bootverbose) - printf("ofw_pci mapdev: start %jx, len %jd\n", - (rman_res_t)start, rman_get_size(res)); - - tag = BUS_GET_BUS_TAG(child, child); - if (tag == NULL) - return (ENOMEM); - - rman_set_bustag(res, tag); - rv = bus_space_map(tag, start, - rman_get_size(res), 0, &handle); - if (rv != 0) - return (ENOMEM); + if (bootverbose) + printf("ofw_pci mapdev: start %jx, len %jd\n", + (rman_res_t)start, rman_get_size(res)); + + tag = BUS_GET_BUS_TAG(child, child); + if (tag == NULL) + return (ENOMEM); + + rman_set_bustag(res, tag); + rv = bus_space_map(tag, start, + rman_get_size(res), 0, &handle); + if (rv != 0) + return (ENOMEM); - rman_set_bushandle(res, handle); - rman_set_virtual(res, (void *)handle); /* XXX for powerpc only ? */ - } + rman_set_bushandle(res, handle); + rman_set_virtual(res, (void *)handle); /* XXX for powerpc only ? */ return (rman_activate_resource(res)); } @@ -528,17 +542,19 @@ static int ofw_pci_deactivate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + struct ofw_pci_softc *sc; + vm_size_t psize; - /* - * If this is a memory resource, unmap it. - */ - if ((type == SYS_RES_MEMORY) || (type == SYS_RES_IOPORT)) { - u_int32_t psize; + sc = device_get_softc(bus); - psize = rman_get_size(res); - pmap_unmapdev((vm_offset_t)rman_get_virtual(res), psize); + if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) { + return (bus_generic_deactivate_resource(bus, child, type, rid, + res)); } + psize = rman_get_size(res); + pmap_unmapdev((vm_offset_t)rman_get_virtual(res), psize); + return (rman_deactivate_resource(res)); } @@ -550,24 +566,15 @@ ofw_pci_adjust_resource(device_t bus, de 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) - return (EINVAL); - switch (type) { - case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; - break; - default: - return (ENXIO); + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); + if (rm == NULL) { + return (bus_generic_adjust_resource(bus, child, type, res, + start, end)); } - - if (!rman_is_region_manager(res, rm)) - return (EINVAL); + KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); + KASSERT(!(rman_get_flags(res) & RF_ACTIVE), + ("active resources cannot be adjusted")); return (rman_adjust_resource(res, start, end)); } @@ -629,3 +636,22 @@ ofw_pci_fill_ranges(phandle_t node, stru free(base_ranges, M_DEVBUF); return (nranges); } + +static struct rman * +ofw_pci_get_rman(struct ofw_pci_softc *sc, int type, u_int flags) +{ + + switch (type) { + case SYS_RES_IOPORT: + return (&sc->sc_io_rman); + case SYS_RES_MEMORY: + if (sc->sc_have_pmem && (flags & RF_PREFETCHABLE)) + return (&sc->sc_pmem_rman); + else + return (&sc->sc_mem_rman); + default: + break; + } + + return (NULL); +} Modified: head/sys/dev/ofw/ofwpci.h ============================================================================== --- head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:33:35 2016 (r302950) +++ head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:43:00 2016 (r302951) @@ -60,13 +60,16 @@ struct ofw_pci_softc { int sc_bus; int sc_initialized; int sc_quirks; + int sc_have_pmem; struct ofw_pci_range *sc_range; int sc_nrange; + uint64_t sc_range_mask; struct ofw_pci_cell_info *sc_cell_info; struct rman sc_io_rman; struct rman sc_mem_rman; + struct rman sc_pmem_rman; bus_space_tag_t sc_memt; bus_dma_tag_t sc_dmat; From owner-svn-src-head@freebsd.org Sun Jul 17 13:43: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 34382B9CC07; Sun, 17 Jul 2016 13:43:48 +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 E14571E07; Sun, 17 Jul 2016 13:43:47 +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 u6HDhlDr026262; Sun, 17 Jul 2016 13:43:47 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HDhluv026260; Sun, 17 Jul 2016 13:43:47 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201607171343.u6HDhluv026260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 17 Jul 2016 13:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302952 - 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: Sun, 17 Jul 2016 13:43:48 -0000 Author: mmel Date: Sun Jul 17 13:43:46 2016 New Revision: 302952 URL: https://svnweb.freebsd.org/changeset/base/302952 Log: OFWPCI: Add support for NEW_PCIB. MFC after: 3 weeks Modified: head/sys/dev/ofw/ofwpci.c head/sys/dev/ofw/ofwpci.h Modified: head/sys/dev/ofw/ofwpci.c ============================================================================== --- head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:00 2016 (r302951) +++ head/sys/dev/ofw/ofwpci.c Sun Jul 17 13:43:46 2016 (r302952) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -145,6 +146,7 @@ ofw_pci_init(device_t dev) sc = device_get_softc(dev); sc->sc_initialized = 1; sc->sc_range = NULL; + sc->sc_pci_domain = device_get_unit(dev); cell_info = (struct ofw_pci_cell_info *)malloc(sizeof(*cell_info), M_DEVBUF, M_WAITOK | M_ZERO); @@ -336,7 +338,7 @@ ofw_pci_read_ivar(device_t dev, device_t switch (which) { case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); + *result = sc->sc_pci_domain; return (0); case PCIB_IVAR_BUS: *result = sc->sc_bus; @@ -409,6 +411,13 @@ ofw_pci_alloc_resource(device_t bus, dev sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) { + return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, + start, end, count, flags)); + } +#endif + rm = ofw_pci_get_rman(sc, type, flags); if (rm == NULL) { return (bus_generic_alloc_resource(bus, child, type, rid, @@ -447,6 +456,12 @@ ofw_pci_release_resource(device_t bus, d sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, + res)); +#endif + rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { return (bus_generic_release_resource(bus, child, type, rid, @@ -566,6 +581,11 @@ ofw_pci_adjust_resource(device_t bus, de struct ofw_pci_softc *sc; sc = device_get_softc(bus); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, + start, end)); +#endif rm = ofw_pci_get_rman(sc, type, rman_get_flags(res)); if (rm == NULL) { Modified: head/sys/dev/ofw/ofwpci.h ============================================================================== --- head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:43:00 2016 (r302951) +++ head/sys/dev/ofw/ofwpci.h Sun Jul 17 13:43:46 2016 (r302952) @@ -72,6 +72,7 @@ struct ofw_pci_softc { struct rman sc_pmem_rman; bus_space_tag_t sc_memt; bus_dma_tag_t sc_dmat; + int sc_pci_domain; struct ofw_bus_iinfo sc_pci_iinfo; }; From owner-svn-src-head@freebsd.org Sun Jul 17 14:13: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 7FE5FB9C1A1; Sun, 17 Jul 2016 14:13:48 +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 4FC151EE8; Sun, 17 Jul 2016 14:13:48 +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 u6HEDlJ5037260; Sun, 17 Jul 2016 14:13:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HEDluC037259; Sun, 17 Jul 2016 14:13:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607171413.u6HEDluC037259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Jul 2016 14:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302957 - 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: Sun, 17 Jul 2016 14:13:48 -0000 Author: mav Date: Sun Jul 17 14:13:47 2016 New Revision: 302957 URL: https://svnweb.freebsd.org/changeset/base/302957 Log: Fix NCQ TRIM emulation. When this code was written, there was no guests using it to test. Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Sun Jul 17 14:12:34 2016 (r302956) +++ head/usr.sbin/bhyve/pci_ahci.c Sun Jul 17 14:13:47 2016 (r302957) @@ -837,7 +837,15 @@ next: done += 8; if (elen == 0) { if (done >= len) { - ahci_write_fis_d2h(p, slot, cfis, ATA_S_READY | ATA_S_DSC); + if (ncq) { + if (first) + ahci_write_fis_d2h_ncq(p, slot); + ahci_write_fis_sdb(p, slot, cfis, + ATA_S_READY | ATA_S_DSC); + } else { + ahci_write_fis_d2h(p, slot, cfis, + ATA_S_READY | ATA_S_DSC); + } p->pending &= ~(1 << slot); ahci_check_stopped(p); if (!first) @@ -1718,7 +1726,7 @@ ahci_handle_cmd(struct ahci_port *p, int case ATA_SEND_FPDMA_QUEUED: if ((cfis[13] & 0x1f) == ATA_SFPDMA_DSM && cfis[17] == 0 && cfis[16] == ATA_DSM_TRIM && - cfis[11] == 0 && cfis[13] == 1) { + cfis[11] == 0 && cfis[3] == 1) { ahci_handle_dsm_trim(p, slot, cfis, 0); break; } From owner-svn-src-head@freebsd.org Sun Jul 17 14:17: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 45747B9C2EA; Sun, 17 Jul 2016 14:17:59 +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 17BE11519; Sun, 17 Jul 2016 14:17:59 +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 u6HEHwwb037586; Sun, 17 Jul 2016 14:17:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HEHwWH037585; Sun, 17 Jul 2016 14:17:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607171417.u6HEHwWH037585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Jul 2016 14:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302960 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 14:17:59 -0000 Author: mav Date: Sun Jul 17 14:17:58 2016 New Revision: 302960 URL: https://svnweb.freebsd.org/changeset/base/302960 Log: Restore PIM_ATA_EXT flag handling, lost at r300207. This re-enables NCQ TRIM usage on capable hardware (bhyve). Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Jul 17 14:16:21 2016 (r302959) +++ head/sys/cam/ata/ata_da.c Sun Jul 17 14:17:58 2016 (r302960) @@ -1774,6 +1774,8 @@ adaregister(struct cam_periph *periph, v softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; softc->unmappedio = 1; } + if (cpi.hba_misc & PIM_ATA_EXT) + softc->flags |= ADA_FLAG_PIM_ATA_EXT; strlcpy(softc->disk->d_descr, cgd->ident_data.model, MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); strlcpy(softc->disk->d_ident, cgd->ident_data.serial, From owner-svn-src-head@freebsd.org Sun Jul 17 14:45: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 55DA3B9C9EA; Sun, 17 Jul 2016 14:45:16 +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 223641596; Sun, 17 Jul 2016 14:45:16 +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 u6HEjFI2048900; Sun, 17 Jul 2016 14:45:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HEjF1R048899; Sun, 17 Jul 2016 14:45:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201607171445.u6HEjF1R048899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 17 Jul 2016 14:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302961 - head/sys/arm/nvidia X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 14:45:16 -0000 Author: mmel Date: Sun Jul 17 14:45:15 2016 New Revision: 302961 URL: https://svnweb.freebsd.org/changeset/base/302961 Log: TEGRA: Subclass Tegra PCIE driver from ofw_pci base driver. Remove now redundant code. Modified: head/sys/arm/nvidia/tegra_pcie.c Modified: head/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- head/sys/arm/nvidia/tegra_pcie.c Sun Jul 17 14:17:58 2016 (r302960) +++ head/sys/arm/nvidia/tegra_pcie.c Sun Jul 17 14:45:15 2016 (r302961) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,100 +65,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include "ofw_bus_if.h" -#include "pcib_if.h" - #include -/* --- Move to ofw_pci.c/.h ----------------------- */ - -struct tegra_pci_range { - /* parsed phys.hi */ - int nonrelocatable; - int prefetchable; - int aliased; - int space_code; /* In native format (not shifted)*/ - int bus; - int device; - int function; - int reg; - pci_addr_t pci_addr; /* PCI Address */ - bus_addr_t host_addr; /* Host bus address*/ - bus_size_t size; /* Range size */ -}; - -static int -tegra_pci_get_ranges(phandle_t node, struct tegra_pci_range **ranges) -{ - int host_address_cells, pci_address_cells, size_cells; - cell_t *base_ranges; - ssize_t nbase_ranges; - int nranges; - int i, j, k; - uint32_t flags; - uint64_t tmp; - - host_address_cells = 1; - pci_address_cells = 3; - size_cells = 2; - OF_getencprop(OF_parent(node), "#address-cells", &host_address_cells, - sizeof(host_address_cells)); - OF_getencprop(node, "#address-cells", &pci_address_cells, - sizeof(pci_address_cells)); - OF_getencprop(node, "#size-cells", &size_cells, sizeof(size_cells)); - - nbase_ranges = OF_getproplen(node, "ranges"); - if (nbase_ranges <= 0) - return (-1); - nranges = nbase_ranges / sizeof(cell_t) / - (pci_address_cells + host_address_cells + size_cells); - - *ranges = malloc(nranges * sizeof(struct tegra_pci_range), - M_DEVBUF, M_WAITOK); - base_ranges = malloc(nbase_ranges, M_DEVBUF, M_WAITOK); - OF_getencprop(node, "ranges", base_ranges, nbase_ranges); - - for (i = 0, j = 0; i < nranges; i++) { - flags = base_ranges[j++]; - (*ranges)[i].nonrelocatable = - flags & OFW_PCI_PHYS_HI_NONRELOCATABLE ? 1 : 0; - (*ranges)[i].prefetchable = - flags & OFW_PCI_PHYS_HI_PREFETCHABLE ? 1 : 0; - (*ranges)[i].aliased = - flags & OFW_PCI_PHYS_HI_ALIASED ? 1 : 0; - (*ranges)[i].space_code = flags & OFW_PCI_PHYS_HI_SPACEMASK; - (*ranges)[i].bus = OFW_PCI_PHYS_HI_BUS(flags); - (*ranges)[i].device = OFW_PCI_PHYS_HI_DEVICE(flags); - (*ranges)[i].function = OFW_PCI_PHYS_HI_FUNCTION(flags); - (*ranges)[i].reg = flags & OFW_PCI_PHYS_HI_REGISTERMASK; - - tmp = 0; - for (k = 0; k < pci_address_cells - 1; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].pci_addr = (pci_addr_t)tmp; - - tmp = 0; - for (k = 0; k < host_address_cells; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].host_addr = (bus_addr_t)tmp; - tmp = 0; +#include "ofw_bus_if.h" +#include "pcib_if.h" - for (k = 0; k < size_cells; k++) { - tmp <<= 32; - tmp |= base_ranges[j++]; - } - (*ranges)[i].size = (bus_size_t)tmp; - } - free(base_ranges, M_DEVBUF); - return (nranges); -} -/* -------------------------------------------------------------------------- */ #define AFI_AXI_BAR0_SZ 0x000 #define AFI_AXI_BAR1_SZ 0x004 #define AFI_AXI_BAR2_SZ 0x008 @@ -358,12 +272,9 @@ struct tegra_pcib_port { #define TEGRA_PCIB_MAX_PORTS 3 struct tegra_pcib_softc { + struct ofw_pci_softc ofw_pci; device_t dev; struct mtx mtx; - struct ofw_bus_iinfo pci_iinfo; - struct rman pref_mem_rman; - struct rman mem_rman; - struct rman io_rman; struct resource *pads_mem_res; struct resource *afi_mem_res; struct resource *cfg_mem_res; @@ -372,18 +283,18 @@ struct tegra_pcib_softc { void *intr_cookie; void *msi_intr_cookie; - struct tegra_pci_range mem_range; - struct tegra_pci_range pref_mem_range; - struct tegra_pci_range io_range; + struct ofw_pci_range mem_range; + struct ofw_pci_range pref_mem_range; + struct ofw_pci_range io_range; phy_t phy; clk_t clk_pex; clk_t clk_afi; clk_t clk_pll_e; clk_t clk_cml; - hwreset_t hwreset_pex; - hwreset_t hwreset_afi; - hwreset_t hwreset_pcie_x; + hwreset_t hwreset_pex; + hwreset_t hwreset_afi; + hwreset_t hwreset_pcie_x; regulator_t supply_avddio_pex; regulator_t supply_dvddio_pex; regulator_t supply_avdd_pex_pll; @@ -392,7 +303,6 @@ struct tegra_pcib_softc { regulator_t supply_vddio_pex_ctl; regulator_t supply_avdd_pll_erefe; - int busnr; /* host bridge bus number */ uint32_t msi_bitmap; bus_addr_t cfg_base_addr; /* base address of config */ bus_size_t cfg_cur_offs; /* currently mapped window */ @@ -403,255 +313,6 @@ struct tegra_pcib_softc { struct tegra_pcib_port *ports[TEGRA_PCIB_MAX_PORTS]; }; -/* ------------------------------------------------------------------------- */ -/* - * Resource manager - */ -static int -tegra_pcib_rman_init(struct tegra_pcib_softc *sc) -{ - int err; - char buf[64]; - - /* Memory management. */ - sc->pref_mem_rman.rm_type = RMAN_ARRAY; - snprintf(buf, sizeof(buf), "%s prefetchable memory space", - device_get_nameunit(sc->dev)); - sc->pref_mem_rman.rm_descr = strdup(buf, M_DEVBUF); - err = rman_init(&sc->pref_mem_rman); - if (err) - return (err); - - sc->mem_rman.rm_type = RMAN_ARRAY; - snprintf(buf, sizeof(buf), "%s non prefetchable memory space", - device_get_nameunit(sc->dev)); - sc->mem_rman.rm_descr = strdup(buf, M_DEVBUF); - err = rman_init(&sc->mem_rman); - if (err) - return (err); - - sc->io_rman.rm_type = RMAN_ARRAY; - snprintf(buf, sizeof(buf), "%s I/O space", - device_get_nameunit(sc->dev)); - sc->io_rman.rm_descr = strdup(buf, M_DEVBUF); - err = rman_init(&sc->io_rman); - if (err) { - rman_fini(&sc->mem_rman); - return (err); - } - - err = rman_manage_region(&sc->pref_mem_rman, - sc->pref_mem_range.host_addr, - sc->pref_mem_range.host_addr + sc->pref_mem_range.size - 1); - if (err) - goto error; - err = rman_manage_region(&sc->mem_rman, - sc->mem_range.host_addr, - sc->mem_range.host_addr + sc->mem_range.size - 1); - if (err) - goto error; - err = rman_manage_region(&sc->io_rman, - sc->io_range.pci_addr, - sc->io_range.pci_addr + sc->io_range.size - 1); - if (err) - goto error; - return (0); - -error: - rman_fini(&sc->pref_mem_rman); - rman_fini(&sc->mem_rman); - rman_fini(&sc->io_rman); - return (err); -} - -static struct rman * -tegra_pcib_rman(struct tegra_pcib_softc *sc, int type, u_int flags) -{ - - switch (type) { - case SYS_RES_IOPORT: - return (&sc->io_rman); - case SYS_RES_MEMORY: - if (flags & RF_PREFETCHABLE) - return (&sc->pref_mem_rman); - else - return (&sc->mem_rman); - default: - break; - } - - return (NULL); -} - -static struct resource * -tegra_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - struct tegra_pcib_softc *sc; - struct rman *rm; - struct resource *res; - - debugf("%s: enter %d start %#jx end %#jx count %#jx\n", __func__, - type, start, end, count); - sc = device_get_softc(dev); - -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) - if (type == PCI_RES_BUS) { - return (pci_domain_alloc_bus(0, child, rid, start, end, count, - flags)); - } -#endif - - rm = tegra_pcib_rman(sc, type, flags); - - if (rm == NULL) { - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - type, rid, start, end, count, flags); - - return (res); - } - - if (bootverbose) { - device_printf(dev, - "rman_reserve_resource: start=%#jx, end=%#jx, count=%#jx\n", - start, end, count); - } - - res = rman_reserve_resource(rm, start, end, count, flags, child); - if (res == NULL) - goto fail; - rman_set_rid(res, *rid); - if (flags & RF_ACTIVE) { - if (bus_activate_resource(child, type, *rid, res)) { - rman_release_resource(res); - goto fail; - } - } - return (res); - -fail: - if (bootverbose) { - device_printf(dev, "%s FAIL: type=%d, rid=%d, " - "start=%016jx, end=%016jx, count=%016jx, flags=%x\n", - __func__, type, *rid, start, end, count, flags); - } - - return (NULL); -} - -static int -tegra_pcib_release_resource(device_t dev, device_t child, int type, int rid, - struct resource *res) -{ - struct tegra_pcib_softc *sc; - struct rman *rm; - - sc = device_get_softc(dev); - debugf("%s: %d rid %x\n", __func__, type, rid); - -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) - if (type == PCI_RES_BUS) - return (pci_domain_release_bus(0, child, rid, res)); -#endif - - rm = tegra_pcib_rman(sc, type, rman_get_flags(res)); - if (rm != NULL) { - KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); - rman_release_resource(res); - } - - return (bus_generic_release_resource(dev, child, type, rid, res)); -} - -static int -tegra_pcib_adjust_resource(device_t dev, device_t child, int type, - struct resource *res, rman_res_t start, rman_res_t end) -{ - struct tegra_pcib_softc *sc; - struct rman *rm; - - sc = device_get_softc(dev); - debugf("%s: %d start %jx end %jx \n", __func__, type, start, end); - -#if defined(NEW_PCIB) && defined(PCI_RES_BUS) - if (type == PCI_RES_BUS) - return (pci_domain_adjust_bus(0, child, res, start, end)); -#endif - - rm = tegra_pcib_rman(sc, type, rman_get_flags(res)); - if (rm != NULL) - return (rman_adjust_resource(res, start, end)); - return (bus_generic_adjust_resource(dev, child, type, res, start, end)); -} -extern bus_space_tag_t fdtbus_bs_tag; -static int -tegra_pcib_pcie_activate_resource(device_t dev, device_t child, int type, - int rid, struct resource *r) -{ - struct tegra_pcib_softc *sc; - vm_offset_t start; - void *p; - int rv; - - sc = device_get_softc(dev); - rv = rman_activate_resource(r); - if (rv != 0) - return (rv); - switch(type) { - case SYS_RES_IOPORT: - start = rman_get_start(r) + sc->io_range.host_addr; - break; - default: - start = rman_get_start(r); - rman_get_start(r); - break; - } - - if (bootverbose) - printf("%s: start %zx, len %jd\n", __func__, start, - rman_get_size(r)); - - p = pmap_mapdev(start, (vm_size_t)rman_get_size(r)); - rman_set_virtual(r, p); - rman_set_bustag(r, fdtbus_bs_tag); - rman_set_bushandle(r, (u_long)p); - return (0); -} - -/* ------------------------------------------------------------------------- */ -/* - * IVARs - */ -static int -tegra_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct tegra_pcib_softc *sc = device_get_softc(dev); - - switch (which) { - case PCIB_IVAR_BUS: - *result = sc->busnr; - return (0); - case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); - return (0); - } - - return (ENOENT); -} - -static int -tegra_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) -{ - struct tegra_pcib_softc *sc = device_get_softc(dev); - - switch (which) { - case PCIB_IVAR_BUS: - sc->busnr = value; - return (0); - } - - return (ENOENT); -} static int tegra_pcib_maxslots(device_t dev) @@ -659,7 +320,6 @@ tegra_pcib_maxslots(device_t dev) return (16); } - static int tegra_pcib_route_interrupt(device_t bus, device_t dev, int pin) { @@ -947,7 +607,6 @@ tegra_pcib_enable_fdt_resources(struct t "Cannot enable 'avdd-pex-pll' regulator\n"); return (rv); } - rv = regulator_enable(sc->supply_hvdd_pex); if (rv != 0) { device_printf(sc->dev, @@ -991,13 +650,11 @@ tegra_pcib_enable_fdt_resources(struct t device_printf(sc->dev, "Cannot enable 'afi' clock\n"); return (rv); } - rv = clk_enable(sc->clk_cml); if (rv != 0) { device_printf(sc->dev, "Cannot enable 'cml' clock\n"); return (rv); } - rv = clk_enable(sc->clk_pll_e); if (rv != 0) { device_printf(sc->dev, "Cannot enable 'pll_e' clock\n"); @@ -1192,12 +849,13 @@ tegra_pcib_parse_fdt_resources(struct te static int tegra_pcib_decode_ranges(struct tegra_pcib_softc *sc, - struct tegra_pci_range *ranges, int nranges) + struct ofw_pci_range *ranges, int nranges) { int i; for (i = 2; i < nranges; i++) { - if (ranges[i].space_code == OFW_PCI_PHYS_HI_SPACE_IO) { + if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_IO) { if (sc->io_range.size != 0) { device_printf(sc->dev, "Duplicated IO range found in DT\n"); @@ -1205,23 +863,25 @@ tegra_pcib_decode_ranges(struct tegra_pc } sc->io_range = ranges[i]; } - if ((ranges[i].space_code == OFW_PCI_PHYS_HI_SPACE_MEM32) && - !ranges[i].prefetchable) { - if (sc->mem_range.size != 0) { - device_printf(sc->dev, - "Duplicated memory range found in DT\n"); - return (ENXIO); + if (((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_MEM32)) { + if (ranges[i].pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + if (sc->pref_mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->pref_mem_range = ranges[i]; + } else { + if (sc->mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->mem_range = ranges[i]; } - sc->mem_range = ranges[i]; - } - if ((ranges[i].space_code == OFW_PCI_PHYS_HI_SPACE_MEM32) && - ranges[i].prefetchable) { - if (sc->pref_mem_range.size != 0) { - device_printf(sc->dev, - "Duplicated memory range found in DT\n"); - return (ENXIO); - } - sc->pref_mem_range = ranges[i]; } } if ((sc->io_range.size == 0) || (sc->mem_range.size == 0) @@ -1454,16 +1114,16 @@ tegra_pcib_enable(struct tegra_pcib_soft FPCI_MAP_EXT_TYPE1_CONFIG, rman_get_size(sc->cfg_mem_res), 0); /* BAR 1 - downstream I/O. */ - tegra_pcib_set_bar(sc, 1, sc->io_range.host_addr, FPCI_MAP_IO, + tegra_pcib_set_bar(sc, 1, sc->io_range.host, FPCI_MAP_IO, sc->io_range.size, 0); /* BAR 2 - downstream prefetchable memory 1:1. */ - tegra_pcib_set_bar(sc, 2, sc->pref_mem_range.host_addr, - sc->pref_mem_range.host_addr, sc->pref_mem_range.size, 1); + tegra_pcib_set_bar(sc, 2, sc->pref_mem_range.host, + sc->pref_mem_range.host, sc->pref_mem_range.size, 1); /* BAR 3 - downstream not prefetchable memory 1:1 .*/ - tegra_pcib_set_bar(sc, 3, sc->mem_range.host_addr, - sc->mem_range.host_addr, sc->mem_range.size, 1); + tegra_pcib_set_bar(sc, 3, sc->mem_range.host, + sc->mem_range.host, sc->mem_range.size, 1); /* BAR 3-8 clear. */ tegra_pcib_set_bar(sc, 4, 0, 0, 0, 0); @@ -1497,8 +1157,6 @@ tegra_pcib_attach(device_t dev) phandle_t node; int rv; int rid; - int nranges; - struct tegra_pci_range *ranges; struct tegra_pcib_port *port; int i; @@ -1506,7 +1164,6 @@ tegra_pcib_attach(device_t dev) sc->dev = dev; mtx_init(&sc->mtx, "msi_mtx", NULL, MTX_DEF); - node = ofw_bus_get_node(dev); rv = tegra_pcib_parse_fdt_resources(sc, node); @@ -1515,14 +1172,6 @@ tegra_pcib_attach(device_t dev) return (rv); } - nranges = tegra_pci_get_ranges(node, &ranges); - if (nranges != 5) { - device_printf(sc->dev, "Unexpected number of ranges: %d\n", - nranges); - rv = ENXIO; - goto out; - } - /* Allocate bus_space resources. */ rid = 0; sc->pads_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, @@ -1574,9 +1223,8 @@ tegra_pcib_attach(device_t dev) } /* - * Get PCI interrupt info. + * Get PCI interrupt */ - ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(pcell_t)); rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); @@ -1595,23 +1243,22 @@ tegra_pcib_attach(device_t dev) goto out; } - if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - tegra_pci_intr, NULL, sc, &sc->intr_cookie)) { - device_printf(dev, "cannot setup interrupt handler\n"); - rv = ENXIO; + sc->ofw_pci.sc_range_mask = 0x3; + rv = ofw_pci_init(dev); + if (rv != 0) goto out; - } - /* Memory management. */ - rv = tegra_pcib_decode_ranges(sc, ranges, nranges); + rv = tegra_pcib_decode_ranges(sc, sc->ofw_pci.sc_range, + sc->ofw_pci.sc_nrange); if (rv != 0) goto out; - rv = tegra_pcib_rman_init(sc); - if (rv != 0) + if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + tegra_pci_intr, NULL, sc, &sc->intr_cookie)) { + device_printf(dev, "cannot setup interrupt handler\n"); + rv = ENXIO; goto out; - free(ranges, M_DEVBUF); - ranges = NULL; + } /* * Enable PCIE device. @@ -1633,8 +1280,6 @@ tegra_pcib_attach(device_t dev) return (bus_generic_attach(dev)); out: - if (ranges != NULL) - free(ranges, M_DEVBUF); return (rv); } @@ -1646,13 +1291,6 @@ static device_method_t tegra_pcib_method DEVMETHOD(device_attach, tegra_pcib_attach), /* Bus interface */ - DEVMETHOD(bus_read_ivar, tegra_pcib_read_ivar), - DEVMETHOD(bus_write_ivar, tegra_pcib_write_ivar), - DEVMETHOD(bus_alloc_resource, tegra_pcib_alloc_resource), - DEVMETHOD(bus_adjust_resource, tegra_pcib_adjust_resource), - DEVMETHOD(bus_release_resource, tegra_pcib_release_resource), - DEVMETHOD(bus_activate_resource, tegra_pcib_pcie_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), @@ -1678,12 +1316,7 @@ static device_method_t tegra_pcib_method DEVMETHOD_END }; -static driver_t tegra_pcib_driver = { - "pcib", - tegra_pcib_methods, - sizeof(struct tegra_pcib_softc), -}; - +DEFINE_CLASS_1(pcib, tegra_pcib_driver, tegra_pcib_methods, + sizeof(struct tegra_pcib_softc), ofw_pci_driver); devclass_t pcib_devclass; - DRIVER_MODULE(pcib, simplebus, tegra_pcib_driver, pcib_devclass, 0, 0); From owner-svn-src-head@freebsd.org Sun Jul 17 15:29: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 6A9C3B9C3A9; Sun, 17 Jul 2016 15:29:32 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CE8D1CD9; Sun, 17 Jul 2016 15:29:32 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6HFTVrA063959; Sun, 17 Jul 2016 15:29:31 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HFTVof063958; Sun, 17 Jul 2016 15:29:31 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201607171529.u6HFTVof063958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 17 Jul 2016 15:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302965 - head/sys/contrib/libnv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 15:29:32 -0000 Author: oshogbo Date: Sun Jul 17 15:29:31 2016 New Revision: 302965 URL: https://svnweb.freebsd.org/changeset/base/302965 Log: Fix memory leak in the nvlist string array. Submitted by: Adam Starak MFC after: 1 week Modified: head/sys/contrib/libnv/nvpair.c Modified: head/sys/contrib/libnv/nvpair.c ============================================================================== --- head/sys/contrib/libnv/nvpair.c Sun Jul 17 15:23:32 2016 (r302964) +++ head/sys/contrib/libnv/nvpair.c Sun Jul 17 15:29:31 2016 (r302965) @@ -1945,6 +1945,7 @@ nvpair_free(nvpair_t *nvp) case NV_TYPE_STRING_ARRAY: for (i = 0; i < nvp->nvp_nitems; i++) nv_free(((char **)(intptr_t)nvp->nvp_data)[i]); + nv_free((char **)(intptr_t)nvp->nvp_data); break; } nv_free(nvp); From owner-svn-src-head@freebsd.org Sun Jul 17 15:36: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 E6AD3B9C565; Sun, 17 Jul 2016 15:36:03 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B797C12DB; Sun, 17 Jul 2016 15:36:03 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6HFa2IL067870; Sun, 17 Jul 2016 15:36:02 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HFa2LJ067869; Sun, 17 Jul 2016 15:36:02 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201607171536.u6HFa2LJ067869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sun, 17 Jul 2016 15:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302966 - head/sys/contrib/libnv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 15:36:04 -0000 Author: oshogbo Date: Sun Jul 17 15:36:02 2016 New Revision: 302966 URL: https://svnweb.freebsd.org/changeset/base/302966 Log: Fix nvlist array memory leak. When we change nvl_array_next to NULL it means that we want to destroy or take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element is no longer needed and can be freed. Submitted by: Adam Starak MFC after: 1 week Modified: head/sys/contrib/libnv/nvlist.c Modified: head/sys/contrib/libnv/nvlist.c ============================================================================== --- head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:29:31 2016 (r302965) +++ head/sys/contrib/libnv/nvlist.c Sun Jul 17 15:36:02 2016 (r302966) @@ -236,10 +236,12 @@ nvlist_set_array_next(nvlist_t *nvl, nvp NVLIST_ASSERT(nvl); - if (ele != NULL) + if (ele != NULL) { nvl->nvl_flags |= NV_FLAG_IN_ARRAY; - else + } else { nvl->nvl_flags &= ~NV_FLAG_IN_ARRAY; + nv_free(nvl->nvl_array_next); + } nvl->nvl_array_next = ele; } From owner-svn-src-head@freebsd.org Sun Jul 17 19:19: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 89D72B980C8; Sun, 17 Jul 2016 19:19:51 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5659B14A5; Sun, 17 Jul 2016 19:19:51 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6HJJouP049140; Sun, 17 Jul 2016 19:19:50 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HJJoOd049139; Sun, 17 Jul 2016 19:19:50 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201607171919.u6HJJoOd049139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 17 Jul 2016 19:19:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302970 - head/sys/powerpc/booke X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 19:19:51 -0000 Author: jhibbits Date: Sun Jul 17 19:19:50 2016 New Revision: 302970 URL: https://svnweb.freebsd.org/changeset/base/302970 Log: No need to include mpc85xx.h anymore, so remove it. Modified: head/sys/powerpc/booke/booke_machdep.c Modified: head/sys/powerpc/booke/booke_machdep.c ============================================================================== --- head/sys/powerpc/booke/booke_machdep.c Sun Jul 17 18:33:17 2016 (r302969) +++ head/sys/powerpc/booke/booke_machdep.c Sun Jul 17 19:19:50 2016 (r302970) @@ -142,10 +142,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(MPC85XX) || defined(QORIQ_DPAA) -#include -#endif - #ifdef DDB #include #endif From owner-svn-src-head@freebsd.org Sun Jul 17 19:24: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 7642AB98562; Sun, 17 Jul 2016 19:24:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46A971A8F; Sun, 17 Jul 2016 19:24:29 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6HJOSt1052678; Sun, 17 Jul 2016 19:24:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HJOSml052676; Sun, 17 Jul 2016 19:24:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201607171924.u6HJOSml052676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 17 Jul 2016 19:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302971 - in head/sys/powerpc: booke 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: Sun, 17 Jul 2016 19:24:29 -0000 Author: jhibbits Date: Sun Jul 17 19:24:28 2016 New Revision: 302971 URL: https://svnweb.freebsd.org/changeset/base/302971 Log: Remove booke_enable_l3_cache declaration and remaining definition. L3 cache is not defined by Book-E, so is platform specific. Since it was already moved for e500-based devices into mpc85xx in r292903, just eliminate it altogether. Any device that supports L3 cache should have its own platform means to enable it. Modified: head/sys/powerpc/booke/machdep_ppc4xx.c head/sys/powerpc/include/machdep.h Modified: head/sys/powerpc/booke/machdep_ppc4xx.c ============================================================================== --- head/sys/powerpc/booke/machdep_ppc4xx.c Sun Jul 17 19:19:50 2016 (r302970) +++ head/sys/powerpc/booke/machdep_ppc4xx.c Sun Jul 17 19:24:28 2016 (r302971) @@ -115,11 +115,6 @@ booke_enable_l2_cache(void) } void -booke_enable_l3_cache(void) -{ -} - -void booke_disable_l2_cache(void) { uint32_t ccr1,l2cr0; Modified: head/sys/powerpc/include/machdep.h ============================================================================== --- head/sys/powerpc/include/machdep.h Sun Jul 17 19:19:50 2016 (r302970) +++ head/sys/powerpc/include/machdep.h Sun Jul 17 19:24:28 2016 (r302971) @@ -32,7 +32,6 @@ void booke_disable_l2_cache(void); void booke_enable_l1_cache(void); void booke_enable_l2_cache(void); -void booke_enable_l3_cache(void); void booke_enable_bpred(void); void booke_init_tlb(vm_paddr_t); From owner-svn-src-head@freebsd.org Sun Jul 17 20:34: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 CDF81B9C672; Sun, 17 Jul 2016 20:34:47 +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 9F96C1AE8; Sun, 17 Jul 2016 20:34:47 +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 u6HKYkux078380; Sun, 17 Jul 2016 20:34:46 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HKYkOr078379; Sun, 17 Jul 2016 20:34:46 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201607172034.u6HKYkOr078379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Sun, 17 Jul 2016 20:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302972 - 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: Sun, 17 Jul 2016 20:34:47 -0000 Author: grehan Date: Sun Jul 17 20:34:46 2016 New Revision: 302972 URL: https://svnweb.freebsd.org/changeset/base/302972 Log: Disallow interrupt requests on disabled endpoints. Submitted by: Leon Dang MFC after: 3 days Modified: head/usr.sbin/bhyve/pci_xhci.c Modified: head/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- head/usr.sbin/bhyve/pci_xhci.c Sun Jul 17 19:24:28 2016 (r302971) +++ head/usr.sbin/bhyve/pci_xhci.c Sun Jul 17 20:34:46 2016 (r302972) @@ -2537,9 +2537,11 @@ static int pci_xhci_dev_intr(struct usb_hci *hci, int epctx) { struct pci_xhci_dev_emu *dev; + struct xhci_dev_ctx *dev_ctx; struct xhci_trb evtrb; struct pci_xhci_softc *sc; struct pci_xhci_portregs *p; + struct xhci_endp_ctx *ep_ctx; int error; int dir_in; int epid; @@ -2578,6 +2580,14 @@ pci_xhci_dev_intr(struct usb_hci *hci, i goto done; } + dev_ctx = dev->dev_ctx; + ep_ctx = &dev_ctx->ctx_ep[epid]; + if ((ep_ctx->dwEpCtx0 & 0x7) == XHCI_ST_EPCTX_DISABLED) { + DPRINTF(("xhci device interrupt on disabled endpoint %d\r\n", + epid)); + return (0); + } + DPRINTF(("xhci device interrupt on endpoint %d\r\n", epid)); pci_xhci_device_doorbell(sc, hci->hci_port, epid, 0); From owner-svn-src-head@freebsd.org Sun Jul 17 21: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 1CAD9B9B950; Sun, 17 Jul 2016 21:49: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 D433D1BDB; Sun, 17 Jul 2016 21:49: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 u6HLns1G004292; Sun, 17 Jul 2016 21:49:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6HLnsDc004291; Sun, 17 Jul 2016 21:49:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607172149.u6HLnsDc004291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 17 Jul 2016 21:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302973 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 17 Jul 2016 21:49:55 -0000 Author: pfg Date: Sun Jul 17 21:49:53 2016 New Revision: 302973 URL: https://svnweb.freebsd.org/changeset/base/302973 Log: sed(1): Fix off by one introduced in r299211. Detected by running the gsed tests. Submitted by: Mikhail Teterin PR: 195929 MFC after: 3 days Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Sun Jul 17 20:34:46 2016 (r302972) +++ head/usr.bin/sed/process.c Sun Jul 17 21:49:53 2016 (r302973) @@ -450,7 +450,7 @@ substitute(struct s_command *cp) regexec_e(re, ps, REG_NOTBOL, 0, le, psl)); /* Did not find the requested number of matches. */ - if (n > 1) + if (n > 0) return (0); /* Copy the trailing retained string. */ From owner-svn-src-head@freebsd.org Mon Jul 18 01:02: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 125C0B9CF59; Mon, 18 Jul 2016 01:02:54 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFB8215F1; Mon, 18 Jul 2016 01:02:53 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I12rBS077842; Mon, 18 Jul 2016 01:02:53 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I12qg3077839; Mon, 18 Jul 2016 01:02:52 GMT (envelope-from will@FreeBSD.org) Message-Id: <201607180102.u6I12qg3077839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Mon, 18 Jul 2016 01:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302974 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 01:02:54 -0000 Author: will Date: Mon Jul 18 01:02:52 2016 New Revision: 302974 URL: https://svnweb.freebsd.org/changeset/base/302974 Log: libkvm: Put private kvm routines in kvm_private.c. Added: head/lib/libkvm/kvm_private.c (contents, props changed) Modified: head/lib/libkvm/Makefile head/lib/libkvm/kvm.c Modified: head/lib/libkvm/Makefile ============================================================================== --- head/lib/libkvm/Makefile Sun Jul 17 21:49:53 2016 (r302973) +++ head/lib/libkvm/Makefile Mon Jul 18 01:02:52 2016 (r302974) @@ -11,7 +11,7 @@ CFLAGS+=-DLIBC_SCCS -I${.CURDIR} WARNS?= 3 SRCS= kvm.c kvm_cptime.c kvm_getloadavg.c \ - kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c \ + kvm_getswapinfo.c kvm_pcpu.c kvm_private.c kvm_proc.c kvm_vnet.c \ kvm_minidump_aarch64.c \ kvm_amd64.c kvm_minidump_amd64.c \ kvm_arm.c kvm_minidump_arm.c \ Modified: head/lib/libkvm/kvm.c ============================================================================== --- head/lib/libkvm/kvm.c Sun Jul 17 21:49:53 2016 (r302973) +++ head/lib/libkvm/kvm.c Mon Jul 18 01:02:52 2016 (r302974) @@ -66,114 +66,12 @@ static char sccsid[] = "@(#)kvm.c 8.2 (B SET_DECLARE(kvm_arch, struct kvm_arch); -/* from src/lib/libc/gen/nlist.c */ -int __fdnlist(int, struct nlist *); - -static int -kvm_fdnlist(kvm_t *kd, struct kvm_nlist *list) -{ - kvaddr_t addr; - int error, nfail; - - if (kd->resolve_symbol == NULL) { - struct nlist *nl; - int count, i; - - for (count = 0; list[count].n_name != NULL && - list[count].n_name[0] != '\0'; count++) - ; - nl = calloc(count + 1, sizeof(*nl)); - for (i = 0; i < count; i++) - nl[i].n_name = list[i].n_name; - nfail = __fdnlist(kd->nlfd, nl); - for (i = 0; i < count; i++) { - list[i].n_type = nl[i].n_type; - list[i].n_value = nl[i].n_value; - } - free(nl); - return (nfail); - } - - nfail = 0; - while (list->n_name != NULL && list->n_name[0] != '\0') { - error = kd->resolve_symbol(list->n_name, &addr); - if (error != 0) { - nfail++; - list->n_value = 0; - list->n_type = 0; - } else { - list->n_value = addr; - list->n_type = N_DATA | N_EXT; - } - list++; - } - return (nfail); -} - char * kvm_geterr(kvm_t *kd) { return (kd->errbuf); } -#include - -/* - * Report an error using printf style arguments. "program" is kd->program - * on hard errors, and 0 on soft errors, so that under sun error emulation, - * only hard errors are printed out (otherwise, programs like gdb will - * generate tons of error messages when trying to access bogus pointers). - */ -void -_kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (program != NULL) { - (void)fprintf(stderr, "%s: ", program); - (void)vfprintf(stderr, fmt, ap); - (void)fputc('\n', stderr); - } else - (void)vsnprintf(kd->errbuf, - sizeof(kd->errbuf), fmt, ap); - - va_end(ap); -} - -void -_kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...) -{ - va_list ap; - int n; - - va_start(ap, fmt); - if (program != NULL) { - (void)fprintf(stderr, "%s: ", program); - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": %s\n", strerror(errno)); - } else { - char *cp = kd->errbuf; - - (void)vsnprintf(cp, sizeof(kd->errbuf), fmt, ap); - n = strlen(cp); - (void)snprintf(&cp[n], sizeof(kd->errbuf) - n, ": %s", - strerror(errno)); - } - va_end(ap); -} - -void * -_kvm_malloc(kvm_t *kd, size_t n) -{ - void *p; - - if ((p = calloc(n, sizeof(char))) == NULL) - _kvm_err(kd, kd->program, "can't allocate %zu bytes: %s", - n, strerror(errno)); - return (p); -} - static int _kvm_read_kernel_ehdr(kvm_t *kd) { @@ -210,166 +108,6 @@ _kvm_read_kernel_ehdr(kvm_t *kd) } } -int -_kvm_probe_elf_kernel(kvm_t *kd, int class, int machine) -{ - - return (kd->nlehdr.e_ident[EI_CLASS] == class && - kd->nlehdr.e_type == ET_EXEC && - kd->nlehdr.e_machine == machine); -} - -int -_kvm_is_minidump(kvm_t *kd) -{ - char minihdr[8]; - - if (kd->rawdump) - return (0); - if (pread(kd->pmfd, &minihdr, 8, 0) == 8 && - memcmp(&minihdr, "minidump", 8) == 0) - return (1); - return (0); -} - -/* - * The powerpc backend has a hack to strip a leading kerneldump - * header from the core before treating it as an ELF header. - * - * We can add that here if we can get a change to libelf to support - * an initial offset into the file. Alternatively we could patch - * savecore to extract cores from a regular file instead. - */ -int -_kvm_read_core_phdrs(kvm_t *kd, size_t *phnump, GElf_Phdr **phdrp) -{ - GElf_Ehdr ehdr; - GElf_Phdr *phdr; - Elf *elf; - size_t i, phnum; - - elf = elf_begin(kd->pmfd, ELF_C_READ, NULL); - if (elf == NULL) { - _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); - return (-1); - } - if (elf_kind(elf) != ELF_K_ELF) { - _kvm_err(kd, kd->program, "invalid core"); - goto bad; - } - if (gelf_getclass(elf) != kd->nlehdr.e_ident[EI_CLASS]) { - _kvm_err(kd, kd->program, "invalid core"); - goto bad; - } - if (gelf_getehdr(elf, &ehdr) == NULL) { - _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); - goto bad; - } - if (ehdr.e_type != ET_CORE) { - _kvm_err(kd, kd->program, "invalid core"); - goto bad; - } - if (ehdr.e_machine != kd->nlehdr.e_machine) { - _kvm_err(kd, kd->program, "invalid core"); - goto bad; - } - - if (elf_getphdrnum(elf, &phnum) == -1) { - _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); - goto bad; - } - - phdr = calloc(phnum, sizeof(*phdr)); - if (phdr == NULL) { - _kvm_err(kd, kd->program, "failed to allocate phdrs"); - goto bad; - } - - for (i = 0; i < phnum; i++) { - if (gelf_getphdr(elf, i, &phdr[i]) == NULL) { - _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); - goto bad; - } - } - elf_end(elf); - *phnump = phnum; - *phdrp = phdr; - return (0); - -bad: - elf_end(elf); - return (-1); -} - -static void -_kvm_hpt_insert(struct hpt *hpt, uint64_t pa, off_t off) -{ - struct hpte *hpte; - uint32_t fnv = FNV1_32_INIT; - - fnv = fnv_32_buf(&pa, sizeof(pa), fnv); - fnv &= (HPT_SIZE - 1); - hpte = malloc(sizeof(*hpte)); - hpte->pa = pa; - hpte->off = off; - hpte->next = hpt->hpt_head[fnv]; - hpt->hpt_head[fnv] = hpte; -} - -void -_kvm_hpt_init(kvm_t *kd, struct hpt *hpt, void *base, size_t len, off_t off, - int page_size, int word_size) -{ - uint64_t bits, idx, pa; - uint64_t *base64; - uint32_t *base32; - - base64 = base; - base32 = base; - for (idx = 0; idx < len / word_size; idx++) { - if (word_size == sizeof(uint64_t)) - bits = _kvm64toh(kd, base64[idx]); - else - bits = _kvm32toh(kd, base32[idx]); - pa = idx * word_size * NBBY * page_size; - for (; bits != 0; bits >>= 1, pa += page_size) { - if ((bits & 1) == 0) - continue; - _kvm_hpt_insert(hpt, pa, off); - off += page_size; - } - } -} - -off_t -_kvm_hpt_find(struct hpt *hpt, uint64_t pa) -{ - struct hpte *hpte; - uint32_t fnv = FNV1_32_INIT; - - fnv = fnv_32_buf(&pa, sizeof(pa), fnv); - fnv &= (HPT_SIZE - 1); - for (hpte = hpt->hpt_head[fnv]; hpte != NULL; hpte = hpte->next) { - if (pa == hpte->pa) - return (hpte->off); - } - return (-1); -} - -void -_kvm_hpt_free(struct hpt *hpt) -{ - struct hpte *hpte, *next; - int i; - - for (i = 0; i < HPT_SIZE; i++) { - for (hpte = hpt->hpt_head[i]; hpte != NULL; hpte = next) { - next = hpte->next; - free(hpte); - } - } -} - static kvm_t * _kvm_open(kvm_t *kd, const char *uf, const char *mf, int flag, char *errout) { @@ -550,207 +288,6 @@ kvm_close(kvm_t *kd) return (0); } -/* - * Walk the list of unresolved symbols, generate a new list and prefix the - * symbol names, try again, and merge back what we could resolve. - */ -static int -kvm_fdnlist_prefix(kvm_t *kd, struct kvm_nlist *nl, int missing, - const char *prefix, kvaddr_t (*validate_fn)(kvm_t *, kvaddr_t)) -{ - struct kvm_nlist *n, *np, *p; - char *cp, *ce; - const char *ccp; - size_t len; - int slen, unresolved; - - /* - * Calculate the space we need to malloc for nlist and names. - * We are going to store the name twice for later lookups: once - * with the prefix and once the unmodified name delmited by \0. - */ - len = 0; - unresolved = 0; - for (p = nl; p->n_name && p->n_name[0]; ++p) { - if (p->n_type != N_UNDF) - continue; - len += sizeof(struct kvm_nlist) + strlen(prefix) + - 2 * (strlen(p->n_name) + 1); - unresolved++; - } - if (unresolved == 0) - return (unresolved); - /* Add space for the terminating nlist entry. */ - len += sizeof(struct kvm_nlist); - unresolved++; - - /* Alloc one chunk for (nlist, [names]) and setup pointers. */ - n = np = malloc(len); - bzero(n, len); - if (n == NULL) - return (missing); - cp = ce = (char *)np; - cp += unresolved * sizeof(struct kvm_nlist); - ce += len; - - /* Generate shortened nlist with special prefix. */ - unresolved = 0; - for (p = nl; p->n_name && p->n_name[0]; ++p) { - if (p->n_type != N_UNDF) - continue; - *np = *p; - /* Save the new\0orig. name so we can later match it again. */ - slen = snprintf(cp, ce - cp, "%s%s%c%s", prefix, - (prefix[0] != '\0' && p->n_name[0] == '_') ? - (p->n_name + 1) : p->n_name, '\0', p->n_name); - if (slen < 0 || slen >= ce - cp) - continue; - np->n_name = cp; - cp += slen + 1; - np++; - unresolved++; - } - - /* Do lookup on the reduced list. */ - np = n; - unresolved = kvm_fdnlist(kd, np); - - /* Check if we could resolve further symbols and update the list. */ - if (unresolved >= 0 && unresolved < missing) { - /* Find the first freshly resolved entry. */ - for (; np->n_name && np->n_name[0]; np++) - if (np->n_type != N_UNDF) - break; - /* - * The lists are both in the same order, - * so we can walk them in parallel. - */ - for (p = nl; np->n_name && np->n_name[0] && - p->n_name && p->n_name[0]; ++p) { - if (p->n_type != N_UNDF) - continue; - /* Skip expanded name and compare to orig. one. */ - ccp = np->n_name + strlen(np->n_name) + 1; - if (strcmp(ccp, p->n_name) != 0) - continue; - /* Update nlist with new, translated results. */ - p->n_type = np->n_type; - if (validate_fn) - p->n_value = (*validate_fn)(kd, np->n_value); - else - p->n_value = np->n_value; - missing--; - /* Find next freshly resolved entry. */ - for (np++; np->n_name && np->n_name[0]; np++) - if (np->n_type != N_UNDF) - break; - } - } - /* We could assert missing = unresolved here. */ - - free(n); - return (unresolved); -} - -int -_kvm_nlist(kvm_t *kd, struct kvm_nlist *nl, int initialize) -{ - struct kvm_nlist *p; - int nvalid; - struct kld_sym_lookup lookup; - int error; - const char *prefix = ""; - char symname[1024]; /* XXX-BZ symbol name length limit? */ - int tried_vnet, tried_dpcpu; - - /* - * If we can't use the kld symbol lookup, revert to the - * slow library call. - */ - if (!ISALIVE(kd)) { - error = kvm_fdnlist(kd, nl); - if (error <= 0) /* Hard error or success. */ - return (error); - - if (_kvm_vnet_initialized(kd, initialize)) - error = kvm_fdnlist_prefix(kd, nl, error, - VNET_SYMPREFIX, _kvm_vnet_validaddr); - - if (error > 0 && _kvm_dpcpu_initialized(kd, initialize)) - error = kvm_fdnlist_prefix(kd, nl, error, - DPCPU_SYMPREFIX, _kvm_dpcpu_validaddr); - - return (error); - } - - /* - * We can use the kld lookup syscall. Go through each nlist entry - * and look it up with a kldsym(2) syscall. - */ - nvalid = 0; - tried_vnet = 0; - tried_dpcpu = 0; -again: - for (p = nl; p->n_name && p->n_name[0]; ++p) { - if (p->n_type != N_UNDF) - continue; - - lookup.version = sizeof(lookup); - lookup.symvalue = 0; - lookup.symsize = 0; - - error = snprintf(symname, sizeof(symname), "%s%s", prefix, - (prefix[0] != '\0' && p->n_name[0] == '_') ? - (p->n_name + 1) : p->n_name); - if (error < 0 || error >= (int)sizeof(symname)) - continue; - lookup.symname = symname; - if (lookup.symname[0] == '_') - lookup.symname++; - - if (kldsym(0, KLDSYM_LOOKUP, &lookup) != -1) { - p->n_type = N_TEXT; - if (_kvm_vnet_initialized(kd, initialize) && - strcmp(prefix, VNET_SYMPREFIX) == 0) - p->n_value = - _kvm_vnet_validaddr(kd, lookup.symvalue); - else if (_kvm_dpcpu_initialized(kd, initialize) && - strcmp(prefix, DPCPU_SYMPREFIX) == 0) - p->n_value = - _kvm_dpcpu_validaddr(kd, lookup.symvalue); - else - p->n_value = lookup.symvalue; - ++nvalid; - /* lookup.symsize */ - } - } - - /* - * Check the number of entries that weren't found. If they exist, - * try again with a prefix for virtualized or DPCPU symbol names. - */ - error = ((p - nl) - nvalid); - if (error && _kvm_vnet_initialized(kd, initialize) && !tried_vnet) { - tried_vnet = 1; - prefix = VNET_SYMPREFIX; - goto again; - } - if (error && _kvm_dpcpu_initialized(kd, initialize) && !tried_dpcpu) { - tried_dpcpu = 1; - prefix = DPCPU_SYMPREFIX; - goto again; - } - - /* - * Return the number of entries that weren't found. If they exist, - * also fill internal error buffer. - */ - error = ((p - nl) - nvalid); - if (error) - _kvm_syserr(kd, kd->program, "kvm_nlist"); - return (error); -} - int kvm_nlist2(kvm_t *kd, struct kvm_nlist *nl) { Added: head/lib/libkvm/kvm_private.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libkvm/kvm_private.c Mon Jul 18 01:02:52 2016 (r302974) @@ -0,0 +1,525 @@ +/*- + * Copyright (c) 1989, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software developed by the Computer Systems + * Engineering group at Lawrence Berkeley Laboratory under DARPA contract + * BG 91-66 and contributed to Berkeley. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 + +#define _WANT_VNET + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kvm_private.h" + +/* + * Routines private to libkvm. + */ + +/* from src/lib/libc/gen/nlist.c */ +int __fdnlist(int, struct nlist *); + +/* + * Report an error using printf style arguments. "program" is kd->program + * on hard errors, and 0 on soft errors, so that under sun error emulation, + * only hard errors are printed out (otherwise, programs like gdb will + * generate tons of error messages when trying to access bogus pointers). + */ +void +_kvm_err(kvm_t *kd, const char *program, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + if (program != NULL) { + (void)fprintf(stderr, "%s: ", program); + (void)vfprintf(stderr, fmt, ap); + (void)fputc('\n', stderr); + } else + (void)vsnprintf(kd->errbuf, + sizeof(kd->errbuf), fmt, ap); + + va_end(ap); +} + +void +_kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...) +{ + va_list ap; + int n; + + va_start(ap, fmt); + if (program != NULL) { + (void)fprintf(stderr, "%s: ", program); + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": %s\n", strerror(errno)); + } else { + char *cp = kd->errbuf; + + (void)vsnprintf(cp, sizeof(kd->errbuf), fmt, ap); + n = strlen(cp); + (void)snprintf(&cp[n], sizeof(kd->errbuf) - n, ": %s", + strerror(errno)); + } + va_end(ap); +} + +void * +_kvm_malloc(kvm_t *kd, size_t n) +{ + void *p; + + if ((p = calloc(n, sizeof(char))) == NULL) + _kvm_err(kd, kd->program, "can't allocate %zu bytes: %s", + n, strerror(errno)); + return (p); +} + +int +_kvm_probe_elf_kernel(kvm_t *kd, int class, int machine) +{ + + return (kd->nlehdr.e_ident[EI_CLASS] == class && + kd->nlehdr.e_type == ET_EXEC && + kd->nlehdr.e_machine == machine); +} + +int +_kvm_is_minidump(kvm_t *kd) +{ + char minihdr[8]; + + if (kd->rawdump) + return (0); + if (pread(kd->pmfd, &minihdr, 8, 0) == 8 && + memcmp(&minihdr, "minidump", 8) == 0) + return (1); + return (0); +} + +/* + * The powerpc backend has a hack to strip a leading kerneldump + * header from the core before treating it as an ELF header. + * + * We can add that here if we can get a change to libelf to support + * an initial offset into the file. Alternatively we could patch + * savecore to extract cores from a regular file instead. + */ +int +_kvm_read_core_phdrs(kvm_t *kd, size_t *phnump, GElf_Phdr **phdrp) +{ + GElf_Ehdr ehdr; + GElf_Phdr *phdr; + Elf *elf; + size_t i, phnum; + + elf = elf_begin(kd->pmfd, ELF_C_READ, NULL); + if (elf == NULL) { + _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); + return (-1); + } + if (elf_kind(elf) != ELF_K_ELF) { + _kvm_err(kd, kd->program, "invalid core"); + goto bad; + } + if (gelf_getclass(elf) != kd->nlehdr.e_ident[EI_CLASS]) { + _kvm_err(kd, kd->program, "invalid core"); + goto bad; + } + if (gelf_getehdr(elf, &ehdr) == NULL) { + _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); + goto bad; + } + if (ehdr.e_type != ET_CORE) { + _kvm_err(kd, kd->program, "invalid core"); + goto bad; + } + if (ehdr.e_machine != kd->nlehdr.e_machine) { + _kvm_err(kd, kd->program, "invalid core"); + goto bad; + } + + if (elf_getphdrnum(elf, &phnum) == -1) { + _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); + goto bad; + } + + phdr = calloc(phnum, sizeof(*phdr)); + if (phdr == NULL) { + _kvm_err(kd, kd->program, "failed to allocate phdrs"); + goto bad; + } + + for (i = 0; i < phnum; i++) { + if (gelf_getphdr(elf, i, &phdr[i]) == NULL) { + _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); + goto bad; + } + } + elf_end(elf); + *phnump = phnum; + *phdrp = phdr; + return (0); + +bad: + elf_end(elf); + return (-1); +} + +static void +_kvm_hpt_insert(struct hpt *hpt, uint64_t pa, off_t off) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + hpte = malloc(sizeof(*hpte)); + hpte->pa = pa; + hpte->off = off; + hpte->next = hpt->hpt_head[fnv]; + hpt->hpt_head[fnv] = hpte; +} + +void +_kvm_hpt_init(kvm_t *kd, struct hpt *hpt, void *base, size_t len, off_t off, + int page_size, int word_size) +{ + uint64_t bits, idx, pa; + uint64_t *base64; + uint32_t *base32; + + base64 = base; + base32 = base; + for (idx = 0; idx < len / word_size; idx++) { + if (word_size == sizeof(uint64_t)) + bits = _kvm64toh(kd, base64[idx]); + else + bits = _kvm32toh(kd, base32[idx]); + pa = idx * word_size * NBBY * page_size; + for (; bits != 0; bits >>= 1, pa += page_size) { + if ((bits & 1) == 0) + continue; + _kvm_hpt_insert(hpt, pa, off); + off += page_size; + } + } +} + +off_t +_kvm_hpt_find(struct hpt *hpt, uint64_t pa) +{ + struct hpte *hpte; + uint32_t fnv = FNV1_32_INIT; + + fnv = fnv_32_buf(&pa, sizeof(pa), fnv); + fnv &= (HPT_SIZE - 1); + for (hpte = hpt->hpt_head[fnv]; hpte != NULL; hpte = hpte->next) { + if (pa == hpte->pa) + return (hpte->off); + } + return (-1); +} + +void +_kvm_hpt_free(struct hpt *hpt) +{ + struct hpte *hpte, *next; + int i; + + for (i = 0; i < HPT_SIZE; i++) { + for (hpte = hpt->hpt_head[i]; hpte != NULL; hpte = next) { + next = hpte->next; + free(hpte); + } + } +} + +static int +kvm_fdnlist(kvm_t *kd, struct kvm_nlist *list) +{ + kvaddr_t addr; + int error, nfail; + + if (kd->resolve_symbol == NULL) { + struct nlist *nl; + int count, i; + + for (count = 0; list[count].n_name != NULL && + list[count].n_name[0] != '\0'; count++) + ; + nl = calloc(count + 1, sizeof(*nl)); + for (i = 0; i < count; i++) + nl[i].n_name = list[i].n_name; + nfail = __fdnlist(kd->nlfd, nl); + for (i = 0; i < count; i++) { + list[i].n_type = nl[i].n_type; + list[i].n_value = nl[i].n_value; + } + free(nl); + return (nfail); + } + + nfail = 0; + while (list->n_name != NULL && list->n_name[0] != '\0') { + error = kd->resolve_symbol(list->n_name, &addr); + if (error != 0) { + nfail++; + list->n_value = 0; + list->n_type = 0; + } else { + list->n_value = addr; + list->n_type = N_DATA | N_EXT; + } + list++; + } + return (nfail); +} + +/* + * Walk the list of unresolved symbols, generate a new list and prefix the + * symbol names, try again, and merge back what we could resolve. + */ +static int +kvm_fdnlist_prefix(kvm_t *kd, struct kvm_nlist *nl, int missing, + const char *prefix, kvaddr_t (*validate_fn)(kvm_t *, kvaddr_t)) +{ + struct kvm_nlist *n, *np, *p; + char *cp, *ce; + const char *ccp; + size_t len; + int slen, unresolved; + + /* + * Calculate the space we need to malloc for nlist and names. + * We are going to store the name twice for later lookups: once + * with the prefix and once the unmodified name delmited by \0. + */ + len = 0; + unresolved = 0; + for (p = nl; p->n_name && p->n_name[0]; ++p) { + if (p->n_type != N_UNDF) + continue; + len += sizeof(struct kvm_nlist) + strlen(prefix) + + 2 * (strlen(p->n_name) + 1); + unresolved++; + } + if (unresolved == 0) + return (unresolved); + /* Add space for the terminating nlist entry. */ + len += sizeof(struct kvm_nlist); + unresolved++; + + /* Alloc one chunk for (nlist, [names]) and setup pointers. */ + n = np = malloc(len); + bzero(n, len); + if (n == NULL) + return (missing); + cp = ce = (char *)np; + cp += unresolved * sizeof(struct kvm_nlist); + ce += len; + + /* Generate shortened nlist with special prefix. */ + unresolved = 0; + for (p = nl; p->n_name && p->n_name[0]; ++p) { + if (p->n_type != N_UNDF) + continue; + *np = *p; + /* Save the new\0orig. name so we can later match it again. */ + slen = snprintf(cp, ce - cp, "%s%s%c%s", prefix, + (prefix[0] != '\0' && p->n_name[0] == '_') ? + (p->n_name + 1) : p->n_name, '\0', p->n_name); + if (slen < 0 || slen >= ce - cp) + continue; + np->n_name = cp; + cp += slen + 1; + np++; + unresolved++; + } + + /* Do lookup on the reduced list. */ + np = n; + unresolved = kvm_fdnlist(kd, np); + + /* Check if we could resolve further symbols and update the list. */ + if (unresolved >= 0 && unresolved < missing) { + /* Find the first freshly resolved entry. */ + for (; np->n_name && np->n_name[0]; np++) + if (np->n_type != N_UNDF) + break; + /* + * The lists are both in the same order, + * so we can walk them in parallel. + */ + for (p = nl; np->n_name && np->n_name[0] && + p->n_name && p->n_name[0]; ++p) { + if (p->n_type != N_UNDF) + continue; + /* Skip expanded name and compare to orig. one. */ + ccp = np->n_name + strlen(np->n_name) + 1; + if (strcmp(ccp, p->n_name) != 0) + continue; + /* Update nlist with new, translated results. */ + p->n_type = np->n_type; + if (validate_fn) + p->n_value = (*validate_fn)(kd, np->n_value); + else + p->n_value = np->n_value; + missing--; + /* Find next freshly resolved entry. */ + for (np++; np->n_name && np->n_name[0]; np++) + if (np->n_type != N_UNDF) + break; + } + } + /* We could assert missing = unresolved here. */ + + free(n); + return (unresolved); +} + +int +_kvm_nlist(kvm_t *kd, struct kvm_nlist *nl, int initialize) +{ + struct kvm_nlist *p; + int nvalid; + struct kld_sym_lookup lookup; + int error; + const char *prefix = ""; + char symname[1024]; /* XXX-BZ symbol name length limit? */ + int tried_vnet, tried_dpcpu; + + /* + * If we can't use the kld symbol lookup, revert to the + * slow library call. + */ + if (!ISALIVE(kd)) { + error = kvm_fdnlist(kd, nl); + if (error <= 0) /* Hard error or success. */ + return (error); + + if (_kvm_vnet_initialized(kd, initialize)) + error = kvm_fdnlist_prefix(kd, nl, error, + VNET_SYMPREFIX, _kvm_vnet_validaddr); + + if (error > 0 && _kvm_dpcpu_initialized(kd, initialize)) + error = kvm_fdnlist_prefix(kd, nl, error, + DPCPU_SYMPREFIX, _kvm_dpcpu_validaddr); + + return (error); + } + + /* + * We can use the kld lookup syscall. Go through each nlist entry + * and look it up with a kldsym(2) syscall. + */ + nvalid = 0; + tried_vnet = 0; + tried_dpcpu = 0; +again: + for (p = nl; p->n_name && p->n_name[0]; ++p) { + if (p->n_type != N_UNDF) + continue; + + lookup.version = sizeof(lookup); + lookup.symvalue = 0; + lookup.symsize = 0; + + error = snprintf(symname, sizeof(symname), "%s%s", prefix, + (prefix[0] != '\0' && p->n_name[0] == '_') ? + (p->n_name + 1) : p->n_name); + if (error < 0 || error >= (int)sizeof(symname)) + continue; + lookup.symname = symname; + if (lookup.symname[0] == '_') + lookup.symname++; + + if (kldsym(0, KLDSYM_LOOKUP, &lookup) != -1) { + p->n_type = N_TEXT; + if (_kvm_vnet_initialized(kd, initialize) && + strcmp(prefix, VNET_SYMPREFIX) == 0) + p->n_value = + _kvm_vnet_validaddr(kd, lookup.symvalue); + else if (_kvm_dpcpu_initialized(kd, initialize) && + strcmp(prefix, DPCPU_SYMPREFIX) == 0) + p->n_value = + _kvm_dpcpu_validaddr(kd, lookup.symvalue); + else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jul 18 01:03: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 02CAFB9CFC5; Mon, 18 Jul 2016 01:03:41 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE85B175C; Mon, 18 Jul 2016 01:03:40 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I13dMX077913; Mon, 18 Jul 2016 01:03:39 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I13dPR077910; Mon, 18 Jul 2016 01:03:39 GMT (envelope-from will@FreeBSD.org) Message-Id: <201607180103.u6I13dPR077910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Mon, 18 Jul 2016 01:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302975 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 01:03:41 -0000 Author: will Date: Mon Jul 18 01:03:39 2016 New Revision: 302975 URL: https://svnweb.freebsd.org/changeset/base/302975 Log: libkvm: Bounds check (more) PTE indices. Modified: head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c Modified: head/lib/libkvm/kvm_minidump_arm.c ============================================================================== --- head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:03:39 2016 (r302975) @@ -184,6 +184,8 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> ARM_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = _kvm32toh(kd, ptemap[pteindex]); if ((pte & ARM_L2_TYPE_MASK) == ARM_L2_TYPE_INV) { _kvm_err(kd, kd->program, Modified: head/lib/libkvm/kvm_minidump_i386.c ============================================================================== --- head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:03:39 2016 (r302975) @@ -162,6 +162,8 @@ _i386_minidump_vatop_pae(kvm_t *kd, kvad if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = le64toh(ptemap[pteindex]); if ((pte & I386_PG_V) == 0) { _kvm_err(kd, kd->program, @@ -207,6 +209,8 @@ _i386_minidump_vatop(kvm_t *kd, kvaddr_t if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> I386_PAGE_SHIFT; + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap)) + goto invalid; pte = le32toh(ptemap[pteindex]); if ((pte & I386_PG_V) == 0) { _kvm_err(kd, kd->program, Modified: head/lib/libkvm/kvm_minidump_mips.c ============================================================================== --- head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:02:52 2016 (r302974) +++ head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:03:39 2016 (r302975) @@ -221,9 +221,13 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_ if (va >= vm->hdr.kernbase) { pteindex = (va - vm->hdr.kernbase) >> MIPS_PAGE_SHIFT; if (vm->pte_size == 64) { + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap64)) + goto invalid; pte = _kvm64toh(kd, ptemap64[pteindex]); a = MIPS64_PTE_TO_PA(pte); } else { + if (pteindex >= vm->hdr.ptesize / sizeof(*ptemap32)) + goto invalid; pte = _kvm32toh(kd, ptemap32[pteindex]); a = MIPS32_PTE_TO_PA(pte); } From owner-svn-src-head@freebsd.org Mon Jul 18 01:55: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 C8EA2B9ABAC; Mon, 18 Jul 2016 01:55:27 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96BDA1AD2; Mon, 18 Jul 2016 01:55:27 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I1tQqV096042; Mon, 18 Jul 2016 01:55:26 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I1tQZM096034; Mon, 18 Jul 2016 01:55:26 GMT (envelope-from will@FreeBSD.org) Message-Id: <201607180155.u6I1tQZM096034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Mon, 18 Jul 2016 01:55:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302976 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 01:55:27 -0000 Author: will Date: Mon Jul 18 01:55:25 2016 New Revision: 302976 URL: https://svnweb.freebsd.org/changeset/base/302976 Log: libkvm: Improve physical address lookup scaling. Instead of using a hash table to convert physical page addresses to offsets in the sparse page array, cache the number of bits set for each 4MB chunk of physical pages. Upon lookup, find the nearest cached population count, then add/subtract the number of bits from that point to the page's PTE bit. Then multiply by page size and add to the sparse page map's base offset. This replaces O(n) worst-case lookup with O(1) (plus a small number of bits to scan in the bitmap). Also, for a 128GB system, a typical kernel core of about 8GB will now only require ~4.5MB of RAM for this approach instead of ~48MB as with the hash table. More concretely, /usr/sbin/crashinfo against the same core improves from a max RSS of 188MB and wall time of 43.72s (33.25 user 2.94 sys) to 135MB and 9.43s (2.58 user 1.47 sys). Running "thread apply all bt" in kgdb has a similar RSS improvement, and wall time drops from 4.44s to 1.93s. Reviewed by: jhb Sponsored by: Backtrace I/O Modified: head/lib/libkvm/kvm.c head/lib/libkvm/kvm_minidump_aarch64.c head/lib/libkvm/kvm_minidump_amd64.c head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c head/lib/libkvm/kvm_private.c head/lib/libkvm/kvm_private.h Modified: head/lib/libkvm/kvm.c ============================================================================== --- head/lib/libkvm/kvm.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm.c Mon Jul 18 01:55:25 2016 (r302976) @@ -283,6 +283,8 @@ kvm_close(kvm_t *kd) free((void *) kd->argspc); if (kd->argv != 0) free((void *)kd->argv); + if (kd->pt_map != NULL) + free(kd->pt_map); free((void *)kd); return (0); Modified: head/lib/libkvm/kvm_minidump_aarch64.c ============================================================================== --- head/lib/libkvm/kvm_minidump_aarch64.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_aarch64.c Mon Jul 18 01:55:25 2016 (r302976) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; uint64_t *page_map; }; @@ -67,7 +66,6 @@ _aarch64_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); free(vm->page_map); free(vm); kd->vmst = NULL; @@ -77,8 +75,7 @@ static int _aarch64_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint64_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -114,19 +111,12 @@ _aarch64_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = AARCH64_PAGE_SIZE + aarch64_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, - "cannot allocate %d bytes for bitmap", - vmst->hdr.bitmapsize); - return (-1); - } - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, - "cannot read %d bytes for page bitmap", - vmst->hdr.bitmapsize); - free(bitmap); + /* build physical address lookup table for sparse pages */ + sparse_off = off + aarch64_round_page(vmst->hdr.bitmapsize) + + aarch64_round_page(vmst->hdr.pmapsize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + AARCH64_PAGE_SIZE, sizeof(uint64_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += aarch64_round_page(vmst->hdr.bitmapsize); @@ -136,7 +126,6 @@ _aarch64_minidump_initvtop(kvm_t *kd) _kvm_err(kd, kd->program, "cannot allocate %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); return (-1); } /* This is the end of the dump, savecore may have truncated it. */ @@ -149,15 +138,9 @@ _aarch64_minidump_initvtop(kvm_t *kd) AARCH64_PAGE_SIZE) { _kvm_err(kd, kd->program, "cannot read %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); return (-1); } - off += vmst->hdr.pmapsize; - - /* build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - AARCH64_PAGE_SIZE, sizeof(*bitmap)); - free(bitmap); + off += aarch64_round_page(vmst->hdr.pmapsize); return (0); } @@ -178,7 +161,7 @@ _aarch64_minidump_vatop(kvm_t *kd, kvadd if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) { a = (va - vm->hdr.dmapbase + vm->hdr.dmapphys) & ~AARCH64_PAGE_MASK; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_aarch64_minidump_vatop: " "direct map address 0x%jx not in minidump", @@ -198,7 +181,7 @@ _aarch64_minidump_vatop(kvm_t *kd, kvadd goto invalid; } a = l3 & ~AARCH64_ATTR_MASK; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_aarch64_minidump_vatop: " "physical address 0x%jx not in minidump", Modified: head/lib/libkvm/kvm_minidump_amd64.c ============================================================================== --- head/lib/libkvm/kvm_minidump_amd64.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_amd64.c Mon Jul 18 01:55:25 2016 (r302976) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; amd64_pte_t *page_map; }; @@ -66,9 +65,7 @@ _amd64_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); - if (vm->page_map) - free(vm->page_map); + free(vm->page_map); free(vm); kd->vmst = NULL; } @@ -77,8 +74,7 @@ static int _amd64_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint64_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -116,37 +112,28 @@ _amd64_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = AMD64_PAGE_SIZE + amd64_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, "cannot allocate %d bytes for bitmap", vmst->hdr.bitmapsize); - return (-1); - } - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", vmst->hdr.bitmapsize); - free(bitmap); + sparse_off = off + amd64_round_page(vmst->hdr.bitmapsize) + + amd64_round_page(vmst->hdr.pmapsize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + AMD64_PAGE_SIZE, sizeof(uint64_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += amd64_round_page(vmst->hdr.bitmapsize); vmst->page_map = _kvm_malloc(kd, vmst->hdr.pmapsize); if (vmst->page_map == NULL) { - _kvm_err(kd, kd->program, "cannot allocate %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); + _kvm_err(kd, kd->program, "cannot allocate %d bytes for page_map", + vmst->hdr.pmapsize); return (-1); } if (pread(kd->pmfd, vmst->page_map, vmst->hdr.pmapsize, off) != (ssize_t)vmst->hdr.pmapsize) { - _kvm_err(kd, kd->program, "cannot read %d bytes for page_map", vmst->hdr.pmapsize); - free(bitmap); + _kvm_err(kd, kd->program, "cannot read %d bytes for page_map", + vmst->hdr.pmapsize); return (-1); } - off += vmst->hdr.pmapsize; - - /* build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - AMD64_PAGE_SIZE, sizeof(*bitmap)); - free(bitmap); + off += amd64_round_page(vmst->hdr.pmapsize); return (0); } @@ -175,7 +162,7 @@ _amd64_minidump_vatop_v1(kvm_t *kd, kvad goto invalid; } a = pte & AMD64_PG_FRAME; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_amd64_minidump_vatop_v1: physical address 0x%jx not in minidump", @@ -186,7 +173,7 @@ _amd64_minidump_vatop_v1(kvm_t *kd, kvad return (AMD64_PAGE_SIZE - offset); } else if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) { a = (va - vm->hdr.dmapbase) & ~AMD64_PAGE_MASK; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_amd64_minidump_vatop_v1: direct map address 0x%jx not in minidump", @@ -235,20 +222,20 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_ } if ((pde & AMD64_PG_PS) == 0) { a = pde & AMD64_PG_FRAME; - ofs = _kvm_hpt_find(&vm->hpt, a); + /* TODO: Just read the single PTE */ + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, - "_amd64_minidump_vatop: pt physical address 0x%jx not in minidump", + "cannot find page table entry for %ju", (uintmax_t)a); goto invalid; } - /* TODO: Just read the single PTE */ if (pread(kd->pmfd, &pt, AMD64_PAGE_SIZE, ofs) != AMD64_PAGE_SIZE) { _kvm_err(kd, kd->program, - "cannot read %d bytes for page table", - AMD64_PAGE_SIZE); - return (-1); + "cannot read page table entry for %ju", + (uintmax_t)a); + goto invalid; } pteindex = (va >> AMD64_PAGE_SHIFT) & (AMD64_NPTEPG - 1); @@ -263,7 +250,7 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_ a = pde & AMD64_PG_PS_FRAME; a += (va & AMD64_PDRMASK) ^ offset; } - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_amd64_minidump_vatop: physical address 0x%jx not in minidump", @@ -274,7 +261,7 @@ _amd64_minidump_vatop(kvm_t *kd, kvaddr_ return (AMD64_PAGE_SIZE - offset); } else if (va >= vm->hdr.dmapbase && va < vm->hdr.dmapend) { a = (va - vm->hdr.dmapbase) & ~AMD64_PAGE_MASK; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_amd64_minidump_vatop: direct map address 0x%jx not in minidump", Modified: head/lib/libkvm/kvm_minidump_arm.c ============================================================================== --- head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_arm.c Mon Jul 18 01:55:25 2016 (r302976) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; void *ptemap; unsigned char ei_data; }; @@ -69,9 +68,7 @@ _arm_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); - if (vm->ptemap) - free(vm->ptemap); + free(vm->ptemap); free(vm); kd->vmst = NULL; } @@ -80,8 +77,7 @@ static int _arm_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint32_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -122,18 +118,11 @@ _arm_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = ARM_PAGE_SIZE + arm_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, "cannot allocate %d bytes for " - "bitmap", vmst->hdr.bitmapsize); - return (-1); - } - - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", - vmst->hdr.bitmapsize); - free(bitmap); + sparse_off = off + arm_round_page(vmst->hdr.bitmapsize) + + arm_round_page(vmst->hdr.ptesize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + ARM_PAGE_SIZE, sizeof(uint32_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += arm_round_page(vmst->hdr.bitmapsize); @@ -142,7 +131,6 @@ _arm_minidump_initvtop(kvm_t *kd) if (vmst->ptemap == NULL) { _kvm_err(kd, kd->program, "cannot allocate %d bytes for " "ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } @@ -150,16 +138,9 @@ _arm_minidump_initvtop(kvm_t *kd) (ssize_t)vmst->hdr.ptesize) { _kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } - - off += vmst->hdr.ptesize; - - /* Build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - ARM_PAGE_SIZE, sizeof(*bitmap)); - free(bitmap); + off += arm_round_page(vmst->hdr.ptesize); return (0); } @@ -209,7 +190,7 @@ _arm_minidump_kvatop(kvm_t *kd, kvaddr_t a = pte & ARM_L2_S_FRAME; } - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_arm_minidump_kvatop: " "physical address 0x%jx not in minidump", Modified: head/lib/libkvm/kvm_minidump_i386.c ============================================================================== --- head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_i386.c Mon Jul 18 01:55:25 2016 (r302976) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; void *ptemap; }; @@ -66,9 +65,7 @@ _i386_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); - if (vm->ptemap) - free(vm->ptemap); + free(vm->ptemap); free(vm); kd->vmst = NULL; } @@ -77,8 +74,7 @@ static int _i386_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint32_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -110,15 +106,11 @@ _i386_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = I386_PAGE_SIZE + i386_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, "cannot allocate %d bytes for bitmap", vmst->hdr.bitmapsize); - return (-1); - } - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", vmst->hdr.bitmapsize); - free(bitmap); + sparse_off = off + i386_round_page(vmst->hdr.bitmapsize) + + i386_round_page(vmst->hdr.ptesize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + I386_PAGE_SIZE, sizeof(uint32_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += i386_round_page(vmst->hdr.bitmapsize); @@ -126,21 +118,14 @@ _i386_minidump_initvtop(kvm_t *kd) vmst->ptemap = _kvm_malloc(kd, vmst->hdr.ptesize); if (vmst->ptemap == NULL) { _kvm_err(kd, kd->program, "cannot allocate %d bytes for ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } if (pread(kd->pmfd, vmst->ptemap, vmst->hdr.ptesize, off) != (ssize_t)vmst->hdr.ptesize) { _kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } - off += vmst->hdr.ptesize; - - /* build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - I386_PAGE_SIZE, sizeof(*bitmap)); - free(bitmap); + off += i386_round_page(vmst->hdr.ptesize); return (0); } @@ -171,7 +156,7 @@ _i386_minidump_vatop_pae(kvm_t *kd, kvad goto invalid; } a = pte & I386_PG_FRAME_PAE; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_i386_minidump_vatop_pae: physical address 0x%jx not in minidump", @@ -218,7 +203,7 @@ _i386_minidump_vatop(kvm_t *kd, kvaddr_t goto invalid; } a = pte & I386_PG_FRAME; - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_i386_minidump_vatop: physical address 0x%jx not in minidump", Modified: head/lib/libkvm/kvm_minidump_mips.c ============================================================================== --- head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_minidump_mips.c Mon Jul 18 01:55:25 2016 (r302976) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); struct vmstate { struct minidumphdr hdr; - struct hpt hpt; void *ptemap; int pte_size; }; @@ -74,9 +73,7 @@ _mips_minidump_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; - _kvm_hpt_free(&vm->hpt); - if (vm->ptemap) - free(vm->ptemap); + free(vm->ptemap); free(vm); kd->vmst = NULL; } @@ -85,8 +82,7 @@ static int _mips_minidump_initvtop(kvm_t *kd) { struct vmstate *vmst; - uint32_t *bitmap; - off_t off; + off_t off, sparse_off; vmst = _kvm_malloc(kd, sizeof(*vmst)); if (vmst == NULL) { @@ -129,18 +125,11 @@ _mips_minidump_initvtop(kvm_t *kd) /* Skip header and msgbuf */ off = MIPS_PAGE_SIZE + mips_round_page(vmst->hdr.msgbufsize); - bitmap = _kvm_malloc(kd, vmst->hdr.bitmapsize); - if (bitmap == NULL) { - _kvm_err(kd, kd->program, "cannot allocate %d bytes for " - "bitmap", vmst->hdr.bitmapsize); - return (-1); - } - - if (pread(kd->pmfd, bitmap, vmst->hdr.bitmapsize, off) != - (ssize_t)vmst->hdr.bitmapsize) { - _kvm_err(kd, kd->program, "cannot read %d bytes for page bitmap", - vmst->hdr.bitmapsize); - free(bitmap); + sparse_off = off + mips_round_page(vmst->hdr.bitmapsize) + + mips_round_page(vmst->hdr.ptesize); + if (_kvm_pt_init(kd, vmst->hdr.bitmapsize, off, sparse_off, + MIPS_PAGE_SIZE, sizeof(uint32_t)) == -1) { + _kvm_err(kd, kd->program, "cannot load core bitmap"); return (-1); } off += mips_round_page(vmst->hdr.bitmapsize); @@ -149,7 +138,6 @@ _mips_minidump_initvtop(kvm_t *kd) if (vmst->ptemap == NULL) { _kvm_err(kd, kd->program, "cannot allocate %d bytes for " "ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } @@ -157,16 +145,9 @@ _mips_minidump_initvtop(kvm_t *kd) (ssize_t)vmst->hdr.ptesize) { _kvm_err(kd, kd->program, "cannot read %d bytes for ptemap", vmst->hdr.ptesize); - free(bitmap); return (-1); } - - off += vmst->hdr.ptesize; - - /* Build physical address hash table for sparse pages */ - _kvm_hpt_init(kd, &vmst->hpt, bitmap, vmst->hdr.bitmapsize, off, - MIPS_PAGE_SIZE, sizeof(*bitmap)); - free(bitmap); + off += mips_round_page(vmst->hdr.ptesize); return (0); } @@ -243,7 +224,7 @@ _mips_minidump_kvatop(kvm_t *kd, kvaddr_ } found: - ofs = _kvm_hpt_find(&vm->hpt, a); + ofs = _kvm_pt_find(kd, a); if (ofs == -1) { _kvm_err(kd, kd->program, "_mips_minidump_kvatop: physical " "address 0x%jx not in minidump", (uintmax_t)a); Modified: head/lib/libkvm/kvm_private.c ============================================================================== --- head/lib/libkvm/kvm_private.c Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_private.c Mon Jul 18 01:55:25 2016 (r302976) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -213,73 +214,178 @@ bad: return (-1); } -static void -_kvm_hpt_insert(struct hpt *hpt, uint64_t pa, off_t off) +/* + * Transform v such that only bits [bit0, bitN) may be set. Generates a + * bitmask covering the number of bits, then shifts so +bit0+ is the first. + */ +static uint64_t +bitmask_range(uint64_t v, uint64_t bit0, uint64_t bitN) { - struct hpte *hpte; - uint32_t fnv = FNV1_32_INIT; + if (bit0 == 0 && bitN == BITS_IN(v)) + return (v); - fnv = fnv_32_buf(&pa, sizeof(pa), fnv); - fnv &= (HPT_SIZE - 1); - hpte = malloc(sizeof(*hpte)); - hpte->pa = pa; - hpte->off = off; - hpte->next = hpt->hpt_head[fnv]; - hpt->hpt_head[fnv] = hpte; + return (v & (((1ULL << (bitN - bit0)) - 1ULL) << bit0)); } -void -_kvm_hpt_init(kvm_t *kd, struct hpt *hpt, void *base, size_t len, off_t off, - int page_size, int word_size) +/* + * Returns the number of bits in a given byte array range starting at a + * given base, from bit0 to bitN. bit0 may be non-zero in the case of + * counting backwards from bitN. + */ +static uint64_t +popcount_bytes(uint64_t *addr, uint32_t bit0, uint32_t bitN) { - uint64_t bits, idx, pa; - uint64_t *base64; - uint32_t *base32; - - base64 = base; - base32 = base; - for (idx = 0; idx < len / word_size; idx++) { - if (word_size == sizeof(uint64_t)) - bits = _kvm64toh(kd, base64[idx]); - else - bits = _kvm32toh(kd, base32[idx]); - pa = idx * word_size * NBBY * page_size; - for (; bits != 0; bits >>= 1, pa += page_size) { - if ((bits & 1) == 0) - continue; - _kvm_hpt_insert(hpt, pa, off); - off += page_size; - } + uint32_t res = bitN - bit0; + uint64_t count = 0; + uint32_t bound; + + /* Align to 64-bit boundary on the left side if needed. */ + if ((bit0 % BITS_IN(*addr)) != 0) { + bound = MIN(bitN, roundup2(bit0, BITS_IN(*addr))); + count += __bitcount64(bitmask_range(*addr, bit0, bound)); + res -= (bound - bit0); + addr++; + } + + while (res > 0) { + bound = MIN(res, BITS_IN(*addr)); + count += __bitcount64(bitmask_range(*addr, 0, bound)); + res -= bound; + addr++; } + + return (count); } -off_t -_kvm_hpt_find(struct hpt *hpt, uint64_t pa) +int +_kvm_pt_init(kvm_t *kd, size_t map_len, off_t map_off, off_t sparse_off, + int page_size, int word_size) { - struct hpte *hpte; - uint32_t fnv = FNV1_32_INIT; + uint64_t *addr; + uint32_t *popcount_bin; + int bin_popcounts = 0; + uint64_t pc_bins, res; + ssize_t rd; - fnv = fnv_32_buf(&pa, sizeof(pa), fnv); - fnv &= (HPT_SIZE - 1); - for (hpte = hpt->hpt_head[fnv]; hpte != NULL; hpte = hpte->next) { - if (pa == hpte->pa) - return (hpte->off); + /* + * Map the bitmap specified by the arguments. + */ + kd->pt_map = _kvm_malloc(kd, map_len); + if (kd->pt_map == NULL) { + _kvm_err(kd, kd->program, "cannot allocate %zu bytes for bitmap", + map_len); + return (-1); } - return (-1); + rd = pread(kd->pmfd, kd->pt_map, map_len, map_off); + if (rd < 0 || rd != (ssize_t)map_len) { + _kvm_err(kd, kd->program, "cannot read %zu bytes for bitmap", + map_len); + return (-1); + } + kd->pt_map_size = map_len; + + /* + * Generate a popcount cache for every POPCOUNT_BITS in the bitmap, + * so lookups only have to calculate the number of bits set between + * a cache point and their bit. This reduces lookups to O(1), + * without significantly increasing memory requirements. + * + * Round up the number of bins so that 'upper half' lookups work for + * the final bin, if needed. The first popcount is 0, since no bits + * precede bit 0, so add 1 for that also. Without this, extra work + * would be needed to handle the first PTEs in _kvm_pt_find(). + */ + addr = kd->pt_map; + res = map_len; + pc_bins = 1 + (res * NBBY + POPCOUNT_BITS / 2) / POPCOUNT_BITS; + kd->pt_popcounts = calloc(pc_bins, sizeof(uint32_t)); + if (kd->pt_popcounts == NULL) + return (-1); + + for (popcount_bin = &kd->pt_popcounts[1]; res > 0; + addr++, res -= sizeof(*addr)) { + *popcount_bin += popcount_bytes(addr, 0, + MIN(res * NBBY, BITS_IN(*addr))); + if (++bin_popcounts == POPCOUNTS_IN(*addr)) { + popcount_bin++; + *popcount_bin = *(popcount_bin - 1); + bin_popcounts = 0; + } + } + + assert(pc_bins * sizeof(*popcount_bin) == + ((uintptr_t)popcount_bin - (uintptr_t)kd->pt_popcounts)); + + kd->pt_sparse_off = sparse_off; + kd->pt_sparse_size = (uint64_t)*popcount_bin * PAGE_SIZE; + kd->pt_page_size = page_size; + kd->pt_word_size = word_size; + return (0); } -void -_kvm_hpt_free(struct hpt *hpt) +/* + * Find the offset for the given physical page address; returns -1 otherwise. + * + * A page's offset is represented by the sparse page base offset plus the + * number of bits set before its bit multiplied by PAGE_SIZE. This means + * that if a page exists in the dump, it's necessary to know how many pages + * in the dump precede it. Reduce this O(n) counting to O(1) by caching the + * number of bits set at POPCOUNT_BITS intervals. + * + * Then to find the number of pages before the requested address, simply + * index into the cache and count the number of bits set between that cache + * bin and the page's bit. Halve the number of bytes that have to be + * checked by also counting down from the next higher bin if it's closer. + */ +off_t +_kvm_pt_find(kvm_t *kd, uint64_t pa) { - struct hpte *hpte, *next; - int i; + uint64_t *bitmap = kd->pt_map; + uint64_t pte_bit_id = pa / PAGE_SIZE; + uint64_t pte_u64 = pte_bit_id / BITS_IN(*bitmap); + uint64_t popcount_id = pte_bit_id / POPCOUNT_BITS; + uint64_t pte_mask = 1ULL << (pte_bit_id % BITS_IN(*bitmap)); + uint64_t bitN; + uint32_t count; + + /* Check whether the page address requested is in the dump. */ + if (pte_bit_id >= (kd->pt_map_size * NBBY) || + (bitmap[pte_u64] & pte_mask) == 0) + return (-1); - for (i = 0; i < HPT_SIZE; i++) { - for (hpte = hpt->hpt_head[i]; hpte != NULL; hpte = next) { - next = hpte->next; - free(hpte); - } + /* + * Add/sub popcounts from the bitmap until the PTE's bit is reached. + * For bits that are in the upper half between the calculated + * popcount id and the next one, use the next one and subtract to + * minimize the number of popcounts required. + */ + if ((pte_bit_id % POPCOUNT_BITS) < (POPCOUNT_BITS / 2)) { + count = kd->pt_popcounts[popcount_id] + popcount_bytes( + bitmap + popcount_id * POPCOUNTS_IN(*bitmap), + 0, pte_bit_id - popcount_id * POPCOUNT_BITS); + } else { + /* + * Counting in reverse is trickier, since we must avoid + * reading from bytes that are not in range, and invert. + */ + uint64_t pte_u64_bit_off = pte_u64 * BITS_IN(*bitmap); + + popcount_id++; + bitN = MIN(popcount_id * POPCOUNT_BITS, + kd->pt_map_size * BITS_IN(uint8_t)); + count = kd->pt_popcounts[popcount_id] - popcount_bytes( + bitmap + pte_u64, + pte_bit_id - pte_u64_bit_off, bitN - pte_u64_bit_off); } + + /* + * This can only happen if the core is truncated. Treat these + * entries as if they don't exist, since their backing doesn't. + */ + if (count >= (kd->pt_sparse_size / PAGE_SIZE)) + return (-1); + + return (kd->pt_sparse_off + (uint64_t)count * PAGE_SIZE); } static int Modified: head/lib/libkvm/kvm_private.h ============================================================================== --- head/lib/libkvm/kvm_private.h Mon Jul 18 01:03:39 2016 (r302975) +++ head/lib/libkvm/kvm_private.h Mon Jul 18 01:55:25 2016 (r302976) @@ -97,23 +97,21 @@ struct __kvm { uintptr_t *dpcpu_off; /* base array, indexed by CPU ID */ u_int dpcpu_curcpu; /* CPU we're currently working with */ kvaddr_t dpcpu_curoff; /* dpcpu base of current CPU */ -}; -/* - * Page table hash used by minidump backends to map physical addresses - * to file offsets. - */ -struct hpte { - struct hpte *next; - uint64_t pa; - off_t off; + /* Page table lookup structures. */ + uint64_t *pt_map; + size_t pt_map_size; + off_t pt_sparse_off; + uint64_t pt_sparse_size; + uint32_t *pt_popcounts; + unsigned int pt_page_size; + unsigned int pt_word_size; }; -#define HPT_SIZE 1024 - -struct hpt { - struct hpte *hpt_head[HPT_SIZE]; -}; +/* Page table lookup constants. */ +#define POPCOUNT_BITS 1024 +#define BITS_IN(v) (sizeof(v) * NBBY) +#define POPCOUNTS_IN(v) (POPCOUNT_BITS / BITS_IN(v)) /* * Functions used internally by kvm, but across kvm modules. @@ -154,6 +152,5 @@ kvaddr_t _kvm_dpcpu_validaddr(kvm_t *, k int _kvm_probe_elf_kernel(kvm_t *, int, int); int _kvm_is_minidump(kvm_t *); int _kvm_read_core_phdrs(kvm_t *, size_t *, GElf_Phdr **); -void _kvm_hpt_init(kvm_t *, struct hpt *, void *, size_t, off_t, int, int); -off_t _kvm_hpt_find(struct hpt *, uint64_t); -void _kvm_hpt_free(struct hpt *); +int _kvm_pt_init(kvm_t *, size_t, off_t, off_t, int, int); +off_t _kvm_pt_find(kvm_t *, uint64_t); From owner-svn-src-head@freebsd.org Mon Jul 18 02: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 E1336B9AFBA; Mon, 18 Jul 2016 02:13:58 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFC8113D8; Mon, 18 Jul 2016 02:13:58 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I2Dvbb003692; Mon, 18 Jul 2016 02:13:57 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I2DvL8003691; Mon, 18 Jul 2016 02:13:57 GMT (envelope-from will@FreeBSD.org) Message-Id: <201607180213.u6I2DvL8003691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Mon, 18 Jul 2016 02:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302977 - head/tools/build X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 02:13:59 -0000 Author: will Date: Mon Jul 18 02:13:57 2016 New Revision: 302977 URL: https://svnweb.freebsd.org/changeset/base/302977 Log: Add my beinstall script. This is meant to install a new BE (boot environment) given a fully built world/kernel. In addition to installing world and kernel in the new BE, it also automatically performs /etc updates (using etcupdate or mergemaster) and package updates (using pkg). Because this process is performed in a new BE, it reduces the need for a second reboot. It also means a reboot into a partially updated system (due to install or hardware failure) can't happen. Inspired by and similar in function to Solaris/illumos-style upgrades. Added: head/tools/build/beinstall.sh (contents, props changed) Added: head/tools/build/beinstall.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/beinstall.sh Mon Jul 18 02:13:57 2016 (r302977) @@ -0,0 +1,153 @@ +#!/bin/sh +# +# Copyright (c) 2016 Will Andrews +# 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. +# +# 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$ +# +## +# Install a boot environment using the current FreeBSD source tree. +# Requires a fully built world & kernel. +# +# Non-base tools required: beadm, pkg +# +# In a sandbox for the new boot environment, this script also runs etcupdate +# and pkg upgrade automatically in the sandbox. Upon successful completion, +# the system will be ready to boot into the new boot environment. Upon +# failure, the target boot environment will be destroyed. In all cases, the +# running system is left untouched. +# +## Usage: +# beinstall [optional world/kernel flags e.g. KERNCONF] +# +## User modifiable variables - set these in the environment if desired. +# If not empty, 'pkg upgrade' will be skipped. +NO_PKG_UPGRADE="${NO_PKG_UPGRADE:-""}" +# Config updater - 'etcupdate' and 'mergemaster' are supported. Set to an +# empty string to skip. +CONFIG_UPDATER="${CONFIG_UPDATER:-"etcupdate"}" +# Flags for etcupdate if used. +ETCUPDATE_FLAGS="${ETCUPDATE_FLAGS:-"-F"}" +# Flags for mergemaster if used. +MERGEMASTER_FLAGS="${MERGEMASTER_FLAGS:-"-iFU"}" + + +######################################################################## +## Constants +ETCUPDATE_CMD="etcupdate" +MERGEMASTER_CMD="mergemaster" + +## Functions +cleanup() { + [ -z "${cleanup_commands}" ] && return + echo "Cleaning up ..." + for command in ${cleanup_commands}; do + ${command} + done +} + +errx() { + cleanup + echo "error: $*" + exit 1 +} + +rmdir_be() { + chflags -R noschg ${BE_MNTPT} + rm -rf ${BE_MNTPT} +} + +cleanup_be() { + beadm destroy -F ${BENAME} +} + +update_mergemaster() { + mergemaster -m $(pwd) -D ${BE_MNTPT} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS} +} + +update_etcupdate() { + etcupdate -s $(pwd) -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $? + etcupdate resolve -D ${BE_MNTPT} +} + + +cleanup_commands="" +trap 'errx "Interrupt caught"' HUP INT TERM + +[ "$(whoami)" != "root" ] && errx "Must be run as root" + +[ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree" +objdir=$(make -V .OBJDIR 2>/dev/null) +[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree" + +if [ -d .git ] ; then + commit_time=$(git show --format='%ct' 2>/dev/null | head -1) + [ $? -ne 0 ] && errx "Can't lookup git commit timestamp" + commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S') +elif [ -d .svn ] ; then + commit_ts=$( svn info | awk '/Last Changed Date/ {print $4 "." $5}' | tr -d :- ) + [ $? -ne 0 ] && errx "Can't lookup Subversion commit timestamp" +else + errx "Unable to determine sandbox type" +fi + +commit_ver=$(${objdir}/bin/freebsd-version/freebsd-version -u 2>/dev/null) +[ -z "${commit_ver}" ] && errx "Unable to determine FreeBSD version" + +BENAME="${commit_ver}-${commit_ts}" + +BE_TMP=$(mktemp -d /tmp/beinstall.XXXXXX) +[ $? -ne 0 -o ! -d ${BE_TMP} ] && errx "Unable to create mountpoint" +[ -z "$NO_CLEANUP_BE" ] && cleanup_commands="rmdir_be ${cleanup_commands}" +BE_MNTPT=${BE_TMP}/mnt +BE_MM_ROOT=${BE_TMP}/mergemaster # mergemaster will create +mkdir -p ${BE_MNTPT} + +beadm create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}" +[ -z "$NO_CLEANUP_BE" ] && cleanup_commands="cleanup_be ${cleanup_commands}" + +beadm mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}." + +echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..." +make $* DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!" +make $* DESTDIR=${BE_MNTPT} installworld || errx "Installworld failed!" + +if [ -n "${CONFIG_UPDATER}" ]; then + "update_${CONFIG_UPDATER}" + [ $? -ne 0 ] && errx "${CONFIG_UPDATER} failed!" +fi + +BE_PKG="chroot ${BE_MNTPT} env ASSUME_ALWAYS_YES=true pkg" +if [ -z "${NO_PKG_UPGRADE}" ]; then + ${BE_PKG} update || errx "Unable to update pkg" + ${BE_PKG} upgrade || errx "Unable to upgrade pkgs" +fi + +beadm unmount ${BENAME} || errx "Unable to unmount BE" +rmdir_be +beadm activate ${BENAME} || errx "Unable to activate BE" +echo +beadm list +echo +echo "Boot environment ${BENAME} setup complete; reboot to use it." From owner-svn-src-head@freebsd.org Mon Jul 18 03:59: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 2EEC8B9C285; Mon, 18 Jul 2016 03:59:05 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9DF71F50; Mon, 18 Jul 2016 03:59:04 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I3x4ec041477; Mon, 18 Jul 2016 03:59:04 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I3x4n3041476; Mon, 18 Jul 2016 03:59:04 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201607180359.u6I3x4n3041476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Mon, 18 Jul 2016 03:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302978 - head/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: Mon, 18 Jul 2016 03:59:05 -0000 Author: sobomax Date: Mon Jul 18 03:59:03 2016 New Revision: 302978 URL: https://svnweb.freebsd.org/changeset/base/302978 Log: Don't print same value twice, one in decimal once in hex. This makes output more cryptic than it needs to be and wastes cpu cycles and console bandwidth. Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Jul 18 02:13:57 2016 (r302977) +++ head/sys/x86/x86/mp_x86.c Mon Jul 18 03:59:03 2016 (r302978) @@ -649,12 +649,10 @@ cpu_mp_announce(void) TOPO_FOREACH(node, &topo_root) { switch (node->type) { case TOPO_TYPE_PKG: - printf("Package HW ID = %u (%#x)\n", - node->hwid, node->hwid); + printf("Package HW ID = %u\n", node->hwid); break; case TOPO_TYPE_CORE: - printf("\tCore HW ID = %u (%#x)\n", - node->hwid, node->hwid); + printf("\tCore HW ID = %u\n", node->hwid); break; case TOPO_TYPE_PU: if (cpu_info[node->hwid].cpu_hyperthread) @@ -663,16 +661,14 @@ cpu_mp_announce(void) hyperthread = ""; if (node->subtype == 0) - printf("\t\tCPU (AP%s): APIC ID: %u (%#x)" - "(disabled)\n", hyperthread, node->hwid, - node->hwid); + printf("\t\tCPU (AP%s): APIC ID: %u" + "(disabled)\n", hyperthread, node->hwid); else if (node->id == 0) - printf("\t\tCPU0 (BSP): APIC ID: %u (%#x)\n", - node->hwid, node->hwid); - else - printf("\t\tCPU%u (AP%s): APIC ID: %u (%#x)\n", - node->id, hyperthread, node->hwid, + printf("\t\tCPU0 (BSP): APIC ID: %u\n", node->hwid); + else + printf("\t\tCPU%u (AP%s): APIC ID: %u\n", + node->id, hyperthread, node->hwid); break; default: /* ignored */ From owner-svn-src-head@freebsd.org Mon Jul 18 04:20: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 90D11B9C7B2; Mon, 18 Jul 2016 04:20:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6120D1A02; Mon, 18 Jul 2016 04:20:27 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I4KQH4049118; Mon, 18 Jul 2016 04:20:26 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I4KQYu049117; Mon, 18 Jul 2016 04:20:26 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201607180420.u6I4KQYu049117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 18 Jul 2016 04:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302980 - 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: Mon, 18 Jul 2016 04:20:27 -0000 Author: alc Date: Mon Jul 18 04:20:26 2016 New Revision: 302980 URL: https://svnweb.freebsd.org/changeset/base/302980 Log: Break up vm_fault()'s implementation of the read-ahead and delete-behind optimizations into two distinct pieces. The first piece consists of the code that should only be performed once per page fault and requires the map to be locked. The second piece consists of the code that should be performed each time a pager is called on an object in the shadow chain. (This second piece expects the map to be unlocked.) Previously, the entire implementation could be executed multiple times. Moreover, the second and subsequent executions would occur with the map unlocked. Usually, the ensuing unsynchronized accesses to the map were harmless because the map was not changing. Nonetheless, it was possible for a use-after-free error to occur, where vm_fault() wrote to a freed map entry. This change corrects that problem. Reported by: avg Reviewed by: kib MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Jul 18 04:16:53 2016 (r302979) +++ head/sys/vm/vm_fault.c Mon Jul 18 04:20:26 2016 (r302980) @@ -291,14 +291,17 @@ vm_fault_hold(vm_map_t map, vm_offset_t int hardfault; struct faultstate fs; struct vnode *vp; + vm_offset_t e_end, e_start; vm_page_t m; - int ahead, behind, cluster_offset, error, locked; + int ahead, behind, cluster_offset, error, locked, rv; + u_char behavior; hardfault = 0; growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; + nera = -1; RetryFault:; @@ -549,29 +552,25 @@ fast_failed: readrest: /* - * We have either allocated a new page or found an existing - * page that is only partially valid. - * - * Attempt to fault-in the page if there is a chance that the - * pager has it, and potentially fault in additional pages - * at the same time. + * If the pager for the current object might have the page, + * then determine the number of additional pages to read and + * potentially reprioritize previously read pages for earlier + * reclamation. These operations should only be performed + * once per page fault. Even if the current pager doesn't + * have the page, the number of additional pages to read will + * apply to subsequent objects in the shadow chain. */ - if (fs.object->type != OBJT_DEFAULT) { - int rv; - u_char behavior = vm_map_entry_behavior(fs.entry); - + if (fs.object->type != OBJT_DEFAULT && nera == -1 && + !P_KILLED(curproc)) { + KASSERT(fs.lookup_still_valid, ("map unlocked")); era = fs.entry->read_ahead; - if (behavior == MAP_ENTRY_BEHAV_RANDOM || - P_KILLED(curproc)) { - behind = 0; + behavior = vm_map_entry_behavior(fs.entry); + if (behavior == MAP_ENTRY_BEHAV_RANDOM) { nera = 0; - ahead = 0; } else if (behavior == MAP_ENTRY_BEHAV_SEQUENTIAL) { - behind = 0; nera = VM_FAULT_READ_AHEAD_MAX; - ahead = nera; if (vaddr == fs.entry->next_read) - vm_fault_dontneed(&fs, vaddr, ahead); + vm_fault_dontneed(&fs, vaddr, nera); } else if (vaddr == fs.entry->next_read) { /* * This is a sequential fault. Arithmetically @@ -580,42 +579,51 @@ readrest: * number of pages is "# of sequential faults * x (read ahead min + 1) + read ahead min" */ - behind = 0; nera = VM_FAULT_READ_AHEAD_MIN; if (era > 0) { nera += era + 1; if (nera > VM_FAULT_READ_AHEAD_MAX) nera = VM_FAULT_READ_AHEAD_MAX; } - ahead = nera; if (era == VM_FAULT_READ_AHEAD_MAX) - vm_fault_dontneed(&fs, vaddr, ahead); + vm_fault_dontneed(&fs, vaddr, nera); } else { /* - * This is a non-sequential fault. Request a - * cluster of pages that is aligned to a - * VM_FAULT_READ_DEFAULT page offset boundary - * within the object. Alignment to a page - * offset boundary is more likely to coincide - * with the underlying file system block than - * alignment to a virtual address boundary. + * This is a non-sequential fault. */ - cluster_offset = fs.pindex % - VM_FAULT_READ_DEFAULT; - behind = ulmin(cluster_offset, - atop(vaddr - fs.entry->start)); nera = 0; - ahead = VM_FAULT_READ_DEFAULT - 1 - - cluster_offset; } - ahead = ulmin(ahead, atop(fs.entry->end - vaddr) - 1); - if (era != nera) + if (era != nera) { + /* + * A read lock on the map suffices to update + * the read ahead count safely. + */ fs.entry->read_ahead = nera; + } /* - * Call the pager to retrieve the data, if any, after - * releasing the lock on the map. We hold a ref on - * fs.object and the pages are exclusive busied. + * Prepare for unlocking the map. Save the map + * entry's start and end addresses, which are used to + * optimize the size of the pager operation below. + * Even if the map entry's addresses change after + * unlocking the map, using the saved addresses is + * safe. + */ + e_start = fs.entry->start; + e_end = fs.entry->end; + } + + /* + * Call the pager to retrieve the page if there is a chance + * that the pager has it, and potentially retrieve additional + * pages at the same time. + */ + if (fs.object->type != OBJT_DEFAULT) { + /* + * We have either allocated a new page or found an + * existing page that is only partially valid. We + * hold a reference on fs.object and the page is + * exclusive busied. */ unlock_map(&fs); @@ -656,6 +664,35 @@ vnode_locked: * Page in the requested page and hint the pager, * that it may bring up surrounding pages. */ + if (nera == -1 || behavior == MAP_ENTRY_BEHAV_RANDOM || + P_KILLED(curproc)) { + behind = 0; + ahead = 0; + } else { + /* Is this a sequential fault? */ + if (nera > 0) { + behind = 0; + ahead = nera; + } else { + /* + * Request a cluster of pages that is + * aligned to a VM_FAULT_READ_DEFAULT + * page offset boundary within the + * object. Alignment to a page offset + * boundary is more likely to coincide + * with the underlying file system + * block than alignment to a virtual + * address boundary. + */ + cluster_offset = fs.pindex % + VM_FAULT_READ_DEFAULT; + behind = ulmin(cluster_offset, + atop(vaddr - e_start)); + ahead = VM_FAULT_READ_DEFAULT - 1 - + cluster_offset; + } + ahead = ulmin(ahead, atop(e_end - vaddr) - 1); + } rv = vm_pager_get_pages(fs.object, &fs.m, 1, &behind, &ahead); if (rv == VM_PAGER_OK) { From owner-svn-src-head@freebsd.org Mon Jul 18 04:30: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 3931FB9CA38; Mon, 18 Jul 2016 04:30:36 +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 06D9B119F; Mon, 18 Jul 2016 04:30:35 +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 u6I4UZQJ054066; Mon, 18 Jul 2016 04:30:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I4UZQ3054065; Mon, 18 Jul 2016 04:30:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607180430.u6I4UZQ3054065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Jul 2016 04:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302981 - 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, 18 Jul 2016 04:30:36 -0000 Author: kib Date: Mon Jul 18 04:30:34 2016 New Revision: 302981 URL: https://svnweb.freebsd.org/changeset/base/302981 Log: Fix another bug after r302350. Reported and tested by: pho PR: 210884 Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Jul 18 04:20:26 2016 (r302980) +++ head/sys/kern/kern_exit.c Mon Jul 18 04:30:34 2016 (r302981) @@ -345,7 +345,7 @@ exit1(struct thread *td, int rval, int s * executing, prevent it from rearming itself and let it finish. */ if (timevalisset(&p->p_realtimer.it_value) && - callout_stop(&p->p_itcallout) == 0) { + _callout_stop_safe(&p->p_itcallout, CS_EXECUTING, NULL) == 0) { timevalclear(&p->p_realtimer.it_interval); msleep(&p->p_itcallout, &p->p_mtx, PWAIT, "ritwait", 0); KASSERT(!timevalisset(&p->p_realtimer.it_value), From owner-svn-src-head@freebsd.org Mon Jul 18 05:00: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 6F3BEB9CED3; Mon, 18 Jul 2016 05:00:02 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 343B4105A; Mon, 18 Jul 2016 05:00:02 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I5017t063744; Mon, 18 Jul 2016 05:00:01 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I501CX063743; Mon, 18 Jul 2016 05:00:01 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201607180500.u6I501CX063743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Mon, 18 Jul 2016 05:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302985 - head/sys/geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 05:00:02 -0000 Author: sobomax Date: Mon Jul 18 05:00:01 2016 New Revision: 302985 URL: https://svnweb.freebsd.org/changeset/base/302985 Log: Relax checking if the privider size matches size recorded in the superblock, allowing provider to be bit bigger, i.e. have some extra padding after the FS image. That in some cases might be a side-effect of using CLOOP format which enforces certain block size and trying to compress image that is not exactly the number of those blocks in size. The UFS itself does not have any issues mounting such padded file systems, so it's what GEOM_LABEL should do. Submitted by: @mizhka_gmail.com Differential Revision: https://reviews.freebsd.org/D6208 Modified: head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/label/g_label_ufs.c ============================================================================== --- head/sys/geom/label/g_label_ufs.c Mon Jul 18 04:36:18 2016 (r302984) +++ head/sys/geom/label/g_label_ufs.c Mon Jul 18 05:00:01 2016 (r302985) @@ -45,6 +45,15 @@ __FBSDID("$FreeBSD$"); #define G_LABEL_UFS_VOLUME 0 #define G_LABEL_UFS_ID 1 +/* + * G_LABEL_UFS_CMP returns true if difference between provider mediasize + * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors + */ +#define G_LABEL_UFS_CMP(prov, fsys, size) \ + ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ + < G_LABEL_UFS_MAXDIFF ) +#define G_LABEL_UFS_MAXDIFF 0x100 + static const int superblocks[] = SBLOCKSEARCH; static void @@ -82,18 +91,35 @@ g_label_ufs_taste_common(struct g_consum if (fs == NULL) continue; /* - * Check for magic. We also need to check if file system size is equal - * to providers size, because sysinstall(8) used to bogusly put first - * partition at offset 0 instead of 16, and glabel/ufs would find file - * system on slice instead of partition. + * Check for magic. We also need to check if file system size + * is almost equal to providers size, because sysinstall(8) + * used to bogusly put first partition at offset 0 + * instead of 16, and glabel/ufs would find file system on slice + * instead of partition. + * + * In addition, media size can be a bit bigger than file system + * size. For instance, mkuzip can append bytes to align data + * to large sector size (it improves compression rates). */ + switch (fs->fs_magic){ + case FS_UFS1_MAGIC: + case FS_UFS2_MAGIC: + G_LABEL_DEBUG(1, "%s %s params: %jd, %d, %d, %jd\n", + fs->fs_magic == FS_UFS1_MAGIC ? "UFS1" : "UFS2", + pp->name, pp->mediasize, fs->fs_fsize, + fs->fs_old_size, fs->fs_providersize); + break; + default: + break; + } + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - ((pp->mediasize / fs->fs_fsize == fs->fs_old_size) || - (pp->mediasize / fs->fs_fsize == fs->fs_providersize))) { + ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) + || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS1. */ } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - ((pp->mediasize / fs->fs_fsize == fs->fs_size) || - (pp->mediasize / fs->fs_fsize == fs->fs_providersize))) { + ( G_LABEL_UFS_CMP(pp, fs, fs_size) + || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { /* Valid UFS2. */ } else { g_free(fs); From owner-svn-src-head@freebsd.org Mon Jul 18 05:36: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 896F6B9C73B; Mon, 18 Jul 2016 05:36: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 3DADA125C; Mon, 18 Jul 2016 05:36: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 u6I5aVi0078531; Mon, 18 Jul 2016 05:36:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I5aV3q078528; Mon, 18 Jul 2016 05:36:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607180536.u6I5aV3q078528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 18 Jul 2016 05:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302986 - 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, 18 Jul 2016 05:36:32 -0000 Author: sephe Date: Mon Jul 18 05:36:31 2016 New Revision: 302986 URL: https://svnweb.freebsd.org/changeset/base/302986 Log: hyperv/vmbus: Cosmetic vmbus channel open cleanup MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7217 Modified: head/sys/dev/hyperv/include/hyperv.h 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 Mon Jul 18 05:00:01 2016 (r302985) +++ head/sys/dev/hyperv/include/hyperv.h Mon Jul 18 05:36:31 2016 (r302986) @@ -276,15 +276,9 @@ hv_set_channel_read_state(hv_vmbus_chann channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } -int hv_vmbus_channel_open( - hv_vmbus_channel* channel, - uint32_t send_ring_buffer_size, - uint32_t recv_ring_buffer_size, - void* user_data, - uint32_t user_data_len, - vmbus_chan_callback_t cb, - void *cbarg); - +int hv_vmbus_channel_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 18 05:00:01 2016 (r302985) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Mon Jul 18 05:36:31 2016 (r302986) @@ -201,93 +201,75 @@ vmbus_chan_sysctl_create(struct hv_vmbus } } -/** - * @brief Open the specified channel - */ int -hv_vmbus_channel_open( - hv_vmbus_channel* new_channel, - uint32_t send_ring_buffer_size, - uint32_t recv_ring_buffer_size, - void* user_data, - uint32_t user_data_len, - vmbus_chan_callback_t cb, - void *cbarg) +hv_vmbus_channel_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg) { - struct vmbus_softc *sc = new_channel->vmbus_sc; + struct vmbus_softc *sc = chan->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; + int error; uint8_t *br; - if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, - "invalid udata len %u for chan%u\n", - user_data_len, new_channel->ch_id); + "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } - KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((txbr_size & PAGE_MASK) == 0, ("send bufring size is not multiple page")); - KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((rxbr_size & PAGE_MASK) == 0, ("recv bufring size is not multiple page")); - if (atomic_testandset_int(&new_channel->ch_stflags, + if (atomic_testandset_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) - panic("double-open chan%u", new_channel->ch_id); + panic("double-open chan%u", chan->ch_id); - new_channel->ch_cb = cb; - new_channel->ch_cbarg = cbarg; + chan->ch_cb = cb; + chan->ch_cbarg = cbarg; - vmbus_chan_update_evtflagcnt(sc, new_channel); + vmbus_chan_update_evtflagcnt(sc, chan); - 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->ch_task, 0, vmbus_chan_task, - new_channel); - } else { - TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, - new_channel); - } + chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); + else + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); /* * 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); + PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (br == NULL) { device_printf(sc->vmbus_dev, "bufring allocation failed\n"); - ret = ENOMEM; + error = ENOMEM; goto failed; } - new_channel->ch_bufring = br; + chan->ch_bufring = br; /* TX bufring comes first */ - hv_vmbus_ring_buffer_init(&new_channel->outbound, - br, send_ring_buffer_size); + hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size); /* RX bufring immediately follows TX bufring */ - hv_vmbus_ring_buffer_init(&new_channel->inbound, - br + send_ring_buffer_size, recv_ring_buffer_size); + hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size); /* Create sysctl tree for this channel */ - vmbus_chan_sysctl_create(new_channel); + vmbus_chan_sysctl_create(chan); /* * Connect the bufrings, both RX and TX, to this channel. */ - ret = vmbus_chan_gpadl_connect(new_channel, - new_channel->ch_bufring_dma.hv_paddr, - send_ring_buffer_size + recv_ring_buffer_size, - &new_channel->ch_bufring_gpadl); - if (ret != 0) { + error = vmbus_chan_gpadl_connect(chan, chan->ch_bufring_dma.hv_paddr, + txbr_size + rxbr_size, &chan->ch_bufring_gpadl); + if (error) { device_printf(sc->vmbus_dev, - "failed to connect bufring GPADL to chan%u\n", - new_channel->ch_id); + "failed to connect bufring GPADL to chan%u\n", chan->ch_id); goto failed; } @@ -298,26 +280,26 @@ hv_vmbus_channel_open( if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", - new_channel->ch_id); - ret = ENXIO; + chan->ch_id); + error = ENXIO; goto failed; } req = vmbus_msghc_dataptr(mh); 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->ch_bufring_gpadl; - 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); + req->chm_chanid = chan->ch_id; + req->chm_openid = chan->ch_id; + req->chm_gpadl = chan->ch_bufring_gpadl; + req->chm_vcpuid = chan->ch_vcpuid; + req->chm_txbr_pgcnt = txbr_size >> PAGE_SHIFT; + if (udlen > 0) + memcpy(req->chm_udata, udata, udlen); - ret = vmbus_msghc_exec(sc, mh); - if (ret != 0) { + error = vmbus_msghc_exec(sc, mh); + if (error) { device_printf(sc->vmbus_dev, "chopen(chan%u) msg hypercall exec failed: %d\n", - new_channel->ch_id, ret); + chan->ch_id, error); vmbus_msghc_put(sc, mh); goto failed; } @@ -331,28 +313,25 @@ hv_vmbus_channel_open( if (status == 0) { if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", - new_channel->ch_id); + chan->ch_id); } return 0; } - device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->ch_id); - ret = ENXIO; + device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + error = ENXIO; failed: - if (new_channel->ch_bufring_gpadl) { - vmbus_chan_gpadl_disconnect(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; + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; } - atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); - return ret; + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; + } + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + return error; } int Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 18 05:00:01 2016 (r302985) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Jul 18 05:36:31 2016 (r302986) @@ -202,7 +202,7 @@ struct vmbus_chanmsg_chopen { uint32_t chm_openid; uint32_t chm_gpadl; uint32_t chm_vcpuid; - uint32_t chm_rxbr_pgofs; + uint32_t chm_txbr_pgcnt; #define VMBUS_CHANMSG_CHOPEN_UDATA_SIZE 120 uint8_t chm_udata[VMBUS_CHANMSG_CHOPEN_UDATA_SIZE]; } __packed; From owner-svn-src-head@freebsd.org Mon Jul 18 05:38: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 9DB7AB9C7D0; Mon, 18 Jul 2016 05:38:39 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward4m.cmail.yandex.net (forward4m.cmail.yandex.net [IPv6:2a02:6b8:b030::1b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C55C144D; Mon, 18 Jul 2016 05:38:38 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp3m.mail.yandex.net (smtp3m.mail.yandex.net [IPv6:2a02:6b8:0:2519::125]) by forward4m.cmail.yandex.net (Yandex) with ESMTP id 9694920252; Mon, 18 Jul 2016 08:38:25 +0300 (MSK) Received: from smtp3m.mail.yandex.net (localhost [127.0.0.1]) by smtp3m.mail.yandex.net (Yandex) with ESMTP id 9597527A0623; Mon, 18 Jul 2016 08:38:25 +0300 (MSK) Received: by smtp3m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ByD2Swcn5N-cPWeFijb; Mon, 18 Jul 2016 08:38:25 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1468820305; bh=b6KfwrS25HLDpB/z+OITHZd9f04A1Lw2/mKYBc5M6FU=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=uKd+NrhvfHTJloSVKsG2VBGT1oQvIFwV7sSHSnfAupOaWI7Dlg7Rv1H/n6W9c7YWY uiejDEH6VWnBVRAYXaE9hL3nODWRsXKLAlcGGjscVY45RBoWYDqYeW7SSsHaLX3Vud /SPGyWVSjVUxB64LQpkM4BKqEl6NNt4VunrF7+xk= Authentication-Results: smtp3m.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0 Subject: Re: svn commit: r302985 - head/sys/geom/label To: Maxim Sobolev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607180500.u6I501CX063743@repo.freebsd.org> From: "Andrey V. Elsukov" Message-ID: <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> Date: Mon, 18 Jul 2016 08:37:27 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607180500.u6I501CX063743@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2ERp3G9mdf6KmBmS6R81sGpul9fOHrlRh" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 05:38:39 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2ERp3G9mdf6KmBmS6R81sGpul9fOHrlRh Content-Type: multipart/mixed; boundary="b5nsrnGPUwu3nH59dAoPB01soVim997x2" From: "Andrey V. Elsukov" To: Maxim Sobolev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> Subject: Re: svn commit: r302985 - head/sys/geom/label References: <201607180500.u6I501CX063743@repo.freebsd.org> In-Reply-To: <201607180500.u6I501CX063743@repo.freebsd.org> --b5nsrnGPUwu3nH59dAoPB01soVim997x2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.07.16 08:00, Maxim Sobolev wrote: > Author: sobomax > Date: Mon Jul 18 05:00:01 2016 > New Revision: 302985 > URL: https://svnweb.freebsd.org/changeset/base/302985 >=20 > Log: > Relax checking if the privider size matches size recorded in the > superblock, allowing provider to be bit bigger, i.e. have some > extra padding after the FS image. That in some cases might be > a side-effect of using CLOOP format which enforces certain block > size and trying to compress image that is not exactly the number > of those blocks in size. The UFS itself does not have any issues > mounting such padded file systems, so it's what GEOM_LABEL should > do. While you are thinking this is good fix, I expect that this change will break many installations. This is not first time when this check was changed. --=20 WBR, Andrey V. Elsukov --b5nsrnGPUwu3nH59dAoPB01soVim997x2-- --2ERp3G9mdf6KmBmS6R81sGpul9fOHrlRh 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/ iQEvBAEBCAAZBQJXjGsXEhxidTdjaGVyQHlhbmRleC5ydQAKCRABxeoEEMihepeR B/9zKYBQUtqMQVnwMUPigqJoQbrM1cD4G2tloEvGrcGpvtu8d4WItC5fIkgBAyD2 PzYvBmdyOW5ERSnuNg4Un4n2NaVZvxgX5IkTmJHwW+/ZyYA4yD3ihAi0rtgScz35 gUg+TgVnosRek8xW8a+VTcgd+9W+0Zwyr8Q/HNYrw4ikbLErJ0KJQz9PRd3UG+L1 c77/ZFTvWTYQJ6im+v9kjOUZCHRkTq0xHmXPuWIi3Khgf5DzU23Mg/7eRlAOnkzH PXDiN9gJDiwoTD/gv0lhnF4w+LE8pdzffLNKGU1bF0SkZ05YeSQZYhBwRJDXzmne ja5QW7HEnP+JYqdG2uIolumS =5VKW -----END PGP SIGNATURE----- --2ERp3G9mdf6KmBmS6R81sGpul9fOHrlRh-- From owner-svn-src-head@freebsd.org Mon Jul 18 06:35: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 9D9C3B9C260; Mon, 18 Jul 2016 06:35:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5F41BD4; Mon, 18 Jul 2016 06:35:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6I6ZeZO000618; Mon, 18 Jul 2016 06:35:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I6ZegR000617; Mon, 18 Jul 2016 06:35:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201607180635.u6I6ZegR000617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 18 Jul 2016 06:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302988 - head/sys/arm/ti/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 06:35:41 -0000 Author: loos Date: Mon Jul 18 06:35:40 2016 New Revision: 302988 URL: https://svnweb.freebsd.org/changeset/base/302988 Log: Fix a random memory overwrite at boot time, simplebus_init() and simplebus_add_device() expect a simplebus_softc structure associated with the device. Add the simplebus_softc as first member in am335x_pwmss_softc structure. Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/arm/ti/am335x/am335x_pwmss.c Modified: head/sys/arm/ti/am335x/am335x_pwmss.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pwmss.c Mon Jul 18 06:09:52 2016 (r302987) +++ head/sys/arm/ti/am335x/am335x_pwmss.c Mon Jul 18 06:35:40 2016 (r302988) @@ -65,6 +65,7 @@ static device_attach_t am335x_pwmss_atta static device_detach_t am335x_pwmss_detach; struct am335x_pwmss_softc { + struct simplebus_softc sc_simplebus; device_t sc_dev; clk_ident_t sc_clk; }; From owner-svn-src-head@freebsd.org Mon Jul 18 08:53: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 42E5AB9CEF6; Mon, 18 Jul 2016 08:53:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C00115B0; Mon, 18 Jul 2016 08:53:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u6I8ruKx087536 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 18 Jul 2016 01:53:57 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u6I8rugV087535; Mon, 18 Jul 2016 01:53:56 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 18 Jul 2016 01:53:56 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302894 - head/sys/kern Message-ID: <20160718085356.GO1076@FreeBSD.org> References: <201607150928.u6F9SW3h065100@repo.freebsd.org> <23f60f35-db99-ea20-837b-becd9c5c1887@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <23f60f35-db99-ea20-837b-becd9c5c1887@selasky.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: Mon, 18 Jul 2016 08:53:58 -0000 On Fri, Jul 15, 2016 at 04:29:45PM +0200, Hans Petter Selasky wrote: H> On 07/15/16 11:28, Gleb Smirnoff wrote: H> > Author: glebius H> > Date: Fri Jul 15 09:28:32 2016 H> > New Revision: 302894 H> > URL: https://svnweb.freebsd.org/changeset/base/302894 H> > H> > Log: H> > Fix regression introduced by r302350. The change of return value for a H> > callout that wasn't scheduled at all was unintentional and yielded in H> > several panics. H> > H> > PR: 210884 H> > H> > Modified: H> > head/sys/kern/kern_timeout.c H> > H> > Modified: head/sys/kern/kern_timeout.c H> > ============================================================================== H> > --- head/sys/kern/kern_timeout.c Fri Jul 15 09:23:18 2016 (r302893) H> > +++ head/sys/kern/kern_timeout.c Fri Jul 15 09:28:32 2016 (r302894) H> > @@ -1381,7 +1381,7 @@ again: H> > CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", H> > c, c->c_func, c->c_arg); H> > CC_UNLOCK(cc); H> > - return (cancelled); H> > + return (0); H> > } H> > H> > c->c_iflags &= ~CALLOUT_PENDING; H> > H> > H> H> Hi, H> H> I think r302894 and r302350 changes the return value of the following H> case, which is not described in the commit message? Is this also a H> regression? H> H> In this revision: H> > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?view=markup&pathrev=296320 H> H> Assume we enter _callout_stop_safe() having the following assertions: H> H> (c->c_iflags & CALLOUT_PENDING) == 0 (satisfied) H> cc_exec_curr(cc, direct) != c (satisfied) H> H> Then we exit returning (-1). H> H> In this revision: H> > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?view=markup&pathrev=296320#l1253 H> H> After your changes, entering the same function under the same conditions: H> H> cc_exec_curr(cc, direct) == c (not satisifed) H> (c->c_iflags & CALLOUT_PENDING) == 0 (satisfied) H> H> Then we exit returning (0). H> H> > https://svnweb.freebsd.org/base/head/sys/kern/kern_timeout.c?revision=302894&view=markup#l1384 H> H> If we call callout_stop() on a never scheduled callout, we now get a H> return value of 0 instead of -1, which by manual page definition is H> wrong ???? H> H> Am I wrong? Do others see this too? You are right, the new -1 value was introduced by you and rrs@ in the commit: ------------------------------------------------------------------------ r290664 | rrs | 2015-11-10 06:49:32 -0800 (вт, 10 нояб. 2015) | 6 lines Add new async_drain to the callout system. This is so-far not used but should be used by TCP for sure in its cleanup of the IN-PCB (will be coming shortly). Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D4076 ------------------------------------------------------------------------ So commit not only extended the KPI, but also changed it. And I missed that, using stable/10 version as reference. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Mon Jul 18 09:26: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 86437B9CD0F; Mon, 18 Jul 2016 09:26:07 +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 4B9E718C8; Mon, 18 Jul 2016 09:26:07 +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 u6I9Q6me063553; Mon, 18 Jul 2016 09:26:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I9Q6ak063552; Mon, 18 Jul 2016 09:26:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201607180926.u6I9Q6ak063552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 18 Jul 2016 09:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302997 - 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, 18 Jul 2016 09:26:07 -0000 Author: glebius Date: Mon Jul 18 09:26:06 2016 New Revision: 302997 URL: https://svnweb.freebsd.org/changeset/base/302997 Log: Redo the r302894: the very new value for a non-scheduled callout is -1. This was recently added in r290664. Noticed by: hselasky PR: 210884 Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Jul 18 09:19:45 2016 (r302996) +++ head/sys/kern/kern_timeout.c Mon Jul 18 09:26:06 2016 (r302997) @@ -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 (0); + return (-1); } c->c_iflags &= ~CALLOUT_PENDING; From owner-svn-src-head@freebsd.org Mon Jul 18 09:29: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 4F4BDB9CE9A; Mon, 18 Jul 2016 09:29:10 +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 0F1C41BEB; Mon, 18 Jul 2016 09:29:09 +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 u6I9T9DK063706; Mon, 18 Jul 2016 09:29:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6I9T9Uw063705; Mon, 18 Jul 2016 09:29:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201607180929.u6I9T9Uw063705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 18 Jul 2016 09:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302998 - 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, 18 Jul 2016 09:29:10 -0000 Author: glebius Date: Mon Jul 18 09:29:08 2016 New Revision: 302998 URL: https://svnweb.freebsd.org/changeset/base/302998 Log: Revert the last commit. It must get more review and testing first. Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Jul 18 09:26:06 2016 (r302997) +++ head/sys/kern/kern_timeout.c Mon Jul 18 09:29:08 2016 (r302998) @@ -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 (-1); + return (0); } c->c_iflags &= ~CALLOUT_PENDING; From owner-svn-src-head@freebsd.org Mon Jul 18 10:53: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 EE0C3B99FA9; Mon, 18 Jul 2016 10:53:48 +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 A74C31CD6; Mon, 18 Jul 2016 10:53:48 +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 u6IArlkh096492; Mon, 18 Jul 2016 10:53:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IArlUY096490; Mon, 18 Jul 2016 10:53:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607181053.u6IArlUY096490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Jul 2016 10:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302999 - 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, 18 Jul 2016 10:53:49 -0000 Author: kib Date: Mon Jul 18 10:53:47 2016 New Revision: 302999 URL: https://svnweb.freebsd.org/changeset/base/302999 Log: The assertion re-added in r302614 was triggered when stopping signal is delivered to vforked child. Issue is that we avoid stopping such children in issignal() to not block parents. But executed AST, which ignored stops, leaves the child with the signal pending but no AST pending. On first exec after vfork(), call signotify() to handle pending reenabled signals. Adjust the assert to not check vfork children until exec. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/kern_exec.c head/sys/kern/subr_trap.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Jul 18 09:29:08 2016 (r302998) +++ head/sys/kern/kern_exec.c Mon Jul 18 10:53:47 2016 (r302999) @@ -760,6 +760,8 @@ interpret: if (p->p_flag & P_PPWAIT) { p->p_flag &= ~(P_PPWAIT | P_PPTRACE); cv_broadcast(&p->p_pwait); + /* STOPs are no longer ignored, arrange for AST */ + signotify(td); } /* Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Mon Jul 18 09:29:08 2016 (r302998) +++ head/sys/kern/subr_trap.c Mon Jul 18 10:53:47 2016 (r302999) @@ -107,15 +107,20 @@ userret(struct thread *td, struct trapfr * multi-threaded processes, where signal distribution might * change due to other threads changing sigmask, the check is * racy and cannot be performed reliably. + * If current process is vfork child, indicated by P_PPWAIT, then + * issignal() ignores stops, so we block the check to avoid + * classifying pending signals. */ 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)); + if ((p->p_flag & P_PPWAIT) == 0) { + 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); } @@ -281,12 +286,15 @@ ast(struct trapframe *framep) * 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. + * See comment in userret() about P_PPWAIT. */ - 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)); + if ((p->p_flag & P_PPWAIT) == 0) { + 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); } From owner-svn-src-head@freebsd.org Mon Jul 18 14:25: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 39E07B9DABD for ; Mon, 18 Jul 2016 14:25:18 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::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 F357D12CF for ; Mon, 18 Jul 2016 14:25:17 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x22c.google.com with SMTP id u186so69338748ita.0 for ; Mon, 18 Jul 2016 07:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XO4vw+7omxcJK7HtqU64jkw4YmvT3n0Nm6jDcapuD1o=; b=UZik9gNk0he9I+eeDGTsqGUsdIYeBUZazNLBwOp9LeOwZqHIzmSoH6TlMdR771M+WB k7Z8sNEDOIhOvJSufCciUlm/2z6/oNBfHtHFntrZwPmafBBUj2uiFYbXZk8amnOW/dIV 8DKw700kZWUJ7CepnFlM4ng9vIK4OT0roylY+4Lr+zLznrH0a31dAVfK14JPtkj7LC6z j3LRtVb7pkVbc0YSWL+HK1UYZA4HFIWHc9SIwW62uftrLRYR6WB/XM4/3oBlbCgWfMbX foj8EueavIgABuWWcfm1RTYZCVRG12Rze7kW6iWkigL9hi5y2ZmsSz8F+El01ka/HZu6 YNJA== 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=XO4vw+7omxcJK7HtqU64jkw4YmvT3n0Nm6jDcapuD1o=; b=AJprj1avpzczAI0GFryhrNSv0fPZOcdFNgqOiFFXRQI5sehasZyG+egTQWH0ycjgYX q82b8ztENkk+pxICDr3Wu7Bjbt2Kv0Wz1CSrUXOLezQd3wlzJB6g3CfusZKHPLI4Tca3 YpYXG24U86cCiWmdYFEhQLjEi5sGqs6uGCYGEdW/9hMW5gvdmO2010ptpEniMybxQsas tPZVtAtlt8uymrs8UlCtHiqc1m2bOUY8mfTZ9AK9M3msqmZ8uWRKOG/kc1SbV7f8bZm4 CVOLlro2MssLQgEZIuq+p61VqBpqMWEKOc5b1W7Ik4Gsw7th6tn28IH3DHT7Tiz9ERaC 6K7g== X-Gm-Message-State: ALyK8tI4/rQhqDmm1LivBIzi6vn7sVSd1EesuPhqaDMFecLdZ4U9v3QBB7DHfEoKhbetyIwfe7NR7bFaoLYOCkJq X-Received: by 10.36.90.79 with SMTP id v76mr33065129ita.16.1468851917008; Mon, 18 Jul 2016 07:25:17 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.59.193 with HTTP; Mon, 18 Jul 2016 07:24:42 -0700 (PDT) In-Reply-To: <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> From: Maxim Sobolev Date: Mon, 18 Jul 2016 07:24:42 -0700 X-Google-Sender-Auth: dzBhpS6fIDO95zMgElgDpQrwIP0 Message-ID: Subject: Re: svn commit: r302985 - head/sys/geom/label 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 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: Mon, 18 Jul 2016 14:25:18 -0000 Andrey, are you talking about this: --- r156299 | pjd | 2006-03-04 11:41:54 -0800 (=D1=81=D0=B1, 04 =D0=BC=D0=B0=D1= =80 2006) | 11 lines We need to check if file system size is equal to provider's size, because sysinstall(8) still bogusly puts first partition at offset 0 instead of 16, so glabel/ufs will find file system on slice instead of partition. Before sysinstall is fixed, we must keep this code, which means that we wont't be able to detect UFS file systems created with 'newfs -s ...'. PS. bsdlabel(8) creates partitions properly. MFC after: 3 days --- In which case this particular change has a better chance of working since it's not removing this check but making it less strict. Therefore it might attach to a wrong provider only if first UFS slice is the only one slice on partition (or if the other partition is very small - less than 256 blocks in size). In either of those cases I don't think it makes much difference if we are attaching to a slice or a partition. -Maxim On Sun, Jul 17, 2016 at 10:37 PM, Andrey V. Elsukov wrote: > On 18.07.16 08:00, Maxim Sobolev wrote: > > Author: sobomax > > Date: Mon Jul 18 05:00:01 2016 > > New Revision: 302985 > > URL: https://svnweb.freebsd.org/changeset/base/302985 > > > > Log: > > Relax checking if the privider size matches size recorded in the > > superblock, allowing provider to be bit bigger, i.e. have some > > extra padding after the FS image. That in some cases might be > > a side-effect of using CLOOP format which enforces certain block > > size and trying to compress image that is not exactly the number > > of those blocks in size. The UFS itself does not have any issues > > mounting such padded file systems, so it's what GEOM_LABEL should > > do. > > While you are thinking this is good fix, I expect that this change will > break many installations. This is not first time when this check was > changed. > > -- > WBR, Andrey V. Elsukov > > From owner-svn-src-head@freebsd.org Mon Jul 18 14:40: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 6563DB9DF0B; Mon, 18 Jul 2016 14:40:15 +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 3CAFA1CE9; Mon, 18 Jul 2016 14:40:14 +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 u6IEeDBb078315; Mon, 18 Jul 2016 14:40:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IEeDD3078314; Mon, 18 Jul 2016 14:40:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607181440.u6IEeDD3078314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 18 Jul 2016 14:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303000 - head/sys/dev/vmware/vmxnet3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 14:40:15 -0000 Author: mav Date: Mon Jul 18 14:40:13 2016 New Revision: 303000 URL: https://svnweb.freebsd.org/changeset/base/303000 Log: Update if_hwassist when interface options are changed. In particular for me this fixes checksum problem when if_bridge attached to the interface requests TXCSUM to be disabled, but effectively ignored. MFC after: 3 days Sponsored by: iXsystems, Inc. Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jul 18 10:53:47 2016 (r302999) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jul 18 14:40:13 2016 (r303000) @@ -130,6 +130,7 @@ static int vmxnet3_alloc_queue_data(stru static void vmxnet3_free_queue_data(struct vmxnet3_softc *); static int vmxnet3_alloc_mcast_table(struct vmxnet3_softc *); static void vmxnet3_init_shared_data(struct vmxnet3_softc *); +static void vmxnet3_init_hwassist(struct vmxnet3_softc *); static void vmxnet3_reinit_interface(struct vmxnet3_softc *); static void vmxnet3_reinit_rss_shared_data(struct vmxnet3_softc *); static void vmxnet3_reinit_shared_data(struct vmxnet3_softc *); @@ -1583,6 +1584,24 @@ vmxnet3_init_shared_data(struct vmxnet3_ } static void +vmxnet3_init_hwassist(struct vmxnet3_softc *sc) +{ + struct ifnet *ifp = sc->vmx_ifp; + uint64_t hwassist; + + hwassist = 0; + if (ifp->if_capenable & IFCAP_TXCSUM) + hwassist |= VMXNET3_CSUM_OFFLOAD; + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + hwassist |= VMXNET3_CSUM_OFFLOAD_IPV6; + if (ifp->if_capenable & IFCAP_TSO4) + hwassist |= CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + hwassist |= CSUM_IP6_TSO; + ifp->if_hwassist = hwassist; +} + +static void vmxnet3_reinit_interface(struct vmxnet3_softc *sc) { struct ifnet *ifp; @@ -1593,15 +1612,7 @@ vmxnet3_reinit_interface(struct vmxnet3_ bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); - ifp->if_hwassist = 0; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist |= VMXNET3_CSUM_OFFLOAD; - if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) - ifp->if_hwassist |= VMXNET3_CSUM_OFFLOAD_IPV6; - if (ifp->if_capenable & IFCAP_TSO4) - ifp->if_hwassist |= CSUM_IP_TSO; - if (ifp->if_capenable & IFCAP_TSO6) - ifp->if_hwassist |= CSUM_IP6_TSO; + vmxnet3_init_hwassist(sc); } static void @@ -3284,6 +3295,8 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vmxnet3_init_locked(sc); + } else { + vmxnet3_init_hwassist(sc); } VMXNET3_CORE_UNLOCK(sc); From owner-svn-src-head@freebsd.org Mon Jul 18 14:53: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 12382B9D2F9; Mon, 18 Jul 2016 14:53: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 C439C16F2; Mon, 18 Jul 2016 14:53: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 u6IErt4p085722; Mon, 18 Jul 2016 14:53:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IErtP6085715; Mon, 18 Jul 2016 14:53:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607181453.u6IErtP6085715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 18 Jul 2016 14:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303001 - 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: Mon, 18 Jul 2016 14:53:57 -0000 Author: jhb Date: Mon Jul 18 14:53:55 2016 New Revision: 303001 URL: https://svnweb.freebsd.org/changeset/base/303001 Log: Add PTRACE_VFORK to trace vfork events. First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when the new child was created via vfork() rather than fork(). Second, a new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK event mask. This new stop is reported after the vfork parent resumes due to the child calling exit or exec. Debuggers can use this stop to reinsert breakpoints in the vfork parent process before it resumes. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D7045 Modified: head/lib/libc/sys/ptrace.2 head/sys/kern/kern_fork.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 Mon Jul 18 14:40:13 2016 (r303000) +++ head/lib/libc/sys/ptrace.2 Mon Jul 18 14:53:55 2016 (r303001) @@ -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 July 15, 2016 +.Dd July 18, 2016 .Dt PTRACE 2 .Os .Sh NAME @@ -141,6 +141,11 @@ The process ID of the new child process .Va pl_child_pid member of .Vt "struct ptrace_lwpinfo" . +If the new child process was created via +.Xr vfork 2 , +the traced process's stop will also include the +.Dv PL_FLAG_VFORKED +flag. 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. @@ -163,6 +168,33 @@ Note that new processes do not report an initial thread, and exiting processes do not report an event for the termination of the last thread. +.It Dv PTRACE_VFORK +Report a stop event when a parent process resumes after a +.Xr vfork 2 . +.Pp +When a thread in the traced process creates a new child process via +.Xr vfork 2 , +the stop that reports +.Dv PL_FLAG_FORKED +and +.Dv PL_FLAG_SCX +occurs just after the child process is created, +but before the thread waits for the child process to stop sharing process +memory. +If a debugger is not tracing the new child process, +it must ensure that no breakpoints are enabled in the shared process +memory before detaching from the new child process. +This means that no breakpoints are enabled in the parent process either. +.Pp +The +.Dv PTRACE_VFORK +flag enables a new stop that indicates when the new child process stops +sharing the process memory of the parent process. +A debugger can reinsert breakpoints in the parent process and resume it +in response to this event. +This event is indicated by setting the +.Dv PL_FLAG_VFORK_DONE +flag. .El .Pp The default tracing event mask when attaching to a process via @@ -491,6 +523,16 @@ 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. +.It PL_FLAG_VFORKED +Indicates that the thread is returning from a call to +.Xr vfork 2 +that created a new child process. +This flag is set in addition to +.Dv PL_FLAG_FORKED . +.It PL_FLAG_VFORK_DONE +Indicates that the thread has resumed after a child process created via +.Xr vfork 2 +has stopped sharing its address space with the traced process. .El .It pl_sigmask The current signal mask of the LWP Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Mon Jul 18 14:40:13 2016 (r303000) +++ head/sys/kern/kern_fork.c Mon Jul 18 14:53:55 2016 (r303001) @@ -735,6 +735,7 @@ do_fork(struct thread *td, struct fork_r if (fr->fr_flags & RFPPWAIT) { td->td_pflags |= TDP_RFPPWAIT; td->td_rfppwait_p = p2; + td->td_dbgflags |= TDB_VFORK; } PROC_UNLOCK(p2); Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Mon Jul 18 14:40:13 2016 (r303000) +++ head/sys/kern/subr_syscall.c Mon Jul 18 14:53:55 2016 (r303001) @@ -242,5 +242,13 @@ again: cv_timedwait(&p2->p_pwait, &p2->p_mtx, hz); } PROC_UNLOCK(p2); + + if (td->td_dbgflags & TDB_VFORK) { + PROC_LOCK(p); + if (p->p_ptevents & PTRACE_VFORK) + ptracestop(td, SIGTRAP); + td->td_dbgflags &= ~TDB_VFORK; + PROC_UNLOCK(p); + } } } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Jul 18 14:40:13 2016 (r303000) +++ head/sys/kern/sys_process.c Mon Jul 18 14:53:55 2016 (r303001) @@ -993,7 +993,7 @@ kern_ptrace(struct thread *td, int req, } tmp = *(int *)addr; if ((tmp & ~(PTRACE_EXEC | PTRACE_SCE | PTRACE_SCX | - PTRACE_FORK | PTRACE_LWP)) != 0) { + PTRACE_FORK | PTRACE_LWP | PTRACE_VFORK)) != 0) { error = EINVAL; break; } @@ -1303,7 +1303,11 @@ kern_ptrace(struct thread *td, int req, if (td2->td_dbgflags & TDB_FORK) { pl->pl_flags |= PL_FLAG_FORKED; pl->pl_child_pid = td2->td_dbg_forked; - } + if (td2->td_dbgflags & TDB_VFORK) + pl->pl_flags |= PL_FLAG_VFORKED; + } else if ((td2->td_dbgflags & (TDB_SCX | TDB_VFORK)) == + TDB_VFORK) + pl->pl_flags |= PL_FLAG_VFORK_DONE; if (td2->td_dbgflags & TDB_CHILD) pl->pl_flags |= PL_FLAG_CHILD; if (td2->td_dbgflags & TDB_BORN) Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Jul 18 14:40:13 2016 (r303000) +++ head/sys/sys/proc.h Mon Jul 18 14:53:55 2016 (r303001) @@ -422,6 +422,7 @@ do { \ #define TDB_CHILD 0x00000100 /* New child indicator for ptrace() */ #define TDB_BORN 0x00000200 /* New LWP indicator for ptrace() */ #define TDB_EXIT 0x00000400 /* Exiting LWP indicator for ptrace() */ +#define TDB_VFORK 0x00000800 /* vfork indicator for ptrace() */ /* * "Private" flags kept in td_pflags: Modified: head/sys/sys/ptrace.h ============================================================================== --- head/sys/sys/ptrace.h Mon Jul 18 14:40:13 2016 (r303000) +++ head/sys/sys/ptrace.h Mon Jul 18 14:53:55 2016 (r303001) @@ -89,6 +89,7 @@ #define PTRACE_SYSCALL (PTRACE_SCE | PTRACE_SCX) #define PTRACE_FORK 0x0008 #define PTRACE_LWP 0x0010 +#define PTRACE_VFORK 0x0020 #define PTRACE_DEFAULT (PTRACE_EXEC) @@ -124,6 +125,8 @@ struct ptrace_lwpinfo { #define PL_FLAG_CHILD 0x80 /* I am from child */ #define PL_FLAG_BORN 0x100 /* new LWP */ #define PL_FLAG_EXITED 0x200 /* exiting LWP */ +#define PL_FLAG_VFORKED 0x400 /* new child via vfork */ +#define PL_FLAG_VFORK_DONE 0x800 /* vfork parent has resumed */ sigset_t pl_sigmask; /* LWP signal mask */ sigset_t pl_siglist; /* LWP pending signal */ struct __siginfo pl_siginfo; /* siginfo for signal */ Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Mon Jul 18 14:40:13 2016 (r303000) +++ head/tests/sys/kern/ptrace_test.c Mon Jul 18 14:53:55 2016 (r303001) @@ -1549,6 +1549,130 @@ ATF_TC_BODY(ptrace__event_mask, tc) ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that the expected ptrace events are reported for PTRACE_VFORK. + */ +ATF_TC_WITHOUT_HEAD(ptrace__ptrace_vfork); +ATF_TC_BODY(ptrace__ptrace_vfork, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int events, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + follow_fork_parent(true); + } + + /* 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_GET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + events |= PTRACE_VFORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events, + sizeof(events)) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) != -1); + + /* The next event should report the end of the vfork. */ + wpid = wait(&status); + ATF_REQUIRE(wpid == fpid); + 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_VFORK_DONE) != 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) != -1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +ATF_TC_WITHOUT_HEAD(ptrace__ptrace_vfork_follow); +ATF_TC_BODY(ptrace__ptrace_vfork_follow, tc) +{ + struct ptrace_lwpinfo pl[2]; + pid_t children[2], fpid, wpid; + int events, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + follow_fork_parent(true); + } + + /* Parent process. */ + children[0] = fpid; + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(children[0], &status, 0); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, children[0], (caddr_t)&events, + sizeof(events)) == 0); + events |= PTRACE_FORK | PTRACE_VFORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, children[0], (caddr_t)&events, + sizeof(events)) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + /* Wait for both halves of the fork event to get reported. */ + children[1] = handle_fork_events(children[0], pl); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_VFORKED) != 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); + + /* + * The child can't exit until the grandchild reports status, so the + * grandchild should report its exit first to the debugger. + */ + wpid = waitpid(children[1], &status, 0); + ATF_REQUIRE(wpid == children[1]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 2); + + /* + * The child should report it's vfork() completion before it + * exits. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl[0], sizeof(pl[0])) != + -1); + ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_VFORK_DONE) != 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -1574,6 +1698,8 @@ ATF_TP_ADD_TCS(tp) 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); + ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork); + ATF_TP_ADD_TC(tp, ptrace__ptrace_vfork_follow); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Mon Jul 18 15:14: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 39D74B9D7D9; Mon, 18 Jul 2016 15:14:25 +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 157B61489; Mon, 18 Jul 2016 15:14:25 +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 u6IFEOcl093032; Mon, 18 Jul 2016 15:14:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IFEOFp093029; Mon, 18 Jul 2016 15:14:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607181514.u6IFEOFp093029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 18 Jul 2016 15:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303002 - in head: sys/kern sys/sys 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: Mon, 18 Jul 2016 15:14:25 -0000 Author: jhb Date: Mon Jul 18 15:14:23 2016 New Revision: 303002 URL: https://svnweb.freebsd.org/changeset/base/303002 Log: Include process IDs in core dumps. When threads were added to the kernel, the pr_pid member of the NT_PRSTATUS note was repurposed to store LWP IDs instead of process IDs. However, the process ID was no longer recorded in core dumps. This change adds a pr_pid field to prpsinfo (NT_PRSINFO). Rather than bumping the prpsinfo version number, note parsers can use the note's payload size to determine if pr_pid is present. Reviewed by: kib, emaste (older version) MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D7117 Modified: head/sys/kern/imgact_elf.c head/sys/sys/procfs.h head/usr.bin/gcore/elfcore.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Jul 18 14:53:55 2016 (r303001) +++ head/sys/kern/imgact_elf.c Mon Jul 18 15:14:23 2016 (r303002) @@ -1874,6 +1874,7 @@ __elfN(note_prpsinfo)(void *arg, struct *cp = ' '; } } + psinfo->pr_pid = p->p_pid; sbuf_bcat(sb, psinfo, sizeof(*psinfo)); free(psinfo, M_TEMP); } Modified: head/sys/sys/procfs.h ============================================================================== --- head/sys/sys/procfs.h Mon Jul 18 14:53:55 2016 (r303001) +++ head/sys/sys/procfs.h Mon Jul 18 15:14:23 2016 (r303002) @@ -49,7 +49,10 @@ typedef struct fpreg fpregset_t; /* * The parenthsized numbers like (1) indicate the minimum version number - * for which each element exists in the structure. + * for which each element exists in the structure. The version number is + * not bumped when adding new fields to the end, only if the meaning of + * an existing field changes. Additional fields are annotated as (1a), + * (1b), etc. to indicate the groupings of additions. */ #define PRSTATUS_VERSION 1 /* Current version of prstatus_t */ @@ -61,7 +64,7 @@ typedef struct prstatus { size_t pr_fpregsetsz; /* sizeof(fpregset_t) (1) */ int pr_osreldate; /* Kernel version (1) */ int pr_cursig; /* Current signal (1) */ - pid_t pr_pid; /* Process ID (1) */ + pid_t pr_pid; /* LWP (Thread) ID (1) */ gregset_t pr_reg; /* General purpose registers (1) */ } prstatus_t; @@ -78,6 +81,7 @@ typedef struct prpsinfo { size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */ char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated (1) */ char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */ + pid_t pr_pid; /* Process ID (1a) */ } prpsinfo_t; typedef struct thrmisc { @@ -104,6 +108,7 @@ typedef struct prpsinfo32 { uint32_t pr_psinfosz; char pr_fname[PRFNAMESZ+1]; char pr_psargs[PRARGSZ+1]; + int32_t pr_pid; } prpsinfo32_t; struct thrmisc32 { Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Mon Jul 18 14:53:55 2016 (r303001) +++ head/usr.bin/gcore/elfcore.c Mon Jul 18 15:14:23 2016 (r303002) @@ -586,6 +586,7 @@ elf_note_prpsinfo(void *arg, size_t *siz } else strlcpy(psinfo->pr_psargs, kip.ki_comm, sizeof(psinfo->pr_psargs)); + psinfo->pr_pid = pid; *sizep = sizeof(*psinfo); return (psinfo); From owner-svn-src-head@freebsd.org Mon Jul 18 15:44: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 9CFA1B9D19C for ; Mon, 18 Jul 2016 15:44:27 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::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 672231673 for ; Mon, 18 Jul 2016 15:44:27 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-it0-x22b.google.com with SMTP id f6so77471116ith.0 for ; Mon, 18 Jul 2016 08:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cl07vYfD4s86oHc4oH/LPcCQpKewvEwKAX06POndnUc=; b=OftsgzVbWwdiKWrwJRETtDLNI3RXBFnb0kehISAu50G/nOuUVwCuxYr2rZfAKYo98O UUZjpV92U7V2QpQck6fiUWwtBg00ZMt/ARHFXOQTKeICAZ8lMHSsGj+2nPeKSdv1Uxqc mVz3MOMVIdxsBdrHvbsysGpCaYa9ur2d5J2Sc= 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=cl07vYfD4s86oHc4oH/LPcCQpKewvEwKAX06POndnUc=; b=Xew5j11+96aQpsm6BCq916zZXYzebxOSwHbaYwi9jaqh6jU9WvWk+MtXsjUDSdzTVl 3eolf/MAVQ2Vbh+DrCOvIpIepnl2rxABzvmz8TgOUWb2f7ZYTCz2zg+zzlf2qguWb1Vd QR8jaytSrjtEeaJZW9ErBsS3aTdoquK7a9WfM9nzg1WuEJ83mQl3H95gihIgFXGIKDiS zpv6dbmZAOrQU16aW9gtgcJpl7twlR1sffwhUAEfpkhJzns0/Z6jXcvFZqGjEGEwmqQ5 rdsUIw3B++2dU8DqpMeZC5bkE9Yl3EaztZDNJiP5XTZiu1cmZ9spAj1T0X4TsHTxChMY A/PQ== X-Gm-Message-State: ALyK8tKojdv2/dIFCMijYLvJRALuUNBnG+ozx8bL/Pa6zMWXRyVb4aWinYXxDZhd8VW4gh7U X-Received: by 10.36.34.14 with SMTP id o14mr36173789ito.11.1468856666594; Mon, 18 Jul 2016 08:44:26 -0700 (PDT) Received: from [100.127.65.10] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id v11sm9023876iod.43.2016.07.18.08.44.24 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 08:44:25 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302998 - head/sys/kern From: Randall Stewart In-Reply-To: <201607180929.u6I9T9Uw063705@repo.freebsd.org> Date: Mon, 18 Jul 2016 17:44:20 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> To: Gleb Smirnoff 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, 18 Jul 2016 15:44:27 -0000 Gleb: This now leaks TCP-PCB=E2=80=99s since you have broken the return codes = with all your fixes that used to be in here. It was return 1 =E2=80=94 You stopped the callout return 0 =E2=80=94 The callout could not be stopped return -1 =E2=80=94 The callout was not running. The LLRef code that was crashing in in.c depended on this to know to = free the memory.. i.e. if was > 0 then they needed to free the memory. TCP depends on a return 0 to indicate the async-drain function will be = called back and thus increments a refcnt and waits for the callback. You now return 0 when no timer was active.. which makes the stack then = wait for the not forth coming async-drain call. R > On Jul 18, 2016, at 11:29 AM, Gleb Smirnoff = wrote: >=20 > Author: glebius > Date: Mon Jul 18 09:29:08 2016 > New Revision: 302998 > URL: https://svnweb.freebsd.org/changeset/base/302998 >=20 > Log: > Revert the last commit. It must get more review and testing first. >=20 > Modified: > head/sys/kern/kern_timeout.c >=20 > Modified: head/sys/kern/kern_timeout.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/sys/kern/kern_timeout.c Mon Jul 18 09:26:06 2016 = (r302997) > +++ head/sys/kern/kern_timeout.c Mon Jul 18 09:29:08 2016 = (r302998) > @@ -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 (-1); > + return (0); > } >=20 > c->c_iflags &=3D ~CALLOUT_PENDING; >=20 -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Mon Jul 18 15:50: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 06D96B9D6D5; Mon, 18 Jul 2016 15:50:55 +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 B4B6A1C39; Mon, 18 Jul 2016 15:50:55 +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 u6IFosck004401; Mon, 18 Jul 2016 15:50:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IFosQS004400; Mon, 18 Jul 2016 15:50:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607181550.u6IFosQS004400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 18 Jul 2016 15:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303003 - 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: Mon, 18 Jul 2016 15:50:56 -0000 Author: gjb Date: Mon Jul 18 15:50:54 2016 New Revision: 303003 URL: https://svnweb.freebsd.org/changeset/base/303003 Log: Make sure we clean up the rdoc and reldoc directories if NODOC is not set. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Mon Jul 18 15:14:23 2016 (r303002) +++ head/release/Makefile Mon Jul 18 15:50:54 2016 (r303003) @@ -119,6 +119,9 @@ CLEANFILES+= ${I}.xz CLEANFILES+= pkg-stage .endif CLEANDIRS= dist ftp disc1 bootonly dvd +.if !defined(NODOC) +CLEANDIRS+= reldoc rdoc +.endif beforeclean: chflags -R noschg . .include From owner-svn-src-head@freebsd.org Mon Jul 18 16: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 5AF39B9DA6A; Mon, 18 Jul 2016 16:06:22 +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 1DB19163A; Mon, 18 Jul 2016 16:06:22 +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 u6IG6LEZ011644; Mon, 18 Jul 2016 16:06:21 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IG6LOd011643; Mon, 18 Jul 2016 16:06:21 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607181606.u6IG6LOd011643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 18 Jul 2016 16:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303004 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 16:06:22 -0000 Author: ache Date: Mon Jul 18 16:06:21 2016 New Revision: 303004 URL: https://svnweb.freebsd.org/changeset/base/303004 Log: 1) POSIX defines well when GLOB_ABORTED can be returned (only for directory open/read errors and with GLOB_ERR and gl_errfunc processing), so we can't blindly return it on any MAXPATHLEN overflow. Even our manpage disagrees with such GLOB_ABORTED usage. Use GLOB_NOSPACE for that now with errno is set to 0 as for limits. 2) Return GLOB_NOSPACE when valid ~ expansion can't happens due to MAXPATHLEN overflow too. 3) POSIX (and our manpage) says, if GLOB_ERR is set, GLOB_ABORTED should be returned immediatelly, without using gl_errfunc. Implement it now. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 15:50:54 2016 (r303003) +++ head/lib/libc/gen/glob.c Mon Jul 18 16:06:21 2016 (r303004) @@ -421,7 +421,7 @@ globtilde(const Char *pattern, Char *pat continue; if (*p != EOS && *p != SLASH) - return (pattern); + return (NULL); *b = EOS; h = NULL; @@ -446,8 +446,9 @@ globtilde(const Char *pattern, Char *pat /* * Expand a ~user */ - if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf)) || - (pwd = getpwnam((char *)wbuf)) == NULL) + if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf))) + return (NULL); + if ((pwd = getpwnam((char *)wbuf)) == NULL) return (pattern); else h = pwd->pw_dir; @@ -474,13 +475,13 @@ globtilde(const Char *pattern, Char *pat sc += clen; } if (too_long) - return (pattern); + return (NULL); dc = wbuf; for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++) continue; if (*dc != EOS) - return (pattern); + return (NULL); /* Append the rest of the pattern */ if (*p != EOS) { @@ -492,7 +493,7 @@ globtilde(const Char *pattern, Char *pat } } if (too_long) - return (pattern); + return (NULL); } else *b = EOS; @@ -515,6 +516,10 @@ glob0(const Char *pattern, glob_t *pglob Char *bufnext, c, patbuf[MAXPATHLEN]; qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob); + if (qpatnext == NULL) { + errno = 0; + return (GLOB_NOSPACE); + } oldpathc = pglob->gl_pathc; bufnext = patbuf; @@ -638,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) { errno = 0; if (pathend + 1 > pathend_last) - return (GLOB_ABORTED); + return (GLOB_NOSPACE); *pathend++ = SEP; *pathend = EOS; return (GLOB_NOSPACE); @@ -648,8 +653,10 @@ glob2(Char *pathbuf, Char *pathend, Char || (S_ISLNK(sb.st_mode) && (g_stat(pathbuf, &sb, pglob) == 0) && S_ISDIR(sb.st_mode)))) { - if (pathend + 1 > pathend_last) - return (GLOB_ABORTED); + if (pathend + 1 > pathend_last) { + errno = 0; + return (GLOB_NOSPACE); + } *pathend++ = SEP; *pathend = EOS; } @@ -663,8 +670,10 @@ glob2(Char *pathbuf, Char *pathend, Char while (*p != EOS && *p != SEP) { if (ismeta(*p)) anymeta = 1; - if (q + 1 > pathend_last) - return (GLOB_ABORTED); + if (q + 1 > pathend_last) { + errno = 0; + return (GLOB_NOSPACE); + } *q++ = *p++; } @@ -672,8 +681,10 @@ glob2(Char *pathbuf, Char *pathend, Char pathend = q; pattern = p; while (*pattern == SEP) { - if (pathend + 1 > pathend_last) - return (GLOB_ABORTED); + if (pathend + 1 > pathend_last) { + errno = 0; + return (GLOB_NOSPACE); + } *pathend++ = *pattern++; } } else /* Need expansion, recurse. */ @@ -695,18 +706,21 @@ glob3(Char *pathbuf, Char *pathend, Char struct dirent *(*readdirfunc)(DIR *); + errno = 0; if (pathend > pathend_last) - return (GLOB_ABORTED); + return (GLOB_NOSPACE); *pathend = EOS; - errno = 0; if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { /* TODO: don't call for ENOENT or ENOTDIR? */ + if (pglob->gl_flags & GLOB_ERR) + return (GLOB_ABORTED); if (pglob->gl_errfunc) { - if (g_Ctoc(pathbuf, buf, sizeof(buf))) - return (GLOB_ABORTED); - if (pglob->gl_errfunc(buf, errno) || - pglob->gl_flags & GLOB_ERR) + if (g_Ctoc(pathbuf, buf, sizeof(buf))) { + errno = 0; + return (GLOB_NOSPACE); + } + if (pglob->gl_errfunc(buf, errno)) return (GLOB_ABORTED); } return (0); @@ -732,7 +746,7 @@ glob3(Char *pathbuf, Char *pathend, Char limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) { errno = 0; if (pathend + 1 > pathend_last) - err = GLOB_ABORTED; + err = GLOB_NOSPACE; else { *pathend++ = SEP; *pathend = EOS; @@ -831,6 +845,7 @@ globextend(const Char *path, glob_t *pgl if ((copy = malloc(len)) != NULL) { if (g_Ctoc(path, copy, len)) { free(copy); + errno = 0; return (GLOB_NOSPACE); } pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; From owner-svn-src-head@freebsd.org Mon Jul 18 16:19: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 D0798B9DDF8 for ; Mon, 18 Jul 2016 16:19:36 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::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 996A01F73 for ; Mon, 18 Jul 2016 16:19:36 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-io0-x22c.google.com with SMTP id 38so164213798iol.0 for ; Mon, 18 Jul 2016 09:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Fb1z4EzxM5VPUnvWqeiYOEor6VbgTwpPIsxUs3j8IRc=; b=p3EfKBxlUV6ZyuVOrwHJ02e3H+CnzdFVBznpa5LBg8DG3dMBlP+PUO5DV3ngYxjJ4r p/NIG11M/H3B0xIWklc+D0jtU0PUgTUm2CcWCZ63FnS+Czp/yPzLj4h520t6p4NASRGG eZGi4mFfqyM9d0gu5CRRMeyWhocY8Rx1bPpbM= 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=Fb1z4EzxM5VPUnvWqeiYOEor6VbgTwpPIsxUs3j8IRc=; b=VfPx95JctCKfKTdS/fcS8tMLrb1DMCekZ6Rk3pxWZS0ARxAujv/DC4lNAJ+tG/rgmy iCdD0kOr1y95ZICzgSsEtGOcg8KsBPwaufgzjpLP/bk55LCm4RbUHZN3Vx9glw/8MGQE 75z+2YuPO23KydQXIM15teV7JoXCdkVMfqHXDdQKnvVL9yqw/ffYKNBfnhqCQ0DnTjgd TjR9mlrp8n+du1xFBXzVMV2Njqrmh1ZmjA6XQCeX9rTnQ9/tXT2s50WFDDf5dKDkFo9r b9MEG5Uwvd11+n9LpOYIr1XqwPo4YbgZKYZumc7DBjFVNqhM8NqxY2Sbf7AlOAgctJe+ lGuA== X-Gm-Message-State: ALyK8tLhmgPApuL3UDDEGy0NefA/hG8fv5csEeDsZogjvb29NR02bdqmDVhX9r02MdgK6CmJ X-Received: by 10.107.22.6 with SMTP id 6mr34463967iow.128.1468858775780; Mon, 18 Jul 2016 09:19:35 -0700 (PDT) Received: from [100.127.65.10] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id u7sm4903209ita.21.2016.07.18.09.19.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 09:19:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302998 - head/sys/kern From: Randall Stewart In-Reply-To: <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> Date: Mon, 18 Jul 2016 18:19:31 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> To: Gleb Smirnoff 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, 18 Jul 2016 16:19:36 -0000 I have worked out a fix of this in Netflix code base (I have the same = code running there). I will get that tested tonight I will get the fixes in to restore the = behavior. I will setup a phabricator shortly.. most likely I will update the one I = already have on the one problem your earlier patch did not fix. R > On Jul 18, 2016, at 5:44 PM, Randall Stewart wrote: >=20 > Gleb: >=20 > This now leaks TCP-PCB=E2=80=99s since you have broken the return = codes with all your > fixes that used to be in here. >=20 > It was >=20 > return 1 =E2=80=94 You stopped the callout > return 0 =E2=80=94 The callout could not be stopped > return -1 =E2=80=94 The callout was not running. >=20 > The LLRef code that was crashing in in.c depended on this to know to = free > the memory.. i.e. if was > 0 then they needed to free the memory. >=20 > TCP depends on a return 0 to indicate the async-drain function will be = called back and > thus increments a refcnt and waits for the callback. >=20 > You now return 0 when no timer was active.. which makes the stack then = wait > for the not forth coming async-drain call. >=20 > R >> On Jul 18, 2016, at 11:29 AM, Gleb Smirnoff = wrote: >>=20 >> Author: glebius >> Date: Mon Jul 18 09:29:08 2016 >> New Revision: 302998 >> URL: https://svnweb.freebsd.org/changeset/base/302998 >>=20 >> Log: >> Revert the last commit. It must get more review and testing first. >>=20 >> Modified: >> head/sys/kern/kern_timeout.c >>=20 >> Modified: head/sys/kern/kern_timeout.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/sys/kern/kern_timeout.c Mon Jul 18 09:26:06 2016 = (r302997) >> +++ head/sys/kern/kern_timeout.c Mon Jul 18 09:29:08 2016 = (r302998) >> @@ -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 (-1); >> + return (0); >> } >>=20 >> c->c_iflags &=3D ~CALLOUT_PENDING; >>=20 >=20 > -------- > Randall Stewart > rrs@netflix.com > 803-317-4952 >=20 >=20 >=20 >=20 >=20 -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Mon Jul 18 16:58: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 8DC8BB9CD4B; Mon, 18 Jul 2016 16:58:48 +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 6049E1154; Mon, 18 Jul 2016 16:58:48 +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 u6IGwlN4031396; Mon, 18 Jul 2016 16:58:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IGwlUZ031395; Mon, 18 Jul 2016 16:58:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607181658.u6IGwlUZ031395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 18 Jul 2016 16:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303009 - head/sys/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, 18 Jul 2016 16:58:48 -0000 Author: mav Date: Mon Jul 18 16:58:47 2016 New Revision: 303009 URL: https://svnweb.freebsd.org/changeset/base/303009 Log: Negotiate/disable TXCSUM_IPV6 same as TXCSUM. Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Mon Jul 18 16:39:53 2016 (r303008) +++ head/sys/net/if_bridge.c Mon Jul 18 16:58:47 2016 (r303009) @@ -166,7 +166,8 @@ __FBSDID("$FreeBSD$"); /* * List of capabilities to possibly mask on the member interface. */ -#define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM) +#define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM|\ + IFCAP_TXCSUM_IPV6) /* * List of capabilities to strip From owner-svn-src-head@freebsd.org Mon Jul 18 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 8DBE3B9D26E; Mon, 18 Jul 2016 17:09:31 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5951A5C; Mon, 18 Jul 2016 17:09:31 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:27806 helo=[10.19.158.225]) by shxd.cx with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1bOe6f-000JJx-D2; Sun, 17 Jul 2016 04:55:09 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r302985 - head/sys/geom/label From: Devin Teske In-Reply-To: Date: Mon, 18 Jul 2016 10:09:27 -0700 Cc: "Andrey V. Elsukov" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Devin Teske Content-Transfer-Encoding: quoted-printable Message-Id: <343F413D-48B9-47C6-9C3C-1B2C78C3FA39@freebsd.org> References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> To: Maxim Sobolev X-Mailer: Apple Mail (2.2104) Sender: devin@shxd.cx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 17:09:31 -0000 > On Jul 18, 2016, at 7:24 AM, Maxim Sobolev = wrote: >=20 > Andrey, are you talking about this: >=20 > --- > r156299 | pjd | 2006-03-04 11:41:54 -0800 (=D1=81=D0=B1, 04 =D0=BC=D0=B0= =D1=80 2006) | 11 lines >=20 > We need to check if file system size is equal to provider's size, = because > sysinstall(8) ?? sysinstall ?? in head ?? --=20 Devin From owner-svn-src-head@freebsd.org Mon Jul 18 18:24: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 9BF5FB9DA83; Mon, 18 Jul 2016 18:24: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 4BB9F1350; Mon, 18 Jul 2016 18:24: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 u6IIOVvt065409; Mon, 18 Jul 2016 18:24:31 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IIOVNn065407; Mon, 18 Jul 2016 18:24:31 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607181824.u6IIOVNn065407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 18 Jul 2016 18:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303010 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 18:24:32 -0000 Author: ache Date: Mon Jul 18 18:24:31 2016 New Revision: 303010 URL: https://svnweb.freebsd.org/changeset/base/303010 Log: 1) Add all characters from ~ expansion as protected to be not interpreted as pattern meta chars. 2) GLOB_ERR and gl_errfunc are supposed to work only for real directories per POSIX, so don't act on missing or plain files, for ENOENT or ENOTDIR (as TODO in the code suggested). 3) Remove the hack in the manpage describing how to skip ENOENT and ENOTDIR in gl_errfunc, it is unneeded now. 4) Set errno to ENAMETOOLONG if g_Ctoc() expansion fails in g_opendir(), as in other places in the code which are wrappers around system functions. Modified: head/lib/libc/gen/glob.3 head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.3 ============================================================================== --- head/lib/libc/gen/glob.3 Mon Jul 18 16:58:47 2016 (r303009) +++ head/lib/libc/gen/glob.3 Mon Jul 18 18:24:31 2016 (r303010) @@ -275,24 +275,10 @@ is .Pf non- Dv NULL , .Fn glob calls -.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) . -This may be unintuitive: a pattern like -.Ql */Makefile -will try to -.Xr stat 2 -.Ql foo/Makefile -even if -.Ql foo -is not a directory, resulting in a -call to -.Fa errfunc . -The error routine can suppress this action by testing for -.Er ENOENT -and -.Er ENOTDIR ; +.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) , however, the .Dv GLOB_ERR -flag will still cause an immediate +flag will cause an immediate return when this happens. .Pp If Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 16:58:47 2016 (r303009) +++ head/lib/libc/gen/glob.c Mon Jul 18 18:24:31 2016 (r303010) @@ -478,7 +478,7 @@ globtilde(const Char *pattern, Char *pat return (NULL); dc = wbuf; - for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++) + for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++ | M_PROTECT) continue; if (*dc != EOS) return (NULL); @@ -712,7 +712,8 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend = EOS; if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { - /* TODO: don't call for ENOENT or ENOTDIR? */ + if (errno == ENOENT || errno == ENOTDIR) + return (0); if (pglob->gl_flags & GLOB_ERR) return (GLOB_ABORTED); if (pglob->gl_errfunc) { @@ -937,8 +938,10 @@ g_opendir(Char *str, glob_t *pglob) if (*str == EOS) strcpy(buf, "."); else { - if (g_Ctoc(str, buf, sizeof(buf))) + if (g_Ctoc(str, buf, sizeof(buf))) { + errno = ENAMETOOLONG; return (NULL); + } } if (pglob->gl_flags & GLOB_ALTDIRFUNC) From owner-svn-src-head@freebsd.org Mon Jul 18 18:28: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 DD240B9DB32 for ; Mon, 18 Jul 2016 18:28:18 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::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 AD2C416EB for ; Mon, 18 Jul 2016 18:28:18 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x233.google.com with SMTP id j124so40203816ith.1 for ; Mon, 18 Jul 2016 11:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=hH2HSF1ATlu64pBHRbjIQDBZAQ6Nm/0pU03a9lYiJAE=; b=SnsrWiAkeKu5EbREPDm3TIfScl4tk6uiRUNnpjnuEwYQWhdguae/6LkviJIgmGt2MG Rguug/C4J1WP0fjV/XBjrY3dDc4dZCO4pihSo/Cpps9LnNHOlSBYeKSwhibplykxh0DY OaQWCeNqXaqaL52pjGx8YG+quJ1e2mzNjOFlv+8fbbhkOmVCegGFYRs+o5OLOGtRSaXm cd+0LkVNS/b0h9nzlSO8XdXsMXyxSYjS3rk7MZlwmjsKL8GXfCzRyE2gApEcbnYkEVSC b0GCh5NAKbgCJy3g2X3qhvpQurydxuYX5z2cfU8p8ekMiZkEq+EbTfMsWloVBVFMvFgb 7aSQ== 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=hH2HSF1ATlu64pBHRbjIQDBZAQ6Nm/0pU03a9lYiJAE=; b=VpA4XumoDqjlMG3JJFu8PRdZCq3IZm3tCH1kGQlcp5Xodl6D0BH+Qnl4YZqIuOHwBM UyMuyB6a2iZTI6G0qLISqpELBB/bpws7DdXTLSlSWEdxJbRLDeBFtr/WTFH+rjEn+7YN gLS0/bDZaeRswfZAz/VVjOJYKafatdBsu4iJdQ4bmm9V2/amNcd72j8Tc3llAFwn65N/ /fnJI77MxXR1sb/KUkr4f+6dewmFzYbBPLJ2lNvcjMNWEG4lupT0xzNattYEwAcDFfxp toA7/d3o+yB1/ysDJDtAoAxtqroXjY9QtV/T6ub7iwYCFohrR52ac9PL7vzUXREyfItQ rjHQ== X-Gm-Message-State: ALyK8tIqpDF8O85Mngh4aLMxUqYloQYD7YaigIwD3Y/vKm9Kn/Xj+Ve0ZjcROhMYiix8gCA7HqZ3clXmJNFwNVx4 X-Received: by 10.36.122.129 with SMTP id a123mr47294700itc.44.1468866498086; Mon, 18 Jul 2016 11:28:18 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.59.193 with HTTP; Mon, 18 Jul 2016 11:28:17 -0700 (PDT) In-Reply-To: <343F413D-48B9-47C6-9C3C-1B2C78C3FA39@freebsd.org> References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> <343F413D-48B9-47C6-9C3C-1B2C78C3FA39@freebsd.org> From: Maxim Sobolev Date: Mon, 18 Jul 2016 11:28:17 -0700 X-Google-Sender-Auth: 9hLpG8ESej2qT6ROKSas4xmlaUo Message-ID: Subject: Re: svn commit: r302985 - head/sys/geom/label To: Devin Teske Cc: "Andrey V. Elsukov" , 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-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: Mon, 18 Jul 2016 18:28:19 -0000 I think people might be worried about existing deployed systems that might stop booting if geom label obscures the whole disk making one or more slices unavailable via geom_label mechanism. -Max On Mon, Jul 18, 2016 at 10:09 AM, Devin Teske wrote: > > > On Jul 18, 2016, at 7:24 AM, Maxim Sobolev wrote: > > > > Andrey, are you talking about this: > > > > --- > > r156299 | pjd | 2006-03-04 11:41:54 -0800 (=D1=81=D0=B1, 04 =D0=BC=D0= =B0=D1=80 2006) | 11 lines > > > > We need to check if file system size is equal to provider's size, becau= se > > sysinstall(8) > > > ?? sysinstall ?? in head ?? > > -- > Devin > > From owner-svn-src-head@freebsd.org Mon Jul 18 19:14: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 7E376B9D76D; Mon, 18 Jul 2016 19:14:44 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward4p.cmail.yandex.net (forward4p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED7181B27; Mon, 18 Jul 2016 19:14:43 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp1h.mail.yandex.net (smtp1h.mail.yandex.net [IPv6:2a02:6b8:0:f05::115]) by forward4p.cmail.yandex.net (Yandex) with ESMTP id 305162039C; Mon, 18 Jul 2016 22:14:31 +0300 (MSK) Received: from smtp1h.mail.yandex.net (localhost [127.0.0.1]) by smtp1h.mail.yandex.net (Yandex) with ESMTP id 2D7E51340354; Mon, 18 Jul 2016 22:14:31 +0300 (MSK) Received: by smtp1h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id QbgBrklslL-EUWSFm99; Mon, 18 Jul 2016 22:14:30 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1468869270; bh=FXJyvP/5852d++VhK9pBE3Tf2NFB9UM7aVKUA/DRiPE=; h=Subject:To:References:Cc:From:Message-ID:Date:In-Reply-To; b=jbKnqjWsc8hFW69cNsTupRIDdMzSEN4lubyM3bMVrMS4u8UCeCTLvjws4rNLwCQ4i 1egTxWiZyXKmmuA8j4e2FrudU7wwQkQecHUOXh9XfH7pTv8aDc/f1PxfwfTyqUVRFC ymKt/XxSw5A7ByIjiR2Oj4nJOKfHUTZrAhAwSSaM= Authentication-Results: smtp1h.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0 Subject: Re: svn commit: r302985 - head/sys/geom/label To: Maxim Sobolev References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: "Andrey V. Elsukov" Message-ID: <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> Date: Mon, 18 Jul 2016 22:13:31 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ueGpDXr6A1K3eXTg85Ifr9keESwJkPJ5Q" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 19:14:44 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ueGpDXr6A1K3eXTg85Ifr9keESwJkPJ5Q Content-Type: multipart/mixed; boundary="CnHlJHfBC52c2jQvNlb5Aw9bv8gw2eqNq" From: "Andrey V. Elsukov" To: Maxim Sobolev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> Subject: Re: svn commit: r302985 - head/sys/geom/label References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> In-Reply-To: --CnHlJHfBC52c2jQvNlb5Aw9bv8gw2eqNq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.07.16 17:24, Maxim Sobolev wrote: > Andrey, are you talking about this: >=20 > --- > r156299 | pjd | 2006-03-04 11:41:54 -0800 (=D1=81=D0=B1, 04 =D0=BC=D0=B0= =D1=80 2006) | 11 lines >=20 > We need to check if file system size is equal to provider's size, becau= se > sysinstall(8) still bogusly puts first partition at offset 0 instead of= 16, > so glabel/ufs will find file system on slice instead of partition. >=20 > Before sysinstall is fixed, we must keep this code, which means that we= > wont't be able to detect UFS file systems created with 'newfs -s ...'. >=20 > PS. bsdlabel(8) creates partitions properly. >=20 > MFC after: 3 days > --- >=20 > In which case this particular change has a better chance of working > since it's not removing this check but making it less strict. Therefore= > it might attach to a wrong provider only if first UFS slice is the only= > one slice on partition (or if the other partition is very small - less > than 256 blocks in size). In either of those cases I don't think it > makes much difference if we are attaching to a slice or a partition. No, I mean r235918, that was reverted after several complains. UFS label is a special label. It always had the same size that provider. Now it will attach to first provider that will be tasted. It can be gmirror, generic glabel, geli, gpart, mbr, whole disk. https://lists.freebsd.org/pipermail/freebsd-geom/2009-April/003473.html --=20 WBR, Andrey V. Elsukov --CnHlJHfBC52c2jQvNlb5Aw9bv8gw2eqNq-- --ueGpDXr6A1K3eXTg85Ifr9keESwJkPJ5Q 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/ iQEvBAEBCAAZBQJXjSpcEhxidTdjaGVyQHlhbmRleC5ydQAKCRABxeoEEMihejOx B/9DwDnHZOgrc/BmUPhgptCCCJR9ZElPnKvqqCQrO4hwLaOhaAHRSD/FwV3168eD Nd8YQn3rK5Sx8oEgDtEymzp0y/crCRmX7d5fbliqPW3atvlNVzEhPEvGByLbW06s Tg11jLnjQLwFAYrf5JQZU5h68nVggRNSJ2T1e6ZTl/pdFbblxViXkLfvVeGdieKP edtnIb37lNzsoLpniwfibRFB5iXGWE0YDQC7cSfYuDQXw/1/TMV6W3xZrXwk77/r uF+5nqXc3zpzoMrGMyenBC7PrCKRbJ46IOMHsXBM2hO+Y0NrOHjLr1Don4Lp16EI FdHOTBffUR8xRgfJ+LuAxVQ5 =toTJ -----END PGP SIGNATURE----- --ueGpDXr6A1K3eXTg85Ifr9keESwJkPJ5Q-- From owner-svn-src-head@freebsd.org Mon Jul 18 19:20: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 87333B9DA84; Mon, 18 Jul 2016 19:20:50 +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 59EB41EA9; Mon, 18 Jul 2016 19:20: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 u6IJKn7i087515; Mon, 18 Jul 2016 19:20:49 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IJKnXS087514; Mon, 18 Jul 2016 19:20:49 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607181920.u6IJKnXS087514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 18 Jul 2016 19:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303011 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 19:20:50 -0000 Author: ache Date: Mon Jul 18 19:20:49 2016 New Revision: 303011 URL: https://svnweb.freebsd.org/changeset/base/303011 Log: Change patch from r303004 case 3. According to POSIX gl_errfunc should be called first, then GLOB_ERR should be considered. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 18:24:31 2016 (r303010) +++ head/lib/libc/gen/glob.c Mon Jul 18 19:20:49 2016 (r303011) @@ -714,9 +714,7 @@ glob3(Char *pathbuf, Char *pathend, Char if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { if (errno == ENOENT || errno == ENOTDIR) return (0); - if (pglob->gl_flags & GLOB_ERR) - return (GLOB_ABORTED); - if (pglob->gl_errfunc) { + if (pglob->gl_errfunc != NULL) { if (g_Ctoc(pathbuf, buf, sizeof(buf))) { errno = 0; return (GLOB_NOSPACE); @@ -724,6 +722,8 @@ glob3(Char *pathbuf, Char *pathend, Char if (pglob->gl_errfunc(buf, errno)) return (GLOB_ABORTED); } + if (pglob->gl_flags & GLOB_ERR) + return (GLOB_ABORTED); return (0); } From owner-svn-src-head@freebsd.org Mon Jul 18 19:37: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 21F20B9D04C for ; Mon, 18 Jul 2016 19:37:42 +0000 (UTC) (envelope-from sobomax@sippysoft.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 DCA041946 for ; Mon, 18 Jul 2016 19:37:41 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x234.google.com with SMTP id f6so75855525ith.1 for ; Mon, 18 Jul 2016 12:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Gt2MRXUzSh3TrtgviKtD+ogKOXWEELccKlxlVu25fT4=; b=rm0/zGd97tBYJXzYDbqFQkCnUDTZQUWgO1eJCaBOrwilaRmC/RFe4ve9TZKU6kAHu+ ktGTiKxrBaTXCjU3vsiUrGrE5S7teaWQc0VTHJfR/WVPgiy1EFIG824lpFyzuuWK1o7b iDM1XZb8JPFGMSBF6I5BO4cCVFUKnASZt21CKTbHhOkgnM1V5iRd2vKjHbUljggUbGWp x/36NzSSJm9rSBxwTr6+853sIFVChLEUsOyulwR5m5eFq7onXt+CpoG0U0KLOHtt0vK/ q5NACr/SgxcyENgGVqXr7y2ICKgOkPuq4mkTo6IrS7DW8HmEbf1IrdFEFNrMY+w3tae+ 15qw== 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=Gt2MRXUzSh3TrtgviKtD+ogKOXWEELccKlxlVu25fT4=; b=WKjfljrh7mZ83xFZJvZosIq7DU/PnEo4KYHVPqKk4Mdlaq/6cteMv1A/+iVSnSO1Bf DtPtHuPWFnRDB/SEOfixDmiv/+cgSuigMcObjhaCKeirC6WjSqeCkOi2gWcGlRUyujb4 kKGCorbQKB1Smbdr1CEIgEArMKhyZ0W7+nNHL34xCVkOtGpTXFiMbXblp+A4Re97Je3Q LUw4GlBbBePF9VjgbfZbOyheWXti0Yzt0Th1W50Yja+1ArkZO5NuSPwJdXERZA1rO1Hc rtoLiJh5sI5UcUG34TpvGfK7fMx1PukZzSYr/wNvw0IrmqClE1AEMWwaNA7E94TnbN8F 9cBw== X-Gm-Message-State: ALyK8tKFqXLulQZT8JZrw/E+aJRaX1+PM/NNMvLAh4EMY682n2MX/HUk6OuHitwb4kfy5F2C5F5P8Y2wovwR/89k X-Received: by 10.36.118.19 with SMTP id z19mr122919itb.44.1468870661149; Mon, 18 Jul 2016 12:37:41 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.59.193 with HTTP; Mon, 18 Jul 2016 12:37:40 -0700 (PDT) In-Reply-To: <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> From: Maxim Sobolev Date: Mon, 18 Jul 2016 12:37:40 -0700 X-Google-Sender-Auth: klxnuK1TIf9wcAiLv9zxjE-qS1g Message-ID: Subject: Re: svn commit: r302985 - head/sys/geom/label 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 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: Mon, 18 Jul 2016 19:37:42 -0000 Well, this looks to me exactly what I am talking about. With this change we are only allowing underlying provider to be *slighly* bigger than the UFS size. So as I said it's pretty harmless to do so, or at least I think it is. In general I think this case is underlying some missing design feature of GEOM framework, which basically gives provider to a first bidder that likes the taste of it. What needs to be happening instead is to have some rank in there, so if consumer A and consumer B both "like" the taste, but provider A has bigger rank it would be given a preference. Then "whole disk" partitioning schemes (mbr, gpt) could be given biggest rank, BSD label and friends slightly smaller, encryption/compression yet smaller and providers that just "decorate" things, like LABEL the lowest possible. -Max On Mon, Jul 18, 2016 at 12:13 PM, Andrey V. Elsukov wrote: > On 18.07.16 17:24, Maxim Sobolev wrote: > > Andrey, are you talking about this: > > > > --- > > r156299 | pjd | 2006-03-04 11:41:54 -0800 (=D1=81=D0=B1, 04 =D0=BC=D0= =B0=D1=80 2006) | 11 lines > > > > We need to check if file system size is equal to provider's size, becau= se > > sysinstall(8) still bogusly puts first partition at offset 0 instead of > 16, > > so glabel/ufs will find file system on slice instead of partition. > > > > Before sysinstall is fixed, we must keep this code, which means that we > > wont't be able to detect UFS file systems created with 'newfs -s ...'. > > > > PS. bsdlabel(8) creates partitions properly. > > > > MFC after: 3 days > > --- > > > > In which case this particular change has a better chance of working > > since it's not removing this check but making it less strict. Therefore > > it might attach to a wrong provider only if first UFS slice is the only > > one slice on partition (or if the other partition is very small - less > > than 256 blocks in size). In either of those cases I don't think it > > makes much difference if we are attaching to a slice or a partition. > > No, I mean r235918, that was reverted after several complains. > UFS label is a special label. It always had the same size that provider. > Now it will attach to first provider that will be tasted. It can be > gmirror, generic glabel, geli, gpart, mbr, whole disk. > > https://lists.freebsd.org/pipermail/freebsd-geom/2009-April/003473.html > > -- > WBR, Andrey V. Elsukov > > From owner-svn-src-head@freebsd.org Mon Jul 18 19:46: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 C9FDCB9D299; Mon, 18 Jul 2016 19:46:33 +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 6CE261F1B; Mon, 18 Jul 2016 19:46:33 +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 u6IJkWpV096725; Mon, 18 Jul 2016 19:46:32 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IJkVKO096708; Mon, 18 Jul 2016 19:46:31 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201607181946.u6IJkVKO096708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Jul 2016 19:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303012 - in head: sbin/ipfw sys/conf sys/modules sys/modules/ipfw_nptv6 sys/netinet sys/netinet6 sys/netpfil/ipfw/nptv6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 19:46:33 -0000 Author: ae Date: Mon Jul 18 19:46:31 2016 New Revision: 303012 URL: https://svnweb.freebsd.org/changeset/base/303012 Log: Add ipfw_nptv6 module that implements Network Prefix Translation for IPv6 as defined in RFC 6296. The module works together with ipfw(4) and implemented as its external action module. When it is loaded, it registers as eaction and can be used in rules. The usage pattern is similar to ipfw_nat(4). All matched by rule traffic goes to the NPT module. Reviewed by: hrs Obtained from: Yandex LLC MFC after: 1 month Relnotes: yes Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D6420 Added: head/sbin/ipfw/nptv6.c (contents, props changed) head/sys/modules/ipfw_nptv6/ head/sys/modules/ipfw_nptv6/Makefile (contents, props changed) head/sys/netinet6/ip_fw_nptv6.h (contents, props changed) head/sys/netpfil/ipfw/nptv6/ head/sys/netpfil/ipfw/nptv6/ip_fw_nptv6.c (contents, props changed) head/sys/netpfil/ipfw/nptv6/nptv6.c (contents, props changed) head/sys/netpfil/ipfw/nptv6/nptv6.h (contents, props changed) Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/main.c head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/modules/Makefile head/sys/netinet/ip_fw.h Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Mon Jul 18 19:20:49 2016 (r303011) +++ head/sbin/ipfw/Makefile Mon Jul 18 19:46:31 2016 (r303012) @@ -5,6 +5,7 @@ PACKAGE=ipfw PROG= ipfw SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c tables.c +SRCS+= nptv6.c WARNS?= 2 .if ${MK_PF} != "no" Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Jul 18 19:20:49 2016 (r303011) +++ head/sbin/ipfw/ipfw.8 Mon Jul 18 19:46:31 2016 (r303012) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 26, 2016 +.Dd July 18, 2016 .Dt IPFW 8 .Os .Sh NAME @@ -113,6 +113,19 @@ in-kernel NAT. .Oc .Oc .Ar pathname +.Ss IPv6-to-IPv6 NETWORK PREFIX TRANSLATION +.Nm +.Oo Cm set Ar N Oc Cm nptv6 Ar name Cm create Ar create-options +.Nm +.Oo Cm set Ar N Oc Cm nptv6 +.Brq Ar name | all +.Brq Cm list | show +.Nm +.Oo Cm set Ar N Oc Cm nptv6 +.Brq Ar name | all +.Cm destroy +.Nm +.Oo Cm set Ar N Oc Cm nptv6 Ar name Cm stats .Ss INTERNAL DIAGNOSTICS .Nm .Cm internal iflist @@ -813,6 +826,11 @@ nat instance see the .Sx NETWORK ADDRESS TRANSLATION (NAT) Section for further information. +.It Cm nptv6 Ar name +Pass packet to a NPTv6 instance (for IPv6-to-IPv6 network prefix translation): +see the +.Sx IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6) +Section for further information. .It Cm pipe Ar pipe_nr Pass packet to a .Nm dummynet @@ -2885,6 +2903,47 @@ instances. See .Sx SYSCTL VARIABLES for more info. +.Sh IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6) +.Nm +support in-kernel IPv6-to-IPv6 network prefix translation as described +in RFC6296. +The kernel module +.Cm ipfw_nptv6 +should be loaded or kernel should has +.Cm options IPFIREWALL_NPTV6 +to be able use NPTv6 translator. +.Pp +The NPTv6 configuration command is the following: +.Bd -ragged -offset indent +.Bk -words +.Cm nptv6 +.Ar name +.Cm create +.Ar create-options +.Ek +.Ed +.Pp +The following parameters can be configured: +.Bl -tag -width indent +.It Cm int_prefix Ar ipv6_prefix +IPv6 prefix used in internal network. +NPTv6 module translates source address when it matches this prefix. +.It Cm ext_prefix Ar ipv6_prefix +IPv6 prefix used in external network. +NPTv6 module translates destination address when it matches this prefix. +.It Cm prefixlen Ar length +The length of specified IPv6 prefixes. It must be in range from 8 to 64. +.El +.Pp +Note that the prefix translation rules are silently ignored when IPv6 packet +forwarding is disabled. +To enable the packet forwarding, set the sysctl variable +.Va net.inet6.ip6.forwarding +to 1. +.Pp +To let the packet continue after being translated, set the sysctl variable +.Va net.inet.ip.fw.one_pass +to 0. .Sh LOADER TUNABLES Tunables can be set in .Xr loader 8 Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jul 18 19:20:49 2016 (r303011) +++ head/sbin/ipfw/ipfw2.c Mon Jul 18 19:46:31 2016 (r303012) @@ -235,6 +235,7 @@ static struct _s_x ether_types[] = { }; static struct _s_x rule_eactions[] = { + { "nptv6", TOK_NPTV6 }, { NULL, 0 } /* terminator */ }; Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Jul 18 19:20:49 2016 (r303011) +++ head/sbin/ipfw/ipfw2.h Mon Jul 18 19:46:31 2016 (r303012) @@ -254,6 +254,13 @@ enum tokens { TOK_UNLOCK, TOK_VLIST, TOK_OLIST, + TOK_STATS, + + /* NPTv6 tokens */ + TOK_NPTV6, + TOK_INTPREFIX, + TOK_EXTPREFIX, + TOK_PREFIXLEN, }; /* @@ -340,6 +347,7 @@ void ipfw_flush(int force); void ipfw_zero(int ac, char *av[], int optname); void ipfw_list(int ac, char *av[], int show_counters); void ipfw_internal_handler(int ac, char *av[]); +void ipfw_nptv6_handler(int ac, char *av[]); int ipfw_check_object_name(const char *name); #ifdef PF Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Mon Jul 18 19:20:49 2016 (r303011) +++ head/sbin/ipfw/main.c Mon Jul 18 19:46:31 2016 (r303012) @@ -425,6 +425,8 @@ ipfw_main(int oldac, char **oldav) if (co.use_set || try_next) { if (_substrcmp(*av, "delete") == 0) ipfw_delete(av); + else if (!strncmp(*av, "nptv6", strlen(*av))) + ipfw_nptv6_handler(ac, av); else if (_substrcmp(*av, "flush") == 0) ipfw_flush(co.do_force); else if (_substrcmp(*av, "zero") == 0) Added: head/sbin/ipfw/nptv6.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ipfw/nptv6.c Mon Jul 18 19:46:31 2016 (r303012) @@ -0,0 +1,399 @@ +/*- + * Copyright (c) 2016 Yandex LLC + * Copyright (c) 2016 Andrey V. Elsukov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include "ipfw2.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +typedef int (nptv6_cb_t)(ipfw_nptv6_cfg *i, const char *name, uint8_t set); +static int nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, + int sort); + +static void nptv6_create(const char *name, uint8_t set, int ac, char **av); +static void nptv6_destroy(const char *name, uint8_t set); +static void nptv6_stats(const char *name, uint8_t set); +static int nptv6_show_cb(ipfw_nptv6_cfg *cfg, const char *name, uint8_t set); +static int nptv6_destroy_cb(ipfw_nptv6_cfg *cfg, const char *name, uint8_t set); + +static struct _s_x nptv6cmds[] = { + { "create", TOK_CREATE }, + { "destroy", TOK_DESTROY }, + { "list", TOK_LIST }, + { "show", TOK_LIST }, + { "stats", TOK_STATS }, + { NULL, 0 } +}; + +/* + * This one handles all NPTv6-related commands + * ipfw [set N] nptv6 NAME {create | config} ... + * ipfw [set N] nptv6 NAME stats + * ipfw [set N] nptv6 {NAME | all} destroy + * ipfw [set N] nptv6 {NAME | all} {list | show} + */ +#define nptv6_check_name table_check_name +void +ipfw_nptv6_handler(int ac, char *av[]) +{ + const char *name; + int tcmd; + uint8_t set; + + if (co.use_set != 0) + set = co.use_set - 1; + else + set = 0; + ac--; av++; + + NEED1("nptv6 needs instance name"); + name = *av; + if (nptv6_check_name(name) != 0) { + if (strcmp(name, "all") == 0) { + name = NULL; + } else + errx(EX_USAGE, "nptv6 instance name %s is invalid", + name); + } + ac--; av++; + NEED1("nptv6 needs command"); + + tcmd = get_token(nptv6cmds, *av, "nptv6 command"); + if (name == NULL && tcmd != TOK_DESTROY && tcmd != TOK_LIST) + errx(EX_USAGE, "nptv6 instance name required"); + switch (tcmd) { + case TOK_CREATE: + ac--; av++; + nptv6_create(name, set, ac, av); + break; + case TOK_LIST: + nptv6_foreach(nptv6_show_cb, name, set, 1); + break; + case TOK_DESTROY: + if (name == NULL) + nptv6_foreach(nptv6_destroy_cb, NULL, set, 0); + else + nptv6_destroy(name, set); + break; + case TOK_STATS: + nptv6_stats(name, set); + } +} + + +static void +nptv6_fill_ntlv(ipfw_obj_ntlv *ntlv, const char *name, uint8_t set) +{ + + ntlv->head.type = IPFW_TLV_EACTION_NAME(1); /* it doesn't matter */ + ntlv->head.length = sizeof(ipfw_obj_ntlv); + ntlv->idx = 1; + ntlv->set = set; + strlcpy(ntlv->name, name, sizeof(ntlv->name)); +} + +static struct _s_x nptv6newcmds[] = { + { "int_prefix", TOK_INTPREFIX }, + { "ext_prefix", TOK_EXTPREFIX }, + { "prefixlen", TOK_PREFIXLEN }, + { NULL, 0 } +}; + + +static void +nptv6_parse_prefix(const char *arg, struct in6_addr *prefix, int *len) +{ + char *p, *l; + + p = strdup(arg); + if (p == NULL) + err(EX_OSERR, NULL); + if ((l = strchr(p, '/')) != NULL) + *l++ = '\0'; + if (inet_pton(AF_INET6, p, prefix) != 1) + errx(EX_USAGE, "Bad prefix: %s", p); + if (l != NULL) { + *len = (int)strtol(l, &l, 10); + if (*l != '\0' || *len <= 0 || *len > 64) + errx(EX_USAGE, "Bad prefix length: %s", arg); + } else + *len = 0; + free(p); +} +/* + * Creates new nptv6 instance + * ipfw nptv6 create int_prefix ext_prefix + * Request: [ ipfw_obj_lheader ipfw_nptv6_cfg ] + */ +#define NPTV6_HAS_INTPREFIX 0x01 +#define NPTV6_HAS_EXTPREFIX 0x02 +#define NPTV6_HAS_PREFIXLEN 0x04 +static void +nptv6_create(const char *name, uint8_t set, int ac, char *av[]) +{ + char buf[sizeof(ipfw_obj_lheader) + sizeof(ipfw_nptv6_cfg)]; + struct in6_addr mask; + ipfw_nptv6_cfg *cfg; + ipfw_obj_lheader *olh; + int tcmd, flags, plen; + char *p = "\0"; + + plen = 0; + memset(buf, 0, sizeof(buf)); + olh = (ipfw_obj_lheader *)buf; + cfg = (ipfw_nptv6_cfg *)(olh + 1); + cfg->set = set; + flags = 0; + while (ac > 0) { + tcmd = get_token(nptv6newcmds, *av, "option"); + ac--; av++; + + switch (tcmd) { + case TOK_INTPREFIX: + NEED1("IPv6 prefix required"); + nptv6_parse_prefix(*av, &cfg->internal, &plen); + flags |= NPTV6_HAS_INTPREFIX; + if (plen > 0) + goto check_prefix; + ac--; av++; + break; + case TOK_EXTPREFIX: + NEED1("IPv6 prefix required"); + nptv6_parse_prefix(*av, &cfg->external, &plen); + flags |= NPTV6_HAS_EXTPREFIX; + if (plen > 0) + goto check_prefix; + ac--; av++; + break; + case TOK_PREFIXLEN: + NEED1("IPv6 prefix length required"); + plen = strtol(*av, &p, 10); +check_prefix: + if (*p != '\0' || plen < 8 || plen > 64) + errx(EX_USAGE, "wrong prefix length: %s", *av); + /* RFC 6296 Sec. 3.1 */ + if (cfg->plen > 0 && cfg->plen != plen) { + warnx("Prefix length mismatch (%d vs %d). " + "It was extended up to %d", + cfg->plen, plen, MAX(plen, cfg->plen)); + plen = MAX(plen, cfg->plen); + } + cfg->plen = plen; + flags |= NPTV6_HAS_PREFIXLEN; + ac--; av++; + break; + } + } + + /* Check validness */ + if ((flags & NPTV6_HAS_INTPREFIX) != NPTV6_HAS_INTPREFIX) + errx(EX_USAGE, "int_prefix required"); + if ((flags & NPTV6_HAS_EXTPREFIX) != NPTV6_HAS_EXTPREFIX) + errx(EX_USAGE, "ext_prefix required"); + if ((flags & NPTV6_HAS_PREFIXLEN) != NPTV6_HAS_PREFIXLEN) + errx(EX_USAGE, "prefixlen required"); + + n2mask(&mask, cfg->plen); + APPLY_MASK(&cfg->internal, &mask); + APPLY_MASK(&cfg->external, &mask); + + olh->count = 1; + olh->objsize = sizeof(*cfg); + olh->size = sizeof(buf); + strlcpy(cfg->name, name, sizeof(cfg->name)); + if (do_set3(IP_FW_NPTV6_CREATE, &olh->opheader, sizeof(buf)) != 0) + err(EX_OSERR, "nptv6 instance creation failed"); +} + +/* + * Destroys NPTv6 instance. + * Request: [ ipfw_obj_header ] + */ +static void +nptv6_destroy(const char *name, uint8_t set) +{ + ipfw_obj_header oh; + + memset(&oh, 0, sizeof(oh)); + nptv6_fill_ntlv(&oh.ntlv, name, set); + if (do_set3(IP_FW_NPTV6_DESTROY, &oh.opheader, sizeof(oh)) != 0) + err(EX_OSERR, "failed to destroy nat instance %s", name); +} + +/* + * Get NPTv6 instance statistics. + * Request: [ ipfw_obj_header ] + * Reply: [ ipfw_obj_header ipfw_obj_ctlv [ uint64_t x N ] ] + */ +static int +nptv6_get_stats(const char *name, uint8_t set, struct ipfw_nptv6_stats *stats) +{ + ipfw_obj_header *oh; + ipfw_obj_ctlv *oc; + size_t sz; + + sz = sizeof(*oh) + sizeof(*oc) + sizeof(*stats); + oh = calloc(1, sz); + nptv6_fill_ntlv(&oh->ntlv, name, set); + if (do_get3(IP_FW_NPTV6_STATS, &oh->opheader, &sz) == 0) { + oc = (ipfw_obj_ctlv *)(oh + 1); + memcpy(stats, oc + 1, sizeof(*stats)); + free(oh); + return (0); + } + free(oh); + return (-1); +} + +static void +nptv6_stats(const char *name, uint8_t set) +{ + struct ipfw_nptv6_stats stats; + + if (nptv6_get_stats(name, set, &stats) != 0) + err(EX_OSERR, "Error retrieving stats"); + + printf("Number of packets translated (internal to external): %ju\n", + (uintmax_t)stats.in2ex); + printf("Number of packets translated (external to internal): %ju\n", + (uintmax_t)stats.ex2in); + printf("Number of packets dropped due to some error: %ju\n", + (uintmax_t)stats.dropped); +} + +static int +nptv6_show_cb(ipfw_nptv6_cfg *cfg, const char *name, uint8_t set) +{ + char abuf[INET6_ADDRSTRLEN]; + + if (name != NULL && strcmp(cfg->name, name) != 0) + return (ESRCH); + + if (co.use_set != 0 && cfg->set != set) + return (ESRCH); + + if (co.use_set != 0 || cfg->set != 0) + printf("set %u ", cfg->set); + inet_ntop(AF_INET6, &cfg->internal, abuf, sizeof(abuf)); + printf("nptv6 %s int_prefix %s ", cfg->name, abuf); + inet_ntop(AF_INET6, &cfg->external, abuf, sizeof(abuf)); + printf("ext_prefix %s prefixlen %u\n", abuf, cfg->plen); + return (0); +} + +static int +nptv6_destroy_cb(ipfw_nptv6_cfg *cfg, const char *name, uint8_t set) +{ + + if (co.use_set != 0 && cfg->set != set) + return (ESRCH); + + nptv6_destroy(cfg->name, cfg->set); + return (0); +} + + +/* + * Compare NPTv6 instances names. + * Honor number comparison. + */ +static int +nptv6name_cmp(const void *a, const void *b) +{ + ipfw_nptv6_cfg *ca, *cb; + + ca = (ipfw_nptv6_cfg *)a; + cb = (ipfw_nptv6_cfg *)b; + + if (ca->set > cb->set) + return (1); + else if (ca->set < cb->set) + return (-1); + return (stringnum_cmp(ca->name, cb->name)); +} + +/* + * Retrieves NPTv6 instance list from kernel, + * Request: [ ipfw_obj_lheader ] + * Reply: [ ipfw_obj_lheader ipfw_nptv6_cfg x N ] + */ +static int +nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, int sort) +{ + ipfw_obj_lheader *olh; + ipfw_nptv6_cfg *cfg; + size_t sz; + int i, error; + + /* Start with reasonable default */ + sz = sizeof(*olh) + 16 * sizeof(*cfg); + for (;;) { + if ((olh = calloc(1, sz)) == NULL) + return (ENOMEM); + + olh->size = sz; + if (do_get3(IP_FW_NPTV6_LIST, &olh->opheader, &sz) != 0) { + sz = olh->size; + free(olh); + if (errno != ENOMEM) + return (errno); + continue; + } + + if (sort != 0) + qsort(olh + 1, olh->count, olh->objsize, nptv6name_cmp); + + cfg = (ipfw_nptv6_cfg *)(olh + 1); + for (i = 0; i < olh->count; i++) { + error = f(cfg, name, set); + cfg = (ipfw_nptv6_cfg *)((caddr_t)cfg + olh->objsize); + } + free(olh); + break; + } + return (0); +} + Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Jul 18 19:20:49 2016 (r303011) +++ head/sys/conf/NOTES Mon Jul 18 19:46:31 2016 (r303012) @@ -965,6 +965,8 @@ device lagg # IPFIREWALL_NAT adds support for in kernel nat in ipfw, and it requires # LIBALIAS. # +# IPFIREWALL_NPTV6 adds support for in kernel NPTv6 in ipfw. +# # IPSTEALTH enables code to support stealth forwarding (i.e., forwarding # packets without touching the TTL). This can be useful to hide firewalls # from traceroute and similar tools. @@ -986,6 +988,7 @@ options IPFIREWALL_VERBOSE #enable logg options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default options IPFIREWALL_NAT #ipfw kernel nat support +options IPFIREWALL_NPTV6 #ipfw kernel IPv6 NPT support options IPDIVERT #divert sockets options IPFILTER #ipfilter support options IPFILTER_LOG #ipfilter logging Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jul 18 19:20:49 2016 (r303011) +++ head/sys/conf/files Mon Jul 18 19:46:31 2016 (r303012) @@ -3859,6 +3859,10 @@ netpfil/ipfw/ip_fw_table_algo.c optional netpfil/ipfw/ip_fw_table_value.c optional inet ipfirewall netpfil/ipfw/ip_fw_iface.c optional inet ipfirewall netpfil/ipfw/ip_fw_nat.c optional inet ipfirewall_nat +netpfil/ipfw/nptv6/ip_fw_nptv6.c optional inet inet6 ipfirewall \ + ipfirewall_nptv6 +netpfil/ipfw/nptv6/nptv6.c optional inet inet6 ipfirewall \ + ipfirewall_nptv6 netpfil/pf/if_pflog.c optional pflog pf inet netpfil/pf/if_pfsync.c optional pfsync pf inet netpfil/pf/pf.c optional pf inet Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Jul 18 19:20:49 2016 (r303011) +++ head/sys/conf/options Mon Jul 18 19:46:31 2016 (r303012) @@ -417,6 +417,7 @@ IPFILTER_LOOKUP opt_ipfilter.h IPFIREWALL opt_ipfw.h IPFIREWALL_DEFAULT_TO_ACCEPT opt_ipfw.h IPFIREWALL_NAT opt_ipfw.h +IPFIREWALL_NPTV6 opt_ipfw.h IPFIREWALL_VERBOSE opt_ipfw.h IPFIREWALL_VERBOSE_LIMIT opt_ipfw.h IPSEC opt_ipsec.h Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Jul 18 19:20:49 2016 (r303011) +++ head/sys/modules/Makefile Mon Jul 18 19:46:31 2016 (r303012) @@ -167,6 +167,7 @@ SUBDIR= \ ${_ipfilter} \ ${_ipfw} \ ipfw_nat \ + ${_ipfw_nptv6} \ ${_ipmi} \ ip6_mroute_mod \ ip_mroute_mod \ @@ -460,6 +461,10 @@ _ipdivert= ipdivert _ipfw= ipfw .endif +.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES) +_ipfw_nptv6= ipfw_nptv6 +.endif + .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) _ipfilter= ipfilter .endif Added: head/sys/modules/ipfw_nptv6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/ipfw_nptv6/Makefile Mon Jul 18 19:46:31 2016 (r303012) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../netpfil/ipfw/nptv6 + +KMOD= ipfw_nptv6 +SRCS= ip_fw_nptv6.c nptv6.c opt_ipfw.h + +.include Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Jul 18 19:20:49 2016 (r303011) +++ head/sys/netinet/ip_fw.h Mon Jul 18 19:46:31 2016 (r303012) @@ -109,6 +109,12 @@ typedef struct _ip_fw3_opheader { #define IP_FW_DUMP_SOPTCODES 116 /* Dump available sopts/versions */ #define IP_FW_DUMP_SRVOBJECTS 117 /* Dump existing named objects */ +#define IP_FW_NPTV6_CREATE 150 /* Create NPTv6 instance */ +#define IP_FW_NPTV6_DESTROY 151 /* Destroy NPTv6 instance */ +#define IP_FW_NPTV6_CONFIG 152 /* Modify NPTv6 instance */ +#define IP_FW_NPTV6_LIST 153 /* List NPTv6 instances */ +#define IP_FW_NPTV6_STATS 154 /* Get NPTv6 instance statistics */ + /* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF @@ -783,6 +789,7 @@ typedef struct _ipfw_obj_tlv { #define IPFW_TLV_TBLENT_LIST 8 #define IPFW_TLV_RANGE 9 #define IPFW_TLV_EACTION 10 +#define IPFW_TLV_COUNTERS 11 #define IPFW_TLV_EACTION_BASE 1000 #define IPFW_TLV_EACTION_NAME(arg) (IPFW_TLV_EACTION_BASE + (arg)) Added: head/sys/netinet6/ip_fw_nptv6.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet6/ip_fw_nptv6.h Mon Jul 18 19:46:31 2016 (r303012) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2016 Yandex LLC + * Copyright (c) 2016 Andrey V. Elsukov + * 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$ + */ + +#ifndef _NETINET6_IP_FW_NPTV6_H_ +#define _NETINET6_IP_FW_NPTV6_H_ + +struct ipfw_nptv6_stats { + uint64_t in2ex; /* Int->Ext packets translated */ + uint64_t ex2in; /* Ext->Int packets translated */ + uint64_t dropped; /* dropped due to some errors */ + uint64_t reserved[5]; +}; + +typedef struct _ipfw_nptv6_cfg { + char name[64]; /* NPTv6 instance name */ + struct in6_addr internal; /* NPTv6 internal prefix */ + struct in6_addr external; /* NPTv6 external prefix */ + uint8_t plen; /* Prefix length */ + uint8_t set; /* Named instance set [0..31] */ + uint8_t spare[2]; + uint32_t flags; +} ipfw_nptv6_cfg; + +#endif /* _NETINET6_IP_FW_NPTV6_H_ */ + Added: head/sys/netpfil/ipfw/nptv6/ip_fw_nptv6.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netpfil/ipfw/nptv6/ip_fw_nptv6.c Mon Jul 18 19:46:31 2016 (r303012) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2016 Yandex LLC + * Copyright (c) 2016 Andrey V. Elsukov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +static int +vnet_ipfw_nptv6_init(const void *arg __unused) +{ + + return (nptv6_init(&V_layer3_chain, IS_DEFAULT_VNET(curvnet))); +} + +static int +vnet_ipfw_nptv6_uninit(const void *arg __unused) +{ + + nptv6_uninit(&V_layer3_chain, IS_DEFAULT_VNET(curvnet)); + return (0); +} + +static int +ipfw_nptv6_modevent(module_t mod, int type, void *unused) +{ + + switch (type) { + case MOD_LOAD: + case MOD_UNLOAD: + break; + default: + return (EOPNOTSUPP); + } + return (0); +} + +static moduledata_t ipfw_nptv6_mod = { + "ipfw_nptv6", + ipfw_nptv6_modevent, + 0 +}; + +/* Define startup order. */ +#define IPFW_NPTV6_SI_SUB_FIREWALL SI_SUB_PROTO_IFATTACHDOMAIN +#define IPFW_NPTV6_MODEVENT_ORDER (SI_ORDER_ANY - 128) /* after ipfw */ +#define IPFW_NPTV6_MODULE_ORDER (IPFW_NPTV6_MODEVENT_ORDER + 1) +#define IPFW_NPTV6_VNET_ORDER (IPFW_NPTV6_MODEVENT_ORDER + 2) + +DECLARE_MODULE(ipfw_nptv6, ipfw_nptv6_mod, IPFW_NPTV6_SI_SUB_FIREWALL, + IPFW_NPTV6_MODULE_ORDER); +MODULE_DEPEND(ipfw_nptv6, ipfw, 3, 3, 3); +MODULE_VERSION(ipfw_nptv6, 1); + +VNET_SYSINIT(vnet_ipfw_nptv6_init, IPFW_NPTV6_SI_SUB_FIREWALL, + IPFW_NPTV6_VNET_ORDER, vnet_ipfw_nptv6_init, NULL); +VNET_SYSUNINIT(vnet_ipfw_nptv6_uninit, IPFW_NPTV6_SI_SUB_FIREWALL, + IPFW_NPTV6_VNET_ORDER, vnet_ipfw_nptv6_uninit, NULL); Added: head/sys/netpfil/ipfw/nptv6/nptv6.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netpfil/ipfw/nptv6/nptv6.c Mon Jul 18 19:46:31 2016 (r303012) @@ -0,0 +1,856 @@ +/*- + * Copyright (c) 2016 Yandex LLC + * Copyright (c) 2016 Andrey V. Elsukov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static VNET_DEFINE(uint16_t, nptv6_eid) = 0; +#define V_nptv6_eid VNET(nptv6_eid) +#define IPFW_TLV_NPTV6_NAME IPFW_TLV_EACTION_NAME(V_nptv6_eid) + +static struct nptv6_cfg *nptv6_alloc_config(const char *name, uint8_t set); +static void nptv6_free_config(struct nptv6_cfg *cfg); +static struct nptv6_cfg *nptv6_find(struct namedobj_instance *ni, + const char *name, uint8_t set); +static int nptv6_rewrite_internal(struct nptv6_cfg *cfg, struct mbuf **mp, + int offset); +static int nptv6_rewrite_external(struct nptv6_cfg *cfg, struct mbuf **mp, + int offset); + +#define NPTV6_LOOKUP(chain, cmd) \ + (struct nptv6_cfg *)SRV_OBJECT((chain), (cmd)->arg1) + +#ifndef IN6_MASK_ADDR +#define IN6_MASK_ADDR(a, m) do { \ + (a)->s6_addr32[0] &= (m)->s6_addr32[0]; \ + (a)->s6_addr32[1] &= (m)->s6_addr32[1]; \ + (a)->s6_addr32[2] &= (m)->s6_addr32[2]; \ + (a)->s6_addr32[3] &= (m)->s6_addr32[3]; \ +} while (0) +#endif +#ifndef IN6_ARE_MASKED_ADDR_EQUAL +#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ + (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ + (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ + (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) +#endif + +#if 0 +#define NPTV6_DEBUG(fmt, ...) do { \ + printf("%s: " fmt "\n", __func__, ## __VA_ARGS__); \ +} while (0) +#define NPTV6_IPDEBUG(fmt, ...) do { \ + char _s[INET6_ADDRSTRLEN], _d[INET6_ADDRSTRLEN]; \ + printf("%s: " fmt "\n", __func__, ## __VA_ARGS__); \ +} while (0) +#else +#define NPTV6_DEBUG(fmt, ...) +#define NPTV6_IPDEBUG(fmt, ...) +#endif + +static int +nptv6_getlasthdr(struct nptv6_cfg *cfg, struct mbuf *m, int *offset) +{ + struct ip6_hdr *ip6; + struct ip6_hbh *hbh; + int proto, hlen; + + hlen = (offset == NULL) ? 0: *offset; + if (m->m_len < hlen) + return (-1); + ip6 = mtodo(m, hlen); + hlen += sizeof(*ip6); + proto = ip6->ip6_nxt; + while (proto == IPPROTO_HOPOPTS || proto == IPPROTO_ROUTING || + proto == IPPROTO_DSTOPTS) { + hbh = mtodo(m, hlen); + if (m->m_len < hlen) + return (-1); + proto = hbh->ip6h_nxt; + hlen += hbh->ip6h_len << 3; + } + if (offset != NULL) + *offset = hlen; + return (proto); +} + +static int +nptv6_translate_icmpv6(struct nptv6_cfg *cfg, struct mbuf **mp, int offset) +{ + struct icmp6_hdr *icmp6; + struct ip6_hdr *ip6; + struct mbuf *m; + + m = *mp; + if (offset > m->m_len) + return (-1); + icmp6 = mtodo(m, offset); + NPTV6_DEBUG("ICMPv6 type %d", icmp6->icmp6_type); + switch (icmp6->icmp6_type) { + case ICMP6_DST_UNREACH: + case ICMP6_PACKET_TOO_BIG: + case ICMP6_TIME_EXCEEDED: + case ICMP6_PARAM_PROB: + break; + case ICMP6_ECHO_REQUEST: + case ICMP6_ECHO_REPLY: + /* nothing to translate */ + return (0); + default: + /* + * XXX: We can add some checks to not translate NDP and MLD + * messages. Currently user must explicitly allow these message + * types, otherwise packets will be dropped. + */ + return (-1); + } + offset += sizeof(*icmp6); + if (offset + sizeof(*ip6) > m->m_pkthdr.len) + return (-1); + if (offset + sizeof(*ip6) > m->m_len) + *mp = m = m_pullup(m, offset + sizeof(*ip6)); + if (m == NULL) + return (-1); + ip6 = mtodo(m, offset); + NPTV6_IPDEBUG("offset %d, %s -> %s %d", offset, + inet_ntop(AF_INET6, &ip6->ip6_src, _s, sizeof(_s)), + inet_ntop(AF_INET6, &ip6->ip6_dst, _d, sizeof(_d)), + ip6->ip6_nxt); + if (IN6_ARE_MASKED_ADDR_EQUAL(&ip6->ip6_src, + &cfg->external, &cfg->mask)) + return (nptv6_rewrite_external(cfg, mp, offset)); + else if (IN6_ARE_MASKED_ADDR_EQUAL(&ip6->ip6_dst, + &cfg->internal, &cfg->mask)) + return (nptv6_rewrite_internal(cfg, mp, offset)); + /* + * Addresses in the inner IPv6 header doesn't matched to + * our prefixes. + */ + return (-1); +} + +static int +nptv6_search_index(struct nptv6_cfg *cfg, struct in6_addr *a) +{ + int idx; + + if (cfg->flags & NPTV6_48PLEN) + return (3); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jul 18 20:19: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 CDAA2B9DCE5; Mon, 18 Jul 2016 20:19:22 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward2p.cmail.yandex.net (forward2p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CCE01C0B; Mon, 18 Jul 2016 20:19:22 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::26]) by forward2p.cmail.yandex.net (Yandex) with ESMTP id 5477320BFF; Mon, 18 Jul 2016 23:19:19 +0300 (MSK) Received: from smtp2o.mail.yandex.net (localhost [127.0.0.1]) by smtp2o.mail.yandex.net (Yandex) with ESMTP id 4C18C36A0142; Mon, 18 Jul 2016 23:19:19 +0300 (MSK) Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id FUVxW9rkDc-JIqCVn7F; Mon, 18 Jul 2016 23:19:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1468873158; bh=Jf8K0/fmJA3imzdKbrB3gUgY4gLmtp2aJAD7ivgc390=; h=Subject:To:References:Cc:From:Message-ID:Date:In-Reply-To; b=k8Gn+9FInWDYMavEA+wmL/wfh1jDNeK/JHcU5JBco13RL3jzfFze5RlwEY6/y2AgE GJC8+9KVgDJWN7bd5EapMEpd2ZqkOvYYeUfY2i8jr1NqJaNgHko9G+xV3Jg9sydbG8 9zDEmW+dp6fjS94x5nke4a7wIced/LyiOUiMy4+I= Authentication-Results: smtp2o.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0 Subject: Re: svn commit: r302985 - head/sys/geom/label To: Maxim Sobolev References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: "Andrey V. Elsukov" Message-ID: Date: Mon, 18 Jul 2016 23:18:23 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wreecAFKFdkWKNgeGUDHMPliFBrdlQJgm" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 20:19:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wreecAFKFdkWKNgeGUDHMPliFBrdlQJgm Content-Type: multipart/mixed; boundary="FAepU4tSjmrHo8c9r2AgS4V4vrGpWkGt5" From: "Andrey V. Elsukov" To: Maxim Sobolev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r302985 - head/sys/geom/label References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> In-Reply-To: --FAepU4tSjmrHo8c9r2AgS4V4vrGpWkGt5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.07.16 22:37, Maxim Sobolev wrote: > Well, this looks to me exactly what I am talking about. With this chang= e > we are only allowing underlying provider to be *slighly* bigger than th= e > UFS size. So as I said it's pretty harmless to do so, or at least I So, this isn't true. 1. You use abs() in the macro - it can be less or bigger. 2. fs_fsize is size of frag blocks, so use it as divider looks incorrect.= --=20 WBR, Andrey V. Elsukov --FAepU4tSjmrHo8c9r2AgS4V4vrGpWkGt5-- --wreecAFKFdkWKNgeGUDHMPliFBrdlQJgm 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/ iQEvBAEBCAAZBQJXjTmPEhxidTdjaGVyQHlhbmRleC5ydQAKCRABxeoEEMiheh6A B/44rvP4rq1As7fp9yCYCoeQjc7sz95aa4VH4BLHL2WhVm8DVuj8R2meh0O2UdQs jyJY5UpHhM3maJhDZ9aiqlHS1k6uqDQilfha2oyLO9XKiue3waBzhw+4bBVYmLBX qOnEVs5TSSW8FeaFn2E3EfEGErLJhqhkchIDqWbML8P/fKitAm2SbSpCjUeGPRhX XhnNgDj3C4HJngT4ZycCv+WPieruJiJShSk8//r1CHA48IX6JFIaSFllvj4IQYD1 tBQlWr6HUK4n8yQaWTRee31FAQAMDOYbfvjMvlPFFA6QdkeSx/bAYAE0Zx++Sco7 V8slSI90Y7ZFtpvINJz3adWp =UYpW -----END PGP SIGNATURE----- --wreecAFKFdkWKNgeGUDHMPliFBrdlQJgm-- From owner-svn-src-head@freebsd.org Mon Jul 18 20:24: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 883DAB9DEE3; Mon, 18 Jul 2016 20:24:14 +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 5A5CA126D; Mon, 18 Jul 2016 20:24:14 +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 u6IKODg1012387; Mon, 18 Jul 2016 20:24:13 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IKODvd012386; Mon, 18 Jul 2016 20:24:13 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607182024.u6IKODvd012386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Mon, 18 Jul 2016 20:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303013 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 18 Jul 2016 20:24:14 -0000 Author: ache Date: Mon Jul 18 20:24:13 2016 New Revision: 303013 URL: https://svnweb.freebsd.org/changeset/base/303013 Log: g_Ctoc() conversion buffers are smaller than needed up to MB_CUR_MAX - 1 since whole conversion needs a room for (len >= MB_CUR_MAX). It is no difference when MB_CUR_MAX == 1, but for multi-byte locales last few chars ('\0' and before) may need just one byte, and the rest of MB_CUR_MAX - 1 space becomes unavailable in the MAXPATHLEN-sized buffer, which cause conversion error on near MAXPATHLEN long pathes. Increase g_Ctoc() conversion buffers to MB_LEN_MAX - 1. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 19:46:31 2016 (r303012) +++ head/lib/libc/gen/glob.c Mon Jul 18 20:24:13 2016 (r303013) @@ -702,7 +702,7 @@ glob3(Char *pathbuf, Char *pathend, Char struct dirent *dp; DIR *dirp; int err; - char buf[MAXPATHLEN]; + char buf[MAXPATHLEN + MB_LEN_MAX - 1]; struct dirent *(*readdirfunc)(DIR *); @@ -933,7 +933,7 @@ globfree(glob_t *pglob) static DIR * g_opendir(Char *str, glob_t *pglob) { - char buf[MAXPATHLEN]; + char buf[MAXPATHLEN + MB_LEN_MAX - 1]; if (*str == EOS) strcpy(buf, "."); @@ -953,7 +953,7 @@ g_opendir(Char *str, glob_t *pglob) static int g_lstat(Char *fn, struct stat *sb, glob_t *pglob) { - char buf[MAXPATHLEN]; + char buf[MAXPATHLEN + MB_LEN_MAX - 1]; if (g_Ctoc(fn, buf, sizeof(buf))) { errno = ENAMETOOLONG; @@ -967,7 +967,7 @@ g_lstat(Char *fn, struct stat *sb, glob_ static int g_stat(Char *fn, struct stat *sb, glob_t *pglob) { - char buf[MAXPATHLEN]; + char buf[MAXPATHLEN + MB_LEN_MAX - 1]; if (g_Ctoc(fn, buf, sizeof(buf))) { errno = ENAMETOOLONG; From owner-svn-src-head@freebsd.org Mon Jul 18 20:34: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 04BC2B9B3BA for ; Mon, 18 Jul 2016 20:34:04 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::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 C7FC81AD7 for ; Mon, 18 Jul 2016 20:34:03 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x22d.google.com with SMTP id f6so1467478ith.0 for ; Mon, 18 Jul 2016 13:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=xbNYJEcy0zRGVGRJ4L41t8xBoCLLxUcoXuLYsR5Nr6Y=; b=hxeCnXJi2hjzL7uc3zFJxVgNnsqIJjnlhxDkSQtzeMuqjwD6pjlJdNAnmjaDEG0/Tz rG5GPEONLk4zUDeZgF9IdAtJ5HZn7Ydk5ChM8M87d0sTDmY8SfNUCnvIaEwreCp9O2mc 5Ak6cah2+cqEUGPQZjztFhfDCO94rrnbD6ripnvivv8i417eyvABAqRU6CrnypyK3WC+ 2rYu1r2tn8gSv2WPA9JkED9aIao5PeZUldq4EWH8LbTBAlJ7nn9ma5XMg7doZi/YVIf9 hbKNnQOxDrRrF7YPEyavEbo76KZqBYkomQw4SXncb4dTve9xHW7bM5fuQZFnY/5O1v/i 1b9w== 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=xbNYJEcy0zRGVGRJ4L41t8xBoCLLxUcoXuLYsR5Nr6Y=; b=GZyXNHt3y1nor345tl4oHJsAnsMnuyGGS/zJ6skoS2/Q7t9ASOhVYlW/+7zGgKlRyx jlFF92zPKvubTUoMFrM0Qmi+7uP7uj2VvM2HfctWvldVLp/ZGgO/m3D/eYov4cOq+fEy eKScL9tzMStLhQMO2GAwqpuVMYhvgxraZoY2KL95Opu1rlG/xehYKN2wwxbbAclIeUbL J8IG8DrEVb55vnJx7awsEDfvzzMY3lO1OKAmFQ5MvX3iG4DX+OZ38a9hX9aACQRiQ1YZ qJZOYMpkV62S0HKJfKDEnPK0E33a/jTc349+drKfU/WVzsd8TPJQMfWrhLkmPgF5xBER cPBg== X-Gm-Message-State: ALyK8tJoQPEnCDv90kJs1jMaI8uz7TfaMajVOfH58n4ioHOrmYuo+cgVPF/AXqU7XuNUomUETuJ7YchabvyxU3/y X-Received: by 10.36.188.65 with SMTP id n62mr51471955ite.61.1468874043060; Mon, 18 Jul 2016 13:34:03 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.59.193 with HTTP; Mon, 18 Jul 2016 13:34:02 -0700 (PDT) In-Reply-To: References: <201607180500.u6I501CX063743@repo.freebsd.org> <20ae3dfe-96f4-c897-67d0-71bb94d14858@yandex.ru> <61cba001-2717-49ee-843e-5ed6d18fa17b@yandex.ru> From: Maxim Sobolev Date: Mon, 18 Jul 2016 13:34:02 -0700 X-Google-Sender-Auth: Q1h0YVHaIOFQCYqTp74xxc7Onlg Message-ID: Subject: Re: svn commit: r302985 - head/sys/geom/label To: "Andrey V. Elsukov" , Michael Zhilin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 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: Mon, 18 Jul 2016 20:34:04 -0000 Andrey, would you mind leaving your comments in the phabricator so that the Mikhail (original contributor of the patch) could work on an improved version? You might be correct about the abs(), I've overlooked that, but the fs_fsize math is just copied over the previous code as far as I can tell. So if it worked with the strict comparison, it should also work with relaxed bound one. https://reviews.freebsd.org/D6208 Thanks! -Max On Mon, Jul 18, 2016 at 1:18 PM, Andrey V. Elsukov wrote: > On 18.07.16 22:37, Maxim Sobolev wrote: > > Well, this looks to me exactly what I am talking about. With this change > > we are only allowing underlying provider to be *slighly* bigger than the > > UFS size. So as I said it's pretty harmless to do so, or at least I > > So, this isn't true. > 1. You use abs() in the macro - it can be less or bigger. > 2. fs_fsize is size of frag blocks, so use it as divider looks incorrect. > > -- > WBR, Andrey V. Elsukov > > From owner-svn-src-head@freebsd.org Tue Jul 19 00:11: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 13260B9D90F; Tue, 19 Jul 2016 00:11:53 +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 F41961716; Tue, 19 Jul 2016 00:11:52 +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 u6J0Bhf3030306 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 18 Jul 2016 17:11:44 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> From: Nathan Whitehorn Message-ID: Date: Mon, 18 Jul 2016 17:11:43 -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: <201606051620.u55GKD5S066398@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbsaVpkc+18HGPTHI9Ed/VAE7Dua3+ur79jkgHn/CAQOi/xkErnRNe8LPFtkRtJYq2mIwU3ys6nlW5KbKJ2D+Co2ahbWPqx9MY= X-Sonic-ID: C;oLi4X0VN5hGd95tMTlz00w== M;gEIXYEVN5hGd95tMTlz00w== 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: Tue, 19 Jul 2016 00:11:53 -0000 Could you please describe what this change is in more detail? It breaks a lot of encapsulations we have worked very hard to maintain, moves ARM code into MI parts of the kernel, and the OFW parts violate IEEE 1275 (the Open Firmware standard). In particular, there is no guarantee that the interrupts for a newbus (or OF) device are encoded in a property called "interrupts" (or, indeed, in any property at all) on that node and there are many, many device trees where that is not the case (e.g. ones with interrupt maps, as well as Apple hardware). By putting that knowledge into the OF root bus device, which we have tried to keep it out of, this enforces a standard that doesn't actually exist. I'm hesitant to ask for reversion on something that landed 6 weeks ago without me noticing, but this needs a lot more architectural work before any parts of the kernel should use it. -Nathan On 06/05/16 09:20, Svatopluk Kraus wrote: > Author: skra > Date: Sun Jun 5 16:20:12 2016 > New Revision: 301453 > URL: https://svnweb.freebsd.org/changeset/base/301453 > > Log: > INTRNG - change the way how an interrupt mapping data are provided > to the framework in OFW (FDT) case. > > This is a follow-up to r301451. > > Differential Revision: https://reviews.freebsd.org/D6634 > > Modified: > head/sys/arm/arm/nexus.c > head/sys/arm64/arm64/gic_v3.c > head/sys/arm64/arm64/nexus.c > head/sys/dev/fdt/simplebus.c > head/sys/dev/gpio/ofw_gpiobus.c > head/sys/dev/iicbus/ofw_iicbus.c > head/sys/dev/ofw/ofw_bus_subr.c > head/sys/dev/ofw/ofw_bus_subr.h > head/sys/dev/ofw/ofwbus.c > head/sys/dev/pci/pci_host_generic.c > head/sys/dev/vnic/mrml_bridge.c > head/sys/dev/vnic/thunder_mdio_fdt.c > head/sys/kern/subr_intr.c > head/sys/mips/mips/nexus.c > head/sys/sys/intr.h > > Modified: head/sys/arm/arm/nexus.c > ============================================================================== > --- head/sys/arm/arm/nexus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/arm/arm/nexus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -412,6 +412,10 @@ nexus_ofw_map_intr(device_t dev, device_ > pcell_t *intr) > { > > +#ifdef INTRNG > + return (INTR_IRQ_INVALID); > +#else > return (intr_fdt_map_irq(iparent, intr, icells)); > +#endif > } > #endif > > Modified: head/sys/arm64/arm64/gic_v3.c > ============================================================================== > --- head/sys/arm64/arm64/gic_v3.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/arm64/arm64/gic_v3.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -58,6 +58,10 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#ifdef FDT > +#include > +#endif > + > #include "pic_if.h" > > #include "gic_v3_reg.h" > > Modified: head/sys/arm64/arm64/nexus.c > ============================================================================== > --- head/sys/arm64/arm64/nexus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/arm64/arm64/nexus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -448,7 +448,7 @@ nexus_ofw_map_intr(device_t dev, device_ > pcell_t *intr) > { > #ifdef INTRNG > - return (intr_fdt_map_irq(iparent, intr, icells)); > + return (INTR_IRQ_INVALID); > #else > int irq; > > > Modified: head/sys/dev/fdt/simplebus.c > ============================================================================== > --- head/sys/dev/fdt/simplebus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/fdt/simplebus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -251,7 +251,9 @@ simplebus_setup_dinfo(device_t dev, phan > > resource_list_init(&ndi->rl); > ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl); > +#ifndef INTRNG > ofw_bus_intr_to_rl(dev, node, &ndi->rl, NULL); > +#endif > > return (ndi); > } > > Modified: head/sys/dev/gpio/ofw_gpiobus.c > ============================================================================== > --- head/sys/dev/gpio/ofw_gpiobus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/gpio/ofw_gpiobus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -321,11 +321,13 @@ ofw_gpiobus_setup_devinfo(device_t bus, > devi->pins[i] = pins[i].pin; > } > free(pins, M_DEVBUF); > +#ifndef INTRNG > /* Parse the interrupt resources. */ > if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl, NULL) != 0) { > ofw_gpiobus_destroy_devinfo(bus, dinfo); > return (NULL); > } > +#endif > device_set_ivars(child, dinfo); > > return (dinfo); > > Modified: head/sys/dev/iicbus/ofw_iicbus.c > ============================================================================== > --- head/sys/dev/iicbus/ofw_iicbus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/iicbus/ofw_iicbus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -187,8 +187,10 @@ ofw_iicbus_attach(device_t dev) > > childdev = device_add_child(dev, NULL, -1); > resource_list_init(&dinfo->opd_dinfo.rl); > +#ifndef INTRNG > ofw_bus_intr_to_rl(childdev, child, > &dinfo->opd_dinfo.rl, NULL); > +#endif > device_set_ivars(childdev, dinfo); > } > > > Modified: head/sys/dev/ofw/ofw_bus_subr.c > ============================================================================== > --- head/sys/dev/ofw/ofw_bus_subr.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/ofw/ofw_bus_subr.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -516,6 +516,7 @@ ofw_bus_find_iparent(phandle_t node) > return (iparent); > } > > +#ifndef INTRNG > int > ofw_bus_intr_to_rl(device_t dev, phandle_t node, > struct resource_list *rl, int *rlen) > @@ -581,6 +582,78 @@ ofw_bus_intr_to_rl(device_t dev, phandle > free(intr, M_OFWPROP); > return (err); > } > +#endif > + > +int > +ofw_bus_intr_by_rid(device_t dev, phandle_t node, int wanted_rid, > + phandle_t *producer, int *ncells, pcell_t **cells) > +{ > + phandle_t iparent; > + uint32_t icells, *intr; > + int err, i, nintr, rid; > + boolean_t extended; > + > + nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), > + (void **)&intr); > + if (nintr > 0) { > + iparent = ofw_bus_find_iparent(node); > + if (iparent == 0) { > + device_printf(dev, "No interrupt-parent found, " > + "assuming direct parent\n"); > + iparent = OF_parent(node); > + iparent = OF_xref_from_node(iparent); > + } > + if (OF_searchencprop(OF_node_from_xref(iparent), > + "#interrupt-cells", &icells, sizeof(icells)) == -1) { > + device_printf(dev, "Missing #interrupt-cells " > + "property, assuming <1>\n"); > + icells = 1; > + } > + if (icells < 1 || icells > nintr) { > + device_printf(dev, "Invalid #interrupt-cells property " > + "value <%d>, assuming <1>\n", icells); > + icells = 1; > + } > + extended = false; > + } else { > + nintr = OF_getencprop_alloc(node, "interrupts-extended", > + sizeof(*intr), (void **)&intr); > + if (nintr <= 0) > + return (ESRCH); > + extended = true; > + } > + err = ESRCH; > + rid = 0; > + for (i = 0; i < nintr; i += icells, rid++) { > + if (extended) { > + iparent = intr[i++]; > + if (OF_searchencprop(OF_node_from_xref(iparent), > + "#interrupt-cells", &icells, sizeof(icells)) == -1) { > + device_printf(dev, "Missing #interrupt-cells " > + "property\n"); > + err = ENOENT; > + break; > + } > + if (icells < 1 || (i + icells) > nintr) { > + device_printf(dev, "Invalid #interrupt-cells " > + "property value <%d>\n", icells); > + err = ERANGE; > + break; > + } > + } > + if (rid == wanted_rid) { > + *cells = malloc(icells * sizeof(**cells), M_OFWPROP, > + M_WAITOK); > + *producer = iparent; > + *ncells= icells; > + memcpy(*cells, intr + i, icells * sizeof(**cells)); > + err = 0; > + break; > + } > + } > + free(intr, M_OFWPROP); > + return (err); > +} > > phandle_t > ofw_bus_find_child(phandle_t start, const char *child_name) > > Modified: head/sys/dev/ofw/ofw_bus_subr.h > ============================================================================== > --- head/sys/dev/ofw/ofw_bus_subr.h Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/ofw/ofw_bus_subr.h Sun Jun 5 16:20:12 2016 (r301453) > @@ -52,6 +52,13 @@ struct ofw_compat_data { > uintptr_t ocd_data; > }; > > +struct intr_map_data_fdt { > + struct intr_map_data hdr; > + phandle_t iparent; > + u_int ncells; > + pcell_t *cells; > +}; > + > #define SIMPLEBUS_PNP_DESCR "Z:compat;P:private;" > #define SIMPLEBUS_PNP_INFO(t) \ > MODULE_PNP_INFO(SIMPLEBUS_PNP_DESCR, simplebus, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0])); > @@ -82,7 +89,11 @@ int ofw_bus_msimap(phandle_t, uint16_t, > /* Routines for parsing device-tree data into resource lists. */ > int ofw_bus_reg_to_rl(device_t, phandle_t, pcell_t, pcell_t, > struct resource_list *); > +#ifndef INTRNG > int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *, int *); > +#endif > +int ofw_bus_intr_by_rid(device_t, phandle_t, int, phandle_t *, int *, > + pcell_t **); > > /* Helper to get device status property */ > const char *ofw_bus_get_status(device_t dev); > > Modified: head/sys/dev/ofw/ofwbus.c > ============================================================================== > --- head/sys/dev/ofw/ofwbus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/ofw/ofwbus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#ifdef INTRNG > +#include > +#endif > > #include > #include > @@ -77,6 +80,9 @@ static device_attach_t ofwbus_attach; > static bus_alloc_resource_t ofwbus_alloc_resource; > static bus_adjust_resource_t ofwbus_adjust_resource; > static bus_release_resource_t ofwbus_release_resource; > +#ifdef INTRNG > +static bus_map_intr_t ofwbus_map_intr; > +#endif > > static device_method_t ofwbus_methods[] = { > /* Device interface */ > @@ -90,6 +96,9 @@ static device_method_t ofwbus_methods[] > DEVMETHOD(bus_alloc_resource, ofwbus_alloc_resource), > DEVMETHOD(bus_adjust_resource, ofwbus_adjust_resource), > DEVMETHOD(bus_release_resource, ofwbus_release_resource), > +#ifdef INTRNG > + DEVMETHOD(bus_map_intr, ofwbus_map_intr), > +#endif > > DEVMETHOD_END > }; > @@ -290,3 +299,53 @@ ofwbus_release_resource(device_t bus, de > } > return (rman_release_resource(r)); > } > + > +#ifdef INTRNG > +static void > +ofwbus_destruct_map_data(struct intr_map_data *map_data) > +{ > + struct intr_map_data_fdt *fdt_map_data; > + > + KASSERT(map_data->type == INTR_MAP_DATA_FDT, > + ("%s: bad map_data type %d", __func__, map_data->type)); > + > + fdt_map_data = (struct intr_map_data_fdt *)map_data; > + OF_prop_free(fdt_map_data->cells); > + free(fdt_map_data, M_OFWPROP); > +} > + > +static int > +ofwbus_map_intr(device_t bus, device_t child, int *rid, rman_res_t *start, > + rman_res_t *end, rman_res_t *count, struct intr_map_data **imd) > +{ > + phandle_t iparent, node; > + pcell_t *cells; > + int ncells, rv; > + u_int irq; > + struct intr_map_data_fdt *fdt_data; > + > + node = ofw_bus_get_node(child); > + rv = ofw_bus_intr_by_rid(child, node, *rid, &iparent, &ncells, &cells); > + if (rv != 0) > + return (rv); > + > + fdt_data = malloc(sizeof(*fdt_data), M_OFWPROP, M_WAITOK | M_ZERO); > + fdt_data->hdr.type = INTR_MAP_DATA_FDT; > + fdt_data->hdr.destruct = ofwbus_destruct_map_data; > + fdt_data->iparent = iparent; > + fdt_data->ncells = ncells; > + fdt_data->cells = cells; > + rv = intr_map_irq(NULL, iparent, (struct intr_map_data *)fdt_data, > + &irq); > + if (rv != 0) { > + ofwbus_destruct_map_data((struct intr_map_data *)fdt_data); > + return (rv); > + } > + > + *start = irq; > + *end = irq; > + *count = 1; > + *imd = (struct intr_map_data *)fdt_data; > + return (0); > +} > +#endif > > Modified: head/sys/dev/pci/pci_host_generic.c > ============================================================================== > --- head/sys/dev/pci/pci_host_generic.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/pci/pci_host_generic.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -949,7 +949,9 @@ generic_pcie_ofw_bus_attach(device_t dev > resource_list_init(&di->di_rl); > ofw_bus_reg_to_rl(dev, node, addr_cells, size_cells, > &di->di_rl); > +#ifndef INTRNG > ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL); > +#endif > > /* Add newbus device for this FDT node */ > child = device_add_child(dev, NULL, -1); > > Modified: head/sys/dev/vnic/mrml_bridge.c > ============================================================================== > --- head/sys/dev/vnic/mrml_bridge.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/vnic/mrml_bridge.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -263,7 +263,9 @@ mrmlb_ofw_bus_attach(device_t dev) > resource_list_init(&di->di_rl); > ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, > &di->di_rl); > +#ifndef INTRNG > ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL); > +#endif > > /* Add newbus device for this FDT node */ > child = device_add_child(dev, NULL, -1); > > Modified: head/sys/dev/vnic/thunder_mdio_fdt.c > ============================================================================== > --- head/sys/dev/vnic/thunder_mdio_fdt.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/dev/vnic/thunder_mdio_fdt.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -271,7 +271,9 @@ mdionexus_ofw_bus_attach(device_t dev) > resource_list_init(&di->di_rl); > ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, > &di->di_rl); > +#ifndef INTRNG > ofw_bus_intr_to_rl(dev, node, &di->di_rl, NULL); > +#endif > > /* Add newbus device for this FDT node */ > child = device_add_child(dev, NULL, -1); > > Modified: head/sys/kern/subr_intr.c > ============================================================================== > --- head/sys/kern/subr_intr.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/kern/subr_intr.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -64,12 +64,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#ifdef FDT > -#include > -#include > -#include > -#endif > - > #ifdef DDB > #include > #endif > @@ -625,33 +619,6 @@ intr_acpi_map_irq(device_t dev, u_int ir > return (ddata->idd_irq); > } > #endif > -#ifdef FDT > -/* > - * Map interrupt source according to FDT data into framework. If such mapping > - * does not exist, create it. Return unique interrupt number (resource handle) > - * associated with mapped interrupt source. > - */ > -u_int > -intr_fdt_map_irq(phandle_t node, pcell_t *cells, u_int ncells) > -{ > - size_t cellsize; > - struct intr_dev_data *ddata; > - struct intr_map_data_fdt *daf; > - > - cellsize = ncells * sizeof(*cells); > - ddata = intr_ddata_alloc(sizeof(struct intr_map_data_fdt) + cellsize); > - if (ddata == NULL) > - return (INTR_IRQ_INVALID); /* no space left */ > - > - ddata->idd_xref = (intptr_t)node; > - ddata->idd_data->type = INTR_MAP_DATA_FDT; > - > - daf = (struct intr_map_data_fdt *)ddata->idd_data; > - daf->ncells = ncells; > - memcpy(daf->cells, cells, cellsize); > - return (ddata->idd_irq); > -} > -#endif > > /* > * Store GPIO interrupt decription in framework and return unique interrupt > @@ -1107,7 +1074,11 @@ intr_alloc_irq(device_t dev, struct reso > KASSERT(rman_get_start(res) == rman_get_end(res), > ("%s: more interrupts in resource", __func__)); > > - isrc = intr_ddata_lookup(rman_get_start(res), &data); > + data = rman_get_virtual(res); > + if (data == NULL) > + isrc = intr_ddata_lookup(rman_get_start(res), &data); > + else > + isrc = isrc_lookup(rman_get_start(res)); > if (isrc == NULL) > return (EINVAL); > > @@ -1123,7 +1094,11 @@ intr_release_irq(device_t dev, struct re > KASSERT(rman_get_start(res) == rman_get_end(res), > ("%s: more interrupts in resource", __func__)); > > - isrc = intr_ddata_lookup(rman_get_start(res), &data); > + data = rman_get_virtual(res); > + if (data == NULL) > + isrc = intr_ddata_lookup(rman_get_start(res), &data); > + else > + isrc = isrc_lookup(rman_get_start(res)); > if (isrc == NULL) > return (EINVAL); > > @@ -1142,7 +1117,11 @@ intr_setup_irq(device_t dev, struct reso > KASSERT(rman_get_start(res) == rman_get_end(res), > ("%s: more interrupts in resource", __func__)); > > - isrc = intr_ddata_lookup(rman_get_start(res), &data); > + data = rman_get_virtual(res); > + if (data == NULL) > + isrc = intr_ddata_lookup(rman_get_start(res), &data); > + else > + isrc = isrc_lookup(rman_get_start(res)); > if (isrc == NULL) > return (EINVAL); > > @@ -1202,7 +1181,11 @@ intr_teardown_irq(device_t dev, struct r > KASSERT(rman_get_start(res) == rman_get_end(res), > ("%s: more interrupts in resource", __func__)); > > - isrc = intr_ddata_lookup(rman_get_start(res), &data); > + data = rman_get_virtual(res); > + if (data == NULL) > + isrc = intr_ddata_lookup(rman_get_start(res), &data); > + else > + isrc = isrc_lookup(rman_get_start(res)); > if (isrc == NULL || isrc->isrc_handlers == 0) > return (EINVAL); > > > Modified: head/sys/mips/mips/nexus.c > ============================================================================== > --- head/sys/mips/mips/nexus.c Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/mips/mips/nexus.c Sun Jun 5 16:20:12 2016 (r301453) > @@ -524,7 +524,11 @@ nexus_ofw_map_intr(device_t dev, device_ > pcell_t *intr) > { > > +#ifdef INTRNG > + return (INTR_IRQ_INVALID); > +#else > return (intr_fdt_map_irq(iparent, intr, icells)); > +#endif > } > #endif > #endif /* INTRNG */ > > Modified: head/sys/sys/intr.h > ============================================================================== > --- head/sys/sys/intr.h Sun Jun 5 16:09:31 2016 (r301452) > +++ head/sys/sys/intr.h Sun Jun 5 16:20:12 2016 (r301453) > @@ -42,13 +42,6 @@ struct intr_map_data_acpi { > enum intr_trigger trig; > }; > #endif > -#ifdef FDT > -struct intr_map_data_fdt { > - struct intr_map_data hdr; > - u_int ncells; > - pcell_t cells[0]; > -}; > -#endif > > struct intr_map_data_gpio { > struct intr_map_data hdr; > @@ -135,9 +128,7 @@ int intr_release_msix(device_t, device_t > u_int intr_acpi_map_irq(device_t, u_int, enum intr_polarity, > enum intr_trigger); > #endif > -#ifdef FDT > -u_int intr_fdt_map_irq(phandle_t, pcell_t *, u_int); > -#endif > + > u_int intr_gpio_map_irq(device_t dev, u_int pin_num, u_int pin_flags, > u_int intr_mode); > > From owner-svn-src-head@freebsd.org Tue Jul 19 00: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 2691EB9DC3F; Tue, 19 Jul 2016 00:25:29 +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 D1CB11E6A; Tue, 19 Jul 2016 00:25:28 +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 u6J0PSso001259; Tue, 19 Jul 2016 00:25:28 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J0PSnQ001258; Tue, 19 Jul 2016 00:25:28 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607190025.u6J0PSnQ001258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 19 Jul 2016 00:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303014 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 00:25:29 -0000 Author: ache Date: Tue Jul 19 00:25:27 2016 New Revision: 303014 URL: https://svnweb.freebsd.org/changeset/base/303014 Log: 1) Don't protect \/ and \. even if user say so. They are not special chars in any case and needed for further processing. For ~ expansion too. 2) Don't terminate *pathend with / when GLOB_LIMIT_STAT is reached, it will be not visible outside in any case since error is returned. 3) Cosmetic: change if expression to better reflect its semantic. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Mon Jul 18 20:24:13 2016 (r303013) +++ head/lib/libc/gen/glob.c Tue Jul 19 00:25:27 2016 (r303014) @@ -244,7 +244,8 @@ glob(const char * __restrict pattern, in return (GLOB_NOMATCH); else if (clen == 0) break; - *bufnext++ = wc | prot; + *bufnext++ = wc | ((wc != DOT && wc != SEP) ? + prot : 0); patnext += clen; } } @@ -478,8 +479,8 @@ globtilde(const Char *pattern, Char *pat return (NULL); dc = wbuf; - for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++ | M_PROTECT) - continue; + for (b = patbuf; b < eb && *dc != EOS; b++, dc++) + *b = *dc | ((*dc != DOT && *dc != SEP) ? M_PROTECT : 0); if (*dc != EOS) return (NULL); @@ -642,10 +643,6 @@ glob2(Char *pathbuf, Char *pathend, Char if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) { errno = 0; - if (pathend + 1 > pathend_last) - return (GLOB_NOSPACE); - *pathend++ = SEP; - *pathend = EOS; return (GLOB_NOSPACE); } if (((pglob->gl_flags & GLOB_MARK) && @@ -886,7 +883,7 @@ match(Char *name, Char *pat, Char *paten ok = 0; if ((k = *name++) == EOS) return (0); - if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS) + if ((negate_range = ((*pat & M_MASK) == M_NOT)) != 0) ++pat; while (((c = *pat++) & M_MASK) != M_END) if ((*pat & M_MASK) == M_RNG) { From owner-svn-src-head@freebsd.org Tue Jul 19 00:27: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 2F922B9DCD3; Tue, 19 Jul 2016 00:27:19 +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 E259F1172; Tue, 19 Jul 2016 00:27:18 +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 u6J0RI63001363; Tue, 19 Jul 2016 00:27:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J0RInI001362; Tue, 19 Jul 2016 00:27:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607190027.u6J0RInI001362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 19 Jul 2016 00:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303015 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 00:27:19 -0000 Author: adrian Date: Tue Jul 19 00:27:17 2016 New Revision: 303015 URL: https://svnweb.freebsd.org/changeset/base/303015 Log: [ath] don't do LDPC, STBC or short-gi for locationing frames. The 11n duration calculation function in net80211 and the HAL round /up/ the duration calculation for short-gi, so we can't use that. The 11n duration calculation doesn't know about the extra symbol time needed for STBC, nor the LDPC encoding duration, so we can't use that. This (along with other, local hacks) allow the locationing services to get down to around 200nS (yes, nanoseconds) of variance when speaking to a "good" AP. Tested: * AR9380, STA mode, local locationing frame hacks Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 19 00:25:27 2016 (r303014) +++ head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 19 00:27:17 2016 (r303015) @@ -242,6 +242,14 @@ ath_tx_rate_fill_rcflags(struct ath_soft if ((ni->ni_vap->iv_htcaps & IEEE80211_HTCAP_LDPC) && (ni->ni_htcap & IEEE80211_HTCAP_LDPC)) do_ldpc = 1; + + /* + * The 11n duration calculation doesn't know about LDPC, + * so don't enable it for positioning. + */ + if (bf->bf_flags & ATH_BUF_TOA_PROBE) + do_ldpc = 0; + do_stbc = 0; for (i = 0; i < ATH_RC_NUM; i++) { @@ -279,29 +287,43 @@ ath_tx_rate_fill_rcflags(struct ath_soft if (ni->ni_chw == 40) rc[i].flags |= ATH_RC_CW40_FLAG; + /* + * NOTE: Don't do short-gi for positioning frames. + * + * For now, the ath_hal and net80211 HT duration + * calculation rounds up the 11n data txtime + * to the nearest multiple of 3.6 microseconds + * and doesn't return the fractional part, so + * we are always "out" by some amount. + */ if (ni->ni_chw == 40 && ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40 && ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40 && - vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40) + vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40 && + (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_SGI_FLAG; + } if (ni->ni_chw == 20 && ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20 && ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20 && - vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) + vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20 && + (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_SGI_FLAG; + } /* * If we have STBC TX enabled and the receiver * can receive (at least) 1 stream STBC, AND it's * MCS 0-7, AND we have at least two chains enabled, - * enable STBC. + * and we're not doing positioning, enable STBC. */ if (ic->ic_htcaps & IEEE80211_HTCAP_TXSTBC && ni->ni_vap->iv_flags_ht & IEEE80211_FHT_STBC_TX && ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM && (sc->sc_cur_txchainmask > 1) && - HT_RC_2_STREAMS(rate) == 1) { + (HT_RC_2_STREAMS(rate) == 1) && + (bf->bf_flags & ATH_BUF_TOA_PROBE) == 0) { rc[i].flags |= ATH_RC_STBC_FLAG; do_stbc = 1; } From owner-svn-src-head@freebsd.org Tue Jul 19 00:43: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 EAEFBB9C069; Tue, 19 Jul 2016 00:43:47 +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 D2E55194C; Tue, 19 Jul 2016 00:43:47 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6J0hdIe026866 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 18 Jul 2016 17:43:40 -0700 Subject: Re: svn commit: r302897 - head/usr.sbin/bsdinstall/scripts To: Bartek Rutkowski , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607151507.u6FF7OGH090313@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <1d8eded8-cb28-0fe0-341a-99d03e9fc768@freebsd.org> Date: Mon, 18 Jul 2016 17:43:39 -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: <201607151507.u6FF7OGH090313@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbHKZUKFt87Fv0pNQdlXq1Ai+D9Py1bA4ucwCIImiNZCf1cYq8x8ZQevhUP0hUB+rHkyseaGBCIFSgRwX4s8hbZqIlBF3fgm6U= X-Sonic-ID: C;vvTK1UlN5hGFmJNwxPCmMQ== M;Kr8M1klN5hGFmJNwxPCmMQ== 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: Tue, 19 Jul 2016 00:43:48 -0000 On 07/15/16 08:07, Bartek Rutkowski wrote: > 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 > Thanks for this! One nit below. > 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 As discussed in the review, I'd prefer it if this were not here and only the part below (in the final menu) were present in the auto script, in particular for 11.0-RELEASE. This keeps the installer flow and avoids preventing the user with a new menu of optional off-by-default things that you have to get through to finish the installation (Handbook installation is in the same category). Would it be possible to change that? -Nathan > 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 > From owner-svn-src-head@freebsd.org Tue Jul 19 00:47: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 A3041B9C0FE; Tue, 19 Jul 2016 00:47:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E39C1AD4; Tue, 19 Jul 2016 00:47:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6J0l0qD008708; Tue, 19 Jul 2016 00:47:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J0l0Un008707; Tue, 19 Jul 2016 00:47:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607190047.u6J0l0Un008707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 00:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303016 - head/contrib/llvm/projects/libunwind/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, 19 Jul 2016 00:47:01 -0000 Author: emaste Date: Tue Jul 19 00:47:00 2016 New Revision: 303016 URL: https://svnweb.freebsd.org/changeset/base/303016 Log: llvm-libunwind: use conventional (non-Darwin) X86 register numbers For historical reasons Darwin/i386 has ebp and esp swapped in the eh_frame register numbering. That is: Darwin Other Reg # eh_frame eh_frame DWARF ===== ======== ======== ===== 4 ebp esp esp 5 esp ebp ebp Although the UNW_X86_* constants are not supposed to be coupled to DWARF / eh_frame numbering they are currently conflated in LLVM libunwind, and thus we require the non-Darwin numbering. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h Modified: head/contrib/llvm/projects/libunwind/include/libunwind.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Jul 19 00:27:17 2016 (r303015) +++ head/contrib/llvm/projects/libunwind/include/libunwind.h Tue Jul 19 00:47:00 2016 (r303016) @@ -151,8 +151,8 @@ enum { UNW_X86_ECX = 1, UNW_X86_EDX = 2, UNW_X86_EBX = 3, - UNW_X86_EBP = 4, - UNW_X86_ESP = 5, + UNW_X86_ESP = 4, + UNW_X86_EBP = 5, UNW_X86_ESI = 6, UNW_X86_EDI = 7 }; From owner-svn-src-head@freebsd.org Tue Jul 19 03:13: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 4230FB9C46A; Tue, 19 Jul 2016 03:13:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 172731CBD; Tue, 19 Jul 2016 03:13:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6J3Dqmi063899; Tue, 19 Jul 2016 03:13:52 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J3DpJU063896; Tue, 19 Jul 2016 03:13:51 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201607190313.u6J3DpJU063896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 19 Jul 2016 03:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303017 - in head/sys/dev: nvd nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 03:13:53 -0000 Author: scottl Date: Tue Jul 19 03:13:51 2016 New Revision: 303017 URL: https://svnweb.freebsd.org/changeset/base/303017 Log: Implement crashdump support on NVME MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/dev/nvd/nvd.c head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ns_cmd.c Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Tue Jul 19 00:47:00 2016 (r303016) +++ head/sys/dev/nvd/nvd.c Tue Jul 19 03:13:51 2016 (r303017) @@ -47,6 +47,7 @@ struct nvd_disk; static disk_ioctl_t nvd_ioctl; static disk_strategy_t nvd_strategy; +static dumper_t nvd_dump; static void nvd_done(void *arg, const struct nvme_completion *cpl); @@ -226,6 +227,26 @@ nvd_ioctl(struct disk *ndisk, u_long cmd return (ret); } +static int +nvd_dump(void *arg, void *virt, vm_offset_t phys, off_t offset, size_t len) +{ + struct nvd_disk *ndisk; + struct disk *dp; + int error; + + dp = arg; + ndisk = dp->d_drv1; + + if (len > 0) { + if ((error = nvme_ns_dump(ndisk->ns, virt, offset, len)) != 0) + return (error); + } else { + /* XXX sync to stable storage */ + } + + return (0); +} + static void nvd_done(void *arg, const struct nvme_completion *cpl) { @@ -302,6 +323,7 @@ nvd_new_disk(struct nvme_namespace *ns, disk = disk_alloc(); disk->d_strategy = nvd_strategy; disk->d_ioctl = nvd_ioctl; + disk->d_dump = nvd_dump; disk->d_name = NVD_STR; disk->d_drv1 = ndisk; Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Tue Jul 19 00:47:00 2016 (r303016) +++ head/sys/dev/nvme/nvme.h Tue Jul 19 03:13:51 2016 (r303017) @@ -876,6 +876,8 @@ int nvme_ns_cmd_deallocate(struct nvme_n void *cb_arg); int nvme_ns_cmd_flush(struct nvme_namespace *ns, nvme_cb_fn_t cb_fn, void *cb_arg); +int nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, + size_t len); /* Registration functions */ struct nvme_consumer * nvme_register_consumer(nvme_cons_ns_fn_t ns_fn, Modified: head/sys/dev/nvme/nvme_ns_cmd.c ============================================================================== --- head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 00:47:00 2016 (r303016) +++ head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 03:13:51 2016 (r303017) @@ -151,3 +151,47 @@ nvme_ns_cmd_flush(struct nvme_namespace return (0); } + +/* Timeout = 1 sec */ +#define NVD_DUMP_TIMEOUT 100000 + +int +nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, size_t len) +{ + struct nvme_completion_poll_status status; + struct nvme_request *req; + struct nvme_command *cmd; + uint64_t lba, lba_count; + int i; + + status.done = FALSE; + req = nvme_allocate_request_vaddr(virt, len, nvme_completion_poll_cb, + &status); + if (req == NULL) + return (ENOMEM); + + cmd = &req->cmd; + cmd->opc = NVME_OPC_WRITE; + cmd->nsid = ns->id; + + lba = offset / nvme_ns_get_sector_size(ns); + lba_count = len / nvme_ns_get_sector_size(ns); + + *(uint64_t *)&cmd->cdw10 = lba; + cmd->cdw12 = lba_count - 1; + + nvme_ctrlr_submit_io_request(ns->ctrlr, req); + if (req->qpair == NULL) + return (ENXIO); + + i = 0; + while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) { + DELAY(10); + nvme_qpair_process_completions(req->qpair); + } + + if (status.done == FALSE) + return (ETIMEDOUT); + + return (0); +} From owner-svn-src-head@freebsd.org Tue Jul 19 04: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 17D05B9DB39; Tue, 19 Jul 2016 04:57:01 +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 D815717B2; Tue, 19 Jul 2016 04:57:00 +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 u6J4v0wZ000679; Tue, 19 Jul 2016 04:57:00 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J4uxft000668; Tue, 19 Jul 2016 04:56:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201607190456.u6J4uxft000668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Jul 2016 04:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303018 - in head: sbin/ipfw sys/netinet 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, 19 Jul 2016 04:57:01 -0000 Author: ae Date: Tue Jul 19 04:56:59 2016 New Revision: 303018 URL: https://svnweb.freebsd.org/changeset/base/303018 Log: Add named dynamic states support to ipfw(4). The keep-state, limit and check-state now will have additional argument flowname. This flowname will be assigned to dynamic rule by keep-state or limit opcode. And then can be matched by check-state opcode or O_PROBE_STATE internal opcode. To reduce possible breakage and to maximize compatibility with old rulesets default flowname introduced. It will be assigned to the rules when user has omitted state name in keep-state and check-state opcodes. Also if name is ambiguous (can be evaluated as rule opcode) it will be replaced to default. Reviewed by: julian Obtained from: Yandex LLC MFC after: 1 month Relnotes: yes Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D6674 Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sys/netinet/ip_fw.h head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Jul 19 03:13:51 2016 (r303017) +++ head/sbin/ipfw/ipfw.8 Tue Jul 19 04:56:59 2016 (r303018) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 18, 2016 +.Dd July 19, 2016 .Dt IPFW 8 .Os .Sh NAME @@ -750,7 +750,7 @@ will be executed when the packet matches .It Cm allow | accept | pass | permit Allow packets that match rule. The search terminates. -.It Cm check-state +.It Cm check-state Op Ar flowname | Cm any Checks the packet against the dynamic ruleset. If a match is found, execute the action associated with the rule which generated this dynamic rule, otherwise @@ -765,6 +765,17 @@ rule is found, the dynamic ruleset is ch or .Cm limit rule. +The +.Ar flowname +is symbolic name assigned to dynamic rule by +.Cm keep-state +opcode. +The special flowname +.Cm any +can be used to ignore states flowname when matching. +The +.Cm default +keyword is special name used for compatibility with old rulesets. .It Cm count Update counters for all packets that match rule. The search continues with the next rule. @@ -1593,7 +1604,7 @@ specified in the same way as .It Cm ipversion Ar ver Matches IP packets whose IP version field is .Ar ver . -.It Cm keep-state +.It Cm keep-state Op Ar flowname Upon a match, the firewall will create a dynamic rule, whose default behaviour is to match bidirectional traffic between source and destination IP/port using the same protocol. @@ -1601,11 +1612,20 @@ The rule has a limited lifetime (control .Xr sysctl 8 variables), and the lifetime is refreshed every time a matching packet is found. +The +.Ar flowname +is used to assign additional to addresses, ports and protocol parameter +to dynamic rule. It can be used for more accurate matching by +.Cm check-state +rule. +The +.Cm default +keyword is special name used for compatibility with old rulesets. .It Cm layer2 Matches only layer2 packets, i.e., those passed to .Nm from ether_demux() and ether_output_frame(). -.It Cm limit Bro Cm src-addr | src-port | dst-addr | dst-port Brc Ar N +.It Cm limit Bro Cm src-addr | src-port | dst-addr | dst-port Brc Ar N Op Ar flowname The firewall will only allow .Ar N connections with the same @@ -1613,8 +1633,6 @@ set of parameters as specified in the ru One or more of source and destination addresses and ports can be specified. -Currently, -only IPv4 flows are supported. .It Cm lookup Bro Cm dst-ip | dst-port | src-ip | src-port | uid | jail Brc Ar name Search an entry in lookup table .Ar name @@ -2207,6 +2225,12 @@ and .Em dst are used here only to denote the initial match addresses, but they are completely equivalent afterwards). +Rules created by +.Cm keep-state +option also have a +.Ar flowname +taken from it. +This name is used in matching together with addresses, ports and protocol. Dynamic rules will be checked at the first .Cm check-state, keep-state or @@ -2215,23 +2239,23 @@ occurrence, and the action performed upo as in the parent rule. .Pp Note that no additional attributes other than protocol and IP addresses -and ports are checked on dynamic rules. +and ports and flowname are checked on dynamic rules. .Pp The typical use of dynamic rules is to keep a closed firewall configuration, but let the first TCP SYN packet from the inside network install a dynamic rule for the flow so that packets belonging to that session will be allowed through the firewall: .Pp -.Dl "ipfw add check-state" -.Dl "ipfw add allow tcp from my-subnet to any setup keep-state" +.Dl "ipfw add check-state OUTBOUND" +.Dl "ipfw add allow tcp from my-subnet to any setup keep-state OUTBOUND" .Dl "ipfw add deny tcp from any to any" .Pp A similar approach can be used for UDP, where an UDP packet coming from the inside will install a dynamic rule to let the response through the firewall: .Pp -.Dl "ipfw add check-state" -.Dl "ipfw add allow udp from my-subnet to any keep-state" +.Dl "ipfw add check-state OUTBOUND" +.Dl "ipfw add allow udp from my-subnet to any keep-state OUTBOUND" .Dl "ipfw add deny udp from any to any" .Pp Dynamic rules expire after some time, which depends on the status Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jul 19 03:13:51 2016 (r303017) +++ head/sbin/ipfw/ipfw2.c Tue Jul 19 04:56:59 2016 (r303018) @@ -1404,6 +1404,7 @@ show_static_rule(struct cmdline_opts *co int l; ipfw_insn *cmd, *has_eaction = NULL, *tagptr = NULL; const char *comment = NULL; /* ptr to comment if we have one */ + const char *ename; int proto = 0; /* default */ int flags = 0; /* prerequisites */ ipfw_insn_log *logptr = NULL; /* set if we find an O_LOG */ @@ -1473,6 +1474,12 @@ show_static_rule(struct cmdline_opts *co switch(cmd->opcode) { case O_CHECK_STATE: bprintf(bp, "check-state"); + if (cmd->arg1 != 0) + ename = object_search_ctlv(fo->tstate, + cmd->arg1, IPFW_TLV_STATE_NAME); + else + ename = NULL; + bprintf(bp, " %s", ename ? ename: "any"); /* avoid printing anything else */ flags = HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP | HAVE_IP; @@ -1587,8 +1594,6 @@ show_static_rule(struct cmdline_opts *co break; case O_EXTERNAL_ACTION: { - const char *ename; - /* * The external action can consists of two following * each other opcodes - O_EXTERNAL_ACTION and @@ -1609,8 +1614,6 @@ show_static_rule(struct cmdline_opts *co } case O_EXTERNAL_INSTANCE: { - const char *ename; - if (has_eaction == NULL) break; /* @@ -2066,6 +2069,9 @@ show_static_rule(struct cmdline_opts *co case O_KEEP_STATE: bprintf(bp, " keep-state"); + bprintf(bp, " %s", + object_search_ctlv(fo->tstate, cmd->arg1, + IPFW_TLV_STATE_NAME)); break; case O_LIMIT: { @@ -2082,6 +2088,9 @@ show_static_rule(struct cmdline_opts *co comma = ","; } bprint_uint_arg(bp, " ", c->conn_limit); + bprintf(bp, " %s", + object_search_ctlv(fo->tstate, cmd->arg1, + IPFW_TLV_STATE_NAME)); break; } @@ -2180,7 +2189,10 @@ show_dyn_state(struct cmdline_opts *co, bprintf(bp, " <-> %s %d", inet_ntop(AF_INET6, &d->id.dst_ip6, buf, sizeof(buf)), d->id.dst_port); } else - bprintf(bp, " UNKNOWN <-> UNKNOWN\n"); + bprintf(bp, " UNKNOWN <-> UNKNOWN"); + if (d->kidx != 0) + bprintf(bp, " %s", object_search_ctlv(fo->tstate, + d->kidx, IPFW_TLV_STATE_NAME)); } static int @@ -2821,6 +2833,18 @@ ipfw_check_object_name(const char *name) return (0); } +static char *default_state_name = "default"; +static int +state_check_name(const char *name) +{ + + if (ipfw_check_object_name(name) != 0) + return (EINVAL); + if (strcmp(name, "any") == 0) + return (EINVAL); + return (0); +} + static int eaction_check_name(const char *name) { @@ -3682,6 +3706,24 @@ compile_rule(char *av[], uint32_t *rbuf, case TOK_CHECKSTATE: have_state = action; action->opcode = O_CHECK_STATE; + if (*av == NULL) { + action->arg1 = pack_object(tstate, + default_state_name, IPFW_TLV_STATE_NAME); + break; + } + if (strcmp(*av, "any") == 0) + action->arg1 = 0; + else if (match_token(rule_options, *av) != -1) { + action->arg1 = pack_object(tstate, + default_state_name, IPFW_TLV_STATE_NAME); + warn("Ambiguous state name '%s', '%s' used instead.\n", + *av, default_state_name); + } else if (state_check_name(*av) == 0) + action->arg1 = pack_object(tstate, *av, + IPFW_TLV_STATE_NAME); + else + errx(EX_DATAERR, "Invalid state name %s", *av); + av++; break; case TOK_ACCEPT: @@ -4502,16 +4544,35 @@ read_options: av++; break; - case TOK_KEEPSTATE: + case TOK_KEEPSTATE: { + uint16_t uidx; + if (open_par) errx(EX_USAGE, "keep-state cannot be part " "of an or block"); if (have_state) errx(EX_USAGE, "only one of keep-state " "and limit is allowed"); + if (*av == NULL || + match_token(rule_options, *av) != -1) { + if (*av != NULL) + warn("Ambiguous state name '%s'," + " '%s' used instead.\n", *av, + default_state_name); + uidx = pack_object(tstate, default_state_name, + IPFW_TLV_STATE_NAME); + } else { + if (state_check_name(*av) != 0) + errx(EX_DATAERR, + "Invalid state name %s", *av); + uidx = pack_object(tstate, *av, + IPFW_TLV_STATE_NAME); + av++; + } have_state = cmd; - fill_cmd(cmd, O_KEEP_STATE, 0, 0); + fill_cmd(cmd, O_KEEP_STATE, 0, uidx); break; + } case TOK_LIMIT: { ipfw_insn_limit *c = (ipfw_insn_limit *)cmd; @@ -4542,8 +4603,24 @@ read_options: GET_UINT_ARG(c->conn_limit, IPFW_ARG_MIN, IPFW_ARG_MAX, TOK_LIMIT, rule_options); - av++; + + if (*av == NULL || + match_token(rule_options, *av) != -1) { + if (*av != NULL) + warn("Ambiguous state name '%s'," + " '%s' used instead.\n", *av, + default_state_name); + cmd->arg1 = pack_object(tstate, + default_state_name, IPFW_TLV_STATE_NAME); + } else { + if (state_check_name(*av) != 0) + errx(EX_DATAERR, + "Invalid state name %s", *av); + cmd->arg1 = pack_object(tstate, *av, + IPFW_TLV_STATE_NAME); + av++; + } break; } @@ -4749,7 +4826,7 @@ done: * generate O_PROBE_STATE if necessary */ if (have_state && have_state->opcode != O_CHECK_STATE) { - fill_cmd(dst, O_PROBE_STATE, 0, 0); + fill_cmd(dst, O_PROBE_STATE, 0, have_state->arg1); dst = next_cmd(dst, &rblen); } @@ -5134,6 +5211,7 @@ static struct _s_x intcmds[] = { static struct _s_x otypes[] = { { "EACTION", IPFW_TLV_EACTION }, + { "DYNSTATE", IPFW_TLV_STATE_NAME }, { NULL, 0 } }; Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Tue Jul 19 03:13:51 2016 (r303017) +++ head/sys/netinet/ip_fw.h Tue Jul 19 04:56:59 2016 (r303018) @@ -688,7 +688,8 @@ struct _ipfw_dyn_rule { /* to generate keepalives) */ u_int16_t dyn_type; /* rule type */ u_int16_t count; /* refcount */ -}; + u_int16_t kidx; /* index of named object */ +} __packed __aligned(8); /* * Definitions for IP option names. @@ -790,6 +791,7 @@ typedef struct _ipfw_obj_tlv { #define IPFW_TLV_RANGE 9 #define IPFW_TLV_EACTION 10 #define IPFW_TLV_COUNTERS 11 +#define IPFW_TLV_STATE_NAME 14 #define IPFW_TLV_EACTION_BASE 1000 #define IPFW_TLV_EACTION_NAME(arg) (IPFW_TLV_EACTION_BASE + (arg)) Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Jul 19 03:13:51 2016 (r303017) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Jul 19 04:56:59 2016 (r303018) @@ -971,6 +971,7 @@ ipfw_chk(struct ip_fw_args *args) * MATCH_FORWARD or MATCH_REVERSE otherwise (q != NULL) */ int dyn_dir = MATCH_UNKNOWN; + uint16_t dyn_name = 0; ipfw_dyn_rule *q = NULL; struct ip_fw_chain *chain = &V_layer3_chain; @@ -2113,17 +2114,35 @@ do { \ /* * dynamic rules are checked at the first * keep-state or check-state occurrence, - * with the result being stored in dyn_dir. + * with the result being stored in dyn_dir + * and dyn_name. * The compiler introduces a PROBE_STATE * instruction for us when we have a * KEEP_STATE (because PROBE_STATE needs * to be run first). + * + * (dyn_dir == MATCH_UNKNOWN) means this is + * first lookup for such f_id. Do lookup. + * + * (dyn_dir != MATCH_UNKNOWN && + * dyn_name != 0 && dyn_name != cmd->arg1) + * means previous lookup didn't find dynamic + * rule for specific state name and current + * lookup will search rule with another state + * name. Redo lookup. + * + * (dyn_dir != MATCH_UNKNOWN && dyn_name == 0) + * means previous lookup was for `any' name + * and it didn't find rule. No need to do + * lookup again. */ - if (dyn_dir == MATCH_UNKNOWN && + if ((dyn_dir == MATCH_UNKNOWN || + (dyn_name != 0 && + dyn_name != cmd->arg1)) && (q = ipfw_lookup_dyn_rule(&args->f_id, &dyn_dir, proto == IPPROTO_TCP ? - TCP(ulp) : NULL)) - != NULL) { + TCP(ulp): NULL, + (dyn_name = cmd->arg1))) != NULL) { /* * Found dynamic entry, update stats * and jump to the 'action' part of Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Jul 19 03:13:51 2016 (r303017) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Tue Jul 19 04:56:59 2016 (r303018) @@ -282,6 +282,200 @@ hash_packet(struct ipfw_flow_id *id, int return i; } +#if 0 +#define DYN_DEBUG(fmt, ...) do { \ + printf("%s: " fmt "\n", __func__, __VA_ARGS__); \ +} while (0) +#else +#define DYN_DEBUG(fmt, ...) +#endif + +static char *default_state_name = "default"; +struct dyn_state_obj { + struct named_object no; + char name[64]; +}; + +#define DYN_STATE_OBJ(ch, cmd) \ + ((struct dyn_state_obj *)SRV_OBJECT(ch, (cmd)->arg1)) +/* + * Classifier callback. + * Return 0 if opcode contains object that should be referenced + * or rewritten. + */ +static int +dyn_classify(ipfw_insn *cmd, uint16_t *puidx, uint8_t *ptype) +{ + + DYN_DEBUG("opcode %d, arg1 %d", cmd->opcode, cmd->arg1); + /* Don't rewrite "check-state any" */ + if (cmd->arg1 == 0 && + cmd->opcode == O_CHECK_STATE) + return (1); + + *puidx = cmd->arg1; + *ptype = 0; + return (0); +} + +static void +dyn_update(ipfw_insn *cmd, uint16_t idx) +{ + + cmd->arg1 = idx; + DYN_DEBUG("opcode %d, arg1 %d", cmd->opcode, cmd->arg1); +} + +static int +dyn_findbyname(struct ip_fw_chain *ch, struct tid_info *ti, + struct named_object **pno) +{ + ipfw_obj_ntlv *ntlv; + const char *name; + + DYN_DEBUG("uidx %d", ti->uidx); + if (ti->uidx != 0) { + if (ti->tlvs == NULL) + return (EINVAL); + /* Search ntlv in the buffer provided by user */ + ntlv = ipfw_find_name_tlv_type(ti->tlvs, ti->tlen, ti->uidx, + IPFW_TLV_STATE_NAME); + if (ntlv == NULL) + return (EINVAL); + name = ntlv->name; + } else + name = default_state_name; + /* + * Search named object with corresponding name. + * Since states objects are global - ignore the set value + * and use zero instead. + */ + *pno = ipfw_objhash_lookup_name_type(CHAIN_TO_SRV(ch), 0, + IPFW_TLV_STATE_NAME, name); + /* + * We always return success here. + * The caller will check *pno and mark object as unresolved, + * then it will automatically create "default" object. + */ + return (0); +} + +static struct named_object * +dyn_findbykidx(struct ip_fw_chain *ch, uint16_t idx) +{ + + DYN_DEBUG("kidx %d", idx); + return (ipfw_objhash_lookup_kidx(CHAIN_TO_SRV(ch), idx)); +} + +static int +dyn_create(struct ip_fw_chain *ch, struct tid_info *ti, + uint16_t *pkidx) +{ + struct namedobj_instance *ni; + struct dyn_state_obj *obj; + struct named_object *no; + ipfw_obj_ntlv *ntlv; + char *name; + + DYN_DEBUG("uidx %d", ti->uidx); + if (ti->uidx != 0) { + if (ti->tlvs == NULL) + return (EINVAL); + ntlv = ipfw_find_name_tlv_type(ti->tlvs, ti->tlen, ti->uidx, + IPFW_TLV_STATE_NAME); + if (ntlv == NULL) + return (EINVAL); + name = ntlv->name; + } else + name = default_state_name; + + ni = CHAIN_TO_SRV(ch); + obj = malloc(sizeof(*obj), M_IPFW, M_WAITOK | M_ZERO); + obj->no.name = obj->name; + obj->no.etlv = IPFW_TLV_STATE_NAME; + strlcpy(obj->name, name, sizeof(obj->name)); + + IPFW_UH_WLOCK(ch); + no = ipfw_objhash_lookup_name_type(ni, 0, + IPFW_TLV_STATE_NAME, name); + if (no != NULL) { + /* + * Object is already created. + * Just return its kidx and bump refcount. + */ + *pkidx = no->kidx; + no->refcnt++; + IPFW_UH_WUNLOCK(ch); + free(obj, M_IPFW); + DYN_DEBUG("\tfound kidx %d", *pkidx); + return (0); + } + if (ipfw_objhash_alloc_idx(ni, &obj->no.kidx) != 0) { + DYN_DEBUG("\talloc_idx failed for %s", name); + IPFW_UH_WUNLOCK(ch); + free(obj, M_IPFW); + return (ENOSPC); + } + ipfw_objhash_add(ni, &obj->no); + IPFW_WLOCK(ch); + SRV_OBJECT(ch, obj->no.kidx) = obj; + IPFW_WUNLOCK(ch); + obj->no.refcnt++; + *pkidx = obj->no.kidx; + IPFW_UH_WUNLOCK(ch); + DYN_DEBUG("\tcreated kidx %d", *pkidx); + return (0); +} + +static void +dyn_destroy(struct ip_fw_chain *ch, struct named_object *no) +{ + struct dyn_state_obj *obj; + + IPFW_UH_WLOCK_ASSERT(ch); + + KASSERT(no->refcnt == 1, + ("Destroying object '%s' (type %u, idx %u) with refcnt %u", + no->name, no->etlv, no->kidx, no->refcnt)); + + DYN_DEBUG("kidx %d", no->kidx); + IPFW_WLOCK(ch); + obj = SRV_OBJECT(ch, no->kidx); + SRV_OBJECT(ch, no->kidx) = NULL; + IPFW_WUNLOCK(ch); + ipfw_objhash_del(CHAIN_TO_SRV(ch), no); + ipfw_objhash_free_idx(CHAIN_TO_SRV(ch), no->kidx); + + free(obj, M_IPFW); +} + +static struct opcode_obj_rewrite dyn_opcodes[] = { + { + O_KEEP_STATE, IPFW_TLV_STATE_NAME, + dyn_classify, dyn_update, + dyn_findbyname, dyn_findbykidx, + dyn_create, dyn_destroy + }, + { + O_CHECK_STATE, IPFW_TLV_STATE_NAME, + dyn_classify, dyn_update, + dyn_findbyname, dyn_findbykidx, + dyn_create, dyn_destroy + }, + { + O_PROBE_STATE, IPFW_TLV_STATE_NAME, + dyn_classify, dyn_update, + dyn_findbyname, dyn_findbykidx, + dyn_create, dyn_destroy + }, + { + O_LIMIT, IPFW_TLV_STATE_NAME, + dyn_classify, dyn_update, + dyn_findbyname, dyn_findbykidx, + dyn_create, dyn_destroy + }, +}; /** * Print customizable flow id description via log(9) facility. */ @@ -403,7 +597,7 @@ dyn_update_proto_state(ipfw_dyn_rule *q, */ static ipfw_dyn_rule * lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i, int *match_direction, - struct tcphdr *tcp) + struct tcphdr *tcp, uint16_t kidx) { /* * Stateful ipfw extensions. @@ -416,10 +610,13 @@ lookup_dyn_rule_locked(struct ipfw_flow_ dir = MATCH_NONE; for (prev = NULL, q = V_ipfw_dyn_v[i].head; q; prev = q, q = q->next) { - if (q->dyn_type == O_LIMIT_PARENT && q->count) + if (q->dyn_type == O_LIMIT_PARENT) + continue; + + if (pkt->proto != q->id.proto) continue; - if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) + if (kidx != 0 && kidx != q->kidx) continue; if (IS_IP6_FLOW_ID(pkt)) { @@ -473,7 +670,7 @@ done: ipfw_dyn_rule * ipfw_lookup_dyn_rule(struct ipfw_flow_id *pkt, int *match_direction, - struct tcphdr *tcp) + struct tcphdr *tcp, uint16_t kidx) { ipfw_dyn_rule *q; int i; @@ -481,7 +678,7 @@ ipfw_lookup_dyn_rule(struct ipfw_flow_id i = hash_packet(pkt, V_curr_dyn_buckets); IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(pkt, i, match_direction, tcp); + q = lookup_dyn_rule_locked(pkt, i, match_direction, tcp, kidx); if (q == NULL) IPFW_BUCK_UNLOCK(i); /* NB: return table locked when q is not NULL */ @@ -591,7 +788,8 @@ resize_dynamic_table(struct ip_fw_chain * - "parent" rules for the above (O_LIMIT_PARENT). */ static ipfw_dyn_rule * -add_dyn_rule(struct ipfw_flow_id *id, int i, u_int8_t dyn_type, struct ip_fw *rule) +add_dyn_rule(struct ipfw_flow_id *id, int i, uint8_t dyn_type, + struct ip_fw *rule, uint16_t kidx) { ipfw_dyn_rule *r; @@ -627,7 +825,7 @@ add_dyn_rule(struct ipfw_flow_id *id, in r->dyn_type = dyn_type; IPFW_ZERO_DYN_COUNTER(r); r->count = 0; - + r->kidx = kidx; r->bucket = i; r->next = V_ipfw_dyn_v[i].head; V_ipfw_dyn_v[i].head = r; @@ -640,7 +838,8 @@ add_dyn_rule(struct ipfw_flow_id *id, in * If the lookup fails, then install one. */ static ipfw_dyn_rule * -lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pindex, struct ip_fw *rule) +lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pindex, struct ip_fw *rule, + uint16_t kidx) { ipfw_dyn_rule *q; int i, is_v6; @@ -651,7 +850,8 @@ lookup_dyn_parent(struct ipfw_flow_id *p IPFW_BUCK_LOCK(i); for (q = V_ipfw_dyn_v[i].head ; q != NULL ; q=q->next) if (q->dyn_type == O_LIMIT_PARENT && - rule== q->rule && + kidx == q->kidx && + rule == q->rule && pkt->proto == q->id.proto && pkt->src_port == q->id.src_port && pkt->dst_port == q->id.dst_port && @@ -673,7 +873,7 @@ lookup_dyn_parent(struct ipfw_flow_id *p } /* Add virtual limiting rule */ - return add_dyn_rule(pkt, i, O_LIMIT_PARENT, rule); + return add_dyn_rule(pkt, i, O_LIMIT_PARENT, rule, kidx); } /** @@ -689,13 +889,14 @@ ipfw_install_state(struct ip_fw_chain *c ipfw_dyn_rule *q; int i; - DEB(print_dyn_rule(&args->f_id, cmd->o.opcode, "install_state", "");) - + DEB(print_dyn_rule(&args->f_id, cmd->o.opcode, "install_state", + (cmd->o.arg1 == 0 ? "": DYN_STATE_OBJ(chain, &cmd->o)->name));) + i = hash_packet(&args->f_id, V_curr_dyn_buckets); IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL); + q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL, cmd->o.arg1); if (q != NULL) { /* should never occur */ DEB( if (last_log != time_uptime) { @@ -716,7 +917,8 @@ ipfw_install_state(struct ip_fw_chain *c switch (cmd->o.opcode) { case O_KEEP_STATE: /* bidir rule */ - q = add_dyn_rule(&args->f_id, i, O_KEEP_STATE, rule); + q = add_dyn_rule(&args->f_id, i, O_KEEP_STATE, rule, + cmd->o.arg1); break; case O_LIMIT: { /* limit number of sessions */ @@ -767,7 +969,8 @@ ipfw_install_state(struct ip_fw_chain *c */ IPFW_BUCK_UNLOCK(i); - if ((parent = lookup_dyn_parent(&id, &pindex, rule)) == NULL) { + parent = lookup_dyn_parent(&id, &pindex, rule, cmd->o.arg1); + if (parent == NULL) { printf("ipfw: %s: add parent failed\n", __func__); IPFW_BUCK_UNLOCK(pindex); return (1); @@ -795,7 +998,7 @@ ipfw_install_state(struct ip_fw_chain *c IPFW_BUCK_LOCK(i); q = add_dyn_rule(&args->f_id, i, O_LIMIT, - (struct ip_fw *)parent); + (struct ip_fw *)parent, cmd->o.arg1); if (q == NULL) { /* Decrement index and notify caller */ IPFW_BUCK_UNLOCK(i); @@ -1412,6 +1615,7 @@ ipfw_dyn_init(struct ip_fw_chain *chain) * being added to chain. */ resize_dynamic_table(chain, V_curr_dyn_buckets); + IPFW_ADD_OBJ_REWRITER(IS_DEFAULT_VNET(curvnet), dyn_opcodes); } void @@ -1423,6 +1627,7 @@ ipfw_dyn_uninit(int pass) callout_drain(&V_ipfw_timeout); return; } + IPFW_DEL_OBJ_REWRITER(IS_DEFAULT_VNET(curvnet), dyn_opcodes); if (V_ipfw_dyn_v != NULL) { /* Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Tue Jul 19 03:13:51 2016 (r303017) +++ head/sys/netpfil/ipfw/ip_fw_private.h Tue Jul 19 04:56:59 2016 (r303018) @@ -189,7 +189,7 @@ struct mbuf *ipfw_send_pkt(struct mbuf * int ipfw_install_state(struct ip_fw_chain *chain, struct ip_fw *rule, ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg); ipfw_dyn_rule *ipfw_lookup_dyn_rule(struct ipfw_flow_id *pkt, - int *match_direction, struct tcphdr *tcp); + int *match_direction, struct tcphdr *tcp, uint16_t kidx); void ipfw_remove_dyn_children(struct ip_fw *rule); void ipfw_get_dynamic(struct ip_fw_chain *chain, char **bp, const char *ep); int ipfw_dump_states(struct ip_fw_chain *chain, struct sockopt_data *sd); Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Jul 19 03:13:51 2016 (r303017) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Tue Jul 19 04:56:59 2016 (r303018) @@ -1679,6 +1679,10 @@ check_ipfw_rule_body(ipfw_insn *cmd, int switch (cmd->opcode) { case O_PROBE_STATE: case O_KEEP_STATE: + if (cmdlen != F_INSN_SIZE(ipfw_insn)) + goto bad_size; + ci->object_opcodes++; + break; case O_PROTO: case O_IP_SRC_ME: case O_IP_DST_ME: @@ -1776,6 +1780,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int case O_LIMIT: if (cmdlen != F_INSN_SIZE(ipfw_insn_limit)) goto bad_size; + ci->object_opcodes++; break; case O_LOG: @@ -1906,8 +1911,10 @@ check_ipfw_rule_body(ipfw_insn *cmd, int if (cmdlen != F_INSN_SIZE(ipfw_insn_nat)) goto bad_size; goto check_action; - case O_FORWARD_MAC: /* XXX not implemented yet */ case O_CHECK_STATE: + ci->object_opcodes++; + /* FALLTHROUGH */ + case O_FORWARD_MAC: /* XXX not implemented yet */ case O_COUNT: case O_ACCEPT: case O_DENY: From owner-svn-src-head@freebsd.org Tue Jul 19 05:36: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 93096B9D160; Tue, 19 Jul 2016 05:36:22 +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 4ECAC16D3; Tue, 19 Jul 2016 05:36:22 +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 u6J5aL0O015269; Tue, 19 Jul 2016 05:36:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J5aLl7015268; Tue, 19 Jul 2016 05:36:21 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201607190536.u6J5aLl7015268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Jul 2016 05:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303019 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 05:36:22 -0000 Author: ae Date: Tue Jul 19 05:36:21 2016 New Revision: 303019 URL: https://svnweb.freebsd.org/changeset/base/303019 Log: Use g_resize_provider() to change the size of GEOM_DISK provider, when it is being opened. This should fix the possible loss of a resize event when disk capacity changed. PR: 211028 Reported by: Dexuan Cui MFC after: 3 weeks Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Tue Jul 19 04:56:59 2016 (r303018) +++ head/sys/geom/geom_disk.c Tue Jul 19 05:36:21 2016 (r303019) @@ -126,7 +126,6 @@ g_disk_access(struct g_provider *pp, int if (error != 0) return (error); } - pp->mediasize = dp->d_mediasize; pp->sectorsize = dp->d_sectorsize; if (dp->d_maxsize == 0) { printf("WARNING: Disk drive %s%d has no d_maxsize\n", @@ -143,6 +142,7 @@ g_disk_access(struct g_provider *pp, int pp->stripeoffset = dp->d_stripeoffset; pp->stripesize = dp->d_stripesize; dp->d_flags |= DISKFLAG_OPEN; + g_resize_provider(pp, dp->d_mediasize); } else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) { if (dp->d_close != NULL) { error = dp->d_close(dp); From owner-svn-src-head@freebsd.org Tue Jul 19 05:38: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 13FDBB9D2C9; Tue, 19 Jul 2016 05:38:46 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-vk0-x22d.google.com (mail-vk0-x22d.google.com [IPv6:2607:f8b0:400c:c05::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 C344919E2; Tue, 19 Jul 2016 05:38:45 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-vk0-x22d.google.com with SMTP id j126so10262917vkg.3; Mon, 18 Jul 2016 22:38: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=Adw+sHzLZ9Jy0FIGJ4v7dseVNr+M7kmBRauhKVNSdZk=; b=m+FNu+WsjVsucf1j6ELdqE67i5m1NGZhmm6vPQ1VKjKJw4+Gx7bhQ/aT13FapxPbPf EblJdDWZlwgsJa+TPCFXpQutiG037Q63jXJIcVVC6irkDsQDwMmhBdfNB7lX4yDcbmCN stMeiVB+rSQY0QtQhV9bJpp6vJISIQwldhOh+bpiMb3yYiKNaffwWn0sR8p7gErOIcR/ jxqqAdgWeebk/l76fB7Jm+TOm04MOJV1ek/p+M4Xt78d98W/qAzSQAHUxq8WBiR/A4LP /pdCTStusuANzX7poAqZanvEKeL1eYYTkdiZWrnIkp9JreKjRTdtRPGRNBkwtVVTdhik Rkhw== 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=Adw+sHzLZ9Jy0FIGJ4v7dseVNr+M7kmBRauhKVNSdZk=; b=foUOouz/iZ5oUbkmHWpBYBOSQb3XXa5s1a5T1W5w+0itOXoDLgGte0VO0VUlC7NHOy NmovW8KhR9b2SA7G5JtfMqNwafDlrZWHkoIahQuRpesq4pGEo61qxO2oP/buC7ZeyD0a qWOKfTCiKrf9vNMOjGDk6Ng8MjaQD1IOEYAY8ZX+AdJvq/9yfVZnzVz7ZRy2LyduHJXc qGLB2dxqBhJ7ucZtIivZsYydEqkrcXqzmzj2vje5euYgwyxEj4Cjp+/qS9Rr8k866J7u 1Jr5c0GhEHPmukRG19tNtnFZGl7ceEfM2yB7Aa5IHK/uRFZrCVHJiPdjA24OFIYD8+Ij u+Zg== X-Gm-Message-State: ALyK8tKbPnm43LweVijTuwE42+zSuJYMgW/uxGgO98D66OxWi2/+xfVpSmyLtPGBL+zKT9awPQQHtVlR7M3Qbg== X-Received: by 10.31.92.78 with SMTP id q75mr14825307vkb.112.1468906724515; Mon, 18 Jul 2016 22:38:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.83.101 with HTTP; Mon, 18 Jul 2016 22:38:44 -0700 (PDT) In-Reply-To: <201607190536.u6J5aLl7015268@repo.freebsd.org> References: <201607190536.u6J5aLl7015268@repo.freebsd.org> From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 13:38:44 +0800 Message-ID: Subject: Re: svn commit: r303019 - head/sys/geom 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: Tue, 19 Jul 2016 05:38:46 -0000 Thanks! On Tue, Jul 19, 2016 at 1:36 PM, Andrey V. Elsukov wrote: > Author: ae > Date: Tue Jul 19 05:36:21 2016 > New Revision: 303019 > URL: https://svnweb.freebsd.org/changeset/base/303019 > > Log: > Use g_resize_provider() to change the size of GEOM_DISK provider, > when it is being opened. This should fix the possible loss of a resize > event when disk capacity changed. > > PR: 211028 > Reported by: Dexuan Cui > MFC after: 3 weeks > > Modified: > head/sys/geom/geom_disk.c > > Modified: head/sys/geom/geom_disk.c > ============================================================================== > --- head/sys/geom/geom_disk.c Tue Jul 19 04:56:59 2016 (r303018) > +++ head/sys/geom/geom_disk.c Tue Jul 19 05:36:21 2016 (r303019) > @@ -126,7 +126,6 @@ g_disk_access(struct g_provider *pp, int > if (error != 0) > return (error); > } > - pp->mediasize = dp->d_mediasize; > pp->sectorsize = dp->d_sectorsize; > if (dp->d_maxsize == 0) { > printf("WARNING: Disk drive %s%d has no d_maxsize\n", > @@ -143,6 +142,7 @@ g_disk_access(struct g_provider *pp, int > pp->stripeoffset = dp->d_stripeoffset; > pp->stripesize = dp->d_stripesize; > dp->d_flags |= DISKFLAG_OPEN; > + g_resize_provider(pp, dp->d_mediasize); > } else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) { > if (dp->d_close != NULL) { > error = dp->d_close(dp); > _______________________________________________ > 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" -- Tomorrow Will Never Die From owner-svn-src-head@freebsd.org Tue Jul 19 05:46: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 0C2CFB9D771; Tue, 19 Jul 2016 05:46: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 D84B61F34; Tue, 19 Jul 2016 05:46: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 u6J5kGW1019114; Tue, 19 Jul 2016 05:46:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J5kFT7019109; Tue, 19 Jul 2016 05:46:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607190546.u6J5kFT7019109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 05:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303020 - 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, 19 Jul 2016 05:46:17 -0000 Author: sephe Date: Tue Jul 19 05:46:15 2016 New Revision: 303020 URL: https://svnweb.freebsd.org/changeset/base/303020 Log: hyperv/vmbus: Cleanup cpu based channel selection. And create cpu to channel map at device attach time for storvsc(4). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7229 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 Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 19 05:36:21 2016 (r303019) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 19 05:46:15 2016 (r303020) @@ -281,8 +281,6 @@ int hv_vmbus_channel_open(struct hv_vmb vmbus_chan_callback_t cb, void *cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); -struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:36:21 2016 (r303019) +++ head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:46:15 2016 (r303020) @@ -96,13 +96,14 @@ int vmbus_chan_gpadl_disconnect(struct h 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_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); 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/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:36:21 2016 (r303019) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:46:15 2016 (r303020) @@ -147,6 +147,8 @@ struct storvsc_softc { struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; device_t hs_dev; + + struct hv_vmbus_channel *hs_cpu2chan[MAXCPU]; }; @@ -664,7 +666,7 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; - outgoing_channel = vmbus_select_outgoing_channel(sc->hs_chan); + outgoing_channel = sc->hs_cpu2chan[curcpu]; mtx_unlock(&request->softc->hs_lock); if (request->prp_list.gpa_range.gpa_len) { @@ -870,6 +872,20 @@ storvsc_probe(device_t dev) return (ret); } +static void +storvsc_create_cpu2chan(struct storvsc_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + sc->hs_cpu2chan[cpu] = vmbus_chan_cpu2chan(sc->hs_chan, cpu); + if (bootverbose) { + device_printf(sc->hs_dev, "cpu%d -> chan%u\n", + cpu, sc->hs_cpu2chan[cpu]->ch_id); + } + } +} + /** * @brief StorVSC attach function * @@ -967,6 +983,9 @@ storvsc_attach(device_t dev) goto cleanup; } + /* Construct cpu to channel mapping */ + storvsc_create_cpu2chan(sc); + /* * Create the device queue. * Hyper-V maps each target to one SCSI HBA Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:36:21 2016 (r303019) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:46:15 2016 (r303020) @@ -1250,61 +1250,63 @@ vmbus_chan_destroy_all(struct vmbus_soft 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 + * If no multi-channel, always select primary channel. */ struct hv_vmbus_channel * -vmbus_select_outgoing_channel(struct hv_vmbus_channel *primary) +vmbus_chan_cpu2chan(struct hv_vmbus_channel *prichan, int cpu) { - 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); + struct hv_vmbus_channel *sel, *chan; + uint32_t vcpu, sel_dist; - if (TAILQ_EMPTY(&primary->ch_subchans)) { - return outgoing_channel; - } + KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpuid %d", cpu)); + if (TAILQ_EMPTY(&prichan->ch_subchans)) + return prichan; - if (smp_pro_id >= MAXCPU) { - return outgoing_channel; - } + vcpu = VMBUS_PCPU_GET(prichan->vmbus_sc, vcpuid, cpu); - 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; - } +#define CHAN_VCPU_DIST(ch, vcpu) \ + (((ch)->ch_vcpuid > (vcpu)) ? \ + ((ch)->ch_vcpuid - (vcpu)) : ((vcpu) - (ch)->ch_vcpuid)) - if (new_channel->ch_vcpuid == cur_vcpu){ - return new_channel; - } +#define CHAN_SELECT(ch) \ +do { \ + sel = ch; \ + sel_dist = CHAN_VCPU_DIST(ch, vcpu); \ +} while (0) + + CHAN_SELECT(prichan); - 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)); + mtx_lock(&prichan->ch_subchan_lock); + TAILQ_FOREACH(chan, &prichan->ch_subchans, ch_sublink) { + uint32_t dist; - if (old_cpu_distance < new_cpu_distance) { + KASSERT(chan->ch_stflags & VMBUS_CHAN_ST_OPENED, + ("chan%u is not opened", chan->ch_id)); + + if (chan->ch_vcpuid == vcpu) { + /* Exact match; done */ + CHAN_SELECT(chan); + break; + } + + dist = CHAN_VCPU_DIST(chan, vcpu); + if (sel_dist <= dist) { + /* Far or same distance; skip */ continue; } - outgoing_channel = new_channel; + /* Select the closer channel. */ + CHAN_SELECT(chan); } + mtx_unlock(&prichan->ch_subchan_lock); + +#undef CHAN_SELECT +#undef CHAN_VCPU_DIST - return(outgoing_channel); + return sel; } struct hv_vmbus_channel ** From owner-svn-src-head@freebsd.org Tue Jul 19 05:57: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 9CD3CB9D966; Tue, 19 Jul 2016 05:57: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 4A3EA153A; Tue, 19 Jul 2016 05:57: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 u6J5vK0I022757; Tue, 19 Jul 2016 05:57:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J5vJJN022750; Tue, 19 Jul 2016 05:57:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607190557.u6J5vJJN022750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 05:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303021 - 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: Tue, 19 Jul 2016 05:57:21 -0000 Author: sephe Date: Tue Jul 19 05:57:19 2016 New Revision: 303021 URL: https://svnweb.freebsd.org/changeset/base/303021 Log: hyperv/vmbus: Function rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7230 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/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_util.c 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 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 19 05:57:19 2016 (r303021) @@ -267,20 +267,6 @@ typedef struct hv_vmbus_channel { #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) -{ - if (!on) - channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; - else - channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; -} - -int hv_vmbus_channel_open(struct hv_vmbus_channel *chan, - int txbr_size, int rxbr_size, const void *udata, int udlen, - vmbus_chan_callback_t cb, void *cbarg); -void hv_vmbus_channel_close(hv_vmbus_channel *channel); - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:57:19 2016 (r303021) @@ -89,6 +89,11 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; +int vmbus_chan_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); +void vmbus_chan_close(struct hv_vmbus_channel *chan); + 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, @@ -98,6 +103,7 @@ void vmbus_chan_cpu_set(struct hv_vmbus_ void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); struct hv_vmbus_channel * vmbus_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on); struct hv_vmbus_channel ** vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jul 19 05:57:19 2016 (r303021) @@ -645,7 +645,7 @@ hv_nv_subchan_attach(struct hv_vmbus_cha { chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); } @@ -675,7 +675,7 @@ hv_nv_on_device_add(struct hn_softc *sc, /* * Open the channel */ - ret = hv_vmbus_channel_open(chan, + ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); if (ret != 0) { @@ -695,7 +695,7 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ free(chan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(chan); + vmbus_chan_close(chan); cleanup: /* @@ -726,7 +726,7 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(sc->hn_prichan); + vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:57:19 2016 (r303021) @@ -318,7 +318,7 @@ storvsc_subchan_attach(struct storvsc_so new_channel->hv_chan_priv1 = sc; vmbus_chan_cpu_rr(new_channel); - ret = hv_vmbus_channel_open(new_channel, + ret = vmbus_chan_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, (void *)&props, @@ -577,7 +577,7 @@ hv_storvsc_connect_vsp(struct storvsc_so */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); vmbus_chan_cpu_rr(sc->hs_chan); - ret = hv_vmbus_channel_open( + ret = vmbus_chan_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -1100,7 +1100,7 @@ storvsc_detach(device_t dev) * under the protection of the incoming channel lock. */ - hv_vmbus_channel_close(sc->hs_chan); + vmbus_chan_close(sc->hs_chan); mtx_lock(&sc->hs_lock); while (!LIST_EMPTY(&sc->hs_free_list)) { Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Jul 19 05:57:19 2016 (r303021) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" void @@ -89,9 +90,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(softc->channel, FALSE); + vmbus_chan_set_readbatch(softc->channel, false); - ret = hv_vmbus_channel_open(softc->channel, 4 * PAGE_SIZE, + ret = vmbus_chan_open(softc->channel, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, softc->callback, softc); @@ -110,7 +111,7 @@ hv_util_detach(device_t dev) { struct hv_util_sc *sc = device_get_softc(dev); - hv_vmbus_channel_close(sc->channel); + vmbus_chan_close(sc->channel); free(sc->receive_buffer, M_DEVBUF); return (0); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:57:19 2016 (r303021) @@ -202,9 +202,8 @@ vmbus_chan_sysctl_create(struct hv_vmbus } int -hv_vmbus_channel_open(struct hv_vmbus_channel *chan, - int txbr_size, int rxbr_size, const void *udata, int udlen, - vmbus_chan_callback_t cb, void *cbarg) +vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { struct vmbus_softc *sc = chan->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; @@ -579,7 +578,7 @@ vmbus_chan_close_internal(struct hv_vmbu * are not being opened. */ void -hv_vmbus_channel_close(struct hv_vmbus_channel *chan) +vmbus_chan_close(struct hv_vmbus_channel *chan) { int subchan_cnt; @@ -1370,3 +1369,12 @@ vmbus_chan_msgproc(struct vmbus_softc *s if (msg_proc != NULL) msg_proc(sc, msg); } + +void +vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on) +{ + if (!on) + chan->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; + else + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; +} From owner-svn-src-head@freebsd.org Tue Jul 19 06:04: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 3B06CB9DAF2; Tue, 19 Jul 2016 06:04: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 039E0198E; Tue, 19 Jul 2016 06:04:45 +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 u6J64jeA026456; Tue, 19 Jul 2016 06:04:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J64jZw026455; Tue, 19 Jul 2016 06:04:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607190604.u6J64jZw026455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 06:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303022 - 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, 19 Jul 2016 06:04:46 -0000 Author: sephe Date: Tue Jul 19 06:04:44 2016 New Revision: 303022 URL: https://svnweb.freebsd.org/changeset/base/303022 Log: hyperv/vmbus: Temp/internal variable/function rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7231 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 19 05:57:19 2016 (r303021) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 06:04:44 2016 (r303022) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_chan_send_event(hv_vmbus_channel* channel); +static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); @@ -81,20 +81,20 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M * @brief Trigger an event notification on the specified channel */ static void -vmbus_chan_send_event(hv_vmbus_channel *channel) +vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = channel->vmbus_sc; - uint32_t chanid = channel->ch_id; + struct vmbus_softc *sc = chan->vmbus_sc; + uint32_t chanid = chan->ch_id; atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { atomic_set_int( - &sc->vmbus_mnf2->mnf_trigs[channel->ch_montrig_idx].mt_pending, - channel->ch_montrig_mask); + &sc->vmbus_mnf2->mnf_trigs[chan->ch_montrig_idx].mt_pending, + chan->ch_montrig_mask); } else { - hypercall_signal_event(channel->ch_monprm_dma.hv_paddr); + hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); } } @@ -637,7 +637,7 @@ vmbus_chan_send(struct hv_vmbus_channel error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -677,7 +677,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -719,7 +719,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -838,20 +838,20 @@ vmbus_event_flags_proc(struct vmbus_soft chid_base = f << VMBUS_EVTFLAG_SHIFT; while ((chid_ofs = ffsl(flags)) != 0) { - struct hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; --chid_ofs; /* NOTE: ffsl is 1-based */ flags &= ~(1UL << chid_ofs); - channel = sc->vmbus_chmap[chid_base + chid_ofs]; + chan = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ - if (channel == NULL || channel->ch_tq == NULL) + if (chan == NULL || chan->ch_tq == NULL) continue; - if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - hv_ring_buffer_read_begin(&channel->inbound); - taskqueue_enqueue(channel->ch_tq, &channel->ch_task); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + hv_ring_buffer_read_begin(&chan->inbound); + taskqueue_enqueue(chan->ch_tq, &chan->ch_task); } } } From owner-svn-src-head@freebsd.org Tue Jul 19 07:51: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 332D6B9C92C; Tue, 19 Jul 2016 07:51: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 F05511AC8; Tue, 19 Jul 2016 07:51: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 u6J7pNDF063911; Tue, 19 Jul 2016 07:51:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J7pNSv063907; Tue, 19 Jul 2016 07:51:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607190751.u6J7pNSv063907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 07:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303023 - 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: Tue, 19 Jul 2016 07:51:24 -0000 Author: sephe Date: Tue Jul 19 07:51:22 2016 New Revision: 303023 URL: https://svnweb.freebsd.org/changeset/base/303023 Log: hyperv/vmbus: Rename laundered vmbus channel code MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7232 Added: head/sys/dev/hyperv/vmbus/vmbus_chan.c - copied unchanged from r303022, head/sys/dev/hyperv/vmbus/hv_channel.c Deleted: head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Jul 19 06:04:44 2016 (r303022) +++ head/sys/conf/files.amd64 Tue Jul 19 07:51:22 2016 (r303023) @@ -270,11 +270,11 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_chan.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 Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Jul 19 06:04:44 2016 (r303022) +++ head/sys/conf/files.i386 Tue Jul 19 07:51:22 2016 (r303023) @@ -246,11 +246,11 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus_chan.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 Copied: head/sys/dev/hyperv/vmbus/vmbus_chan.c (from r303022, head/sys/dev/hyperv/vmbus/hv_channel.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Tue Jul 19 07:51:22 2016 (r303023, copy of r303022, head/sys/dev/hyperv/vmbus/hv_channel.c) @@ -0,0 +1,1380 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); +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 + */ +static void +vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + uint32_t chanid = chan->ch_id; + + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); + + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + atomic_set_int( + &sc->vmbus_mnf2->mnf_trigs[chan->ch_montrig_idx].mt_pending, + chan->ch_montrig_mask); + } else { + hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); + } +} + +static int +vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) +{ + struct hv_vmbus_channel *chan = arg1; + int mnf = 0; + + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) + mnf = 1; + return sysctl_handle_int(oidp, &mnf, 0, req); +} + +static void +vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan) +{ + struct sysctl_oid *ch_tree, *chid_tree, *br_tree; + struct sysctl_ctx_list *ctx; + uint32_t ch_id; + char name[16]; + + /* + * 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); + + /* + * 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); + 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"); + } +} + +int +vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) +{ + struct vmbus_softc *sc = chan->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 error; + uint8_t *br; + + if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + device_printf(sc->vmbus_dev, + "invalid udata len %d for chan%u\n", udlen, chan->ch_id); + return EINVAL; + } + KASSERT((txbr_size & PAGE_MASK) == 0, + ("send bufring size is not multiple page")); + KASSERT((rxbr_size & PAGE_MASK) == 0, + ("recv bufring size is not multiple page")); + + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_OPENED_SHIFT)) + panic("double-open chan%u", chan->ch_id); + + chan->ch_cb = cb; + chan->ch_cbarg = cbarg; + + vmbus_chan_update_evtflagcnt(sc, chan); + + chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); + else + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); + + /* + * 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, txbr_size + rxbr_size, &chan->ch_bufring_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (br == NULL) { + device_printf(sc->vmbus_dev, "bufring allocation failed\n"); + error = ENOMEM; + goto failed; + } + chan->ch_bufring = br; + + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size); + + /* Create sysctl tree for this channel */ + vmbus_chan_sysctl_create(chan); + + /* + * Connect the bufrings, both RX and TX, to this channel. + */ + error = vmbus_chan_gpadl_connect(chan, chan->ch_bufring_dma.hv_paddr, + txbr_size + rxbr_size, &chan->ch_bufring_gpadl); + if (error) { + device_printf(sc->vmbus_dev, + "failed to connect bufring GPADL to chan%u\n", chan->ch_id); + goto failed; + } + + /* + * Open channel w/ the bufring GPADL on the target CPU. + */ + 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", + chan->ch_id); + error = ENXIO; + goto failed; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; + req->chm_chanid = chan->ch_id; + req->chm_openid = chan->ch_id; + req->chm_gpadl = chan->ch_bufring_gpadl; + req->chm_vcpuid = chan->ch_vcpuid; + req->chm_txbr_pgcnt = txbr_size >> PAGE_SHIFT; + if (udlen > 0) + memcpy(req->chm_udata, udata, udlen); + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "chopen(chan%u) msg hypercall exec failed: %d\n", + chan->ch_id, error); + vmbus_msghc_put(sc, mh); + goto failed; + } + + 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) { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u opened\n", + chan->ch_id); + } + return 0; + } + + device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + error = ENXIO; + +failed: + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; + } + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; + } + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + return error; +} + +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; + + /* + * Preliminary checks. + */ + + KASSERT((size & PAGE_MASK) == 0, + ("invalid GPA size %d, not multiple page size", size)); + page_count = size >> PAGE_SHIFT; + + KASSERT((paddr & PAGE_MASK) == 0, + ("GPA is not page aligned %jx", (uintmax_t)paddr)); + page_id = paddr >> PAGE_SHIFT; + + 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; + } + + /* + * Allocate GPADL id. + */ + gpadl = vmbus_gpadl_alloc(sc); + *gpadl0 = gpadl; + + /* + * 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", + chan->ch_id); + return EIO; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; + req->chm_chanid = chan->ch_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++; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpadl->chan%u msg hypercall exec failed: %d\n", + chan->ch_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + while (page_count > 0) { + struct vmbus_chanmsg_gpadl_subconn *subreq; + + if (page_count > VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_subconn, + chm_gpa_page[cnt]); + vmbus_msghc_reset(mh, reqsz); + + 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++; + + vmbus_msghc_exec_noresult(mh); + } + KASSERT(page_count == 0, ("invalid page count %d", page_count)); + + msg = vmbus_msghc_wait_result(sc, mh); + status = ((const struct vmbus_chanmsg_gpadl_connresp *) + msg->msg_data)->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status != 0) { + device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " + "status %u\n", chan->ch_id, status); + return EIO; + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "gpadl->chan%u " + "succeeded\n", chan->ch_id); + } + } + return 0; +} + +/* + * Disconnect the GPA from the target channel + */ +int +vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_disconn *req; + int error; + + 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->ch_id); + return EBUSY; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; + 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->ch_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 +vmbus_chan_close_internal(struct hv_vmbus_channel *chan) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_chclose *req; + struct taskqueue *tq = chan->ch_tq; + int error; + + /* TODO: stringent check */ + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + + /* + * Free this channel's sysctl tree attached to its device's + * sysctl tree. + */ + sysctl_ctx_free(&chan->ch_sysctl_ctx); + + /* + * 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", + chan->ch_id); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; + req->chm_chanid = chan->ch_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", + chan->ch_id, error); + return; + } else if (bootverbose) { + device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); + } + + /* + * 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; + } + + /* + * 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; + } +} + +/* + * Caller should make sure that all sub-channels have + * been added to 'chan' and all to-be-closed channels + * are not being opened. + */ +void +vmbus_chan_close(struct hv_vmbus_channel *chan) +{ + int subchan_cnt; + + if (!VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Sub-channel is closed when its primary channel + * is closed; done. + */ + return; + } + + /* + * Close all sub-channels, if any. + */ + subchan_cnt = chan->ch_subchan_cnt; + if (subchan_cnt > 0) { + struct hv_vmbus_channel **subchan; + int i; + + subchan = vmbus_subchan_get(chan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + vmbus_chan_close_internal(subchan[i]); + vmbus_subchan_rel(subchan, subchan_cnt); + } + + /* Then close the primary channel. */ + vmbus_chan_close_internal(chan); +} + +int +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; + uint64_t pad = 0; + struct iovec iov[3]; + boolean_t send_evt; + + hlen = sizeof(pkt); + pktlen = hlen + dlen; + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = type; + pkt.cp_hdr.cph_flags = flags; + 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; + 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; + + error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); + if (!error && send_evt) + vmbus_chan_signal_tx(chan); + return error; +} + +int +vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid) +{ + 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 = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; + 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; + + 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_signal_tx(chan); + return error; +} + +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) +{ + 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 = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; + 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; + + 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_signal_tx(chan); + return error; +} + +int +vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0, + uint64_t *xactid) +{ + struct vmbus_chanpkt_hdr pkt; + int error, dlen, hlen; + + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; + + hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); + dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; + + if (*dlen0 < dlen) { + /* Return the size of this packet's data. */ + *dlen0 = dlen; + return ENOBUFS; + } + + *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; +} + +int +vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) +{ + struct vmbus_chanpkt_hdr pkt; + int error, pktlen; + + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; + + pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); + if (*pktlen0 < pktlen) { + /* Return the size of this packet. */ + *pktlen0 = pktlen; + return ENOBUFS; + } + *pktlen0 = pktlen; + + /* Include packet header */ + error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0); + KASSERT(!error, ("hv_ring_buffer_read failed")); + + return 0; +} + +static void +vmbus_chan_task(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + vmbus_chan_callback_t cb = chan->ch_cb; + void *cbarg = chan->ch_cbarg; + + /* + * 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. + * + * NOTE: Interrupt has been disabled in the ISR. + */ + for (;;) { + uint32_t left; + + cb(cbarg); + + 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->ch_cb(chan->ch_cbarg); +} + +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 chid_base; + u_long flags; + int chid_ofs; + + if (event_flags[f] == 0) + continue; + + flags = atomic_swap_long(&event_flags[f], 0); + chid_base = f << VMBUS_EVTFLAG_SHIFT; + + while ((chid_ofs = ffsl(flags)) != 0) { + struct hv_vmbus_channel *chan; + + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); + + chan = sc->vmbus_chmap[chid_base + chid_ofs]; + + /* if channel is closed or closing */ + if (chan == NULL || chan->ch_tq == NULL) + continue; + + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + hv_ring_buffer_read_begin(&chan->inbound); + taskqueue_enqueue(chan->ch_tq, &chan->ch_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->ch_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid); + + 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->ch_id, chan->ch_cpuid, flag_cnt); + } + break; + } + } +} + +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; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jul 19 09:48: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 76921B9E3E0; Tue, 19 Jul 2016 09:48:09 +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 3D1E9188D; Tue, 19 Jul 2016 09:48:09 +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 u6J9m8JP007558; Tue, 19 Jul 2016 09:48:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J9m8iw007557; Tue, 19 Jul 2016 09:48:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607190948.u6J9m8iw007557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 19 Jul 2016 09:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303024 - 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: Tue, 19 Jul 2016 09:48:09 -0000 Author: tuexen Date: Tue Jul 19 09:48:08 2016 New Revision: 303024 URL: https://svnweb.freebsd.org/changeset/base/303024 Log: netstat and sockstat expect the IPv6 link local addresses to have an embedded scope. So don't recover. MFC after: 3 days Modified: head/sys/netinet/sctp_sysctl.c Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Tue Jul 19 07:51:22 2016 (r303023) +++ head/sys/netinet/sctp_sysctl.c Tue Jul 19 09:48:08 2016 (r303024) @@ -279,15 +279,6 @@ sctp_sysctl_copy_out_local_addresses(str if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { if (local_scope == 0) continue; - if (sin6->sin6_scope_id == 0) { - /* - * bad link - * local - * address - */ - if (sa6_recoverscope(sin6) != 0) - continue; - } } if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) continue; From owner-svn-src-head@freebsd.org Tue Jul 19 11:16: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 C3358B9EA97; Tue, 19 Jul 2016 11:16:45 +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 93623168F; Tue, 19 Jul 2016 11:16:45 +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 u6JBGiSA042426; Tue, 19 Jul 2016 11:16:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JBGi1p042425; Tue, 19 Jul 2016 11:16:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607191116.u6JBGi1p042425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 19 Jul 2016 11:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303025 - 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: Tue, 19 Jul 2016 11:16:45 -0000 Author: tuexen Date: Tue Jul 19 11:16:44 2016 New Revision: 303025 URL: https://svnweb.freebsd.org/changeset/base/303025 Log: Use correct order of conditions to avoid NULL deref. MFC after: 3 days X-MFC with: r302935 Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Tue Jul 19 09:48:08 2016 (r303024) +++ head/sys/netinet/sctp_indata.c Tue Jul 19 11:16:44 2016 (r303025) @@ -831,7 +831,7 @@ restart: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); - if (!TAILQ_EMPTY(&nc->reasm) && (nc->first_frag_seen)) { + if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { /* * Switch to the new guy and * continue From owner-svn-src-head@freebsd.org Tue Jul 19 11:22: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 177C6B9EC5B; Tue, 19 Jul 2016 11:22:31 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mail.miracle.cz (mail.miracle.cz [193.84.128.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.miracle.cz", Issuer "Miracle Group Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CAE381AD3; Tue, 19 Jul 2016 11:22:30 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from [193.84.128.50] (meloun.ad.miracle.cz [193.84.128.50]) by mail.miracle.cz (Postfix) with ESMTPSA id 276383ACE3; Tue, 19 Jul 2016 13:13:34 +0200 (CEST) Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Nathan Whitehorn , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> From: Michal Meloun X-Enigmail-Draft-Status: N1110 Message-ID: <578E0B5D.3070105@FreeBSD.org> Date: Tue, 19 Jul 2016 13:13:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.miracle.cz); Tue, 19 Jul 2016 13:13:34 +0200 (CEST) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 11:22:31 -0000 Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): Hi Nathan, I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so please don’t expect quick response. > Could you please describe what this change is in more detail? Short description is appended. > > It breaks a lot of encapsulations we have worked very hard to maintain, > moves ARM code into MI parts of the kernel, and the OFW parts violate > IEEE 1275 (the Open Firmware standard). In particular, there is no > guarantee that the interrupts for a newbus (or OF) device are encoded in > a property called "interrupts" (or, indeed, in any property at all) on > that node and there are many, many device trees where that is not the > case (e.g. ones with interrupt maps, as well as Apple hardware). By > putting that knowledge into the OF root bus device, which we have tried > to keep it out of, this enforces a standard that doesn't actually exist. Imho, this patch doesn’t change anything in this area. Only handling of “interrupts” property is changed, all other cases are unchanged (I hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. > > I'm hesitant to ask for reversion on something that landed 6 weeks ago > without me noticing, but this needs a lot more architectural work before > any parts of the kernel should use it. > -Nathan I think that it’s too late. This patch series consist of r301451 (https://reviews.freebsd.org/D6632), r301453, r301539 and 301543. And new GPIO interrupts are currently used (by in tree drivers or in development trees). The root of problem is that standard way of delivering interrupt resource to consumer driver doesn’t works in OFW world. So we have some fact: - the format of interrupt property is dependent of interrupt controller and only interrupt controller can parse it. - the interrupt property can have more data than just interrupt number. - single interrupt controller must be able to handle multiple format of interrupt description. In pre-patchset era, simplebus enumerates children and attempts to set memory and interrupts to resource list for them. But the interrupt controllers are not yet populated so nobody can parse interrupt property. Moreover, in all cases (parsed or not), we cannot store complete interrupt description into resource list. The patch simply postpones reading of interrupt property to bus_alloc_resource() (called by consumer driver) time. Due to this, we can: - parse interrupt property. The interrupt driver must exist at this time. - bus_alloc_resource() returns resource, so we can attach parsed interrupt data to it. By this, the resource itself can be used for delivering configuration data to subsequent call to bus_setup_intr() (or to all related bus_() calls). The patched code still accepts delivering of interrupts in resource list. Michal From owner-svn-src-head@freebsd.org Tue Jul 19 11:43: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 F0D04B9C31E for ; Tue, 19 Jul 2016 11:43:22 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-pa0-x236.google.com (mail-pa0-x236.google.com [IPv6:2607:f8b0:400e:c03::236]) (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 C061D197D for ; Tue, 19 Jul 2016 11:43:22 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-pa0-x236.google.com with SMTP id iw10so6391502pac.2 for ; Tue, 19 Jul 2016 04:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=q+ZKOX2GyF3pn16UlA17jz1ZKERyNOGiN1CxLYT/AmI=; b=dvZyE7tlcCBLIlLxR6RzW8FRK+DaomO+lYCF76soAPRQ5L+VBsFKKZYWQ8ZkH50yD4 dIyqZ9PlJUtQlj16FL48UObmqzkqodr8RdbEiUBllD1a0bDA4g98f+k9hLGfXvbHLLIH JXKXKgYW1UyWMbxZuZVINr0jqWxUGcliTEgow= 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=q+ZKOX2GyF3pn16UlA17jz1ZKERyNOGiN1CxLYT/AmI=; b=eui/gQlJPqBkLA/PQKEe00ABj/dPLHJ0V/PdgYIiqmQl1RFzX2PwvZRPMb3aYebHGF 9zi7M2RP3/i/3MWh1Bp2lSxcyzzYbRTOkLJpVPbwqFa1vwGGf9ET2akabyPNIn6xU9rm MAOPgWCt2c3fqmwl4NeRiUvc5fSuEYQYiKJfF3BKeyOVXFasSEmz8KuJ7fCIq+ePZN5G ZcEPMqljrXXrSGp+tVRi5XREo3co2HS7C1rzEgCd7vzo5FyfDrrr6bao+ydGOPsuN3PE 8l7QCtMVTJ3HXGN/QQD8H4P1CYqOptlGTvlrWdIhjormby91/GG4P0yTU4VwASg6vK/5 GhcA== X-Gm-Message-State: ALyK8tL8oA7YPIrhAPNBIZbxNBgFek0/2Q7GhjmJ6Na2TzeQ5Ob268mLpiT3dKpuW8xicQiQ X-Received: by 10.66.66.13 with SMTP id b13mr65166407pat.45.1468928601967; Tue, 19 Jul 2016 04:43:21 -0700 (PDT) Received: from [100.127.66.198] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id q14sm2877361pfi.76.2016.07.19.04.43.19 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 04:43:21 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302998 - head/sys/kern From: Randall Stewart In-Reply-To: <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> Date: Tue, 19 Jul 2016 13:43:16 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> To: Gleb Smirnoff 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: Tue, 19 Jul 2016 11:43:23 -0000 Gleb Ok I have now updated https://reviews.freebsd.org/D7135 You can take this or not=E2=80=A6 I really don=E2=80=99t care either = way=E2=80=A6 (you are welcome to own the kern_timeout.c code I hate it) :-) Basically when you went off and re-factored kern_timeout.c I had worked = in parallel on fixing the bugs you were seeing.. There were three distinct problems that I = fixed=E2=80=A6 but then you had refactored the stop() routine.. and I thought ok.. thats fine. I = had actually thought about doing something similar to what you did and was too chicken to poke that = much at it.. it has always had a nasty habit of biting back when you make a lot of changes = :-D I know my version has worked for quite some time in my testing so I = brought it back. Complete with its 3 return codes (I only recently switched to your = version and thus started having difficulties with leaks and crashes)=E2=80=A6. You are welcome not to use this.. I know it works (it ran on a number of machines at NF last night.. and we will of course = continue testing it as we finish our dev testing for the upcoming OCA software release).. = For now this is what will be going out into the OCA=E2=80=99s at least :-) R > On Jul 18, 2016, at 6:19 PM, Randall Stewart wrote: >=20 > I have worked out a fix of this in Netflix code base (I have the same = code running there). I > will get that tested tonight I will get the fixes in to restore the = behavior. >=20 > I will setup a phabricator shortly.. most likely I will update the one = I already > have on the one problem your earlier patch did not fix. >=20 > R >> On Jul 18, 2016, at 5:44 PM, Randall Stewart wrote: >>=20 >> Gleb: >>=20 >> This now leaks TCP-PCB=E2=80=99s since you have broken the return = codes with all your >> fixes that used to be in here. >>=20 >> It was >>=20 >> return 1 =E2=80=94 You stopped the callout >> return 0 =E2=80=94 The callout could not be stopped >> return -1 =E2=80=94 The callout was not running. >>=20 >> The LLRef code that was crashing in in.c depended on this to know to = free >> the memory.. i.e. if was > 0 then they needed to free the memory. >>=20 >> TCP depends on a return 0 to indicate the async-drain function will = be called back and >> thus increments a refcnt and waits for the callback. >>=20 >> You now return 0 when no timer was active.. which makes the stack = then wait >> for the not forth coming async-drain call. >>=20 >> R >>> On Jul 18, 2016, at 11:29 AM, Gleb Smirnoff = wrote: >>>=20 >>> Author: glebius >>> Date: Mon Jul 18 09:29:08 2016 >>> New Revision: 302998 >>> URL: https://svnweb.freebsd.org/changeset/base/302998 >>>=20 >>> Log: >>> Revert the last commit. It must get more review and testing first. >>>=20 >>> Modified: >>> head/sys/kern/kern_timeout.c >>>=20 >>> Modified: head/sys/kern/kern_timeout.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/sys/kern/kern_timeout.c Mon Jul 18 09:26:06 2016 = (r302997) >>> +++ head/sys/kern/kern_timeout.c Mon Jul 18 09:29:08 2016 = (r302998) >>> @@ -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 (-1); >>> + return (0); >>> } >>>=20 >>> c->c_iflags &=3D ~CALLOUT_PENDING; >>>=20 >>=20 >> -------- >> Randall Stewart >> rrs@netflix.com >> 803-317-4952 >>=20 >>=20 >>=20 >>=20 >>=20 >=20 > -------- > Randall Stewart > rrs@netflix.com > 803-317-4952 >=20 >=20 >=20 >=20 >=20 -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Tue Jul 19 12:25: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 40C9BB9D943; Tue, 19 Jul 2016 12:25:46 +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 257E216CB; Tue, 19 Jul 2016 12:25:46 +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 C06FC180F; Tue, 19 Jul 2016 12:25:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Tue, 19 Jul 2016 12:25:45 +0000 From: Glen Barber To: Randall Stewart Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302998 - head/sys/kern Message-ID: <20160719122545.GC65494@FreeBSD.org> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4ZLFUWh1odzi/v6L" Content-Disposition: inline In-Reply-To: <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> 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: Tue, 19 Jul 2016 12:25:46 -0000 --4ZLFUWh1odzi/v6L Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 19, 2016 at 01:43:16PM +0200, Randall Stewart wrote: > Gleb >=20 > Ok >=20 > I have now updated >=20 > https://reviews.freebsd.org/D7135 >=20 > You can take this or not=E2=80=A6 I really don=E2=80=99t care either way= =E2=80=A6 (you are welcome to > own the kern_timeout.c code I hate it) :-) >=20 > Basically when you went off and re-factored kern_timeout.c I had worked i= n parallel on fixing > the bugs you were seeing.. There were three distinct problems that I fixe= d=E2=80=A6 but then > you had refactored the stop() routine.. and I thought ok.. thats fine. I = had actually thought about > doing something similar to what you did and was too chicken to poke that = much at it.. it has > always had a nasty habit of biting back when you make a lot of changes :-D >=20 > I know my version has worked for quite some time in my testing so I broug= ht it back. > Complete with its 3 return codes (I only recently switched to your versio= n and thus > started having difficulties with leaks and crashes)=E2=80=A6. >=20 > You are welcome not to use this.. I know it works (it ran > on a number of machines at NF last night.. and we will of course continue= testing > it as we finish our dev testing for the upcoming OCA software release).. = For now > this is what will be going out into the OCA=E2=80=99s at least :-) >=20 I'm honestly done with this topic, and at the point now where I'm considering backing out all changes to callout(9) and related changes to the state they were at in stable/10. This changes the KBI, and if it needs to be done, it needs to happen now. We cannot wait for RC1 phase for this, and the amount of churn to get things into a working state with the current implementation far outweighs the benefit of the dangers. Glen --4ZLFUWh1odzi/v6L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXjhxEAAoJEAMUWKVHj+KT5xIP/jg4d79vtnMxLGSMprTEJ5ex +zXlcL1hut+Ja8tdBOdR0XxwnMZJKG77a4nRpi1pd3F+tohHxbthUHPzpq4Bs6Os LUftWJL9Zrkc/oGP3AziPPYtQmutNgmeKKBM6O88UEqp/cb8jtm6nmF56E0HxyMI uXQ6cjm9x6eRcRt1J8ta9QkmReUWWtoDc34br7pphEB/6O2174uvYWqtTof/SCKL KT2V6R9fX98ThhL3OgqO6a9pF51uLMN3UpDqrluOOQxk4NuJTMfEC51WQtY+HGAL ZRDmUj+/fWgNVgk6sbdBgJPgH+W+EJtCgg15ietOofur+7kJBbT9NxvaIfHJhN3N TCADGLSZfCryX7/bUET8xkqXUOHRxxF3Ukp5oby6NRUwzE6H3hqk0/MJgLWHsVyI 1E46Ay2DN9+gLuhkIhx6rNF7a3xvA6ZmMIk6uPZoi1V7BAou9XS6cTZiR8xAqy9T 5O0fU8dBQ4oeWJuZp2i1Yjq/9KmQ+GavO4LCdzLKThzTmJAuCm2I1L7HpnNfaQIR 6J0nIuoGczy7vFXZ7ZfMKi34p1g8WqVETwbr9lOPc/GLOhY/px13G1UdOKFU5+bs mgpkcNy1A625hrBRkjDhueHgXIOWB2zc+Iq3KGzeMqO1uuUoH9I3BFtFJhjSUROZ ZvFeKzepJ0aTtJzS+jXR =gsnG -----END PGP SIGNATURE----- --4ZLFUWh1odzi/v6L-- From owner-svn-src-head@freebsd.org Tue Jul 19 13:46: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 6E700B9E53C for ; Tue, 19 Jul 2016 13:46:58 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c: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 0286B1E57 for ; Tue, 19 Jul 2016 13:46:58 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-wm0-x22c.google.com with SMTP id f65so139565386wmi.0 for ; Tue, 19 Jul 2016 06:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cbkwfU1SQm13mj4CPVN3YAH8Sg6ACWOtoDazr/y2M8I=; b=kPCDZ+KnV/+7VAgj2iN8TULuB9Z31/ChTKbqGDRWjor+cPY/T7vrOpJ1Y4SsbJIlT5 Flw12v6TD9De4odUa2zD7Mdgqu2M/MHdGY7hF3M8Y/HM9c6xIitEh98pcR5EPt70Y7Nf I5rm3koaJTFnmqJHBDk7MaxPtAVZ2BJa30JFo= 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=cbkwfU1SQm13mj4CPVN3YAH8Sg6ACWOtoDazr/y2M8I=; b=EnITIJkJY74pwdoJHP+XHJwJ6hgLx+j9lV6cb8rLAmuUx7Utlnnazngs0hsrXoHfu2 /DBa2VpzNdjmKRFuIJ6guJR+7fPj4DMr+gjm6Ww/ouRsKwJOgUtM5iYVBsuvm+yqqM4f TGNprEepU4zVFyjvLyzcnbfl7CXYN8KmLVRqCBjaeWL1IBVSytTthlc7KJJYSid2Wdyw rb4iZfgl7rfZP2LzgSBGEbdm/BvhvqGIgCtAj9SZwBwv1r+bLfubHSp8TsR1mqrbPfnT eqaxmGYXEnvJ9MIDH2ybjTtKadwQn+WGQJAyN/aHvT1IoK4onLYJ30ABwosGpS40v2MQ UNsw== X-Gm-Message-State: ALyK8tLQTmJMWQETEzRVcZoVxx3HM48yJ2DcCkEZmiUMhI38BE2k73j3ClxN1eqPe+iiPmJe X-Received: by 10.28.94.18 with SMTP id s18mr4336513wmb.44.1468936015920; Tue, 19 Jul 2016 06:46:55 -0700 (PDT) Received: from surfer-172-29-73-217-hotspot.internet-for-guests.com ([62.214.2.210]) by smtp.gmail.com with ESMTPSA id m201sm23061649wma.11.2016.07.19.06.46.54 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 06:46:55 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302998 - head/sys/kern From: Randall Stewart In-Reply-To: <20160719122545.GC65494@FreeBSD.org> Date: Tue, 19 Jul 2016 15:46:54 +0200 Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <03E667D5-A4C9-47B9-A8DD-49ECD0E2B7EB@netflix.com> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> <20160719122545.GC65494@FreeBSD.org> To: Glen Barber 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: Tue, 19 Jul 2016 13:46:58 -0000 Glen: My changes work.. I have them running in NF in at least 1/2 dozen = machines. I am more than willing to commit them.. they actually are not much = different than whats in stable 10.. though I don=E2=80=99t know if the async-drain was = MFC=E2=80=99d there.. it needs to be in for TCP.. or else you will have yet another mess in that respect (TCP depends on ASYNC-drain). I can commit what I have.. if you like.. or not.. I really don=E2=80=99t = care (I hate kern_timeout.c :-o) R > On Jul 19, 2016, at 2:25 PM, Glen Barber wrote: >=20 > On Tue, Jul 19, 2016 at 01:43:16PM +0200, Randall Stewart wrote: >> Gleb >>=20 >> Ok >>=20 >> I have now updated >>=20 >> https://reviews.freebsd.org/D7135 >>=20 >> You can take this or not=E2=80=A6 I really don=E2=80=99t care either = way=E2=80=A6 (you are welcome to >> own the kern_timeout.c code I hate it) :-) >>=20 >> Basically when you went off and re-factored kern_timeout.c I had = worked in parallel on fixing >> the bugs you were seeing.. There were three distinct problems that I = fixed=E2=80=A6 but then >> you had refactored the stop() routine.. and I thought ok.. thats = fine. I had actually thought about >> doing something similar to what you did and was too chicken to poke = that much at it.. it has >> always had a nasty habit of biting back when you make a lot of = changes :-D >>=20 >> I know my version has worked for quite some time in my testing so I = brought it back. >> Complete with its 3 return codes (I only recently switched to your = version and thus >> started having difficulties with leaks and crashes)=E2=80=A6. >>=20 >> You are welcome not to use this.. I know it works (it ran >> on a number of machines at NF last night.. and we will of course = continue testing >> it as we finish our dev testing for the upcoming OCA software = release).. For now >> this is what will be going out into the OCA=E2=80=99s at least :-) >>=20 >=20 > I'm honestly done with this topic, and at the point now where I'm > considering backing out all changes to callout(9) and related changes = to > the state they were at in stable/10. >=20 > This changes the KBI, and if it needs to be done, it needs to happen > now. We cannot wait for RC1 phase for this, and the amount of churn = to > get things into a working state with the current implementation far > outweighs the benefit of the dangers. >=20 > Glen >=20 -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Tue Jul 19 13:56: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 551A7B9E806; Tue, 19 Jul 2016 13:56:16 +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 220111648; Tue, 19 Jul 2016 13:56:16 +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 B77E61613; Tue, 19 Jul 2016 13:56:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Tue, 19 Jul 2016 13:56:14 +0000 From: Glen Barber To: Randall Stewart Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r302998 - head/sys/kern Message-ID: <20160719135614.GE65494@FreeBSD.org> References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> <20160719122545.GC65494@FreeBSD.org> <03E667D5-A4C9-47B9-A8DD-49ECD0E2B7EB@netflix.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HnQK338I3UIa/qiP" Content-Disposition: inline In-Reply-To: <03E667D5-A4C9-47B9-A8DD-49ECD0E2B7EB@netflix.com> 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: Tue, 19 Jul 2016 13:56:16 -0000 --HnQK338I3UIa/qiP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 19, 2016 at 03:46:54PM +0200, Randall Stewart wrote: > Glen: >=20 > My changes work.. I have them running in NF in at least 1/2 dozen machin= es. >=20 For how long? What are the uptimes on these machines? This is the blocker for 11.0-BETA2, and I don't want to see more regressions being introduced at this point of the cycle. Glen > I am more than willing to commit them.. they actually are not much differ= ent than > whats in stable 10.. though I don=E2=80=99t know if the async-drain was M= FC=E2=80=99d there.. it > needs to be in for TCP.. or else you will have yet another mess in that > respect (TCP depends on ASYNC-drain). >=20 > I can commit what I have.. if you like.. or not.. I really don=E2=80=99t = care (I hate kern_timeout.c :-o) >=20 > R > > On Jul 19, 2016, at 2:25 PM, Glen Barber wrote: > >=20 > > On Tue, Jul 19, 2016 at 01:43:16PM +0200, Randall Stewart wrote: > >> Gleb > >>=20 > >> Ok > >>=20 > >> I have now updated > >>=20 > >> https://reviews.freebsd.org/D7135 > >>=20 > >> You can take this or not=E2=80=A6 I really don=E2=80=99t care either w= ay=E2=80=A6 (you are welcome to > >> own the kern_timeout.c code I hate it) :-) > >>=20 > >> Basically when you went off and re-factored kern_timeout.c I had worke= d in parallel on fixing > >> the bugs you were seeing.. There were three distinct problems that I f= ixed=E2=80=A6 but then > >> you had refactored the stop() routine.. and I thought ok.. thats fine.= I had actually thought about > >> doing something similar to what you did and was too chicken to poke th= at much at it.. it has > >> always had a nasty habit of biting back when you make a lot of changes= :-D > >>=20 > >> I know my version has worked for quite some time in my testing so I br= ought it back. > >> Complete with its 3 return codes (I only recently switched to your ver= sion and thus > >> started having difficulties with leaks and crashes)=E2=80=A6. > >>=20 > >> You are welcome not to use this.. I know it works (it ran > >> on a number of machines at NF last night.. and we will of course conti= nue testing > >> it as we finish our dev testing for the upcoming OCA software release)= =2E. For now > >> this is what will be going out into the OCA=E2=80=99s at least :-) > >>=20 > >=20 > > I'm honestly done with this topic, and at the point now where I'm > > considering backing out all changes to callout(9) and related changes to > > the state they were at in stable/10. > >=20 > > This changes the KBI, and if it needs to be done, it needs to happen > > now. We cannot wait for RC1 phase for this, and the amount of churn to > > get things into a working state with the current implementation far > > outweighs the benefit of the dangers. > >=20 > > Glen > >=20 >=20 > -------- > Randall Stewart > rrs@netflix.com > 803-317-4952 >=20 >=20 >=20 >=20 >=20 --HnQK338I3UIa/qiP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXjjF+AAoJEAMUWKVHj+KTz4IP/RS7eMubuJFzIGlvByqZ0FFl UUEQrjRVG0VB9UTMOEW27zo8Xt1jj9iv1TyZJqgdadIZlBGaQiw5A5rotDAUTFTD RR+6QxRv32bxlwJlSb10fZaAbbUjG197OnwmzgBUTke5cqTm+5GZt9x6rUhaSjes H/sMP2lOtg2fUEKu7k7oONTqhwZFvusanoi4dbvYOLWQcah782bSycZugbMltfZB lQksNCDnJNXzW3L3aLqI0dGHHfxyBHpLgIaYBLJbocacu5gLJ4l2srFe3ab9QwGT fSG8Od3CDHNWRgxw4I2qfb20pShKNLrq9Tzwm+g7eAr1Vk5ssvz+viMlvhyJx5q2 U8NgZcZsvbaUMgLMXfJGG7nOLZN+G3U0QUzvt3/AO30ARP4iVdZUKhE9jffYvlPe 7BlyxQBFft0HoWpayI/4nYDQzknzDo7phfdqW2IpakcMu+tIu0ocnb8Zs1bz5kyh BX8r6MFZIMQmHG1pZh53XU+rONke1PVsq7zDOZLjR2MMKrsCEU9nW2O8ZQxO7Lsb uUyhfOlxn/n65LiL7NZrVExs6CzKDaMn5tAoJxhVMGoImvOCz97iWmTtTnXIJ9vE cq6oiPPGd72Rt4pogMiQ2lFFPOd4rwkW0GgX3p+n4hmM5tLaUt8daDJPh82AfhqF GUqCKdveifpNCXFrqL6T =yXdD -----END PGP SIGNATURE----- --HnQK338I3UIa/qiP-- From owner-svn-src-head@freebsd.org Tue Jul 19 14: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 C2C9EB9E88F for ; Tue, 19 Jul 2016 14:58:01 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 558CE12A4 for ; Tue, 19 Jul 2016 14:58:01 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-wm0-x236.google.com with SMTP id o80so29888655wme.1 for ; Tue, 19 Jul 2016 07:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YkpmP7BmMjMhcJJZEE1H3ptxZaKu8lgb2+3bEwWgHeo=; b=Gade/jcB5glELTlPTVyIZQs05HwtJ+An09sruvLqCwng2iPAfNvemZo2AYlGv7BsOv I7s9iG+UHCTHtUIf1lUxq+ARxxl/ebJzWAJKh8FnO9umdTyeDENybbs9s6jQPlxDpn2z 4xTkP9adaf79FedtGD2In4evk0buYQhNjlvNc= 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=YkpmP7BmMjMhcJJZEE1H3ptxZaKu8lgb2+3bEwWgHeo=; b=ffHBGunHanfEqrWtlW8aO6fWY42cY+3/3+QG6A+/ZeaitUcJ0d5q2+eIbUsH/m5buN NkHa0QbABP+levri08lUJvls7A4Rqs5Km0Sf7Ww/uqkDjdsDasddgO/vEoJyVW7pb5yj S/46uFLoCH9O0fVbDX7cJ2UuN7OFT9A+em7g+6HCYOMhEdIt2egZUGuyrXxy37aXfJyW UC4FGn2/aWrtAheXxFx4F1yXmAmpMrzVqq9Yo8ddYyRxp5oXKr9X2ZSbxU5/ePay0RAx yYaeuvGme3b/ZG4cxOw3+8OFqbu+qj8QEFPKSEMgsdpgafbbSv+OcdUc11ib23x1SZ39 1ibA== X-Gm-Message-State: ALyK8tKso/E5ZF/2AcDvqVZ41S+AuTMm9b4SYTToKjM+kvErudC1rOmI/fiFxGncUSqXUSIt X-Received: by 10.28.47.7 with SMTP id v7mr4823067wmv.38.1468940279691; Tue, 19 Jul 2016 07:57:59 -0700 (PDT) Received: from dhcp-a2de.meeting.ietf.org (dhcp-a2de.meeting.ietf.org. [31.133.162.222]) by smtp.gmail.com with ESMTPSA id a21sm6405214wma.10.2016.07.19.07.57.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 07:57:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r302998 - head/sys/kern From: Randall Stewart In-Reply-To: <20160719135614.GE65494@FreeBSD.org> Date: Tue, 19 Jul 2016 16:57:57 +0200 Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201607180929.u6I9T9Uw063705@repo.freebsd.org> <64C1543A-3EDE-4852-88EA-5B0B78FCF016@netflix.com> <58868615-8255-4D8B-BD9E-8E19A734CB6C@netflix.com> <5E551FA8-C779-45AE-B038-D8B51B53EEAA@netflix.com> <20160719122545.GC65494@FreeBSD.org> <03E667D5-A4C9-47B9-A8DD-49ECD0E2B7EB@netflix.com> <20160719135614.GE65494@FreeBSD.org> To: Glen Barber 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: Tue, 19 Jul 2016 14:58:01 -0000 Well=20 The code itself I had up on machines for probably about 2 months. But = then I switched over to Gleb=E2=80=99s changes here just recently .. which = caused me all kinds of fun :) I had to go back into Mercurial to pull back my changes.. I have had the resurrected changes running on my netflix machines for about 20 or so hours generating about anywhere from 14Gbps to 32Gbps depending on the = machine type. I plan on waiting until tomorrow to sync it down into the NF code base.=20= Note that if you do decide instead to roll back to the 10.x = kern_timeout.c you will need to roll back a bunch of tcp changes as well that use the new async_drain() interface. I am game either way for you to proceed.. I will commit this current = code to head as long as I hear no objections (from Gleb or others)=E2=80=A6. R > On Jul 19, 2016, at 3:56 PM, Glen Barber wrote: >=20 > On Tue, Jul 19, 2016 at 03:46:54PM +0200, Randall Stewart wrote: >> Glen: >>=20 >> My changes work.. I have them running in NF in at least 1/2 dozen = machines. >>=20 >=20 > For how long? What are the uptimes on these machines? >=20 > This is the blocker for 11.0-BETA2, and I don't want to see more > regressions being introduced at this point of the cycle. >=20 > Glen >=20 >> I am more than willing to commit them.. they actually are not much = different than >> whats in stable 10.. though I don=E2=80=99t know if the async-drain = was MFC=E2=80=99d there.. it >> needs to be in for TCP.. or else you will have yet another mess in = that >> respect (TCP depends on ASYNC-drain). >>=20 >> I can commit what I have.. if you like.. or not.. I really don=E2=80=99= t care (I hate kern_timeout.c :-o) >>=20 >> R >>> On Jul 19, 2016, at 2:25 PM, Glen Barber wrote: >>>=20 >>> On Tue, Jul 19, 2016 at 01:43:16PM +0200, Randall Stewart wrote: >>>> Gleb >>>>=20 >>>> Ok >>>>=20 >>>> I have now updated >>>>=20 >>>> https://reviews.freebsd.org/D7135 >>>>=20 >>>> You can take this or not=E2=80=A6 I really don=E2=80=99t care = either way=E2=80=A6 (you are welcome to >>>> own the kern_timeout.c code I hate it) :-) >>>>=20 >>>> Basically when you went off and re-factored kern_timeout.c I had = worked in parallel on fixing >>>> the bugs you were seeing.. There were three distinct problems that = I fixed=E2=80=A6 but then >>>> you had refactored the stop() routine.. and I thought ok.. thats = fine. I had actually thought about >>>> doing something similar to what you did and was too chicken to poke = that much at it.. it has >>>> always had a nasty habit of biting back when you make a lot of = changes :-D >>>>=20 >>>> I know my version has worked for quite some time in my testing so I = brought it back. >>>> Complete with its 3 return codes (I only recently switched to your = version and thus >>>> started having difficulties with leaks and crashes)=E2=80=A6. >>>>=20 >>>> You are welcome not to use this.. I know it works (it ran >>>> on a number of machines at NF last night.. and we will of course = continue testing >>>> it as we finish our dev testing for the upcoming OCA software = release).. For now >>>> this is what will be going out into the OCA=E2=80=99s at least :-) >>>>=20 >>>=20 >>> I'm honestly done with this topic, and at the point now where I'm >>> considering backing out all changes to callout(9) and related = changes to >>> the state they were at in stable/10. >>>=20 >>> This changes the KBI, and if it needs to be done, it needs to happen >>> now. We cannot wait for RC1 phase for this, and the amount of churn = to >>> get things into a working state with the current implementation far >>> outweighs the benefit of the dangers. >>>=20 >>> Glen >>>=20 >>=20 >> -------- >> Randall Stewart >> rrs@netflix.com >> 803-317-4952 >>=20 >>=20 >>=20 >>=20 >>=20 -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Tue Jul 19 15:06: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 1DEE7B9ECF4; Tue, 19 Jul 2016 15:06:49 +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 0A24E18FC; Tue, 19 Jul 2016 15:06:48 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6JF6jYQ025935 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 19 Jul 2016 08:06:46 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> From: Nathan Whitehorn Message-ID: Date: Tue, 19 Jul 2016 08:06: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: <578E0B5D.3070105@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Sonic-CAuth: UmFuZG9tSVbZZBE9GBHIe/W2fotA8uS1IEchVKR9c5oc+LEi6bRY0o12vNuZD71Sy7U9IUL/rGY73VnqeGpxdGTQVyicpdFKfdHEFrvRj9g= X-Sonic-ID: C;bpiiaMJN5hGKN5NwxPCmMQ== M;VhnkaMJN5hGKN5NwxPCmMQ== 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: Tue, 19 Jul 2016 15:06:49 -0000 On 07/19/16 04:13, Michal Meloun wrote: > Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): > Hi Nathan, > I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so > please don’t expect quick response. > >> Could you please describe what this change is in more detail? > Short description is appended. > >> It breaks a lot of encapsulations we have worked very hard to maintain, >> moves ARM code into MI parts of the kernel, and the OFW parts violate >> IEEE 1275 (the Open Firmware standard). In particular, there is no >> guarantee that the interrupts for a newbus (or OF) device are encoded in >> a property called "interrupts" (or, indeed, in any property at all) on >> that node and there are many, many device trees where that is not the >> case (e.g. ones with interrupt maps, as well as Apple hardware). By >> putting that knowledge into the OF root bus device, which we have tried >> to keep it out of, this enforces a standard that doesn't actually exist. > Imho, this patch doesn’t change anything in this area. Only handling of > “interrupts” property is changed, all other cases are unchanged (I > hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. But "interrupts" isn't a generic part of OF. This makes it one, incorrectly. > >> I'm hesitant to ask for reversion on something that landed 6 weeks ago >> without me noticing, but this needs a lot more architectural work before >> any parts of the kernel should use it. >> -Nathan > I think that it’s too late. This patch series consist of r301451 > (https://reviews.freebsd.org/D6632), > r301453, r301539 and 301543. And new GPIO interrupts are currently used > (by in tree drivers or in development trees). Well, then we need in-place rearchitecture. > > > The root of problem is that standard way of delivering interrupt > resource to consumer driver doesn’t works in OFW world. > > So we have some fact: > - the format of interrupt property is dependent of interrupt > controller and only interrupt controller can parse it. > - the interrupt property can have more data than just interrupt > number. > - single interrupt controller must be able to handle multiple > format of interrupt description. > > In pre-patchset era, simplebus enumerates children and attempts to set > memory and interrupts to resource list for them. But the interrupt > controllers are not yet populated so nobody can parse interrupt > property. Moreover, in all cases (parsed or not), we cannot store > complete interrupt description into resource list. We have done this for many years on PowerPC and sparc64 with delayed configuration of interrupts and a look-up table. This handles complicated bus configurations better than this code and requires no changes outside of a few MD files. That is why the (now partially duplicated) OFW_BUS_MAP_INTR() function exists. That one also has the benefit of still working when used in conjunction with, e.g., devices with an interrupt-map-mask property. > > The patch simply postpones reading of interrupt property to > bus_alloc_resource() (called by consumer driver) time. > > Due to this, we can: > - parse interrupt property. The interrupt driver must exist > at this time. This only works with some types of interrupt properties, not all, and breaks if the interrupt driver hasn't attached yet (which it can't be guaranteed to -- some PPC systems have interrupt drivers that live on the PCI bus, for example). > - bus_alloc_resource() returns resource, so we can attach parsed > interrupt data to it. By this, the resource itself can be used > for delivering configuration data to subsequent call to > bus_setup_intr() (or to all related bus_() calls). > > > The patched code still accepts delivering of interrupts in resource list. > > Michal > Given that other code depends on this, fixing it will likely require some complex work. I wish I had known about it when it went in. There are three main problems: 1. It doesn't work for interrupts defined by other mechanisms (e.g. interrupt-map properties) 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), but is both problematically more general and less flexible (it has requirements on timing of PIC attachment vs. driver resource allocation) 3. It is not fully transparent to end code. Since it happens at bus_alloc_resource() time, it is complicated to get the appropriate values for IRQs constructed by composite techniques (interrupt-map vs. interrupts vs. hand allocation vs. PCI routing, for example). It is much easier to do this correctly at bus attach time when the resource lists are made (how PPC does it). (1) is easy to fix without API changes, but (2) and (3) are fundamental architectural problems that will bite us immediately down the road and cause a permanent schism between OF support on different platforms. Let me describe how this is handled on PowerPC (Linux on PPC solves the problem the same way). When constructing a resource list, bus drivers that construct them from OF properties call ofw_bus_map_intr() with the interrupt parent phandle and the array of cells corresponding to the interrupt. This thunks immediately to nexus, which connects to code in intr_machdep.c. Code there assigns a unique made-up virtual IRQ and returns it, caching the interrupt parent ID and opaque interrupt data (if the same string of data reappears later, you get back the same virtual IRQ of course). When PIC drivers attach and register themselves with the interrupt handling layer, all the interrupts for that PIC are passed to it along with the virtual IRQ. The PIC driver is supposed to know what its interrupt data mean, which can be safely guaranteed, and it presents the assigned virtual IRQ number to the kernel when dispatching interrupts. (IRQs configured after PIC attachment are passed through immediately). This accomplishes the following things: 1. Parsing interrupt data is moved to the PIC driver, which is the only place it can be done safely. 2. There is no ordering requirement on PIC attachment vs. the attachment of anything else. 3. Changes are extremely minimal relative to the "standard" interrupt flow: you only have to patch code that is already directly dealing with OF interrupts. 4. It happens at bus enumeration time, when results can be guaranteed self-consistent. 5. It combines naturally with ofw_bus_lookup_imap() and friends in the interrupt-map case (e.g. for PCI). I'm not sure what the right path forward is, but this code needs to be fixed. The PowerPC code is fully MI, and was the template for the original INTRNG, so it shouldn't be too bad to replace. -Nathan From owner-svn-src-head@freebsd.org Tue Jul 19 15:26: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 65DC3B9D26B; Tue, 19 Jul 2016 15:26:39 +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 450191509; Tue, 19 Jul 2016 15:26:38 +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 u6JFQYDv012568 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 19 Jul 2016 08:26:35 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> From: Nathan Whitehorn Message-ID: <7a60092c-392c-abbe-c794-3c4c71e372f0@freebsd.org> Date: Tue, 19 Jul 2016 08:26:34 -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: <578E0B5D.3070105@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Sonic-CAuth: UmFuZG9tSVbe8T1JFYBikiFadjv2TeGa2CpyTv0mcA9kaHHU2g6r/Bqo94awLuv3tgHAoiGJTPUcqzCMpUMLqB1tbbE7MP+zi1UOaZKeT9Y= X-Sonic-ID: C;PrNtLcVN5hG2aptMTlz00w== M;Bu/DLcVN5hG2aptMTlz00w== 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: Tue, 19 Jul 2016 15:26:39 -0000 On 07/19/16 04:13, Michal Meloun wrote: > Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): > Hi Nathan, > I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so > please don’t expect quick response. > >> Could you please describe what this change is in more detail? > Short description is appended. > >> It breaks a lot of encapsulations we have worked very hard to maintain, >> moves ARM code into MI parts of the kernel, and the OFW parts violate >> IEEE 1275 (the Open Firmware standard). In particular, there is no >> guarantee that the interrupts for a newbus (or OF) device are encoded in >> a property called "interrupts" (or, indeed, in any property at all) on >> that node and there are many, many device trees where that is not the >> case (e.g. ones with interrupt maps, as well as Apple hardware). By >> putting that knowledge into the OF root bus device, which we have tried >> to keep it out of, this enforces a standard that doesn't actually exist. > Imho, this patch doesn’t change anything in this area. Only handling of > “interrupts” property is changed, all other cases are unchanged (I > hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. > >> I'm hesitant to ask for reversion on something that landed 6 weeks ago >> without me noticing, but this needs a lot more architectural work before >> any parts of the kernel should use it. >> -Nathan > I think that it’s too late. This patch series consist of r301451 > (https://reviews.freebsd.org/D6632), > r301453, r301539 and 301543. And new GPIO interrupts are currently used > (by in tree drivers or in development trees). > > [See other email for information for detail on why I am concerned about this code] Looking through those commits and the current state of HEAD, it turns out bus_map_intr() is not yet used anywhere in the tree; there is just a stub implementation in dev/ofw/ofwbus.c and a prototype that is never called in sys/bus.h. As such, I would in fact like to ask for the reversion of both r301451 and r301453 at this point, especially from the stable/11 branch. Adding a new API is something we can do to stable/11 at any point; removing one, or changing one, is something we cannot do. After that, I am more than happy to help move ARM code to use the existing dev/ofw scheme for handling interrupt metadata. -Nathan From owner-svn-src-head@freebsd.org Tue Jul 19 16:02: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 31BB5B9DBB4; Tue, 19 Jul 2016 16:02:09 +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 018FE1D4B; Tue, 19 Jul 2016 16:02:08 +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 u6JG28W3054189; Tue, 19 Jul 2016 16:02:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JG28c3054188; Tue, 19 Jul 2016 16:02:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607191602.u6JG28c3054188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 19 Jul 2016 16:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303026 - 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: Tue, 19 Jul 2016 16:02:09 -0000 Author: andrew Date: Tue Jul 19 16:02:07 2016 New Revision: 303026 URL: https://svnweb.freebsd.org/changeset/base/303026 Log: Add missing flags from acpidump. These are defined in the header, but not printed. The HW_REDUCED flag is useful as it should be set on arm64 to comply with the ARM Server Base Boot Requirements. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Jul 19 11:16:44 2016 (r303025) +++ head/usr.sbin/acpi/acpidump/acpi.c Tue Jul 19 16:02:07 2016 (r303026) @@ -1177,6 +1177,7 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->BootFlags, NO_VGA); PRINTFLAG(fadt->BootFlags, NO_MSI); PRINTFLAG(fadt->BootFlags, NO_ASPM); + PRINTFLAG(fadt->BootFlags, NO_CMOS_RTC); PRINTFLAG_END(); printf("\tFlags="); @@ -1200,6 +1201,8 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->Flags, REMOTE_POWER_ON); PRINTFLAG(fadt->Flags, APIC_CLUSTER); PRINTFLAG(fadt->Flags, APIC_PHYSICAL); + PRINTFLAG(fadt->Flags, HW_REDUCED); + PRINTFLAG(fadt->Flags, LOW_POWER_S0); PRINTFLAG_END(); #undef PRINTFLAG From owner-svn-src-head@freebsd.org Tue Jul 19 16:34: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 269BFB9E64B; Tue, 19 Jul 2016 16:34:51 +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 D75BD1F53; Tue, 19 Jul 2016 16:34:50 +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 u6JGYonu066020; Tue, 19 Jul 2016 16:34:50 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JGYnwN066019; Tue, 19 Jul 2016 16:34:49 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607191634.u6JGYnwN066019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 19 Jul 2016 16:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303028 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 16:34:51 -0000 Author: gjb Date: Tue Jul 19 16:34:49 2016 New Revision: 303028 URL: https://svnweb.freebsd.org/changeset/base/303028 Log: Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. Submitted by: des (a while back) Sponsored by: The FreeBSD Foundation Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Tue Jul 19 16:22:50 2016 (r303027) +++ head/share/misc/bsd-family-tree Tue Jul 19 16:34:49 2016 (r303028) @@ -339,7 +339,11 @@ FreeBSD 5.2 | | | FreeBSD | | OpenBSD 5.9 | | 10.3 | | | | | | | | | -FreeBSD 11 -current | NetBSD -current OpenBSD -current DragonFly -current + *--FreeBSD | | | | + | 11.0 | | | | + | | | | | + | | | | | +FreeBSD 12 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | v v v v v @@ -687,6 +691,8 @@ OpenBSD 5.8 2015-10-18 [OBD] DragonFly 4.4.1 2015-12-07 [DFB] OpenBSD 5.9 2016-03-29 [OBD] FreeBSD 10.3 2016-04-04 [FBD] +FreeBSD 11.0 2016-06-08 [FBD] +FreeBSD 12.0 2016-06-09 [FBD] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Tue Jul 19 16:42: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 2708EB9E860; Tue, 19 Jul 2016 16:42:07 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (mp2.macomnet.net [195.128.64.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 7BBD715E5; Tue, 19 Jul 2016 16:42:05 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.15.2/8.15.2) with ESMTP id u6JGg3Jq097093; Tue, 19 Jul 2016 19:42:03 +0300 (MSK) (envelope-from maxim.konovalov@gmail.com) Date: Tue, 19 Jul 2016 19:42:03 +0300 (MSK) From: Maxim Konovalov To: Glen Barber cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303028 - head/share/misc In-Reply-To: <201607191634.u6JGYnwN066019@repo.freebsd.org> Message-ID: References: <201607191634.u6JGYnwN066019@repo.freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 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: Tue, 19 Jul 2016 16:42:07 -0000 On Tue, 19 Jul 2016, 16:34-0000, Glen Barber wrote: > Author: gjb > Date: Tue Jul 19 16:34:49 2016 > New Revision: 303028 > URL: https://svnweb.freebsd.org/changeset/base/303028 > > Log: > Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. > > Submitted by: des (a while back) > Sponsored by: The FreeBSD Foundation > The file lists releases not branches. I don't think we have 11.0 or 12.0 released. -- Maxim Konovalov From owner-svn-src-head@freebsd.org Tue Jul 19 16:46: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 69A3FB9E905; Tue, 19 Jul 2016 16:46:22 +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 59E761830; Tue, 19 Jul 2016 16:46:22 +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 096961B0E; Tue, 19 Jul 2016 16:46:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Tue, 19 Jul 2016 16:46:21 +0000 From: Glen Barber To: Maxim Konovalov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303028 - head/share/misc Message-ID: <20160719164621.GK65494@FreeBSD.org> References: <201607191634.u6JGYnwN066019@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NPWyolIJAVLYbHY6" Content-Disposition: inline In-Reply-To: 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: Tue, 19 Jul 2016 16:46:22 -0000 --NPWyolIJAVLYbHY6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 19, 2016 at 07:42:03PM +0300, Maxim Konovalov wrote: > On Tue, 19 Jul 2016, 16:34-0000, Glen Barber wrote: >=20 > > Author: gjb > > Date: Tue Jul 19 16:34:49 2016 > > New Revision: 303028 > > URL: https://svnweb.freebsd.org/changeset/base/303028 > > > > Log: > > Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. > > > > Submitted by: des (a while back) > > Sponsored by: The FreeBSD Foundation > > > The file lists releases not branches. I don't think we have 11.0 or > 12.0 released. >=20 Honestly, I am not sure about anything in this file. :) There was an entry for 11-current though. Is the dated-part of the commit the problem, or is the entire change wrong? If the latter, I'll look at it again (or even revert it, and let someone who knows how this file is supposed to be updated handle it). Glen --NPWyolIJAVLYbHY6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXjlldAAoJEAMUWKVHj+KTgKwP/0G+3iopl1+WGN6iF39q+Yja Vplb0faB29y/WO9INxEQglznpaGzOfhv0t778tuPSeqHM8VcQXmEWCDhen6+cnnp QEDb1XhdcWoOyNHbmsvmsjmmmPKwqt3IAqj++YWAhh3+yV5kBND5rkR/RYQV8C0k YI9utqrK+4etQ/d2BSY0vrBJbBomAmq6PI/6YrK7TqEpKfhQnkOjOSUqJW6fAokI Tda/q/+OHEJh6BwGl5laHv36Wg/qHfZSFvroiRHk1YC8rDtieSWGAZT6fiZXpafX ieEizbLadAU0vkoL6DUfqC9QlUHxFg+OXkzBH90tHAFXH95fVpXlWEr5jgRH1pLv ABvYah9K/pKMGWluzRIOCMDf0Tx/gsfb0z0Z5zy5lAHcDjFF2SiZ07nLfF6YkFy4 G37JozK3e1HdzwN48ngM+uNsXrgt/SPniukll3crIBsa4Mw2tugRQQH2C/RCy1T4 gzvczxnPZ6VSKMtSeqmWQGC96UBg7CP4K25JfmHtaZlMpVs2fJf/PMQ+kQNgg1l2 rMLghoMoeDtqOFDZMymZCAgZ+eRLSgmXygLg7yMaKYJ2QpEJfHC0fys9ms2c/3Mo QwL1DvnnwFJIkskSJ+QZoxltu7NHMuMJiN6yStweLmZwDr701460cp4Wb6elF5o/ UGKVIkqvh/LtkPUsxmFW =+wbe -----END PGP SIGNATURE----- --NPWyolIJAVLYbHY6-- From owner-svn-src-head@freebsd.org Tue Jul 19 16:51: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 7026CB9EABE; Tue, 19 Jul 2016 16:51:37 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (mp2.macomnet.net [195.128.64.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 EFC141D03; Tue, 19 Jul 2016 16:51:36 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.15.2/8.15.2) with ESMTP id u6JGpY6X097196; Tue, 19 Jul 2016 19:51:34 +0300 (MSK) (envelope-from maxim.konovalov@gmail.com) Date: Tue, 19 Jul 2016 19:51:34 +0300 (MSK) From: Maxim Konovalov To: Glen Barber cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303028 - head/share/misc In-Reply-To: <20160719164621.GK65494@FreeBSD.org> Message-ID: References: <201607191634.u6JGYnwN066019@repo.freebsd.org> <20160719164621.GK65494@FreeBSD.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 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: Tue, 19 Jul 2016 16:51:37 -0000 On Tue, 19 Jul 2016, 16:46-0000, Glen Barber wrote: > On Tue, Jul 19, 2016 at 07:42:03PM +0300, Maxim Konovalov wrote: > > On Tue, 19 Jul 2016, 16:34-0000, Glen Barber wrote: > > > > > Author: gjb > > > Date: Tue Jul 19 16:34:49 2016 > > > New Revision: 303028 > > > URL: https://svnweb.freebsd.org/changeset/base/303028 > > > > > > Log: > > > Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. > > > > > > Submitted by: des (a while back) > > > Sponsored by: The FreeBSD Foundation > > > > > The file lists releases not branches. I don't think we have 11.0 or > > 12.0 released. > > > > Honestly, I am not sure about anything in this file. :) > > There was an entry for 11-current though. Is the dated-part of the > commit the problem, or is the entire change wrong? If the latter, I'll > look at it again (or even revert it, and let someone who knows how this > file is supposed to be updated handle it). > Just dates are incorrect. -- Maxim Konovalov From owner-svn-src-head@freebsd.org Tue Jul 19 16:54: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 888B8B9EBD5; Tue, 19 Jul 2016 16:54:07 +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 75E071F5B; Tue, 19 Jul 2016 16:54:07 +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 241571F5D; Tue, 19 Jul 2016 16:54:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Tue, 19 Jul 2016 16:54:06 +0000 From: Glen Barber To: Maxim Konovalov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303028 - head/share/misc Message-ID: <20160719165406.GL65494@FreeBSD.org> References: <201607191634.u6JGYnwN066019@repo.freebsd.org> <20160719164621.GK65494@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c8UbHMnQwI7BF+TB" Content-Disposition: inline In-Reply-To: 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: Tue, 19 Jul 2016 16:54:07 -0000 --c8UbHMnQwI7BF+TB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 19, 2016 at 07:51:34PM +0300, Maxim Konovalov wrote: > On Tue, 19 Jul 2016, 16:46-0000, Glen Barber wrote: >=20 > > On Tue, Jul 19, 2016 at 07:42:03PM +0300, Maxim Konovalov wrote: > > > On Tue, 19 Jul 2016, 16:34-0000, Glen Barber wrote: > > > > > > > Author: gjb > > > > Date: Tue Jul 19 16:34:49 2016 > > > > New Revision: 303028 > > > > URL: https://svnweb.freebsd.org/changeset/base/303028 > > > > > > > > Log: > > > > Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. > > > > > > > > Submitted by: des (a while back) > > > > Sponsored by: The FreeBSD Foundation > > > > > > > The file lists releases not branches. I don't think we have 11.0 or > > > 12.0 released. > > > > > > > Honestly, I am not sure about anything in this file. :) > > > > There was an entry for 11-current though. Is the dated-part of the > > commit the problem, or is the entire change wrong? If the latter, I'll > > look at it again (or even revert it, and let someone who knows how this > > file is supposed to be updated handle it). > > > Just dates are incorrect. >=20 Ok, I'll remove them now. Thank you for reporting this. Glen --c8UbHMnQwI7BF+TB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXjlsuAAoJEAMUWKVHj+KTfhQP/2FBdfbPfelJ7kOnTTnikBi3 /MuCe02ZyiqKs3QXZra5VZByCkrMXt9zbI5GbU/gcOoIHhjyLP39xUHApwwdx7Yw Zs8Gl3ltOFK3zQl5NWAykx0a2H6wSPS+3zZvPoAJx5UQ/iYvc5vQvoOkUBRwnqdc tg3g3Kf70j0htexxTq34eR6rEqbULnYzOXeIVvympEliEov4i2fPGwOeqdkuF68H WGcJGhLN+cLVj07Q6vueOIGjLyDCboVjrYfhKLiY5kuJDQK9bFcobEhzmWPmE4+F eiCNzLFS/T72Pt8UuKzapBzNCHcciNoTFgqc/SDwjyE2Fq4Z8LxVPH9VdNL58qpA OBJkpHBdDrrv/4Pado5IBtBZNqL8pIE+QGnXpuUTO+7q75cvtrr6tC5bOa6Akn0v NSTZlEOFk9XFGBYHc+me/rrtUvhHpAumoFztJjvpX+bO1hSmJyHziN1+XsAi4ocz ALXjUOC6BXL43JCP5IRtC0cwiI6de+eV7uVVtPwJ9ycAwdmXVENMdXUDvVpO/ZDX JEV/HtEEerYY+6K5zcp7ZapZGiFRNWoQ+MA95n/X9/Pr9z/UrzYMI0XlPTg4bk1L Q6RicLPJmy793sWXWhrKa+bf6gryu9kz92xcuw7gw41QyYPpeUHJCnrNDDMFW7Ox pVF2qAvBwr8z3R7Y6+mq =xkTH -----END PGP SIGNATURE----- --c8UbHMnQwI7BF+TB-- From owner-svn-src-head@freebsd.org Tue Jul 19 16:55: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 F0C63B9EC39; Tue, 19 Jul 2016 16:55:17 +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 BEA861246; Tue, 19 Jul 2016 16:55:17 +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 u6JGtGe6073751; Tue, 19 Jul 2016 16:55:16 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JGtGaO073750; Tue, 19 Jul 2016 16:55:16 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607191655.u6JGtGaO073750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 19 Jul 2016 16:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303030 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 16:55:18 -0000 Author: gjb Date: Tue Jul 19 16:55:16 2016 New Revision: 303030 URL: https://svnweb.freebsd.org/changeset/base/303030 Log: Fix the previous commit to the family tree file. It is too early to list 11.0, and we do not list -CURRENT here. Submitted by: maxim Sponsored by: The FreeBSD Foundation Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Tue Jul 19 16:46:27 2016 (r303029) +++ head/share/misc/bsd-family-tree Tue Jul 19 16:55:16 2016 (r303030) @@ -691,8 +691,6 @@ OpenBSD 5.8 2015-10-18 [OBD] DragonFly 4.4.1 2015-12-07 [DFB] OpenBSD 5.9 2016-03-29 [OBD] FreeBSD 10.3 2016-04-04 [FBD] -FreeBSD 11.0 2016-06-08 [FBD] -FreeBSD 12.0 2016-06-09 [FBD] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Tue Jul 19 17:15: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 59F7EB9E371; Tue, 19 Jul 2016 17:15:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 236CF1168; Tue, 19 Jul 2016 17:15:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JHF8sP080998; Tue, 19 Jul 2016 17:15:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JHF8jw080997; Tue, 19 Jul 2016 17:15:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191715.u6JHF8jw080997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 17:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303031 - head/contrib/llvm/tools/clang/lib/Driver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 17:15:09 -0000 Author: emaste Date: Tue Jul 19 17:15:07 2016 New Revision: 303031 URL: https://svnweb.freebsd.org/changeset/base/303031 Log: clang++: Always use --eh-frame-hdr on FreeBSD, even for -static FreeBSD uses LLVM's libunwind on FreeBSD/arm64 today (and we expect to use it more widely in the future) and it requires the EH frame segment in static binaries. Reviewed by: dim Obtained from: Clang commit r266123 MFC after: 3 days Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7250 Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Tue Jul 19 16:55:16 2016 (r303030) +++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Tue Jul 19 17:15:07 2016 (r303031) @@ -7922,12 +7922,12 @@ void freebsd::Linker::ConstructJob(Compi if (IsPIE) CmdArgs.push_back("-pie"); + CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_static)) { CmdArgs.push_back("-Bstatic"); } else { if (Args.hasArg(options::OPT_rdynamic)) CmdArgs.push_back("-export-dynamic"); - CmdArgs.push_back("--eh-frame-hdr"); if (Args.hasArg(options::OPT_shared)) { CmdArgs.push_back("-Bshareable"); } else { From owner-svn-src-head@freebsd.org Tue Jul 19 17:31: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 669EDB9E9A8; Tue, 19 Jul 2016 17:31:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3290D1A99; Tue, 19 Jul 2016 17:31:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JHVmLZ085825; Tue, 19 Jul 2016 17:31:48 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JHVmew085824; Tue, 19 Jul 2016 17:31:48 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201607191731.u6JHVmew085824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 19 Jul 2016 17:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303032 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 17:31:49 -0000 Author: sbruno Date: Tue Jul 19 17:31:48 2016 New Revision: 303032 URL: https://svnweb.freebsd.org/changeset/base/303032 Log: Fixup DA cable detection routines to not set the cable type to unknown if they do not match one of two cable types. PR: 150249 Submitted by: borjam@sarenet.es Reviewed by: erj MFC after: 3 days Modified: head/sys/dev/ixgbe/ixgbe_phy.c Modified: head/sys/dev/ixgbe/ixgbe_phy.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_phy.c Tue Jul 19 17:15:07 2016 (r303031) +++ head/sys/dev/ixgbe/ixgbe_phy.c Tue Jul 19 17:31:48 2016 (r303032) @@ -1534,21 +1534,18 @@ s32 ixgbe_identify_sfp_module_generic(st hw->phy.type = ixgbe_phy_sfp_intel; break; default: - if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) - hw->phy.type = - ixgbe_phy_sfp_passive_unknown; - else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) - hw->phy.type = - ixgbe_phy_sfp_active_unknown; - else - hw->phy.type = ixgbe_phy_sfp_unknown; + hw->phy.type = ixgbe_phy_sfp_unknown; break; } } /* Allow any DA cable vendor */ if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE | - IXGBE_SFF_DA_ACTIVE_CABLE)) { + IXGBE_SFF_DA_ACTIVE_CABLE)) { + if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) + hw->phy.type = ixgbe_phy_sfp_passive_unknown; + else if (cable_tech & IXGBE_SFF_DA_ACTIVE_CABLE) + hw->phy.type = ixgbe_phy_sfp_active_unknown; status = IXGBE_SUCCESS; goto out; } From owner-svn-src-head@freebsd.org Tue Jul 19 17:46: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 433E3B9EC05; Tue, 19 Jul 2016 17:46:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F00321313; Tue, 19 Jul 2016 17:46:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JHkASY092272; Tue, 19 Jul 2016 17:46:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JHk9ov092270; Tue, 19 Jul 2016 17:46:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191746.u6JHk9ov092270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 17:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303033 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 17:46:11 -0000 Author: emaste Date: Tue Jul 19 17:46:09 2016 New Revision: 303033 URL: https://svnweb.freebsd.org/changeset/base/303033 Log: add an arch.7 man page with architecture-specific details Based on details collected on the wiki, at https://wiki.freebsd.org/EdMaste/ArchitectureSpecifics Further details to be added over time. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7096 Added: head/share/man/man7/arch.7 (contents, props changed) Modified: head/share/man/man7/Makefile Modified: head/share/man/man7/Makefile ============================================================================== --- head/share/man/man7/Makefile Tue Jul 19 17:31:48 2016 (r303032) +++ head/share/man/man7/Makefile Tue Jul 19 17:46:09 2016 (r303033) @@ -7,6 +7,7 @@ PACKAGE=runtime-manuals #MISSING: eqnchar.7 ms.7 term.7 MAN= adding_user.7 \ + arch.7 \ ascii.7 \ bsd.snmpmod.mk.7 \ build.7 \ Added: head/share/man/man7/arch.7 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man7/arch.7 Tue Jul 19 17:46:09 2016 (r303033) @@ -0,0 +1,171 @@ +.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. +.\" +.\" This documentation was created by Ed Maste under sponsorship of +.\" The FreeBSD Foundation. +.\" +.\" 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 COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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 19, 2016 +.Dt ARCH 7 +.Os +.Sh NAME +.Nm arch +.Nd Architecture-specific details +.Sh DESCRIPTION +Differences between CPU architectures and platforms supported by +.Fx . +.Pp +.Ss Type sizes +On all supported architectures, +.Bl -column -offset -indent "long long" "Size" +.It Sy Type Ta Sy Size +.It short Ta 2 +.It int Ta 4 +.It long Ta sizeof(void*) +.It long long Ta 8 +.It float Ta 4 +.It double Ta 8 +.El +.Bl -column -offset indent ".Sy Architecture" ".Sy sizeof(void *)" ".Sy "sizeof(long double)" +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) +.It amd64 Ta 8 Ta 16 +.It arm Ta 4 Ta 8 +.It armeb Ta 4 Ta 8 +.It armv6 Ta 4 Ta 8 +.It arm64 Ta 8 Ta 16 +.It i386 Ta 4 Ta 12 +.It mips Ta 4 Ta 8 +.It mipsel Ta 4 Ta 8 +.It mipsn32 Ta 4 Ta 8 +.It mips64 Ta 8 Ta 8 +.It mips64el Ta 8 Ta 8 +.It powerpc Ta 4 Ta 8 +.It powerpc64 Ta 8 Ta 8 +.It riscv Ta 8 Ta +.It sparc64 Ta 8 Ta 16 +.El +.Ss Endianness and Char Signedness +.Bl -column -offset indent ".Sy Architecture" ".Sy Endianness" ".Sy "char Signedness" +.It Sy Architecture Ta Sy Endianness Ta Sy char Signedness +.It amd64 Ta little Ta signed +.It arm Ta little Ta unsigned +.It armeb Ta big Ta unsigned +.It armv6 Ta little Ta unsigned +.It arm64 Ta little Ta unsigned +.It i386 Ta little Ta signed +.It mips Ta little Ta signed +.It mipsel Ta big Ta signed +.It mipsn32 Ta little Ta signed +.It mips64 Ta little Ta signed +.It mips64el Ta little Ta signed +.It powerpc Ta big Ta unsigned +.It powerpc64 Ta big Ta unsigned +.It riscv Ta little Ta signed +.It sparc64 Ta big Ta signed +.El +.Ss Page Size +.Bl -column -offset indent ".Sy Architecture" ".Sy Page Sizes" +.It Sy Architecture Ta Sy Page Sizes +.It amd64 Ta 4K, 2M, 1G +.It arm Ta 4K +.It armeb Ta 4K +.It armv6 Ta 4K +.It arm64 Ta 4K, 2M, 1G +.It i386 Ta 4K, 2M (PAE), 4M +.It mips Ta 4K +.It mipsel Ta 4K +.It mipsn32 Ta 4K +.It mips64 Ta 4K +.It mips64el Ta 4K +.It powerpc Ta 4K +.It powerpc64 Ta 4K +.It riscv Ta 4K +.It sparc64 Ta 8K +.El +.Ss Floating Point +.Bl -column -offset indent ".Sy Architecture" ".Sy float, double" ".Sy long double" +.It Sy Architecture Ta Sy float, double Ta Sy long double +.It amd64 Ta hard Ta hard, 80 bit +.It arm Ta soft Ta soft, double precision +.It armeb Ta soft Ta soft, double precision +.It armv6 Ta hard Ta hard, double precision +.It arm64 Ta hard Ta soft, quad precision +.It i386 Ta hard Ta hard, 80 bit +.It mips Ta soft Ta identical to double +.It mipsel Ta soft Ta identical to double +.It mipsn32 Ta soft Ta identical to double +.It mips64 Ta soft Ta identical to double +.It mips64el Ta soft Ta identical to double +.It powerpc Ta hard Ta hard, double precision +.It powerpc64 Ta hard Ta hard, double precision +.It riscv Ta +.It sparc64 Ta hard Ta hard, quad precision +.El +.Ss Predefined Macros +The compiler provides a number of predefined macros. +Some of these provide architecture-specific details and are explained below. +Other macros, including those required by the language standard, are not +included here. +.Pp +The full set of predefined macros can be obtained with this command: +.Bd -literal -offset indent +cc -x c -Dm -E /dev/null +.Ed +.Pp +Common type size and endianness macros: +.Bl -column -offset indent "BYTE_ORDER" ".Sy Meaning" +.It Sy Macro Ta Sy Meaning +.It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int +.It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . +.Dv PDP11_ENDIAN is not used on FreeBSD. +.El +.Pp +Architecture-specific macros: +.Bl -column -offset indent ".Sy Architecture" ".Sy Predefined macros" +.It Sy Architecture Ta Sy Predefined macros +.It amd64 Ta Dv __amd64__, Dv __x86_64__ +.It arm Ta Dv __arm__ +.It armeb Ta Dv __arm__ +.It armv6 Ta Dv __arm__, Dv __ARM_ARCH >= 6 +.It arm64 Ta Dv __aarch64__ +.It i386 Ta Dv __i386__ +.It mips Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32 +.It mipsel Ta Dv __mips__, Dv __mips_o32 +.It mipsn32 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n32 +.It mips64 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64 +.It mips64el Ta Dv __mips__, Dv __mips_n64 +.It powerpc Ta Dv __powerpc__ +.It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ +.It riscv Ta Dv __riscv__, Dv __riscv64 +.It sparc64 Ta Dv __sparc64__ +.El +.Sh SEE ALSO +.Xr src.conf 5 , +.Xr build 7 +.Sh HISTORY +An +.Nm +manual page appeared in +.Fx 12 . From owner-svn-src-head@freebsd.org Tue Jul 19 18:05: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 3381EB9EF17; Tue, 19 Jul 2016 18:05:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3CDC1C86; Tue, 19 Jul 2016 18:05:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JI5QQO099588; Tue, 19 Jul 2016 18:05:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JI5Q0V099587; Tue, 19 Jul 2016 18:05:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191805.u6JI5Q0V099587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 18:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303034 - 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, 19 Jul 2016 18:05:27 -0000 Author: emaste Date: Tue Jul 19 18:05:25 2016 New Revision: 303034 URL: https://svnweb.freebsd.org/changeset/base/303034 Log: Include makewhatis in ITOOLS when MK_MAN_UTILS is true Previously it was conditional on MK_MAN. It's possible to build FreeBSD with man pages but without man page tools. MK_MAN_UTILS is the conditional used in share/man/Makefile for determining whether makewhatis is executed at install time, so it is the proper one for ITOOLS as well. PR: 210142 MFC after: 1 week Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Jul 19 17:46:09 2016 (r303033) +++ head/Makefile.inc1 Tue Jul 19 18:05:25 2016 (r303034) @@ -884,7 +884,7 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod ${LOCAL_ITOOLS} # Needed for share/man -.if ${MK_MAN} != "no" +.if ${MK_MAN_UTILS} != "no" ITOOLS+=makewhatis .endif From owner-svn-src-head@freebsd.org Tue Jul 19 18:07: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 C1B76B9EFFB; Tue, 19 Jul 2016 18:07:48 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7ECE41E3B; Tue, 19 Jul 2016 18:07:48 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JI7lsV099758; Tue, 19 Jul 2016 18:07:47 GMT (envelope-from markm@FreeBSD.org) Received: (from markm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JI7lAq099753; Tue, 19 Jul 2016 18:07:47 GMT (envelope-from markm@FreeBSD.org) Message-Id: <201607191807.u6JI7lAq099753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markm set sender to markm@FreeBSD.org using -f From: Mark Murray Date: Tue, 19 Jul 2016 18:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303035 - in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm 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, 19 Jul 2016 18:07:48 -0000 Author: markm Date: Tue Jul 19 18:07:47 2016 New Revision: 303035 URL: https://svnweb.freebsd.org/changeset/base/303035 Log: Random bit generator (RBG) driver for RPi and RPi2. Summary: This driver supports the following methods to trigger gathering random bits from the hardware: 1. interrupt when the FIFO is full (default) fed into the harvest queue 2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if hz is less than 100, otherwise hz / 100, feeding the random bits into the harvest queue If the kernel is booted with verbose enabled, the contents of the registers will be dumped after the RBG is started during the attach routine. Author: hackagadget_gmail.com (Stephen J. Kiernan) Test Plan: Built RPI2 kernel and booted on board. Tested the different methods to feed the harvest queue (callout, interrupt) and the interrupt driven approach seems best. However, keeping the other method for people to be able to experiment with. Reviewed By: adrian, delphij, markm Differential Revision: https://reviews.freebsd.org/D6888 Added: head/sys/arm/broadcom/bcm2835/bcm2835_rng.c (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x head/sys/boot/fdt/dts/arm/bcm2835.dtsi head/sys/boot/fdt/dts/arm/bcm2836.dtsi head/sys/sys/random.h Added: head/sys/arm/broadcom/bcm2835/bcm2835_rng.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_rng.c Tue Jul 19 18:07:47 2016 (r303035) @@ -0,0 +1,534 @@ +/* + * Copyright (c) 2015, 2016, Stephen J. Kiernan + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#if !defined(BCM2835_RNG_USE_CALLOUT) +#define BCM2835_RNG_USE_INTERRUPT +#endif + +static device_attach_t bcm2835_rng_attach; +static device_detach_t bcm2835_rng_detach; +static device_probe_t bcm2835_rng_probe; + +#define RNG_CTRL 0x00 /* RNG Control Register */ +#define RNG_COMBLK1_OSC 0x003f0000 /* Combiner Blk 1 Oscillator */ +#define RNG_COMBLK1_OSC_SHIFT 16 +#define RNG_COMBLK2_OSC 0x0fc00000 /* Combiner Blk 2 Oscillator */ +#define RNG_COMBLK2_OSC_SHIFT 22 +#define RNG_JCLK_BYP_DIV_CNT 0x0000ff00 /* Jitter clk bypass divider + count */ +#define RNG_JCLK_BYP_DIV_CNT_SHIFT 8 +#define RNG_JCLK_BYP_SRC 0x00000020 /* Jitter clk bypass source */ +#define RNG_JCLK_BYP_SEL 0x00000010 /* Jitter clk bypass select */ +#define RNG_RBG2X 0x00000002 /* RBG 2X SPEED */ +#define RNG_RBGEN_BIT 0x00000001 /* Enable RNG bit */ + +#define RNG_STATUS 0x04 /* RNG status register */ +#define RND_VAL_SHIFT 24 /* Shift for valid words */ +#define RND_VAL_MASK 0x000000ff /* Number valid words mask */ +#define RND_VAL_WARM_CNT 0x40000 /* RNG Warm Up count */ +#define RND_WARM_CNT 0xfffff /* RNG Warm Up Count mask */ + +#define RNG_DATA 0x08 /* RNG Data Register */ +#define RNG_FF_THRES 0x0c +#define RNG_FF_THRES_MASK 0x0000001f + +#define RNG_INT_MASK 0x10 +#define RNG_INT_OFF_BIT 0x00000001 + +#define RNG_FF_DEFAULT 0x10 /* FIFO threshold default */ + +#define RNG_FIFO_WORDS (RNG_FF_DEFAULT / sizeof(uint32_t)) + +#define RNG_NUM_OSCILLATORS 6 +#define RNG_STALL_COUNT_DEFAULT 10 + +struct bcm2835_rng_softc { + device_t sc_dev; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + void * sc_intr_hdl; +#if defined(BCM2835_RNG_USE_CALLOUT) || defined(BCM2835_RNG_USE_INTERRUPT) + uint32_t sc_buf[RNG_FIFO_WORDS]; +#endif +#if defined(BCM2835_RNG_USE_CALLOUT) + struct callout sc_rngto; + int sc_rnghz; +#endif + int sc_stall_count; + int sc_rbg2x; + long sc_underrun; +}; + +static __inline void +bcm2835_rng_stat_inc_underrun(struct bcm2835_rng_softc *sc) +{ + + atomic_add_long(&sc->sc_underrun, 1); +} + +static __inline uint32_t +bcm2835_rng_read4(struct bcm2835_rng_softc *sc, bus_size_t off) +{ + + return bus_read_4(sc->sc_mem_res, off); +} + +static __inline void +bcm2835_rng_read_multi4(struct bcm2835_rng_softc *sc, bus_size_t off, + uint32_t *datap, bus_size_t count) +{ + + bus_read_multi_4(sc->sc_mem_res, off, datap, count); +} + +static __inline void +bcm2835_rng_write4(struct bcm2835_rng_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->sc_mem_res, off, val); +} + +static void +bcm2835_rng_dump_registers(struct bcm2835_rng_softc *sc, struct sbuf *sbp) +{ + uint32_t comblk2_osc, comblk1_osc, jclk_byp_div, val; + int i; + + /* Display RNG control register contents */ + val = bcm2835_rng_read4(sc, RNG_CTRL); + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); + + comblk2_osc = (val & RNG_COMBLK2_OSC) >> RNG_COMBLK2_OSC_SHIFT; + sbuf_printf(sbp, " RNG_COMBLK2_OSC (%02x)\n", comblk2_osc); + for (i = 0; i < RNG_NUM_OSCILLATORS; i++) + if ((comblk2_osc & (1 << i)) == 0) + sbuf_printf(sbp, " Oscillator %d enabled\n", i + 1); + + comblk1_osc = (val & RNG_COMBLK1_OSC) >> RNG_COMBLK1_OSC_SHIFT; + sbuf_printf(sbp, " RNG_COMBLK1_OSC (%02x)\n", comblk1_osc); + for (i = 0; i < RNG_NUM_OSCILLATORS; i++) + if ((comblk1_osc & (1 << i)) == 0) + sbuf_printf(sbp, " Oscillator %d enabled\n", i + 1); + + jclk_byp_div = (val & RNG_JCLK_BYP_DIV_CNT) >> + RNG_JCLK_BYP_DIV_CNT_SHIFT; + sbuf_printf(sbp, + " RNG_JCLK_BYP_DIV_CNT (%02x)\n APB clock frequency / %d\n", + jclk_byp_div, 2 * (jclk_byp_div + 1)); + + sbuf_printf(sbp, " RNG_JCLK_BYP_SRC:\n %s\n", + (val & RNG_JCLK_BYP_SRC) ? "Use divided down APB clock" : + "Use RNG clock (APB clock)"); + + sbuf_printf(sbp, " RNG_JCLK_BYP_SEL:\n %s\n", + (val & RNG_JCLK_BYP_SEL) ? "Bypass internal jitter clock" : + "Use internal jitter clock"); + + if ((val & RNG_RBG2X) != 0) + sbuf_cat(sbp, " RNG_RBG2X: RNG 2X SPEED enabled\n"); + + if ((val & RNG_RBGEN_BIT) != 0) + sbuf_cat(sbp, " RNG_RBGEN_BIT: RBG enabled\n"); + + /* Display RNG status register contents */ + val = bcm2835_rng_read4(sc, RNG_STATUS); + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); + sbuf_printf(sbp, " RND_VAL: %02x\n", + (val >> RND_VAL_SHIFT) & RND_VAL_MASK); + sbuf_printf(sbp, " RND_WARM_CNT: %05x\n", val & RND_WARM_CNT); + + /* Display FIFO threshold register contents */ + val = bcm2835_rng_read4(sc, RNG_FF_THRES); + sbuf_printf(sbp, "RNG_FF_THRES: %05x\n", val & RNG_FF_THRES_MASK); + + /* Display interrupt mask register contents */ + val = bcm2835_rng_read4(sc, RNG_INT_MASK); + sbuf_printf(sbp, "RNG_INT_MASK: interrupt %s\n", + ((val & RNG_INT_OFF_BIT) != 0) ? "disabled" : "enabled"); +} + +static void +bcm2835_rng_disable_intr(struct bcm2835_rng_softc *sc) +{ + uint32_t mask; + + /* Set the interrupt off bit in the interrupt mask register */ + mask = bcm2835_rng_read4(sc, RNG_INT_MASK); + mask |= RNG_INT_OFF_BIT; + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); +} + +#if defined(BCM2835_RNG_USE_INTERRUPT) +static void +bcm2835_rng_enable_intr(struct bcm2835_rng_softc *sc) +{ + uint32_t mask; + + /* Clear the interrupt off bit in the interrupt mask register */ + mask = bcm2835_rng_read4(sc, RNG_INT_MASK); + mask &= ~RNG_INT_OFF_BIT; + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); +} +#endif + +static void +bcm2835_rng_start(struct bcm2835_rng_softc *sc) +{ + uint32_t ctrl; + + /* Disable the interrupt */ + bcm2835_rng_disable_intr(sc); + + /* Set the warmup count */ + bcm2835_rng_write4(sc, RNG_STATUS, RND_VAL_WARM_CNT); + + /* Enable the RNG */ + ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl |= RNG_RBGEN_BIT; + if (sc->sc_rbg2x) + ctrl |= RNG_RBG2X; + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Enable the interrupt */ + bcm2835_rng_enable_intr(sc); +#endif +} + +static void +bcm2835_rng_stop(struct bcm2835_rng_softc *sc) +{ + uint32_t ctrl; + + /* Disable the RNG */ + ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl &= ~RNG_RBGEN_BIT; + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); +} + +static void +bcm2835_rng_harvest(struct bcm2835_rng_softc *sc) +{ + uint32_t *dest; + uint32_t status; + u_int cnt, nread, num_avail, num_words; + int seen_underrun, num_stalls; + + dest = sc->sc_buf; + nread = num_words = 0; + seen_underrun = num_stalls = 0; + for (cnt = sizeof(sc->sc_buf) / sizeof(uint32_t); cnt > 0; + cnt -= num_words) { + /* Read status register to find out how many words available */ + status = bcm2835_rng_read4(sc, RNG_STATUS); + num_avail = (status >> RND_VAL_SHIFT) & RND_VAL_MASK; + + /* If we have none... */ + if (num_avail == 0) { + bcm2835_rng_stat_inc_underrun(sc); + if (++seen_underrun >= sc->sc_stall_count) { + if (num_stalls++ > 0) { + device_printf(sc->sc_dev, + "RNG stalled, disabling device\n"); + bcm2835_rng_stop(sc); + break; + } else { + device_printf(sc->sc_dev, + "Too many underruns, resetting\n"); + bcm2835_rng_stop(sc); + bcm2835_rng_start(sc); + seen_underrun = 0; + } + } + /* Try again */ + continue; + } + + CTR2(KTR_DEV, "%s: %d words available in RNG FIFO", + device_get_nameunit(sc->sc_dev), num_avail); + + /* Pull MIN(num_avail, cnt) words from the FIFO */ + num_words = (num_avail > cnt) ? cnt : num_avail; + bcm2835_rng_read_multi4(sc, RNG_DATA, dest, + num_words); + dest += num_words; + nread += num_words; + } + + cnt = nread * sizeof(uint32_t); + if (cnt > 0) + random_harvest_queue(sc->sc_buf, cnt, cnt * NBBY / 2, + RANDOM_PURE_BROADCOM); + +#if defined(BCM2835_RNG_USE_CALLOUT) + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); +#endif +} + +static int +sysctl_bcm2835_rng_2xspeed(SYSCTL_HANDLER_ARGS) +{ + struct bcm2835_rng_softc *sc = arg1; + int error, rbg2x; + + rbg2x = sc->sc_rbg2x; + error = sysctl_handle_int(oidp, &rbg2x, 0, req); + if (error) + return (error); + if (req->newptr == NULL) + return (error); + if (rbg2x == sc->sc_rbg2x) + return (0); + + /* Reset the RNG */ + bcm2835_rng_stop(sc); + sc->sc_rbg2x = rbg2x; + bcm2835_rng_start(sc); + + return (0); +} + +#ifdef BCM2835_RNG_DEBUG_REGISTERS +static int +sysctl_bcm2835_rng_dump(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sb; + struct bcm2835_rng_softc *sc = arg1; + int error; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sbuf_new_for_sysctl(&sb, NULL, 128, req); + bcm2835_rng_dump_registers(sc, &sb); + error = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error); +} +#endif + +static int +bcm2835_rng_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-rng")) + return (ENXIO); + + device_set_desc(dev, "Broadcom BCM2835 RNG"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm2835_rng_attach(device_t dev) +{ + struct bcm2835_rng_softc *sc; + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + int error, rid; + + error = 0; + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_stall_count = RNG_STALL_COUNT_DEFAULT; +#ifdef BCM2835_RNG_USE_CALLOUT + /* Initialize callout */ + callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); +#endif + TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); + TUNABLE_INT_FETCH("bcmrng.stall_count", &sc->sc_stall_count); + + /* Allocate memory resources */ + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + bcm2835_rng_detach(dev); + return (ENXIO); + } + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Allocate interrupt resource */ + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + bcm2835_rng_detach(dev); + return (ENXIO); + } + + /* Set up the interrupt handler */ + error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)bcm2835_rng_harvest, sc, &sc->sc_intr_hdl); + if (error) { + device_printf(dev, "Failed to set up IRQ\n"); + sc->sc_intr_hdl = NULL; + bcm2835_rng_detach(dev); + return (error); + } +#endif + + /* Start the RNG */ + bcm2835_rng_start(sc); + + /* Dump the registers if booting verbose */ + if (bootverbose) { + struct sbuf sb; + + (void) sbuf_new(&sb, NULL, 256, + SBUF_AUTOEXTEND | SBUF_INCLUDENUL); + bcm2835_rng_dump_registers(sc, &sb); + sbuf_trim(&sb); + error = sbuf_finish(&sb); + if (error == 0) + device_printf(dev, "%s", sbuf_data(&sb)); + sbuf_delete(&sb); + } + + sysctl_ctx = device_get_sysctl_ctx(dev); + sysctl_tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_LONG(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "underrun", CTLFLAG_RD, &sc->sc_underrun, + "Number of FIFO underruns"); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "2xspeed", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + sysctl_bcm2835_rng_2xspeed, "I", "Enable RBG 2X SPEED"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "stall_count", CTLFLAG_RW, &sc->sc_stall_count, + RNG_STALL_COUNT_DEFAULT, "Number of underruns to assume RNG stall"); +#ifdef BCM2835_RNG_DEBUG_REGISTERS + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "dumpregs", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, + sysctl_bcm2835_rng_dump, "S", "Dump RNG registers"); +#endif + +#if defined(BCM2835_RNG_USE_CALLOUT) + /* Reset callout */ + if (hz >= 100) + sc->sc_rnghz = hz / 100; + else + sc->sc_rnghz = 1; + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); +#endif + + return (0); +} + +static int +bcm2835_rng_detach(device_t dev) +{ + struct bcm2835_rng_softc *sc; +#if defined(BCM2835_RNG_USE_INTERRUPT) + int error; +#endif + + sc = device_get_softc(dev); + + /* Stop the RNG */ + bcm2835_rng_stop(sc); + + /* Drain the callout it */ +#if defined(BCM2835_RNG_USE_CALLOUT) + callout_drain(&sc->sc_rngto); +#endif + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Tear down the interrupt */ + if (sc->sc_irq_res && sc->sc_intr_hdl) { + error = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl); + if (error != 0) { + device_printf(dev, "could not tear down IRQ\n"); + return (error); + } + sc->sc_intr_hdl = NULL; + } + + /* Release interrupt resource */ + if (sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + sc->sc_irq_res = NULL; + } +#endif + + /* Release memory resource */ + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static device_method_t bcm2835_rng_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm2835_rng_probe), + DEVMETHOD(device_attach, bcm2835_rng_attach), + DEVMETHOD(device_detach, bcm2835_rng_detach), + + DEVMETHOD_END +}; + +static driver_t bcm2835_rng_driver = { + "bcmrng", + bcm2835_rng_methods, + sizeof(struct bcm2835_rng_softc) +}; +static devclass_t bcm2835_rng_devclass; + +DRIVER_MODULE(bcm2835_rng, simplebus, bcm2835_rng_driver, + bcm2835_rng_devclass, 0, 0); +DRIVER_MODULE(bcm2835_rng, ofwbus, bcm2835_rng_driver, bcm2835_rng_devclass, 0, + 0); +MODULE_VERSION(bcm2835_rng, 1); +MODULE_DEPEND(bcm2835_rng, randomdev, 1, 1, 1); Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Jul 19 18:05:25 2016 (r303034) +++ head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Jul 19 18:07:47 2016 (r303035) @@ -10,6 +10,7 @@ arm/broadcom/bcm2835/bcm2835_gpio.c opt arm/broadcom/bcm2835/bcm2835_intr.c standard arm/broadcom/bcm2835/bcm2835_machdep.c standard arm/broadcom/bcm2835/bcm2835_mbox.c standard +arm/broadcom/bcm2835/bcm2835_rng.c optional random arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi arm/broadcom/bcm2835/bcm2835_vcio.c standard Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2835.dtsi Tue Jul 19 18:05:25 2016 (r303034) +++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi Tue Jul 19 18:07:47 2016 (r303035) @@ -396,6 +396,14 @@ }; }; + rng { + compatible = "broadcom,bcm2835-rng", + "broadcom,bcm2708-rng"; + reg = <0x104000 0x20>; + interrupts = <69>; + interrupt-parent = <&intc>; + }; + bsc0 { #address-cells = <1>; #size-cells = <0>; Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Tue Jul 19 18:05:25 2016 (r303034) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Tue Jul 19 18:07:47 2016 (r303035) @@ -389,6 +389,14 @@ }; }; + rng { + compatible = "broadcom,bcm2835-rng", + "broadcom,bcm2708-rng"; + reg = <0x104000 0x20>; + interrupts = <69>; + interrupt-parent = <&intc>; + }; + bsc0 { #address-cells = <1>; #size-cells = <0>; Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Tue Jul 19 18:05:25 2016 (r303034) +++ head/sys/sys/random.h Tue Jul 19 18:07:47 2016 (r303035) @@ -90,6 +90,7 @@ enum random_entropy_source { RANDOM_PURE_NEHEMIAH, RANDOM_PURE_RNDTEST, RANDOM_PURE_VIRTIO, + RANDOM_PURE_BROADCOM, ENTROPYSOURCE }; From owner-svn-src-head@freebsd.org Tue Jul 19 18:10: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 83B00B9D0C6; Tue, 19 Jul 2016 18:10:02 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0: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 3931D119F; Tue, 19 Jul 2016 18:10:02 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from graveyard.grondar.org ([88.96.155.33] helo=gronkulator.grondar.org) by gromit.grondar.org with esmtpsa (TLSv1:ECDHE-RSA-AES256-SHA:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1bPZSv-000Bt2-TX; Tue, 19 Jul 2016 19:09:59 +0100 Subject: Re: svn commit: r303035 - in head/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm sys Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_B71B2847-D9CF-4269-8A6B-B7E495B14AC2"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6.1 From: Mark R V Murray In-Reply-To: <201607191807.u6JI7lAq099753@repo.freebsd.org> Date: Tue, 19 Jul 2016 19:09:51 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201607191807.u6JI7lAq099753@repo.freebsd.org> To: Mark Robert Vaughan Murray X-Mailer: Apple Mail (2.3124) X-SA-Score: -1.0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 18:10:02 -0000 --Apple-Mail=_B71B2847-D9CF-4269-8A6B-B7E495B14AC2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi * I'm going to get a bollicking for the formatting in this. Apologies in = advance! M > On 19 Jul 2016, at 19:07, Mark Murray wrote: >=20 > Author: markm > Date: Tue Jul 19 18:07:47 2016 > New Revision: 303035 > URL: https://svnweb.freebsd.org/changeset/base/303035 >=20 > Log: > Random bit generator (RBG) driver for RPi and RPi2. >=20 > Summary: > This driver supports the following methods to trigger gathering = random bits from the hardware: > 1. interrupt when the FIFO is full (default) fed into the harvest = queue > 2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if = hz is less than 100, otherwise hz / 100, feeding the random bits into = the harvest queue >=20 > If the kernel is booted with verbose enabled, the contents of the = registers will be dumped after the RBG is started during the attach = routine. >=20 > Author: hackagadget_gmail.com (Stephen J. Kiernan) >=20 > Test Plan: Built RPI2 kernel and booted on board. Tested the = different methods to feed the harvest queue (callout, interrupt) and the = interrupt driven approach seems best. However, keeping the other method = for people to be able to experiment with. >=20 > Reviewed By: adrian, delphij, markm >=20 > Differential Revision: https://reviews.freebsd.org/D6888 >=20 > Added: > head/sys/arm/broadcom/bcm2835/bcm2835_rng.c (contents, props = changed) > Modified: > head/sys/arm/broadcom/bcm2835/files.bcm283x > head/sys/boot/fdt/dts/arm/bcm2835.dtsi > head/sys/boot/fdt/dts/arm/bcm2836.dtsi > head/sys/sys/random.h >=20 > Added: head/sys/arm/broadcom/bcm2835/bcm2835_rng.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 > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm/broadcom/bcm2835/bcm2835_rng.c Tue Jul 19 = 18:07:47 2016 (r303035) > @@ -0,0 +1,534 @@ > +/* > + * Copyright (c) 2015, 2016, Stephen J. Kiernan > + * 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > + > +#if !defined(BCM2835_RNG_USE_CALLOUT) > +#define BCM2835_RNG_USE_INTERRUPT > +#endif > + > +static device_attach_t bcm2835_rng_attach; > +static device_detach_t bcm2835_rng_detach; > +static device_probe_t bcm2835_rng_probe; > + > +#define RNG_CTRL 0x00 /* RNG Control = Register */ > +#define RNG_COMBLK1_OSC 0x003f0000 /* Combiner Blk = 1 Oscillator */ > +#define RNG_COMBLK1_OSC_SHIFT 16 > +#define RNG_COMBLK2_OSC 0x0fc00000 /* Combiner Blk = 2 Oscillator */ > +#define RNG_COMBLK2_OSC_SHIFT 22 > +#define RNG_JCLK_BYP_DIV_CNT 0x0000ff00 /* Jitter clk = bypass divider > + count */ > +#define RNG_JCLK_BYP_DIV_CNT_SHIFT 8 > +#define RNG_JCLK_BYP_SRC 0x00000020 /* Jitter clk = bypass source */ > +#define RNG_JCLK_BYP_SEL 0x00000010 /* Jitter clk = bypass select */ > +#define RNG_RBG2X 0x00000002 /* RBG 2X SPEED = */ > +#define RNG_RBGEN_BIT 0x00000001 /* Enable RNG = bit */ > + > +#define RNG_STATUS 0x04 /* RNG status = register */ > +#define RND_VAL_SHIFT 24 /* Shift for = valid words */ > +#define RND_VAL_MASK 0x000000ff /* Number valid = words mask */ > +#define RND_VAL_WARM_CNT 0x40000 /* RNG Warm Up = count */ > +#define RND_WARM_CNT 0xfffff /* RNG Warm Up = Count mask */ > + > +#define RNG_DATA 0x08 /* RNG Data = Register */ > +#define RNG_FF_THRES 0x0c > +#define RNG_FF_THRES_MASK 0x0000001f > + > +#define RNG_INT_MASK 0x10 > +#define RNG_INT_OFF_BIT 0x00000001 > + > +#define RNG_FF_DEFAULT 0x10 /* FIFO = threshold default */ > + > +#define RNG_FIFO_WORDS (RNG_FF_DEFAULT / = sizeof(uint32_t)) > + > +#define RNG_NUM_OSCILLATORS 6 > +#define RNG_STALL_COUNT_DEFAULT 10 > + > +struct bcm2835_rng_softc { > + device_t sc_dev; > + struct resource * sc_mem_res; > + struct resource * sc_irq_res; > + void * sc_intr_hdl; > +#if defined(BCM2835_RNG_USE_CALLOUT) || = defined(BCM2835_RNG_USE_INTERRUPT) > + uint32_t sc_buf[RNG_FIFO_WORDS]; > +#endif > +#if defined(BCM2835_RNG_USE_CALLOUT) > + struct callout sc_rngto; > + int sc_rnghz; > +#endif > + int sc_stall_count; > + int sc_rbg2x; > + long sc_underrun; > +}; > + > +static __inline void > +bcm2835_rng_stat_inc_underrun(struct bcm2835_rng_softc *sc) > +{ > + > + atomic_add_long(&sc->sc_underrun, 1); > +} > + > +static __inline uint32_t > +bcm2835_rng_read4(struct bcm2835_rng_softc *sc, bus_size_t off) > +{ > + > + return bus_read_4(sc->sc_mem_res, off); > +} > + > +static __inline void > +bcm2835_rng_read_multi4(struct bcm2835_rng_softc *sc, bus_size_t off, > + uint32_t *datap, bus_size_t count) > +{ > + > + bus_read_multi_4(sc->sc_mem_res, off, datap, count); > +} > + > +static __inline void > +bcm2835_rng_write4(struct bcm2835_rng_softc *sc, bus_size_t off, = uint32_t val) > +{ > + > + bus_write_4(sc->sc_mem_res, off, val); > +} > + > +static void > +bcm2835_rng_dump_registers(struct bcm2835_rng_softc *sc, struct sbuf = *sbp) > +{ > + uint32_t comblk2_osc, comblk1_osc, jclk_byp_div, val; > + int i; > + > + /* Display RNG control register contents */ > + val =3D bcm2835_rng_read4(sc, RNG_CTRL); > + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); > + > + comblk2_osc =3D (val & RNG_COMBLK2_OSC) >> = RNG_COMBLK2_OSC_SHIFT; > + sbuf_printf(sbp, " RNG_COMBLK2_OSC (%02x)\n", comblk2_osc); > + for (i =3D 0; i < RNG_NUM_OSCILLATORS; i++) > + if ((comblk2_osc & (1 << i)) =3D=3D 0) > + sbuf_printf(sbp, " Oscillator %d enabled\n", = i + 1); > + > + comblk1_osc =3D (val & RNG_COMBLK1_OSC) >> = RNG_COMBLK1_OSC_SHIFT; > + sbuf_printf(sbp, " RNG_COMBLK1_OSC (%02x)\n", comblk1_osc); > + for (i =3D 0; i < RNG_NUM_OSCILLATORS; i++) > + if ((comblk1_osc & (1 << i)) =3D=3D 0) > + sbuf_printf(sbp, " Oscillator %d enabled\n", = i + 1); > + > + jclk_byp_div =3D (val & RNG_JCLK_BYP_DIV_CNT) >> > + RNG_JCLK_BYP_DIV_CNT_SHIFT; > + sbuf_printf(sbp, > + " RNG_JCLK_BYP_DIV_CNT (%02x)\n APB clock frequency / = %d\n", > + jclk_byp_div, 2 * (jclk_byp_div + 1)); > + > + sbuf_printf(sbp, " RNG_JCLK_BYP_SRC:\n %s\n", > + (val & RNG_JCLK_BYP_SRC) ? "Use divided down APB clock" : > + "Use RNG clock (APB clock)"); > + > + sbuf_printf(sbp, " RNG_JCLK_BYP_SEL:\n %s\n", > + (val & RNG_JCLK_BYP_SEL) ? "Bypass internal jitter clock" : > + "Use internal jitter clock"); > + > + if ((val & RNG_RBG2X) !=3D 0) > + sbuf_cat(sbp, " RNG_RBG2X: RNG 2X SPEED enabled\n"); > + > + if ((val & RNG_RBGEN_BIT) !=3D 0) > + sbuf_cat(sbp, " RNG_RBGEN_BIT: RBG enabled\n"); > + > + /* Display RNG status register contents */ > + val =3D bcm2835_rng_read4(sc, RNG_STATUS); > + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); > + sbuf_printf(sbp, " RND_VAL: %02x\n", > + (val >> RND_VAL_SHIFT) & RND_VAL_MASK); > + sbuf_printf(sbp, " RND_WARM_CNT: %05x\n", val & RND_WARM_CNT); > + > + /* Display FIFO threshold register contents */ > + val =3D bcm2835_rng_read4(sc, RNG_FF_THRES); > + sbuf_printf(sbp, "RNG_FF_THRES: %05x\n", val & = RNG_FF_THRES_MASK); > + > + /* Display interrupt mask register contents */ > + val =3D bcm2835_rng_read4(sc, RNG_INT_MASK); > + sbuf_printf(sbp, "RNG_INT_MASK: interrupt %s\n", > + ((val & RNG_INT_OFF_BIT) !=3D 0) ? "disabled" : "enabled"); > +} > + > +static void > +bcm2835_rng_disable_intr(struct bcm2835_rng_softc *sc) > +{ > + uint32_t mask; > + > + /* Set the interrupt off bit in the interrupt mask register */ > + mask =3D bcm2835_rng_read4(sc, RNG_INT_MASK); > + mask |=3D RNG_INT_OFF_BIT; > + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); > +} > + > +#if defined(BCM2835_RNG_USE_INTERRUPT) > +static void > +bcm2835_rng_enable_intr(struct bcm2835_rng_softc *sc) > +{ > + uint32_t mask; > + > + /* Clear the interrupt off bit in the interrupt mask register */ > + mask =3D bcm2835_rng_read4(sc, RNG_INT_MASK); > + mask &=3D ~RNG_INT_OFF_BIT; > + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); > +} > +#endif > + > +static void > +bcm2835_rng_start(struct bcm2835_rng_softc *sc) > +{ > + uint32_t ctrl; > + > + /* Disable the interrupt */ > + bcm2835_rng_disable_intr(sc); > + > + /* Set the warmup count */ > + bcm2835_rng_write4(sc, RNG_STATUS, RND_VAL_WARM_CNT); > + > + /* Enable the RNG */ > + ctrl =3D bcm2835_rng_read4(sc, RNG_CTRL); > + ctrl |=3D RNG_RBGEN_BIT; > + if (sc->sc_rbg2x) > + ctrl |=3D RNG_RBG2X; > + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); > + > +#if defined(BCM2835_RNG_USE_INTERRUPT) > + /* Enable the interrupt */ > + bcm2835_rng_enable_intr(sc); > +#endif > +} > + > +static void > +bcm2835_rng_stop(struct bcm2835_rng_softc *sc) > +{ > + uint32_t ctrl; > + > + /* Disable the RNG */ > + ctrl =3D bcm2835_rng_read4(sc, RNG_CTRL); > + ctrl &=3D ~RNG_RBGEN_BIT; > + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); > +} > + > +static void > +bcm2835_rng_harvest(struct bcm2835_rng_softc *sc) > +{ > + uint32_t *dest; > + uint32_t status; > + u_int cnt, nread, num_avail, num_words; > + int seen_underrun, num_stalls; > + > + dest =3D sc->sc_buf; > + nread =3D num_words =3D 0; > + seen_underrun =3D num_stalls =3D 0; > + for (cnt =3D sizeof(sc->sc_buf) / sizeof(uint32_t); cnt > 0; > + cnt -=3D num_words) { > + /* Read status register to find out how many words = available */ > + status =3D bcm2835_rng_read4(sc, RNG_STATUS); > + num_avail =3D (status >> RND_VAL_SHIFT) & RND_VAL_MASK; > + > + /* If we have none... */ > + if (num_avail =3D=3D 0) { > + bcm2835_rng_stat_inc_underrun(sc); > + if (++seen_underrun >=3D sc->sc_stall_count) { > + if (num_stalls++ > 0) { > + device_printf(sc->sc_dev, > + "RNG stalled, disabling = device\n"); > + bcm2835_rng_stop(sc); > + break; > + } else { > + device_printf(sc->sc_dev, > + "Too many underruns, = resetting\n"); > + bcm2835_rng_stop(sc); > + bcm2835_rng_start(sc); > + seen_underrun =3D 0; > + } > + } > + /* Try again */ > + continue; > + } > + > + CTR2(KTR_DEV, "%s: %d words available in RNG FIFO", > + device_get_nameunit(sc->sc_dev), num_avail); > + > + /* Pull MIN(num_avail, cnt) words from the FIFO */ > + num_words =3D (num_avail > cnt) ? cnt : num_avail; > + bcm2835_rng_read_multi4(sc, RNG_DATA, dest, > + num_words); > + dest +=3D num_words; > + nread +=3D num_words; > + } > + > + cnt =3D nread * sizeof(uint32_t); > + if (cnt > 0) > + random_harvest_queue(sc->sc_buf, cnt, cnt * NBBY / 2, > + RANDOM_PURE_BROADCOM); > + > +#if defined(BCM2835_RNG_USE_CALLOUT) > + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, = sc); > +#endif > +} > + > +static int > +sysctl_bcm2835_rng_2xspeed(SYSCTL_HANDLER_ARGS) > +{ > + struct bcm2835_rng_softc *sc =3D arg1; > + int error, rbg2x; > + > + rbg2x =3D sc->sc_rbg2x; > + error =3D sysctl_handle_int(oidp, &rbg2x, 0, req); > + if (error) > + return (error); > + if (req->newptr =3D=3D NULL) > + return (error); > + if (rbg2x =3D=3D sc->sc_rbg2x) > + return (0); > + > + /* Reset the RNG */ > + bcm2835_rng_stop(sc); > + sc->sc_rbg2x =3D rbg2x; > + bcm2835_rng_start(sc); > + > + return (0); > +} > + > +#ifdef BCM2835_RNG_DEBUG_REGISTERS > +static int > +sysctl_bcm2835_rng_dump(SYSCTL_HANDLER_ARGS) > +{ > + struct sbuf sb; > + struct bcm2835_rng_softc *sc =3D arg1; > + int error; > + > + error =3D sysctl_wire_old_buffer(req, 0); > + if (error !=3D 0) > + return (error); > + sbuf_new_for_sysctl(&sb, NULL, 128, req); > + bcm2835_rng_dump_registers(sc, &sb); > + error =3D sbuf_finish(&sb); > + sbuf_delete(&sb); > + return (error); > +} > +#endif > + > +static int > +bcm2835_rng_probe(device_t dev) > +{ > + > + if (!ofw_bus_status_okay(dev)) > + return (ENXIO); > + > + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-rng")) > + return (ENXIO); > + > + device_set_desc(dev, "Broadcom BCM2835 RNG"); > + > + return (BUS_PROBE_DEFAULT); > +} > + > +static int > +bcm2835_rng_attach(device_t dev) > +{ > + struct bcm2835_rng_softc *sc; > + struct sysctl_ctx_list *sysctl_ctx; > + struct sysctl_oid *sysctl_tree; > + int error, rid; > + > + error =3D 0; > + sc =3D device_get_softc(dev); > + sc->sc_dev =3D dev; > + sc->sc_stall_count =3D RNG_STALL_COUNT_DEFAULT; > +#ifdef BCM2835_RNG_USE_CALLOUT > + /* Initialize callout */ > + callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); > +#endif > + TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); > + TUNABLE_INT_FETCH("bcmrng.stall_count", &sc->sc_stall_count); > + > + /* Allocate memory resources */ > + rid =3D 0; > + sc->sc_mem_res =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY, = &rid, > + RF_ACTIVE); > + if (sc->sc_mem_res =3D=3D NULL) { > + bcm2835_rng_detach(dev); > + return (ENXIO); > + } > + > +#if defined(BCM2835_RNG_USE_INTERRUPT) > + /* Allocate interrupt resource */ > + rid =3D 0; > + sc->sc_irq_res =3D bus_alloc_resource_any(dev, SYS_RES_IRQ, = &rid, > + RF_SHAREABLE | RF_ACTIVE); > + if (sc->sc_irq_res =3D=3D NULL) { > + bcm2835_rng_detach(dev); > + return (ENXIO); > + } > + > + /* Set up the interrupt handler */ > + error =3D bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | = INTR_MPSAFE, > + NULL, (driver_intr_t *)bcm2835_rng_harvest, sc, = &sc->sc_intr_hdl); > + if (error) { > + device_printf(dev, "Failed to set up IRQ\n"); > + sc->sc_intr_hdl =3D NULL; > + bcm2835_rng_detach(dev); > + return (error); > + } > +#endif > + > + /* Start the RNG */ > + bcm2835_rng_start(sc); > + > + /* Dump the registers if booting verbose */ > + if (bootverbose) { > + struct sbuf sb; > + > + (void) sbuf_new(&sb, NULL, 256, > + SBUF_AUTOEXTEND | SBUF_INCLUDENUL); > + bcm2835_rng_dump_registers(sc, &sb); > + sbuf_trim(&sb); > + error =3D sbuf_finish(&sb); > + if (error =3D=3D 0) > + device_printf(dev, "%s", sbuf_data(&sb)); > + sbuf_delete(&sb); > + } > + > + sysctl_ctx =3D device_get_sysctl_ctx(dev); > + sysctl_tree =3D device_get_sysctl_tree(dev); > + SYSCTL_ADD_LONG(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), = OID_AUTO, > + "underrun", CTLFLAG_RD, &sc->sc_underrun, > + "Number of FIFO underruns"); > + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), = OID_AUTO, > + "2xspeed", CTLTYPE_INT | CTLFLAG_RW, sc, 0, > + sysctl_bcm2835_rng_2xspeed, "I", "Enable RBG 2X SPEED"); > + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), = OID_AUTO, > + "stall_count", CTLFLAG_RW, &sc->sc_stall_count, > + RNG_STALL_COUNT_DEFAULT, "Number of underruns to assume RNG = stall"); > +#ifdef BCM2835_RNG_DEBUG_REGISTERS > + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), = OID_AUTO, > + "dumpregs", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, > + sysctl_bcm2835_rng_dump, "S", "Dump RNG registers"); > +#endif > + > +#if defined(BCM2835_RNG_USE_CALLOUT) > + /* Reset callout */ > + if (hz >=3D 100) > + sc->sc_rnghz =3D hz / 100; > + else > + sc->sc_rnghz =3D 1; > + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, = sc); > +#endif > + > + return (0); > +} > + > +static int > +bcm2835_rng_detach(device_t dev) > +{ > + struct bcm2835_rng_softc *sc; > +#if defined(BCM2835_RNG_USE_INTERRUPT) > + int error; > +#endif > + > + sc =3D device_get_softc(dev); > + > + /* Stop the RNG */ > + bcm2835_rng_stop(sc); > + > + /* Drain the callout it */ > +#if defined(BCM2835_RNG_USE_CALLOUT) > + callout_drain(&sc->sc_rngto); > +#endif > + > +#if defined(BCM2835_RNG_USE_INTERRUPT) > + /* Tear down the interrupt */ > + if (sc->sc_irq_res && sc->sc_intr_hdl) { > + error =3D bus_teardown_intr(dev, sc->sc_irq_res, = sc->sc_intr_hdl); > + if (error !=3D 0) { > + device_printf(dev, "could not tear down IRQ\n"); > + return (error); > + } > + sc->sc_intr_hdl =3D NULL; > + } > + > + /* Release interrupt resource */ > + if (sc->sc_irq_res) { > + bus_release_resource(dev, SYS_RES_IRQ, 0, = sc->sc_irq_res); > + sc->sc_irq_res =3D NULL; > + } > +#endif > + > + /* Release memory resource */ > + if (sc->sc_mem_res !=3D NULL) > + bus_release_resource(dev, SYS_RES_MEMORY, 0, = sc->sc_mem_res); > + > + return (0); > +} > + > +static device_method_t bcm2835_rng_methods[] =3D { > + /* Device interface */ > + DEVMETHOD(device_probe, bcm2835_rng_probe), > + DEVMETHOD(device_attach, bcm2835_rng_attach), > + DEVMETHOD(device_detach, bcm2835_rng_detach), > + > + DEVMETHOD_END > +}; > + > +static driver_t bcm2835_rng_driver =3D { > + "bcmrng", > + bcm2835_rng_methods, > + sizeof(struct bcm2835_rng_softc) > +}; > +static devclass_t bcm2835_rng_devclass; > + > +DRIVER_MODULE(bcm2835_rng, simplebus, bcm2835_rng_driver, > + bcm2835_rng_devclass, 0, 0); > +DRIVER_MODULE(bcm2835_rng, ofwbus, bcm2835_rng_driver, = bcm2835_rng_devclass, 0, > + 0); > +MODULE_VERSION(bcm2835_rng, 1); > +MODULE_DEPEND(bcm2835_rng, randomdev, 1, 1, 1); >=20 > Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/broadcom/bcm2835/files.bcm283x Tue Jul 19 = 18:05:25 2016 (r303034) > +++ head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Jul 19 = 18:07:47 2016 (r303035) > @@ -10,6 +10,7 @@ arm/broadcom/bcm2835/bcm2835_gpio.c opt > arm/broadcom/bcm2835/bcm2835_intr.c standard > arm/broadcom/bcm2835/bcm2835_machdep.c standard > arm/broadcom/bcm2835/bcm2835_mbox.c standard > +arm/broadcom/bcm2835/bcm2835_rng.c optional random > arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci > arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi > arm/broadcom/bcm2835/bcm2835_vcio.c standard >=20 > Modified: head/sys/boot/fdt/dts/arm/bcm2835.dtsi > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/boot/fdt/dts/arm/bcm2835.dtsi Tue Jul 19 18:05:25 2016 = (r303034) > +++ head/sys/boot/fdt/dts/arm/bcm2835.dtsi Tue Jul 19 18:07:47 2016 = (r303035) > @@ -396,6 +396,14 @@ > }; > }; >=20 > + rng { > + compatible =3D "broadcom,bcm2835-rng", > + "broadcom,bcm2708-rng"; > + reg =3D <0x104000 0x20>; > + interrupts =3D <69>; > + interrupt-parent =3D <&intc>; > + }; > + > bsc0 { > #address-cells =3D <1>; > #size-cells =3D <0>; >=20 > Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/boot/fdt/dts/arm/bcm2836.dtsi Tue Jul 19 18:05:25 2016 = (r303034) > +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Tue Jul 19 18:07:47 2016 = (r303035) > @@ -389,6 +389,14 @@ > }; > }; >=20 > + rng { > + compatible =3D "broadcom,bcm2835-rng", > + "broadcom,bcm2708-rng"; > + reg =3D <0x104000 0x20>; > + interrupts =3D <69>; > + interrupt-parent =3D <&intc>; > + }; > + > bsc0 { > #address-cells =3D <1>; > #size-cells =3D <0>; >=20 > Modified: head/sys/sys/random.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/sys/random.h Tue Jul 19 18:05:25 2016 = (r303034) > +++ head/sys/sys/random.h Tue Jul 19 18:07:47 2016 = (r303035) > @@ -90,6 +90,7 @@ enum random_entropy_source { > RANDOM_PURE_NEHEMIAH, > RANDOM_PURE_RNDTEST, > RANDOM_PURE_VIRTIO, > + RANDOM_PURE_BROADCOM, > ENTROPYSOURCE > }; >=20 >=20 -- Mark R V Murray --Apple-Mail=_B71B2847-D9CF-4269-8A6B-B7E495B14AC2 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----- Version: GnuPG/MacGPG2 v2.0.30 Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAleObPUACgkQzQuKNftX15Ow7gCgpqW4NCMmkhQci4TOSrj/mFzK dmIAnjNBi+ycgdd/b8kJNbh3oMnj6NX6 =X9dj -----END PGP SIGNATURE----- --Apple-Mail=_B71B2847-D9CF-4269-8A6B-B7E495B14AC2-- From owner-svn-src-head@freebsd.org Tue Jul 19 18:15: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 1A29DB9D351; Tue, 19 Jul 2016 18:15:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C58941709; Tue, 19 Jul 2016 18:15:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JIFMCR003687; Tue, 19 Jul 2016 18:15:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JIFM2W003685; Tue, 19 Jul 2016 18:15:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191815.u6JIFM2W003685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 18:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303036 - head/usr.sbin/makefs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 18:15:24 -0000 Author: emaste Date: Tue Jul 19 18:15:22 2016 New Revision: 303036 URL: https://svnweb.freebsd.org/changeset/base/303036 Log: makefs: reorder 'usage' alphabetically From NetBSD, Mon Aug 15 14:45:01 2011 +0000 (wiz) Re-order `usage' alphabetically; rename option arguments in the manpage's `SYNOPSIS' section to match those from `usage' (not the other way around; the `usage'-line (and other parts of makefs.c) contain the correct names); minor punctuation improvements. From Snader_LB. makefs.8 1.36 makefs.c 1.30 Obtained from: NetBSD Modified: head/usr.sbin/makefs/makefs.8 head/usr.sbin/makefs/makefs.c Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Tue Jul 19 18:07:47 2016 (r303035) +++ head/usr.sbin/makefs/makefs.8 Tue Jul 19 18:15:22 2016 (r303036) @@ -401,7 +401,8 @@ The utility appeared in .Nx 1.6 . .Sh AUTHORS -.An Luke Mewburn Aq Mt lukem@NetBSD.org +.An Luke Mewburn +.Aq Mt lukem@NetBSD.org (original program), .An Daniel Watt , .An Walter Deignan , Modified: head/usr.sbin/makefs/makefs.c ============================================================================== --- head/usr.sbin/makefs/makefs.c Tue Jul 19 18:07:47 2016 (r303035) +++ head/usr.sbin/makefs/makefs.c Tue Jul 19 18:15:22 2016 (r303036) @@ -403,10 +403,10 @@ usage(void) prog = getprogname(); fprintf(stderr, -"usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n" -"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-R roundup-size]\n" -"\t[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]\n" -"\t[-xZ] [-N userdb-dir] [-T ]\n" +"usage: %s [-xZ] [-B endian] [-b free-blocks] [-d debug-mask]\n" +"\t[-F mtree-specfile] [-f free-files] [-M minimum-size] [-m maximum-size]\n" +"\t[-N userdb-dir] [-o fs-options] [-R roundup-size] [-S sector-size]\n" +"\t[-s image-size] [-T ] [-t fs-type]\n" "\timage-file directory | manifest [extra-directory ...]\n", prog); exit(1); From owner-svn-src-head@freebsd.org Tue Jul 19 18:21: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 3BA91B9D580; Tue, 19 Jul 2016 18:21:19 +0000 (UTC) (envelope-from ken@freebsd.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "A1-33714", Issuer "A1-33714" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 15EC61BBF; Tue, 19 Jul 2016 18:21:18 +0000 (UTC) (envelope-from ken@freebsd.org) Received: from [10.0.0.27] (mbp2013-wired.int.kdm.org [10.0.0.27]) (authenticated bits=0) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPSA id u6JI0BvL093581 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Jul 2016 14:00:12 -0400 (EDT) (envelope-from ken@freebsd.org) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r297023 - head/sbin/kldstat From: Ken Merry In-Reply-To: <201603181449.u2IEnCeN071630@repo.freebsd.org> Date: Tue, 19 Jul 2016 14:00:11 -0400 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201603181449.u2IEnCeN071630@repo.freebsd.org> To: Julian Elischer X-Mailer: Apple Mail (2.3124) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [96.89.93.250]); Tue, 19 Jul 2016 14:00:12 -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: Tue, 19 Jul 2016 18:21:19 -0000 > On Mar 18, 2016, at 10:49 AM, Julian Elischer = wrote: >=20 > Author: julian > Date: Fri Mar 18 14:49:11 2016 > New Revision: 297023 > URL: https://svnweb.freebsd.org/changeset/base/297023 >=20 > Log: > Add the ability to print out ht emodule specific information in = likely formats. > Among other things this gives us the ability to find outthe syscall = number of a dynamically loaded syscall that has a dynamicly allocated = vector number. >=20 > MFC after: 1 week > Sponsored by: Panzura inc. >=20 > Modified: > head/sbin/kldstat/kldstat.8 > head/sbin/kldstat/kldstat.c >=20 > Modified: head/sbin/kldstat/kldstat.8 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/sbin/kldstat/kldstat.8 Fri Mar 18 13:32:37 2016 = (r297022) > +++ head/sbin/kldstat/kldstat.8 Fri Mar 18 14:49:11 2016 = (r297023) > @@ -36,10 +36,12 @@ > .Op Fl h > .Op Fl q > .Op Fl v > +.Op Fl d > .Op Fl i Ar id > .Op Fl n Ar filename > .Nm > .Op Fl q > +.Op Fl d > .Op Fl m Ar modname > .Sh DESCRIPTION > The > @@ -54,6 +56,8 @@ Display the size field in a human-readab > instead of hex values. > .It Fl v > Be more verbose. > +.It Fl d > +Show the module specific data (as int, unsigned int and unsigned = long) > .It Fl i Ar id > Display the status of only the file with this ID. > .It Fl n Ar filename >=20 > Modified: head/sbin/kldstat/kldstat.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/sbin/kldstat/kldstat.c Fri Mar 18 13:32:37 2016 = (r297022) > +++ head/sbin/kldstat/kldstat.c Fri Mar 18 14:49:11 2016 = (r297023) > @@ -36,19 +36,28 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include >=20 > #define POINTER_WIDTH ((int)(sizeof(void *) * 2 + 2)) >=20 > +static int showdata =3D 0; > + > static void > printmod(int modid) > { > struct module_stat stat; >=20 > + bzero(&stat, sizeof(stat)); > stat.version =3D sizeof(struct module_stat); > if (modstat(modid, &stat) < 0) > warn("can't stat module id %d", modid); > else > - printf("\t\t%2d %s\n", stat.id, stat.name); > + if (showdata) { > + printf("\t\t%2d %s (%d, %u, 0x%lx)\n", stat.id, stat.name,=20= > + stat.data.intval, stat.data.uintval, = stat.data.ulongval); > + } else { > + printf("\t\t%2d %s\n", stat.id, stat.name); > + } > } >=20 > static void > @@ -88,8 +97,8 @@ printfile(int fileid, int verbose, int h > static void > usage(void) > { > - fprintf(stderr, "usage: kldstat [-h] [-q] [-v] [-i id] [-n = filename]\n"); > - fprintf(stderr, " kldstat [-q] [-m modname]\n"); > + fprintf(stderr, "usage: kldstata[-d] [-h] [-q] [-v] [-i id] [-n = filename]\n"); > + fprintf(stderr, " kldstat [-d] [-q] [-m modname]\n=E2=80=9D);= Looks like there is a typo in the usage. Ken= From owner-svn-src-head@freebsd.org Tue Jul 19 18:31: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 B16BAB9DCF2; Tue, 19 Jul 2016 18:31:20 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A3E915DD; Tue, 19 Jul 2016 18:31:20 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JIVJc0007543; Tue, 19 Jul 2016 18:31:19 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JIVJWq007542; Tue, 19 Jul 2016 18:31:19 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201607191831.u6JIVJWq007542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Tue, 19 Jul 2016 18:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303037 - 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, 19 Jul 2016 18:31:20 -0000 Author: rrs Date: Tue Jul 19 18:31:19 2016 New Revision: 303037 URL: https://svnweb.freebsd.org/changeset/base/303037 Log: This reverts out Gleb's changes and adds three small fixes that I think closes up the races Gleb was looking for. This is running quite nicely in Netflix and now no longer causes TCP-tcb leaks. Differential Revision: 7135 Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Tue Jul 19 18:15:22 2016 (r303036) +++ head/sys/kern/kern_timeout.c Tue Jul 19 18:31:19 2016 (r303037) @@ -1050,7 +1050,7 @@ callout_reset_sbt_on(struct callout *c, */ if (c->c_lock != NULL && !cc_exec_cancel(cc, direct)) cancelled = cc_exec_cancel(cc, direct) = true; - if (cc_exec_waiting(cc, direct)) { + if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, direct)) { /* * Someone has called callout_drain to kill this * callout. Don't reschedule. @@ -1166,7 +1166,7 @@ _callout_stop_safe(struct callout *c, in struct callout_cpu *cc, *old_cc; struct lock_class *class; int direct, sq_locked, use_lock; - int cancelled, not_on_a_list; + int not_on_a_list; if ((flags & CS_DRAIN) != 0) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock, @@ -1234,17 +1234,47 @@ again: panic("migration should not happen"); #endif } - + if ((drain != NULL) && (c->c_iflags & CALLOUT_PENDING) && + (cc_exec_curr(cc, direct) != c)) { + /* + * This callout is executing and we are draining. + * The only way this can happen is if its also + * been rescheduled to run on one thread *and* asked to drain + * on this thread (at the same time it is waiting to execute). + */ + if ((c->c_iflags & CALLOUT_PROCESSED) == 0) { + if (cc_exec_next(cc) == c) + cc_exec_next(cc) = LIST_NEXT(c, c_links.le); + LIST_REMOVE(c, c_links.le); + } else { + TAILQ_REMOVE(&cc->cc_expireq, c, c_links.tqe); + } + c->c_iflags &= ~CALLOUT_PENDING; + c->c_flags &= ~CALLOUT_ACTIVE; + } /* - * If the callout is running, try to stop it or drain it. + * If the callout isn't pending, it's not on the queue, so + * don't attempt to remove it from the queue. We can try to + * stop it by other means however. */ - if (cc_exec_curr(cc, direct) == c) { + if (!(c->c_iflags & CALLOUT_PENDING)) { /* - * Succeed we to stop it or not, we must clear the - * active flag - this is what API users expect. + * If it wasn't on the queue and it isn't the current + * callout, then we can't stop it, so just bail. + * It probably has already been run (if locking + * is properly done). You could get here if the caller + * calls stop twice in a row for example. The second + * call would fall here without CALLOUT_ACTIVE set. */ c->c_flags &= ~CALLOUT_ACTIVE; - + if (cc_exec_curr(cc, direct) != c) { + CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", + c, c->c_func, c->c_arg); + CC_UNLOCK(cc); + if (sq_locked) + sleepq_release(&cc_exec_waiting(cc, direct)); + return (-1); + } if ((flags & CS_DRAIN) != 0) { /* * The current callout is running (or just @@ -1278,7 +1308,6 @@ again: old_cc = cc; goto again; } - /* * Migration could be cancelled here, but * as long as it is still not sure when it @@ -1362,6 +1391,8 @@ again: cc_exec_drain(cc, direct) = drain; } CC_UNLOCK(cc); + if (drain) + return(0); return ((flags & CS_EXECUTING) != 0); } CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", @@ -1369,20 +1400,12 @@ again: if (drain) { cc_exec_drain(cc, direct) = drain; } - KASSERT(!sq_locked, ("sleepqueue chain still locked")); - cancelled = ((flags & CS_EXECUTING) != 0); - } else - cancelled = 1; - - if (sq_locked) - sleepq_release(&cc_exec_waiting(cc, direct)); - - if ((c->c_iflags & CALLOUT_PENDING) == 0) { - CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", - c, c->c_func, c->c_arg); CC_UNLOCK(cc); + KASSERT(!sq_locked, ("sleepqueue chain still locked")); return (0); } + if (sq_locked) + sleepq_release(&cc_exec_waiting(cc, direct)); c->c_iflags &= ~CALLOUT_PENDING; c->c_flags &= ~CALLOUT_ACTIVE; @@ -1400,7 +1423,7 @@ again: } callout_cc_del(c, cc); CC_UNLOCK(cc); - return (cancelled); + return (1); } void @@ -1615,7 +1638,6 @@ SYSCTL_PROC(_kern, OID_AUTO, callout_sta CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_callout_stat, "I", "Dump immediate statistic snapshot of the scheduled callouts"); - #ifdef DDB static void _show_callout(struct callout *c) From owner-svn-src-head@freebsd.org Tue Jul 19 18:32: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 2F5B2B9DDB2; Tue, 19 Jul 2016 18:32:12 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com [IPv6:2607:f8b0:400e:c03::242]) (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 EF9BE181D; Tue, 19 Jul 2016 18:32:11 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x242.google.com with SMTP id ez1so1749468pab.3; Tue, 19 Jul 2016 11:32:11 -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=QOhVX4UJ4BG2GYEOsLhJ0BC50P07oYONooz3afTmjhk=; b=yW9I3Px59Aqic2P0qJm3HLQ3pXiDkWSXC6Z10WpUo5gIZoh5D8Gck/yPNhaHY11gHe cWFaP+cXH0H9qjUsK7nVBVydfya60RaTlASqSjao0QIgR0nyfo52IR3AIFyiH1Rc2x+b gejpjuyFR5f16fuf/u4EiHlPRgPkWBYUaxzORnoXj6QdUxF8NVfz715XcR1hQl3t5vKj 9RMZv5pPzp588qfWdMnVUinOBDfpe2/qVNS3SBhke+uTOFK3bynELob/nG1k2rNXe/k8 y140ufGw/nre2Hy/LBOFYeXMTGsEezOmQ81FtfhcMdTGuewizezDSaYzOwoiNflAHiHH i6uw== 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=QOhVX4UJ4BG2GYEOsLhJ0BC50P07oYONooz3afTmjhk=; b=TN6tWRXM9+8C3BWk/rrV4Ko7fQtIq5NMgar0/yFdbSWKhFEtlqVmJEnVpTQSXNg4ki ck2E7XA6oZhEtbHZu7C5/B1pli7+0xyxHuIa39a7xa6ZX51go4Uvj71iVQzxMRzHTdJP YodHeS97QK4jCqs5z/IwNfLiDFzfACeoQEj6zGjAljAkNw56YlDSSP8Keuu5SD7XnxHE Yj7YxYPHVY1mieRY4aaRqgkAt4APxh9Bb8sXwjQ9hUj2poNAClI4/cHTUDxvtoiQLwUN 9G42l7/vymQXmfjr6D4wVzLP1Qd8Zi5qKb4Rwto+gwNBA/ABzdpaiOV8iKN7lWpLiQ0G NFJA== X-Gm-Message-State: ALyK8tLP5JoIHnnJe5SYvNY7oeDo+adDcoF6RxkKoCGzY5wWFR9DAP6JjGziYLUxJJw0UQ== X-Received: by 10.66.156.226 with SMTP id wh2mr65999477pab.116.1468953129909; Tue, 19 Jul 2016 11:32:09 -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 ee3sm6010931pac.25.2016.07.19.11.32.08 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 11:32:09 -0700 (PDT) Subject: Re: svn commit: r303037 - head/sys/kern Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_3264ADD5-A28D-4042-8154-D27295A7FEE3"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201607191831.u6JIVJWq007542@repo.freebsd.org> Date: Tue, 19 Jul 2016 11:32:07 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201607191831.u6JIVJWq007542@repo.freebsd.org> To: Randall Stewart 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: Tue, 19 Jul 2016 18:32:12 -0000 --Apple-Mail=_3264ADD5-A28D-4042-8154-D27295A7FEE3 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Jul 19, 2016, at 11:31, Randall Stewart wrote: > > Author: rrs > Date: Tue Jul 19 18:31:19 2016 > New Revision: 303037 > URL: https://svnweb.freebsd.org/changeset/base/303037 > > Log: > This reverts out Gleb's changes and adds three small > fixes that I think closes up the races Gleb was > looking for. This is running quite nicely in Netflix and > now no longer causes TCP-tcb leaks. > > Differential Revision: 7135 This needs to be MFCed to ^/stable/11. Thanks, -Ngie --Apple-Mail=_3264ADD5-A28D-4042-8154-D27295A7FEE3 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 iQIcBAEBCgAGBQJXjnInAAoJEPWDqSZpMIYVi5EP/R4PXkQOIVZdHNztm+ukBMRs CDZ8c9ZXFl3I3TUaNfKJcXjCCgcN1Do/q4baks1lzyLxGeoVAqjlb/3bAdXOm4su ydg+QjgM52rOzDqq37MXV7OehiMGFM9dHWyuVBb3p62JVeEgH9biNYFL6z93K7sf PoOQOLVHI5usfh5gWbwYI8ueo7ekOQIu8CeCAvDMI0KhuN3G9VpLxLVDe0WyWMYg 5grL9KMnHFldQPaLCepz7EnNTjq/U/hFVV6vJF+3VVGp4jhiGzj3IKHUxuo9W2ZD g3/68GedVGWXziqJw3rwlzwQM3xJfd43QxYpdU8Q+pPDYDg0rmbjoXOhbxDj8a2H yye/WysnlQoabTChfW7Be5P/28EWz8kbsVcGgnHNOWEtj/bqAJGj5XKDtYLDh80m wa5YtbXzMipNflGozjg8XQGkpfRE102dcZXSl9tCwGi+Z6NIbQvQRdS0OlkIXWly vHAbK/1PF7CpvcV6Zs4psiJekfaTtbbResxSJ0fVsGw6JsyDZpOX2rQ25WidWeao B7xCrVSd8zD7V1MCKHssSqo6+A6I9oyGgT4WHRfB4a685Yayg66/sYfnZ8l0GNib MzxQ0dyzw7YT61AwArEAa+d+g6Asnn1GbeRXTUYJ+bZ0agknQTroKc8ZOJ78MdXK DfbqwcEpUVTf8MNV+QCz =zUGr -----END PGP SIGNATURE----- --Apple-Mail=_3264ADD5-A28D-4042-8154-D27295A7FEE3-- From owner-svn-src-head@freebsd.org Tue Jul 19 18:39: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 C61AAB9DEC1; Tue, 19 Jul 2016 18:39:22 +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 AEE031AEC; Tue, 19 Jul 2016 18:39:22 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6JIdJoM010595 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 19 Jul 2016 11:39:19 -0700 Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Nathan Whitehorn Message-ID: <263c0490-691a-b551-f5e7-fc5bb6b05ba7@freebsd.org> Date: Tue, 19 Jul 2016 11:39:19 -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: <201607191746.u6JHk9ov092270@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVaAEJA+3wjzPUKJdIVk0KbStjYnlgoL+/SNhU4W7ZopaK+BGBcPZdALpmN85z8wfD8+3USG6uatlBHRjSf9mPWT24nKj41UaTs= X-Sonic-ID: C;7PKaGuBN5hGexpNwxPCmMQ== M;6JfWGuBN5hGexpNwxPCmMQ== 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: Tue, 19 Jul 2016 18:39:22 -0000 Thank you! This is super useful. -Nathan On 07/19/16 10:46, Ed Maste wrote: > Author: emaste > Date: Tue Jul 19 17:46:09 2016 > New Revision: 303033 > URL: https://svnweb.freebsd.org/changeset/base/303033 > > Log: > add an arch.7 man page with architecture-specific details > > Based on details collected on the wiki, at > https://wiki.freebsd.org/EdMaste/ArchitectureSpecifics > Further details to be added over time. > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D7096 > > Added: > head/share/man/man7/arch.7 (contents, props changed) > Modified: > head/share/man/man7/Makefile > > Modified: head/share/man/man7/Makefile > ============================================================================== > --- head/share/man/man7/Makefile Tue Jul 19 17:31:48 2016 (r303032) > +++ head/share/man/man7/Makefile Tue Jul 19 17:46:09 2016 (r303033) > @@ -7,6 +7,7 @@ PACKAGE=runtime-manuals > > #MISSING: eqnchar.7 ms.7 term.7 > MAN= adding_user.7 \ > + arch.7 \ > ascii.7 \ > bsd.snmpmod.mk.7 \ > build.7 \ > > Added: head/share/man/man7/arch.7 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man7/arch.7 Tue Jul 19 17:46:09 2016 (r303033) > @@ -0,0 +1,171 @@ > +.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. > +.\" > +.\" This documentation was created by Ed Maste under sponsorship of > +.\" The FreeBSD Foundation. > +.\" > +.\" 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 COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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 19, 2016 > +.Dt ARCH 7 > +.Os > +.Sh NAME > +.Nm arch > +.Nd Architecture-specific details > +.Sh DESCRIPTION > +Differences between CPU architectures and platforms supported by > +.Fx . > +.Pp > +.Ss Type sizes > +On all supported architectures, > +.Bl -column -offset -indent "long long" "Size" > +.It Sy Type Ta Sy Size > +.It short Ta 2 > +.It int Ta 4 > +.It long Ta sizeof(void*) > +.It long long Ta 8 > +.It float Ta 4 > +.It double Ta 8 > +.El > +.Bl -column -offset indent ".Sy Architecture" ".Sy sizeof(void *)" ".Sy "sizeof(long double)" > +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) > +.It amd64 Ta 8 Ta 16 > +.It arm Ta 4 Ta 8 > +.It armeb Ta 4 Ta 8 > +.It armv6 Ta 4 Ta 8 > +.It arm64 Ta 8 Ta 16 > +.It i386 Ta 4 Ta 12 > +.It mips Ta 4 Ta 8 > +.It mipsel Ta 4 Ta 8 > +.It mipsn32 Ta 4 Ta 8 > +.It mips64 Ta 8 Ta 8 > +.It mips64el Ta 8 Ta 8 > +.It powerpc Ta 4 Ta 8 > +.It powerpc64 Ta 8 Ta 8 > +.It riscv Ta 8 Ta > +.It sparc64 Ta 8 Ta 16 > +.El > +.Ss Endianness and Char Signedness > +.Bl -column -offset indent ".Sy Architecture" ".Sy Endianness" ".Sy "char Signedness" > +.It Sy Architecture Ta Sy Endianness Ta Sy char Signedness > +.It amd64 Ta little Ta signed > +.It arm Ta little Ta unsigned > +.It armeb Ta big Ta unsigned > +.It armv6 Ta little Ta unsigned > +.It arm64 Ta little Ta unsigned > +.It i386 Ta little Ta signed > +.It mips Ta little Ta signed > +.It mipsel Ta big Ta signed > +.It mipsn32 Ta little Ta signed > +.It mips64 Ta little Ta signed > +.It mips64el Ta little Ta signed > +.It powerpc Ta big Ta unsigned > +.It powerpc64 Ta big Ta unsigned > +.It riscv Ta little Ta signed > +.It sparc64 Ta big Ta signed > +.El > +.Ss Page Size > +.Bl -column -offset indent ".Sy Architecture" ".Sy Page Sizes" > +.It Sy Architecture Ta Sy Page Sizes > +.It amd64 Ta 4K, 2M, 1G > +.It arm Ta 4K > +.It armeb Ta 4K > +.It armv6 Ta 4K > +.It arm64 Ta 4K, 2M, 1G > +.It i386 Ta 4K, 2M (PAE), 4M > +.It mips Ta 4K > +.It mipsel Ta 4K > +.It mipsn32 Ta 4K > +.It mips64 Ta 4K > +.It mips64el Ta 4K > +.It powerpc Ta 4K > +.It powerpc64 Ta 4K > +.It riscv Ta 4K > +.It sparc64 Ta 8K > +.El > +.Ss Floating Point > +.Bl -column -offset indent ".Sy Architecture" ".Sy float, double" ".Sy long double" > +.It Sy Architecture Ta Sy float, double Ta Sy long double > +.It amd64 Ta hard Ta hard, 80 bit > +.It arm Ta soft Ta soft, double precision > +.It armeb Ta soft Ta soft, double precision > +.It armv6 Ta hard Ta hard, double precision > +.It arm64 Ta hard Ta soft, quad precision > +.It i386 Ta hard Ta hard, 80 bit > +.It mips Ta soft Ta identical to double > +.It mipsel Ta soft Ta identical to double > +.It mipsn32 Ta soft Ta identical to double > +.It mips64 Ta soft Ta identical to double > +.It mips64el Ta soft Ta identical to double > +.It powerpc Ta hard Ta hard, double precision > +.It powerpc64 Ta hard Ta hard, double precision > +.It riscv Ta > +.It sparc64 Ta hard Ta hard, quad precision > +.El > +.Ss Predefined Macros > +The compiler provides a number of predefined macros. > +Some of these provide architecture-specific details and are explained below. > +Other macros, including those required by the language standard, are not > +included here. > +.Pp > +The full set of predefined macros can be obtained with this command: > +.Bd -literal -offset indent > +cc -x c -Dm -E /dev/null > +.Ed > +.Pp > +Common type size and endianness macros: > +.Bl -column -offset indent "BYTE_ORDER" ".Sy Meaning" > +.It Sy Macro Ta Sy Meaning > +.It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int > +.It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer > +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . > +.Dv PDP11_ENDIAN is not used on FreeBSD. > +.El > +.Pp > +Architecture-specific macros: > +.Bl -column -offset indent ".Sy Architecture" ".Sy Predefined macros" > +.It Sy Architecture Ta Sy Predefined macros > +.It amd64 Ta Dv __amd64__, Dv __x86_64__ > +.It arm Ta Dv __arm__ > +.It armeb Ta Dv __arm__ > +.It armv6 Ta Dv __arm__, Dv __ARM_ARCH >= 6 > +.It arm64 Ta Dv __aarch64__ > +.It i386 Ta Dv __i386__ > +.It mips Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_o32 > +.It mipsel Ta Dv __mips__, Dv __mips_o32 > +.It mipsn32 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n32 > +.It mips64 Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64 > +.It mips64el Ta Dv __mips__, Dv __mips_n64 > +.It powerpc Ta Dv __powerpc__ > +.It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ > +.It riscv Ta Dv __riscv__, Dv __riscv64 > +.It sparc64 Ta Dv __sparc64__ > +.El > +.Sh SEE ALSO > +.Xr src.conf 5 , > +.Xr build 7 > +.Sh HISTORY > +An > +.Nm > +manual page appeared in > +.Fx 12 . > From owner-svn-src-head@freebsd.org Tue Jul 19 18:40: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 B1DB6B9E03C; Tue, 19 Jul 2016 18:40:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 841CF1CE4; Tue, 19 Jul 2016 18:40:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JIetZG012558; Tue, 19 Jul 2016 18:40:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JIet9V012553; Tue, 19 Jul 2016 18:40:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191840.u6JIet9V012553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 18:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303038 - in head/usr.sbin/makefs: . ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 18:40:56 -0000 Author: emaste Date: Tue Jul 19 18:40:54 2016 New Revision: 303038 URL: https://svnweb.freebsd.org/changeset/base/303038 Log: makefs: sync NetBSD IDs with upstream for changes that we already have May 22 21:51:39 2011 +0000 (christos): From Nathan Whitehorn (nwhitehorn at freebsd dot org): Add code to generate bootable ISOs on Powermac and CHRP systems. Synthesize some partition maps (APM and MBR, respectively) pointing to (a) the whole disk, and (b) relevant El Torito boot images that have been added by other code. These partition maps are a little bit funny looking, but they seem to work. FreeBSD has been using this successfully in their release generation on powerpc, as well as generating all non-SPARC install media. SPARC support could probably be added as an extension of this patch. makefs.8 1.33 Tue Aug 23 17:09:11 2011 +0000 (christos): PR/45285: Martin Matuska: makefs does not properly convert ISO level 1 and 2 filenames (buffer overflow) makefs does not properly verify the maximum filename length in the special "." case for both ISO level 1 and ISO level 2 filename conversion. This creates broken images or causes a buffer overflow (ISO level 2). ISO level 1: If a filename contains only dots or up to 8 characters followed by dots the 8+3 limit check doesn't work. ISO level 2: If a filename contains a dot in the first 30 characters and a dot on the 30th character, the length limit check doesn't work and the buffer is overflowed. $ mkdir level1 $ touch level1/12345............ $ makefs -t cd9660 -o isolevel=1 test.iso level1 $ mkdir level2 $ touch level2/1234567890.2345678901234567.....34567890123456789012345 $ makefs -t cd9660 -o isolevel=2 test.iso level2 cd9660.c 1.32 Sun Oct 9 21:33:43 2011 +0000 (christos): add support for setting the ufs label. (Nathan Whitehorn) ffs.c 1.45 ffs.h 1.2 mkfs.c 1.22 makefs.8 1.37 Obtained from: NetBSD Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/ffs.h head/usr.sbin/makefs/ffs/mkfs.c head/usr.sbin/makefs/makefs.8 Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Tue Jul 19 18:31:19 2016 (r303037) +++ head/usr.sbin/makefs/cd9660.c Tue Jul 19 18:40:54 2016 (r303038) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.31 2011/08/06 23:25:19 christos Exp $ */ +/* $NetBSD: cd9660.c,v 1.32 2011/08/23 17:09:11 christos Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan Modified: head/usr.sbin/makefs/ffs.c ============================================================================== --- head/usr.sbin/makefs/ffs.c Tue Jul 19 18:31:19 2016 (r303037) +++ head/usr.sbin/makefs/ffs.c Tue Jul 19 18:40:54 2016 (r303038) @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.44 2009/04/28 22:49:26 joerg Exp $ */ +/* $NetBSD: ffs.c,v 1.45 2011/10/09 22:49:26 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. Modified: head/usr.sbin/makefs/ffs.h ============================================================================== --- head/usr.sbin/makefs/ffs.h Tue Jul 19 18:31:19 2016 (r303037) +++ head/usr.sbin/makefs/ffs.h Tue Jul 19 18:40:54 2016 (r303038) @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.h,v 1.1 2004/12/20 20:51:42 jmc Exp $ */ +/* $NetBSD: ffs.h,v 1.2 2004/12/20 20:51:42 jmc Exp $ */ /* * Copyright (c) 2001-2003 Wasabi Systems, Inc. Modified: head/usr.sbin/makefs/ffs/mkfs.c ============================================================================== --- head/usr.sbin/makefs/ffs/mkfs.c Tue Jul 19 18:31:19 2016 (r303037) +++ head/usr.sbin/makefs/ffs/mkfs.c Tue Jul 19 18:40:54 2016 (r303038) @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.20 2004/06/24 22:30:13 lukem Exp $ */ +/* $NetBSD: mkfs.c,v 1.22 2011/10/09 22:30:13 christos Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. Modified: head/usr.sbin/makefs/makefs.8 ============================================================================== --- head/usr.sbin/makefs/makefs.8 Tue Jul 19 18:31:19 2016 (r303037) +++ head/usr.sbin/makefs/makefs.8 Tue Jul 19 18:40:54 2016 (r303038) @@ -1,4 +1,4 @@ -.\" $NetBSD: makefs.8,v 1.32 2009/01/20 20:47:25 bjh21 Exp $ +.\" $NetBSD: makefs.8,v 1.33 2011/05/22 21:51:39 christos Exp $ .\" .\" Copyright (c) 2001-2003 Wasabi Systems, Inc. .\" All rights reserved. From owner-svn-src-head@freebsd.org Tue Jul 19 19:00: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 A2A62B9E40B; Tue, 19 Jul 2016 19:00:23 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7540B1898; Tue, 19 Jul 2016 19:00:23 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JJ0MTZ018734; Tue, 19 Jul 2016 19:00:22 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJ0MuB018733; Tue, 19 Jul 2016 19:00:22 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201607191900.u6JJ0MuB018733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 19 Jul 2016 19:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303039 - head/sys/boot/efi/libefi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:00:23 -0000 Author: manu Date: Tue Jul 19 19:00:22 2016 New Revision: 303039 URL: https://svnweb.freebsd.org/changeset/base/303039 Log: Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console. Reviewed by: andrew, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6783 Modified: head/sys/boot/efi/libefi/Makefile Modified: head/sys/boot/efi/libefi/Makefile ============================================================================== --- head/sys/boot/efi/libefi/Makefile Tue Jul 19 18:40:54 2016 (r303038) +++ head/sys/boot/efi/libefi/Makefile Tue Jul 19 19:00:22 2016 (r303039) @@ -35,6 +35,10 @@ CFLAGS+= -I${.CURDIR}/../../common # Handle FreeBSD specific %b and %D printf format specifiers CFLAGS+= ${FORMAT_EXTENSIONS} + +# Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "aarch64" CFLAGS+= -DTERM_EMU +.endif .include From owner-svn-src-head@freebsd.org Tue Jul 19 19:09: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 5DDF6B9E774; Tue, 19 Jul 2016 19:09:25 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE3F1F78; Tue, 19 Jul 2016 19:09:24 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JJ9OgU022488; Tue, 19 Jul 2016 19:09:24 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJ9OGt022486; Tue, 19 Jul 2016 19:09:24 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201607191909.u6JJ9OGt022486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 19 Jul 2016 19:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303040 - in head/sys/dev: nvd nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:09:25 -0000 Author: scottl Date: Tue Jul 19 19:09:23 2016 New Revision: 303040 URL: https://svnweb.freebsd.org/changeset/base/303040 Log: Supporting flushing the dump before returning, and simplify/combine the logic. Switch to a 5us delay since most NVME devices can easily do 200,000 iops. Submitted by: imp MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/dev/nvd/nvd.c head/sys/dev/nvme/nvme_ns_cmd.c Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Tue Jul 19 19:00:22 2016 (r303039) +++ head/sys/dev/nvd/nvd.c Tue Jul 19 19:09:23 2016 (r303040) @@ -237,14 +237,7 @@ nvd_dump(void *arg, void *virt, vm_offse dp = arg; ndisk = dp->d_drv1; - if (len > 0) { - if ((error = nvme_ns_dump(ndisk->ns, virt, offset, len)) != 0) - return (error); - } else { - /* XXX sync to stable storage */ - } - - return (0); + return (nvme_ns_dump(ndisk->ns, virt, offset, len)); } static void Modified: head/sys/dev/nvme/nvme_ns_cmd.c ============================================================================== --- head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 19:00:22 2016 (r303039) +++ head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 19:09:23 2016 (r303040) @@ -153,7 +153,7 @@ nvme_ns_cmd_flush(struct nvme_namespace } /* Timeout = 1 sec */ -#define NVD_DUMP_TIMEOUT 100000 +#define NVD_DUMP_TIMEOUT 200000 int nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, size_t len) @@ -171,14 +171,13 @@ nvme_ns_dump(struct nvme_namespace *ns, return (ENOMEM); cmd = &req->cmd; - cmd->opc = NVME_OPC_WRITE; - cmd->nsid = ns->id; - lba = offset / nvme_ns_get_sector_size(ns); - lba_count = len / nvme_ns_get_sector_size(ns); - - *(uint64_t *)&cmd->cdw10 = lba; - cmd->cdw12 = lba_count - 1; + if (len > 0) { + lba = offset / nvme_ns_get_sector_size(ns); + lba_count = len / nvme_ns_get_sector_size(ns); + nvme_ns_write_cmd(cmd, ns->id, lba, lba_count); + } else + nvme_ns_flush_cmd(cmd, ns->id); nvme_ctrlr_submit_io_request(ns->ctrlr, req); if (req->qpair == NULL) @@ -186,7 +185,7 @@ nvme_ns_dump(struct nvme_namespace *ns, i = 0; while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) { - DELAY(10); + DELAY(5); nvme_qpair_process_completions(req->qpair); } From owner-svn-src-head@freebsd.org Tue Jul 19 19:13: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 2FEADB9EA09; Tue, 19 Jul 2016 19:13:02 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1E74173A; Tue, 19 Jul 2016 19:13:01 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JJD1fD026063; Tue, 19 Jul 2016 19:13:01 GMT (envelope-from rene@FreeBSD.org) Received: (from rene@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJD16E026062; Tue, 19 Jul 2016 19:13:01 GMT (envelope-from rene@FreeBSD.org) Message-Id: <201607191913.u6JJD16E026062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rene set sender to rene@FreeBSD.org using -f From: Rene Ladan Date: Tue, 19 Jul 2016 19:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303041 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:13:02 -0000 Author: rene (doc,ports committer) Date: Tue Jul 19 19:13:01 2016 New Revision: 303041 URL: https://svnweb.freebsd.org/changeset/base/303041 Log: erwin stepped down from portmgr, update the graph. Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Tue Jul 19 19:09:23 2016 (r303040) +++ head/share/misc/organization.dot Tue Jul 19 19:13:01 2016 (r303041) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nantoine, bapt, bdrewery,\nerwin, mat, swills,\nmiwi"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nantoine, bapt, bdrewery,\nmat, swills, miwi"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\ndelphij,\ndes, gavin, gjb,\nglebius, remko"] From owner-svn-src-head@freebsd.org Tue Jul 19 19:19: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 563A5B9EB4E; Tue, 19 Jul 2016 19:19:04 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 288F81A24; Tue, 19 Jul 2016 19:19:04 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JJJ3RG026300; Tue, 19 Jul 2016 19:19:03 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJJ3Xj026299; Tue, 19 Jul 2016 19:19:03 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201607191919.u6JJJ3Xj026299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Tue, 19 Jul 2016 19:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303042 - head/sys/dev/nvd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:19:04 -0000 Author: scottl Date: Tue Jul 19 19:19:03 2016 New Revision: 303042 URL: https://svnweb.freebsd.org/changeset/base/303042 Log: Remove unused variable from last commit. Modified: head/sys/dev/nvd/nvd.c Modified: head/sys/dev/nvd/nvd.c ============================================================================== --- head/sys/dev/nvd/nvd.c Tue Jul 19 19:13:01 2016 (r303041) +++ head/sys/dev/nvd/nvd.c Tue Jul 19 19:19:03 2016 (r303042) @@ -232,7 +232,6 @@ nvd_dump(void *arg, void *virt, vm_offse { struct nvd_disk *ndisk; struct disk *dp; - int error; dp = arg; ndisk = dp->d_drv1; From owner-svn-src-head@freebsd.org Tue Jul 19 19:20: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 89C88B9ED3D; Tue, 19 Jul 2016 19:20:49 +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 60E811DB2; Tue, 19 Jul 2016 19:20:49 +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 u6JJKm5J026426; Tue, 19 Jul 2016 19:20:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJKm7R026421; Tue, 19 Jul 2016 19:20:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607191920.u6JJKm7R026421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 19 Jul 2016 19:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303043 - in head: share/man/man4 sys/dev/vt sys/dev/vt/hw/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:20:49 -0000 Author: cem Date: Tue Jul 19 19:20:47 2016 New Revision: 303043 URL: https://svnweb.freebsd.org/changeset/base/303043 Log: Increase vt(4) framebuffer maximum size And rename "DEFAULT" constants to the more accurate "MAX." PR: 210382 Submitted by: Felix Reviewed by: wblock, cem Tested by: Dave Cottlehuber Modified: head/share/man/man4/vt.4 head/sys/dev/vt/hw/fb/vt_fb.c head/sys/dev/vt/vt.h head/sys/dev/vt/vt_core.c Modified: head/share/man/man4/vt.4 ============================================================================== --- head/share/man/man4/vt.4 Tue Jul 19 19:19:03 2016 (r303042) +++ head/share/man/man4/vt.4 Tue Jul 19 19:20:47 2016 (r303043) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2016 +.Dd July 19, 2016 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -36,8 +36,8 @@ .Cd "options VT_MAXWINDOWS=N" .Cd "options VT_ALT_TO_ESC_HACK=1" .Cd "options VT_TWOBUTTON_MOUSE" -.Cd "options VT_FB_DEFAULT_WIDTH=X" -.Cd "options VT_FB_DEFAULT_HEIGHT=Y" +.Cd "options VT_FB_MAX_WIDTH=X" +.Cd "options VT_FB_MAX_HEIGHT=Y" .Cd "options SC_NO_CUTPASTE" .Cd "device vt" .Pp Modified: head/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.c Tue Jul 19 19:19:03 2016 (r303042) +++ head/sys/dev/vt/hw/fb/vt_fb.c Tue Jul 19 19:20:47 2016 (r303043) @@ -416,10 +416,10 @@ vt_fb_init(struct vt_device *vd) int err; info = vd->vd_softc; - vd->vd_height = MIN(VT_FB_DEFAULT_HEIGHT, info->fb_height); + vd->vd_height = MIN(VT_FB_MAX_HEIGHT, info->fb_height); margin = (info->fb_height - vd->vd_height) >> 1; vd->vd_transpose = margin * info->fb_stride; - vd->vd_width = MIN(VT_FB_DEFAULT_WIDTH, info->fb_width); + vd->vd_width = MIN(VT_FB_MAX_WIDTH, info->fb_width); margin = (info->fb_width - vd->vd_width) >> 1; vd->vd_transpose += margin * (info->fb_bpp / NBBY); vd->vd_video_dev = info->fb_video_dev; Modified: head/sys/dev/vt/vt.h ============================================================================== --- head/sys/dev/vt/vt.h Tue Jul 19 19:19:03 2016 (r303042) +++ head/sys/dev/vt/vt.h Tue Jul 19 19:20:47 2016 (r303043) @@ -377,11 +377,11 @@ void vt_upgrade(struct vt_device *vd); #define PIXEL_WIDTH(w) ((w) / 8) #define PIXEL_HEIGHT(h) ((h) / 16) -#ifndef VT_FB_DEFAULT_WIDTH -#define VT_FB_DEFAULT_WIDTH 2048 +#ifndef VT_FB_MAX_WIDTH +#define VT_FB_MAX_WIDTH 4096 #endif -#ifndef VT_FB_DEFAULT_HEIGHT -#define VT_FB_DEFAULT_HEIGHT 1200 +#ifndef VT_FB_MAX_HEIGHT +#define VT_FB_MAX_HEIGHT 2400 #endif /* name argument is not used yet. */ Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Tue Jul 19 19:19:03 2016 (r303042) +++ head/sys/dev/vt/vt_core.c Tue Jul 19 19:20:47 2016 (r303043) @@ -181,8 +181,8 @@ static void vt_resume_handler(void *priv SET_DECLARE(vt_drv_set, struct vt_driver); -#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)) -#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)) +#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_MAX_HEIGHT)) +#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_MAX_WIDTH)) struct terminal vt_consterm; static struct vt_window vt_conswindow; From owner-svn-src-head@freebsd.org Tue Jul 19 19:44: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 68C45B9E447; Tue, 19 Jul 2016 19:44:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (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 3B7B21C67; Tue, 19 Jul 2016 19:44:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f178.google.com with SMTP id m101so28562545ioi.2; Tue, 19 Jul 2016 12:44:45 -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=RidhlpfJz9m6tNmvxgYWPq7vVqOK36+GZZeLdleewWY=; b=jRSwH0O8JApveckj3KCFaVOJ+qxd0fW49OzEUkd8MixB+u6YCxcB7GWpZCc0yihby7 vb8l06hn/naqvQT6QcRTiJ8THPh638w7emJA2ek+6ugTx8ZKt1uySN8q78ZFO3w9c0gR oB74NPxc/6EKNZhdEnOdhh0AinVLSCVt9Wu/QnT8ooqV1BVJVRZ6E4//stuToSgfQjKJ Ec6bSb8cOAFE8XZP0Iv3IeSbMHayWsRiljI5wp9G5KXRlKzrCqqCPgOEh6zoC6KjSnmV lCB92und8D2eeggPwG/B8U5nu8BBgt3F04BBS5I+WMoHoxaiWK0Jx9t38LhclwECU08Y YdIQ== X-Gm-Message-State: ALyK8tJl+d+yRjBa8H+KYvkN7a6zTFq3F58xbGyRUvMX26I/qeyTYCxysoKjzfV1ec+6eQ== X-Received: by 10.107.157.194 with SMTP id g185mr5518954ioe.82.1468957030276; Tue, 19 Jul 2016 12:37:10 -0700 (PDT) Received: from mail-it0-f44.google.com (mail-it0-f44.google.com. [209.85.214.44]) by smtp.gmail.com with ESMTPSA id w12sm10157653iow.29.2016.07.19.12.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 12:37:10 -0700 (PDT) Received: by mail-it0-f44.google.com with SMTP id f6so29635096ith.0; Tue, 19 Jul 2016 12:37:09 -0700 (PDT) X-Received: by 10.36.76.16 with SMTP id a16mr47567215itb.86.1468957029787; Tue, 19 Jul 2016 12:37:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Tue, 19 Jul 2016 12:37:09 -0700 (PDT) In-Reply-To: <201607191746.u6JHk9ov092270@repo.freebsd.org> References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Conrad Meyer Date: Tue, 19 Jul 2016 12:37:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Maste 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: Tue, 19 Jul 2016 19:44:45 -0000 On Tue, Jul 19, 2016 at 10:46 AM, Ed Maste wrote: > Author: emaste > Date: Tue Jul 19 17:46:09 2016 > New Revision: 303033 > URL: https://svnweb.freebsd.org/changeset/base/303033 > > Log: > add an arch.7 man page with architecture-specific details > > Based on details collected on the wiki, at > https://wiki.freebsd.org/EdMaste/ArchitectureSpecifics > Further details to be added over time. > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D7096 > > Added: > head/share/man/man7/arch.7 (contents, props changed) > Modified: > head/share/man/man7/Makefile > > ... > Added: head/share/man/man7/arch.7 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man7/arch.7 Tue Jul 19 17:46:09 2016 (r303033) > @@ -0,0 +1,171 @@ > ... > +.Ss Predefined Macros > +The compiler provides a number of predefined macros. > +Some of these provide architecture-specific details and are explained below. > +Other macros, including those required by the language standard, are not > +included here. > +.Pp > +The full set of predefined macros can be obtained with this command: > +.Bd -literal -offset indent > +cc -x c -Dm -E /dev/null > +.Ed > +.Pp > +Common type size and endianness macros: > +.Bl -column -offset indent "BYTE_ORDER" ".Sy Meaning" > +.It Sy Macro Ta Sy Meaning > +.It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int > +.It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer ILP32 was only added on CURRENT during the 11 timeframe (the r276479 3.5.0 import), and can't be relied upon for stable/10 or 9, FWIW. (Not useful for ports, for example.) Sure, it's probably okay that this manual page only describes the release it is present in. Best, Conrad From owner-svn-src-head@freebsd.org Tue Jul 19 19:50: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 547D5B9E4EE; Tue, 19 Jul 2016 19:50:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 235AD1E79; Tue, 19 Jul 2016 19:50:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JJoUE4037629; Tue, 19 Jul 2016 19:50:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JJoUAt037628; Tue, 19 Jul 2016 19:50:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607191950.u6JJoUAt037628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 19:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303044 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 19:50:31 -0000 Author: emaste Date: Tue Jul 19 19:50:30 2016 New Revision: 303044 URL: https://svnweb.freebsd.org/changeset/base/303044 Log: arch.7: we also use 1M page mappings on armv6 Submitted by: alc Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Tue Jul 19 19:20:47 2016 (r303043) +++ head/share/man/man7/arch.7 Tue Jul 19 19:50:30 2016 (r303044) @@ -90,7 +90,7 @@ On all supported architectures, .It amd64 Ta 4K, 2M, 1G .It arm Ta 4K .It armeb Ta 4K -.It armv6 Ta 4K +.It armv6 Ta 4K, 1M .It arm64 Ta 4K, 2M, 1G .It i386 Ta 4K, 2M (PAE), 4M .It mips Ta 4K From owner-svn-src-head@freebsd.org Tue Jul 19 19: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 3F29DB9E6EA; Tue, 19 Jul 2016 19:52:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::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 096EB13A7; Tue, 19 Jul 2016 19:52:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22c.google.com with SMTP id j124so30403460ith.1; Tue, 19 Jul 2016 12:52:11 -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=5jz+dgICMsQWiZaNr4ykXe9EX5Y9Mwmj57ly07UofQE=; b=YMml81czA8S4kycfj/UJc/UfMw0CAk+klJPGInnqWA9e6PeMBokmAzqWBAjZjK8KLg HNo3hxw9Y2ndA7OZiLjqvY6kMWZtesUMJjf3Adhw5Aon76zJiJ3HnSe8hbAVPgVn3IJe 4VnwveVXDzMl8e69pSb6PdXvSNHiYX6qh7ED0y8PPgEUTZyroyNwVJFJRgF143NMkMJF J2tFdnHsXRF2op2jTq8l74Ab7AVFeRqWtmhYTlzyGr1eibz62d0V+Xkq/zpCAiiDul++ 5wErepDoO3xIKBArwtBq6Ni8sPQJNJS57U2c+imootiUOnKYNHeIlMd/R+ZDEEY+4fMb f/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:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=5jz+dgICMsQWiZaNr4ykXe9EX5Y9Mwmj57ly07UofQE=; b=JrGCyPckj6JBvQuH6npjQFeI6VPiaxUJpg0aQtnTZNQF8fi8fJjYB6XjBqEvExTD1Z YX1axcR7lzSjLd7IwwYzPUwlsuPoG/rSIPnG2Wiac/ZAVq5WV7PNP8QOyMkIDGI+RDf+ 0YviTAO9bl9KHk0DveyrLt3yyZHWPkcWdVSsksq8zQrHf71QD/EnToaGPAKzHgXEFEIk xtxjbDQDReyfhjVdqxxT7N9u+6Mw1jk431ePEDmCUK55EVKV+65VocwNbiooYtn4WIIU VUpOecv0L/4qFn6zbeZlBvhWNWf7bbVtKc/a4Xf5TiFEYRhtME9CXSbRCdVxey8H6Vcv XRlQ== X-Gm-Message-State: ALyK8tJfw/vObdSr+eX0COUm8e1o32JDeHZfCNALWQFwgPCIoHdj6kRws9KhZp5QlIPJ2PxN3oQxtt+kqt+X0Q== X-Received: by 10.36.111.209 with SMTP id x200mr13614254itb.59.1468957930391; Tue, 19 Jul 2016 12:52:10 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.138.28 with HTTP; Tue, 19 Jul 2016 12:51:51 -0700 (PDT) In-Reply-To: References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Ed Maste Date: Tue, 19 Jul 2016 15:51:51 -0400 X-Google-Sender-Auth: 0dIMWFjyZYNAZ_IAEQDK8KqvGEM Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Conrad Meyer 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: Tue, 19 Jul 2016 19:52:11 -0000 On 19 July 2016 at 15:37, Conrad Meyer wrote: > > ILP32 was only added on CURRENT during the 11 timeframe (the r276479 > 3.5.0 import), and can't be relied upon for stable/10 or 9, FWIW. > (Not useful for ports, for example.) > > Sure, it's probably okay that this manual page only describes the > release it is present in. Good point; I should add a note to clarify this in the page itself. From owner-svn-src-head@freebsd.org Tue Jul 19 20:11: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 BCE5AB9ED88; Tue, 19 Jul 2016 20:11:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D1691ECC; Tue, 19 Jul 2016 20:11:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6JKBo8a046380; Tue, 19 Jul 2016 20:11:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JKBopW046379; Tue, 19 Jul 2016 20:11:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607192011.u6JKBopW046379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Jul 2016 20:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303045 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 20:11:51 -0000 Author: emaste Date: Tue Jul 19 20:11:50 2016 New Revision: 303045 URL: https://svnweb.freebsd.org/changeset/base/303045 Log: arch.7: correct MIPS endianness transcription error Submitted by: Nikolai Lifanov Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Tue Jul 19 19:50:30 2016 (r303044) +++ head/share/man/man7/arch.7 Tue Jul 19 20:11:50 2016 (r303045) @@ -74,10 +74,10 @@ On all supported architectures, .It armv6 Ta little Ta unsigned .It arm64 Ta little Ta unsigned .It i386 Ta little Ta signed -.It mips Ta little Ta signed -.It mipsel Ta big Ta signed -.It mipsn32 Ta little Ta signed -.It mips64 Ta little Ta signed +.It mips Ta big Ta signed +.It mipsel Ta little Ta signed +.It mipsn32 Ta big Ta signed +.It mips64 Ta big Ta signed .It mips64el Ta little Ta signed .It powerpc Ta big Ta unsigned .It powerpc64 Ta big Ta unsigned From owner-svn-src-head@freebsd.org Tue Jul 19 20:15: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 CFBC1B9EE31; Tue, 19 Jul 2016 20:15:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (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 8ABEB1343; Tue, 19 Jul 2016 20:15:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f178.google.com with SMTP id m101so29282564ioi.2; Tue, 19 Jul 2016 13:15:10 -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=1ihLwqFX5XNSv3NKtG+W+XEh3Uu+Xn7+UvT2EjNkSDY=; b=FF4VlzyRtAnkuT8d77fdEp+inXM60ozBvau+jtKZygtH3FhIv8/RDTUuP3KUBfrXcB x1qgSwSRWV+adIZyPnvO6jYiT6gbYk8k/hc0empMMwjvnr9PzEVLco55u3cGnMYiVHrU zE0Y654YiSHVddDBv31nJxh0b0jGwt7H3mcz/6EPwwQ+0aOfE335egkyI4aDL/SVZf4W IS5CjdZUxZAEvDRE/V3bZNZ8uKcTUvAQswOfoWmuVIfS3q+LYRM2KVo7ULKNdlmS65uD Qay7ZMT4PNMCdIgF4CeD6AOlUR22NTqMju9DfqYGV1UQClmSp6Ibx7e5oqROn3e1aDOC dRCw== X-Gm-Message-State: ALyK8tJMZ8YpMHTRkfO/nuE7S+yX5QhmLm5dNFhVJhxk7yCpe0BU3RTmK2UJqVDxWgUtlg== X-Received: by 10.107.131.38 with SMTP id f38mr43009029iod.173.1468959309662; Tue, 19 Jul 2016 13:15:09 -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 o74sm11466393ioe.37.2016.07.19.13.15.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 13:15:09 -0700 (PDT) Received: by mail-io0-f182.google.com with SMTP id b62so29225549iod.3; Tue, 19 Jul 2016 13:15:09 -0700 (PDT) X-Received: by 10.107.56.70 with SMTP id f67mr10761276ioa.162.1468959309034; Tue, 19 Jul 2016 13:15:09 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Tue, 19 Jul 2016 13:15:08 -0700 (PDT) In-Reply-To: References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Conrad Meyer Date: Tue, 19 Jul 2016 13:15:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Maste 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: Tue, 19 Jul 2016 20:15:10 -0000 On Tue, Jul 19, 2016 at 12:51 PM, Ed Maste wrote: > On 19 July 2016 at 15:37, Conrad Meyer wrote: >> >> ILP32 was only added on CURRENT during the 11 timeframe (the r276479 >> 3.5.0 import), and can't be relied upon for stable/10 or 9, FWIW. >> (Not useful for ports, for example.) >> >> Sure, it's probably okay that this manual page only describes the >> release it is present in. > > Good point; I should add a note to clarify this in the page itself. Alternatively, it looks like a pretty trivial backport. But I'm not volunteering :-). Best, Conrad From owner-svn-src-head@freebsd.org Tue Jul 19 20:22: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 839C0B9E036; Tue, 19 Jul 2016 20:22:14 +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 3A3501807; Tue, 19 Jul 2016 20:22:14 +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 u6JKMD6t051362; Tue, 19 Jul 2016 20:22:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JKMDJD051361; Tue, 19 Jul 2016 20:22:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607192022.u6JKMDJD051361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 19 Jul 2016 20:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303046 - 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: Tue, 19 Jul 2016 20:22:14 -0000 Author: pfg Date: Tue Jul 19 20:22:13 2016 New Revision: 303046 URL: https://svnweb.freebsd.org/changeset/base/303046 Log: libc: tag the Rune initialization function prototypes visibility as hidden. It is good practice to export as few symbols as possible from your shared libraries, so use the GCC visibility attribute in this case, matching what Apple's libc does. Reference: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html Hinted by: Apple's libc 1082.20.4 MFC after: 1 week Modified: head/lib/libc/locale/mblocal.h Modified: head/lib/libc/locale/mblocal.h ============================================================================== --- head/lib/libc/locale/mblocal.h Tue Jul 19 20:11:50 2016 (r303045) +++ head/lib/libc/locale/mblocal.h Tue Jul 19 20:22:13 2016 (r303046) @@ -65,18 +65,18 @@ extern struct xlocale_ctype __xlocale_gl /* * Rune initialization function prototypes. */ -int _none_init(struct xlocale_ctype *, _RuneLocale *); -int _UTF8_init(struct xlocale_ctype *, _RuneLocale *); -int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *); -int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *); -int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *); -int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *); -int _GB18030_init(struct xlocale_ctype *, _RuneLocale *); -int _GB2312_init(struct xlocale_ctype *, _RuneLocale *); -int _GBK_init(struct xlocale_ctype *, _RuneLocale *); -int _BIG5_init(struct xlocale_ctype *, _RuneLocale *); -int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *); -int _ascii_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _none_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _ascii_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _UTF8_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _GB18030_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _GB2312_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _GBK_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _BIG5_init(struct xlocale_ctype *, _RuneLocale *); +__hidden int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *); typedef size_t (*mbrtowc_pfn_t)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); From owner-svn-src-head@freebsd.org Tue Jul 19 20:46: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 CB3FEB9E47C for ; Tue, 19 Jul 2016 20:46:37 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x230.google.com (mail-yw0-x230.google.com [IPv6:2607:f8b0:4002:c05::230]) (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 A16E814F4 for ; Tue, 19 Jul 2016 20:46:37 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x230.google.com with SMTP id j12so20348368ywb.2 for ; Tue, 19 Jul 2016 13:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=32Nh8wp85blDdmxcfnJJ/NxrblebtXF8R41u9mnqToc=; b=D2pmgsQAxtcZVKPMt7rS4L1Qw8pUzkdOseVplfC+FJpNHhRfX7sMd21yKbEzwS5yJ2 70+PK9/UjjguGP260ofNUmOfF2SJpeeI86DugkHozomk4qLg+uBlCLsQmgvw8YBVoy8z pt4EIvHzIX8Gafx4hv9hORoLwrfnagl/t0RLIC3lZZFHgE1AkxfEB65tttGkGJ3N5G4y TW4TzycOkiHaKtOUlUHS5km2UgEYmsdLRP+0hEYHJLgCkvJc2ATkmfI2JPE/3nKGNVo8 qsLrZ0gm2b7CXUrsekqGeOxcBMDExDQUnCjOAUaw0I+WfyYK6tvyjiEeOSLN3ToVMmNo ushg== 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=32Nh8wp85blDdmxcfnJJ/NxrblebtXF8R41u9mnqToc=; b=eKJs8sEGCBTOA52GtfhYf/emYqHDTl4DspZdr1WrmOYcgWvsCa1GUlKyvfgwTYt8qv JsBU++abcmoRCIFNpj3RJP7KoQVokpb62BZn59pPURHaJ7bcv+HGvC89kA/Ey3F1Bi28 Ifu4kszCtGPEdd4pzjsl3o0ETEBtn8TJzbGhyfthkahfnGyj3/2BrAEToAVshyHt8Yez deMZxOOFvktAEIdR51lp0pAiITY0mh7yarqCWtz9ysRlzt50mAfeLZ09oGRjsEF54ppf dY8+IsBbdMH0wkPhRwMv5wmsqPSIoiClTr0YLe7AxkCa/1Ns+6pxqhrq+HwjyzEqZjPY eWRw== X-Gm-Message-State: ALyK8tKuEuTbT59uajJY+XPIc137LOanput4oOzv9Y1TkywzBr0WqbAHoZfx4BFLKafpGQsb0A/kDPGlfb5IUg== X-Received: by 10.37.114.2 with SMTP id n2mr26299951ybc.54.1468961196641; Tue, 19 Jul 2016 13:46:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.201.71 with HTTP; Tue, 19 Jul 2016 13:46:36 -0700 (PDT) In-Reply-To: <201607192022.u6JKMDJD051361@repo.freebsd.org> References: <201607192022.u6JKMDJD051361@repo.freebsd.org> From: Ed Schouten Date: Tue, 19 Jul 2016 22:46:36 +0200 Message-ID: Subject: Re: svn commit: r303046 - head/lib/libc/locale To: "Pedro F. Giffuni" 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: Tue, 19 Jul 2016 20:46:37 -0000 Hi Pedro, 2016-07-19 22:22 GMT+02:00 Pedro F. Giffuni : > Author: pfg > Date: Tue Jul 19 20:22:13 2016 > New Revision: 303046 > URL: https://svnweb.freebsd.org/changeset/base/303046 > > Log: > libc: tag the Rune initialization function prototypes visibility as hidden. How does this interact with symbol versioning/mapping? Wouldn't our C library's symbol map already make these symbols hidden without any explicit annotation? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Tue Jul 19 21:22: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 25660B9EE43 for ; Tue, 19 Jul 2016 21:22:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm18-vm0.bullet.mail.bf1.yahoo.com (nm18-vm0.bullet.mail.bf1.yahoo.com [98.139.213.138]) (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 CA7AD16D9 for ; Tue, 19 Jul 2016 21:22:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1468963350; bh=LbMhfiZVPIPTqKi5gWy6Tm6HEmPKqxE5aidTGIQUNSc=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=SuhjVNInYNml1vQVPWhsSMxd3lvpc1dUeSMCEO70HmkReGqk8qds1NZIL1o4YhiCDJtDuK77kLnh/oUe7QuRbprIBENjRPlhvnyItcXms9xY0H+psMq9lg6xD6AiILHqvjclp07xhNquuSgXGYsBPVsSNdX307E7nRSYlSLruy/Nu2YTzJmpCrGEYJH0y4IbXxPFuh1hgdV7ZE/tP6qfzFC4N//w5NSIQtOI2szh9F0WXOHljol6N33l07hXDeRqjmyH46CKEbu0x3BWUBiC/xAOuqdUXWjEQIJmTOJQR76gra5oZX6DassuzDeMjGwnShEZ3ROunR5qvXrhWV8K6A== Received: from [98.139.170.181] by nm18.bullet.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 21:22:30 -0000 Received: from [98.139.211.194] by tm24.bullet.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 21:22:30 -0000 Received: from [127.0.0.1] by smtp203.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 21:22:30 -0000 X-Yahoo-Newman-Id: 870474.29954.bm@smtp203.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Ff.odvsVM1l6UaWimbtRRuTdayr.Xpa6SxGgpUf9nJJIFH_ p7M53a1dwP3h8qNojmYWy1uzNoCKdsYLMUKrEolib3G4.JIqvMlhZKdftqD2 mqOjZJH98fXMCZlfFl_J.MDH6AEIVS0DT_yzz_00E3q2HjR6QIRrwyFbsfEG Xm8C7X7XP44L1qESrCTePZUOXmQKuVtpqF0XsZ1Byh.0QxGyx1YFlclc3hcf 3_34SehGLvA4wLVQch.hj5uWSYnP17ZlzyLUejkSShiyuW.kGQrW9ySJUbUz lF1HXaK0FjNwUKUvndTlLeRykK4w.Fa3OixLL3PhD4McyDE6ZE0WDclEhA4W 4Tpy4gekaRI4hrRC7JoKRS5u8uoDzF8obt7KG9JPkY6ZxMRpxvysg_vJLtaM 1gNGz5VfWGgAPqIsXfVNDkg4SOe04ExwUdRRF8zbROd2fgw7351eyhhzp29F uxBnDCt2VpHh0Ni._KkLcM9GnQ0fMaLxiql.07ZK5zYySX6qMtdG4mtoUB.R 8ZJpjt9ztB5qBaAQlFg7ahnro0wwwAc2gkoMApoNjAV3TfA-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303046 - head/lib/libc/locale To: Ed Schouten References: <201607192022.u6JKMDJD051361@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <0273c74d-fc3b-8bf9-9c79-8bc8101943dc@FreeBSD.org> Date: Tue, 19 Jul 2016 16:22:33 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: 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: Tue, 19 Jul 2016 21:22:39 -0000 Hi; On 07/19/16 15:46, Ed Schouten wrote: > Hi Pedro, > > 2016-07-19 22:22 GMT+02:00 Pedro F. Giffuni : >> Author: pfg >> Date: Tue Jul 19 20:22:13 2016 >> New Revision: 303046 >> URL: https://svnweb.freebsd.org/changeset/base/303046 >> >> Log: >> libc: tag the Rune initialization function prototypes visibility as hidden. > > How does this interact with symbol versioning/mapping? Wouldn't our C > library's symbol map already make these symbols hidden without any > explicit annotation? > It shouldn't hurt at all, this is not the first use that we make of the visibility attributes in libc. I do notice we tend to put them at the end of the prototype, while I followed the Apple notation of setting them in front. No idea if that is worthwhile to change. It is true that these symbols should already be hidden but in the case some port is using -fvisibility= compiler flag this will prevent the symbols from getting exported by accident. Pedro. From owner-svn-src-head@freebsd.org Tue Jul 19 21:57: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 2BBC6B9E431; Tue, 19 Jul 2016 21:57:32 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E220C15BA; Tue, 19 Jul 2016 21:57:31 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 448E6358C62; Tue, 19 Jul 2016 23:57:28 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 2906828494; Tue, 19 Jul 2016 23:57:28 +0200 (CEST) Date: Tue, 19 Jul 2016 23:57:28 +0200 From: Jilles Tjoelker To: Ed Schouten Cc: "Pedro F. Giffuni" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303046 - head/lib/libc/locale Message-ID: <20160719215727.GA45133@stack.nl> References: <201607192022.u6JKMDJD051361@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 21:57:32 -0000 On Tue, Jul 19, 2016 at 10:46:36PM +0200, Ed Schouten wrote: > 2016-07-19 22:22 GMT+02:00 Pedro F. Giffuni : > > Author: pfg > > Date: Tue Jul 19 20:22:13 2016 > > New Revision: 303046 > > URL: https://svnweb.freebsd.org/changeset/base/303046 > > Log: > > libc: tag the Rune initialization function prototypes visibility > > as hidden. > How does this interact with symbol versioning/mapping? Wouldn't our C > library's symbol map already make these symbols hidden without any > explicit annotation? Trying to export (using a version script) a symbol with hidden visibility attribute is an error, but GNU ld might accept it and fix it up using text relocations or by not exporting the symbol. Although both version scripts and visibility attributes can be used to prevent exporting symbols, the goals are different. The goal of version scripts is to enforce that no symbol is exported that is not in the version script. The goal of visibility attributes is to optimize performance and code size. For example, on i386, a function without visibility attributes that is not exported is called directly but still has %ebx set up for the PLT entry. This not only adds extra instructions and stack usage but also prevents tail calls (clang called the GOT entry indirectly for a while to allow tail calls but this was removed because some code depended on lazy resolution which requires PLT entries). -- Jilles Tjoelker From owner-svn-src-head@freebsd.org Tue Jul 19 22:13: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 603EFB9E9F7 for ; Tue, 19 Jul 2016 22:13:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm21.bullet.mail.bf1.yahoo.com (nm21.bullet.mail.bf1.yahoo.com [98.139.212.180]) (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 185131EB2 for ; Tue, 19 Jul 2016 22:13:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1468965602; bh=HOw0gpEXTSRcF4V++5k8G8Pb0aMbQyyjJUTKc91txdk=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=DFV7DXkuREnccsQ8VEEYGLm2Q4aIK6Je5+YX+5LM/1FbLlNhLn+KUl8UFhchEUaiXXXEHUdDy1jclBtafBH0EblztIb2xnJpVLr4UyMwjZCJ8nNXOmX9TW6TA6j7crUmmesyW7jstTIPYNVEW0b95t6t8RoJrIlqoM78+VEmCOLyCOPGFnriUXQ1rTjMRsFNy1+y8iEpfqRZ+qgciCTgaSZgK3ECDIf0vkpgr4QuKz451MNGz64C2TxMjcHl9GbNu/K5P9J2CCuUrkTtzJbDQdYVivmsZl4TUt/qtaRs8yu3n5dJOlP39K3TdE20+asSFwX2gXZZT/XHVFgh3MYPCw== Received: from [66.196.81.174] by nm21.bullet.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 22:00:02 -0000 Received: from [68.142.230.64] by tm20.bullet.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 22:00:02 -0000 Received: from [127.0.0.1] by smtp221.mail.bf1.yahoo.com with NNFMP; 19 Jul 2016 22:00:02 -0000 X-Yahoo-Newman-Id: 845823.50913.bm@smtp221.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: NmP7zdIVM1lBVleoPpm22kzUqU6rjwSYQFbdphhp95Gy9iV XcY0U4Wk_ufgZSjhFpAPQEn_v9buopmTuEg2bMfdCNRZqYUTcP51MuWtITTq oy_M15fNWlU8QNQp1UmMZZwrh3CB3U5qiYqM12C2elxbuINZ6Dmk9fO4FTkw wZn2S0Mx6G2sukYjn4K1a3fFCdQvS7BBwYNRlNtpTj.9e2DHtLEv8W.2x0QP fftssXbC_1VIkWjG__.M82wcEG_EiMQlscLlBRCLjGc9RGgqHEZvwLJmeo7b QStO1bEuc9uW8UIgPDIHexJdDJPlAkwHREjobFfFmjPdn2piksOM3.IWPUyM 3x286eO2WB0SH9v8xRSi2F07LEUDaMxWna3WhwL7JD1aI7l8hRqhwssAUpk_ xIB7s_d1h1I9GKgYxSjr5b8yJzevVLn6ONmdIkJvHRIqW0wbEjVZOfsRzrZB 4nquQ34tizFKmm1Hcm8cd6fMocLUXoKeXTSLcYltxyvslJSEDqnxO_Oqm3h0 wVJhwsC6GfjQJ1bPYp2JnMO9H60E3TJIi8TEJ8t6rKlaagw-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303046 - head/lib/libc/locale To: Ed Schouten References: <201607192022.u6JKMDJD051361@repo.freebsd.org> <0273c74d-fc3b-8bf9-9c79-8bc8101943dc@FreeBSD.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: Date: Tue, 19 Jul 2016 17:00:05 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <0273c74d-fc3b-8bf9-9c79-8bc8101943dc@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: Tue, 19 Jul 2016 22:13:56 -0000 On 07/19/16 16:22, Pedro Giffuni wrote: > Hi; > > On 07/19/16 15:46, Ed Schouten wrote: >> Hi Pedro, >> >> 2016-07-19 22:22 GMT+02:00 Pedro F. Giffuni : >>> Author: pfg >>> Date: Tue Jul 19 20:22:13 2016 >>> New Revision: 303046 >>> URL: https://svnweb.freebsd.org/changeset/base/303046 >>> >>> Log: >>> libc: tag the Rune initialization function prototypes visibility as >>> hidden. >> >> How does this interact with symbol versioning/mapping? Wouldn't our C >> library's symbol map already make these symbols hidden without any >> explicit annotation? >> > > It shouldn't hurt at all, this is not the first use that we make of the > visibility attributes in libc. I do notice we tend to put them at the > end of the prototype, while I followed the Apple notation of setting > them in front. No idea if that is worthwhile to change. > > It is true that these symbols should already be hidden but in the case > some port is using -fvisibility= compiler flag this will prevent the > symbols from getting exported by accident. > Hmm... actually, you probably can't unhide the regular functions with -fvisibility. It just doesn't hurt to have the extra insurance, plus it's generally not wrong to be compatible with Apple ;). Pedro. From owner-svn-src-head@freebsd.org Tue Jul 19 22:56: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 6C9F0B9E267; Tue, 19 Jul 2016 22:56:42 +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 3E6D512C1; Tue, 19 Jul 2016 22:56:42 +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 u6JMufRb007511; Tue, 19 Jul 2016 22:56:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6JMuewv007503; Tue, 19 Jul 2016 22:56:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607192256.u6JMuewv007503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 19 Jul 2016 22:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303047 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 19 Jul 2016 22:56:42 -0000 Author: pfg Date: Tue Jul 19 22:56:40 2016 New Revision: 303047 URL: https://svnweb.freebsd.org/changeset/base/303047 Log: sed(1): Assorted cleanups and simplifications. Const-ify several variables, make it build cleanly with WARNS level 5. Submitted by: mi PR: 195929 MFC after: 1 month Modified: head/usr.bin/sed/Makefile head/usr.bin/sed/compile.c head/usr.bin/sed/defs.h head/usr.bin/sed/extern.h head/usr.bin/sed/main.c head/usr.bin/sed/misc.c head/usr.bin/sed/process.c Modified: head/usr.bin/sed/Makefile ============================================================================== --- head/usr.bin/sed/Makefile Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/Makefile Tue Jul 19 22:56:40 2016 (r303047) @@ -6,7 +6,7 @@ PROG= sed SRCS= compile.c main.c misc.c process.c -WARNS?= 2 +WARNS?= 5 .if ${MK_TESTS} != "no" SUBDIR+= tests Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/compile.c Tue Jul 19 22:56:40 2016 (r303047) @@ -64,21 +64,21 @@ static struct labhash { int lh_ref; } *labels[LHSZ]; -static char *compile_addr(char *, struct s_addr *); -static char *compile_ccl(char **, char *); -static char *compile_delimited(char *, char *, int); -static char *compile_flags(char *, struct s_subst *); -static regex_t *compile_re(char *, int); -static char *compile_subst(char *, struct s_subst *); -static char *compile_text(void); -static char *compile_tr(char *, struct s_tr **); +static const char *compile_addr(const char *, struct s_addr *); +static char *compile_ccl(const char **, char *); +static const char *compile_delimited(const char *, char *, int); +static const char *compile_flags(const char *, struct s_subst *); +static const regex_t *compile_re(const char *, int); +static const char *compile_subst(const char *, struct s_subst *); +static char *compile_text(size_t *); +static const char *compile_tr(const char *, struct s_tr **); static struct s_command **compile_stream(struct s_command **); -static char *duptoeol(char *, const char *); +static char *duptoeol(const char *, const char *, size_t *); static void enterlabel(struct s_command *); static struct s_command - *findlabel(char *); -static void fixuplabel(struct s_command *, struct s_command *); + *findlabel(const char *); +static void fixuplabel(struct s_command *, const struct s_command *); static void uselabel(void); /* @@ -144,17 +144,20 @@ compile(void) err(1, "malloc"); } -#define EATSPACE() do { \ - if (p) \ - while (*p && isspace((unsigned char)*p)) \ - p++; \ +#define EATSPACE() do { \ + while (*p && isspace((unsigned char)*p)) \ + p++; \ + } while (0) + +#define EATSPACEN() do { \ + while (*p && *p != '\n' && isspace((unsigned char)*p)) \ + p++; \ } while (0) static struct s_command ** compile_stream(struct s_command **link) { - char *p; - static char lbuf[_POSIX2_LINE_MAX + 1]; /* To save stack */ + const char *p; struct s_command *cmd, *cmd2, *stack; struct s_format *fp; char re[_POSIX2_LINE_MAX + 1]; @@ -162,22 +165,22 @@ compile_stream(struct s_command **link) stack = NULL; for (;;) { - if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) { + if ((p = cu_fgets(NULL)) == NULL) { if (stack != NULL) errx(1, "%lu: %s: unexpected EOF (pending }'s)", linenum, fname); return (link); } -semicolon: EATSPACE(); - if (p) { - if (*p == '#' || *p == '\0') - continue; - else if (*p == ';') { - p++; - goto semicolon; - } +semicolon: EATSPACEN(); + switch (*p) { + case '#': case '\0': case '\n': + continue; /* to next command-unit */ + case ';': + p++; + goto semicolon; } + if ((*link = cmd = malloc(sizeof(struct s_command))) == NULL) err(1, "malloc"); link = &cmd->next; @@ -208,14 +211,14 @@ semicolon: EATSPACE(); cmd->a1 = cmd->a2 = NULL; nonsel: /* Now parse the command */ - if (!*p) + if (*p == '\0' || *p == '\n') errx(1, "%lu: %s: command expected", linenum, fname); cmd->code = *p; for (fp = cmd_fmts; fp->code; fp++) if (fp->code == *p) break; if (!fp->code) - errx(1, "%lu: %s: invalid command code %c", linenum, fname, *p); + errx(1, "%lu: %s: invalid command code %c (%s)", linenum, fname, *p, p); if (naddr > fp->naddr) errx(1, "%lu: %s: command %c expects up to %d address(es), found %d", @@ -228,11 +231,11 @@ nonsel: /* Now parse the command */ goto nonsel; case GROUP: /* { */ p++; - EATSPACE(); + EATSPACEN(); cmd->next = stack; stack = cmd; link = &cmd->u.c; - if (*p) + if (*p != '\0' && *p != '\n') goto semicolon; break; case ENDGROUP: @@ -249,13 +252,13 @@ nonsel: /* Now parse the command */ /*FALLTHROUGH*/ case EMPTY: /* d D g G h H l n N p P q x = \0 */ p++; - EATSPACE(); + EATSPACEN(); if (*p == ';') { p++; link = &cmd->next; goto semicolon; } - if (*p) + if (*p != '\0' && *p != '\n') errx(1, "%lu: %s: extra characters at the end of %c command", linenum, fname, cmd->code); break; @@ -266,12 +269,12 @@ nonsel: /* Now parse the command */ errx(1, "%lu: %s: command %c expects \\ followed by text", linenum, fname, cmd->code); p++; - EATSPACE(); - if (*p) + EATSPACEN(); + if (*p != '\n') errx(1, - "%lu: %s: extra characters after \\ at the end of %c command", - linenum, fname, cmd->code); - cmd->t = compile_text(); + "%lu: %s: extra characters (%c) after \\ at the end of %c command", + linenum, fname, *p, cmd->code); + cmd->t = compile_text(&cmd->tlen); break; case COMMENT: /* \0 # */ break; @@ -280,10 +283,10 @@ nonsel: /* Now parse the command */ EATSPACE(); if (*p == '\0') errx(1, "%lu: %s: filename expected", linenum, fname); - cmd->t = duptoeol(p, "w command"); + cmd->t = duptoeol(p, "w command", &cmd->tlen); if (aflag) cmd->u.fd = -1; - else if ((cmd->u.fd = open(p, + else if ((cmd->u.fd = open(cmd->t, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) err(1, "%s", p); @@ -294,27 +297,27 @@ nonsel: /* Now parse the command */ if (*p == '\0') errx(1, "%lu: %s: filename expected", linenum, fname); else - cmd->t = duptoeol(p, "read command"); + cmd->t = duptoeol(p, "read command", &cmd->tlen); break; case BRANCH: /* b t */ p++; - EATSPACE(); - if (*p == '\0') + EATSPACEN(); + if (*p == '\0' || *p == '\n') cmd->t = NULL; else - cmd->t = duptoeol(p, "branch"); + cmd->t = duptoeol(p, "branch", &cmd->tlen); break; case LABEL: /* : */ p++; EATSPACE(); - cmd->t = duptoeol(p, "label"); - if (strlen(p) == 0) + cmd->t = duptoeol(p, "label", &cmd->tlen); + if (cmd->t[0] == '\0') errx(1, "%lu: %s: empty label", linenum, fname); enterlabel(cmd); break; case SUBST: /* s */ p++; - if (*p == '\0' || *p == '\\') + if (*p == '\0' || *p == '\\' || *p == '\n') errx(1, "%lu: %s: substitute pattern can not be delimited by newline or backslash", linenum, fname); @@ -325,21 +328,15 @@ nonsel: /* Now parse the command */ errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); - /* Compile RE with no case sensitivity temporarily */ - if (*re == '\0') - cmd->u.s->re = NULL; - else - cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); - /* Recompile RE with case sensitivity from "I" flag if any */ - if (*re == '\0') - cmd->u.s->re = NULL; - else + if (*re != '\0') cmd->u.s->re = compile_re(re, cmd->u.s->icase); + EATSPACE(); + if (*p == ';') { p++; link = &cmd->next; @@ -372,8 +369,8 @@ nonsel: /* Now parse the command */ * in the case of a non-terminated string. The character array d is filled * with the processed string. */ -static char * -compile_delimited(char *p, char *d, int is_tr) +static const char * +compile_delimited(const char *p, char *d, int is_tr) { char c; @@ -416,10 +413,10 @@ compile_delimited(char *p, char *d, int /* compile_ccl: expand a POSIX character class */ static char * -compile_ccl(char **sp, char *t) +compile_ccl(const char **sp, char *t) { int c, d; - char *s = *sp; + const char *s = *sp; *t++ = *s++; if (*s == '^') @@ -441,8 +438,8 @@ compile_ccl(char **sp, char *t) * regular expression. * Cflags are passed to regcomp. */ -static regex_t * -compile_re(char *re, int case_insensitive) +static const regex_t * +compile_re(const char *re, int case_insensitive) { regex_t *rep; int eval, flags; @@ -466,14 +463,13 @@ compile_re(char *re, int case_insensitiv * point to a saved copy of it. Nsub is the number of parenthesized regular * expressions. */ -static char * -compile_subst(char *p, struct s_subst *s) +static const char * +compile_subst(const char *p, struct s_subst *s) { - static char lbuf[_POSIX2_LINE_MAX + 1]; int asize, size; u_char ref; char c, *text, *op, *sp; - int more = 1, sawesc = 0; + int more = 0, sawesc = 0; c = *p++; /* Terminator character */ if (c == '\0') @@ -487,7 +483,7 @@ compile_subst(char *p, struct s_subst *s size = 0; do { op = sp = text + size; - for (; *p; p++) { + for (; *p != '\0' && *p != '\n'; p++) { if (*p == '\\' || sawesc) { /* * If this is a continuation from the last @@ -509,7 +505,10 @@ compile_subst(char *p, struct s_subst *s */ sawesc = 1; p--; - continue; + break; + } else if (*p == '\n') { + *sp++ = '\n'; + break; } else if (strchr("123456789", *p) != NULL) { *sp++ = '\\'; ref = *p - '0'; @@ -523,8 +522,11 @@ compile_subst(char *p, struct s_subst *s *sp++ = '\\'; } else if (*p == c) { if (*++p == '\0' && more) { - if (cu_fgets(lbuf, sizeof(lbuf), &more)) - p = lbuf; + const char *nextp; + + nextp = cu_fgets(&more); + if (nextp != NULL) + p = nextp; } *sp++ = '\0'; size += sp - op; @@ -544,7 +546,7 @@ compile_subst(char *p, struct s_subst *s if ((text = realloc(text, asize)) == NULL) err(1, "realloc"); } - } while (cu_fgets(p = lbuf, sizeof(lbuf), &more)); + } while ((p = cu_fgets(&more))); errx(1, "%lu: %s: unterminated substitute in regular expression", linenum, fname); /* NOTREACHED */ @@ -553,12 +555,12 @@ compile_subst(char *p, struct s_subst *s /* * Compile the flags of the s command */ -static char * -compile_flags(char *p, struct s_subst *s) +static const char * +compile_flags(const char *p, struct s_subst *s) { int gn; /* True if we have seen g or n */ unsigned long nval; - char wfile[_POSIX2_LINE_MAX + 1], *q, *eq; + char *q; s->n = 1; /* Default */ s->p = 0; @@ -566,7 +568,7 @@ compile_flags(char *p, struct s_subst *s s->wfd = -1; s->icase = 0; for (gn = 0;;) { - EATSPACE(); /* EXTENSION */ + EATSPACEN(); /* EXTENSION */ switch (*p) { case 'g': if (gn) @@ -594,13 +596,13 @@ compile_flags(char *p, struct s_subst *s "%lu: %s: more than one number or 'g' in substitute flags", linenum, fname); gn = 1; errno = 0; - nval = strtol(p, &p, 10); + nval = strtol(p, &q, 10); if (errno == ERANGE || nval > INT_MAX) errx(1, "%lu: %s: overflow in the 'N' substitute flag", linenum, fname); s->n = nval; - p--; - break; + p = q; + continue; case 'w': p++; #ifdef HISTORIC_PRACTICE @@ -610,27 +612,15 @@ compile_flags(char *p, struct s_subst *s } #endif EATSPACE(); - q = wfile; - eq = wfile + sizeof(wfile) - 1; - while (*p) { - if (*p == '\n') - break; - if (q >= eq) - err(1, "wfile too long"); - *q++ = *p++; - } - *q = '\0'; - if (q == wfile) - errx(1, "%lu: %s: no wfile specified", linenum, fname); - s->wfile = strdup(wfile); - if (!aflag && (s->wfd = open(wfile, + s->wfile = duptoeol(p, "w flag", NULL); + if (!aflag && (s->wfd = open(s->wfile, O_WRONLY|O_APPEND|O_CREAT|O_TRUNC, DEFFILEMODE)) == -1) - err(1, "%s", wfile); + err(1, "%s", s->wfile); return (p); default: - errx(1, "%lu: %s: bad flag in substitute command: '%c'", - linenum, fname, *p); + errx(1, "%lu: %s: bad flag in substitute command: '%c' (%.10s)", + linenum, fname, *p, p); break; } p++; @@ -640,8 +630,8 @@ compile_flags(char *p, struct s_subst *s /* * Compile a translation set of strings into a lookup table. */ -static char * -compile_tr(char *p, struct s_tr **py) +static const char * +compile_tr(const char *p, struct s_tr **py) { struct s_tr *y; int i; @@ -652,7 +642,7 @@ compile_tr(char *p, struct s_tr **py) mbstate_t mbs1, mbs2; if ((*py = y = malloc(sizeof(*y))) == NULL) - err(1, NULL); + err(1, "malloc"); y->multis = NULL; y->nmultis = 0; @@ -672,11 +662,11 @@ compile_tr(char *p, struct s_tr **py) op = old; oldlen = mbsrtowcs(NULL, &op, 0, NULL); if (oldlen == (size_t)-1) - err(1, NULL); + err(1, "mbsrtowcs"); np = new; newlen = mbsrtowcs(NULL, &np, 0, NULL); if (newlen == (size_t)-1) - err(1, NULL); + err(1, "mbsrtowcs"); if (newlen != oldlen) errx(1, "%lu: %s: transform strings are not the same length", linenum, fname); @@ -715,7 +705,7 @@ compile_tr(char *p, struct s_tr **py) y->multis = realloc(y->multis, (y->nmultis + 1) * sizeof(*y->multis)); if (y->multis == NULL) - err(1, NULL); + err(1, "realloc"); i = y->nmultis++; y->multis[i].fromlen = oclen; memcpy(y->multis[i].from, op, oclen); @@ -733,23 +723,24 @@ compile_tr(char *p, struct s_tr **py) * Compile the text following an a, c, or i command. */ static char * -compile_text(void) +compile_text(size_t *ptlen) { int asize, esc_nl, size; - char *text, *p, *op, *s; - char lbuf[_POSIX2_LINE_MAX + 1]; + char *text, *s; + const char *p, *op; asize = 2 * _POSIX2_LINE_MAX + 1; if ((text = malloc(asize)) == NULL) err(1, "malloc"); size = 0; - while (cu_fgets(lbuf, sizeof(lbuf), NULL)) { + while ((p = cu_fgets(NULL))) { op = s = text + size; - p = lbuf; for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') esc_nl = 1; *s++ = *p; + if (*p == '\n') + break; } size += s - op; if (!esc_nl) { @@ -763,17 +754,18 @@ compile_text(void) } } text[size] = '\0'; - if ((p = realloc(text, size + 1)) == NULL) + if ((text = realloc(text, size + 1)) == NULL) err(1, "realloc"); - return (p); + *ptlen = size; + return (text); } /* * Get an address and return a pointer to the first character after * it. Fill the structure pointed to according to the address. */ -static char * -compile_addr(char *p, struct s_addr *a) +static const char * +compile_addr(const char *p, struct s_addr *a) { char *end, re[_POSIX2_LINE_MAX + 1]; int icase; @@ -827,22 +819,26 @@ compile_addr(char *p, struct s_addr *a) * Return a copy of all the characters up to \n or \0. */ static char * -duptoeol(char *s, const char *ctype) +duptoeol(const char *s, const char *ctype, size_t *ptlen) { size_t len; int ws; - char *p, *start; + char *p; + const char *start; ws = 0; for (start = s; *s != '\0' && *s != '\n'; ++s) ws = isspace((unsigned char)*s); - *s = '\0'; if (ws) warnx("%lu: %s: whitespace after %s", linenum, fname, ctype); - len = s - start + 1; - if ((p = malloc(len)) == NULL) + len = s - start; + if ((p = malloc(len + 1)) == NULL) err(1, "malloc"); - return (memmove(p, start, len)); + memmove(p, start, len); + p[len] = '\0'; + if (ptlen != NULL) + *ptlen = len; + return p; } /* @@ -853,7 +849,7 @@ duptoeol(char *s, const char *ctype) * TODO: Remove } nodes */ static void -fixuplabel(struct s_command *cp, struct s_command *end) +fixuplabel(struct s_command *cp, const struct s_command *end) { for (; cp != end; cp = cp->next) @@ -870,7 +866,7 @@ fixuplabel(struct s_command *cp, struct break; } if ((cp->u.c = findlabel(cp->t)) == NULL) - errx(1, "%lu: %s: undefined label '%s'", linenum, fname, cp->t); + errx(1, "%lu: %s: %c: undefined label '%s'", linenum, fname, cp->code, cp->t); free(cp->t); break; case '{': @@ -910,13 +906,13 @@ enterlabel(struct s_command *cp) * list cp. L is excluded from the search. Return NULL if not found. */ static struct s_command * -findlabel(char *name) +findlabel(const char *name) { struct labhash *lh; - u_char *p; + const u_char *p; u_int h, c; - for (h = 0, p = (u_char *)name; (c = *p) != 0; p++) + for (h = 0, p = (const u_char *)name; (c = *p) != 0; p++) h = (h << 5) + h + c; for (lh = labels[h & LHMASK]; lh != NULL; lh = lh->lh_next) { if (lh->lh_hash == h && strcmp(name, lh->lh_cmd->t) == 0) { Modified: head/usr.bin/sed/defs.h ============================================================================== --- head/usr.bin/sed/defs.h Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/defs.h Tue Jul 19 22:56:40 2016 (r303047) @@ -51,7 +51,7 @@ struct s_addr { enum e_atype type; /* Address type */ union { u_long l; /* Line number */ - regex_t *r; /* Regular expression */ + const regex_t *r; /* Regular expression */ } u; }; @@ -64,7 +64,7 @@ struct s_subst { int icase; /* True if I flag */ char *wfile; /* NULL if no wfile */ int wfd; /* Cached file descriptor */ - regex_t *re; /* Regular expression */ + const regex_t *re; /* Regular expression */ unsigned int maxbref; /* Largest backreference. */ u_long linenum; /* Line number. */ char *new; /* Replacement text */ @@ -94,6 +94,7 @@ struct s_command { struct s_addr *a1, *a2; /* Start and end address */ u_long startline; /* Start line number or zero */ char *t; /* Text for : a c i r w */ + size_t tlen; union { struct s_command *c; /* Command(s) for b t { */ struct s_subst *s; /* Substitute command */ Modified: head/usr.bin/sed/extern.h ============================================================================== --- head/usr.bin/sed/extern.h Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/extern.h Tue Jul 19 22:56:40 2016 (r303047) @@ -45,12 +45,12 @@ extern const char *fname, *outfname; extern FILE *infile, *outfile; extern int rflags; /* regex flags to use */ -void cfclose(struct s_command *, struct s_command *); +void cfclose(struct s_command *, const struct s_command *); void compile(void); void cspace(SPACE *, const char *, size_t, enum e_spflag); -char *cu_fgets(char *, int, int *); +const char *cu_fgets(int *); int mf_fgets(SPACE *, enum e_spflag); int lastline(void); void process(void); void resetstate(void); -char *strregerror(int, regex_t *); +char *strregerror(int, const regex_t *); Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/main.c Tue Jul 19 22:56:40 2016 (r303047) @@ -73,7 +73,7 @@ static const char sccsid[] = "@(#)main.c struct s_compunit { struct s_compunit *next; enum e_cut {CU_FILE, CU_STRING} type; - char *s; /* Pointer to string or fname */ + const char *s; /* Pointer to string or fname */ }; /* @@ -86,7 +86,7 @@ static struct s_compunit *script, **cu_n * Linked list of files to be processed */ struct s_flist { - char *fname; + const char *fname; struct s_flist *next; }; @@ -117,15 +117,14 @@ static char tmpfname[PATH_MAX]; /* Tempo static const char *inplace; /* Inplace edit file extension. */ u_long linenum; -static void add_compunit(enum e_cut, char *); -static void add_file(char *); +static void add_compunit(enum e_cut, const char *); +static void add_file(const char *); static void usage(void); int main(int argc, char *argv[]) { int c, fflag; - char *temp_arg; (void) setlocale(LC_ALL, ""); @@ -147,11 +146,7 @@ main(int argc, char *argv[]) break; case 'e': eflag = 1; - if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL) - err(1, "malloc"); - strcpy(temp_arg, optarg); - strcat(temp_arg, "\n"); - add_compunit(CU_STRING, temp_arg); + add_compunit(CU_STRING, optarg); break; case 'f': fflag = 1; @@ -214,14 +209,16 @@ usage(void) * Like fgets, but go through the chain of compilation units chaining them * together. Empty strings and files are ignored. */ -char * -cu_fgets(char *buf, int n, int *more) +const char * +cu_fgets(int *more) { static enum {ST_EOF, ST_FILE, ST_STRING} state = ST_EOF; static FILE *f; /* Current open file */ - static char *s; /* Current pointer inside string */ - static char string_ident[30]; + static const char *s; /* Current pointer inside string */ + static char string_ident[30], *lastresult; + static size_t lastsize; char *p; + const char *start; again: switch (state) { @@ -251,14 +248,16 @@ again: goto again; } case ST_FILE: - if ((p = fgets(buf, n, f)) != NULL) { + p = lastresult; + if (getline(&p, &lastsize, f) != -1) { linenum++; - if (linenum == 1 && buf[0] == '#' && buf[1] == 'n') + if (linenum == 1 && p[0] == '#' && p[1] == 'n') nflag = 1; if (more != NULL) *more = !feof(f); - return (p); - } + return (lastresult = p); + } else if (ferror(f)) + err(1, "%s", script->s); script = script->next; (void)fclose(f); state = ST_EOF; @@ -266,39 +265,26 @@ again: case ST_STRING: if (linenum == 0 && s[0] == '#' && s[1] == 'n') nflag = 1; - p = buf; + else if (s[0] == '\0') { + state = ST_EOF; + script = script->next; + goto again; + } + start = s; for (;;) { - if (n-- <= 1) { - *p = '\0'; - linenum++; - if (more != NULL) - *more = 1; - return (buf); - } switch (*s) { case '\0': state = ST_EOF; - if (s == script->s) { - script = script->next; - goto again; - } else { - script = script->next; - *p = '\0'; - linenum++; - if (more != NULL) - *more = 0; - return (buf); - } + script = script->next; + /* FALLTHROUGH */ case '\n': - *p++ = '\n'; - *p = '\0'; s++; linenum++; if (more != NULL) *more = 0; - return (buf); + return (start); default: - *p++ = *s++; + s++; } } } @@ -400,13 +386,13 @@ mf_fgets(SPACE *sp, enum e_spflag spflag sizeof(oldfname)); len = strlcat(oldfname, inplace, sizeof(oldfname)); - if (len > (ssize_t)sizeof(oldfname)) + if ((size_t)len > sizeof(oldfname)) errx(1, "%s: name too long", fname); } len = snprintf(tmpfname, sizeof(tmpfname), "%s/.!%ld!%s", dirname(fname), (long)getpid(), basename(fname)); - if (len >= (ssize_t)sizeof(tmpfname)) + if ((size_t)len >= sizeof(tmpfname)) errx(1, "%s: name too long", fname); unlink(tmpfname); if (outfile != NULL && outfile != stdout) @@ -460,7 +446,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag * Add a compilation unit to the linked list */ static void -add_compunit(enum e_cut type, char *s) +add_compunit(enum e_cut type, const char *s) { struct s_compunit *cu; @@ -477,7 +463,7 @@ add_compunit(enum e_cut type, char *s) * Add a file to the linked list */ static void -add_file(char *s) +add_file(const char *s) { struct s_flist *fp; Modified: head/usr.bin/sed/misc.c ============================================================================== --- head/usr.bin/sed/misc.c Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/misc.c Tue Jul 19 22:56:40 2016 (r303047) @@ -56,16 +56,14 @@ static const char sccsid[] = "@(#)misc.c * the buffer). */ char * -strregerror(int errcode, regex_t *preg) +strregerror(int errcode, const regex_t *preg) { static char *oe; size_t s; - if (oe != NULL) - free(oe); s = regerror(errcode, preg, NULL, 0); - if ((oe = malloc(s)) == NULL) - err(1, "malloc"); + if ((oe = realloc(oe, s)) == NULL) + err(1, "realloc"); (void)regerror(errcode, preg, oe, s); return (oe); } Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Tue Jul 19 20:22:13 2016 (r303046) +++ head/usr.bin/sed/process.c Tue Jul 19 22:56:40 2016 (r303047) @@ -67,14 +67,14 @@ static SPACE HS, PS, SS, YS; #define hs HS.space #define hsl HS.len -static inline int applies(struct s_command *); -static void do_tr(struct s_tr *); -static void flush_appends(void); -static void lputs(char *, size_t); -static int regexec_e(regex_t *, const char *, int, int, size_t, - size_t); -static void regsub(SPACE *, char *, char *); -static int substitute(struct s_command *); +static inline int applies(struct s_command *); +static void do_tr(const struct s_tr *); +static void flush_appends(void); +static void lputs(const char *, size_t); +static int regexec_e(const regex_t *, const char *, int, int, + size_t, size_t); +static void regsub(SPACE *, const char *, const char *); +static int substitute(const struct s_command *); struct s_appends *appends; /* Array of pointers to strings to append. */ static int appendx; /* Index into appends array. */ @@ -83,7 +83,7 @@ int appendnum; /* Size of appends arra static int lastaddr; /* Set by applies if last address of a range. */ static int sdone; /* If any substitutes since last line input. */ /* Iov structure for 'w' commands. */ -static regex_t *defpreg; +static const regex_t *defpreg; size_t maxnsub; regmatch_t *match; @@ -376,13 +376,13 @@ resetstate(void) * and then swap them. */ static int -substitute(struct s_command *cp) +substitute(const struct s_command *cp) { SPACE tspace; - regex_t *re; + const regex_t *re; regoff_t slen; int lastempty, n; - size_t le = 0; + regoff_t le = 0; char *s; s = ps; @@ -488,7 +488,7 @@ substitute(struct s_command *cp) * Perform translation ('y' command) in the pattern space. */ static void -do_tr(struct s_tr *y) +do_tr(const struct s_tr *y) { SPACE tmp; char c, *p; @@ -578,7 +578,7 @@ flush_appends(void) } static void -lputs(char *s, size_t len) +lputs(const char *s, size_t len) { static const char escapes[] = "\\\a\b\f\r\t\v"; int c, col, width; @@ -658,7 +658,7 @@ lputs(char *s, size_t len) } static int -regexec_e(regex_t *preg, const char *string, int eflags, int nomatch, +regexec_e(const regex_t *preg, const char *string, int eflags, int nomatch, size_t start, size_t stop) { int eval; @@ -690,7 +690,7 @@ regexec_e(regex_t *preg, const char *str * Based on a routine by Henry Spencer */ static void -regsub(SPACE *sp, char *string, char *src) +regsub(SPACE *sp, const char *string, const char *src) { int len, no; char c, *dst; @@ -762,7 +762,7 @@ cspace(SPACE *sp, const char *p, size_t * Close all cached opened files and report any errors */ void -cfclose(struct s_command *cp, struct s_command *end) +cfclose(struct s_command *cp, const struct s_command *end) { for (; cp != end; cp = cp->next) From owner-svn-src-head@freebsd.org Wed Jul 20 00:02: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 432BDB9D11F; Wed, 20 Jul 2016 00:02:12 +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 20D711E44; Wed, 20 Jul 2016 00:02:12 +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 u6K02Be6032043; Wed, 20 Jul 2016 00:02:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K02BW2032040; Wed, 20 Jul 2016 00:02:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607200002.u6K02BW2032040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 Jul 2016 00:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303050 - in head/sys: cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 cddl/dev/dtrace/x86 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: Wed, 20 Jul 2016 00:02:12 -0000 Author: markj Date: Wed Jul 20 00:02:10 2016 New Revision: 303050 URL: https://svnweb.freebsd.org/changeset/base/303050 Log: Merge {amd64,i386}/instr_size.c into x86_instr_size.c. Also reduce the diff between us and upstream: the input data model will always be DATAMODEL_NATIVE because of a bug (p_model is never set but is always initialized to 0), so we don't need to override the caller anyway. This change is also necessary to support the pid provider for 32-bit processes on amd64. MFC after: 2 weeks Added: head/sys/cddl/dev/dtrace/x86/instr_size.c - copied, changed from r303049, head/sys/cddl/dev/dtrace/i386/instr_size.c Deleted: head/sys/cddl/dev/dtrace/amd64/instr_size.c head/sys/cddl/dev/dtrace/i386/instr_size.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 Copied and modified: head/sys/cddl/dev/dtrace/x86/instr_size.c (from r303049, head/sys/cddl/dev/dtrace/i386/instr_size.c) ============================================================================== --- head/sys/cddl/dev/dtrace/i386/instr_size.c Tue Jul 19 23:25:45 2016 (r303049, copy source) +++ head/sys/cddl/dev/dtrace/x86/instr_size.c Wed Jul 20 00:02:10 2016 (r303050) @@ -44,6 +44,9 @@ #include #include #else +#include +#include + typedef u_int model_t; #define DATAMODEL_NATIVE 0 int dtrace_instr_size(uchar_t *); @@ -104,9 +107,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isi dis86_t x; uint_t mode = SIZE32; -#ifdef illumos mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32; -#endif x.d86_data = (void **)&instr; x.d86_get_byte = dtrace_dis_get_byte; Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Jul 19 23:25:45 2016 (r303049) +++ head/sys/conf/files.amd64 Wed Jul 20 00:02:10 2016 (r303050) @@ -142,7 +142,7 @@ cddl/dev/dtrace/amd64/dtrace_asm.S opt cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" -cddl/dev/dtrace/amd64/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" +cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/aesni/aesni.c optional aesni aesni_ghash.o optional aesni \ Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Jul 19 23:25:45 2016 (r303049) +++ head/sys/conf/files.i386 Wed Jul 20 00:02:10 2016 (r303050) @@ -83,7 +83,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S opti cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}" cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" -cddl/dev/dtrace/i386/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" +cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs compat/linux/linux_event.c optional compat_linux From owner-svn-src-head@freebsd.org Wed Jul 20 00:06: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 22DEDB9D1E2; Wed, 20 Jul 2016 00:06:05 +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 E726A11D5; Wed, 20 Jul 2016 00:06:04 +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 u6K0648d032867; Wed, 20 Jul 2016 00:06:04 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K064Sd032866; Wed, 20 Jul 2016 00:06:04 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607200006.u6K064Sd032866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 20 Jul 2016 00:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303051 - head/usr.bin/mandoc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 00:06:05 -0000 Author: bdrewery Date: Wed Jul 20 00:06:03 2016 New Revision: 303051 URL: https://svnweb.freebsd.org/changeset/base/303051 Log: Only build makewhatis(1)/apropos(1) with MAN_UTILS. This is what src.conf(5) documents and is what the older non-mandoc versions respected. Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/mandoc/Makefile Modified: head/usr.bin/mandoc/Makefile ============================================================================== --- head/usr.bin/mandoc/Makefile Wed Jul 20 00:02:10 2016 (r303050) +++ head/usr.bin/mandoc/Makefile Wed Jul 20 00:06:03 2016 (r303051) @@ -8,7 +8,7 @@ MDOCMLDIR= ${.CURDIR}/../../contrib/mdoc PROG= mandoc MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 # roff.7 MLINKS= mandoc.1 mdocml.1 -.if ${MK_MANDOCDB} != no +.if ${MK_MANDOCDB} != no && ${MK_MAN_UTILS} != no MAN+= apropos.1 makewhatis.8 MLINKS+= apropos.1 whatis.1 LINKS= ${BINDIR}/mandoc ${BINDIR}/whatis \ From owner-svn-src-head@freebsd.org Wed Jul 20 00:09: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 5F0D9B9D33A; Wed, 20 Jul 2016 00:09:23 +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 31E9814B0; Wed, 20 Jul 2016 00:09:23 +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 u6K09MKo033014; Wed, 20 Jul 2016 00:09:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K09MNY033012; Wed, 20 Jul 2016 00:09:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607200009.u6K09MNY033012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 Jul 2016 00:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303052 - in head/sys: 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: Wed, 20 Jul 2016 00:09:23 -0000 Author: markj Date: Wed Jul 20 00:09:22 2016 New Revision: 303052 URL: https://svnweb.freebsd.org/changeset/base/303052 Log: Make vm_pageout_wakeup_thresh a u_int rather than an int. It's a threshold for v_free_count, which is of type u_int. This also lets us get rid of a cast in vm_paging_needed(). Reviewed by: alc MFC after: 1 week Modified: head/sys/sys/vmmeter.h head/sys/vm/vm_pageout.c Modified: head/sys/sys/vmmeter.h ============================================================================== --- head/sys/sys/vmmeter.h Wed Jul 20 00:06:03 2016 (r303051) +++ head/sys/sys/vmmeter.h Wed Jul 20 00:09:22 2016 (r303052) @@ -117,7 +117,7 @@ struct vmmeter { extern struct vmmeter vm_cnt; -extern int vm_pageout_wakeup_thresh; +extern u_int vm_pageout_wakeup_thresh; /* * Return TRUE if we are under our severe low-free-pages threshold @@ -181,7 +181,7 @@ vm_paging_needed(void) { return (vm_cnt.v_free_count + vm_cnt.v_cache_count < - (u_int)vm_pageout_wakeup_thresh); + vm_pageout_wakeup_thresh); } #endif Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Jul 20 00:06:03 2016 (r303051) +++ head/sys/vm/vm_pageout.c Wed Jul 20 00:09:22 2016 (r303052) @@ -157,7 +157,7 @@ SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ int vm_pageout_deficit; /* Estimated number of pages deficit */ -int vm_pageout_wakeup_thresh; +u_int vm_pageout_wakeup_thresh; static int vm_pageout_oom_seq = 12; bool vm_pageout_wanted; /* Event on which pageout daemon sleeps */ bool vm_pages_needed; /* Are threads waiting for free pages? */ From owner-svn-src-head@freebsd.org Wed Jul 20 01:01: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 50A08B9F0A7; Wed, 20 Jul 2016 01:01:51 +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 1A5911186; Wed, 20 Jul 2016 01:01:51 +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 u6K11o0G054724; Wed, 20 Jul 2016 01:01:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K11ohI054723; Wed, 20 Jul 2016 01:01:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607200101.u6K11ohI054723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 Jul 2016 01:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303059 - 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: Wed, 20 Jul 2016 01:01:51 -0000 Author: markj Date: Wed Jul 20 01:01:50 2016 New Revision: 303059 URL: https://svnweb.freebsd.org/changeset/base/303059 Log: Release the second critical section in uma_zfree_arg() slightly earlier. It is only needed when removing a full bucket from the per-CPU cache. The bucket cache (uz_buckets) is protected by the zone mutex and thus the critical section can be released before inserting into that list. MFC after: 1 week Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Jul 20 00:53:21 2016 (r303058) +++ head/sys/vm/uma_core.c Wed Jul 20 01:01:50 2016 (r303059) @@ -2744,6 +2744,8 @@ zfree_start: goto zfree_start; } cache->uc_freebucket = NULL; + /* We are no longer associated with this CPU. */ + critical_exit(); /* Can we throw this on the zone full list? */ if (bucket != NULL) { @@ -2756,9 +2758,6 @@ zfree_start: LIST_INSERT_HEAD(&zone->uz_buckets, bucket, ub_link); } - /* We are no longer associated with this CPU. */ - critical_exit(); - /* * We bump the uz count when the cache size is insufficient to * handle the working set. From owner-svn-src-head@freebsd.org Wed Jul 20 03:01: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 B69DEB9D645 for ; Wed, 20 Jul 2016 03:01:31 +0000 (UTC) (envelope-from jbeich@vfemail.net) Received: from vfemail.net (onethreetwo.vfemail.net [199.16.11.132]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 740A2177A for ; Wed, 20 Jul 2016 03:01:30 +0000 (UTC) (envelope-from jbeich@vfemail.net) Received: (qmail 90837 invoked by uid 89); 20 Jul 2016 03:01:29 -0000 Received: from localhost (HELO freequeue.vfemail.net) (127.0.0.1) by localhost with (DHE-RSA-AES256-SHA encrypted) SMTP; 20 Jul 2016 03:01:29 -0000 Received: (qmail 90374 invoked by uid 89); 20 Jul 2016 03:01:12 -0000 Received: by simscan 1.3.1 ppid: 90366, pid: 90370, t: 0.0044s scanners:none Received: from unknown (HELO smtp102-2.vfemail.net) (172.16.100.62) by FreeQueue with SMTP; 20 Jul 2016 03:01:12 -0000 Received: (qmail 7662 invoked by uid 89); 20 Jul 2016 03:01:12 -0000 Received: by simscan 1.4.0 ppid: 7641, pid: 7658, t: 0.5424s scanners:none Received: from unknown (HELO nil) (amJlaWNoQHZmZW1haWwubmV0@172.16.100.27) by mail.vfemail.net with ESMTPA; 20 Jul 2016 03:01:11 -0000 From: Jan Beich To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303033 - head/share/man/man7 References: <201607191746.u6JHk9ov092270@repo.freebsd.org> Date: Wed, 20 Jul 2016 05:01:03 +0200 In-Reply-To: <201607191746.u6JHk9ov092270@repo.freebsd.org> (Ed Maste's message of "Tue, 19 Jul 2016 17:46:09 +0000 (UTC)") Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 03:01:31 -0000 --=-=-= Content-Type: text/plain Ed Maste writes: > +.It Sy Architecture Ta Sy Page Sizes > +.It amd64 Ta 4K, 2M, 1G Does FreeBSD support 1G pages nowadays? $ sysctl hw.pagesizes hw.pagesizes: 4096 2097152 0 $ dmesg | fgrep -i 1gb AMD Features=0x2c100800 > +.Ss Predefined Macros > +The compiler provides a number of predefined macros. > +Some of these provide architecture-specific details and are explained below. > +Other macros, including those required by the language standard, are not > +included here. [...] > +cc -x c -Dm -E /dev/null Typo: -Dm vs. -dM > +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . Are these really compiler macros? I think, defines them. $ clang38 -x c -dM -E /dev/null | fgrep ENDIAN #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #define __ORDER_BIG_ENDIAN__ 4321 #define __ORDER_LITTLE_ENDIAN__ 1234 #define __ORDER_PDP_ENDIAN__ 3412 $ gcc5 -x c -dM -E /dev/null | fgrep ENDIAN #define __ORDER_LITTLE_ENDIAN__ 1234 #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ #define __ORDER_PDP_ENDIAN__ 3412 #define __ORDER_BIG_ENDIAN__ 4321 #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQF8BAEBCgBmBQJXjulvXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREQjQ0MzY3NEM3RDIzNTc4NkUxNDkyQ0VF NEM3Nzg4MzQ3OURCRERCAAoJEOTHeINHnb3ba2QH/iBMtZV06lQ4dAdG2mA5rdoA APlTiA2QF6EcrrgpVsRlQ3wb3x5cMexu2UvRRrICJ2Lj1ZhmX4XxcjTwZxbS3sYI RkRAO/bly1KyF6MGFtKIw+ThWcVMEaBuPc9SpKJUG+O2Kry1BjVVl9UyWcz2BFB/ dK8G+bTHTunPT8IDv5n5CeyzdolzvusLqsSuK+Y2Kjr3hCp4WFoquL4BJFAKySCZ wncRbYHEj675Io27WfXflmxEt5jCeKVpTbvwyFq1BM/OpwZ5X8frEA7wnB5dGSgx Fs+Wp5DsgY/UsLYU+2jWEnVq550ZRakPMCwhSPkCxXd2htHpg+ZzNR/+uYODSsI= =WH2R -----END PGP SIGNATURE----- --=-=-=-- From owner-svn-src-head@freebsd.org Wed Jul 20 03:13: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 483EBB9D98A; Wed, 20 Jul 2016 03:13:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10EEE1F8A; Wed, 20 Jul 2016 03:13:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6K3D377003474; Wed, 20 Jul 2016 03:13:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K3D3XE003473; Wed, 20 Jul 2016 03:13:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607200313.u6K3D3XE003473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Jul 2016 03:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303061 - head/contrib/llvm/projects/libunwind/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, 20 Jul 2016 03:13:04 -0000 Author: emaste Date: Wed Jul 20 03:13:02 2016 New Revision: 303061 URL: https://svnweb.freebsd.org/changeset/base/303061 Log: libunwind: Properly align _Unwind_Exception. _Unwind_Exception is required to be double word aligned. GCC has interpreted this to mean "use the maximum useful alignment for the target" so follow that lead. Obtained from: LLVM review D22543 Modified: head/contrib/llvm/projects/libunwind/include/unwind.h Modified: head/contrib/llvm/projects/libunwind/include/unwind.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/unwind.h Wed Jul 20 02:21:54 2016 (r303060) +++ head/contrib/llvm/projects/libunwind/include/unwind.h Wed Jul 20 03:13:02 2016 (r303061) @@ -128,7 +128,7 @@ struct _Unwind_Exception { // added for binary compatibility. uint32_t reserved[3]; #endif -}; +} __attribute__((__aligned__)); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int version, From owner-svn-src-head@freebsd.org Wed Jul 20 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 60EBBB9E1E9; Wed, 20 Jul 2016 03:52:06 +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 2A1221181; Wed, 20 Jul 2016 03:52:06 +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 u6K3q529015194; Wed, 20 Jul 2016 03:52:05 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K3q4I3015185; Wed, 20 Jul 2016 03:52:04 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607200352.u6K3q4I3015185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Jul 2016 03:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303062 - head/contrib/openresolv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 03:52:06 -0000 Author: pfg Date: Wed Jul 20 03:52:04 2016 New Revision: 303062 URL: https://svnweb.freebsd.org/changeset/base/303062 Log: MFV r298167, r300962, r303048: openresolv: update to version 3.8.1. Among the new features it attempts to support alternative init systems. MFC after: 1 month Modified: head/contrib/openresolv/Makefile head/contrib/openresolv/configure head/contrib/openresolv/dnsmasq.in head/contrib/openresolv/libc.in head/contrib/openresolv/named.in head/contrib/openresolv/resolvconf.8.in head/contrib/openresolv/resolvconf.conf.5.in head/contrib/openresolv/resolvconf.in head/contrib/openresolv/unbound.in Directory Properties: head/contrib/openresolv/ (props changed) Modified: head/contrib/openresolv/Makefile ============================================================================== --- head/contrib/openresolv/Makefile Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/Makefile Wed Jul 20 03:52:04 2016 (r303062) @@ -1,5 +1,4 @@ PKG= openresolv -VERSION= 3.7.3 # Nasty hack so that make clean works without configure being run _CONFIG_MK!= test -e config.mk && echo config.mk || echo config-null.mk @@ -10,14 +9,12 @@ SBINDIR?= /sbin SYSCONFDIR?= /etc LIBEXECDIR?= /libexec/resolvconf VARDIR?= /var/run/resolvconf -RCDIR?= /etc/rc.d -RESTARTCMD?= if ${RCDIR}/\1 status >/dev/null 2>\&1; then \ - ${RCDIR}/\1 restart; \ - fi INSTALL?= install SED?= sed +VERSION!= ${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in + BINMODE?= 0755 DOCMODE?= 0644 MANMODE?= 0444 @@ -33,7 +30,9 @@ SED_SYSCONFDIR= -e 's:@SYSCONFDIR@:${SY SED_LIBEXECDIR= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' SED_VARDIR= -e 's:@VARDIR@:${VARDIR}:g' SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' -SED_RESTARTCMD= -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' +SED_RESTARTCMD= -e 's:@RESTARTCMD@:${RESTARTCMD}:g' +SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' +SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g' DISTPREFIX?= ${PKG}-${VERSION} DISTFILEGZ?= ${DISTPREFIX}.tar.gz @@ -44,9 +43,10 @@ FOSSILID?= current all: ${TARGET} -.in: +.in: Makefile ${CONFIG_MK} ${SED} ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \ - ${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \ + ${SED_VARDIR} \ + ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \ $< > $@ clean: Modified: head/contrib/openresolv/configure ============================================================================== --- head/contrib/openresolv/configure Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/configure Wed Jul 20 03:52:04 2016 (r303062) @@ -8,6 +8,7 @@ HOST= TARGET= RESTARTCMD= RCDIR= +STATUSARG= for x do opt=${x%%=*} @@ -33,6 +34,8 @@ for x do --target) TARGET=$var;; --libdir) LIBDIR=$var;; --restartcmd) RESTARTCMD=$var;; + --rcdir) RCDIR=$var;; + --statusarg) STATUSARG=$var;; --includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";; --datadir|--infodir) ;; # ignore autotools --disable-maintainer-mode|--disable-dependency-tracking) ;; @@ -117,7 +120,17 @@ echo "Configuring openresolv for ... $OS rm -rf $CONFIG_MK echo "# $OS" >$CONFIG_MK -for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR; do +# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled +# regardless of if it's not running. +# So we force onestatus to work around this silly bug. +if [ -z "$STATUSARG" ]; then + case "$OS" in + freebsd*) STATUSARG="onestatus";; + esac +fi + +for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG +do eval v=\$$x # Make files look nice for import l=$((10 - ${#x})) @@ -126,96 +139,6 @@ for x in SYSCONFDIR SBINDIR LIBEXECDIR V echo "$x=$t $v" >>$CONFIG_MK done -if [ -z "$RESTARTCMD" ]; then - printf "Checking for systemd ... " - if [ -x /bin/systemctl ]; then - RESTARTCMD="/bin/systemctl try-restart \1" - echo "yes" - elif [ -x /usr/bin/systemctl ]; then - RESTARTCMD="/usr/bin/systemctl try-restart \1" - echo "yes" - else - echo "no" - fi -fi - -# Arch upgraded to systemd, so this check has to be just after systemd -# but higher than the others -if [ -z "$RESTARTCMD" ]; then - printf "Checking for Arch ... " - if [ -e /etc/arch-release -a -d /etc/rc.d ]; then - RCDIR=/etc/rc.d - RESTARTCMD="[ -e /var/run/daemons/\1 ] \&\& /etc/rc.d/\1 restart" - echo "yes" - else - echo "no" - fi -fi - -if [ -z "$RESTARTCMD" ]; then - printf "Checking for OpenRC ... " - if [ -x /sbin/rc-service ]; then - RESTARTCMD="if /sbin/rc-service -e \1; then /sbin/rc-service \1 -- -Ds restart; fi" - echo "yes" - else - echo "no" - fi -fi -if [ -z "$RESTARTCMD" ]; then - printf "Checking for invoke-rc.d ... " - if [ -x /usr/sbin/invoke-rc.d ]; then - RCDIR=/etc/init.d - RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \1 status >/dev/null 2>\&1; then /usr/sbin/invoke-rc.d \1 restart; fi" - echo "yes" - else - echo "no" - fi -fi -if [ -z "$RESTARTCMD" ]; then - printf "Checking for service ... " - if [ -x /sbin/service ]; then - RCDIR=/etc/init.d - RESTARTCMD="if /sbin/service \1; then /sbin/service \1 restart; fi" - echo "yes" - else - echo "no" - fi -fi -if [ -z "$RESTARTCMD" ]; then - printf "Checking for runit... " - if [ -x /bin/sv ]; then - RESTARTCMD="/bin/sv try-restart \1" - echo "yes" - elif [ -x /usr/bin/sv ]; then - RESTARTCMD="/usr/bin/sv try-restart \1" - echo "yes" - else - echo "no" - fi -fi -if [ -z "$RESTARTCMD" ]; then - for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do - printf "Checking for $x ... " - if [ -d $x ]; then - RCDIR=$x - RESTARTCMD="if $x/\1 status >/dev/null 2>\&1; then $x/\1 restart; fi" - echo "yes" - break - else - echo "no" - fi - done -fi - -if [ -z "$RESTARTCMD" ]; then - echo "$0: WARNING: No means of interacting with system services detected!" - exit 1 -fi - -echo "RCDIR= $RCDIR" >>$CONFIG_MK -# Work around bug in the dash shell as "echo 'foo \1'" does bad things -printf "%s\n" "RESTARTCMD= $RESTARTCMD" >>$CONFIG_MK - echo echo " SYSCONFDIR = $SYSCONFDIR" echo " SBINDIR = $SBINDIR" @@ -223,3 +146,7 @@ echo " LIBEXECDIR = $LIBEXECDIR" echo " VARDIR = $RUNDIR" echo " MANDIR = $MANDIR" echo +echo " RESTARTCMD = $RESTARTCMD" +echo " RCDIR = $RCDIR" +echo " STATUSARG = $STATUSARG" +echo Modified: head/contrib/openresolv/dnsmasq.in ============================================================================== --- head/contrib/openresolv/dnsmasq.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/dnsmasq.in Wed Jul 20 03:52:04 2016 (r303062) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2012 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # dnsmasq subscriber for resolvconf @@ -37,7 +37,6 @@ NL=" [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid [ -s "$dnsmasq_pid" ] || unset dnsmasq_pid : ${dnsmasq_service:=dnsmasq} -: ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@} newconf="# Generated by resolvconf$NL" newresolv="$newconf" @@ -180,7 +179,15 @@ if [ -n "$dnsmasq_resolv" ]; then fi if $changed; then - eval $dnsmasq_restart + # dnsmasq does not re-read the configuration file on SIGHUP + if [ -n "$dnsmasq_restart" ]; then + eval $dnsmasq_restart + elif [ -n "$RESTARTCMD" ]; then + set -- ${dnsmasq_service} + eval $RESTARTCMD + else + @SBINDIR@/resolvconf -r ${dnsmasq_service} + fi fi if $dbus; then if [ -s "$dnsmasq_pid" ]; then Modified: head/contrib/openresolv/libc.in ============================================================================== --- head/contrib/openresolv/libc.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/libc.in Wed Jul 20 03:52:04 2016 (r303062) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2014 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # libc subscriber for resolvconf @@ -97,7 +97,6 @@ elif [ -d "$SYSCONFDIR"/resolvconf ]; th fi : ${resolv_conf:=/etc/resolv.conf} : ${libc_service:=nscd} -: ${libc_restart:=@RESTARTCMD ${libc_service}@} : ${list_resolv:=@SBINDIR@/resolvconf -l} if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)" @@ -229,7 +228,14 @@ fi # Create our resolv.conf now (umask 022; echo "$newconf" >"$resolv_conf") -eval $libc_restart +if [ -n "$libc_restart" ]; then + eval $libc_restart +elif [ -n "$RESTARTCMD" ]; then + set -- ${libc_service} + eval $RESTARTCMD +else + @SBINDIR@/resolvconf -r ${libc_service} +fi retval=0 # Notify users of the resolver Modified: head/contrib/openresolv/named.in ============================================================================== --- head/contrib/openresolv/named.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/named.in Wed Jul 20 03:52:04 2016 (r303062) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2007-2012 Roy Marples +# Copyright (c) 2007-2016 Roy Marples # All rights reserved # named subscriber for resolvconf @@ -35,18 +35,22 @@ NL=" # Platform specific kludges if [ -z "$named_service" -a -z "$named_restart" -a \ - -d "@RCDIR@" -a ! -x "@RCDIR@"/named ] + -d "$RCDIR" -a ! -x "$RCDIR"/named ] then - if [ -x "@RCDIR@"/bind9 ]; then + if [ -x "$RCDIR"/bind9 ]; then # Debian and derivatives named_service=bind9 - elif [ -x "@RCDIR@"/rc.bind ]; then + elif [ -x "$RCDIR"/rc.bind ]; then # Slackware named_service=rc.bind fi fi : ${named_service:=named} -: ${named_restart:=@RESTARTCMD ${named_service}@} + +: ${named_pid:=/var/run/$named_service.pid} +[ -s "$named_pid" ] || named_pid=/var/run/$named_service/$named_service.pid +[ -s "$named_pid" ] || unset named_pid + newoptions="# Generated by resolvconf$NL" newzones="$newoptions" @@ -101,6 +105,14 @@ if [ -n "$named_zones" ]; then fi fi +# named does not seem to work with SIGHUP which is a same if $changed; then - eval $named_restart + if [ -n "$named_restart" ]; then + eval $named_restart + elif [ -n "$RESTARTCMD" ]; then + set -- ${named_service} + eval $RESTARTCMD + else + @SBINDIR@/resolvconf -r ${named_service} + fi fi Modified: head/contrib/openresolv/resolvconf.8.in ============================================================================== --- head/contrib/openresolv/resolvconf.8.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/resolvconf.8.in Wed Jul 20 03:52:04 2016 (r303062) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007-2015 Roy Marples +.\" Copyright (c) 2007-2016 Roy Marples .\" All rights reserved .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 27, 2015 +.Dd May 7, 2016 .Dt RESOLVCONF 8 .Os .Sh NAME @@ -64,7 +64,7 @@ solves this by letting the daemon send t file to .Nm via -.Xr stdin 3 +.Xr stdin 4 with the argument .Fl a Ar interface Ns Op Ar .protocol instead of the filesystem. @@ -101,7 +101,7 @@ as private. This means that the name servers listed in that .Pa resolv.conf are only used for queries against the domain/search listed in the same file. -This only works when a local resolver other than libc is installed. +This only works when a local resolver other than libc is installed. See .Xr resolvconf.conf 5 for how to configure @@ -125,24 +125,28 @@ file(s) for all the on the .Ar interface . .Pp -Here are some more options that -.Nm -has:- +Here are some options for the above commands:- .Bl -tag -width indent -.It Fl I -Initialise the state directory -.Pa @VARDIR@ . -This only needs to be called if the initial system boot sequence does not -automatically clean it out; for example the state directory is moved -somewhere other than -.Pa /var/run . -If used, it should only be called once as early in the system boot sequence -as possible and before -.Nm -is used to add interfaces. .It Fl f -Ignore non existant interfaces. +Ignore non existent interfaces. Only really useful for deleting interfaces. +.It Fl m Ar metric +Set the metric of the interface when adding it, default of 0. +Lower metrics take precedence. +This affects the default order of interfaces when listed. +.It Fl p +Marks the interface +.Pa resolv.conf +as private. +.It Fl x +Mark the interface +.Pa resolv.conf +as exclusive when adding, otherwise only use the latest exclusive interface. +.El +.Pp +.Nm +has some more commands for general usage:- +.Bl -tag -width indent .It Fl i Ar pattern List the interfaces and protocols, optionally matching .Ar pattern , @@ -157,14 +161,6 @@ If .Ar pattern is specified then we list the files for the interfaces and protocols that match it. -.It Fl m Ar metric -Set the metric of the interface when adding it, default of 0. -Lower metrics take precedence. -This affects the default order of interfaces when listed. -.It Fl p -Marks the interface -.Pa resolv.conf -as private. .It Fl u Force .Nm @@ -172,15 +168,31 @@ to update all its subscribers. .Nm does not update the subscribers when adding a resolv.conf that matches what it already has for that interface. -.It Fl x -Mark the interface -.Pa resolv.conf -as exclusive when adding, otherwise only use the latest exclusive interface. .El .Pp .Nm -also has some options designed to be used by its subscribers:- +also has some commands designed to be used by it's subscribers and +system startup:- .Bl -tag -width indent +.It Fl I +Initialise the state directory +.Pa @VARDIR@ . +This only needs to be called if the initial system boot sequence does not +automatically clean it out; for example the state directory is moved +somewhere other than +.Pa /var/run . +If used, it should only be called once as early in the system boot sequence +as possible and before +.Nm +is used to add interfaces. +.It Fl R +Echo the command used to restart a service. +.It Fl r Ar service +If the +.Ar service +is running then restart it. +If the service does not exist or is not running then zero is returned, +otherwise the result of restarting the service. .It Fl v Echo variables DOMAINS, SEARCH and NAMESERVERS so that the subscriber can configure the resolver easily. @@ -278,16 +290,16 @@ Directory of subscribers which are run a State directory for .Nm . .El +.Sh SEE ALSO +.Xr resolver 3 , +.Xr stdin 4 , +.Xr resolv.conf 5 , +.Xr resolvconf.conf 5 .Sh HISTORY This implementation of .Nm is called openresolv and is fully command line compatible with Debian's resolvconf, as written by Thomas Hood. -.Sh SEE ALSO -.Xr resolv.conf 5 , -.Xr resolvconf.conf 5 , -.Xr resolver 3 , -.Xr stdin 3 .Sh AUTHORS .An Roy Marples Aq Mt roy@marples.name .Sh BUGS Modified: head/contrib/openresolv/resolvconf.conf.5.in ============================================================================== --- head/contrib/openresolv/resolvconf.conf.5.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/resolvconf.conf.5.in Wed Jul 20 03:52:04 2016 (r303062) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 21, 2016 +.Dd April 28, 2016 .Dt RESOLVCONF.CONF 5 .Os .Sh NAME @@ -103,7 +103,8 @@ This is equivalent to the .Nm resolvconf -p option. .It Sy replace -Is a space separated list of replacement keywords. The syntax is this: +Is a space separated list of replacement keywords. +The syntax is this: .Va $keyword Ns / Ns Va $match Ns / Ns Va $replacement .Pp Example, given this resolv.conf: @@ -284,33 +285,32 @@ variables, documented below. .Pp .Bl -tag -width indent .It Sy dnsmasq_service -Location of the dnsmasq service. +Name of the dnsmasq service. .It Sy dnsmasq_restart Command to restart the dnsmasq service. .It Sy dnsmasq_pid Location of the dnsmasq pidfile. .It Sy libc_service -Location of the libc service. +Name of the libc service. .It Sy libc_restart Command to restart the libc service. .It Sy named_service -Location of the named service. +Name of the named service. .It Sy named_restart Command to restart the named service. .It Sy pdnsd_restart Command to restart the pdnsd service. .It Sy unbound_service -Location of the unbound service. +Name of the unbound service. .It Sy unbound_restart Command to restart the unbound service. .It Sy unbound_pid Location of the unbound pidfile. .El .Sh SEE ALSO +.Xr sh 1 , .Xr resolv.conf 5 , .Xr resolvconf 8 -and -.Xr sh 1 . .Sh AUTHORS .An Roy Marples Aq Mt roy@marples.name .Sh BUGS Modified: head/contrib/openresolv/resolvconf.in ============================================================================== --- head/contrib/openresolv/resolvconf.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/resolvconf.in Wed Jul 20 03:52:04 2016 (r303062) @@ -25,9 +25,12 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. RESOLVCONF="$0" +OPENRESOLV_VERSION="3.8.1" SYSCONFDIR=@SYSCONFDIR@ LIBEXECDIR=@LIBEXECDIR@ VARDIR=@VARDIR@ +RCDIR=@RCDIR@ +RESTARTCMD=@RESTARTCMD@ # Disregard dhcpcd setting unset interface_order state_dir @@ -71,55 +74,45 @@ error_exit() usage() { cat <<-EOF - Usage: ${RESOLVCONF##*/} [options] + Usage: ${RESOLVCONF##*/} [options] command [argument] Inform the system about any DNS updates. - Options: + Commands: -a \$INTERFACE Add DNS information to the specified interface (DNS supplied via stdin in resolv.conf format) - -m metric Give the added DNS information a metric - -p Mark the interface as private - -x Mark the interface as exclusive -d \$INTERFACE Delete DNS information from the specified interface - -f Ignore non existant interfaces - -I Init the state dir - -u Run updates from our current DNS information - -l [\$PATTERN] Show DNS information, optionally from interfaces - that match the specified pattern + -h Show this help cruft -i [\$PATTERN] Show interfaces that have supplied DNS information optionally from interfaces that match the specified pattern + -l [\$PATTERN] Show DNS information, optionally from interfaces + that match the specified pattern + + -u Run updates from our current DNS information + + Options: + -f Ignore non existent interfaces + -m metric Give the added DNS information a metric + -p Mark the interface as private + -x Mark the interface as exclusive + + Subscriber and System Init Commands: + -I Init the state dir + -r \$SERVICE Restart the system service + (restarting a non-existent or non-running service + should have no output and return 0) + -R Show the system service restart command -v [\$PATTERN] echo NEWDOMAIN, NEWSEARCH and NEWNS variables to the console - -h Show this help cruft + -V [\$PATTERN] Same as -v, but only uses configuration in + $SYSCONFDIR/resolvconf.conf EOF [ -z "$1" ] && exit 0 echo error_exit "$*" } -echo_resolv() -{ - local line= OIFS="$IFS" - - [ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1 - echo "# resolv.conf from $1" - # Our variable maker works of the fact each resolv.conf per interface - # is separated by blank lines. - # So we remove them when echoing them. - while read -r line; do - IFS="$OIFS" - if [ -n "$line" ]; then - # We need to set IFS here to preserve any whitespace - IFS='' - printf "%s\n" "$line" - fi - done < "$IFACEDIR/$1" - echo - IFS="$OIFS" -} - # Strip any trailing dot from each name as a FQDN does not belong # in resolv.conf(5) # If you think otherwise, capture a DNS trace and you'll see libc @@ -159,7 +152,10 @@ parse_resolv() private=false for p in $private_interfaces; do case "$iface" in - "$p"|"$p":*) private=true; break;; + "$p"|"$p":*) + private=true + break + ;; esac done fi @@ -261,6 +257,108 @@ config_mkdirs() return $e } +# With the advent of alternative init systems, it's possible to have +# more than one installed. So we need to try and guess what one we're +# using unless overriden by configure. +# Note that restarting a service is a last resort - the subscribers +# should make a reasonable attempt to reconfigre the service via some +# method, normally SIGHUP. +detect_init() +{ + [ -n "$RESTARTCMD" ] && return 0 + + # Detect the running init system. + # As systemd and OpenRC can be installed on top of legacy init + # systems we try to detect them first. + local status="@STATUSARG@" + : ${status:=status} + if [ -x /bin/systemctl -a -S /run/systemd/private ]; then + RESTARTCMD="if /bin/systemctl --quiet is-active \$1.service; then + /bin/systemctl restart \$1.service; +fi" + elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then + RESTARTCMD="if /usr/bin/systemctl --quiet is-active \$1.service; then + /usr/bin/systemctl restart \$1.service; +fi" + elif [ -x /sbin/rc-service -a \ + -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ] + then + RESTARTCMD="/sbin/rc-service -i \$1 -- -Ds restart" + elif [ -x /usr/sbin/invoke-rc.d ]; then + RCDIR=/etc/init.d + RESTARTCMD="if /usr/sbin/invoke-rc.d --quiet \$1 status 1>/dev/null 2>&1; then + /usr/sbin/invoke-rc.d \$1 restart; +fi" + elif [ -x /sbin/service ]; then + # Old RedHat + RCDIR=/etc/init.d + RESTARTCMD="if /sbin/service \$1; then + /sbin/service \$1 restart; +fi" + elif [ -x /usr/sbin/service ]; then + # Could be FreeBSD + RESTARTCMD="if /usr/sbin/service \$1 $status 1>/dev/null 2>&1; then + /usr/sbin/service \$1 restart; +fi" + elif [ -x /bin/sv ]; then + RESTARTCMD="/bin/sv try-restart \$1" + elif [ -x /usr/bin/sv ]; then + RESTARTCMD="/usr/bin/sv try-restart \$1" + elif [ -e /etc/arch-release -a -d /etc/rc.d ]; then + RCDIR=/etc/rc.d + RESTARTCMD="if [ -e /var/run/daemons/\$1 ]; then + /etc/rc.d/\$1 restart; +fi" + elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then + RESTARTCMD="if /etc/rc.d/rc.\$1 status 1>/dev/null 2>&1; then + /etc/rc.d/rc.\$1 restart; +fi" + elif [ -e /etc/rc.d/rc.subr -a -d /etc/rc.d ]; then + # OpenBSD + RESTARTCMD="if /etc/rc.d/\$1 check 1>/dev/null 2>&1; then + /etc/rc.d/\$1 restart; +fi" + else + for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do + [ -d $x ] || continue + RESTARTCMD="if $x/\$1 $status 1>/dev/null 2>&1; then + $x/\$1 restart; +fi" + break + done + fi + + if [ -z "$RESTARTCMD" ]; then + if [ "$NOINIT_WARNED" != true ]; then + warn "could not detect a useable init system" + _NOINIT_WARNED=true + fi + return 1 + fi + _NOINIT_WARNED= + return 0 +} + +echo_resolv() +{ + local line= OIFS="$IFS" + + [ -n "$1" -a -f "$IFACEDIR/$1" ] || return 1 + echo "# resolv.conf from $1" + # Our variable maker works of the fact each resolv.conf per interface + # is separated by blank lines. + # So we remove them when echoing them. + while read -r line; do + IFS="$OIFS" + if [ -n "$line" ]; then + # We need to set IFS here to preserve any whitespace + IFS='' + printf "%s\n" "$line" + fi + done < "$IFACEDIR/$1" + IFS="$OIFS" +} + list_resolv() { [ -d "$IFACEDIR" ] || return 0 @@ -320,6 +418,7 @@ list_resolv() cd "$IFACEDIR" retval=1 + excl=true for i in $(uniqify $list); do # Only list interfaces which we really have if ! [ -f "$i" ]; then @@ -334,6 +433,7 @@ list_resolv() printf %s "$i " else echo_resolv "$i" + echo fi [ $? = 0 -a "$retval" = 1 ] && retval=0 done @@ -499,7 +599,7 @@ make_vars() force=false VFLAG= -while getopts a:Dd:fhIilm:puvVx OPT; do +while getopts a:Dd:fhIilm:pRruvVx OPT; do case "$OPT" in f) force=true;; h) usage;; @@ -541,6 +641,18 @@ if [ "$cmd" = l -o "$cmd" = i ]; then exit $? fi +# Restart a service or echo the command to restart a service +if [ "$cmd" = r -o "$cmd" = R ]; then + detect_init || exit 1 + if [ "$cmd" = r ]; then + set -- $args + eval $RESTARTCMD + else + echo "$RESTARTCMD" + fi + exit $? +fi + # Not normally needed, but subscribers should be able to run independently if [ "$cmd" = v -o -n "$VFLAG" ]; then make_vars "$iface" @@ -765,13 +877,17 @@ case "${resolvconf:-YES}" in *) exit 0;; esac +# Try and detect a suitable init system for our scripts +detect_init +export RESTARTCMD RCDIR _NOINIT_WARNED + eval "$(make_vars)" export RESOLVCONF DOMAINS SEARCH NAMESERVERS LOCALNAMESERVERS : ${list_resolv:=list_resolv -l} retval=0 # Run scripts in the same directory resolvconf is run from -# in case any scripts accidently dump files in the wrong place. +# in case any scripts accidentally dump files in the wrong place. cd "$_PWD" for script in "$LIBEXECDIR"/*; do if [ -f "$script" ]; then Modified: head/contrib/openresolv/unbound.in ============================================================================== --- head/contrib/openresolv/unbound.in Wed Jul 20 03:13:02 2016 (r303061) +++ head/contrib/openresolv/unbound.in Wed Jul 20 03:52:04 2016 (r303062) @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2009-2014 Roy Marples +# Copyright (c) 2009-2016 Roy Marples # All rights reserved # unbound subscriber for resolvconf @@ -37,7 +37,6 @@ NL=" : ${unbound_pid:=/var/run/unbound.pid} : ${unbound_service:=unbound} -: ${unbound_restart:=@RESTARTCMD ${unbound_service}@} newconf="# Generated by resolvconf$NL" for d in $DOMAINS; do @@ -71,6 +70,18 @@ else @SBINDIR@/resolvconf -D "$unbound_conf" fi +restart_unbound() +{ + if [ -n "$unbound_restart" ]; then + eval $unbound_restart + elif [ -n "$RESTARTCMD" ]; then + set -- ${unbound_service} + eval $RESTARTCMD + else + @SBINDIR@/resolvconf -r ${unbound_service} + fi +} + if [ ! -f "$unbound_conf" ] || \ [ "$(cat "$unbound_conf")" != "$(printf %s "$newconf")" ] then @@ -78,9 +89,9 @@ then # If we can't sent a HUP then force a restart if [ -s "$unbound_pid" ]; then if ! kill -HUP $(cat "$unbound_pid") 2>/dev/null; then - eval $unbound_restart + restart_unbound fi else - eval $unbound_restart + restart_unbound fi fi From owner-svn-src-head@freebsd.org Wed Jul 20 03:55: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 2ABE2B9E3B7 for ; Wed, 20 Jul 2016 03:55:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm28.bullet.mail.bf1.yahoo.com (nm28.bullet.mail.bf1.yahoo.com [98.139.212.187]) (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 D814213A7 for ; Wed, 20 Jul 2016 03:55:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1468986931; bh=92z0aOcrKdYbPK0anLyxfrtft7woSolB0w7KRwZt7FQ=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=hWFtUT1rzYqzlXzxqKvgjOMHXR5uYFvej2khcRB2uIaAkLkst58wEMhwvydDAU9uPjr6KrSJ0kb7cc6pUcxCite0Fs4oLJgFMN2mSHcScH5ssy4QrGseJpXnGcFKmz7L8Zt+q6l0r81AVAQ9ZSeXft9nx3POY7UxmU4j1zfyW/IwzLnnAgna0GUUZ5D9c/5LqBoH47idSBVfO9DJlsZEKJfmj8Cwc/CuD4LZCK/qGyTanpITBviAfp/UmvNMJf9zAb2Fj4M29ujQ6ZGL/dpG8Sro3FHOHAc1YDlAEKaNk/byaF/bZ/ppOk6sKnddJdLS0IedTxS73WKKXO8Pv6tKLg== Received: from [98.139.215.143] by nm28.bullet.mail.bf1.yahoo.com with NNFMP; 20 Jul 2016 03:55:31 -0000 Received: from [98.139.211.196] by tm14.bullet.mail.bf1.yahoo.com with NNFMP; 20 Jul 2016 03:55:31 -0000 Received: from [127.0.0.1] by smtp205.mail.bf1.yahoo.com with NNFMP; 20 Jul 2016 03:55:31 -0000 X-Yahoo-Newman-Id: 205918.21047.bm@smtp205.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: cdTdtzMVM1lpQpKtZQ8QxGC1GDbHQHBkPG7lKINz.b5MZg4 SrP1tU9Gki08AabhqVPdE2zoILHNa4HzjFZAq2hjf.gTcWvxHqTZsYP57rvB dNGFEM8mkkHn3O2UrcJdQVoB8G0eatVH3uPFjj59g2Mi4WactjYZixpf_LJ. loUa26uIOlAbFuSxGFr4fK6YyNo6JVNzUj8bJwaHleGem9EAakKSm7TNzIIV vsfSS1DJdE61H5pnn7l25bU6Kz4Z2Iko_CP0H2YwcnYjRx9EK9cZ3Y0fivln 0qY4xAbuI4PSZpw8YAbQJ6RR45voHNNr.0C4HBk.7CSA7NMhKPKOdDMo39pX Tpv_EA1yofnjM6wcL7zRQF9HqdMMDACoayyBKpc1DXINHtM3FECIYKwyS50T kmD7__nhOdXDTZZo1UW.IFs6Fs2iRx29blVoWJnGuBq_rCsxROkAdx0m0g3M k44xuwem5WCl.skzo85MhjwoyRGEWHSgmHPK3Fp_pVqfZXA.DuuOrtA_zMq4 XZcwnUc8lU3E2eYCaF_kwtSpyjzly4DNhcfOIWk3gus_9MA-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303062 - head/contrib/openresolv To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607200352.u6K3q4I3015185@repo.freebsd.org> From: Pedro Giffuni Message-ID: <1c75b9d0-d70b-7e23-709c-f4ed1c5bfe3b@FreeBSD.org> Date: Tue, 19 Jul 2016 22:55:34 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201607200352.u6K3q4I3015185@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: Wed, 20 Jul 2016 03:55:33 -0000 On 07/19/16 22:52, Pedro F. Giffuni wrote: > Author: pfg > Date: Wed Jul 20 03:52:04 2016 > New Revision: 303062 > URL: https://svnweb.freebsd.org/changeset/base/303062 > > Log: > MFV r298167, r300962, r303048: > openresolv: update to version 3.8.1. > > Among the new features it attempts to support alternative init systems. > > MFC after: 1 month > In case it's not clear ... While I am running this and I don't see any issue, I don't have sufficient confidence yet to merge it into a release. Pedro. From owner-svn-src-head@freebsd.org Wed Jul 20 04:10: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 B509CB9E617; Wed, 20 Jul 2016 04:10:00 +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 4FA731987; Wed, 20 Jul 2016 04:10:00 +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 u6K49sN4015263 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 20 Jul 2016 07:09:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u6K49sN4015263 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u6K49sbQ015262; Wed, 20 Jul 2016 07:09:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 20 Jul 2016 07:09:54 +0300 From: Konstantin Belousov To: Jan Beich Cc: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303033 - head/share/man/man7 Message-ID: <20160720040954.GM38613@kib.kiev.ua> References: <201607191746.u6JHk9ov092270@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: Wed, 20 Jul 2016 04:10:00 -0000 On Wed, Jul 20, 2016 at 05:01:03AM +0200, Jan Beich wrote: > Ed Maste writes: > > > +.It Sy Architecture Ta Sy Page Sizes > > +.It amd64 Ta 4K, 2M, 1G > > Does FreeBSD support 1G pages nowadays? Define what do you mean by 'support'. The direct map is mapped with 1G pages where possible, and the mappings are demoted when page attributes change. Neither kernel nor userspace mappings are promoted to 1G superpages in the current pmap. From owner-svn-src-head@freebsd.org Wed Jul 20 04:25: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 80078B9EABC; Wed, 20 Jul 2016 04:25:10 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A01126B; Wed, 20 Jul 2016 04:25:10 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6K4P9W1029161; Wed, 20 Jul 2016 04:25:09 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K4P93p029160; Wed, 20 Jul 2016 04:25:09 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201607200425.u6K4P93p029160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Wed, 20 Jul 2016 04:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303063 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 04:25:10 -0000 Author: stevek Date: Wed Jul 20 04:25:09 2016 New Revision: 303063 URL: https://svnweb.freebsd.org/changeset/base/303063 Log: Add myself (stevek) as a src committer and mentor (sjg) to committers-src.dot Approved by: sjg (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Wed Jul 20 03:52:04 2016 (r303062) +++ head/share/misc/committers-src.dot Wed Jul 20 04:25:09 2016 (r303063) @@ -303,6 +303,7 @@ sobomax [label="Maxim Sobolev\nsobomax@F sos [label="Soren Schmidt\nsos@FreeBSD.org\n????/??/??"] sson [label="Stacey Son\nsson@FreeBSD.org\n2008/07/08"] stas [label="Stanislav Sedov\nstas@FreeBSD.org\n2008/08/22"] +stevek [label="Stephen J. Kiernan\nstevek@FreeBSD.org\n2016/07/18"] suz [label="SUZUKI Shinsuke\nsuz@FreeBSD.org\n2002/03/26"] syrinx [label="Shteryana Shopova\nsyrinx@FreeBSD.org\n2006/10/07"] takawata [label="Takanori Watanabe\ntakawata@FreeBSD.org\n2000/07/06"] @@ -754,6 +755,7 @@ shin -> ume simon -> benl sjg -> phil +sjg -> stevek sos -> marcel From owner-svn-src-head@freebsd.org Wed Jul 20 05:03: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 4780AB9F453; Wed, 20 Jul 2016 05:03: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 24C7F177A; Wed, 20 Jul 2016 05:03:06 +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 u6K535ij043853; Wed, 20 Jul 2016 05:03:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K535Oc043849; Wed, 20 Jul 2016 05:03:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200503.u6K535Oc043849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 05:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303066 - in head/sys/dev/hyperv: include 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, 20 Jul 2016 05:03:06 -0000 Author: sephe Date: Wed Jul 20 05:03:04 2016 New Revision: 303066 URL: https://svnweb.freebsd.org/changeset/base/303066 Log: hyperv/vmbus: Get rid of unnecessary definition. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7240 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 04:49:01 2016 (r303065) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:03:04 2016 (r303066) @@ -58,8 +58,6 @@ #include #include -typedef uint8_t hv_bool_uint8_t; - #define HV_S_OK 0x00000000 #define HV_E_FAIL 0x80004005 #define HV_ERROR_NOT_SUPPORTED 0x80070032 @@ -90,8 +88,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -#define HW_MACADDR_LEN 6 - /* * Common defines for Hyper-V ICs */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 20 04:49:01 2016 (r303065) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 20 05:03:04 2016 (r303066) @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -1065,12 +1066,12 @@ typedef struct netvsc_dev_ { nvsp_msg channel_init_packet; nvsp_msg revoke_packet; - /*uint8_t hw_mac_addr[HW_MACADDR_LEN];*/ + /*uint8_t hw_mac_addr[ETHER_ADDR_LEN];*/ /* Holds rndis device info */ void *extension; - hv_bool_uint8_t destroy; + uint8_t destroy; /* Negotiated NVSP version */ uint32_t nvsp_version; @@ -1109,7 +1110,7 @@ typedef void (*pfn_on_send_rx_completion #endif typedef struct netvsc_packet_ { - hv_bool_uint8_t is_data_pkt; /* One byte */ + uint8_t is_data_pkt; /* One byte */ uint16_t vlan_tci; uint32_t status; @@ -1140,7 +1141,7 @@ typedef struct netvsc_packet_ { typedef struct { uint8_t mac_addr[6]; /* Assumption unsigned long */ - hv_bool_uint8_t link_state; + uint8_t link_state; } netvsc_device_info; #ifndef HN_USE_TXDESC_BUFRING Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 20 04:49:01 2016 (r303065) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 20 05:03:04 2016 (r303066) @@ -699,7 +699,7 @@ cleanup: static inline int hv_rf_query_device_mac(rndis_device *device) { - uint32_t size = HW_MACADDR_LEN; + uint32_t size = ETHER_ADDR_LEN; return (hv_rf_query_device(device, RNDIS_OID_802_3_PERMANENT_ADDRESS, device->hw_mac_addr, &size)); @@ -1126,7 +1126,7 @@ hv_rf_on_device_add(struct hn_softc *sc, "hv_rf_send_offload_request failed, ret=%d\n", ret); } - memcpy(dev_info->mac_addr, rndis_dev->hw_mac_addr, HW_MACADDR_LEN); + memcpy(dev_info->mac_addr, rndis_dev->hw_mac_addr, ETHER_ADDR_LEN); hv_rf_query_device_link_status(rndis_dev); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 20 04:49:01 2016 (r303065) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 20 05:03:04 2016 (r303066) @@ -31,6 +31,8 @@ #ifndef __HV_RNDIS_FILTER_H__ #define __HV_RNDIS_FILTER_H__ +#include +#include /* * Defines @@ -103,7 +105,7 @@ typedef struct rndis_device_ { STAILQ_HEAD(RQ, rndis_request_) myrequest_list; - uint8_t hw_mac_addr[HW_MACADDR_LEN]; + uint8_t hw_mac_addr[ETHER_ADDR_LEN]; } rndis_device; /* From owner-svn-src-head@freebsd.org Wed Jul 20 05:08: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 36FC0B9F4F6 for ; Wed, 20 Jul 2016 05:08:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::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 E259C19D5 for ; Wed, 20 Jul 2016 05:08:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id u186so108342563ita.0 for ; Tue, 19 Jul 2016 22:08:55 -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=78063zK/ujFVtirHf7zN4D0t3SeDx1kAuMrFiReU7XI=; b=eqxozsPbyV1sakLNq7GmUjP8OckWlRtlRnqcDnztWp9ccxJCzhuv08PxKBAYhJsDIA tlnf4gsyrgpl4A1tSupqPBOwognikBCYC1ySCCbj540OQgJsksAbz9+6IeRkokajIdJg ezUqiFGaenYzWS6tYVivNR11YrPEfv54lhxq7WPUpQpqJ9qK4a4m5mCh92M3MYRz/nRV 4tWNChMtQjmTP5hglm4EvOlSkA9kDSsQoSLCol8RSrS7vdrrS4F6vkz9cQSmO579T0+v LdOk0SlA9oeP3RUaO+piqeLM6XAxkahTvh233sJKo5alTPa1QKSBt4dLq0VV/MZ+Vp9d V03A== 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=78063zK/ujFVtirHf7zN4D0t3SeDx1kAuMrFiReU7XI=; b=kr73j2ljh+2mO9ehbNTF4YwvOSK9c9LymgaCS7F1Iaj7GI/5+YZRpdvLFeD8E/wCk9 xha2MhUmamfoXQAF26O4hy5DDO4fw3I14WEj/7FzHweRAHcNZ5lOVab9xpCrx9N9tMfE zvhLxnzqDau/tfNKr55mKHYVs8aAvqGoXPwI9yBiekhbL15KAPxpJJggOAASyQfqHSlY 7CUhtfOz6ucNpYD4BrMuUedRh9pap/28vU2DzJTEoGr7q1NpENAnE971W4ni1K4YNSpr xoX6TXRbgLBMP7yaj6FMCQwRln9yp+oIZZ5XEGamVrw7gK6Ogc0P2tzjPv/5MZOEPuHk rFMA== X-Gm-Message-State: ALyK8tJHhDF9Bkfg9gHYB3B60D6F4HFp1V5VfqvT9uTJiqkLbGu4gRrUt3Z4chaPfHbhbWoJI6OpCLoCsRa7kA== X-Received: by 10.36.108.194 with SMTP id w185mr7685620itb.72.1468991335103; Tue, 19 Jul 2016 22:08:55 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.137.131 with HTTP; Tue, 19 Jul 2016 22:08:54 -0700 (PDT) X-Originating-IP: [69.53.245.200] In-Reply-To: References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Warner Losh Date: Tue, 19 Jul 2016 23:08:54 -0600 X-Google-Sender-Auth: lWvuVhxctcnFpf1escJvIECscwo Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Jan Beich Cc: Ed Maste , 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, 20 Jul 2016 05:08:56 -0000 On Tue, Jul 19, 2016 at 9:01 PM, Jan Beich wrote: > Ed Maste writes: > >> +.It Sy Architecture Ta Sy Page Sizes >> +.It amd64 Ta 4K, 2M, 1G > > Does FreeBSD support 1G pages nowadays? > > $ sysctl hw.pagesizes > hw.pagesizes: 4096 2097152 0 > > $ dmesg | fgrep -i 1gb > AMD Features=0x2c100800 > >> +.Ss Predefined Macros >> +The compiler provides a number of predefined macros. >> +Some of these provide architecture-specific details and are explained below. >> +Other macros, including those required by the language standard, are not >> +included here. > [...] >> +cc -x c -Dm -E /dev/null > > Typo: -Dm vs. -dM > >> +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . > > Are these really compiler macros? I think, defines them. sys/endian.h defines them (and it implements that by including machine/endian.h in part). > $ clang38 -x c -dM -E /dev/null | fgrep ENDIAN > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ > #define __LITTLE_ENDIAN__ 1 > #define __ORDER_BIG_ENDIAN__ 4321 > #define __ORDER_LITTLE_ENDIAN__ 1234 > #define __ORDER_PDP_ENDIAN__ 3412 > > $ gcc5 -x c -dM -E /dev/null | fgrep ENDIAN > #define __ORDER_LITTLE_ENDIAN__ 1234 > #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ > #define __ORDER_PDP_ENDIAN__ 3412 > #define __ORDER_BIG_ENDIAN__ 4321 > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ This is why they are defined in machine/endian.h. Compilers have been somewhat inconsistent in the past. Warner From owner-svn-src-head@freebsd.org Wed Jul 20 05:16: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 DF538B9F72C; Wed, 20 Jul 2016 05:16: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 A377B1F4F; Wed, 20 Jul 2016 05:16:24 +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 u6K5GN1e047694; Wed, 20 Jul 2016 05:16:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K5GNSU047687; Wed, 20 Jul 2016 05:16:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200516.u6K5GNSU047687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 05:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303067 - in head/sys/dev/hyperv: include 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, 20 Jul 2016 05:16:25 -0000 Author: sephe Date: Wed Jul 20 05:16:23 2016 New Revision: 303067 URL: https://svnweb.freebsd.org/changeset/base/303067 Log: hyperv/vmbus: Move IC register definition to Hyper-V utilities MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7241 Added: head/sys/dev/hyperv/utilities/hv_utilreg.h (contents, props changed) Modified: head/sys/dev/hyperv/include/hyperv.h 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 Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:16:23 2016 (r303067) @@ -58,11 +58,6 @@ #include #include -#define HV_S_OK 0x00000000 -#define HV_E_FAIL 0x80004005 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 - /* * VMBUS version is 32 bit, upper 16 bit for major_number and lower * 16 bit for minor_number. @@ -88,60 +83,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -/* - * Common defines for Hyper-V ICs - */ -#define HV_ICMSGTYPE_NEGOTIATE 0 -#define HV_ICMSGTYPE_HEARTBEAT 1 -#define HV_ICMSGTYPE_KVPEXCHANGE 2 -#define HV_ICMSGTYPE_SHUTDOWN 3 -#define HV_ICMSGTYPE_TIMESYNC 4 -#define HV_ICMSGTYPE_VSS 5 - -#define HV_ICMSGHDRFLAG_TRANSACTION 1 -#define HV_ICMSGHDRFLAG_REQUEST 2 -#define HV_ICMSGHDRFLAG_RESPONSE 4 - -typedef struct hv_vmbus_pipe_hdr { - uint32_t flags; - uint32_t msgsize; -} __packed hv_vmbus_pipe_hdr; - -typedef struct hv_vmbus_ic_version { - uint16_t major; - uint16_t minor; -} __packed hv_vmbus_ic_version; - -typedef struct hv_vmbus_icmsg_hdr { - hv_vmbus_ic_version icverframe; - uint16_t icmsgtype; - hv_vmbus_ic_version icvermsg; - uint16_t icmsgsize; - uint32_t status; - uint8_t ictransaction_id; - uint8_t icflags; - uint8_t reserved[2]; -} __packed hv_vmbus_icmsg_hdr; - -typedef struct hv_vmbus_icmsg_negotiate { - uint16_t icframe_vercnt; - uint16_t icmsg_vercnt; - uint32_t reserved; - hv_vmbus_ic_version icversion_data[1]; /* any size array */ -} __packed hv_vmbus_icmsg_negotiate; - -typedef struct hv_vmbus_shutdown_msg_data { - uint32_t reason_code; - uint32_t timeout_seconds; - uint32_t flags; - uint8_t display_message[2048]; -} __packed hv_vmbus_shutdown_msg_data; - -typedef struct hv_vmbus_heartbeat_msg_data { - uint64_t seq_num; - uint32_t reserved[8]; -} __packed hv_vmbus_heartbeat_msg_data; - typedef struct { /* * offset in bytes from the start of ring data below Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 20 05:16:23 2016 (r303067) @@ -36,6 +36,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 05:16:23 2016 (r303067) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_util.h" #include "unicode.h" Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 20 05:16:23 2016 (r303067) @@ -41,6 +41,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 20 05:16:23 2016 (r303067) @@ -41,6 +41,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 20 05:03:04 2016 (r303066) +++ head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 20 05:16:23 2016 (r303067) @@ -41,6 +41,7 @@ #include #include +#include #include "hv_util.h" void Added: head/sys/dev/hyperv/utilities/hv_utilreg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/hv_utilreg.h Wed Jul 20 05:16:23 2016 (r303067) @@ -0,0 +1,91 @@ +/*- + * 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 _HV_UTILREG_H_ +#define _HV_UTILREG_H_ + +#define HV_S_OK 0x00000000 +#define HV_E_FAIL 0x80004005 +#define HV_ERROR_NOT_SUPPORTED 0x80070032 +#define HV_ERROR_MACHINE_LOCKED 0x800704F7 + +/* + * Common defines for Hyper-V ICs + */ +#define HV_ICMSGTYPE_NEGOTIATE 0 +#define HV_ICMSGTYPE_HEARTBEAT 1 +#define HV_ICMSGTYPE_KVPEXCHANGE 2 +#define HV_ICMSGTYPE_SHUTDOWN 3 +#define HV_ICMSGTYPE_TIMESYNC 4 +#define HV_ICMSGTYPE_VSS 5 + +#define HV_ICMSGHDRFLAG_TRANSACTION 1 +#define HV_ICMSGHDRFLAG_REQUEST 2 +#define HV_ICMSGHDRFLAG_RESPONSE 4 + +typedef struct hv_vmbus_pipe_hdr { + uint32_t flags; + uint32_t msgsize; +} __packed hv_vmbus_pipe_hdr; + +typedef struct hv_vmbus_ic_version { + uint16_t major; + uint16_t minor; +} __packed hv_vmbus_ic_version; + +typedef struct hv_vmbus_icmsg_hdr { + hv_vmbus_ic_version icverframe; + uint16_t icmsgtype; + hv_vmbus_ic_version icvermsg; + uint16_t icmsgsize; + uint32_t status; + uint8_t ictransaction_id; + uint8_t icflags; + uint8_t reserved[2]; +} __packed hv_vmbus_icmsg_hdr; + +typedef struct hv_vmbus_icmsg_negotiate { + uint16_t icframe_vercnt; + uint16_t icmsg_vercnt; + uint32_t reserved; + hv_vmbus_ic_version icversion_data[1]; /* any size array */ +} __packed hv_vmbus_icmsg_negotiate; + +typedef struct hv_vmbus_shutdown_msg_data { + uint32_t reason_code; + uint32_t timeout_seconds; + uint32_t flags; + uint8_t display_message[2048]; +} __packed hv_vmbus_shutdown_msg_data; + +typedef struct hv_vmbus_heartbeat_msg_data { + uint64_t seq_num; + uint32_t reserved[8]; +} __packed hv_vmbus_heartbeat_msg_data; + +#endif /* !_HV_UTILREG_H_ */ From owner-svn-src-head@freebsd.org Wed Jul 20 05:26: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 AF2CDB9FB10; Wed, 20 Jul 2016 05:26: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 7CA531666; Wed, 20 Jul 2016 05:26: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 u6K5Q4fg051289; Wed, 20 Jul 2016 05:26:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K5Q4Do051283; Wed, 20 Jul 2016 05:26:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200526.u6K5Q4Do051283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 05:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303068 - 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: Wed, 20 Jul 2016 05:26:05 -0000 Author: sephe Date: Wed Jul 20 05:26:04 2016 New Revision: 303068 URL: https://svnweb.freebsd.org/changeset/base/303068 Log: hyperv/vmbus: Channel struct field rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7242 Modified: head/sys/dev/hyperv/include/hyperv.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/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:26:04 2016 (r303068) @@ -117,7 +117,7 @@ typedef void (*vmbus_chan_callback_t)(vo typedef struct hv_vmbus_channel { device_t ch_dev; - struct vmbus_softc *vmbus_sc; + struct vmbus_softc *ch_vmbus; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ @@ -129,13 +129,13 @@ typedef struct hv_vmbus_channel { uint32_t ch_montrig_mask;/* MNF trig mask */ /* - * send to parent + * TX bufring; at the beginning of ch_bufring. */ - hv_vmbus_ring_buffer_info outbound; + hv_vmbus_ring_buffer_info ch_txbr; /* - * receive from parent + * RX bufring; immediately following ch_txbr. */ - hv_vmbus_ring_buffer_info inbound; + hv_vmbus_ring_buffer_info ch_rxbr; struct taskqueue *ch_tq; struct task ch_task; @@ -169,9 +169,9 @@ typedef struct hv_vmbus_channel { /* * Driver private data */ - void *hv_chan_priv1; - void *hv_chan_priv2; - void *hv_chan_priv3; + void *ch_dev_priv1; + void *ch_dev_priv2; + void *ch_dev_priv3; void *ch_bufring; /* TX+RX bufrings */ struct hyperv_dma ch_bufring_dma; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:26:04 2016 (r303068) @@ -50,7 +50,7 @@ #include "hv_rndis_filter.h" /* priv1 and priv2 are consumed by the main driver */ -#define hv_chan_rdbuf hv_chan_priv3 +#define ch_dev_rdbuf ch_dev_priv3 MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); @@ -644,7 +644,7 @@ void hv_nv_subchan_attach(struct hv_vmbus_channel *chan) { - chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); @@ -670,7 +670,7 @@ hv_nv_on_device_add(struct hn_softc *sc, sema_init(&net_dev->channel_init_sema, 0, "netdev_sema"); - chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); /* * Open the channel @@ -679,7 +679,7 @@ hv_nv_on_device_add(struct hn_softc *sc, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); if (ret != 0) { - free(chan->hv_chan_rdbuf, M_NETVSC); + free(chan->ch_dev_rdbuf, M_NETVSC); goto cleanup; } @@ -694,7 +694,7 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ - free(chan->hv_chan_rdbuf, M_NETVSC); + free(chan->ch_dev_rdbuf, M_NETVSC); vmbus_chan_close(chan); cleanup: @@ -725,7 +725,7 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); + free(sc->hn_prichan->ch_dev_rdbuf, M_NETVSC); vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); @@ -986,7 +986,7 @@ hv_nv_on_channel_callback(void *xchan) if (net_dev == NULL) return; - buffer = chan->hv_chan_rdbuf; + buffer = chan->ch_dev_rdbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; uint32_t bytes_rxed; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 05:26:04 2016 (r303068) @@ -120,8 +120,8 @@ __FBSDID("$FreeBSD$"); #include "hv_rndis_filter.h" #include "vmbus_if.h" -#define hv_chan_rxr hv_chan_priv1 -#define hv_chan_txr hv_chan_priv2 +#define ch_dev_rxr ch_dev_priv1 +#define ch_dev_txr ch_dev_priv2 /* Short for Hyper-V network interface */ #define NETVSC_DEVNAME "hn" @@ -811,9 +811,9 @@ hn_tx_done(struct hv_vmbus_channel *chan void netvsc_channel_rollup(struct hv_vmbus_channel *chan) { - struct hn_tx_ring *txr = chan->hv_chan_txr; + struct hn_tx_ring *txr = chan->ch_dev_txr; #if defined(INET) || defined(INET6) - struct hn_rx_ring *rxr = chan->hv_chan_rxr; + struct hn_rx_ring *rxr = chan->ch_dev_rxr; tcp_lro_flush_all(&rxr->hn_lro); #endif @@ -1284,7 +1284,7 @@ netvsc_recv(struct hv_vmbus_channel *cha const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value) { - struct hn_rx_ring *rxr = chan->hv_chan_rxr; + struct hn_rx_ring *rxr = chan->ch_dev_rxr; struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; @@ -2928,7 +2928,7 @@ hn_channel_attach(struct hn_softc *sc, s ("RX ring %d already attached", idx)); rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; - chan->hv_chan_rxr = rxr; + chan->ch_dev_rxr = rxr; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", idx, chan->ch_id); @@ -2941,7 +2941,7 @@ hn_channel_attach(struct hn_softc *sc, s ("TX ring %d already attached", idx)); txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED; - chan->hv_chan_txr = txr; + chan->ch_dev_txr = txr; txr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 05:26:04 2016 (r303068) @@ -316,7 +316,7 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); - new_channel->hv_chan_priv1 = sc; + new_channel->ch_dev_priv1 = sc; vmbus_chan_cpu_rr(new_channel); ret = vmbus_chan_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, @@ -575,7 +575,7 @@ hv_storvsc_connect_vsp(struct storvsc_so /* * Open the channel */ - KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); + KASSERT(sc->hs_chan->ch_dev_priv1 == sc, ("invalid chan priv1")); vmbus_chan_cpu_rr(sc->hs_chan); ret = vmbus_chan_open( sc->hs_chan, @@ -773,7 +773,7 @@ hv_storvsc_on_channel_callback(void *xch { int ret = 0; hv_vmbus_channel *channel = xchan; - struct storvsc_softc *sc = channel->hv_chan_priv1; + struct storvsc_softc *sc = channel->ch_dev_priv1; uint32_t bytes_recvd; uint64_t request_id; uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)]; @@ -915,7 +915,7 @@ storvsc_attach(device_t dev) sc = device_get_softc(dev); sc->hs_chan = vmbus_get_channel(dev); - sc->hs_chan->hv_chan_priv1 = sc; + sc->hs_chan->ch_dev_priv1 = sc; stor_type = storvsc_get_storage_type(dev); Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Jul 20 05:26:04 2016 (r303068) @@ -1015,7 +1015,7 @@ vmbus_child_pnpinfo_str(device_t dev, de int vmbus_add_child(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; device_t parent = sc->vmbus_dev; int error = 0; @@ -1052,7 +1052,7 @@ vmbus_delete_child(struct hv_vmbus_chann * device_add_child() */ mtx_lock(&Giant); - error = device_delete_child(chan->vmbus_sc->vmbus_dev, chan->ch_dev); + error = device_delete_child(chan->ch_vmbus->vmbus_dev, chan->ch_dev); mtx_unlock(&Giant); return error; Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 05:16:23 2016 (r303067) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 05:26:04 2016 (r303068) @@ -83,7 +83,7 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; uint32_t chanid = chan->ch_id; atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], @@ -187,7 +187,7 @@ vmbus_chan_sysctl_create(struct hv_vmbus "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"); + &chan->ch_rxbr, "inbound ring buffer stats"); } /* @@ -197,7 +197,7 @@ vmbus_chan_sysctl_create(struct hv_vmbus "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"); + &chan->ch_txbr, "outbound ring buffer stats"); } } @@ -205,7 +205,7 @@ int vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; const struct vmbus_chanmsg_chopen_resp *resp; const struct vmbus_message *msg; struct vmbus_chanmsg_chopen *req; @@ -233,7 +233,7 @@ vmbus_chan_open(struct hv_vmbus_channel vmbus_chan_update_evtflagcnt(sc, chan); - chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + chan->ch_tq = VMBUS_PCPU_GET(chan->ch_vmbus, event_tq, chan->ch_cpuid); if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); else @@ -254,9 +254,9 @@ vmbus_chan_open(struct hv_vmbus_channel chan->ch_bufring = br; /* TX bufring comes first */ - hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size); + hv_vmbus_ring_buffer_init(&chan->ch_txbr, br, txbr_size); /* RX bufring immediately follows TX bufring */ - hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size); + hv_vmbus_ring_buffer_init(&chan->ch_rxbr, br + txbr_size, rxbr_size); /* Create sysctl tree for this channel */ vmbus_chan_sysctl_create(chan); @@ -337,7 +337,7 @@ 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_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; struct vmbus_chanmsg_gpadl_conn *req; const struct vmbus_message *msg; @@ -466,7 +466,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; struct vmbus_chanmsg_gpadl_disconn *req; int error; @@ -503,7 +503,7 @@ vmbus_chan_gpadl_disconnect(struct hv_vm static void vmbus_chan_close_internal(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; struct taskqueue *tq = chan->ch_tq; @@ -564,8 +564,8 @@ vmbus_chan_close_internal(struct hv_vmbu /* * Destroy the TX+RX bufrings. */ - hv_ring_buffer_cleanup(&chan->outbound); - hv_ring_buffer_cleanup(&chan->inbound); + hv_ring_buffer_cleanup(&chan->ch_txbr); + hv_ring_buffer_cleanup(&chan->ch_rxbr); if (chan->ch_bufring != NULL) { hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); chan->ch_bufring = NULL; @@ -635,7 +635,7 @@ vmbus_chan_send(struct hv_vmbus_channel iov[2].iov_base = &pad; iov[2].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); + error = hv_ring_buffer_write(&chan->ch_txbr, iov, 3, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -675,7 +675,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c iov[3].iov_base = &pad; iov[3].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -717,7 +717,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ iov[3].iov_base = &pad; iov[3].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -730,7 +730,7 @@ vmbus_chan_recv(struct hv_vmbus_channel struct vmbus_chanpkt_hdr pkt; int error, dlen, hlen; - error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) return error; @@ -747,7 +747,7 @@ vmbus_chan_recv(struct hv_vmbus_channel *dlen0 = dlen; /* Skip packet header */ - error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen); + error = hv_ring_buffer_read(&chan->ch_rxbr, data, dlen, hlen); KASSERT(!error, ("hv_ring_buffer_read failed")); return 0; @@ -760,7 +760,7 @@ vmbus_chan_recv_pkt(struct hv_vmbus_chan struct vmbus_chanpkt_hdr pkt; int error, pktlen; - error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) return error; @@ -773,7 +773,7 @@ vmbus_chan_recv_pkt(struct hv_vmbus_chan *pktlen0 = pktlen; /* Include packet header */ - error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0); + error = hv_ring_buffer_read(&chan->ch_rxbr, pkt0, pktlen, 0); KASSERT(!error, ("hv_ring_buffer_read failed")); return 0; @@ -803,12 +803,12 @@ vmbus_chan_task(void *xchan, int pending cb(cbarg); - left = hv_ring_buffer_read_end(&chan->inbound); + left = hv_ring_buffer_read_end(&chan->ch_rxbr); if (left == 0) { /* No more data in RX bufring; done */ break; } - hv_ring_buffer_read_begin(&chan->inbound); + hv_ring_buffer_read_begin(&chan->ch_rxbr); } } @@ -850,7 +850,7 @@ vmbus_event_flags_proc(struct vmbus_soft continue; if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - hv_ring_buffer_read_begin(&chan->inbound); + hv_ring_buffer_read_begin(&chan->ch_rxbr); taskqueue_enqueue(chan->ch_tq, &chan->ch_task); } } @@ -925,7 +925,7 @@ vmbus_chan_alloc(struct vmbus_softc *sc) return NULL; } - chan->vmbus_sc = sc; + chan->ch_vmbus = 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); @@ -947,7 +947,7 @@ vmbus_chan_free(struct hv_vmbus_channel static int vmbus_chan_add(struct hv_vmbus_channel *newchan) { - struct vmbus_softc *sc = newchan->vmbus_sc; + struct vmbus_softc *sc = newchan->ch_vmbus; struct hv_vmbus_channel *prichan; if (newchan->ch_id == 0) { @@ -1040,14 +1040,14 @@ vmbus_chan_cpu_set(struct hv_vmbus_chann { 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) { + if (chan->ch_vmbus->vmbus_version == VMBUS_VERSION_WS2008 || + chan->ch_vmbus->vmbus_version == VMBUS_VERSION_WIN7) { /* Only cpu0 is supported */ cpu = 0; } chan->ch_cpuid = cpu; - chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + chan->ch_vcpuid = VMBUS_PCPU_GET(chan->ch_vmbus, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -1180,7 +1180,7 @@ vmbus_chan_detach_task(void *xchan, int vmbus_delete_child(chan); /* NOTE: DO NOT free primary channel for now */ } else { - struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_softc *sc = chan->ch_vmbus; struct hv_vmbus_channel *pri_chan = chan->ch_prichan; struct vmbus_chanmsg_chfree *req; struct vmbus_msghc *mh; @@ -1264,7 +1264,7 @@ vmbus_chan_cpu2chan(struct hv_vmbus_chan if (TAILQ_EMPTY(&prichan->ch_subchans)) return prichan; - vcpu = VMBUS_PCPU_GET(prichan->vmbus_sc, vcpuid, cpu); + vcpu = VMBUS_PCPU_GET(prichan->ch_vmbus, vcpuid, cpu); #define CHAN_VCPU_DIST(ch, vcpu) \ (((ch)->ch_vcpuid > (vcpu)) ? \ From owner-svn-src-head@freebsd.org Wed Jul 20 05:34: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 1B267B9FC50; Wed, 20 Jul 2016 05:34: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 CEDBC1A94; Wed, 20 Jul 2016 05:34: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 u6K5YUDj054844; Wed, 20 Jul 2016 05:34:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K5YTZW054833; Wed, 20 Jul 2016 05:34:29 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200534.u6K5YTZW054833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 05:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303069 - 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: Wed, 20 Jul 2016 05:34:31 -0000 Author: sephe Date: Wed Jul 20 05:34:28 2016 New Revision: 303069 URL: https://svnweb.freebsd.org/changeset/base/303069 Log: hyperv/vmbus: Pass channel as the first argument for channel callback The prepares to kill device private fields in channel struct, which are not flexible and extensible. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7243 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hv_net_vsc.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/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:34:28 2016 (r303069) @@ -113,7 +113,9 @@ typedef struct { uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; -typedef void (*vmbus_chan_callback_t)(void *); +struct hv_vmbus_channel; + +typedef void (*vmbus_chan_callback_t)(struct hv_vmbus_channel *, void *); typedef struct hv_vmbus_channel { device_t ch_dev; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:34:28 2016 (r303069) @@ -57,7 +57,7 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static void hv_nv_on_channel_callback(void *xchan); +static void hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *arg); 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); @@ -647,7 +647,7 @@ hv_nv_subchan_attach(struct hv_vmbus_cha chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, - hv_nv_on_channel_callback, chan); + hv_nv_on_channel_callback, NULL); } /* @@ -677,7 +677,7 @@ hv_nv_on_device_add(struct hn_softc *sc, */ ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, - NULL, 0, hv_nv_on_channel_callback, chan); + NULL, 0, hv_nv_on_channel_callback, NULL); if (ret != 0) { free(chan->ch_dev_rdbuf, M_NETVSC); goto cleanup; @@ -973,9 +973,8 @@ hv_nv_send_table(struct hn_softc *sc, co * Net VSC on channel callback */ static void -hv_nv_on_channel_callback(void *xchan) +hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *arg __unused) { - struct hv_vmbus_channel *chan = xchan; device_t dev = chan->ch_dev; struct hn_softc *sc = device_get_softc(dev); netvsc_dev *net_dev; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 05:34:28 2016 (r303069) @@ -274,7 +274,7 @@ 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 *xchan); +static void hv_storvsc_on_channel_callback(struct hv_vmbus_channel *chan, void *xsc); static void hv_storvsc_on_iocompletion( struct storvsc_softc *sc, struct vstor_packet *vstor_packet, struct hv_storvsc_request *request); @@ -316,15 +316,13 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); - new_channel->ch_dev_priv1 = sc; vmbus_chan_cpu_rr(new_channel); ret = vmbus_chan_open(new_channel, 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, - new_channel); + hv_storvsc_on_channel_callback, sc); } /** @@ -575,7 +573,6 @@ hv_storvsc_connect_vsp(struct storvsc_so /* * Open the channel */ - KASSERT(sc->hs_chan->ch_dev_priv1 == sc, ("invalid chan priv1")); vmbus_chan_cpu_rr(sc->hs_chan); ret = vmbus_chan_open( sc->hs_chan, @@ -583,8 +580,7 @@ hv_storvsc_connect_vsp(struct storvsc_so sc->hs_drv_props->drv_ringbuffer_size, (void *)&props, sizeof(struct vmstor_chan_props), - hv_storvsc_on_channel_callback, - sc->hs_chan); + hv_storvsc_on_channel_callback, sc); if (ret != 0) { return ret; @@ -769,11 +765,10 @@ hv_storvsc_rescan_target(struct storvsc_ } static void -hv_storvsc_on_channel_callback(void *xchan) +hv_storvsc_on_channel_callback(struct hv_vmbus_channel *channel, void *xsc) { int ret = 0; - hv_vmbus_channel *channel = xchan; - struct storvsc_softc *sc = channel->ch_dev_priv1; + struct storvsc_softc *sc = xsc; uint32_t bytes_recvd; uint64_t request_id; uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)]; @@ -915,7 +910,6 @@ storvsc_attach(device_t dev) sc = device_get_softc(dev); sc->hs_chan = vmbus_get_channel(dev); - sc->hs_chan->ch_dev_priv1 = sc; stor_type = storvsc_get_storage_type(dev); @@ -1265,7 +1259,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_chan); + hv_storvsc_on_channel_callback(sc->hs_chan, sc); mtx_lock(&sc->hs_lock); } Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Wed Jul 20 05:34:28 2016 (r303069) @@ -49,10 +49,9 @@ static const struct hyperv_guid service_ * Process heartbeat message */ static void -hv_heartbeat_cb(void *context) +hv_heartbeat_cb(struct hv_vmbus_channel *channel, void *context) { uint8_t* buf; - hv_vmbus_channel* channel; int recvlen; uint64_t requestid; int ret; @@ -63,7 +62,6 @@ hv_heartbeat_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; - channel = softc->channel; recvlen = PAGE_SIZE; ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid); Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 05:34:28 2016 (r303069) @@ -121,6 +121,7 @@ static struct cdevsw hv_kvp_cdevsw = */ typedef struct hv_kvp_sc { struct hv_util_sc util_sc; + device_t dev; /* Unless specified the pending mutex should be * used to alter the values of the following parameters: @@ -576,7 +577,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 = vmbus_chan_send(sc->util_sc.channel, + error = vmbus_chan_send(vmbus_get_channel(sc->dev), VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, sc->host_msg_id); if (error) @@ -625,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.channel; + channel = vmbus_get_channel(sc->dev); recvlen = 2 * PAGE_SIZE; ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); @@ -709,7 +710,7 @@ hv_kvp_process_request(void *context, in * Callback routine that gets called whenever there is a message from host */ static void -hv_kvp_callback(void *context) +hv_kvp_callback(struct hv_vmbus_channel *chan __unused, void *context) { hv_kvp_sc *sc = (hv_kvp_sc*)context; /* @@ -813,7 +814,7 @@ hv_kvp_dev_daemon_write(struct cdev *dev if (sc->register_done == false) { if (sc->daemon_kvp_msg.kvp_hdr.operation == HV_KVP_OP_REGISTER) { sc->register_done = true; - hv_kvp_callback(dev->si_drv1); + hv_kvp_callback(vmbus_get_channel(sc->dev), dev->si_drv1); } else { hv_kvp_log_info("%s, KVP Registration Failed\n", __func__); @@ -891,6 +892,7 @@ hv_kvp_attach(device_t dev) hv_kvp_sc *sc = (hv_kvp_sc*)device_get_softc(dev); sc->util_sc.callback = hv_kvp_callback; + sc->dev = dev; sema_init(&sc->dev_sema, 0, "hv_kvp device semaphore"); mtx_init(&sc->pending_mutex, "hv-kvp pending mutex", NULL, MTX_DEF); Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Wed Jul 20 05:34:28 2016 (r303069) @@ -53,10 +53,9 @@ static const struct hyperv_guid service_ * Shutdown */ static void -hv_shutdown_cb(void *context) +hv_shutdown_cb(struct hv_vmbus_channel *channel, void *context) { uint8_t* buf; - hv_vmbus_channel* channel; uint8_t execute_shutdown = 0; hv_vmbus_icmsg_hdr* icmsghdrp; uint32_t recv_len; @@ -67,7 +66,6 @@ hv_shutdown_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; - channel = softc->channel; recv_len = PAGE_SIZE; ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id); Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Wed Jul 20 05:34:28 2016 (r303069) @@ -130,9 +130,8 @@ void hv_adj_guesttime(hv_timesync_sc *sc * Time Sync Channel message handler */ static void -hv_timesync_cb(void *context) +hv_timesync_cb(struct hv_vmbus_channel *channel, void *context) { - hv_vmbus_channel* channel; hv_vmbus_icmsg_hdr* icmsghdrp; uint32_t recvlen; uint64_t requestId; @@ -142,7 +141,6 @@ hv_timesync_cb(void *context) hv_timesync_sc *softc; softc = (hv_timesync_sc*)context; - channel = softc->util_sc.channel; time_buf = softc->util_sc.receive_buffer; recvlen = PAGE_SIZE; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_util.c Wed Jul 20 05:34:28 2016 (r303069) @@ -77,12 +77,13 @@ int hv_util_attach(device_t dev) { struct hv_util_sc* softc; + struct hv_vmbus_channel *chan; int ret; softc = device_get_softc(dev); - softc->channel = vmbus_get_channel(dev); softc->receive_buffer = malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); + chan = vmbus_get_channel(dev); /* * These services are not performance critical and do not need @@ -91,11 +92,10 @@ hv_util_attach(device_t dev) * Turn off batched reading for all util drivers before we open the * channel. */ - vmbus_chan_set_readbatch(softc->channel, false); + vmbus_chan_set_readbatch(chan, false); - ret = vmbus_chan_open(softc->channel, 4 * PAGE_SIZE, - 4 * PAGE_SIZE, NULL, 0, - softc->callback, softc); + ret = vmbus_chan_open(chan, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, + softc->callback, softc); if (ret) goto error0; @@ -112,7 +112,7 @@ hv_util_detach(device_t dev) { struct hv_util_sc *sc = device_get_softc(dev); - vmbus_chan_close(sc->channel); + vmbus_chan_close(vmbus_get_channel(dev)); free(sc->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 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/utilities/hv_util.h Wed Jul 20 05:34:28 2016 (r303069) @@ -39,9 +39,7 @@ typedef struct hv_util_sc { /* * function to process Hyper-V messages */ - void (*callback)(void *); - - struct hv_vmbus_channel *channel; + void (*callback)(struct hv_vmbus_channel *, void *); uint8_t *receive_buffer; } hv_util_sc; Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 05:26:04 2016 (r303068) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 05:34:28 2016 (r303069) @@ -801,7 +801,7 @@ vmbus_chan_task(void *xchan, int pending for (;;) { uint32_t left; - cb(cbarg); + cb(chan, cbarg); left = hv_ring_buffer_read_end(&chan->ch_rxbr); if (left == 0) { @@ -817,7 +817,7 @@ vmbus_chan_task_nobatch(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - chan->ch_cb(chan->ch_cbarg); + chan->ch_cb(chan, chan->ch_cbarg); } static __inline void From owner-svn-src-head@freebsd.org Wed Jul 20 05:48: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 2B359B9FE1C; Wed, 20 Jul 2016 05:48:54 +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 EA5BB11E4; Wed, 20 Jul 2016 05:48: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 u6K5mr0f058760; Wed, 20 Jul 2016 05:48:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K5mq82058753; Wed, 20 Jul 2016 05:48:52 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200548.u6K5mq82058753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 05:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303070 - in head/sys/dev/hyperv: include 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, 20 Jul 2016 05:48:54 -0000 Author: sephe Date: Wed Jul 20 05:48:52 2016 New Revision: 303070 URL: https://svnweb.freebsd.org/changeset/base/303070 Log: hyperv/vmbus: Deprecate the device private data in channel struct They are neither flexible nor extensible. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7244 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.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:48:52 2016 (r303070) @@ -168,13 +168,6 @@ typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) ch_sublink; /* sub-channel link */ struct hv_vmbus_channel *ch_prichan; /* owner primary chan */ - /* - * Driver private data - */ - void *ch_dev_priv1; - void *ch_dev_priv2; - void *ch_dev_priv3; - void *ch_bufring; /* TX+RX bufrings */ struct hyperv_dma ch_bufring_dma; uint32_t ch_bufring_gpadl; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:48:52 2016 (r303070) @@ -49,15 +49,13 @@ #include "hv_rndis.h" #include "hv_rndis_filter.h" -/* priv1 and priv2 are consumed by the main driver */ -#define ch_dev_rdbuf ch_dev_priv3 - MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); /* * Forward declarations */ -static void hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *arg); +static void hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, + void *xrxr); 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); @@ -68,7 +66,7 @@ static void hv_nv_on_send_completion(net 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, + struct hn_rx_ring *rxr, struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); /* @@ -641,13 +639,14 @@ hv_nv_disconnect_from_vsp(netvsc_dev *ne } void -hv_nv_subchan_attach(struct hv_vmbus_channel *chan) +hv_nv_subchan_attach(struct hv_vmbus_channel *chan, struct hn_rx_ring *rxr) { - - chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + KASSERT(rxr->hn_rx_idx == chan->ch_subidx, + ("chan%u subidx %u, rxr%d mismatch", + chan->ch_id, chan->ch_subidx, rxr->hn_rx_idx)); vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, - hv_nv_on_channel_callback, NULL); + hv_nv_on_channel_callback, rxr); } /* @@ -656,7 +655,8 @@ 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 hn_softc *sc, void *additional_info) +hv_nv_on_device_add(struct hn_softc *sc, void *additional_info, + struct hn_rx_ring *rxr) { struct hv_vmbus_channel *chan = sc->hn_prichan; netvsc_dev *net_dev; @@ -670,18 +670,17 @@ hv_nv_on_device_add(struct hn_softc *sc, sema_init(&net_dev->channel_init_sema, 0, "netdev_sema"); - chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - /* * Open the channel */ + KASSERT(rxr->hn_rx_idx == chan->ch_subidx, + ("chan%u subidx %u, rxr%d mismatch", + chan->ch_id, chan->ch_subidx, rxr->hn_rx_idx)); ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, - NULL, 0, hv_nv_on_channel_callback, NULL); - if (ret != 0) { - free(chan->ch_dev_rdbuf, M_NETVSC); + NULL, 0, hv_nv_on_channel_callback, rxr); + if (ret != 0) goto cleanup; - } /* * Connect with the NetVsp @@ -694,7 +693,6 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ - free(chan->ch_dev_rdbuf, M_NETVSC); vmbus_chan_close(chan); cleanup: @@ -725,7 +723,6 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - free(sc->hn_prichan->ch_dev_rdbuf, M_NETVSC); vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); @@ -840,14 +837,13 @@ hv_nv_on_send(struct hv_vmbus_channel *c * with virtual addresses. */ static void -hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, +hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { 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; int count = 0; int i = 0; int status = nvsp_status_success; @@ -856,7 +852,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st /* 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 %u is invalid!\n", + if_printf(rxr->hn_ifp, "packet hdr type %u is invalid!\n", nvsp_msg_pkt->hdr.msg_type); return; } @@ -864,7 +860,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { - device_printf(dev, "rxbuf_id %d is invalid!\n", + if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", pkt->cp_rxbuf_id); return; } @@ -878,7 +874,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st 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); + hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { status = nvsp_status_failure; } @@ -973,10 +969,10 @@ hv_nv_send_table(struct hn_softc *sc, co * Net VSC on channel callback */ static void -hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *arg __unused) +hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *xrxr) { - device_t dev = chan->ch_dev; - struct hn_softc *sc = device_get_softc(dev); + struct hn_rx_ring *rxr = xrxr; + struct hn_softc *sc = rxr->hn_ifp->if_softc; netvsc_dev *net_dev; void *buffer; int bufferlen = NETVSC_PACKET_SIZE; @@ -985,7 +981,7 @@ hv_nv_on_channel_callback(struct hv_vmbu if (net_dev == NULL) return; - buffer = chan->ch_dev_rdbuf; + buffer = rxr->hn_rdbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; uint32_t bytes_rxed; @@ -1001,13 +997,13 @@ hv_nv_on_channel_callback(struct hv_vmbu pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(net_dev, sc, chan, pkt); + hv_nv_on_receive(net_dev, rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: hv_nv_send_table(sc, pkt); break; default: - device_printf(dev, + if_printf(rxr->hn_ifp, "unknown chan pkt %u\n", pkt->cph_type); break; @@ -1023,7 +1019,7 @@ hv_nv_on_channel_callback(struct hv_vmbu /* alloc new buffer */ buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); if (buffer == NULL) { - device_printf(dev, + if_printf(rxr->hn_ifp, "hv_cb malloc buffer failed, len=%u\n", bytes_rxed); bufferlen = 0; @@ -1039,5 +1035,5 @@ hv_nv_on_channel_callback(struct hv_vmbu if (bufferlen > NETVSC_PACKET_SIZE) free(buffer, M_NETVSC); - hv_rf_channel_rollup(chan); + hv_rf_channel_rollup(rxr, rxr->hn_txr); } Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Jul 20 05:48:52 2016 (r303070) @@ -1151,8 +1151,12 @@ SLIST_HEAD(hn_txdesc_list, hn_txdesc); struct buf_ring; #endif +struct hn_tx_ring; + struct hn_rx_ring { struct ifnet *hn_ifp; + struct hn_tx_ring *hn_txr; + void *hn_rdbuf; int hn_rx_idx; /* Trust csum verification on host side */ @@ -1266,12 +1270,13 @@ extern int hv_promisc_mode; 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); + void *additional_info, struct hn_rx_ring *rxr); 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); -void hv_nv_subchan_attach(struct hv_vmbus_channel *chan); +void hv_nv_subchan_attach(struct hv_vmbus_channel *chan, + struct hn_rx_ring *rxr); #endif /* __HV_NET_VSC_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 05:48:52 2016 (r303070) @@ -120,9 +120,6 @@ __FBSDID("$FreeBSD$"); #include "hv_rndis_filter.h" #include "vmbus_if.h" -#define ch_dev_rxr ch_dev_priv1 -#define ch_dev_txr ch_dev_priv2 - /* Short for Hyper-V network interface */ #define NETVSC_DEVNAME "hn" @@ -544,7 +541,8 @@ 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(sc, &device_info, ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, ring_cnt, + &sc->hn_rx_ring[0]); if (error) goto failed; KASSERT(sc->net_dev->num_channel > 0 && @@ -809,12 +807,9 @@ hn_tx_done(struct hv_vmbus_channel *chan } void -netvsc_channel_rollup(struct hv_vmbus_channel *chan) +netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { - struct hn_tx_ring *txr = chan->ch_dev_txr; #if defined(INET) || defined(INET6) - struct hn_rx_ring *rxr = chan->ch_dev_rxr; - tcp_lro_flush_all(&rxr->hn_lro); #endif @@ -1279,12 +1274,11 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb * Note: This is no longer used as a callback */ int -netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, +netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value) { - struct hn_rx_ring *rxr = chan->ch_dev_rxr; struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; @@ -1589,7 +1583,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, vmbus_subchan_drain(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, - sc->hn_rx_ring_inuse); + sc->hn_rx_ring_inuse, &sc->hn_rx_ring[0]); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -2223,6 +2217,9 @@ hn_create_rx_data(struct hn_softc *sc, i if (hn_trust_hostip) rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_IP; rxr->hn_ifp = sc->hn_ifp; + if (i < sc->hn_tx_ring_cnt) + rxr->hn_txr = &sc->hn_tx_ring[i]; + rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); rxr->hn_rx_idx = i; /* @@ -2335,17 +2332,19 @@ hn_create_rx_data(struct hn_softc *sc, i static void hn_destroy_rx_data(struct hn_softc *sc) { -#if defined(INET) || defined(INET6) int i; -#endif if (sc->hn_rx_ring_cnt == 0) return; + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { + struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; + #if defined(INET) || defined(INET6) - for (i = 0; i < sc->hn_rx_ring_cnt; ++i) - tcp_lro_free(&sc->hn_rx_ring[i].hn_lro); + tcp_lro_free(&rxr->hn_lro); #endif + free(rxr->hn_rdbuf, M_NETVSC); + } free(sc->hn_rx_ring, M_NETVSC); sc->hn_rx_ring = NULL; @@ -2928,7 +2927,6 @@ hn_channel_attach(struct hn_softc *sc, s ("RX ring %d already attached", idx)); rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; - chan->ch_dev_rxr = rxr; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", idx, chan->ch_id); @@ -2941,7 +2939,6 @@ hn_channel_attach(struct hn_softc *sc, s ("TX ring %d already attached", idx)); txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED; - chan->ch_dev_txr = txr; txr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", @@ -2968,22 +2965,25 @@ hn_subchan_attach(struct hn_softc *sc, s static void hn_subchan_setup(struct hn_softc *sc) { - struct hv_vmbus_channel **subchan; + struct hv_vmbus_channel **subchans; int subchan_cnt = sc->net_dev->num_channel - 1; int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); + subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { + struct hv_vmbus_channel *subchan = subchans[i]; + /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan[i]); - hv_nv_subchan_attach(subchan[i]); + hn_subchan_attach(sc, subchan); + hv_nv_subchan_attach(subchan, + &sc->hn_rx_ring[subchan->ch_subidx]); } /* Release the sub-channels */ - vmbus_subchan_rel(subchan, subchan_cnt); + vmbus_subchan_rel(subchans, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_rndis.h Wed Jul 20 05:48:52 2016 (r303070) @@ -1083,12 +1083,14 @@ typedef struct rndismp_rx_bufs_info_ { * Externs */ struct hv_vmbus_channel; +struct hn_rx_ring; +struct hn_tx_ring; -int netvsc_recv(struct hv_vmbus_channel *chan, +int netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value); -void netvsc_channel_rollup(struct hv_vmbus_channel *chan); +void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Jul 20 05:48:52 2016 (r303070) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -74,8 +76,7 @@ static int hv_rf_send_request(rndis_dev static void hv_rf_receive_response(rndis_device *device, rndis_msg *response); static void hv_rf_receive_indicate_status(rndis_device *device, rndis_msg *response); -static void hv_rf_receive_data(rndis_device *device, rndis_msg *message, - struct hv_vmbus_channel *chan, +static void hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, netvsc_packet *pkt); static int hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, uint32_t *result_size); @@ -527,12 +528,11 @@ skip: * RNDIS filter receive data */ static void -hv_rf_receive_data(rndis_device *device, rndis_msg *message, - struct hv_vmbus_channel *chan, netvsc_packet *pkt) +hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, + netvsc_packet *pkt) { rndis_packet *rndis_pkt; uint32_t data_offset; - device_t dev = device->net_dev->sc->hn_dev; struct hv_rf_recvinfo info; rndis_pkt = &message->msg.packet; @@ -548,7 +548,7 @@ hv_rf_receive_data(rndis_device *device, pkt->tot_data_buf_len -= data_offset; if (pkt->tot_data_buf_len < rndis_pkt->data_length) { pkt->status = nvsp_status_failure; - device_printf(dev, + if_printf(rxr->hn_ifp, "total length %u is less than data length %u\n", pkt->tot_data_buf_len, rndis_pkt->data_length); return; @@ -559,7 +559,7 @@ hv_rf_receive_data(rndis_device *device, if (hv_rf_find_recvinfo(rndis_pkt, &info)) { pkt->status = nvsp_status_failure; - device_printf(dev, "recvinfo parsing failed\n"); + if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); return; } @@ -568,7 +568,7 @@ hv_rf_receive_data(rndis_device *device, else pkt->vlan_tci = 0; - netvsc_recv(chan, pkt, info.csum_info, info.hash_info, info.hash_value); + netvsc_recv(rxr, pkt, info.csum_info, info.hash_info, info.hash_value); } /* @@ -576,7 +576,7 @@ hv_rf_receive_data(rndis_device *device, */ int hv_rf_on_receive(netvsc_dev *net_dev, - struct hv_vmbus_channel *chan, netvsc_packet *pkt) + struct hn_rx_ring *rxr, netvsc_packet *pkt) { rndis_device *rndis_dev; rndis_msg *rndis_hdr; @@ -599,7 +599,7 @@ hv_rf_on_receive(netvsc_dev *net_dev, /* data message */ case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rndis_dev, rndis_hdr, chan, pkt); + hv_rf_receive_data(rxr, rndis_hdr, pkt); break; /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: @@ -1058,7 +1058,7 @@ hv_rf_close_device(rndis_device *device) */ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, - int nchan) + int nchan, struct hn_rx_ring *rxr) { int ret; netvsc_dev *net_dev; @@ -1081,7 +1081,7 @@ hv_rf_on_device_add(struct hn_softc *sc, * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - net_dev = hv_nv_on_device_add(sc, additl_info); + net_dev = hv_nv_on_device_add(sc, additl_info, rxr); if (!net_dev) { hv_put_rndis_device(rndis_dev); @@ -1266,8 +1266,8 @@ hv_rf_on_send_request_halt_completion(st } void -hv_rf_channel_rollup(struct hv_vmbus_channel *chan) +hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { - netvsc_channel_rollup(chan); + netvsc_channel_rollup(rxr, txr); } Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 20 05:34:28 2016 (r303069) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Jul 20 05:48:52 2016 (r303070) @@ -113,12 +113,14 @@ typedef struct rndis_device_ { */ struct hv_vmbus_channel; struct hn_softc; +struct hn_rx_ring; int hv_rf_on_receive(netvsc_dev *net_dev, - struct hv_vmbus_channel *chan, netvsc_packet *pkt); + struct hn_rx_ring *rxr, 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 hn_softc *sc, void *additl_info, int nchan); +void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan, + struct hn_rx_ring *rxr); 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); From owner-svn-src-head@freebsd.org Wed Jul 20 06:00: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 B6634B9E04B; Wed, 20 Jul 2016 06:00: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 86B18179C; Wed, 20 Jul 2016 06:00: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 u6K60SpW062652; Wed, 20 Jul 2016 06:00:28 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K60SbG062642; Wed, 20 Jul 2016 06:00:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200600.u6K60SbG062642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 06:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303071 - 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: Wed, 20 Jul 2016 06:00:29 -0000 Author: sephe Date: Wed Jul 20 06:00:27 2016 New Revision: 303071 URL: https://svnweb.freebsd.org/changeset/base/303071 Log: hyperv/vmbus: Hide channel struct definition. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7245 Added: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h (contents, props changed) 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/utilities/hv_kvp.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 20 06:00:27 2016 (r303071) @@ -83,122 +83,8 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -typedef struct { - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t write_index; - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t read_index; - /* - * NOTE: The interrupt_mask field is used only for channels, but - * vmbus connection also uses this data structure - */ - volatile uint32_t interrupt_mask; - /* pad it to PAGE_SIZE so that data starts on a page */ - uint8_t reserved[4084]; - - /* - * WARNING: Ring data starts here - * !!! DO NOT place any fields below this !!! - */ - uint8_t buffer[0]; /* doubles as interrupt mask */ -} __packed hv_vmbus_ring_buffer; - -typedef struct { - hv_vmbus_ring_buffer* ring_buffer; - struct mtx ring_lock; - uint32_t ring_data_size; /* ring_size */ -} hv_vmbus_ring_buffer_info; - struct hv_vmbus_channel; -typedef void (*vmbus_chan_callback_t)(struct hv_vmbus_channel *, void *); - -typedef struct hv_vmbus_channel { - device_t ch_dev; - struct vmbus_softc *ch_vmbus; - 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. - */ - int ch_montrig_idx; /* MNF trig index */ - uint32_t ch_montrig_mask;/* MNF trig mask */ - - /* - * TX bufring; at the beginning of ch_bufring. - */ - hv_vmbus_ring_buffer_info ch_txbr; - /* - * RX bufring; immediately following ch_txbr. - */ - hv_vmbus_ring_buffer_info ch_rxbr; - - 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; - - int ch_cpuid; /* owner cpu */ - /* - * 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 ch_vcpuid; - - /* - * If this is a primary channel, ch_subchan* fields - * contain sub-channels belonging to this 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 */ - - 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 */ - volatile uint32_t ch_stflags; /* atomic-op */ - /* VMBUS_CHAN_ST_ */ - struct hyperv_guid ch_guid_type; - struct hyperv_guid ch_guid_inst; - - struct sysctl_ctx_list ch_sysctl_ctx; -} hv_vmbus_channel; - -#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) - -#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 - -#define VMBUS_CHAN_ST_OPENED_SHIFT 0 -#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/include/vmbus.h Wed Jul 20 06:00:27 2016 (r303071) @@ -88,6 +88,9 @@ struct vmbus_chanpkt_rxbuf { #define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; +struct hyperv_guid; + +typedef void (*vmbus_chan_callback_t)(struct hv_vmbus_channel *, void *); int vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, @@ -124,4 +127,10 @@ int vmbus_chan_send_prplist(struct hv_vm struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, uint64_t xactid); +uint32_t vmbus_chan_id(const struct hv_vmbus_channel *chan); +uint32_t vmbus_chan_subidx(const struct hv_vmbus_channel *chan); +bool vmbus_chan_is_primary(const struct hv_vmbus_channel *chan); +const struct hyperv_guid * + vmbus_chan_guid_inst(const struct hv_vmbus_channel *chan); + #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Jul 20 06:00:27 2016 (r303071) @@ -641,9 +641,9 @@ hv_nv_disconnect_from_vsp(netvsc_dev *ne void hv_nv_subchan_attach(struct hv_vmbus_channel *chan, struct hn_rx_ring *rxr) { - KASSERT(rxr->hn_rx_idx == chan->ch_subidx, + KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), ("chan%u subidx %u, rxr%d mismatch", - chan->ch_id, chan->ch_subidx, rxr->hn_rx_idx)); + vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, rxr); @@ -673,9 +673,9 @@ hv_nv_on_device_add(struct hn_softc *sc, /* * Open the channel */ - KASSERT(rxr->hn_rx_idx == chan->ch_subidx, + KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), ("chan%u subidx %u, rxr%d mismatch", - chan->ch_id, chan->ch_subidx, rxr->hn_rx_idx)); + vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, rxr); Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 20 06:00:27 2016 (r303071) @@ -791,9 +791,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->ch_subidx, - txr->hn_chan->ch_subidx)); + ("channel mismatch, on chan%u, should be chan%u", + vmbus_chan_subidx(chan), vmbus_chan_subidx(txr->hn_chan))); txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); @@ -2917,7 +2916,7 @@ hn_channel_attach(struct hn_softc *sc, s struct hn_rx_ring *rxr; int idx; - idx = chan->ch_subidx; + idx = vmbus_chan_subidx(chan); KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", @@ -2929,7 +2928,7 @@ hn_channel_attach(struct hn_softc *sc, s if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", - idx, chan->ch_id); + idx, vmbus_chan_id(chan)); } if (idx < sc->hn_tx_ring_inuse) { @@ -2942,7 +2941,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->ch_id); + idx, vmbus_chan_id(chan)); } } @@ -2954,11 +2953,8 @@ static void hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) { - KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), + KASSERT(!vmbus_chan_is_primary(chan), ("subchannel callback on primary channel")); - KASSERT(chan->ch_subidx > 0, - ("invalid channel subidx %u", - chan->ch_subidx)); hn_channel_attach(sc, chan); } @@ -2979,7 +2975,7 @@ hn_subchan_setup(struct hn_softc *sc) /* NOTE: Calling order is critical. */ hn_subchan_attach(sc, subchan); hv_nv_subchan_attach(subchan, - &sc->hn_rx_ring[subchan->ch_subidx]); + &sc->hn_rx_ring[vmbus_chan_subidx(subchan)]); } /* Release the sub-channels */ Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Jul 20 06:00:27 2016 (r303071) @@ -876,7 +876,7 @@ storvsc_create_cpu2chan(struct storvsc_s sc->hs_cpu2chan[cpu] = vmbus_chan_cpu2chan(sc->hs_chan, cpu); if (bootverbose) { device_printf(sc->hs_dev, "cpu%d -> chan%u\n", - cpu, sc->hs_cpu2chan[cpu]->ch_id); + cpu, vmbus_chan_id(sc->hs_cpu2chan[cpu])); } } } Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Wed Jul 20 06:00:27 2016 (r303071) @@ -342,7 +342,8 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru * TODO: need vmbus interface. */ chan = vmbus_get_channel(dev); - hyperv_guid2str(&chan->ch_guid_inst, buf, sizeof(buf)); + hyperv_guid2str(vmbus_chan_guid_inst(chan), + buf, sizeof(buf)); if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, HYPERV_GUID_STRLEN - 1) == 0) { @@ -615,7 +616,7 @@ static void hv_kvp_process_request(void *context, int pending) { uint8_t *kvp_buf; - hv_vmbus_channel *channel; + struct hv_vmbus_channel *channel; uint32_t recvlen = 0; uint64_t requestid; struct hv_vmbus_icmsg_hdr *icmsghdrp; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed Jul 20 06:00:27 2016 (r303071) @@ -37,7 +37,7 @@ #include #include -#include +#include struct vmbus_softc; Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 05:48:52 2016 (r303070) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 06:00:27 2016 (r303071) @@ -1378,3 +1378,30 @@ vmbus_chan_set_readbatch(struct hv_vmbus else chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } + +uint32_t +vmbus_chan_id(const struct hv_vmbus_channel *chan) +{ + return chan->ch_id; +} + +uint32_t +vmbus_chan_subidx(const struct hv_vmbus_channel *chan) +{ + return chan->ch_subidx; +} + +bool +vmbus_chan_is_primary(const struct hv_vmbus_channel *chan) +{ + if (VMBUS_CHAN_ISPRIMARY(chan)) + return true; + else + return false; +} + +const struct hyperv_guid * +vmbus_chan_guid_inst(const struct hv_vmbus_channel *chan) +{ + return &chan->ch_guid_inst; +} Added: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Wed Jul 20 06:00:27 2016 (r303071) @@ -0,0 +1,155 @@ +/*- + * 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_CHANVAR_H_ +#define _VMBUS_CHANVAR_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +typedef struct { + /* + * offset in bytes from the start of ring data below + */ + volatile uint32_t write_index; + /* + * offset in bytes from the start of ring data below + */ + volatile uint32_t read_index; + /* + * NOTE: The interrupt_mask field is used only for channels, but + * vmbus connection also uses this data structure + */ + volatile uint32_t interrupt_mask; + /* pad it to PAGE_SIZE so that data starts on a page */ + uint8_t reserved[4084]; + + /* + * WARNING: Ring data starts here + * !!! DO NOT place any fields below this !!! + */ + uint8_t buffer[0]; /* doubles as interrupt mask */ +} __packed hv_vmbus_ring_buffer; + +typedef struct { + hv_vmbus_ring_buffer* ring_buffer; + struct mtx ring_lock; + uint32_t ring_data_size; /* ring_size */ +} hv_vmbus_ring_buffer_info; + +typedef struct hv_vmbus_channel { + device_t ch_dev; + struct vmbus_softc *ch_vmbus; + 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. + */ + int ch_montrig_idx; /* MNF trig index */ + uint32_t ch_montrig_mask;/* MNF trig mask */ + + /* + * TX bufring; at the beginning of ch_bufring. + */ + hv_vmbus_ring_buffer_info ch_txbr; + /* + * RX bufring; immediately following ch_txbr. + */ + hv_vmbus_ring_buffer_info ch_rxbr; + + 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; + + int ch_cpuid; /* owner cpu */ + /* + * 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 ch_vcpuid; + + /* + * If this is a primary channel, ch_subchan* fields + * contain sub-channels belonging to this 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 */ + + 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 */ + volatile uint32_t ch_stflags; /* atomic-op */ + /* VMBUS_CHAN_ST_ */ + struct hyperv_guid ch_guid_type; + struct hyperv_guid ch_guid_inst; + + struct sysctl_ctx_list ch_sysctl_ctx; +} hv_vmbus_channel; + +#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) + +#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 + +#define VMBUS_CHAN_ST_OPENED_SHIFT 0 +#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) + +#endif /* !_VMBUS_CHANVAR_H_ */ From owner-svn-src-head@freebsd.org Wed Jul 20 06:12: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 DEFE8B9E3A7; Wed, 20 Jul 2016 06:12: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 8F4E01F75; Wed, 20 Jul 2016 06:12: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 u6K6CWJc069740; Wed, 20 Jul 2016 06:12:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K6CW9v069738; Wed, 20 Jul 2016 06:12:32 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607200612.u6K6CW9v069738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 20 Jul 2016 06:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303072 - 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, 20 Jul 2016 06:12:34 -0000 Author: sephe Date: Wed Jul 20 06:12:32 2016 New Revision: 303072 URL: https://svnweb.freebsd.org/changeset/base/303072 Log: hyperv/vmbus: Save MNF trigger location instead of MNF trigger index. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7246 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 06:00:27 2016 (r303071) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Jul 20 06:12:32 2016 (r303072) @@ -89,13 +89,10 @@ vmbus_chan_signal_tx(struct hv_vmbus_cha atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - atomic_set_int( - &sc->vmbus_mnf2->mnf_trigs[chan->ch_montrig_idx].mt_pending, - chan->ch_montrig_mask); - } else { + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) + atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask); + else hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); - } } static int @@ -1106,13 +1103,19 @@ vmbus_chan_msgproc_choffer(struct vmbus_ chan->ch_monprm->mp_connid = offer->chm_connid; if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + int trig_idx; + /* * 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) + + trig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (trig_idx >= VMBUS_MONTRIGS_MAX) panic("invalid monitor trigger %u", offer->chm_montrig); + chan->ch_montrig = + &sc->vmbus_mnf2->mnf_trigs[trig_idx].mt_pending; + chan->ch_montrig_mask = 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Wed Jul 20 06:00:27 2016 (r303071) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Wed Jul 20 06:12:32 2016 (r303072) @@ -80,7 +80,7 @@ typedef struct hv_vmbus_channel { * These are based on the offer_msg.monitor_id. * Save it here for easy access. */ - int ch_montrig_idx; /* MNF trig index */ + volatile uint32_t *ch_montrig; /* MNF trigger */ uint32_t ch_montrig_mask;/* MNF trig mask */ /* From owner-svn-src-head@freebsd.org Wed Jul 20 06:29: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 1AA7FB9E5B5; Wed, 20 Jul 2016 06:29:28 +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 D2D2515D7; Wed, 20 Jul 2016 06:29:27 +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 u6K6TRur073556; Wed, 20 Jul 2016 06:29:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K6TR95073555; Wed, 20 Jul 2016 06:29:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201607200629.u6K6TR95073555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 20 Jul 2016 06:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303073 - 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: Wed, 20 Jul 2016 06:29:28 -0000 Author: tuexen Date: Wed Jul 20 06:29:26 2016 New Revision: 303073 URL: https://svnweb.freebsd.org/changeset/base/303073 Log: Fix a bug in deferred stream reset processing which results in using a length field before it is set. Thanks to Taylor Brandstetter for reporting the issue and providing a fix. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Wed Jul 20 06:12:32 2016 (r303072) +++ head/sys/netinet/sctp_output.c Wed Jul 20 06:29:26 2016 (r303073) @@ -11940,7 +11940,6 @@ sctp_send_deferred_reset_response(struct return; } SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD); - sctp_add_stream_reset_result(chk, ent->seq, response); /* setup chunk parameters */ chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; @@ -11955,6 +11954,7 @@ sctp_send_deferred_reset_response(struct ch->chunk_length = htons(chk->book_size); atomic_add_int(&chk->whoTo->ref_count, 1); SCTP_BUF_LEN(chk->data) = chk->send_size; + sctp_add_stream_reset_result(chk, ent->seq, response); /* insert the chunk for sending */ TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, From owner-svn-src-head@freebsd.org Wed Jul 20 06: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 C8049B9EE2B; Wed, 20 Jul 2016 06:53:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B234814C8; Wed, 20 Jul 2016 06:53:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u6K6rZHD001607 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 19 Jul 2016 23:53:35 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u6K6rZ0N001606; Tue, 19 Jul 2016 23:53:35 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 19 Jul 2016 23:53:35 -0700 From: Gleb Smirnoff To: Randall Stewart Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303037 - head/sys/kern Message-ID: <20160720065335.GU1076@FreeBSD.org> References: <201607191831.u6JIVJWq007542@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607191831.u6JIVJWq007542@repo.freebsd.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: Wed, 20 Jul 2016 06:53:41 -0000 On Tue, Jul 19, 2016 at 06:31:19PM +0000, Randall Stewart wrote: R> Author: rrs R> Date: Tue Jul 19 18:31:19 2016 R> New Revision: 303037 R> URL: https://svnweb.freebsd.org/changeset/base/303037 R> R> Log: R> This reverts out Gleb's changes and adds three small R> fixes that I think closes up the races Gleb was R> looking for. This is running quite nicely in Netflix and R> now no longer causes TCP-tcb leaks. R> R> Differential Revision: 7135 Just to notice that I am completely pissed of by this commit war, that you started. I've been testing my changes properly, I gave people time to review my changes. You didn't. >From your explanation in other emails I see that you've been testing your changes with a version of FreeBSD that is a heavily modified FreeBSD 10, not 11. The new code you mixed with revert of mine, doesn't fix the problem observed. It fixes another problem that you imagined, which might exist, but isn't observed. We already discussed that and you didn't prove it wrong. Your change doesn't even revert my change completely. -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Wed Jul 20 07:30: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 736AFB9C7CB; Wed, 20 Jul 2016 07:30:45 +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 483DE147B; Wed, 20 Jul 2016 07:30: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 u6K7UiPc096328; Wed, 20 Jul 2016 07:30:44 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K7Ui3s096327; Wed, 20 Jul 2016 07:30:44 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607200730.u6K7Ui3s096327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 20 Jul 2016 07:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303074 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 07:30:45 -0000 Author: ache Date: Wed Jul 20 07:30:44 2016 New Revision: 303074 URL: https://svnweb.freebsd.org/changeset/base/303074 Log: 1) Per POSIX (and glibc) GLOB_NOCHECK should return original pattern, unmodified, if no matches found. But our original code strips all '\' returning it. Rewrite the code to allow to reconstruct exact the original pattern with backslashes for this case. 2) Prevent to use truncated pattern if MAXPATHLEN exceeded, return GLOB_NOMATCH instead. 3) Fix few end loop conditions filling Char arrays with mbrtowc(), MB_CUR_MAX is unneeded in two places and condition is less by one in other place. 4) Prevent to use truncated filenames match if MAXPATHLEN exceeded, skip such directory entries. 5) Don't end *pathend with L'/' in glob3() if limit is reached, this change will be not visible since error is returned. 6) If error happens in (*readdirfunc)(), do the same GLOB_ABORTED processing as for g_opendir() as POSIX requires. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Wed Jul 20 06:29:26 2016 (r303073) +++ head/lib/libc/gen/glob.c Wed Jul 20 07:30:44 2016 (r303074) @@ -152,6 +152,7 @@ typedef char Char; #define CHAR(c) ((Char)((c)&M_CHAR)) #define META(c) ((Char)((c)|M_QUOTE)) +#define UNPROT(c) ((c) & ~M_PROTECT) #define M_ALL META(L'*') #define M_END META(L']') #define M_NOT META(L'!') @@ -159,10 +160,11 @@ typedef char Char; #define M_RNG META(L'-') #define M_SET META(L'[') #define ismeta(c) (((c)&M_QUOTE) != 0) +#define isprot(c) (((c)&M_PROTECT) != 0) static int compare(const void *, const void *); -static int g_Ctoc(const Char *, char *, size_t); +static int g_Ctoc(const Char *, char *, size_t, int); static int g_lstat(Char *, struct stat *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static const Char *g_strchr(const Char *, wchar_t); @@ -176,7 +178,7 @@ static int glob2(Char *, Char *, Char * struct glob_limit *); static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *); -static int globextend(const Char *, glob_t *, struct glob_limit *); +static int globextend(const Char *, glob_t *, struct glob_limit *, int); static const Char * globtilde(const Char *, Char *, size_t, glob_t *); static int globexp1(const Char *, glob_t *, struct glob_limit *); @@ -197,6 +199,7 @@ glob(const char * __restrict pattern, in mbstate_t mbs; wchar_t wc; size_t clen; + int too_long; patnext = pattern; if (!(flags & GLOB_APPEND)) { @@ -216,24 +219,27 @@ glob(const char * __restrict pattern, in bufnext = patbuf; bufend = bufnext + MAXPATHLEN - 1; + too_long = 1; if (flags & GLOB_NOESCAPE) { memset(&mbs, 0, sizeof(mbs)); - while (bufend - bufnext >= MB_CUR_MAX) { + while (bufnext <= bufend) { clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) return (GLOB_NOMATCH); - else if (clen == 0) + else if (clen == 0) { + too_long = 0; break; + } *bufnext++ = wc; patnext += clen; } } else { /* Protect the quoted characters. */ memset(&mbs, 0, sizeof(mbs)); - while (bufend - bufnext >= MB_CUR_MAX) { + while (bufnext <= bufend) { if (*patnext == '\\') { if (*++patnext == '\0') { - *bufnext++ = QUOTE | M_PROTECT; + *bufnext++ = QUOTE; continue; } prot = M_PROTECT; @@ -242,13 +248,16 @@ glob(const char * __restrict pattern, in clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) return (GLOB_NOMATCH); - else if (clen == 0) + else if (clen == 0) { + too_long = 0; break; - *bufnext++ = wc | ((wc != DOT && wc != SEP) ? - prot : 0); + } + *bufnext++ = wc | prot; patnext += clen; } } + if (too_long) + return (GLOB_NOMATCH); *bufnext = EOS; if (flags & GLOB_BRACE) @@ -447,7 +456,7 @@ globtilde(const Char *pattern, Char *pat /* * Expand a ~user */ - if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf))) + if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf), 0)) return (NULL); if ((pwd = getpwnam((char *)wbuf)) == NULL) return (pattern); @@ -479,8 +488,8 @@ globtilde(const Char *pattern, Char *pat return (NULL); dc = wbuf; - for (b = patbuf; b < eb && *dc != EOS; b++, dc++) - *b = *dc | ((*dc != DOT && *dc != SEP) ? M_PROTECT : 0); + for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++ | M_PROTECT) + continue; if (*dc != EOS) return (NULL); @@ -589,7 +598,7 @@ glob0(const Char *pattern, glob_t *pglob if (((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) - return (globextend(pattern, pglob, limit)); + return (globextend(pattern, pglob, limit, 1)); else return (GLOB_NOMATCH); } @@ -645,10 +654,11 @@ glob2(Char *pathbuf, Char *pathend, Char errno = 0; return (GLOB_NOSPACE); } - if (((pglob->gl_flags & GLOB_MARK) && - pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) - || (S_ISLNK(sb.st_mode) && - (g_stat(pathbuf, &sb, pglob) == 0) && + if ((pglob->gl_flags & GLOB_MARK) && + UNPROT(pathend[-1]) != SEP && + (S_ISDIR(sb.st_mode) || + (S_ISLNK(sb.st_mode) && + g_stat(pathbuf, &sb, pglob) == 0 && S_ISDIR(sb.st_mode)))) { if (pathend + 1 > pathend_last) { errno = 0; @@ -658,13 +668,13 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend = EOS; } ++pglob->gl_matchc; - return (globextend(pathbuf, pglob, limit)); + return (globextend(pathbuf, pglob, limit, 0)); } /* Find end of next segment, copy tentatively to pathend. */ q = pathend; p = pattern; - while (*p != EOS && *p != SEP) { + while (*p != EOS && UNPROT(*p) != SEP) { if (ismeta(*p)) anymeta = 1; if (q + 1 > pathend_last) { @@ -677,7 +687,7 @@ glob2(Char *pathbuf, Char *pathend, Char if (!anymeta) { /* No expansion, do next segment. */ pathend = q; pattern = p; - while (*pattern == SEP) { + while (UNPROT(*pattern) == SEP) { if (pathend + 1 > pathend_last) { errno = 0; return (GLOB_NOSPACE); @@ -698,28 +708,29 @@ glob3(Char *pathbuf, Char *pathend, Char { struct dirent *dp; DIR *dirp; - int err; + int err, too_long, saverrno; char buf[MAXPATHLEN + MB_LEN_MAX - 1]; struct dirent *(*readdirfunc)(DIR *); - errno = 0; - if (pathend > pathend_last) + if (pathend > pathend_last) { + errno = 0; return (GLOB_NOSPACE); + } *pathend = EOS; + if (pglob->gl_errfunc != NULL && + g_Ctoc(pathbuf, buf, sizeof(buf), 0)) { + errno = 0; + return (GLOB_NOSPACE); + } + errno = 0; if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { if (errno == ENOENT || errno == ENOTDIR) return (0); - if (pglob->gl_errfunc != NULL) { - if (g_Ctoc(pathbuf, buf, sizeof(buf))) { - errno = 0; - return (GLOB_NOSPACE); - } - if (pglob->gl_errfunc(buf, errno)) - return (GLOB_ABORTED); - } - if (pglob->gl_flags & GLOB_ERR) + if ((pglob->gl_errfunc != NULL && + pglob->gl_errfunc(buf, errno)) || + (pglob->gl_flags & GLOB_ERR)) return (GLOB_ABORTED); return (0); } @@ -732,6 +743,7 @@ glob3(Char *pathbuf, Char *pathend, Char else readdirfunc = readdir; + errno = 0; /* Search directory for matching names. */ while ((dp = (*readdirfunc)(dirp)) != NULL) { char *sc; @@ -743,23 +755,18 @@ glob3(Char *pathbuf, Char *pathend, Char if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) { errno = 0; - if (pathend + 1 > pathend_last) - err = GLOB_NOSPACE; - else { - *pathend++ = SEP; - *pathend = EOS; - err = GLOB_NOSPACE; - } + err = GLOB_NOSPACE; break; } /* Initial DOT must be matched literally. */ - if (dp->d_name[0] == '.' && *pattern != DOT) + if (dp->d_name[0] == '.' && UNPROT(*pattern) != DOT) continue; memset(&mbs, 0, sizeof(mbs)); dc = pathend; sc = dp->d_name; - while (dc < pathend_last) { + too_long = 1; + while (dc <= pathend_last) { clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) { /* XXX See initial comment #2. */ @@ -767,11 +774,13 @@ glob3(Char *pathbuf, Char *pathend, Char clen = 1; memset(&mbs, 0, sizeof(mbs)); } - if ((*dc++ = wc) == EOS) + if ((*dc++ = wc) == EOS) { + too_long = 0; break; + } sc += clen; } - if (!match(pathend, pattern, restpattern)) { + if (too_long || !match(pathend, pattern, restpattern)) { *pathend = EOS; continue; } @@ -779,13 +788,24 @@ glob3(Char *pathbuf, Char *pathend, Char pglob, limit); if (err) break; + errno = 0; } + saverrno = errno; if (pglob->gl_flags & GLOB_ALTDIRFUNC) (*pglob->gl_closedir)(dirp); else closedir(dirp); - return (err); + errno = saverrno; + + if (err) + return (err); + + if (dp == NULL && errno != 0 && ((pglob->gl_errfunc != NULL && + pglob->gl_errfunc(buf, errno)) || (pglob->gl_flags & GLOB_ERR))) + return (GLOB_ABORTED); + + return (0); } @@ -804,7 +824,8 @@ glob3(Char *pathbuf, Char *pathend, Char * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int -globextend(const Char *path, glob_t *pglob, struct glob_limit *limit) +globextend(const Char *path, glob_t *pglob, struct glob_limit *limit, + int prot) { char **pathv; size_t i, newsize, len; @@ -831,9 +852,11 @@ globextend(const Char *path, glob_t *pgl } pglob->gl_pathv = pathv; - for (p = path; *p++;) + for (p = path; *p++ != EOS;) continue; len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ + if (prot) + len += (size_t)(p - path) - 1; limit->l_string_cnt += len; if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_string_cnt >= GLOB_LIMIT_STRING) { @@ -841,7 +864,7 @@ globextend(const Char *path, glob_t *pgl return (GLOB_NOSPACE); } if ((copy = malloc(len)) != NULL) { - if (g_Ctoc(path, copy, len)) { + if (g_Ctoc(path, copy, len, prot)) { free(copy); errno = 0; return (GLOB_NOSPACE); @@ -935,7 +958,7 @@ g_opendir(Char *str, glob_t *pglob) if (*str == EOS) strcpy(buf, "."); else { - if (g_Ctoc(str, buf, sizeof(buf))) { + if (g_Ctoc(str, buf, sizeof(buf), 0)) { errno = ENAMETOOLONG; return (NULL); } @@ -952,7 +975,7 @@ g_lstat(Char *fn, struct stat *sb, glob_ { char buf[MAXPATHLEN + MB_LEN_MAX - 1]; - if (g_Ctoc(fn, buf, sizeof(buf))) { + if (g_Ctoc(fn, buf, sizeof(buf), 0)) { errno = ENAMETOOLONG; return (-1); } @@ -966,7 +989,7 @@ g_stat(Char *fn, struct stat *sb, glob_t { char buf[MAXPATHLEN + MB_LEN_MAX - 1]; - if (g_Ctoc(fn, buf, sizeof(buf))) { + if (g_Ctoc(fn, buf, sizeof(buf), 0)) { errno = ENAMETOOLONG; return (-1); } @@ -987,23 +1010,31 @@ g_strchr(const Char *str, wchar_t ch) } static int -g_Ctoc(const Char *str, char *buf, size_t len) +g_Ctoc(const Char *str, char *buf, size_t len, int prot) { mbstate_t mbs; size_t clen; + Char Ch; + Ch = *str; memset(&mbs, 0, sizeof(mbs)); while (len >= MB_CUR_MAX) { - clen = wcrtomb(buf, CHAR(*str), &mbs); + if (prot && isprot(Ch)) { + Ch = UNPROT(Ch); + *buf++ = '\\'; + len--; + continue; + } + clen = wcrtomb(buf, CHAR(Ch), &mbs); if (clen == (size_t)-1) { /* XXX See initial comment #2. */ - *buf = (char)CHAR(*str); + *buf = (char)CHAR(Ch); clen = 1; memset(&mbs, 0, sizeof(mbs)); } - if (CHAR(*str) == EOS) + if (CHAR(Ch) == EOS) return (0); - str++; + Ch = *++str; buf += clen; len -= clen; } From owner-svn-src-head@freebsd.org Wed Jul 20 07: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 0D029B9C87A; Wed, 20 Jul 2016 07:32:11 +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 3B97F17E2; Wed, 20 Jul 2016 07:32: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 mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 816BCD4A084; Wed, 20 Jul 2016 17:32:02 +1000 (AEST) Date: Wed, 20 Jul 2016 17:32:01 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Jan Beich , Ed Maste , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303033 - head/share/man/man7 In-Reply-To: Message-ID: <20160720170316.T3729@besplex.bde.org> References: <201607191746.u6JHk9ov092270@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=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=tITsiVaQAAAA:8 a=6I5d2MoRAAAA:8 a=ST0UujPXQ9mVs6hp854A:9 a=CjuIK1q_8ugA:10 a=Rrwg1Sb9G9BBOlP1exfM:22 a=IjZwj45LgO3ly-622nXo: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: Wed, 20 Jul 2016 07:32:11 -0000 On Tue, 19 Jul 2016, Warner Losh wrote: > On Tue, Jul 19, 2016 at 9:01 PM, Jan Beich wrote: >> Ed Maste writes: >> >>> +.Ss Predefined Macros >>> +The compiler provides a number of predefined macros. >>> +Some of these provide architecture-specific details and are explained below. >>> +Other macros, including those required by the language standard, are not >>> +included here. >> [...] >>> +cc -x c -Dm -E /dev/null >> >> Typo: -Dm vs. -dM >> >>> +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . >> >> Are these really compiler macros? I think, defines them. These are non-compiler-predefined macros. They are namespace pollution in which is only there in the __BSD_VISIBLE case. > sys/endian.h defines them (and it implements that by including machine/endian.h > in part). > >> $ clang38 -x c -dM -E /dev/null | fgrep ENDIAN >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> #define __LITTLE_ENDIAN__ 1 >> #define __ORDER_BIG_ENDIAN__ 4321 >> #define __ORDER_LITTLE_ENDIAN__ 1234 >> #define __ORDER_PDP_ENDIAN__ 3412 These are the related compiler definitions in the implementation namespace. Their spelling is quite different and there are no consistency checks between values, but the ABI requires similar values. The values are as different as the spellings in some cases. __LITTLE_ENDIAN__ is 1, but FreeBSD's _LITTLE_ENDIAN is 1234. Actually, the semantics of these is very different too. FreeBSD's _LITTLE_ENDIAN corresponds to __ORDER_LITTLE_ENDIAN. >> $ gcc5 -x c -dM -E /dev/null | fgrep ENDIAN >> #define __ORDER_LITTLE_ENDIAN__ 1234 >> #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ >> #define __ORDER_PDP_ENDIAN__ 3412 >> #define __ORDER_BIG_ENDIAN__ 4321 >> #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ gcc apparently doesn't even have the confusing __LITTLE_ENDIAN__. > This is why they are defined in machine/endian.h. Compilers have been > somewhat inconsistent in the past. But they aren't defined in machine/endian.h. Compilers had no trace of them in the past. Even gcc-4.2 in the present /usr/src doesn't have them. The FreeBSD macros should be used since they have been portable in BSD for at last 25 years, with a better spelling which is unsuitable for standards because it is not ugly enough to not be already in use with possibly inconsistent semantics. glibc is different again. In an old version (2.6), it uses __BYTE_ORDER where FreeBSD uses _BYTE_ORDER and compilers use __BYTE_ORDER__. It also defines the FreeBSD pollution BYTE_ORDER in string/endian.h and uses this in dangerous places like netinet/icmp6.h, but in the standard netinet/in.h which doesn't allow this, it is more careful and uses __BYTE_ORDER. The man page might need to be more careful about this. BYTE_ORDER is not a compiler predefine or standard spelling and determing the applicable spelling is time-consuming. Bruce From owner-svn-src-head@freebsd.org Wed Jul 20 07:44: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 198F0B9CEFE; Wed, 20 Jul 2016 07:44:33 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pa0-x229.google.com (mail-pa0-x229.google.com [IPv6:2607:f8b0:400e:c03::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 DB89711EA; Wed, 20 Jul 2016 07:44:32 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pa0-x229.google.com with SMTP id fi15so15793710pac.1; Wed, 20 Jul 2016 00:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:reply-to:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=UHN6yCn41HEEcjSdVLd/VhnYrF1UYxm86NaEn+K5L/U=; b=YFjVVAGmIRDpET6wOtvNRdB3Yb91XePtli5xGgcr5uKzVNRa6XxgZBLJTVneKXe/l2 hoZuOexqWznfGtDm2uRgYXYiZnNx/prB6vw4SXWo+KqalSW76cJrWQPf8RdBJhP/rm9I LH32h+TxMjEJyZx/dlG2lHNnkXxUo56fQyy7HeBrjZY7cdBc8P3jeJFXLWteHAq17GCX uIF+QFlIlNK3p8G9OADed6nnEvtnahiuO5HbPw1Y52JiAZ5mFRHo39KamLwM7Fry/k7L NE4Ozh59Esq2uqspSjrv/6wGGuhWICTAnhfklYugdTE2TD4IonOb86e7fZUGwT4dIedG 2oAQ== 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:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=UHN6yCn41HEEcjSdVLd/VhnYrF1UYxm86NaEn+K5L/U=; b=dCKIPfEuS3w/Qyr0HUOK9T3xBzahGkuS62caMylqA6FhGU3KuRtylHrGGnxh24OrHT ayC0+TayQsSPUpLsksnziW5FOEJ1xG9AerZ/2PZSuRgjw19u1Q9/Cbpo7S50gGJ1Zozd J8slMgvyWFH5xrFo2wT2SsGJghng7uNABd9tYRmX5CvGFeK3xH/oo9Q2/iNAD/3OQxT0 MzEHuFzE9kJq3mGOl5RYb8eoB2kHqs0vBL6WP9Kv7BudLa6zxWtP+jDTvFQq3U7ZsYex e5B8AhzaxhqipUjiQGmGW38XSP3Z1JYgttjBjUDm7kfyBGUFqES5DMZofYS2aW2VUBSS 9z4Q== X-Gm-Message-State: ALyK8tIRCRVAbpTOqRUr/yCd3y48F+TlG32N53ru+zwv8NxTZItva1zglXgLK1+4pVnwIw== X-Received: by 10.66.219.105 with SMTP id pn9mr72291097pac.25.1469000672192; Wed, 20 Jul 2016 00:44:32 -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 9sm2321535pfo.74.2016.07.20.00.44.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 00:44:31 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r303043 - in head: share/man/man4 sys/dev/vt sys/dev/vt/hw/fb References: <201607191920.u6JJKm7R026421@repo.freebsd.org> To: "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Kubilay Kocak Message-ID: <1c485351-51f3-99f1-b7da-0745030dd1e6@FreeBSD.org> Date: Wed, 20 Jul 2016 17:44:27 +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: <201607191920.u6JJKm7R026421@repo.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: Wed, 20 Jul 2016 07:44:33 -0000 On 20/07/2016 5:20 AM, Conrad E. Meyer wrote: > Author: cem > Date: Tue Jul 19 19:20:47 2016 > New Revision: 303043 > URL: https://svnweb.freebsd.org/changeset/base/303043 > > Log: > Increase vt(4) framebuffer maximum size > > And rename "DEFAULT" constants to the more accurate "MAX." > > PR: 210382 > Submitted by: Felix > Reviewed by: wblock, cem > Tested by: Dave Cottlehuber Can MFC? There are high hopes for this coming out in 11.0 / next 10.x re is cc'd on the original bugzilla issue > Modified: > head/share/man/man4/vt.4 > head/sys/dev/vt/hw/fb/vt_fb.c > head/sys/dev/vt/vt.h > head/sys/dev/vt/vt_core.c > > Modified: head/share/man/man4/vt.4 > ============================================================================== > --- head/share/man/man4/vt.4 Tue Jul 19 19:19:03 2016 (r303042) > +++ head/share/man/man4/vt.4 Tue Jul 19 19:20:47 2016 (r303043) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd June 21, 2016 > +.Dd July 19, 2016 > .Dt "VIRTUAL TERMINALS" 4 > .Os > .Sh NAME > @@ -36,8 +36,8 @@ > .Cd "options VT_MAXWINDOWS=N" > .Cd "options VT_ALT_TO_ESC_HACK=1" > .Cd "options VT_TWOBUTTON_MOUSE" > -.Cd "options VT_FB_DEFAULT_WIDTH=X" > -.Cd "options VT_FB_DEFAULT_HEIGHT=Y" > +.Cd "options VT_FB_MAX_WIDTH=X" > +.Cd "options VT_FB_MAX_HEIGHT=Y" > .Cd "options SC_NO_CUTPASTE" > .Cd "device vt" > .Pp > > Modified: head/sys/dev/vt/hw/fb/vt_fb.c > ============================================================================== > --- head/sys/dev/vt/hw/fb/vt_fb.c Tue Jul 19 19:19:03 2016 (r303042) > +++ head/sys/dev/vt/hw/fb/vt_fb.c Tue Jul 19 19:20:47 2016 (r303043) > @@ -416,10 +416,10 @@ vt_fb_init(struct vt_device *vd) > int err; > > info = vd->vd_softc; > - vd->vd_height = MIN(VT_FB_DEFAULT_HEIGHT, info->fb_height); > + vd->vd_height = MIN(VT_FB_MAX_HEIGHT, info->fb_height); > margin = (info->fb_height - vd->vd_height) >> 1; > vd->vd_transpose = margin * info->fb_stride; > - vd->vd_width = MIN(VT_FB_DEFAULT_WIDTH, info->fb_width); > + vd->vd_width = MIN(VT_FB_MAX_WIDTH, info->fb_width); > margin = (info->fb_width - vd->vd_width) >> 1; > vd->vd_transpose += margin * (info->fb_bpp / NBBY); > vd->vd_video_dev = info->fb_video_dev; > > Modified: head/sys/dev/vt/vt.h > ============================================================================== > --- head/sys/dev/vt/vt.h Tue Jul 19 19:19:03 2016 (r303042) > +++ head/sys/dev/vt/vt.h Tue Jul 19 19:20:47 2016 (r303043) > @@ -377,11 +377,11 @@ void vt_upgrade(struct vt_device *vd); > #define PIXEL_WIDTH(w) ((w) / 8) > #define PIXEL_HEIGHT(h) ((h) / 16) > > -#ifndef VT_FB_DEFAULT_WIDTH > -#define VT_FB_DEFAULT_WIDTH 2048 > +#ifndef VT_FB_MAX_WIDTH > +#define VT_FB_MAX_WIDTH 4096 > #endif > -#ifndef VT_FB_DEFAULT_HEIGHT > -#define VT_FB_DEFAULT_HEIGHT 1200 > +#ifndef VT_FB_MAX_HEIGHT > +#define VT_FB_MAX_HEIGHT 2400 > #endif > > /* name argument is not used yet. */ > > Modified: head/sys/dev/vt/vt_core.c > ============================================================================== > --- head/sys/dev/vt/vt_core.c Tue Jul 19 19:19:03 2016 (r303042) > +++ head/sys/dev/vt/vt_core.c Tue Jul 19 19:20:47 2016 (r303043) > @@ -181,8 +181,8 @@ static void vt_resume_handler(void *priv > > SET_DECLARE(vt_drv_set, struct vt_driver); > > -#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)) > -#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)) > +#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_MAX_HEIGHT)) > +#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_MAX_WIDTH)) > > struct terminal vt_consterm; > static struct vt_window vt_conswindow; > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Wed Jul 20 09:29: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 E79E0B9F52C; Wed, 20 Jul 2016 09:29:40 +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 9D9D0182F; Wed, 20 Jul 2016 09:29:40 +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 u6K9TdwP040646; Wed, 20 Jul 2016 09:29:39 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6K9Td8S040645; Wed, 20 Jul 2016 09:29:39 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201607200929.u6K9Td8S040645@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: Wed, 20 Jul 2016 09:29:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303076 - head/sys/dev/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 09:29:41 -0000 Author: royger Date: Wed Jul 20 09:29:39 2016 New Revision: 303076 URL: https://svnweb.freebsd.org/changeset/base/303076 Log: vesa: fix panic on suspend Fix the following panic seen when migrating a FreeBSD guest on Xen: panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541 cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0 vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570 kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0 __mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630 vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680 vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0 isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0 bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame [...] This is caused because vga_sub_configure (which is called if the VGA adapter is attached after VESA tried to initialize), points to vesa_configure, which doesn't initialize the VESA mutex. In order to fix it, make sure vga_sub_configure points to vesa_load, so that all the needed vesa components are properly initialized. Sponsored by: Citrix Systems R&D MFC after: 3 days PR: 209203 Reviewed by: dumbbell Differential revision: https://reviews.freebsd.org/D7196 Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Wed Jul 20 07:33:48 2016 (r303075) +++ head/sys/dev/fb/vesa.c Wed Jul 20 09:29:39 2016 (r303076) @@ -134,6 +134,7 @@ static vi_fill_rect_t vesa_fill_rect; static vi_bitblt_t vesa_bitblt; static vi_diag_t vesa_diag; static int vesa_bios_info(int level); +static int vesa_late_load(int flags); static video_switch_t vesavidsw = { vesa_probe, @@ -1141,7 +1142,7 @@ vesa_configure(int flags) * initialization for now and try again later. */ if (adp == NULL) { - vga_sub_configure = vesa_configure; + vga_sub_configure = vesa_late_load; return (ENODEV); } @@ -1909,6 +1910,17 @@ vesa_bios_info(int level) static int vesa_load(void) { + + return (vesa_late_load(0)); +} + +/* + * To be called from the vga_sub_configure hook in case the VGA adapter is + * not found when VESA is loaded. + */ +static int +vesa_late_load(int flags) +{ int error; if (vesa_init_done) @@ -1918,7 +1930,7 @@ vesa_load(void) /* locate a VGA adapter */ vesa_adp = NULL; - error = vesa_configure(0); + error = vesa_configure(flags); if (error == 0) vesa_bios_info(bootverbose); From owner-svn-src-head@freebsd.org Wed Jul 20 10:06: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 0033DB9C88F; Wed, 20 Jul 2016 10:06:58 +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 AAFE01A76; Wed, 20 Jul 2016 10:06:57 +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 u6KA6uTs057279; Wed, 20 Jul 2016 10:06:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KA6u5P057278; Wed, 20 Jul 2016 10:06:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607201006.u6KA6u5P057278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Jul 2016 10:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303084 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 10:06:58 -0000 Author: avg Date: Wed Jul 20 10:06:56 2016 New Revision: 303084 URL: https://svnweb.freebsd.org/changeset/base/303084 Log: MFV r303082: 6391 Override default SPA config location via environment illumos/illumos-gate@ae24175b2b25e9fb4bfd9ac0648b57e0735b6651 https://github.com/illumos/illumos-gate/commit/ae24175b2b25e9fb4bfd9ac0648b57e0735b6651 https://www.illumos.org/issues/6391 When using zdb with non-default SPA config file it is not convenient to add -U all the time. This commit introduces support for setting/overriding SPA config location via environment variable 'SPA_CONFIG_PATH'. If -U flag is specified in the command line it will override any other value as usual. https://github.com/zfsonlinux/zfs/commit/64d7b6cf75e52a4698d9bdec61745573c39d2e5a Reviewed by: Brian Behlendorf Reviewed by: Richard Yao Reviewed by: Matthew Ahrens Reviewed by: Will Andrews Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Cyril Plisko MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 09:58:10 2016 (r303083) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 10:06:56 2016 (r303084) @@ -3558,12 +3558,22 @@ main(int argc, char **argv) nvlist_t *policy = NULL; uint64_t max_txg = UINT64_MAX; int rewind = ZPOOL_NEVER_REWIND; + char *spa_config_path_env; (void) setrlimit(RLIMIT_NOFILE, &rl); (void) enable_extended_FILE_stdio(-1, -1); dprintf_setup(&argc, argv); + /* + * If there is an environment variable SPA_CONFIG_PATH it overrides + * default spa_config_path setting. If -U flag is specified it will + * override this environment variable settings once again. + */ + spa_config_path_env = getenv("SPA_CONFIG_PATH"); + if (spa_config_path_env != NULL) + spa_config_path = spa_config_path_env; + while ((c = getopt(argc, argv, "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) { switch (c) { From owner-svn-src-head@freebsd.org Wed Jul 20 11:04: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 A1C1DB9A297; Wed, 20 Jul 2016 11:04:50 +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 6B99914A8; Wed, 20 Jul 2016 11:04:50 +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 u6KB4nlP079161; Wed, 20 Jul 2016 11:04:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KB4nom079160; Wed, 20 Jul 2016 11:04:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607201104.u6KB4nom079160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Jul 2016 11:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303085 - 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: Wed, 20 Jul 2016 11:04:50 -0000 Author: mav Date: Wed Jul 20 11:04:49 2016 New Revision: 303085 URL: https://svnweb.freebsd.org/changeset/base/303085 Log: Remove outdated list of supported chipsets, generalizing it. Modified: head/share/man/man4/ichsmb.4 Modified: head/share/man/man4/ichsmb.4 ============================================================================== --- head/share/man/man4/ichsmb.4 Wed Jul 20 10:06:56 2016 (r303084) +++ head/share/man/man4/ichsmb.4 Wed Jul 20 11:04:49 2016 (r303085) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd July 20, 2016 .Dt ICHSMB 4 .Os .Sh NAME @@ -46,10 +46,12 @@ .Cd device smb .Cd device ichsmb .Sh DESCRIPTION -This driver provides access to the SMBus controller logical -device contained in the Intel 82801AA (ICH), 82801AB (ICH0), -82801BA (ICH2), 82801CA (ICH3), 82801DC (ICH4), 82801EB (ICH5), -82801FB (ICH6) and 82801GB (ICH7) PCI chips. +The +.Nm +driver provides +.Xr smbus 4 +support for the SMBus controller logical device contained in all Intel +motherboard chipsets starting from 82801AA (ICH). .Sh SEE ALSO .Xr smb 4 , .Xr smbus 4 From owner-svn-src-head@freebsd.org Wed Jul 20 11:15: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 4ECF7B9A677; Wed, 20 Jul 2016 11:15:34 +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 0AD6F1B2E; Wed, 20 Jul 2016 11:15:33 +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 u6KBFX7A082973; Wed, 20 Jul 2016 11:15:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KBFXcE082971; Wed, 20 Jul 2016 11:15:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201607201115.u6KBFXcE082971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Jul 2016 11:15:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303086 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 11:15:34 -0000 Author: avg Date: Wed Jul 20 11:15:32 2016 New Revision: 303086 URL: https://svnweb.freebsd.org/changeset/base/303086 Log: MFV r303083: 7164 zdb should be able to open the root dataset Note: conversion of the manual page change from roff to mdoc is mine. illumos/illumos-gate@b702644a6eb66615d67b492fd73ecd9efa11fc7d https://github.com/illumos/illumos-gate/commit/b702644a6eb66615d67b492fd73ecd9efa11fc7d https://www.illumos.org/issues/7164 If the pool/dataset command-line argument is specified with a trailing slash, for example, "tank/", we should interpret it as the topmost dataset (rather than the whole pool) Reviewed by: Pavel Zakharov Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Tim Chase PR: 204661 MFC after: 1 week Relnotes: yes Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jul 20 11:04:49 2016 (r303085) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jul 20 11:15:32 2016 (r303086) @@ -86,6 +86,17 @@ pool, and is inherently unstable. The precise output of most invocations is not documented, a knowledge of ZFS internals is assumed. .Pp +If the +.Ar dataset +argument does not contain any +.Sy / +or +.Sy @ +characters, it is interpreted as a pool name. +The root dataset can be specified as +.Pa pool Ns Sy / +(pool name followed by a slash). +.Pp When operating on an imported and active pool it is possible, though unlikely, that zdb may interpret inconsistent pool data and behave erratically. .Sh OPTIONS Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 11:04:49 2016 (r303085) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 11:15:32 2016 (r303086) @@ -3559,6 +3559,7 @@ main(int argc, char **argv) uint64_t max_txg = UINT64_MAX; int rewind = ZPOOL_NEVER_REWIND; char *spa_config_path_env; + boolean_t target_is_spa = B_TRUE; (void) setrlimit(RLIMIT_NOFILE, &rl); (void) enable_extended_FILE_stdio(-1, -1); @@ -3738,8 +3739,23 @@ main(int argc, char **argv) } } + if (strpbrk(target, "/@") != NULL) { + size_t targetlen; + + target_is_spa = B_FALSE; + /* + * Remove any trailing slash. Later code would get confused + * by it, but we want to allow it so that "pool/" can + * indicate that we want to dump the topmost filesystem, + * rather than the whole pool. + */ + targetlen = strlen(target); + if (targetlen != 0 && target[targetlen - 1] == '/') + target[targetlen - 1] = '\0'; + } + if (error == 0) { - if (strpbrk(target, "/@") == NULL || dump_opt['R']) { + if (target_is_spa || dump_opt['R']) { error = spa_open_rewind(target, &spa, FTAG, policy, NULL); if (error) { From owner-svn-src-head@freebsd.org Wed Jul 20 11:23: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 C45BBB9A906; Wed, 20 Jul 2016 11:23:07 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C412113B; Wed, 20 Jul 2016 11:23:07 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KBN6sD086612; Wed, 20 Jul 2016 11:23:06 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KBN62g086610; Wed, 20 Jul 2016 11:23:06 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201607201123.u6KBN62g086610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 20 Jul 2016 11:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303087 - 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, 20 Jul 2016 11:23:07 -0000 Author: manu Date: Wed Jul 20 11:23:06 2016 New Revision: 303087 URL: https://svnweb.freebsd.org/changeset/base/303087 Log: Add support for the SID (Security ID Module) on Allwinner A10 and A20. The rootkey is burnt at production and can't be changed, thus is can be used as a device unique ID or to generate a MAC address (This is was u-boot does). The rootkey is exposed as a sysctl (dev.aw_sid..rootkey). Reviewed by: jmcneill Differential Revision: https://reviews.freebsd.org/D6383 Modified: head/sys/arm/allwinner/aw_sid.c head/sys/arm/allwinner/aw_sid.h Modified: head/sys/arm/allwinner/aw_sid.c ============================================================================== --- head/sys/arm/allwinner/aw_sid.c Wed Jul 20 11:15:32 2016 (r303086) +++ head/sys/arm/allwinner/aw_sid.c Wed Jul 20 11:23:06 2016 (r303087) @@ -33,12 +33,14 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include #include #include #include +#include #include #include @@ -50,13 +52,22 @@ __FBSDID("$FreeBSD$"); #define SID_THERMAL_CALIB0 (SID_SRAM + 0x34) #define SID_THERMAL_CALIB1 (SID_SRAM + 0x38) +enum sid_type { + A10_SID = 1, + A20_SID, + A83T_SID, +}; + static struct ofw_compat_data compat_data[] = { - { "allwinner,sun8i-a83t-sid", 1 }, + { "allwinner,sun4i-a10-sid", A10_SID}, + { "allwinner,sun7i-a20-sid", A20_SID}, + { "allwinner,sun8i-a83t-sid", A83T_SID}, { NULL, 0 } }; struct aw_sid_softc { struct resource *res; + int type; }; static struct aw_sid_softc *aw_sid_sc; @@ -66,9 +77,18 @@ static struct resource_spec aw_sid_spec[ { -1, 0 } }; +enum sid_keys { + AW_SID_ROOT_KEY, +}; + +#define ROOT_KEY_OFF 0x0 +#define ROOT_KEY_SIZE 4 + #define RD4(sc, reg) bus_read_4((sc)->res, (reg)) #define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) +static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS); + static int aw_sid_probe(device_t dev) { @@ -96,6 +116,19 @@ aw_sid_attach(device_t dev) aw_sid_sc = sc; + sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + switch (sc->type) { + case A10_SID: + case A20_SID: + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "rootkey", + CTLTYPE_STRING | CTLFLAG_RD, + dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key"); + break; + default: + break; + } return (0); } @@ -107,6 +140,8 @@ aw_sid_read_tscalib(uint32_t *calib0, ui sc = aw_sid_sc; if (sc == NULL) return (ENXIO); + if (sc->type != A83T_SID) + return (ENXIO); *calib0 = RD4(sc, SID_THERMAL_CALIB0); *calib1 = RD4(sc, SID_THERMAL_CALIB1); @@ -114,6 +149,45 @@ aw_sid_read_tscalib(uint32_t *calib0, ui return (0); } +int +aw_sid_get_rootkey(u_char *out) +{ + struct aw_sid_softc *sc; + int i; + u_int tmp; + + sc = aw_sid_sc; + if (sc == NULL) + return (ENXIO); + if (sc->type != A10_SID && sc->type != A20_SID) + return (ENXIO); + + for (i = 0; i < ROOT_KEY_SIZE ; i++) { + tmp = RD4(aw_sid_sc, ROOT_KEY_OFF + (i * 4)); + be32enc(&out[i * 4], tmp); + } + + return (0); +} + +static int +aw_sid_sysctl(SYSCTL_HANDLER_ARGS) +{ + enum sid_keys key = arg2; + u_char rootkey[16]; + char out[33]; + + if (key != AW_SID_ROOT_KEY) + return (ENOENT); + + if (aw_sid_get_rootkey(rootkey) != 0) + return (ENOENT); + snprintf(out, sizeof(out), + "%16D", rootkey, ""); + + return sysctl_handle_string(oidp, out, sizeof(out), req); +} + static device_method_t aw_sid_methods[] = { /* Device interface */ DEVMETHOD(device_probe, aw_sid_probe), Modified: head/sys/arm/allwinner/aw_sid.h ============================================================================== --- head/sys/arm/allwinner/aw_sid.h Wed Jul 20 11:15:32 2016 (r303086) +++ head/sys/arm/allwinner/aw_sid.h Wed Jul 20 11:23:06 2016 (r303087) @@ -30,5 +30,6 @@ #define __AW_SID_H__ int aw_sid_read_tscalib(uint32_t *, uint32_t *); +int aw_sid_get_rootkey(u_char *out); #endif /* !__AW_SID_H__ */ From owner-svn-src-head@freebsd.org Wed Jul 20 11:29: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 5E68AB9AB1A; Wed, 20 Jul 2016 11:29:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mail.miracle.cz (mail.miracle.cz [193.84.128.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.miracle.cz", Issuer "Miracle Group Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9305F1454; Wed, 20 Jul 2016 11:29:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from [193.84.128.50] (meloun.ad.miracle.cz [193.84.128.50]) by mail.miracle.cz (Postfix) with ESMTPSA id 8EBC73AC9B; Wed, 20 Jul 2016 13:28:53 +0200 (CEST) Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Nathan Whitehorn , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> From: Michal Meloun X-Enigmail-Draft-Status: N1110 Message-ID: <578F6075.7010500@FreeBSD.org> Date: Wed, 20 Jul 2016 13:28:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.miracle.cz); Wed, 20 Jul 2016 13:28:53 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Wed, 20 Jul 2016 11:29:02 -0000 Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): > > > On 07/19/16 04:13, Michal Meloun wrote: >> Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): >> Hi Nathan, >> I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so >> please don’t expect quick response. >> >>> Could you please describe what this change is in more detail? >> Short description is appended. >> >>> It breaks a lot of encapsulations we have worked very hard to maintain, >>> moves ARM code into MI parts of the kernel, and the OFW parts violate >>> IEEE 1275 (the Open Firmware standard). In particular, there is no >>> guarantee that the interrupts for a newbus (or OF) device are >>> encoded in >>> a property called "interrupts" (or, indeed, in any property at all) on >>> that node and there are many, many device trees where that is not the >>> case (e.g. ones with interrupt maps, as well as Apple hardware). By >>> putting that knowledge into the OF root bus device, which we have tried >>> to keep it out of, this enforces a standard that doesn't actually >>> exist. >> Imho, this patch doesn’t change anything in this area. Only handling of >> “interrupts” property is changed, all other cases are unchanged (I >> hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. > > But "interrupts" isn't a generic part of OF. This makes it one, > incorrectly. How? Can you be little more exact ? > >> >>> I'm hesitant to ask for reversion on something that landed 6 weeks ago >>> without me noticing, but this needs a lot more architectural work >>> before >>> any parts of the kernel should use it. >>> -Nathan >> I think that it’s too late. This patch series consist of r301451 >> (https://reviews.freebsd.org/D6632), >> r301453, r301539 and 301543. And new GPIO interrupts are currently used >> (by in tree drivers or in development trees). > > Well, then we need in-place rearchitecture. > >> >> >> The root of problem is that standard way of delivering interrupt >> resource to consumer driver doesn’t works in OFW world. >> >> So we have some fact: >> - the format of interrupt property is dependent of interrupt >> controller and only interrupt controller can parse it. >> - the interrupt property can have more data than just interrupt >> number. >> - single interrupt controller must be able to handle multiple >> format of interrupt description. >> >> In pre-patchset era, simplebus enumerates children and attempts to set >> memory and interrupts to resource list for them. But the interrupt >> controllers are not yet populated so nobody can parse interrupt >> property. Moreover, in all cases (parsed or not), we cannot store >> complete interrupt description into resource list. > > We have done this for many years on PowerPC and sparc64 with delayed > configuration of interrupts and a look-up table. This handles > complicated bus configurations better than this code and requires no > changes outside of a few MD files. That is why the (now partially > duplicated) OFW_BUS_MAP_INTR() function exists. That one also has the > benefit of still working when used in conjunction with, e.g., devices > with an interrupt-map-mask property. > >> >> The patch simply postpones reading of interrupt property to >> bus_alloc_resource() (called by consumer driver) time. >> >> Due to this, we can: >> - parse interrupt property. The interrupt driver must exist >> at this time. > > This only works with some types of interrupt properties, not all, and > breaks if the interrupt driver hasn't attached yet (which it can't be > guaranteed to -- some PPC systems have interrupt drivers that live on > the PCI bus, for example). How you can allocate (and reserve it in rman) interrupt if is not mapped (so you have not real IRQ number for it). Just for notice - multiple virtual IRQs can be mapped into single real IRQ. > >> - bus_alloc_resource() returns resource, so we can attach parsed >> interrupt data to it. By this, the resource itself can be used >> for delivering configuration data to subsequent call to >> bus_setup_intr() (or to all related bus_() calls). >> >> >> The patched code still accepts delivering of interrupts in resource >> list. >> >> Michal >> > > Given that other code depends on this, fixing it will likely require > some complex work. I wish I had known about it when it went in. > > There are three main problems: > 1. It doesn't work for interrupts defined by other mechanisms (e.g. > interrupt-map properties) I aggree, but missing ' interrupt-map' functioanlity is not caused by this patch. > 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), > but is both problematically more general and less flexible (it has > requirements on timing of PIC attachment vs. driver resource allocation) OFW_BUS_MAP_INTR() can parse only OFW based data and expect that parsed data are magicaly stored within the call. The new method, bus_map_intr(), can parse data from multiple sources (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also returns parsed data back to caller. And no, it doesn't add any additional timing requirements . > 3. It is not fully transparent to end code. Since it happens at > bus_alloc_resource() time, it is complicated to get the appropriate > values for IRQs constructed by composite techniques (interrupt-map vs. > interrupts vs. hand allocation vs. PCI routing, for example). I don't see any limitation - can you be more exact? Why is not transparent? Why is more complicated ? > It is much easier to do this correctly at bus attach time when the > resource lists are made (how PPC does it). > I don't agree. I don't agree. Making this at bus attach time leads into complicated 'virtual' IRQ infrastructure, with many unresolved corner cases. > (1) is easy to fix without API changes, but (2) and (3) are > fundamental architectural problems that will bite us immediately down > the road and cause a permanent schism between OF support on different > platforms. > > Let me describe how this is handled on PowerPC (Linux on PPC solves > the problem the same way). When constructing a resource list, bus > drivers that construct them from OF properties call ofw_bus_map_intr() > with the interrupt parent phandle and the array of cells corresponding > to the interrupt. This thunks immediately to nexus, which connects to > code in intr_machdep.c. Code there assigns a unique made-up virtual > IRQ and returns it, caching the interrupt parent ID and opaque > interrupt data (if the same string of data reappears later, you get > back the same virtual IRQ of course). > > When PIC drivers attach and register themselves with the interrupt > handling layer, all the interrupts for that PIC are passed to it along > with the virtual IRQ. The PIC driver is supposed to know what its > interrupt data mean, which can be safely guaranteed, and it presents > the assigned virtual IRQ number to the kernel when dispatching > interrupts. (IRQs configured after PIC attachment are passed through > immediately). > > This accomplishes the following things: > 1. Parsing interrupt data is moved to the PIC driver, which is the > only place it can be done safely. I don't see anything different comparing with INTRNG. > 2. There is no ordering requirement on PIC attachment vs. the > attachment of anything else. I think thats is not a true - PIC must exist before bus_alloc_resource() / bus_setup_intr() is called. > 3. Changes are extremely minimal relative to the "standard" interrupt > flow: you only have to patch code that is already directly dealing > with OF interrupts. I don't see anything different comparing with INTRNG. > 4. It happens at bus enumeration time, when results can be guaranteed > self-consistent. Where do you see any potential source of inconsistency in INTRNG? > 5. It combines naturally with ofw_bus_lookup_imap() and friends in the > interrupt-map case (e.g. for PCI). Again, I don't see anything different. Proper parsing of interrupt property is not a problem of INTRNG (but must be fixed, of course). > > I'm not sure what the right path forward is, but this code needs to be > fixed. The PowerPC code is fully MI, and was the template for the > original INTRNG, so it shouldn't be too bad to replace. > -Nathan > So, new INTRNG: - Introduces new more general bus method that can parse interrupt configuration data from any source. Is this step backward? - Old INTRNG and PPC code stores unparsed and/or parsed interrupt data in INTRNG and each consumer must query for them. This data sharing also causes significant locking issues. New INTRNG stores interrupt configuration data into given resource, so each relevant bus method can access it immediately. Is this step backward? - New INTRNG is not OFW centric, it can works with virtually unlimited number of configuration data sources. Is this step backward? - New INTRNG correctly uses standard system infrastructure. Real IRQ number is reserved in rman within bus_alloc_resource() call, interrupt HW is configured (only!) within bus_setup_intr() call. Is this step backward? - New INTRNG completely eliminates huge and not always working virtual IRQ concept. Don’t take me bad, I’m open to any change. But no, at this time, I’m not ready to completely revert someone else's work – although I am a co-author. Michal From owner-svn-src-head@freebsd.org Wed Jul 20 12:46: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 57180B9DC45; Wed, 20 Jul 2016 12:46:22 +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 266DC13A2; Wed, 20 Jul 2016 12:46:22 +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 u6KCkLHA016324; Wed, 20 Jul 2016 12:46:21 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KCkL7X016323; Wed, 20 Jul 2016 12:46:21 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607201246.u6KCkL7X016323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 20 Jul 2016 12:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303088 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 12:46:22 -0000 Author: ache Date: Wed Jul 20 12:46:21 2016 New Revision: 303088 URL: https://svnweb.freebsd.org/changeset/base/303088 Log: In addition to r303074 case 1, search for protected L'/' too in globtilde() Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Wed Jul 20 11:23:06 2016 (r303087) +++ head/lib/libc/gen/glob.c Wed Jul 20 12:46:21 2016 (r303088) @@ -126,7 +126,6 @@ struct glob_limit { #define TILDE L'~' #define LBRACE L'{' #define RBRACE L'}' -#define SLASH L'/' #define COMMA L',' #ifndef DEBUG @@ -427,10 +426,10 @@ globtilde(const Char *pattern, Char *pat */ eb = &patbuf[patbuf_len - 1]; for (p = pattern + 1, b = patbuf; - b < eb && *p != EOS && *p != SLASH; *b++ = *p++) + b < eb && *p != EOS && UNPROT(*p) != SEP; *b++ = *p++) continue; - if (*p != EOS && *p != SLASH) + if (*p != EOS && UNPROT(*p) != SEP) return (NULL); *b = EOS; From owner-svn-src-head@freebsd.org Wed Jul 20 13:33: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 4BB04B9EA02 for ; Wed, 20 Jul 2016 13:33:42 +0000 (UTC) (envelope-from rrs@netflix.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 061361D78 for ; Wed, 20 Jul 2016 13:33:42 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-qt0-x22c.google.com with SMTP id 52so26150979qtq.3 for ; Wed, 20 Jul 2016 06:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=bSHanfuZHo5kt9yK99Py9p4O/GZmY3Vboj49GoSqc7g=; b=Bwk3wGa5p2DVNZc2dus5CQur28SzB4EGbEDInirMo25nA4XGH/3H2Al+7Ko/P3Tunw LuFQ3uijw59COC7sJ6S54Rm5fZJ940I7Bph1Lo1VwdEp17cpujea9BBDR2ErH7tLs9sA qH26/LiUsToUzWaMNCNd70pU1SBG3X5dK8Xhs= 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=bSHanfuZHo5kt9yK99Py9p4O/GZmY3Vboj49GoSqc7g=; b=Ge/ifkG2W+22OjridJ1dbbVHwikfF76biZpX5tJKy7l5vS8bqe9Rd2KQRCBrSdJKJ0 xMdH7NFv3U03gVoK5fiOqWGrN/posPMRYvpV/XMCIk87eYMiOjrZgfxYMv/sb9ARpoQz gYkD1m4zNWe0WpJ+HSA9I1t1N/m8uYtz/GQ93r3FLKZbssAvNJBS58IX2WcOdyTQ+9H5 14paF41Kmsed3QKdjbUUEFLA2AjPAwhXQdTQMey1C97FIUEvH2oBSZnREbASzzHxPzuu HUclCFk33daNfurAWlkGuZ9l61nbviQhR4H8+ye8nDVn3gDLrFtAR1AxO6jtqfRYFBmb 4wjw== X-Gm-Message-State: ALyK8tIgQQONBop8WVpcaPj1ZXwWpHGKfPngI952V3hhYkj59Es2M6E1OB/eyJ7BiC+lXH6O X-Received: by 10.237.53.19 with SMTP id a19mr68514536qte.67.1469021621035; Wed, 20 Jul 2016 06:33:41 -0700 (PDT) Received: from [100.127.85.21] ([69.53.246.16]) by smtp.gmail.com with ESMTPSA id o70sm1418645qka.29.2016.07.20.06.33.39 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 06:33:40 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r303037 - head/sys/kern From: Randall Stewart In-Reply-To: <20160720065335.GU1076@FreeBSD.org> Date: Wed, 20 Jul 2016 15:33:37 +0200 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1CA02E0F-6871-4291-9F5A-20EFF5F6315D@netflix.com> References: <201607191831.u6JIVJWq007542@repo.freebsd.org> <20160720065335.GU1076@FreeBSD.org> To: Gleb Smirnoff 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, 20 Jul 2016 13:33:42 -0000 Gleb I wish you would have responded earlier.. I am more than glad to hand off all kern_timeout.c to you=E2=80=A6 please take it commit what you = want to it and have it. I hate the code and I dislike having to touch it. Its yours.. I can assure you I will not touch it again. R > On Jul 20, 2016, at 8:53 AM, Gleb Smirnoff = wrote: >=20 > On Tue, Jul 19, 2016 at 06:31:19PM +0000, Randall Stewart wrote: > R> Author: rrs > R> Date: Tue Jul 19 18:31:19 2016 > R> New Revision: 303037 > R> URL: https://svnweb.freebsd.org/changeset/base/303037 > R>=20 > R> Log: > R> This reverts out Gleb's changes and adds three small > R> fixes that I think closes up the races Gleb was > R> looking for. This is running quite nicely in Netflix and > R> now no longer causes TCP-tcb leaks. > R> =20 > R> Differential Revision: 7135 >=20 > Just to notice that I am completely pissed of by this commit > war, that you started. >=20 > I've been testing my changes properly, I gave people time to > review my changes. You didn't. >=20 > =46rom your explanation in other emails I see that you've been > testing your changes with a version of FreeBSD that is a heavily > modified FreeBSD 10, not 11. >=20 > The new code you mixed with revert of mine, doesn't fix the > problem observed. It fixes another problem that you imagined, > which might exist, but isn't observed. We already discussed that > and you didn't prove it wrong. >=20 > Your change doesn't even revert my change completely. >=20 > --=20 > Totus tuus, Glebius. -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Wed Jul 20 14:40: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 4CBE6B9F0C3; Wed, 20 Jul 2016 14:40:58 +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 04E09186B; Wed, 20 Jul 2016 14:40:57 +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 u6KEevoK059184; Wed, 20 Jul 2016 14:40:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KEevLD059182; Wed, 20 Jul 2016 14:40:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607201440.u6KEevLD059182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Jul 2016 14:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303090 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 14:40:58 -0000 Author: kib Date: Wed Jul 20 14:40:56 2016 New Revision: 303090 URL: https://svnweb.freebsd.org/changeset/base/303090 Log: Ensure that the UFS directory vnode' vm_object is properly sized before UFS_BALLOC() is called. I do not believe that this caused any real issue on FreeBSD because the exclusive vnode lock is held over the balloc/resize, the change is to make formally correct KPI use. Based on: the Matthew Dillon' patch from DragonFly BSD PR: 93942 Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Wed Jul 20 14:38:02 2016 (r303089) +++ head/sys/ufs/ufs/ufs_lookup.c Wed Jul 20 14:40:56 2016 (r303090) @@ -881,6 +881,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir struct buf *bp; u_int dsize; struct direct *ep, *nep; + u_int64_t old_isize; int error, ret, blkoff, loc, spacefree, flags, namlen; char *dirbuf; @@ -909,16 +910,18 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdir return (error); } #endif + old_isize = dp->i_size; + vnode_pager_setsize(dvp, (u_long)dp->i_offset + DIRBLKSIZ); if ((error = UFS_BALLOC(dvp, (off_t)dp->i_offset, DIRBLKSIZ, cr, flags, &bp)) != 0) { if (DOINGSOFTDEP(dvp) && newdirbp != NULL) bdwrite(newdirbp); + vnode_pager_setsize(dvp, (u_long)old_isize); return (error); } dp->i_size = dp->i_offset + DIRBLKSIZ; DIP_SET(dp, i_size, dp->i_size); dp->i_flag |= IN_CHANGE | IN_UPDATE; - vnode_pager_setsize(dvp, (u_long)dp->i_size); dirp->d_reclen = DIRBLKSIZ; blkoff = dp->i_offset & (VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_iosize - 1); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Wed Jul 20 14:38:02 2016 (r303089) +++ head/sys/ufs/ufs/ufs_vnops.c Wed Jul 20 14:40:56 2016 (r303090) @@ -1913,13 +1913,13 @@ ufs_mkdir(ap) dirtemplate = *dtp; dirtemplate.dot_ino = ip->i_number; dirtemplate.dotdot_ino = dp->i_number; + vnode_pager_setsize(tvp, DIRBLKSIZ); if ((error = UFS_BALLOC(tvp, (off_t)0, DIRBLKSIZ, cnp->cn_cred, BA_CLRBUF, &bp)) != 0) goto bad; ip->i_size = DIRBLKSIZ; DIP_SET(ip, i_size, DIRBLKSIZ); ip->i_flag |= IN_CHANGE | IN_UPDATE; - vnode_pager_setsize(tvp, (u_long)ip->i_size); bcopy((caddr_t)&dirtemplate, (caddr_t)bp->b_data, sizeof dirtemplate); if (DOINGSOFTDEP(tvp)) { /* From owner-svn-src-head@freebsd.org Wed Jul 20 15:00: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 DD807B9F6ED; Wed, 20 Jul 2016 15:00:06 +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 B0628180A; Wed, 20 Jul 2016 15:00:06 +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 u6KF05Yt064636; Wed, 20 Jul 2016 15:00:05 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KF05T6064635; Wed, 20 Jul 2016 15:00:05 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201607201500.u6KF05T6064635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 20 Jul 2016 15:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303091 - head/usr.sbin/camdd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 15:00:07 -0000 Author: asomers Date: Wed Jul 20 15:00:05 2016 New Revision: 303091 URL: https://svnweb.freebsd.org/changeset/base/303091 Log: Fix camdd for host-aware and host-managed SMR disks. This should've gone in as part of r300207 Reviewed by: ken MFC after: 3 days Sponsored by: Spectra Logic Corp Modified: head/usr.sbin/camdd/camdd.c Modified: head/usr.sbin/camdd/camdd.c ============================================================================== --- head/usr.sbin/camdd/camdd.c Wed Jul 20 14:40:56 2016 (r303090) +++ head/usr.sbin/camdd/camdd.c Wed Jul 20 15:00:05 2016 (r303091) @@ -1292,6 +1292,7 @@ camdd_probe_pass(struct cam_device *cam_ case T_CDROM: case T_OPTICAL: case T_RBC: + case T_ZBC_HM: break; default: errx(1, "Unsupported SCSI device type %d", scsi_dev_type); From owner-svn-src-head@freebsd.org Wed Jul 20 15:20: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 E3EB2B9FE76; Wed, 20 Jul 2016 15:20:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f179.google.com (mail-io0-f179.google.com [209.85.223.179]) (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 B78B519B1; Wed, 20 Jul 2016 15:20:11 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f179.google.com with SMTP id m101so50396700ioi.2; Wed, 20 Jul 2016 08:20:11 -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=7qwxLgnR6no4IVerhQZfwAvYLAxHBbprLOof3cgTVRY=; b=XUIfxG5Qcy5jbHaLKOJE0Vl34yKxnNgNIIG70bXpCTQJT+OQfB7/1PC9X5tauNLc+m GjrhViAEgEmooL3vLfYrDP+yeD1Hm8+x9ZRfPgXZxivI0efQEmgtVG38uA6jhY39boIJ HI2EMaLQs8WrzLFnbqNzO/98mAG54nlWPjVA3P6vXcOZ3WroDfUCD/Er1BrqfMYkK/Uo nvN7eVHtjyTkGSr8leoLLiPHLdrFH+lhnvA6/s9XT5/Ci4lFionoc8u2NKWJtChz8cAW OaPq6AXLMDJgIsHnnPiWooHAQgkZX671U4kRqDzdWniU/qAKEpYZMWGiNAYOgxUKo4OZ mdgQ== X-Gm-Message-State: ALyK8tIy9h0Iz3jc0WVvbe4VhmvQhSkyrzzcnR/t9lFKhUSefBpKFQP8MbulFbCzo+C5/g== X-Received: by 10.107.17.68 with SMTP id z65mr45259681ioi.150.1469028005383; Wed, 20 Jul 2016 08:20:05 -0700 (PDT) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com. [209.85.223.171]) by smtp.gmail.com with ESMTPSA id 188sm8950093itk.19.2016.07.20.08.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 08:20:05 -0700 (PDT) Received: by mail-io0-f171.google.com with SMTP id m101so50396347ioi.2; Wed, 20 Jul 2016 08:20:05 -0700 (PDT) X-Received: by 10.107.28.11 with SMTP id c11mr3969572ioc.7.1469028004881; Wed, 20 Jul 2016 08:20:04 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Wed, 20 Jul 2016 08:20:04 -0700 (PDT) In-Reply-To: <1c485351-51f3-99f1-b7da-0745030dd1e6@FreeBSD.org> References: <201607191920.u6JJKm7R026421@repo.freebsd.org> <1c485351-51f3-99f1-b7da-0745030dd1e6@FreeBSD.org> From: Conrad Meyer Date: Wed, 20 Jul 2016 08:20:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303043 - in head: share/man/man4 sys/dev/vt sys/dev/vt/hw/fb To: koobs@freebsd.org 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: Wed, 20 Jul 2016 15:20:12 -0000 On Wed, Jul 20, 2016 at 12:44 AM, Kubilay Kocak wrote: > On 20/07/2016 5:20 AM, Conrad E. Meyer wrote: >> Author: cem >> Date: Tue Jul 19 19:20:47 2016 >> New Revision: 303043 >> URL: https://svnweb.freebsd.org/changeset/base/303043 >> >> Log: >> Increase vt(4) framebuffer maximum size >> >> And rename "DEFAULT" constants to the more accurate "MAX." >> >> PR: 210382 >> Submitted by: Felix >> Reviewed by: wblock, cem >> Tested by: Dave Cottlehuber > > Can MFC? > > There are high hopes for this coming out in 11.0 / next 10.x > > re is cc'd on the original bugzilla issue If you would like to do so, please go ahead. Best, Conrad From owner-svn-src-head@freebsd.org Wed Jul 20 15:45: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 23DEEB9E475; Wed, 20 Jul 2016 15:45:22 +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 0AD201B12; Wed, 20 Jul 2016 15:45:21 +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 u6KFj6hg022302 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 20 Jul 2016 08:45:07 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> From: Nathan Whitehorn Message-ID: <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> Date: Wed, 20 Jul 2016 08:45:06 -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: <578F6075.7010500@FreeBSD.org> X-Sonic-CAuth: UmFuZG9tSVaCibFARB3fA4bleaDLT/egfL6kT6bkkayTbSm+b2UDY18aEJQZdTY2NRqWHUAL7fcc8NyxTWgU3p4gXVNJbafDqFQWA0XC53Y= X-Sonic-ID: C;qh3D7pBO5hG5MZtMTlz00w== M;Kp4m75BO5hG5MZtMTlz00w== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: Wed, 20 Jul 2016 15:45:22 -0000 On 07/20/16 04:28, Michal Meloun wrote: > Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >> >> >> On 07/19/16 04:13, Michal Meloun wrote: >>> Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): >>> Hi Nathan, >>> I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so >>> please don’t expect quick response. >>> >>>> Could you please describe what this change is in more detail? >>> Short description is appended. >>> >>>> It breaks a lot of encapsulations we have worked very hard to >>>> maintain, >>>> moves ARM code into MI parts of the kernel, and the OFW parts violate >>>> IEEE 1275 (the Open Firmware standard). In particular, there is no >>>> guarantee that the interrupts for a newbus (or OF) device are >>>> encoded in >>>> a property called "interrupts" (or, indeed, in any property at all) on >>>> that node and there are many, many device trees where that is not the >>>> case (e.g. ones with interrupt maps, as well as Apple hardware). By >>>> putting that knowledge into the OF root bus device, which we have >>>> tried >>>> to keep it out of, this enforces a standard that doesn't actually >>>> exist. >>> Imho, this patch doesn’t change anything in this area. Only handling of >>> “interrupts” property is changed, all other cases are unchanged (I >>> hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. >> >> But "interrupts" isn't a generic part of OF. This makes it one, >> incorrectly. > How? Can you be little more exact ? Because it puts knowledge into ofwbus that expects that children at arbitrary levels of nesting have interrupts defined by an "interrupts" property. You could patch this through on sub-devices, of course, but that's already done correctly by the existing ofw_bus_map_intr() code in a much more robust way that doesn't involve trying to guess how sub-buses and devices have chosen to allocate resources. Why reinvent the wheel all the way through the bus hierarchy? >> >>> >>>> I'm hesitant to ask for reversion on something that landed 6 weeks ago >>>> without me noticing, but this needs a lot more architectural work >>>> before >>>> any parts of the kernel should use it. >>>> -Nathan >>> I think that it’s too late. This patch series consist of r301451 >>> (https://reviews.freebsd.org/D6632), >>> r301453, r301539 and 301543. And new GPIO interrupts are currently >>> used >>> (by in tree drivers or in development trees). >> >> Well, then we need in-place rearchitecture. >> >>> >>> >>> The root of problem is that standard way of delivering interrupt >>> resource to consumer driver doesn’t works in OFW world. >>> >>> So we have some fact: >>> - the format of interrupt property is dependent of interrupt >>> controller and only interrupt controller can parse it. >>> - the interrupt property can have more data than just interrupt >>> number. >>> - single interrupt controller must be able to handle multiple >>> format of interrupt description. >>> >>> In pre-patchset era, simplebus enumerates children and attempts to set >>> memory and interrupts to resource list for them. But the interrupt >>> controllers are not yet populated so nobody can parse interrupt >>> property. Moreover, in all cases (parsed or not), we cannot store >>> complete interrupt description into resource list. >> >> We have done this for many years on PowerPC and sparc64 with delayed >> configuration of interrupts and a look-up table. This handles >> complicated bus configurations better than this code and requires no >> changes outside of a few MD files. That is why the (now partially >> duplicated) OFW_BUS_MAP_INTR() function exists. That one also has the >> benefit of still working when used in conjunction with, e.g., devices >> with an interrupt-map-mask property. >> >>> >>> The patch simply postpones reading of interrupt property to >>> bus_alloc_resource() (called by consumer driver) time. >>> >>> Due to this, we can: >>> - parse interrupt property. The interrupt driver must exist >>> at this time. >> >> This only works with some types of interrupt properties, not all, and >> breaks if the interrupt driver hasn't attached yet (which it can't be >> guaranteed to -- some PPC systems have interrupt drivers that live on >> the PCI bus, for example). > How you can allocate (and reserve it in rman) interrupt if is not > mapped (so you have not real IRQ number for it). Just for notice - > multiple virtual IRQs can be mapped into single real IRQ. The core idea is to think of the full interrupt specifier -- the interrupt parent and the full byte string in the device tree -- as the IRQ rather than the interrupt pin on some chip (which is usually, but not always, the first word in that byte string). The "virtual" IRQ number is just a compression of that longer piece of data, which usually can't fit in an rman resource. There is no need to actually activate those interrupts before interrupts are enabled, so you can just cache them in a table until the end of device probing, which lets you break circular dependency loops between bus and interrupt topology. So long as you keep track of your mapping and the same (parent, interrupt specifier) parent always gives the same virtual IRQ, there is no way in this system to map multiple active IRQs onto a single interrupt pin on the PIC unless your device tree is broken and specifies two devices with incompatible modes (active high and edge downgoing or something) on the same pin. In this case, nothing you can do will save you -- unless your PIC supports interrupts for different kinds of events, in which case this system will work perfectly by treating them as different interrupts to the kernel for which the fact they are on the same pin is immaterial. I should note that ARM and MIPS have an almost complete implementation of this already: maybe some more intr_machdep.c logic is needed for some cases, but all the rest of the plumbing is there. > >> >>> - bus_alloc_resource() returns resource, so we can attach parsed >>> interrupt data to it. By this, the resource itself can be used >>> for delivering configuration data to subsequent call to >>> bus_setup_intr() (or to all related bus_() calls). >>> >>> >>> The patched code still accepts delivering of interrupts in resource >>> list. >>> >>> Michal >>> >> >> Given that other code depends on this, fixing it will likely require >> some complex work. I wish I had known about it when it went in. >> >> There are three main problems: >> 1. It doesn't work for interrupts defined by other mechanisms (e.g. >> interrupt-map properties) > I aggree, but missing ' interrupt-map' functioanlity is not caused by > this patch. It is in that the standard system already implements it completely. > >> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >> but is both problematically more general and less flexible (it has >> requirements on timing of PIC attachment vs. driver resource allocation) > OFW_BUS_MAP_INTR() can parse only OFW based data and expect that > parsed data are magicaly stored within the call. > The new method, bus_map_intr(), can parse data from multiple sources > (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also > returns parsed data back to caller. That is not true. It works as long as you can specify the interrupt state as a 32-bit key of some kind for the PIC and a string of arbitrary data, which works with all of those. You could even make the interrupt data be a pointer to exactly the structs you have chosen to define here. > And no, it doesn't add any additional timing requirements . As far as I can tell, it requires the interrupt controller to be attached before you can allocate interrupts. Is that not true? > >> 3. It is not fully transparent to end code. Since it happens at >> bus_alloc_resource() time, it is complicated to get the appropriate >> values for IRQs constructed by composite techniques (interrupt-map >> vs. interrupts vs. hand allocation vs. PCI routing, for example). > I don't see any limitation - can you be more exact? Why is not > transparent? Why is more complicated ? Suppose that a PCI device adds more IRQs to its resource list or modifies the ordering. How is whatever bus layer supposed to do something sensible at allocation time? It requires that RID numbers mean something to the parent bus after assignment, which is not guaranteed by anything and is, in more than handful of cases I think of, not true in practice. >> It is much easier to do this correctly at bus attach time when the >> resource lists are made (how PPC does it). >> > I don't agree. I don't agree. Making this at bus attach time leads > into complicated 'virtual' IRQ infrastructure, with many unresolved > corner cases. Which unresolved corner cases? This has been working correctly on a number of platforms in both FreeBSD and Linux for many years. > >> (1) is easy to fix without API changes, but (2) and (3) are >> fundamental architectural problems that will bite us immediately down >> the road and cause a permanent schism between OF support on different >> platforms. >> >> Let me describe how this is handled on PowerPC (Linux on PPC solves >> the problem the same way). When constructing a resource list, bus >> drivers that construct them from OF properties call >> ofw_bus_map_intr() with the interrupt parent phandle and the array of >> cells corresponding to the interrupt. This thunks immediately to >> nexus, which connects to code in intr_machdep.c. Code there assigns a >> unique made-up virtual IRQ and returns it, caching the interrupt >> parent ID and opaque interrupt data (if the same string of data >> reappears later, you get back the same virtual IRQ of course). >> >> When PIC drivers attach and register themselves with the interrupt >> handling layer, all the interrupts for that PIC are passed to it >> along with the virtual IRQ. The PIC driver is supposed to know what >> its interrupt data mean, which can be safely guaranteed, and it >> presents the assigned virtual IRQ number to the kernel when >> dispatching interrupts. (IRQs configured after PIC attachment are >> passed through immediately). >> >> This accomplishes the following things: >> 1. Parsing interrupt data is moved to the PIC driver, which is the >> only place it can be done safely. > I don't see anything different comparing with INTRNG. What I am advocating *is* INTRNG, at least as originally conceived and implemented. >> 2. There is no ordering requirement on PIC attachment vs. the >> attachment of anything else. > I think thats is not a true - PIC must exist before > bus_alloc_resource() / bus_setup_intr() is called. It does not with the IRQ mapping infrastructure. Interrupts are set up at PIC attachment, whenever that occurs. > >> 3. Changes are extremely minimal relative to the "standard" interrupt >> flow: you only have to patch code that is already directly dealing >> with OF interrupts. > I don't see anything different comparing with INTRNG. Again, this was the original INTRNG architecture and is already implemented. As such, there are *no* changes required on ARM to get it. bus_map_intr() adds a bunch of new code, in parallel with the old code that also solves the problem, to no purpose. >> 4. It happens at bus enumeration time, when results can be guaranteed >> self-consistent. > Where do you see any potential source of inconsistency in INTRNG? See the example above about modified interrupt lists. There is also no obvious way for a child device to construct an interrupt not assigned to it by the parent device from device tree properties without knowing in some detail what kind of interrupt needs to be built. > >> 5. It combines naturally with ofw_bus_lookup_imap() and friends in >> the interrupt-map case (e.g. for PCI). > Again, I don't see anything different. Proper parsing of interrupt > property is not a problem of INTRNG (but must be fixed, of course). But it is *already* fixed by the standard code that already exists. You are introducing a less-functional parallel code path here. >> >> I'm not sure what the right path forward is, but this code needs to >> be fixed. The PowerPC code is fully MI, and was the template for the >> original INTRNG, so it shouldn't be too bad to replace. >> -Nathan >> > > So, new INTRNG: > - Introduces new more general bus method that can parse interrupt > configuration > data from any source. Is this step backward? Yes, since it is more general in some sense, while simultaneously handling fewer cases than code that already exists and is implemented. > > - Old INTRNG and PPC code stores unparsed and/or parsed interrupt data in > INTRNG and each consumer must query for them. This data sharing also > causes > significant locking issues. New INTRNG stores interrupt > configuration data into > given resource, so each relevant bus method can access it immediately. > Is this step backward? Which locking issues? And yes, it is. > > - New INTRNG is not OFW centric, it can works with virtually unlimited > number > of configuration data sources. Is this step backward? Also yes, because it makes the interrupt handles less opaque, which makes the infrastructure less flexible. > - New INTRNG correctly uses standard system infrastructure. Real IRQ > number > is reserved in rman within bus_alloc_resource() call, interrupt HW is > configured (only!) within bus_setup_intr() call. Is this step > backward? The "real" IRQ number is not well defined always, so requiring that is a step backwards, yes. > - New INTRNG completely eliminates huge and not always working virtual > IRQ concept. When does it "not always work"? It seems to, in fact, always work on multiple platforms and have for a long time in the face of all kinds of totally bizarre topologies and system architectures. > > > Don’t take me bad, I’m open to any change. But no, at this time, I’m > not ready to completely revert someone else's work – although I am a > co-author. I would urge, in the strongest possible terms, that this be backed out from stable/11 at least. We can add the new API back for 11.1 if we want it, but we totally lose the ability to change it later in the stable/11 cycle if it stays in now. -Nathan > > Michal > > From owner-svn-src-head@freebsd.org Wed Jul 20 15:59: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 19DCCB9EEBB; Wed, 20 Jul 2016 15:59:39 +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 DD8E21C4A; Wed, 20 Jul 2016 15:59:38 +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 u6KFxcdD088595; Wed, 20 Jul 2016 15:59:38 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KFxck2088594; Wed, 20 Jul 2016 15:59:38 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607201559.u6KFxck2088594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 20 Jul 2016 15:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303094 - head/usr.bin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 15:59:39 -0000 Author: ache Date: Wed Jul 20 15:59:37 2016 New Revision: 303094 URL: https://svnweb.freebsd.org/changeset/base/303094 Log: Continuation lines with comments badly affects gprof, it is excluded from build on amd64 f.e. Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Wed Jul 20 15:07:52 2016 (r303093) +++ head/usr.bin/Makefile Wed Jul 20 15:59:37 2016 (r303094) @@ -270,8 +270,9 @@ SUBDIR.${MK_TOOLCHAIN}+= ctags SUBDIR.${MK_TOOLCHAIN}+= cxxfilt SUBDIR.${MK_TOOLCHAIN}+= elfcopy SUBDIR.${MK_TOOLCHAIN}+= file2c -.if ${MACHINE_ARCH} != "aarch64" && \ # ARM64TODO gprof does not build - ${MACHINE_CPUARCH} != "riscv" # RISCVTODO gprof does not build +# ARM64TODO gprof does not build +# RISCVTODO gprof does not build +.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_CPUARCH} != "riscv" SUBDIR.${MK_TOOLCHAIN}+= gprof .endif SUBDIR.${MK_TOOLCHAIN}+= indent From owner-svn-src-head@freebsd.org Wed Jul 20 16:35: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 502C3B9F673; Wed, 20 Jul 2016 16:35:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B3201ECD; Wed, 20 Jul 2016 16:35:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u6KGZ114005033 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 20 Jul 2016 09:35:01 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u6KGZ1Ne005032; Wed, 20 Jul 2016 09:35:01 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 20 Jul 2016 09:35:01 -0700 From: Gleb Smirnoff To: Randall Stewart Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303037 - head/sys/kern Message-ID: <20160720163501.GY1076@FreeBSD.org> References: <201607191831.u6JIVJWq007542@repo.freebsd.org> <20160720065335.GU1076@FreeBSD.org> <1CA02E0F-6871-4291-9F5A-20EFF5F6315D@netflix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1CA02E0F-6871-4291-9F5A-20EFF5F6315D@netflix.com> 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: Wed, 20 Jul 2016 16:35:03 -0000 Randall, I have just tested and r303037 brings the TCP panic back. I got two crashes during 2.5 hours. In your email [1] you are right, there is regression that (-1) return value is lost. This problem was worked on in the PR 210884, and we were very close to commiting the fix. The whole 11.0-RELEASE cycle strongly depends on this change. We don't want to release with TCP panic, and of course we want the regression described in 210884 to be fixed. Your backout mixed with extra code really made things messy. Since I don't want to go with commit war, on behalf of RE we are asking for explicit agreement to back out r303037. Then we will proceed with latest patch from 210884. Is that okay? [1] https://lists.freebsd.org/pipermail/svn-src-head/2016-July/089313.html On Wed, Jul 20, 2016 at 03:33:37PM +0200, Randall Stewart wrote: R> Gleb R> R> I wish you would have responded earlier.. I am more than glad to hand R> off all kern_timeout.c to you… please take it commit what you want to R> it and have it. I hate the code and I dislike having to touch it. R> R> Its yours.. I can assure you I will not touch it again. R> R> R R> > On Jul 20, 2016, at 8:53 AM, Gleb Smirnoff wrote: R> > R> > On Tue, Jul 19, 2016 at 06:31:19PM +0000, Randall Stewart wrote: R> > R> Author: rrs R> > R> Date: Tue Jul 19 18:31:19 2016 R> > R> New Revision: 303037 R> > R> URL: https://svnweb.freebsd.org/changeset/base/303037 R> > R> R> > R> Log: R> > R> This reverts out Gleb's changes and adds three small R> > R> fixes that I think closes up the races Gleb was R> > R> looking for. This is running quite nicely in Netflix and R> > R> now no longer causes TCP-tcb leaks. R> > R> R> > R> Differential Revision: 7135 R> > R> > Just to notice that I am completely pissed of by this commit R> > war, that you started. R> > R> > I've been testing my changes properly, I gave people time to R> > review my changes. You didn't. R> > R> > From your explanation in other emails I see that you've been R> > testing your changes with a version of FreeBSD that is a heavily R> > modified FreeBSD 10, not 11. R> > R> > The new code you mixed with revert of mine, doesn't fix the R> > problem observed. It fixes another problem that you imagined, R> > which might exist, but isn't observed. We already discussed that R> > and you didn't prove it wrong. R> > R> > Your change doesn't even revert my change completely. R> > R> > -- R> > Totus tuus, Glebius. R> R> -------- R> Randall Stewart R> rrs@netflix.com R> 803-317-4952 R> R> R> R> R> R> -- Totus tuus, Glebius. From owner-svn-src-head@freebsd.org Wed Jul 20 16:37: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 F04D1B9F770 for ; Wed, 20 Jul 2016 16:37:01 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-pf0-x234.google.com (mail-pf0-x234.google.com [IPv6:2607:f8b0:400e:c00::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 C134A1348 for ; Wed, 20 Jul 2016 16:37:01 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-pf0-x234.google.com with SMTP id h186so20705026pfg.3 for ; Wed, 20 Jul 2016 09:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=q5XRxHZpy2RFa0Rbfu+aNlEGQEzcjwb2VL/U05U4DuA=; b=EBuhp8k5EUwj4I60OR5gA41emdOLMCG9Wh/45RgwrZFfytxXlskRB25IuFX7M4/6CK 8VZckhuFzFY37lfXbEWFRSZ5S3rzcmZzS/4MfZB4gIaM3SX2O3KPlXxLFBr4pNdlcB8C nddbEhb0dmbr+UclufQHkqnwxO+t7kEikFqDk= 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=q5XRxHZpy2RFa0Rbfu+aNlEGQEzcjwb2VL/U05U4DuA=; b=SV4G4JrjFc/h4lv4kgjIK2APcMItVX+XcPSZBwMeCn036tUpBt/NQJfvskezkuVPKD /250bo3idEg+zKClVXF/+saX34RwxnlKUJE659ktrAMp9iqeSne/oHj1cgzdEaSp4mlm //T/S8GqF2SdoeM4e8rGn/dAL08sQEfWD+DE5I45QR2bqv72bv1EcjxLdVhT7Z4bdJb7 I0vkio3UD6w1KcAs21NyYFvr93qVPuobpCifqrK9eqjPAyIOh2cNK1yKe1z8DGhmvNzf OOM93+S5MC/puUyIYhEbTwZFZTwrHCewcZclBmnh/pl7iqv9jJMx2lZnxXtt7fE2MmlP wvFg== X-Gm-Message-State: ALyK8tIxQi8HppXsQP2MD7Iyw/gDr6fT+EseBS6A/h+8WjyK2MXITO9Bgce78AiYRnnsnq+z X-Received: by 10.98.77.65 with SMTP id a62mr66104464pfb.128.1469032620968; Wed, 20 Jul 2016 09:37:00 -0700 (PDT) Received: from [100.127.67.9] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id n5sm5867740pai.11.2016.07.20.09.36.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 09:37:00 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r303037 - head/sys/kern From: Randall Stewart In-Reply-To: <20160720163501.GY1076@FreeBSD.org> Date: Wed, 20 Jul 2016 18:36:55 +0200 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6135F2B2-6543-4A06-92D3-5BC7F75ED320@netflix.com> References: <201607191831.u6JIVJWq007542@repo.freebsd.org> <20160720065335.GU1076@FreeBSD.org> <1CA02E0F-6871-4291-9F5A-20EFF5F6315D@netflix.com> <20160720163501.GY1076@FreeBSD.org> To: Gleb Smirnoff 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, 20 Jul 2016 16:37:02 -0000 You are most welcome to backout anything you like.. as far as I am concerned you own the code.. R > On Jul 20, 2016, at 6:35 PM, Gleb Smirnoff = wrote: >=20 > Randall, >=20 > I have just tested and r303037 brings the TCP panic back. I > got two crashes during 2.5 hours. >=20 > In your email [1] you are right, there is regression that (-1) > return value is lost. This problem was worked on in the PR 210884, > and we were very close to commiting the fix. >=20 > The whole 11.0-RELEASE cycle strongly depends on this change. We > don't want to release with TCP panic, and of course we want the > regression described in 210884 to be fixed. >=20 > Your backout mixed with extra code really made things messy. Since > I don't want to go with commit war, on behalf of RE we are asking > for explicit agreement to back out r303037. Then we will proceed with > latest patch from 210884. Is that okay? >=20 > [1] = https://lists.freebsd.org/pipermail/svn-src-head/2016-July/089313.html >=20 > On Wed, Jul 20, 2016 at 03:33:37PM +0200, Randall Stewart wrote: > R> Gleb > R>=20 > R> I wish you would have responded earlier.. I am more than glad to = hand > R> off all kern_timeout.c to you=E2=80=A6 please take it commit what = you want to > R> it and have it. I hate the code and I dislike having to touch it. > R>=20 > R> Its yours.. I can assure you I will not touch it again. > R>=20 > R> R > R> > On Jul 20, 2016, at 8:53 AM, Gleb Smirnoff = wrote: > R> >=20 > R> > On Tue, Jul 19, 2016 at 06:31:19PM +0000, Randall Stewart wrote: > R> > R> Author: rrs > R> > R> Date: Tue Jul 19 18:31:19 2016 > R> > R> New Revision: 303037 > R> > R> URL: https://svnweb.freebsd.org/changeset/base/303037 > R> > R>=20 > R> > R> Log: > R> > R> This reverts out Gleb's changes and adds three small > R> > R> fixes that I think closes up the races Gleb was > R> > R> looking for. This is running quite nicely in Netflix and > R> > R> now no longer causes TCP-tcb leaks. > R> > R> =20 > R> > R> Differential Revision: 7135 > R> >=20 > R> > Just to notice that I am completely pissed of by this commit > R> > war, that you started. > R> >=20 > R> > I've been testing my changes properly, I gave people time to > R> > review my changes. You didn't. > R> >=20 > R> > =46rom your explanation in other emails I see that you've been > R> > testing your changes with a version of FreeBSD that is a heavily > R> > modified FreeBSD 10, not 11. > R> >=20 > R> > The new code you mixed with revert of mine, doesn't fix the > R> > problem observed. It fixes another problem that you imagined, > R> > which might exist, but isn't observed. We already discussed that > R> > and you didn't prove it wrong. > R> >=20 > R> > Your change doesn't even revert my change completely. > R> >=20 > R> > --=20 > R> > Totus tuus, Glebius. > R>=20 > R> -------- > R> Randall Stewart > R> rrs@netflix.com > R> 803-317-4952 > R>=20 > R>=20 > R>=20 > R>=20 > R>=20 > R>=20 >=20 > --=20 > Totus tuus, Glebius. -------- Randall Stewart rrs@netflix.com 803-317-4952 From owner-svn-src-head@freebsd.org Wed Jul 20 16:43: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 5C23AB9F923; Wed, 20 Jul 2016 16:43:08 +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 23523182F; Wed, 20 Jul 2016 16:43:07 +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 03F411FE024; Wed, 20 Jul 2016 18:43:04 +0200 (CEST) Subject: Re: svn commit: r303037 - head/sys/kern To: Gleb Smirnoff , Randall Stewart References: <201607191831.u6JIVJWq007542@repo.freebsd.org> <20160720065335.GU1076@FreeBSD.org> <1CA02E0F-6871-4291-9F5A-20EFF5F6315D@netflix.com> <20160720163501.GY1076@FreeBSD.org> Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <959a352e-f7a7-b578-2aaa-ab99281b6666@selasky.org> Date: Wed, 20 Jul 2016 18:47:06 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20160720163501.GY1076@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: Wed, 20 Jul 2016 16:43:08 -0000 On 07/20/16 18:35, Gleb Smirnoff wrote: > Randall, > > I have just tested and r303037 brings the TCP panic back. I > got two crashes during 2.5 hours. Hi Gleb, There is more than one way to fix the TCP panic. You don't _need_ to change the return values of callout_stop(). You _can_ make a new function for this, which doesn't cause problems in case anyone out there is depending on the current callout_stop() behaviour. > In your email [1] you are right, there is regression that (-1) > return value is lost. This problem was worked on in the PR 210884, > and we were very close to commiting the fix. > > The whole 11.0-RELEASE cycle strongly depends on this change. We > don't want to release with TCP panic, and of course we want the > regression described in 210884 to be fixed. > > Your backout mixed with extra code really made things messy. Since > I don't want to go with commit war, on behalf of RE we are asking > for explicit agreement to back out r303037. Then we will proceed with > latest patch from 210884. Is that okay? I think Randall is right trying to preserve the callout API. My wish Gleb, is that you add a new function to handle the new behaviour. > > [1] https://lists.freebsd.org/pipermail/svn-src-head/2016-July/089313.html > --HPS From owner-svn-src-head@freebsd.org Wed Jul 20 16:44: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 C0392B9F98E; Wed, 20 Jul 2016 16:44:23 +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 94C7D1A12; Wed, 20 Jul 2016 16:44:23 +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 u6KGiMEc007024; Wed, 20 Jul 2016 16:44:22 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KGiM3e007023; Wed, 20 Jul 2016 16:44:22 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201607201644.u6KGiM3e007023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 20 Jul 2016 16:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303096 - 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: Wed, 20 Jul 2016 16:44:23 -0000 Author: glebius Date: Wed Jul 20 16:44:22 2016 New Revision: 303096 URL: https://svnweb.freebsd.org/changeset/base/303096 Log: Revert r303037. It re-introduces the panic with TCP timers. Agreed by: rrs, re (gjb) Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Wed Jul 20 16:36:17 2016 (r303095) +++ head/sys/kern/kern_timeout.c Wed Jul 20 16:44:22 2016 (r303096) @@ -1050,7 +1050,7 @@ callout_reset_sbt_on(struct callout *c, */ if (c->c_lock != NULL && !cc_exec_cancel(cc, direct)) cancelled = cc_exec_cancel(cc, direct) = true; - if (cc_exec_waiting(cc, direct) || cc_exec_drain(cc, direct)) { + if (cc_exec_waiting(cc, direct)) { /* * Someone has called callout_drain to kill this * callout. Don't reschedule. @@ -1166,7 +1166,7 @@ _callout_stop_safe(struct callout *c, in struct callout_cpu *cc, *old_cc; struct lock_class *class; int direct, sq_locked, use_lock; - int not_on_a_list; + int cancelled, not_on_a_list; if ((flags & CS_DRAIN) != 0) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock, @@ -1234,47 +1234,17 @@ again: panic("migration should not happen"); #endif } - if ((drain != NULL) && (c->c_iflags & CALLOUT_PENDING) && - (cc_exec_curr(cc, direct) != c)) { - /* - * This callout is executing and we are draining. - * The only way this can happen is if its also - * been rescheduled to run on one thread *and* asked to drain - * on this thread (at the same time it is waiting to execute). - */ - if ((c->c_iflags & CALLOUT_PROCESSED) == 0) { - if (cc_exec_next(cc) == c) - cc_exec_next(cc) = LIST_NEXT(c, c_links.le); - LIST_REMOVE(c, c_links.le); - } else { - TAILQ_REMOVE(&cc->cc_expireq, c, c_links.tqe); - } - c->c_iflags &= ~CALLOUT_PENDING; - c->c_flags &= ~CALLOUT_ACTIVE; - } + /* - * If the callout isn't pending, it's not on the queue, so - * don't attempt to remove it from the queue. We can try to - * stop it by other means however. + * If the callout is running, try to stop it or drain it. */ - if (!(c->c_iflags & CALLOUT_PENDING)) { + if (cc_exec_curr(cc, direct) == c) { /* - * If it wasn't on the queue and it isn't the current - * callout, then we can't stop it, so just bail. - * It probably has already been run (if locking - * is properly done). You could get here if the caller - * calls stop twice in a row for example. The second - * call would fall here without CALLOUT_ACTIVE set. + * Succeed we to stop it or not, we must clear the + * active flag - this is what API users expect. */ c->c_flags &= ~CALLOUT_ACTIVE; - if (cc_exec_curr(cc, direct) != c) { - CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", - c, c->c_func, c->c_arg); - CC_UNLOCK(cc); - if (sq_locked) - sleepq_release(&cc_exec_waiting(cc, direct)); - return (-1); - } + if ((flags & CS_DRAIN) != 0) { /* * The current callout is running (or just @@ -1308,6 +1278,7 @@ again: old_cc = cc; goto again; } + /* * Migration could be cancelled here, but * as long as it is still not sure when it @@ -1391,8 +1362,6 @@ again: cc_exec_drain(cc, direct) = drain; } CC_UNLOCK(cc); - if (drain) - return(0); return ((flags & CS_EXECUTING) != 0); } CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", @@ -1400,13 +1369,21 @@ again: if (drain) { cc_exec_drain(cc, direct) = drain; } - CC_UNLOCK(cc); KASSERT(!sq_locked, ("sleepqueue chain still locked")); - return (0); - } + cancelled = ((flags & CS_EXECUTING) != 0); + } else + cancelled = 1; + if (sq_locked) sleepq_release(&cc_exec_waiting(cc, direct)); + if ((c->c_iflags & CALLOUT_PENDING) == 0) { + CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", + c, c->c_func, c->c_arg); + CC_UNLOCK(cc); + return (0); + } + c->c_iflags &= ~CALLOUT_PENDING; c->c_flags &= ~CALLOUT_ACTIVE; @@ -1423,7 +1400,7 @@ again: } callout_cc_del(c, cc); CC_UNLOCK(cc); - return (1); + return (cancelled); } void @@ -1638,6 +1615,7 @@ SYSCTL_PROC(_kern, OID_AUTO, callout_sta CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_callout_stat, "I", "Dump immediate statistic snapshot of the scheduled callouts"); + #ifdef DDB static void _show_callout(struct callout *c) From owner-svn-src-head@freebsd.org Wed Jul 20 16:46: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 4353CB9FA3A; Wed, 20 Jul 2016 16:46:15 +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 0D1501BCE; Wed, 20 Jul 2016 16:46:14 +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 u6KGkElh007146; Wed, 20 Jul 2016 16:46:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KGkEt4007145; Wed, 20 Jul 2016 16:46:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201607201646.u6KGkEt4007145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Wed, 20 Jul 2016 16:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303097 - 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: Wed, 20 Jul 2016 16:46:15 -0000 Author: nwhitehorn Date: Wed Jul 20 16:46:13 2016 New Revision: 303097 URL: https://svnweb.freebsd.org/changeset/base/303097 Log: Add myself to MAINTAINERS. Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Wed Jul 20 16:44:22 2016 (r303096) +++ head/MAINTAINERS Wed Jul 20 16:46:13 2016 (r303097) @@ -105,3 +105,4 @@ vmm(4) neel,grehan Pre-commit review re autofs(5) trasz Pre-commit review recommended. iscsi(4) trasz Pre-commit review recommended. rctl(8) trasz Pre-commit review recommended. +sys/dev/ofw nwhitehorn Pre-commit review recommended. From owner-svn-src-head@freebsd.org Wed Jul 20 16:48: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 16952B9FB0A; Wed, 20 Jul 2016 16:48:27 +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 DDA091D9B; Wed, 20 Jul 2016 16:48:26 +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 u6KGmQVu007254; Wed, 20 Jul 2016 16:48:26 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KGmQPs007253; Wed, 20 Jul 2016 16:48:26 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201607201648.u6KGmQPs007253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 20 Jul 2016 16:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303098 - 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: Wed, 20 Jul 2016 16:48:27 -0000 Author: glebius Date: Wed Jul 20 16:48:25 2016 New Revision: 303098 URL: https://svnweb.freebsd.org/changeset/base/303098 Log: Redo the r302894: the very new value for a non-scheduled callout is -1. This was recently added in r290664. Noticed by: hselasky Tested by: Larry Rosenman PR: 210884 Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Wed Jul 20 16:46:13 2016 (r303097) +++ head/sys/kern/kern_timeout.c Wed Jul 20 16:48:25 2016 (r303098) @@ -1380,8 +1380,14 @@ again: if ((c->c_iflags & CALLOUT_PENDING) == 0) { CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", c, c->c_func, c->c_arg); + /* + * For not scheduled and not executing callout return + * negative value. + */ + if (cc_exec_curr(cc, direct) != c) + cancelled = -1; CC_UNLOCK(cc); - return (0); + return (cancelled); } c->c_iflags &= ~CALLOUT_PENDING; From owner-svn-src-head@freebsd.org Wed Jul 20 16:59: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 69CC4B9FE18; Wed, 20 Jul 2016 16:59:37 +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 2F30C15AC; Wed, 20 Jul 2016 16:59:37 +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 u6KGxa89010930; Wed, 20 Jul 2016 16:59:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KGxaNs010929; Wed, 20 Jul 2016 16:59:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607201659.u6KGxaNs010929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Jul 2016 16:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303099 - 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: Wed, 20 Jul 2016 16:59:37 -0000 Author: cem Date: Wed Jul 20 16:59:36 2016 New Revision: 303099 URL: https://svnweb.freebsd.org/changeset/base/303099 Log: Extend ELF coredump to support more than 65535 segments The ELF e_phnum field is only 16 bits wide. To support more than 65535 segments (program headers), Sun's "Linker and Libraries Guide" table 7-7 (or 12-7, depending on document version) prescribes a special first section header where sh_info represents the real number of program headers. Test code to follow, when it is ready. Reference: http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf Reviewed by: emaste, markj Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7255 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed Jul 20 16:48:25 2016 (r303098) +++ head/sys/kern/imgact_elf.c Wed Jul 20 16:59:36 2016 (r303099) @@ -1323,6 +1323,8 @@ __elfN(coredump)(struct thread *td, stru * Collect info about the core file header area. */ hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count); + if (seginfo.count + 1 >= PN_XNUM) + hdrsize += sizeof(Elf_Shdr); __elfN(prepare_notes)(td, ¬elst, ¬esz); coresize = round_page(hdrsize + notesz) + seginfo.size; @@ -1618,10 +1620,10 @@ __elfN(puthdr)(struct thread *td, void * { Elf_Ehdr *ehdr; Elf_Phdr *phdr; + Elf_Shdr *shdr; struct phdr_closure phc; ehdr = (Elf_Ehdr *)hdr; - phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); ehdr->e_ident[EI_MAG0] = ELFMAG0; ehdr->e_ident[EI_MAG1] = ELFMAG1; @@ -1645,14 +1647,43 @@ __elfN(puthdr)(struct thread *td, void * ehdr->e_flags = 0; ehdr->e_ehsize = sizeof(Elf_Ehdr); ehdr->e_phentsize = sizeof(Elf_Phdr); - ehdr->e_phnum = numsegs + 1; ehdr->e_shentsize = sizeof(Elf_Shdr); - ehdr->e_shnum = 0; ehdr->e_shstrndx = SHN_UNDEF; + if (numsegs + 1 < PN_XNUM) { + ehdr->e_phnum = numsegs + 1; + ehdr->e_shnum = 0; + } else { + ehdr->e_phnum = PN_XNUM; + ehdr->e_shnum = 1; + + ehdr->e_shoff = ehdr->e_phoff + + (numsegs + 1) * ehdr->e_phentsize; + KASSERT(ehdr->e_shoff == hdrsize - sizeof(Elf_Shdr), + ("e_shoff: %zu, hdrsize - shdr: %zu", + ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); + + shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); + memset(shdr, 0, sizeof(*shdr)); + /* + * A special first section is used to hold large segment and + * section counts. This was proposed by Sun Microsystems in + * Solaris and has been adopted by Linux; the standard ELF + * tools are already familiar with the technique. + * + * See table 7-7 of the Solaris "Linker and Libraries Guide" + * (or 12-7 depending on the version of the document) for more + * details. + */ + shdr->sh_type = SHT_NULL; + shdr->sh_size = ehdr->e_shnum; + shdr->sh_link = ehdr->e_shstrndx; + shdr->sh_info = numsegs + 1; + } /* * Fill in the program header entries. */ + phdr = (Elf_Phdr *)((char *)hdr + ehdr->e_phoff); /* The note segement. */ phdr->p_type = PT_NOTE; From owner-svn-src-head@freebsd.org Wed Jul 20 17: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 8046BB9F5A3; Wed, 20 Jul 2016 17:19: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 5C6F9130A; Wed, 20 Jul 2016 17:19: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 u6KHJle2018408; Wed, 20 Jul 2016 17:19:47 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KHJlRf018405; Wed, 20 Jul 2016 17:19:47 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607201719.u6KHJlRf018405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 20 Jul 2016 17:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303100 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 17:19:48 -0000 Author: andrew Date: Wed Jul 20 17:19:47 2016 New Revision: 303100 URL: https://svnweb.freebsd.org/changeset/base/303100 Log: We will be switching to a new arm64 uart cpu driver that handles both FDT and ACPI. As such pull out what will be the common parts of the FDT cpu detection to a new function that can be shared between them. Reviewed by: manu Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7262 Modified: head/sys/dev/uart/uart_bus_fdt.c head/sys/dev/uart/uart_cpu_fdt.c head/sys/dev/uart/uart_cpu_fdt.h Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Wed Jul 20 16:59:36 2016 (r303099) +++ head/sys/dev/uart/uart_bus_fdt.c Wed Jul 20 17:19:47 2016 (r303100) @@ -105,6 +105,129 @@ uart_fdt_find_device(device_t dev) } static int +phandle_chosen_propdev(phandle_t chosen, const char *name, phandle_t *node) +{ + char buf[64]; + + if (OF_getprop(chosen, name, buf, sizeof(buf)) <= 0) + return (ENXIO); + if ((*node = OF_finddevice(buf)) == -1) + return (ENXIO); + + return (0); +} + +static const struct ofw_compat_data * +uart_fdt_find_compatible(phandle_t node, const struct ofw_compat_data *cd) +{ + const struct ofw_compat_data *ocd; + + for (ocd = cd; ocd->ocd_str != NULL; ocd++) { + if (fdt_is_compatible(node, ocd->ocd_str)) + return (ocd); + } + return (NULL); +} + +static uintptr_t +uart_fdt_find_by_node(phandle_t node, int class_list) +{ + struct ofw_compat_data **cd; + const struct ofw_compat_data *ocd; + + if (class_list) { + SET_FOREACH(cd, uart_fdt_class_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } else { + SET_FOREACH(cd, uart_fdt_class_and_device_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } + + return (0); +} + +int +uart_cpu_fdt_probe(struct uart_class **classp, bus_space_tag_t *bst, + bus_space_handle_t *bsh, int *baud, u_int *rclk, u_int *shiftp) +{ + const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", + "stdin-path", "stdin", NULL}; + const char **name; + struct uart_class *class; + phandle_t node, chosen; + pcell_t br, clk, shift; + char *cp; + int err; + + /* Has the user forced a specific device node? */ + cp = kern_getenv("hw.fdt.console"); + if (cp == NULL) { + /* + * Retrieve /chosen/std{in,out}. + */ + node = -1; + if ((chosen = OF_finddevice("/chosen")) != -1) { + for (name = propnames; *name != NULL; name++) { + if (phandle_chosen_propdev(chosen, *name, + &node) == 0) + break; + } + } + if (chosen == -1 || *name == NULL) + node = OF_finddevice("serial0"); /* Last ditch */ + } else { + node = OF_finddevice(cp); + } + + if (node == -1) + return (ENXIO); + + /* + * Check old style of UART definition first. Unfortunately, the common + * FDT processing is not possible if we have clock, power domains and + * pinmux stuff. + */ + class = (struct uart_class *)uart_fdt_find_by_node(node, 0); + if (class != NULL) { + if ((err = uart_fdt_get_clock(node, &clk)) != 0) + return (err); + } else { + /* Check class only linker set */ + class = + (struct uart_class *)uart_fdt_find_by_node(node, 1); + if (class == NULL) + return (ENXIO); + clk = 0; + } + + /* + * Retrieve serial attributes. + */ + if (uart_fdt_get_shift(node, &shift) != 0) + shift = uart_getregshift(class); + + if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0) + br = 0; + + err = OF_decode_addr(node, 0, bst, bsh, NULL); + if (err != 0) + return (err); + + *classp = class; + *baud = br; + *rclk = clk; + *shiftp = shift; + + return (0); +} + +static int uart_fdt_probe(device_t dev) { struct uart_softc *sc; Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Wed Jul 20 16:59:36 2016 (r303099) +++ head/sys/dev/uart/uart_cpu_fdt.c Wed Jul 20 17:19:47 2016 (r303100) @@ -120,14 +120,11 @@ uart_fdt_find_by_node(phandle_t node, in int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { - const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", - "stdin-path", "stdin", NULL}; - const char **name; struct uart_class *class; - phandle_t node, chosen; - pcell_t shift, br, rclk; - char *cp; - int err; + bus_space_tag_t bst; + bus_space_handle_t bsh; + u_int shift, rclk; + int br, err; /* Allow overriding the FDT using the environment. */ class = &uart_ns8250_class; @@ -138,69 +135,24 @@ uart_cpu_getdev(int devtype, struct uart if (devtype != UART_DEV_CONSOLE) return (ENXIO); - /* Has the user forced a specific device node? */ - cp = kern_getenv("hw.fdt.console"); - if (cp == NULL) { - /* - * Retrieve /chosen/std{in,out}. - */ - node = -1; - if ((chosen = OF_finddevice("/chosen")) != -1) { - for (name = propnames; *name != NULL; name++) { - if (phandle_chosen_propdev(chosen, *name, - &node) == 0) - break; - } - } - if (chosen == -1 || *name == NULL) - node = OF_finddevice("serial0"); /* Last ditch */ - } else { - node = OF_finddevice(cp); - } - - if (node == -1) /* Can't find anything */ - return (ENXIO); - - /* - * Check old style of UART definition first. Unfortunately, the common - * FDT processing is not possible if we have clock, power domains and - * pinmux stuff. - */ - class = (struct uart_class *)uart_fdt_find_by_node(node, 0); - if (class != NULL) { - if ((err = uart_fdt_get_clock(node, &rclk)) != 0) - return (err); - } else { - /* Check class only linker set */ - class = - (struct uart_class *)uart_fdt_find_by_node(node, 1); - if (class == NULL) - return (ENXIO); - rclk = 0; - } - - /* - * Retrieve serial attributes. - */ - if (uart_fdt_get_shift(node, &shift) != 0) - shift = uart_getregshift(class); - - if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0) - br = 0; + err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, &shift); + if (err != 0) + return (err); /* * Finalize configuration. */ di->bas.chan = 0; - di->bas.regshft = (u_int)shift; + di->bas.regshft = shift; di->baudrate = br; - di->bas.rclk = (u_int)rclk; + di->bas.rclk = rclk; di->ops = uart_getops(class); di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; + di->bas.bst = bst; + di->bas.bsh = bsh; - err = OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL); uart_bus_space_mem = di->bas.bst; uart_bus_space_io = NULL; Modified: head/sys/dev/uart/uart_cpu_fdt.h ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.h Wed Jul 20 16:59:36 2016 (r303099) +++ head/sys/dev/uart/uart_cpu_fdt.h Wed Jul 20 17:19:47 2016 (r303100) @@ -50,6 +50,8 @@ SET_DECLARE(uart_fdt_class_set, struct o #define UART_FDT_CLASS(data) \ DATA_SET(uart_fdt_class_set, data) +int uart_cpu_fdt_probe(struct uart_class **, bus_space_tag_t *, + bus_space_handle_t *, int *, u_int *, u_int *); int uart_fdt_get_clock(phandle_t node, pcell_t *cell); int uart_fdt_get_shift(phandle_t node, pcell_t *cell); From owner-svn-src-head@freebsd.org Wed Jul 20 17:20: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 86B6DB9F60A; Wed, 20 Jul 2016 17:20:23 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59E4A14E5; Wed, 20 Jul 2016 17:20:23 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KHKMYh018496; Wed, 20 Jul 2016 17:20:22 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KHKMOZ018495; Wed, 20 Jul 2016 17:20:22 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201607201720.u6KHKMOZ018495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 20 Jul 2016 17:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303101 - 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: Wed, 20 Jul 2016 17:20:23 -0000 Author: alc Date: Wed Jul 20 17:20:22 2016 New Revision: 303101 URL: https://svnweb.freebsd.org/changeset/base/303101 Log: Add a comment describing the 'fast path' that was introduced in r270011. Reviewed by: kib MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Jul 20 17:19:47 2016 (r303100) +++ head/sys/vm/vm_fault.c Wed Jul 20 17:20:22 2016 (r303101) @@ -354,6 +354,15 @@ RetryFault:; KASSERT((fault_flags & VM_FAULT_WIRE) == 0, ("!wired && VM_FAULT_WIRE")); + /* + * Try to avoid lock contention on the top-level object through + * special-case handling of some types of page faults, specifically, + * those that are both (1) mapping an existing page from the top- + * level object and (2) not having to mark that object as containing + * dirty pages. Under these conditions, a read lock on the top-level + * object suffices, allowing multiple page faults of a similar type to + * run in parallel on the same top-level object. + */ if (fs.vp == NULL /* avoid locked vnode leak */ && (fault_flags & (VM_FAULT_WIRE | VM_FAULT_DIRTY)) == 0 && /* avoid calling vm_object_set_writeable_dirty() */ From owner-svn-src-head@freebsd.org Wed Jul 20 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 D6902B9F962; Wed, 20 Jul 2016 17:32:41 +0000 (UTC) (envelope-from ler@lerctr.org) Received: from thebighonker.lerctr.org (thebighonker.lerctr.org [IPv6:2001:470:1f0f:3ad:223:7dff:fe9e:6e8a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "thebighonker.lerctr.org", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4A5C1D52; Wed, 20 Jul 2016 17:32:41 +0000 (UTC) (envelope-from ler@lerctr.org) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lerctr.org; s=lerami; h=Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: Content-Transfer-Encoding:Content-Type:MIME-Version:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rEBFzUDNlHooGft/Adlxc7XXBz1X3KPkQgmmJSXClIo=; b=t5e4o5d9DV3ETCTBI3JnGkgzHI KNbsNRMr5RInKFdotskxuwYQKUP0kzIzzCU2VWw2jlia2TgiGc0OKAk3ppuWhRIAgeCKbxudqokB3 1niXWbxt6HKmZSPRXQifcdaDPLnzt0CEu8/TBLYQlzbuRUdVGg/0376AndisGaFb2f/A=; Received: from thebighonker.lerctr.org ([2001:470:1f0f:3ad:223:7dff:fe9e:6e8a]:21318 helo=webmail.lerctr.org) by thebighonker.lerctr.org with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1bPvMP-000DLl-4a; Wed, 20 Jul 2016 12:32:41 -0500 Received: from proxy.na.alcatel-lucent.com ([135.245.48.75]) by webmail.lerctr.org with HTTP (HTTP/1.1 POST); Wed, 20 Jul 2016 12:32:41 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 20 Jul 2016 12:32:41 -0500 From: Larry Rosenman To: "Conrad E. Meyer" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-svn-src-all@freebsd.org Subject: Re: svn commit: r303099 - head/sys/kern In-Reply-To: <201607201659.u6KGxaNs010929@repo.freebsd.org> References: <201607201659.u6KGxaNs010929@repo.freebsd.org> Message-ID: <7d98bc0deeedc54964b62911276c41cc@thebighonker.lerctr.org> X-Sender: ler@lerctr.org User-Agent: Roundcube Webmail/1.2.0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 17:32:42 -0000 This broke my build: --- imgact_elf32.o --- In file included from /usr/src/sys/kern/imgact_elf32.c:31: /usr/src/sys/kern/imgact_elf.c:1663:8: error: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'Elf32_Off' (aka 'unsigned int') [-Werror,-Wformat] ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); ^~~~~~~~~~~~~ /usr/src/sys/sys/systm.h:86:17: note: expanded from macro 'KASSERT' kassert_panic msg; \ ^~~ On 2016-07-20 11:59, Conrad E. Meyer wrote: > Author: cem > Date: Wed Jul 20 16:59:36 2016 > New Revision: 303099 > URL: https://svnweb.freebsd.org/changeset/base/303099 > > Log: > Extend ELF coredump to support more than 65535 segments > > The ELF e_phnum field is only 16 bits wide. To support more than > 65535 segments > (program headers), Sun's "Linker and Libraries Guide" table 7-7 (or > 12-7, > depending on document version) prescribes a special first section > header where > sh_info represents the real number of program headers. > > Test code to follow, when it is ready. > > Reference: http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf > > Reviewed by: emaste, markj > Sponsored by: EMC / Isilon Storage Division > Differential Revision: https://reviews.freebsd.org/D7255 > > Modified: > head/sys/kern/imgact_elf.c > > Modified: head/sys/kern/imgact_elf.c > ============================================================================== > --- head/sys/kern/imgact_elf.c Wed Jul 20 16:48:25 2016 (r303098) > +++ head/sys/kern/imgact_elf.c Wed Jul 20 16:59:36 2016 (r303099) > @@ -1323,6 +1323,8 @@ __elfN(coredump)(struct thread *td, stru > * Collect info about the core file header area. > */ > hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count); > + if (seginfo.count + 1 >= PN_XNUM) > + hdrsize += sizeof(Elf_Shdr); > __elfN(prepare_notes)(td, ¬elst, ¬esz); > coresize = round_page(hdrsize + notesz) + seginfo.size; > > @@ -1618,10 +1620,10 @@ __elfN(puthdr)(struct thread *td, void * > { > Elf_Ehdr *ehdr; > Elf_Phdr *phdr; > + Elf_Shdr *shdr; > struct phdr_closure phc; > > ehdr = (Elf_Ehdr *)hdr; > - phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); > > ehdr->e_ident[EI_MAG0] = ELFMAG0; > ehdr->e_ident[EI_MAG1] = ELFMAG1; > @@ -1645,14 +1647,43 @@ __elfN(puthdr)(struct thread *td, void * > ehdr->e_flags = 0; > ehdr->e_ehsize = sizeof(Elf_Ehdr); > ehdr->e_phentsize = sizeof(Elf_Phdr); > - ehdr->e_phnum = numsegs + 1; > ehdr->e_shentsize = sizeof(Elf_Shdr); > - ehdr->e_shnum = 0; > ehdr->e_shstrndx = SHN_UNDEF; > + if (numsegs + 1 < PN_XNUM) { > + ehdr->e_phnum = numsegs + 1; > + ehdr->e_shnum = 0; > + } else { > + ehdr->e_phnum = PN_XNUM; > + ehdr->e_shnum = 1; > + > + ehdr->e_shoff = ehdr->e_phoff + > + (numsegs + 1) * ehdr->e_phentsize; > + KASSERT(ehdr->e_shoff == hdrsize - sizeof(Elf_Shdr), > + ("e_shoff: %zu, hdrsize - shdr: %zu", > + ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); > + > + shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); > + memset(shdr, 0, sizeof(*shdr)); > + /* > + * A special first section is used to hold large segment and > + * section counts. This was proposed by Sun Microsystems in > + * Solaris and has been adopted by Linux; the standard ELF > + * tools are already familiar with the technique. > + * > + * See table 7-7 of the Solaris "Linker and Libraries Guide" > + * (or 12-7 depending on the version of the document) for more > + * details. > + */ > + shdr->sh_type = SHT_NULL; > + shdr->sh_size = ehdr->e_shnum; > + shdr->sh_link = ehdr->e_shstrndx; > + shdr->sh_info = numsegs + 1; > + } > > /* > * Fill in the program header entries. > */ > + phdr = (Elf_Phdr *)((char *)hdr + ehdr->e_phoff); > > /* The note segement. */ > phdr->p_type = PT_NOTE; > _______________________________________________ > 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" -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 214-642-9640 E-Mail: ler@lerctr.org US Mail: 17716 Limpia Crk, Round Rock, TX 78664-7281 From owner-svn-src-head@freebsd.org Wed Jul 20 17:46: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 52462B9FD04; Wed, 20 Jul 2016 17:46:34 +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 2527815FE; Wed, 20 Jul 2016 17:46:34 +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 u6KHkXYf029225; Wed, 20 Jul 2016 17:46:33 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KHkXoW029224; Wed, 20 Jul 2016 17:46:33 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607201746.u6KHkXoW029224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 20 Jul 2016 17:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303102 - 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: Wed, 20 Jul 2016 17:46:34 -0000 Author: andrew Date: Wed Jul 20 17:46:33 2016 New Revision: 303102 URL: https://svnweb.freebsd.org/changeset/base/303102 Log: Mark the Designware MMC and USB OTG drivers as FDT only. These are normally found on arm64 devices that use FDT. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Jul 20 17:20:22 2016 (r303101) +++ head/sys/conf/files.arm64 Wed Jul 20 17:46:33 2016 (r303102) @@ -59,8 +59,8 @@ dev/acpica/acpi_if.m optional acpi dev/ahci/ahci_generic.c optional ahci fdt dev/hwpmc/hwpmc_arm64.c optional hwpmc dev/hwpmc/hwpmc_arm64_md.c optional hwpmc -dev/mmc/host/dwmmc.c optional dwmmc -dev/mmc/host/dwmmc_hisi.c optional dwmmc soc_hisi_hi6220 +dev/mmc/host/dwmmc.c optional dwmmc fdt +dev/mmc/host/dwmmc_hisi.c optional dwmmc fdt soc_hisi_hi6220 dev/ofw/ofw_cpu.c optional fdt dev/ofw/ofwpci.c optional fdt pci dev/pci/pci_host_generic.c optional pci fdt @@ -68,7 +68,7 @@ dev/psci/psci.c optional psci dev/psci/psci_arm64.S optional psci dev/uart/uart_cpu_fdt.c optional uart fdt dev/uart/uart_dev_pl011.c optional uart pl011 -dev/usb/controller/dwc_otg_hisi.c optional dwcotg soc_hisi_hi6220 +dev/usb/controller/dwc_otg_hisi.c optional dwcotg fdt soc_hisi_hi6220 dev/usb/controller/generic_ohci.c optional ohci fdt dev/usb/controller/generic_usb_if.m optional ohci fdt dev/vnic/mrml_bridge.c optional vnic fdt From owner-svn-src-head@freebsd.org Wed Jul 20 18:00: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 E5806B9FFFE; Wed, 20 Jul 2016 18:00:23 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6B531D70; Wed, 20 Jul 2016 18:00:23 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KI0MW9033104; Wed, 20 Jul 2016 18:00:22 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KI0MiW033103; Wed, 20 Jul 2016 18:00:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201607201800.u6KI0MiW033103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 20 Jul 2016 18:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303103 - 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: Wed, 20 Jul 2016 18:00:24 -0000 Author: brooks Date: Wed Jul 20 18:00:22 2016 New Revision: 303103 URL: https://svnweb.freebsd.org/changeset/base/303103 Log: Minor wording improvements to the note about pipe(2) removal. MFC after: 5 days Sponsored by: DARPA, AFRL Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jul 20 17:46:33 2016 (r303102) +++ head/UPDATING Wed Jul 20 18:00:22 2016 (r303103) @@ -33,11 +33,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 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 - only implemented by the kernels which include "options - COMPAT_FREEBSD10" in their config file (this is the default). - Users should ensure that this option is enabled in their kernel - or upgrade userspace to r302092 before upgrading their kernel. + a wrapper that calls the pipe2(2) system call and the pipe(2) + system call is now only implemented by the kernels that include + "options COMPAT_FREEBSD10" in their config file (this is the + default). Users should ensure that this option is enabled in + their kernel or upgrade userspace to r302092 before upgrading their + kernel. 20160527: CAM will now strip leading spaces from SCSI disks' serial numbers. From owner-svn-src-head@freebsd.org Wed Jul 20 18:02: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 04FDAB9F153; Wed, 20 Jul 2016 18:02:09 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C60DD121D; Wed, 20 Jul 2016 18:02:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KI28sF036417; Wed, 20 Jul 2016 18:02:08 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KI28eK036416; Wed, 20 Jul 2016 18:02:08 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201607201802.u6KI28eK036416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 20 Jul 2016 18:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303104 - 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: Wed, 20 Jul 2016 18:02:09 -0000 Author: brooks Date: Wed Jul 20 18:02:07 2016 New Revision: 303104 URL: https://svnweb.freebsd.org/changeset/base/303104 Log: Update to reflect the fact that pipe() is a wrapper around the pipe2() system call. Reviewed by: jhb, wblock MFC after: 5 days Sponsored by: DAPRA, AFRL Differential Revision: https://reviews.freebsd.org/D6948 Modified: head/lib/libc/sys/pipe.2 Modified: head/lib/libc/sys/pipe.2 ============================================================================== --- head/lib/libc/sys/pipe.2 Wed Jul 20 18:00:22 2016 (r303103) +++ head/lib/libc/sys/pipe.2 Wed Jul 20 18:02:07 2016 (r303104) @@ -28,7 +28,7 @@ .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 22, 2016 +.Dd July 20, 2016 .Dt PIPE 2 .Os .Sh NAME @@ -109,6 +109,18 @@ The bidirectional nature of this impleme portable to older systems, so it is recommended to use the convention for using the endpoints in the traditional manner when using a pipe in one direction. +.Sh IMPLEMENTATION NOTES +The +.Fn pipe +function calls the +.Fn pipe2 +system call. +As a result, system call traces such as those captured by +.Xr dtrace 1 +or +.Xr ktrace 1 +will show calls to +.Fn pipe2 . .Sh RETURN VALUES .Rv -std pipe .Sh ERRORS @@ -157,3 +169,10 @@ The .Fn pipe2 function appeared in .Fx 10.0 . +.Pp +The +.Fn pipe +function became a wrapper around +.Fn pipe2 +in +.Fx 11.0 . From owner-svn-src-head@freebsd.org Wed Jul 20 18:11: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 8AD41B9F58B; Wed, 20 Jul 2016 18:11:23 +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 57ED2170F; Wed, 20 Jul 2016 18:11:23 +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 u6KIBMhu039076; Wed, 20 Jul 2016 18:11:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KIBMQx039075; Wed, 20 Jul 2016 18:11:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607201811.u6KIBMQx039075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Jul 2016 18:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303105 - 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: Wed, 20 Jul 2016 18:11:23 -0000 Author: cem Date: Wed Jul 20 18:11:22 2016 New Revision: 303105 URL: https://svnweb.freebsd.org/changeset/base/303105 Log: Fix DEBUG build on 64-bit arch after r303099 Reported by: Larry Rosenman Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed Jul 20 18:02:07 2016 (r303104) +++ head/sys/kern/imgact_elf.c Wed Jul 20 18:11:22 2016 (r303105) @@ -1660,7 +1660,7 @@ __elfN(puthdr)(struct thread *td, void * (numsegs + 1) * ehdr->e_phentsize; KASSERT(ehdr->e_shoff == hdrsize - sizeof(Elf_Shdr), ("e_shoff: %zu, hdrsize - shdr: %zu", - ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); + (size_t)ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); memset(shdr, 0, sizeof(*shdr)); From owner-svn-src-head@freebsd.org Wed Jul 20 18:11: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 5F20AB9F5D8; Wed, 20 Jul 2016 18:11:54 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (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 325421950; Wed, 20 Jul 2016 18:11:53 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f178.google.com with SMTP id q83so54998472iod.1; Wed, 20 Jul 2016 11:11:53 -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=sU+LeyheEcOYmnzSBWt+/6sMX6XFxPl3Wu41sTGesps=; b=eDq2Nx2/FGY4+7C8+doBLixjok4gLbM9ZkbOkAxI37pJ5SYwsjKHHOT8MtxEEOAOgB tJ/wIHHmDPyuZptdmYufRNW1ykJAowUU3mbra2yI/lahDOAsTGWuRlh3ctAW16+0yVqC pncS4jhBEkVJGWGhTN0GyF6hzxcaZWwOHn/t5QhZqhWJM0uSA/bMTIDpRQtCGofGCCFK E18Aqowu2JG/Kd7TWl91ZR3CKPzUOrJsQfy3by8a8LZBDUz47z/BU1JxJ7xGTMl0o9TJ sro1PGv1IalnBa5UkzlZfiLvalQz++cy2DoneF4h1I2PhexIM+fa3G1fh4RaWYFwBT7R p+Cg== X-Gm-Message-State: ALyK8tLeMoOmjPQcK3aMCOxlilTV9q8S8jMNLC7cI0JMVOSWCZVO+Rf7hkiZkTib+XsIwA== X-Received: by 10.107.166.135 with SMTP id p129mr45468463ioe.121.1469038312697; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id c40sm1941329iod.6.2016.07.20.11.11.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 11:11:52 -0700 (PDT) Received: by mail-it0-f52.google.com with SMTP id j124so57996485ith.1; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) X-Received: by 10.36.212.132 with SMTP id x126mr46373814itg.34.1469038312181; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Wed, 20 Jul 2016 11:11:51 -0700 (PDT) In-Reply-To: <7d98bc0deeedc54964b62911276c41cc@thebighonker.lerctr.org> References: <201607201659.u6KGxaNs010929@repo.freebsd.org> <7d98bc0deeedc54964b62911276c41cc@thebighonker.lerctr.org> From: Conrad Meyer Date: Wed, 20 Jul 2016 11:11:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303099 - head/sys/kern To: Larry Rosenman Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-svn-src-all@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, 20 Jul 2016 18:11:54 -0000 Mea culpa. Thanks for the report. Fixed in r303105. Best, Conrad On Wed, Jul 20, 2016 at 10:32 AM, Larry Rosenman wrote: > This broke my build: > --- imgact_elf32.o --- > In file included from /usr/src/sys/kern/imgact_elf32.c:31: > /usr/src/sys/kern/imgact_elf.c:1663:8: error: format specifies type 'size_t' > (aka 'unsigned long') but the argument has type 'Elf32_Off' (aka 'unsigned > int') [-Werror,-Wformat] > ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); > ^~~~~~~~~~~~~ > /usr/src/sys/sys/systm.h:86:17: note: expanded from macro 'KASSERT' > kassert_panic msg; \ > ^~~ > > > > > On 2016-07-20 11:59, Conrad E. Meyer wrote: >> >> Author: cem >> Date: Wed Jul 20 16:59:36 2016 >> New Revision: 303099 >> URL: https://svnweb.freebsd.org/changeset/base/303099 >> >> Log: >> Extend ELF coredump to support more than 65535 segments >> >> The ELF e_phnum field is only 16 bits wide. To support more than >> 65535 segments >> (program headers), Sun's "Linker and Libraries Guide" table 7-7 (or >> 12-7, >> depending on document version) prescribes a special first section header >> where >> sh_info represents the real number of program headers. >> >> Test code to follow, when it is ready. >> >> Reference: http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf >> >> Reviewed by: emaste, markj >> Sponsored by: EMC / Isilon Storage Division >> Differential Revision: https://reviews.freebsd.org/D7255 >> >> Modified: >> head/sys/kern/imgact_elf.c >> >> Modified: head/sys/kern/imgact_elf.c >> >> ============================================================================== >> --- head/sys/kern/imgact_elf.c Wed Jul 20 16:48:25 2016 (r303098) >> +++ head/sys/kern/imgact_elf.c Wed Jul 20 16:59:36 2016 (r303099) >> @@ -1323,6 +1323,8 @@ __elfN(coredump)(struct thread *td, stru >> * Collect info about the core file header area. >> */ >> hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + >> seginfo.count); >> + if (seginfo.count + 1 >= PN_XNUM) >> + hdrsize += sizeof(Elf_Shdr); >> __elfN(prepare_notes)(td, ¬elst, ¬esz); >> coresize = round_page(hdrsize + notesz) + seginfo.size; >> >> @@ -1618,10 +1620,10 @@ __elfN(puthdr)(struct thread *td, void * >> { >> Elf_Ehdr *ehdr; >> Elf_Phdr *phdr; >> + Elf_Shdr *shdr; >> struct phdr_closure phc; >> >> ehdr = (Elf_Ehdr *)hdr; >> - phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); >> >> ehdr->e_ident[EI_MAG0] = ELFMAG0; >> ehdr->e_ident[EI_MAG1] = ELFMAG1; >> @@ -1645,14 +1647,43 @@ __elfN(puthdr)(struct thread *td, void * >> ehdr->e_flags = 0; >> ehdr->e_ehsize = sizeof(Elf_Ehdr); >> ehdr->e_phentsize = sizeof(Elf_Phdr); >> - ehdr->e_phnum = numsegs + 1; >> ehdr->e_shentsize = sizeof(Elf_Shdr); >> - ehdr->e_shnum = 0; >> ehdr->e_shstrndx = SHN_UNDEF; >> + if (numsegs + 1 < PN_XNUM) { >> + ehdr->e_phnum = numsegs + 1; >> + ehdr->e_shnum = 0; >> + } else { >> + ehdr->e_phnum = PN_XNUM; >> + ehdr->e_shnum = 1; >> + >> + ehdr->e_shoff = ehdr->e_phoff + >> + (numsegs + 1) * ehdr->e_phentsize; >> + KASSERT(ehdr->e_shoff == hdrsize - sizeof(Elf_Shdr), >> + ("e_shoff: %zu, hdrsize - shdr: %zu", >> + ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); >> + >> + shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); >> + memset(shdr, 0, sizeof(*shdr)); >> + /* >> + * A special first section is used to hold large segment >> and >> + * section counts. This was proposed by Sun Microsystems >> in >> + * Solaris and has been adopted by Linux; the standard ELF >> + * tools are already familiar with the technique. >> + * >> + * See table 7-7 of the Solaris "Linker and Libraries >> Guide" >> + * (or 12-7 depending on the version of the document) for >> more >> + * details. >> + */ >> + shdr->sh_type = SHT_NULL; >> + shdr->sh_size = ehdr->e_shnum; >> + shdr->sh_link = ehdr->e_shstrndx; >> + shdr->sh_info = numsegs + 1; >> + } >> >> /* >> * Fill in the program header entries. >> */ >> + phdr = (Elf_Phdr *)((char *)hdr + ehdr->e_phoff); >> >> /* The note segement. */ >> phdr->p_type = PT_NOTE; >> _______________________________________________ >> 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" > > > -- > Larry Rosenman http://www.lerctr.org/~ler > Phone: +1 214-642-9640 E-Mail: ler@lerctr.org > US Mail: 17716 Limpia Crk, Round Rock, TX 78664-7281 From owner-svn-src-head@freebsd.org Wed Jul 20 18:16: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 915A6B9F6C5; Wed, 20 Jul 2016 18:16:59 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 644B11D01; Wed, 20 Jul 2016 18:16:59 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KIGwxn040593; Wed, 20 Jul 2016 18:16:58 GMT (envelope-from zeising@FreeBSD.org) Received: (from zeising@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KIGwRr040592; Wed, 20 Jul 2016 18:16:58 GMT (envelope-from zeising@FreeBSD.org) Message-Id: <201607201816.u6KIGwRr040592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zeising set sender to zeising@FreeBSD.org using -f From: Niclas Zeising Date: Wed, 20 Jul 2016 18:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303106 - 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: Wed, 20 Jul 2016 18:16:59 -0000 Author: zeising (doc,ports committer) Date: Wed Jul 20 18:16:58 2016 New Revision: 303106 URL: https://svnweb.freebsd.org/changeset/base/303106 Log: Change wording to use function rather than system call in the description as well. Reviewed by: brooks MFC after: 5 days Modified: head/lib/libc/sys/pipe.2 Modified: head/lib/libc/sys/pipe.2 ============================================================================== --- head/lib/libc/sys/pipe.2 Wed Jul 20 18:11:22 2016 (r303105) +++ head/lib/libc/sys/pipe.2 Wed Jul 20 18:16:58 2016 (r303106) @@ -46,7 +46,7 @@ .Sh DESCRIPTION The .Fn pipe -system call +function creates a .Em pipe , which is an object allowing From owner-svn-src-head@freebsd.org Wed Jul 20 18:41: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 8CABBB9FEA0; Wed, 20 Jul 2016 18:41:48 +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 4043011CB; Wed, 20 Jul 2016 18:41:48 +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 u6KIfl0r051469; Wed, 20 Jul 2016 18:41:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KIfleG051451; Wed, 20 Jul 2016 18:41:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607201841.u6KIfleG051451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 20 Jul 2016 18:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303109 - head/usr.sbin/crashinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 18:41:48 -0000 Author: jhb Date: Wed Jul 20 18:41:47 2016 New Revision: 303109 URL: https://svnweb.freebsd.org/changeset/base/303109 Log: Update crashinfo to work with newer gdb from ports. If gdb from ports is installed, use it instead of the base system gdb to extract variables from a kernel. Note that base gdb and ports gdb do not support the same options for invoking a single command in batch mode, so a wrapper shell function is used. In addition, prefer kgdb from ports when generating a backtrace if present. PR: 193335 Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7218 Modified: head/usr.sbin/crashinfo/crashinfo.sh Modified: head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.sh Wed Jul 20 18:27:42 2016 (r303108) +++ head/usr.sbin/crashinfo/crashinfo.sh Wed Jul 20 18:41:47 2016 (r303109) @@ -35,6 +35,22 @@ usage() exit 1 } +# Run a single gdb command against a kernel file in batch mode. +# The kernel file is specified as the first argument and the command +# is given in the remaining arguments. +gdb_command() +{ + local k + + k=$1 ; shift + + if [ -x /usr/local/bin/gdb ]; then + /usr/local/bin/gdb -batch -ex "$@" $k + else + echo -e "$@" | /usr/bin/gdb -x /dev/stdin -batch $k + fi +} + find_kernel() { local ivers k kvers @@ -55,8 +71,8 @@ find_kernel() # Look for a matching kernel version. for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do - kvers=$(echo 'printf " Version String: %s", version' | \ - gdb -x /dev/stdin -batch $k 2>/dev/null) + kvers=$(gdb_command $k 'printf " Version String: %s", version' \ + 2>/dev/null) if [ "$ivers" = "$kvers" ]; then KERNEL=$k break @@ -151,11 +167,10 @@ echo "Writing crash summary to $FILE." umask 077 # Simulate uname -ostype=$(echo -e printf '"%s", ostype' | gdb -x /dev/stdin -batch $KERNEL) -osrelease=$(echo -e printf '"%s", osrelease' | gdb -x /dev/stdin -batch $KERNEL) -version=$(echo -e printf '"%s", version' | gdb -x /dev/stdin -batch $KERNEL | \ - tr '\t\n' ' ') -machine=$(echo -e printf '"%s", machine' | gdb -x /dev/stdin -batch $KERNEL) +ostype=$(gdb_command $KERNEL 'printf "%s", ostype') +osrelease=$(gdb_command $KERNEL 'printf "%s", osrelease') +version=$(gdb_command $KERNEL 'printf "%s", version' | tr '\t\n' ' ') +machine=$(gdb_command $KERNEL 'printf "%s", machine') exec > $FILE 2>&1 @@ -174,7 +189,11 @@ file=`mktemp /tmp/crashinfo.XXXXXX` if [ $? -eq 0 ]; then echo "bt" >> $file echo "quit" >> $file - kgdb $KERNEL $VMCORE < $file + if [ -x /usr/local/bin/kgdb ]; then + /usr/local/bin/kgdb $KERNEL $VMCORE < $file + else + kgdb $KERNEL $VMCORE < $file + fi rm -f $file echo fi From owner-svn-src-head@freebsd.org Wed Jul 20 19:07: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 6112DB9F6EE; Wed, 20 Jul 2016 19:07:43 +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 4ED771445; Wed, 20 Jul 2016 19:07:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 455F1121C; Wed, 20 Jul 2016 19:07:43 +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 E941565A6; Wed, 20 Jul 2016 19:07:42 +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 wMWEYeTg4kmH; Wed, 20 Jul 2016 19:07:39 +0000 (UTC) Subject: Re: svn commit: r303043 - in head: share/man/man4 sys/dev/vt sys/dev/vt/hw/fb DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 35FC7659F To: cem@freebsd.org, koobs@freebsd.org References: <201607191920.u6JJKm7R026421@repo.freebsd.org> <1c485351-51f3-99f1-b7da-0745030dd1e6@FreeBSD.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery Organization: FreeBSD Message-ID: Date: Wed, 20 Jul 2016 12:07:37 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: 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: Wed, 20 Jul 2016 19:07:43 -0000 On 7/20/16 8:20 AM, Conrad Meyer wrote: > On Wed, Jul 20, 2016 at 12:44 AM, Kubilay Kocak wrote: >> On 20/07/2016 5:20 AM, Conrad E. Meyer wrote: >>> Author: cem >>> Date: Tue Jul 19 19:20:47 2016 >>> New Revision: 303043 >>> URL: https://svnweb.freebsd.org/changeset/base/303043 >>> >>> Log: >>> Increase vt(4) framebuffer maximum size >>> >>> And rename "DEFAULT" constants to the more accurate "MAX." >>> >>> PR: 210382 >>> Submitted by: Felix >>> Reviewed by: wblock, cem >>> Tested by: Dave Cottlehuber >> >> Can MFC? >> >> There are high hopes for this coming out in 11.0 / next 10.x >> >> re is cc'd on the original bugzilla issue > > If you would like to do so, please go ahead. > > Best, > Conrad > I'll handle it after it's been in for a week. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Wed Jul 20 19:21: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 F2479B9FFF1; Wed, 20 Jul 2016 19:21:12 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF48B12D4; Wed, 20 Jul 2016 19:21:12 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KJLBLe064306; Wed, 20 Jul 2016 19:21:11 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KJLBkW064304; Wed, 20 Jul 2016 19:21:11 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201607201921.u6KJLBkW064304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 20 Jul 2016 19:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303110 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 19:21:13 -0000 Author: sbruno Date: Wed Jul 20 19:21:11 2016 New Revision: 303110 URL: https://svnweb.freebsd.org/changeset/base/303110 Log: Remove uneeded parens. MFC after: 1 day Modified: head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Jul 20 18:41:47 2016 (r303109) +++ head/sys/dev/e1000/if_igb.c Wed Jul 20 19:21:11 2016 (r303110) @@ -1106,7 +1106,7 @@ igb_ioctl(struct ifnet *ifp, u_long comm ifp->if_mtu = ifr->ifr_mtu; adapter->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) igb_init_locked(adapter); IGB_CORE_UNLOCK(adapter); break; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Wed Jul 20 18:41:47 2016 (r303109) +++ head/sys/dev/e1000/if_lem.c Wed Jul 20 19:21:11 2016 (r303110) @@ -1053,7 +1053,7 @@ lem_ioctl(if_t ifp, u_long command, cadd if_setmtu(ifp, ifr->ifr_mtu); adapter->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; - if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING)) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) lem_init_locked(adapter); EM_CORE_UNLOCK(adapter); break; From owner-svn-src-head@freebsd.org Wed Jul 20 19:33: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 5FF88B9E51B; Wed, 20 Jul 2016 19:33:36 +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 498951E69; Wed, 20 Jul 2016 19:33:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 421D11E12; Wed, 20 Jul 2016 19:33:36 +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 01D2B668D; Wed, 20 Jul 2016 19:33:36 +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 oBvPd0_0xgjn; Wed, 20 Jul 2016 19:33:33 +0000 (UTC) Subject: Re: svn commit: r302350 - in head: share/man/man9 sys/kern sys/sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 15DA36687 To: Hans Petter Selasky , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Gleb Smirnoff References: <201607051847.u65IlIYf000901@repo.freebsd.org> <20160713084947.a4nfb6obr475pah6@mac> <8ed4b78f-71d3-9051-d435-ad0f9f3af124@selasky.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Bryan Drewery Organization: FreeBSD Message-ID: <2026f486-d770-193d-34c1-8b93ec19b51e@FreeBSD.org> Date: Wed, 20 Jul 2016 12:33:33 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <8ed4b78f-71d3-9051-d435-ad0f9f3af124@selasky.org> Content-Type: text/plain; charset=windows-1252 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, 20 Jul 2016 19:33:36 -0000 On 7/13/16 3:11 AM, Hans Petter Selasky wrote: > 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 > I won't comment on the specific cases, but I do think we should move to using enums or macros for these return values and other parts of the KPI. The callout API is getting very abused lately, since r290664, and there seems to be a lack of review or consensus around most changes. Even in the recent changes, the review brought up several points that were seemingly ignored, and more that are still being ignored. The constant churn and reverts on this API is not acceptable. -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Wed Jul 20 20:10: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 3FA02B9F1C0; Wed, 20 Jul 2016 20:10:38 +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 10E0A18DC; Wed, 20 Jul 2016 20:10:37 +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 u6KKAbvB081938; Wed, 20 Jul 2016 20:10:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KKAb76081937; Wed, 20 Jul 2016 20:10:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607202010.u6KKAb76081937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Jul 2016 20:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303111 - 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: Wed, 20 Jul 2016 20:10:38 -0000 Author: mav Date: Wed Jul 20 20:10:37 2016 New Revision: 303111 URL: https://svnweb.freebsd.org/changeset/base/303111 Log: Document list of supported chipsets. Modified: head/share/man/man4/intpm.4 Modified: head/share/man/man4/intpm.4 ============================================================================== --- head/share/man/man4/intpm.4 Wed Jul 20 19:21:11 2016 (r303110) +++ head/share/man/man4/intpm.4 Wed Jul 20 20:10:37 2016 (r303111) @@ -24,25 +24,39 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 1999 +.Dd July 20, 2016 .Dt INTPM 4 .Os .Sh NAME .Nm intpm .Nd Intel PIIX4 Power Management controller driver .Sh SYNOPSIS +.Cd device pci .Cd device smbus .Cd device smb .Cd device intpm .Sh DESCRIPTION -This driver provides access to -.Tn Intel PIIX4 PCI Controller function 3 , -Power management controller. -Currently, only smbus controller -function is implemented. -But it also have bus idle monitoring function. -It -will display mapped I/O address for bus monitoring function when attaching. +The +.Nm +driver provides access to +.Tn Intel PIIX4 +compatible Power Management controllers. +Currently, only +.Xr smbus 4 +controller function is implemented. +.Sh HARDWARE +The +.Nm +driver supports the following chipsets: +.Pp +.Bl -bullet -compact +.It +Intel 82371AB/82443MX +.It +ATI IXP400 +.It +AMD SB600/700/710/750 +.El .Sh SEE ALSO .Xr smb 4 , .Xr smbus 4 From owner-svn-src-head@freebsd.org Wed Jul 20 20:18: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 4BF55B9F486; Wed, 20 Jul 2016 20:18:54 +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 F2F291166; Wed, 20 Jul 2016 20:18:53 +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 u6KKIrJQ085531; Wed, 20 Jul 2016 20:18:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KKIq15085526; Wed, 20 Jul 2016 20:18:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607202018.u6KKIq15085526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Jul 2016 20:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303113 - 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: Wed, 20 Jul 2016 20:18:54 -0000 Author: mav Date: Wed Jul 20 20:18:52 2016 New Revision: 303113 URL: https://svnweb.freebsd.org/changeset/base/303113 Log: Cross-link some SMBus controller drivers man pages. Some compatibility cases are not obvious. Modified: head/share/man/man4/amdpm.4 head/share/man/man4/amdsmb.4 head/share/man/man4/ichsmb.4 head/share/man/man4/intpm.4 head/share/man/man4/ismt.4 Modified: head/share/man/man4/amdpm.4 ============================================================================== --- head/share/man/man4/amdpm.4 Wed Jul 20 20:12:58 2016 (r303112) +++ head/share/man/man4/amdpm.4 Wed Jul 20 20:18:52 2016 (r303113) @@ -51,6 +51,7 @@ for writing user code to fetch voltages, monitoring chip of your mainboard. .Sh SEE ALSO .Xr amdsmb 4 , +.Xr intpm 4 , .Xr smb 4 , .Xr smbus 4 .Sh HISTORY Modified: head/share/man/man4/amdsmb.4 ============================================================================== --- head/share/man/man4/amdsmb.4 Wed Jul 20 20:12:58 2016 (r303112) +++ head/share/man/man4/amdsmb.4 Wed Jul 20 20:18:52 2016 (r303113) @@ -31,6 +31,7 @@ .Nm amdsmb .Nd "AMD-8111 SMBus 2.0 controller driver" .Sh SYNOPSIS +.Cd "device pci" .Cd "device smbus" .Cd "device smb" .Cd "device amdsmb" @@ -39,6 +40,8 @@ The .Nm driver provides access to the AMD-8111 SMBus 2.0 controller. .Sh SEE ALSO +.Xr amdpm 4 , +.Xr intpm 4 , .Xr smb 4 , .Xr smbus 4 .Sh HISTORY Modified: head/share/man/man4/ichsmb.4 ============================================================================== --- head/share/man/man4/ichsmb.4 Wed Jul 20 20:12:58 2016 (r303112) +++ head/share/man/man4/ichsmb.4 Wed Jul 20 20:18:52 2016 (r303113) @@ -53,6 +53,8 @@ driver provides support for the SMBus controller logical device contained in all Intel motherboard chipsets starting from 82801AA (ICH). .Sh SEE ALSO +.Xr intpm 4 , +.Xr ismt 4 , .Xr smb 4 , .Xr smbus 4 .Sh AUTHORS Modified: head/share/man/man4/intpm.4 ============================================================================== --- head/share/man/man4/intpm.4 Wed Jul 20 20:12:58 2016 (r303112) +++ head/share/man/man4/intpm.4 Wed Jul 20 20:18:52 2016 (r303113) @@ -58,6 +58,9 @@ ATI IXP400 AMD SB600/700/710/750 .El .Sh SEE ALSO +.Xr amdpm 4 , +.Xr amdsmb 4 , +.Xr ichsmb 4 , .Xr smb 4 , .Xr smbus 4 .Sh HISTORY Modified: head/share/man/man4/ismt.4 ============================================================================== --- head/share/man/man4/ismt.4 Wed Jul 20 20:12:58 2016 (r303112) +++ head/share/man/man4/ismt.4 Wed Jul 20 20:18:52 2016 (r303113) @@ -48,6 +48,7 @@ This driver provides access to the SMBus 2.0 controller device contained in the Intel Atom S1200 and C2000 CPUs. .Sh SEE ALSO +.Xr ichsmb 4 , .Xr smb 4 , .Xr smbus 4 .Sh HISTORY From owner-svn-src-head@freebsd.org Wed Jul 20 22:03: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 B11F3B9FBF0; Wed, 20 Jul 2016 22:03:46 +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 640F21BE2; Wed, 20 Jul 2016 22:03:46 +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 u6KM3j2c027655; Wed, 20 Jul 2016 22:03:45 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KM3jHZ027654; Wed, 20 Jul 2016 22:03:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607202203.u6KM3jHZ027654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Jul 2016 22:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303114 - 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: Wed, 20 Jul 2016 22:03:46 -0000 Author: cem Date: Wed Jul 20 22:03:45 2016 New Revision: 303114 URL: https://svnweb.freebsd.org/changeset/base/303114 Log: Add extended segment support to gcore A follow-up to r303099, D7255. Basically, apply the exact same change, with the exact same rationale, to gcore. gcore's elfcore.c is largely a clone of the kernel imgact_elf coredump facility. Reviewed by: emaste (earlier version, not substantially different) Requested by: jhb Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D7265 Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Wed Jul 20 20:18:52 2016 (r303113) +++ head/usr.bin/gcore/elfcore.c Wed Jul 20 22:03:45 2016 (r303114) @@ -213,6 +213,8 @@ elf_coredump(int efd __unused, int fd, p */ sb = sbuf_new_auto(); hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + seginfo.count); + if (seginfo.count + 1 >= PN_XNUM) + hdrsize += sizeof(Elf_Shdr); /* Start header + notes section. */ sbuf_start_section(sb, NULL); /* Make empty header subsection. */ @@ -423,10 +425,10 @@ elf_puthdr(pid_t pid, vm_map_entry_t map { Elf_Ehdr *ehdr; Elf_Phdr *phdr; + Elf_Shdr *shdr; struct phdr_closure phc; ehdr = (Elf_Ehdr *)hdr; - phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); ehdr->e_ident[EI_MAG0] = ELFMAG0; ehdr->e_ident[EI_MAG1] = ELFMAG1; @@ -446,14 +448,40 @@ elf_puthdr(pid_t pid, vm_map_entry_t map ehdr->e_flags = 0; ehdr->e_ehsize = sizeof(Elf_Ehdr); ehdr->e_phentsize = sizeof(Elf_Phdr); - ehdr->e_phnum = numsegs + 1; ehdr->e_shentsize = sizeof(Elf_Shdr); - ehdr->e_shnum = 0; ehdr->e_shstrndx = SHN_UNDEF; + if (numsegs + 1 < PN_XNUM) { + ehdr->e_phnum = numsegs + 1; + ehdr->e_shnum = 0; + } else { + ehdr->e_phnum = PN_XNUM; + ehdr->e_shnum = 1; + + ehdr->e_shoff = ehdr->e_phoff + + (numsegs + 1) * ehdr->e_phentsize; + + shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); + memset(shdr, 0, sizeof(*shdr)); + /* + * A special first section is used to hold large segment and + * section counts. This was proposed by Sun Microsystems in + * Solaris and has been adopted by Linux; the standard ELF + * tools are already familiar with the technique. + * + * See table 7-7 of the Solaris "Linker and Libraries Guide" + * (or 12-7 depending on the version of the document) for more + * details. + */ + shdr->sh_type = SHT_NULL; + shdr->sh_size = ehdr->e_shnum; + shdr->sh_link = ehdr->e_shstrndx; + shdr->sh_info = numsegs + 1; + } /* * Fill in the program header entries. */ + phdr = (Elf_Phdr *)((char *)hdr + ehdr->e_phoff); /* The note segement. */ phdr->p_type = PT_NOTE; From owner-svn-src-head@freebsd.org Wed Jul 20 22:05: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 539ECB9FC8A; Wed, 20 Jul 2016 22:05:46 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D7CE1D93; Wed, 20 Jul 2016 22:05:46 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KM5j7c027765; Wed, 20 Jul 2016 22:05:45 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KM5jJB027763; Wed, 20 Jul 2016 22:05:45 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201607202205.u6KM5jJB027763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 20 Jul 2016 22:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303115 - head/sys/dev/urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 20 Jul 2016 22:05:46 -0000 Author: avos Date: Wed Jul 20 22:05:44 2016 New Revision: 303115 URL: https://svnweb.freebsd.org/changeset/base/303115 Log: urtwn: fix A-MSDU tx aggregation when encryption is used. Clear unused (undocumented) CAM bytes while setting a key; without that, hardware does weird things when A-MSDU bit in QoS header is set. Tested with RTL8188CUS (AP) -> RTL8188EU (STA) (A-MSDU transmit). Reported by: many Obtained from: https://github.com/s3erios/urtwm MFC after: 5 days Modified: head/sys/dev/urtwn/if_urtwn.c head/sys/dev/urtwn/if_urtwnreg.h Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Wed Jul 20 22:03:45 2016 (r303114) +++ head/sys/dev/urtwn/if_urtwn.c Wed Jul 20 22:05:44 2016 (r303115) @@ -2318,6 +2318,10 @@ urtwn_key_set_cb(struct urtwn_softc *sc, k->wk_cipher->ic_cipher, algo, k->wk_flags, k->wk_keylen, ether_sprintf(k->wk_macaddr)); + /* Clear high bits. */ + urtwn_cam_write(sc, R92C_CAM_CTL6(k->wk_keyix), 0); + urtwn_cam_write(sc, R92C_CAM_CTL7(k->wk_keyix), 0); + /* Write key. */ for (i = 0; i < 4; i++) { error = urtwn_cam_write(sc, R92C_CAM_KEY(k->wk_keyix, i), Modified: head/sys/dev/urtwn/if_urtwnreg.h ============================================================================== --- head/sys/dev/urtwn/if_urtwnreg.h Wed Jul 20 22:03:45 2016 (r303114) +++ head/sys/dev/urtwn/if_urtwnreg.h Wed Jul 20 22:05:44 2016 (r303115) @@ -871,6 +871,8 @@ #define R92C_CAM_CTL0(entry) ((entry) * 8 + 0) #define R92C_CAM_CTL1(entry) ((entry) * 8 + 1) #define R92C_CAM_KEY(entry, i) ((entry) * 8 + 2 + (i)) +#define R92C_CAM_CTL6(entry) ((entry) * 8 + 6) +#define R92C_CAM_CTL7(entry) ((entry) * 8 + 7) /* Bits for R92C_CAM_CTL0(i). */ #define R92C_CAM_KEYID_M 0x00000003 From owner-svn-src-head@freebsd.org Wed Jul 20 22:46: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 8DA02BA05EE; Wed, 20 Jul 2016 22:46:57 +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 49CC016B4; Wed, 20 Jul 2016 22:46:57 +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 u6KMkuij042707; Wed, 20 Jul 2016 22:46:56 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KMkuvn042706; Wed, 20 Jul 2016 22:46:56 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607202246.u6KMkuvn042706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Jul 2016 22:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303118 - 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: Wed, 20 Jul 2016 22:46:57 -0000 Author: cem Date: Wed Jul 20 22:46:56 2016 New Revision: 303118 URL: https://svnweb.freebsd.org/changeset/base/303118 Log: ANSI-fy imgact_elf.c Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed Jul 20 22:32:19 2016 (r303117) +++ head/sys/kern/imgact_elf.c Wed Jul 20 22:46:56 2016 (r303118) @@ -1449,9 +1449,7 @@ cb_put_phdr(entry, closure) * the number of segments and their total size. */ static void -cb_size_segment(entry, closure) - vm_map_entry_t entry; - void *closure; +cb_size_segment(vm_map_entry_t entry, void *closure) { struct sseg_closure *ssc = (struct sseg_closure *)closure; @@ -1465,10 +1463,7 @@ cb_size_segment(entry, closure) * caller-supplied data. */ static void -each_writable_segment(td, func, closure) - struct thread *td; - segment_callback func; - void *closure; +each_writable_segment(struct thread *td, segment_callback func, void *closure) { struct proc *p = td->td_proc; vm_map_t map = &p->p_vmspace->vm_map; From owner-svn-src-head@freebsd.org Wed Jul 20 22:49: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 D9D90BA06CA; Wed, 20 Jul 2016 22:49:34 +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 AD29B19AD; Wed, 20 Jul 2016 22:49:34 +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 u6KMnXPs042830; Wed, 20 Jul 2016 22:49:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KMnXL3042829; Wed, 20 Jul 2016 22:49:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201607202249.u6KMnXL3042829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 20 Jul 2016 22:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303119 - 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: Wed, 20 Jul 2016 22:49:35 -0000 Author: gjb Date: Wed Jul 20 22:49:33 2016 New Revision: 303119 URL: https://svnweb.freebsd.org/changeset/base/303119 Log: Create a /usr/home -> /home symlink for the arm images to avoid /usr/home confusingly being created as a directory. Reported by: Russell Haley MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/arm.subr Modified: head/release/tools/arm.subr ============================================================================== --- head/release/tools/arm.subr Wed Jul 20 22:46:56 2016 (r303118) +++ head/release/tools/arm.subr Wed Jul 20 22:49:33 2016 (r303119) @@ -88,6 +88,7 @@ arm_create_user() { -c 'FreeBSD User' -d '/home/freebsd' -s '/bin/csh' chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \ usermod root -w yes + chroot ${CHROOTDIR} ln -s /home ${DESTDIR}/usr/home return 0 } From owner-svn-src-head@freebsd.org Wed Jul 20 22:51: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 695B3BA093D; Wed, 20 Jul 2016 22:51:34 +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 22C8F1D44; Wed, 20 Jul 2016 22:51:34 +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 u6KMpXuK042961; Wed, 20 Jul 2016 22:51:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KMpX73042960; Wed, 20 Jul 2016 22:51:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607202251.u6KMpX73042960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 20 Jul 2016 22:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303120 - 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: Wed, 20 Jul 2016 22:51:34 -0000 Author: cem Date: Wed Jul 20 22:51:33 2016 New Revision: 303120 URL: https://svnweb.freebsd.org/changeset/base/303120 Log: imgact_elf: Rename the segment iterator to match reality The each_writable_segment routine evaluates segments on a slightly little more nuanced metric than simply "writable" or not. Rename the function to more closely match its behavior (each_dumpable_segment). Suggested by: jhb Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Wed Jul 20 22:49:33 2016 (r303119) +++ head/sys/kern/imgact_elf.c Wed Jul 20 22:51:33 2016 (r303120) @@ -1163,7 +1163,7 @@ static void cb_put_phdr(vm_map_entry_t, static void cb_size_segment(vm_map_entry_t, void *); static int core_write(struct coredump_params *, void *, size_t, off_t, enum uio_seg); -static void each_writable_segment(struct thread *, segment_callback, void *); +static void each_dumpable_segment(struct thread *, segment_callback, void *); static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t, struct note_info_list *, size_t); static void __elfN(prepare_notes)(struct thread *, struct note_info_list *, @@ -1317,7 +1317,7 @@ __elfN(coredump)(struct thread *td, stru /* Size the program segments. */ seginfo.count = 0; seginfo.size = 0; - each_writable_segment(td, cb_size_segment, &seginfo); + each_dumpable_segment(td, cb_size_segment, &seginfo); /* * Collect info about the core file header area. @@ -1419,7 +1419,7 @@ done: } /* - * A callback for each_writable_segment() to write out the segment's + * A callback for each_dumpable_segment() to write out the segment's * program header entry. */ static void @@ -1445,7 +1445,7 @@ cb_put_phdr(entry, closure) } /* - * A callback for each_writable_segment() to gather information about + * A callback for each_dumpable_segment() to gather information about * the number of segments and their total size. */ static void @@ -1463,7 +1463,7 @@ cb_size_segment(vm_map_entry_t entry, vo * caller-supplied data. */ static void -each_writable_segment(struct thread *td, segment_callback func, void *closure) +each_dumpable_segment(struct thread *td, segment_callback func, void *closure) { struct proc *p = td->td_proc; vm_map_t map = &p->p_vmspace->vm_map; @@ -1694,7 +1694,7 @@ __elfN(puthdr)(struct thread *td, void * /* All the writable segments from the program. */ phc.phdr = phdr; phc.offset = round_page(hdrsize + notesz); - each_writable_segment(td, cb_put_phdr, &phc); + each_dumpable_segment(td, cb_put_phdr, &phc); } static size_t From owner-svn-src-head@freebsd.org Wed Jul 20 23:18: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 DFA34BA0EC9; Wed, 20 Jul 2016 23:18:39 +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 C0AE21B8D; Wed, 20 Jul 2016 23:18:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C5AD5B923; Wed, 20 Jul 2016 19:18:37 -0400 (EDT) From: John Baldwin To: "Conrad E. Meyer" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303120 - head/sys/kern Date: Wed, 20 Jul 2016 16:09:27 -0700 Message-ID: <2986227.mkPmo6E96P@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201607202251.u6KMpX73042960@repo.freebsd.org> References: <201607202251.u6KMpX73042960@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Jul 2016 19:18:37 -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: Wed, 20 Jul 2016 23:18:40 -0000 On Wednesday, July 20, 2016 10:51:33 PM Conrad E. Meyer wrote: > Author: cem > Date: Wed Jul 20 22:51:33 2016 > New Revision: 303120 > URL: https://svnweb.freebsd.org/changeset/base/303120 > > Log: > imgact_elf: Rename the segment iterator to match reality > > The each_writable_segment routine evaluates segments on a slightly little more > nuanced metric than simply "writable" or not. Rename the function to more > closely match its behavior (each_dumpable_segment). > > Suggested by: jhb > Sponsored by: EMC / Isilon Storage Division Please do the same rename in gcore's elfcore.c as well. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 21 00:42: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 53D61B8372F; Thu, 21 Jul 2016 00:42:11 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::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 20296132A; Thu, 21 Jul 2016 00:42:11 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf0-x231.google.com with SMTP id h186so24062035pfg.3; Wed, 20 Jul 2016 17:42:11 -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=hhNC90wkdhC5rH3Ty3JDf7iLIVyqYj42fG3rKe+0LxE=; b=OrspgZ/SIySz7lMzUhjpUX8rsMnS5h8yr5Zoa3rLsCpqqYYj1LtqO7EZlfwAgYtopb gQLXVsbJr9X/9PDLpBvjQkQjum+Qj+vAUTlFnLIpk/y1Nu48dClTCLdGPNxiq7Cm7VU6 JmDh3QJZmzQHCkMJU0+2fRIIQUyTQ+9k5oS969+9P8KBvoFdvvh51uc/1Vj1UA5G1qzj JwoyFKjaF0tvgbHMoRLJtgdjIBYYGjGFpXhXgX9+r7DK3DZkWjiiGgRL1v1cRVvnA3A9 nrAhQgsuqyYMZMz/h0InxzAl/2N1wOCC9TOoBw85J1qvWIg9lyYrU4OltSTOGAzYLPJi dVGg== 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=hhNC90wkdhC5rH3Ty3JDf7iLIVyqYj42fG3rKe+0LxE=; b=Oqdea78h2J3UlgpMubZu3e7VYCrXObh0Kc8OnoA61zPz2E+cCA6KaxdZutMWRoKXVA mycrkM2NLDuncOKB+To4LnsRnu41KErDapK9vlli+To6qkqyKuS8Z7u/ctQG8hAx7nBj JmnNqaQOJYeV8RhN8DuqPGDZKFWcUtaxkPPSHu0XMXOH4JthSzh1eqfBPG+AuTGWWxE2 3mqhED19xrIeRazyiMvM9lXo609ei0KXX+6Kj6D7GYEDlQCtopWfbIFRa79SBZPHlqhb BM6A4vw+vT38BNJTSWWBURQI0slzqk+NtPDjqPPsRQLptgoPf5YUH5BO990eIn/LXzRr WK0A== X-Gm-Message-State: ALyK8tIMbMj/tHNK5RORfvMex/Pqe+gtBd2H9SZnHkHksRAFaTf5fQXhbiM8BZL0V+MBBw== X-Received: by 10.98.32.81 with SMTP id g78mr68794536pfg.20.1469061730651; Wed, 20 Jul 2016 17:42:10 -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 k78sm7163600pfa.78.2016.07.20.17.42.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 17:42:10 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r303043 - in head: share/man/man4 sys/dev/vt sys/dev/vt/hw/fb References: <201607191920.u6JJKm7R026421@repo.freebsd.org> <1c485351-51f3-99f1-b7da-0745030dd1e6@FreeBSD.org> To: Bryan Drewery , cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Kubilay Kocak Message-ID: <51c76ae7-d598-96df-8a1f-06f254ec9c90@FreeBSD.org> Date: Thu, 21 Jul 2016 10:42:03 +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: 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: Thu, 21 Jul 2016 00:42:11 -0000 On 21/07/2016 5:07 AM, Bryan Drewery wrote: > On 7/20/16 8:20 AM, Conrad Meyer wrote: >> On Wed, Jul 20, 2016 at 12:44 AM, Kubilay Kocak wrote: >>> On 20/07/2016 5:20 AM, Conrad E. Meyer wrote: >>>> Author: cem >>>> Date: Tue Jul 19 19:20:47 2016 >>>> New Revision: 303043 >>>> URL: https://svnweb.freebsd.org/changeset/base/303043 >>>> >>>> Log: >>>> Increase vt(4) framebuffer maximum size >>>> >>>> And rename "DEFAULT" constants to the more accurate "MAX." >>>> >>>> PR: 210382 >>>> Submitted by: Felix >>>> Reviewed by: wblock, cem >>>> Tested by: Dave Cottlehuber >>> >>> Can MFC? >>> >>> There are high hopes for this coming out in 11.0 / next 10.x >>> >>> re is cc'd on the original bugzilla issue >> >> If you would like to do so, please go ahead. >> >> Best, >> Conrad >> > > I'll handle it after it's been in for a week. > Thank you Bryan ./koobs From owner-svn-src-head@freebsd.org Thu Jul 21 00:53: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 26FBCB83BAF; Thu, 21 Jul 2016 00:53:16 +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 D43951BCD; Thu, 21 Jul 2016 00:53:15 +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 u6L0rFeg090298; Thu, 21 Jul 2016 00:53:15 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L0rF70090297; Thu, 21 Jul 2016 00:53:15 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201607210053.u6L0rF70090297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Thu, 21 Jul 2016 00:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303122 - 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, 21 Jul 2016 00:53:16 -0000 Author: cem Date: Thu Jul 21 00:53:14 2016 New Revision: 303122 URL: https://svnweb.freebsd.org/changeset/base/303122 Log: Mirror r303120 to gcore Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Thu Jul 21 00:52:53 2016 (r303121) +++ head/usr.bin/gcore/elfcore.c Thu Jul 21 00:53:14 2016 (r303122) @@ -95,7 +95,7 @@ typedef void* (*notefunc_t)(void *, size static void cb_put_phdr(vm_map_entry_t, void *); static void cb_size_segment(vm_map_entry_t, void *); -static void each_writable_segment(vm_map_entry_t, segment_callback, +static void each_dumpable_segment(vm_map_entry_t, segment_callback, void *closure); static void elf_detach(void); /* atexit() handler. */ static void *elf_note_fpregset(void *, size_t *); @@ -206,7 +206,7 @@ elf_coredump(int efd __unused, int fd, p /* Size the program segments. */ seginfo.count = 0; seginfo.size = 0; - each_writable_segment(map, cb_size_segment, &seginfo); + each_dumpable_segment(map, cb_size_segment, &seginfo); /* * Build the header and the notes using sbuf and write to the file. @@ -277,7 +277,7 @@ elf_coredump(int efd __unused, int fd, p } /* - * A callback for each_writable_segment() to write out the segment's + * A callback for each_dumpable_segment() to write out the segment's * program header entry. */ static void @@ -307,7 +307,7 @@ cb_put_phdr(vm_map_entry_t entry, void * } /* - * A callback for each_writable_segment() to gather information about + * A callback for each_dumpable_segment() to gather information about * the number of segments and their total size. */ static void @@ -325,7 +325,7 @@ cb_size_segment(vm_map_entry_t entry, vo * data. */ static void -each_writable_segment(vm_map_entry_t map, segment_callback func, void *closure) +each_dumpable_segment(vm_map_entry_t map, segment_callback func, void *closure) { vm_map_entry_t entry; @@ -497,7 +497,7 @@ elf_puthdr(pid_t pid, vm_map_entry_t map /* All the writable segments from the program. */ phc.phdr = phdr; phc.offset = segoff; - each_writable_segment(map, cb_put_phdr, &phc); + each_dumpable_segment(map, cb_put_phdr, &phc); } /* From owner-svn-src-head@freebsd.org Thu Jul 21 00:54: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 18A6AB83C29; Thu, 21 Jul 2016 00:54:00 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f179.google.com (mail-io0-f179.google.com [209.85.223.179]) (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 E099E1D41; Thu, 21 Jul 2016 00:53:59 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f179.google.com with SMTP id b62so62661813iod.3; Wed, 20 Jul 2016 17:53:59 -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:content-transfer-encoding; bh=QyUQdd7wSFu0pyBlej3yakkEwDCSnUTzzwt1BpgYfOk=; b=O0itaIXzuUmXbW1y03hfr7y6TvI3fQsbtP1KgWU0HZeAiq2g/ZpchXoPJw4VZkqH3C vbe7HMFvCkZJKoLOScWDsFu5dUphyJ7KuyFaLQoCMCExDDnXtFqLwPZjO4VIO4KMdGwJ Xc1tbCt4zPMeKHe2jjK+UgCscRqkmBw7ZnR2Qtm0MkXtKGHroGWIoq0sbJzcLNTa3iQL 3GFYQBzYUVXA7lNri56AYHrxKImaTCxsj6ZiPN252qe94ZXy1jeZhKcPIetDFqp22Dzh nd+FlvAabnjF3kr+u8FoMEHnPOu8oS4BbaGak9r6GuetnQJLFWyBN09fS0FwO7rFfBx/ fQkw== X-Gm-Message-State: ALyK8tJfpmsx0LneS4iLoFTZsEcdK8e7EO/+OWFp3C7JMcgtWJ0ZLbFyPIYRYeyRJItWhQ== X-Received: by 10.107.132.217 with SMTP id o86mr48067065ioi.18.1469062438757; Wed, 20 Jul 2016 17:53:58 -0700 (PDT) Received: from mail-it0-f46.google.com (mail-it0-f46.google.com. [209.85.214.46]) by smtp.gmail.com with ESMTPSA id w138sm326927itc.8.2016.07.20.17.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 17:53:58 -0700 (PDT) Received: by mail-it0-f46.google.com with SMTP id j124so3776148ith.1; Wed, 20 Jul 2016 17:53:58 -0700 (PDT) X-Received: by 10.36.192.9 with SMTP id u9mr5756615itf.86.1469062438330; Wed, 20 Jul 2016 17:53:58 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Wed, 20 Jul 2016 17:53:57 -0700 (PDT) In-Reply-To: <2986227.mkPmo6E96P@ralph.baldwin.cx> References: <201607202251.u6KMpX73042960@repo.freebsd.org> <2986227.mkPmo6E96P@ralph.baldwin.cx> From: Conrad Meyer Date: Wed, 20 Jul 2016 17:53:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303120 - head/sys/kern To: John Baldwin Cc: src-committers , 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, 21 Jul 2016 00:54:00 -0000 Sure =E2=80=94 r303122. Conrad On Wed, Jul 20, 2016 at 4:09 PM, John Baldwin wrote: > On Wednesday, July 20, 2016 10:51:33 PM Conrad E. Meyer wrote: >> Author: cem >> Date: Wed Jul 20 22:51:33 2016 >> New Revision: 303120 >> URL: https://svnweb.freebsd.org/changeset/base/303120 >> >> Log: >> imgact_elf: Rename the segment iterator to match reality >> >> The each_writable_segment routine evaluates segments on a slightly lit= tle more >> nuanced metric than simply "writable" or not. Rename the function to = more >> closely match its behavior (each_dumpable_segment). >> >> Suggested by: jhb >> Sponsored by: EMC / Isilon Storage Division > > Please do the same rename in gcore's elfcore.c as well. > > -- > John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 21 03:11: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 96BECB9E886; Thu, 21 Jul 2016 03:11:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AE591AA2; Thu, 21 Jul 2016 03:11:36 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6L3BZig041242; Thu, 21 Jul 2016 03:11:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L3BZH4041241; Thu, 21 Jul 2016 03:11:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607210311.u6L3BZH4041241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 03:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303123 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 03:11:36 -0000 Author: imp Date: Thu Jul 21 03:11:35 2016 New Revision: 303123 URL: https://svnweb.freebsd.org/changeset/base/303123 Log: Fix mismerge and include the nvme support. Also, print out the name of any CCB's functions that's not supported. MFC after: 1 week Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Jul 21 00:53:14 2016 (r303122) +++ head/sys/cam/cam_xpt.c Thu Jul 21 03:11:35 2016 (r303123) @@ -1033,6 +1033,8 @@ xpt_announce_periph(struct cam_periph *p else if (path->device->protocol == PROTO_SEMB) semb_print_ident( (struct sep_identify_data *)&path->device->ident_data); + else if (path->device->protocol == PROTO_NVME) + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); else printf("Unknown protocol device\n"); if (path->device->serial_num_len > 0) { @@ -1086,6 +1088,8 @@ xpt_denounce_periph(struct cam_periph *p else if (path->device->protocol == PROTO_SEMB) semb_print_ident_short( (struct sep_identify_data *)&path->device->ident_data); + else if (path->device->protocol == PROTO_NVME) + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); else printf("Unknown protocol device"); if (path->device->serial_num_len > 0) @@ -2516,6 +2520,10 @@ xpt_action_default(union ccb *start_ccb) if (start_ccb->ccb_h.func_code == XPT_ATA_IO) start_ccb->ataio.resid = 0; /* FALLTHROUGH */ + case XPT_NVME_IO: + if (start_ccb->ccb_h.func_code == XPT_NVME_IO) + start_ccb->nvmeio.resid = 0; + /* FALLTHROUGH */ case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: @@ -2655,6 +2663,8 @@ call_sim: cgd->inq_data = dev->inq_data; cgd->ident_data = dev->ident_data; cgd->inq_flags = dev->inq_flags; + cgd->nvme_data = dev->nvme_data; + cgd->nvme_cdata = dev->nvme_cdata; cgd->ccb_h.status = CAM_REQ_CMP; cgd->serial_num_len = dev->serial_num_len; if ((dev->serial_num_len > 0) @@ -3011,8 +3021,10 @@ call_sim: case XPT_TERM_IO: case XPT_ENG_INQ: /* XXX Implement */ - printf("%s: CCB type %#x not supported\n", __func__, - start_ccb->ccb_h.func_code); + xpt_print_path(start_ccb->ccb_h.path); + printf("%s: CCB type %#x %s not supported\n", __func__, + start_ccb->ccb_h.func_code, + xpt_action_name(start_ccb->ccb_h.func_code)); start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; if (start_ccb->ccb_h.func_code & XPT_FC_DEV_QUEUED) { xpt_done(start_ccb); @@ -3315,6 +3327,13 @@ xpt_run_devq(struct cam_devq *devq) ata_cmd_string(&work_ccb->ataio.cmd, cdb_str, sizeof(cdb_str)))); break; + case XPT_NVME_IO: + CAM_DEBUG(work_ccb->ccb_h.path, + CAM_DEBUG_CDB,("%s. NCB: %s\n", + nvme_op_string(&work_ccb->nvmeio.cmd), + nvme_cmd_string(&work_ccb->nvmeio.cmd, + cdb_str, sizeof(cdb_str)))); + break; default: break; } @@ -3904,6 +3923,9 @@ xpt_bus_register(struct cam_sim *sim, de case XPORT_SATA: new_bus->xport = ata_get_xport(); break; + case XPORT_NVME: + new_bus->xport = nvme_get_xport(); + break; default: new_bus->xport = &xport_default; break; From owner-svn-src-head@freebsd.org Thu Jul 21 03:11: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 8DD2CB9E88D; Thu, 21 Jul 2016 03:11:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60F581AA6; Thu, 21 Jul 2016 03:11:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6L3BaCm041286; Thu, 21 Jul 2016 03:11:36 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L3BadW041285; Thu, 21 Jul 2016 03:11:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607210311.u6L3BadW041285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 03:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303124 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 03:11:37 -0000 Author: imp Date: Thu Jul 21 03:11:36 2016 New Revision: 303124 URL: https://svnweb.freebsd.org/changeset/base/303124 Log: Fix mismerge and add NVME xport support to devstat (or rather, exclude it from SCSI). MFC after: 1 week Modified: head/sys/cam/cam_ccb.h Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Thu Jul 21 03:11:35 2016 (r303123) +++ head/sys/cam/cam_ccb.h Thu Jul 21 03:11:36 2016 (r303124) @@ -285,10 +285,11 @@ typedef enum { XPORT_NVME, /* NVMe over PCIe */ } cam_xport; +#define XPORT_IS_NVME(t) ((t) == XPORT_NVME) #define XPORT_IS_ATA(t) ((t) == XPORT_ATA || (t) == XPORT_SATA) #define XPORT_IS_SCSI(t) ((t) != XPORT_UNKNOWN && \ (t) != XPORT_UNSPECIFIED && \ - !XPORT_IS_ATA(t)) + !XPORT_IS_ATA(t) && !XPORT_IS_NVME(t)) #define XPORT_DEVSTAT_TYPE(t) (XPORT_IS_ATA(t) ? DEVSTAT_TYPE_IF_IDE : \ XPORT_IS_SCSI(t) ? DEVSTAT_TYPE_IF_SCSI : \ DEVSTAT_TYPE_IF_OTHER) From owner-svn-src-head@freebsd.org Thu Jul 21 03:11: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 78B8CB9E8B0; Thu, 21 Jul 2016 03:11:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 477851AED; Thu, 21 Jul 2016 03:11:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6L3Bd0f041375; Thu, 21 Jul 2016 03:11:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L3BdUV041373; Thu, 21 Jul 2016 03:11:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607210311.u6L3BdUV041373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 03:11:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303126 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 03:11:40 -0000 Author: imp Date: Thu Jul 21 03:11:39 2016 New Revision: 303126 URL: https://svnweb.freebsd.org/changeset/base/303126 Log: Actually import nvme_sim so the CAM attachment for NVME (nda) actually works. MFC after: 1 week Added: head/sys/dev/nvme/nvme_sim.c (contents, props changed) Modified: head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Thu Jul 21 03:11:37 2016 (r303125) +++ head/sys/dev/nvme/nvme_private.h Thu Jul 21 03:11:39 2016 (r303126) @@ -245,10 +245,6 @@ struct nvme_controller { struct mtx lock; - struct cam_sim *sim; - struct cam_path *path; - int cam_ref; - uint32_t ready_timeout_in_ms; bus_space_tag_t bus_tag; Added: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/nvme/nvme_sim.c Thu Jul 21 03:11:39 2016 (r303126) @@ -0,0 +1,400 @@ +/*- + * Copyright (c) 2016 Netflix, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include // Yes, this is wrong. +#include + +#include "nvme_private.h" + +#define ccb_accb_ptr spriv_ptr0 +#define ccb_ctrlr_ptr spriv_ptr1 +static void nvme_sim_action(struct cam_sim *sim, union ccb *ccb); +static void nvme_sim_poll(struct cam_sim *sim); + +#define sim2softc(sim) ((struct nvme_sim_softc *)cam_sim_softc(sim)) +#define sim2ns(sim) (sim2softc(sim)->s_ns) +#define sim2ctrlr(sim) (sim2softc(sim)->s_ctrlr) + +struct nvme_sim_softc +{ + struct nvme_controller *s_ctrlr; + struct nvme_namespace *s_ns; + struct cam_sim *s_sim; + struct cam_path *s_path; +}; + +static void +nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_completion *cpl) +{ + union ccb *ccb = (union ccb *)ccb_arg; + + /* + * Let the periph know the completion, and let it sort out what + * it means. Make our best guess, though for the status code. + */ + memcpy(&ccb->nvmeio.cpl, cpl, sizeof(*cpl)); + if (nvme_completion_is_error(cpl)) + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + else + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); +} + +static void +nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) +{ + struct ccb_nvmeio *nvmeio = &ccb->nvmeio; + struct nvme_request *req; + void *payload; + uint32_t size; + struct nvme_controller *ctrlr; + + ctrlr = sim2ctrlr(sim); + payload = nvmeio->data_ptr; + size = nvmeio->dxfer_len; + /* SG LIST ??? */ + if ((nvmeio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_BIO) + req = nvme_allocate_request_bio((struct bio *)payload, + nvme_sim_nvmeio_done, ccb); + else if (payload == NULL) + req = nvme_allocate_request_null(nvme_sim_nvmeio_done, ccb); + else + req = nvme_allocate_request_vaddr(payload, size, + nvme_sim_nvmeio_done, ccb); + + if (req == NULL) { + nvmeio->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_done(ccb); + return; + } + + memcpy(&req->cmd, &ccb->nvmeio.cmd, sizeof(ccb->nvmeio.cmd)); + + nvme_ctrlr_submit_io_request(ctrlr, req); + + ccb->ccb_h.status |= CAM_SIM_QUEUED; +} + +static void +nvme_sim_action(struct cam_sim *sim, union ccb *ccb) +{ + struct nvme_controller *ctrlr; + struct nvme_namespace *ns; + + CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, + ("nvme_sim_action: func= %#x\n", + ccb->ccb_h.func_code)); + + /* + * XXX when we support multiple namespaces in the base driver we'll need + * to revisit how all this gets stored and saved in the periph driver's + * reserved areas. Right now we store all three in the softc of the sim. + */ + ns = sim2ns(sim); + ctrlr = sim2ctrlr(sim); + + printf("Sim action: ctrlr %p ns %p\n", ctrlr, ns); + + mtx_assert(&ctrlr->lock, MA_OWNED); + + switch (ccb->ccb_h.func_code) { + case XPT_CALC_GEOMETRY: /* Calculate Geometry Totally nuts ? XXX */ + /* + * Only meaningful for old-school SCSI disks since only the SCSI + * da driver generates them. Reject all these that slip through. + */ + /*FALLTHROUGH*/ + case XPT_ABORT: /* Abort the specified CCB */ + case XPT_EN_LUN: /* Enable LUN as a target */ + case XPT_TARGET_IO: /* Execute target I/O request */ + case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */ + case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/ + /* + * Only target mode generates these, and only for SCSI. They are + * all invalid/unsupported for NVMe. + */ + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + case XPT_SET_TRAN_SETTINGS: + /* + * NVMe doesn't really have different transfer settings, but + * other parts of CAM think failure here is a big deal. + */ + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_PATH_INQ: /* Path routing inquiry */ + { + struct ccb_pathinq *cpi = &ccb->cpi; + + /* + * NVMe may have multiple LUNs on the same path. Current generation + * of NVMe devives support only a single name space. Multiple name + * space drives are coming, but it's unclear how we should report + * them up the stack. + */ + cpi->version_num = 1; + cpi->hba_inquiry = 0; + cpi->target_sprt = 0; + cpi->hba_misc = PIM_UNMAPPED /* | PIM_NOSCAN */; + cpi->hba_eng_cnt = 0; + cpi->max_target = 0; + cpi->max_lun = ctrlr->cdata.nn; + cpi->maxio = nvme_ns_get_max_io_xfer_size(ns); + cpi->initiator_id = 0; + cpi->bus_id = cam_sim_bus(sim); + cpi->base_transfer_speed = 4000000; /* 4 GB/s 4 lanes pcie 3 */ + strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strncpy(cpi->hba_vid, "NVMe", HBA_IDLEN); + strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->unit_number = cam_sim_unit(sim); + cpi->transport = XPORT_NVME; /* XXX XPORT_PCIE ? */ + cpi->transport_version = 1; /* XXX Get PCIe spec ? */ + cpi->protocol = PROTO_NVME; + cpi->protocol_version = NVME_REV_1; /* Groks all 1.x NVMe cards */ + cpi->xport_specific.nvme.nsid = ns->id; + cpi->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_GET_TRAN_SETTINGS: /* Get transport settings */ + { + struct ccb_trans_settings *cts; + struct ccb_trans_settings_nvme *nvmep; + struct ccb_trans_settings_nvme *nvmex; + + cts = &ccb->cts; + nvmex = &cts->xport_specific.nvme; + nvmep = &cts->proto_specific.nvme; + + nvmex->valid = CTS_NVME_VALID_SPEC; + nvmex->spec_major = 1; /* XXX read from card */ + nvmex->spec_minor = 2; + nvmex->spec_tiny = 0; + + nvmep->valid = CTS_NVME_VALID_SPEC; + nvmep->spec_major = 1; /* XXX read from card */ + nvmep->spec_minor = 2; + nvmep->spec_tiny = 0; + cts->transport = XPORT_NVME; + cts->protocol = PROTO_NVME; + cts->ccb_h.status = CAM_REQ_CMP; + break; + } + case XPT_TERM_IO: /* Terminate the I/O process */ + /* + * every driver handles this, but nothing generates it. Assume + * it's OK to just say 'that worked'. + */ + /*FALLTHROUGH*/ + case XPT_RESET_DEV: /* Bus Device Reset the specified device */ + case XPT_RESET_BUS: /* Reset the specified bus */ + /* + * NVMe doesn't really support physically resetting the bus. It's part + * of the bus scanning dance, so return sucess to tell the process to + * proceed. + */ + ccb->ccb_h.status = CAM_REQ_CMP; + break; + case XPT_NVME_IO: /* Execute the requested I/O operation */ + nvme_sim_nvmeio(sim, ccb); + return; /* no done */ + default: + ccb->ccb_h.status = CAM_REQ_INVALID; + break; + } + xpt_done(ccb); +} + +static void +nvme_sim_poll(struct cam_sim *sim) +{ + + nvme_ctrlr_intx_handler(sim2ctrlr(sim)); +} + +static void * +nvme_sim_new_controller(struct nvme_controller *ctrlr) +{ + struct cam_devq *devq; + int max_trans; + int unit; + struct nvme_sim_softc *sc = NULL; + + max_trans = 256;/* XXX not so simple -- must match queues */ + unit = device_get_unit(ctrlr->dev); + devq = cam_simq_alloc(max_trans); + if (devq == NULL) + return NULL; + + sc = malloc(sizeof(*sc), M_NVME, M_ZERO | M_WAITOK); + + sc->s_ctrlr = ctrlr; + + sc->s_sim = cam_sim_alloc(nvme_sim_action, nvme_sim_poll, + "nvme", sc, unit, &ctrlr->lock, max_trans, max_trans, devq); + if (sc->s_sim == NULL) { + printf("Failed to allocate a sim\n"); + cam_simq_free(devq); + free(sc, M_NVME); + return NULL; + } + + return sc; +} + +static void +nvme_sim_rescan_target(struct nvme_controller *ctrlr, struct cam_path *path) +{ + union ccb *ccb; + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + printf("unable to alloc CCB for rescan\n"); + return; + } + + if (xpt_clone_path(&ccb->ccb_h.path, path) != CAM_REQ_CMP) { + printf("unable to copy path for rescan\n"); + xpt_free_ccb(ccb); + return; + } + + xpt_rescan(ccb); +} + +static void * +nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) +{ + struct nvme_sim_softc *sc = sc_arg; + struct nvme_controller *ctrlr = sc->s_ctrlr; + int i; + + sc->s_ns = ns; + + printf("Our SIM's softc %p ctrlr %p ns %p\n", sc, ctrlr, ns); + + /* + * XXX this is creating one bus per ns, but it should be one + * XXX target per controller, and one LUN per namespace. + * XXX Current drives only support one NS, so there's time + * XXX to fix it later when new drives arrive. + * + * XXX I'm pretty sure the xpt_bus_register() call below is + * XXX like super lame and it really belongs in the sim_new_ctrlr + * XXX callback. Then the create_path below would be pretty close + * XXX to being right. Except we should be per-ns not per-ctrlr + * XXX data. + */ + + mtx_lock(&ctrlr->lock); +/* Create bus */ + + /* + * XXX do I need to lock ctrlr->lock ? + * XXX do I need to lock the path? + * ata and scsi seem to in their code, but their discovery is + * somewhat more asynchronous. We're only every called one at a + * time, and nothing is in parallel. + */ + + i = 0; + if (xpt_bus_register(sc->s_sim, ctrlr->dev, 0) != CAM_SUCCESS) + goto error; + i++; + if (xpt_create_path(&sc->s_path, /*periph*/NULL, cam_sim_path(sc->s_sim), + 1, ns->id) != CAM_REQ_CMP) + goto error; + i++; + + sc->s_path->device->nvme_data = nvme_ns_get_data(ns); + sc->s_path->device->nvme_cdata = nvme_ctrlr_get_data(ns->ctrlr); + +/* Scan bus */ + printf("Initiate rescan of the bus\n"); + nvme_sim_rescan_target(ctrlr, sc->s_path); + + mtx_unlock(&ctrlr->lock); + + return ns; + +error: + switch (i) { + case 2: + xpt_free_path(sc->s_path); + case 1: + xpt_bus_deregister(cam_sim_path(sc->s_sim)); + case 0: + cam_sim_free(sc->s_sim, /*free_devq*/TRUE); + } + mtx_unlock(&ctrlr->lock); + return NULL; +} + +static void +nvme_sim_controller_fail(void *ctrlr_arg) +{ + /* XXX cleanup XXX */ +} + +struct nvme_consumer *consumer_cookie; + +static void +nvme_sim_init(void) +{ + + consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, + nvme_sim_new_controller, NULL, nvme_sim_controller_fail); +} + +SYSINIT(nvme_sim_register, SI_SUB_DRIVERS, SI_ORDER_ANY, + nvme_sim_init, NULL); + +static void +nvme_sim_uninit(void) +{ + /* XXX Cleanup */ + + nvme_unregister_consumer(consumer_cookie); +} + +SYSUNINIT(nvme_sim_unregister, SI_SUB_DRIVERS, SI_ORDER_ANY, + nvme_sim_uninit, NULL); From owner-svn-src-head@freebsd.org Thu Jul 21 03:11: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 B037DB9E898; Thu, 21 Jul 2016 03:11:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D7251AAC; Thu, 21 Jul 2016 03:11:38 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6L3BbQA041331; Thu, 21 Jul 2016 03:11:37 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L3Bbap041330; Thu, 21 Jul 2016 03:11:37 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607210311.u6L3Bbap041330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 03:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303125 - head/sys/cam/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 03:11:38 -0000 Author: imp Date: Thu Jul 21 03:11:37 2016 New Revision: 303125 URL: https://svnweb.freebsd.org/changeset/base/303125 Log: Remove some bogus comments and printfs. Also, we can't cam_periph_releaes_locked() at the end of nvme_probe_start because we hit an assertion which may be bogus. Instead, leak a periph until we sort it out. Since these devices don't arrive and depart often, so this is the lessor of two evils. MFC after: 1 week Modified: head/sys/cam/nvme/nvme_xpt.c Modified: head/sys/cam/nvme/nvme_xpt.c ============================================================================== --- head/sys/cam/nvme/nvme_xpt.c Thu Jul 21 03:11:36 2016 (r303124) +++ head/sys/cam/nvme/nvme_xpt.c Thu Jul 21 03:11:37 2016 (r303125) @@ -163,13 +163,14 @@ static struct xpt_xport nvme_xport = { struct xpt_xport * nvme_get_xport(void) { + return (&nvme_xport); } static void nvme_probe_periph_init() { - printf("nvme cam probe device init\n"); + } static cam_status @@ -297,18 +298,15 @@ nvme_probe_start(struct cam_periph *peri start_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(start_ccb); } -// XXX not sure I need this -// XXX unlike other XPTs, we never freeze the queue since we have a super-simple -// XXX state machine - /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. -- did we really do this? */ -// cam_release_devq(path, 0, 0, 0, FALSE); cam_periph_invalidate(periph); - cam_periph_release_locked(periph); + /* Can't release periph since we hit a (possibly bogus) assertion */ +// cam_periph_release_locked(periph); } static void nvme_probe_cleanup(struct cam_periph *periph) { + free(periph->softc, M_CAMXPT); } From owner-svn-src-head@freebsd.org Thu Jul 21 05:30: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 89584B9F523; Thu, 21 Jul 2016 05:30: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 45CFC1E78; Thu, 21 Jul 2016 05:30: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 u6L5UVRt090511; Thu, 21 Jul 2016 05:30:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L5UV1l090509; Thu, 21 Jul 2016 05:30:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607210530.u6L5UV1l090509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 21 Jul 2016 05:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303127 - 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, 21 Jul 2016 05:30:32 -0000 Author: sephe Date: Thu Jul 21 05:30:31 2016 New Revision: 303127 URL: https://svnweb.freebsd.org/changeset/base/303127 Log: hyperv/vmbus: Save event flag location and evet flag mask. This avoids unnecessary access to the vmbus_softc struct on sending path. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7257 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 03:11:39 2016 (r303126) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 05:30:31 2016 (r303127) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); @@ -77,18 +76,13 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) }; -/** - * @brief Trigger an event notification on the specified channel +/* + * Notify host that there are data pending on our TX bufring. */ -static void -vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) +static __inline void +vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = chan->ch_vmbus; - uint32_t chanid = chan->ch_id; - - atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - + atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask); if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask); else @@ -1120,6 +1114,13 @@ vmbus_chan_msgproc_choffer(struct vmbus_ 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } + /* + * Setup event flag. + */ + chan->ch_evtflag = + &sc->vmbus_tx_evtflags[chan->ch_id >> VMBUS_EVTFLAG_SHIFT]; + chan->ch_evtflag_mask = 1UL << (chan->ch_id & VMBUS_EVTFLAG_MASK); + /* Select default cpu for this channel. */ vmbus_chan_cpu_default(chan); Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 03:11:39 2016 (r303126) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:30:31 2016 (r303127) @@ -77,13 +77,20 @@ typedef struct hv_vmbus_channel { uint32_t ch_id; /* channel id */ /* - * These are based on the offer_msg.monitor_id. + * These are based on the vmbus_chanmsg_choffer.chm_montrig. * Save it here for easy access. */ - volatile uint32_t *ch_montrig; /* MNF trigger */ + volatile uint32_t *ch_montrig; /* MNF trigger loc. */ uint32_t ch_montrig_mask;/* MNF trig mask */ /* + * These are based on the vmbus_chanmsg_choffer.chm_chanid. + * Save it here for easy access. + */ + volatile u_long *ch_evtflag; /* event flag loc. */ + u_long ch_evtflag_mask;/* event flag */ + + /* * TX bufring; at the beginning of ch_bufring. */ hv_vmbus_ring_buffer_info ch_txbr; From owner-svn-src-head@freebsd.org Thu Jul 21 05:38: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 298EDB9FF4C; Thu, 21 Jul 2016 05:38:07 +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 E02591651; Thu, 21 Jul 2016 05:38:06 +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 u6L5c603094225; Thu, 21 Jul 2016 05:38:06 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L5c6WC094223; Thu, 21 Jul 2016 05:38:06 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607210538.u6L5c6WC094223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 21 Jul 2016 05:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303128 - 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, 21 Jul 2016 05:38:07 -0000 Author: sephe Date: Thu Jul 21 05:38:05 2016 New Revision: 303128 URL: https://svnweb.freebsd.org/changeset/base/303128 Log: hyperv/vmbus: Reorder channel fields. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7258 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 05:30:31 2016 (r303127) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 05:38:05 2016 (r303128) @@ -83,7 +83,7 @@ static __inline void vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan) { atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask); - if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) + if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF) atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask); else hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); @@ -95,7 +95,7 @@ vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARG struct hv_vmbus_channel *chan = arg1; int mnf = 0; - if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) + if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF) mnf = 1; return sysctl_handle_int(oidp, &mnf, 0, req); } @@ -1102,7 +1102,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ /* * Setup MNF stuffs. */ - chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_txflags |= VMBUS_CHAN_TXF_HASMNF; trig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; if (trig_idx >= VMBUS_MONTRIGS_MAX) Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:30:31 2016 (r303127) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:38:05 2016 (r303128) @@ -71,42 +71,63 @@ typedef struct { } hv_vmbus_ring_buffer_info; typedef struct hv_vmbus_channel { - device_t ch_dev; - struct vmbus_softc *ch_vmbus; + /* + * NOTE: + * Fields before ch_txbr are only accessed on this channel's + * target CPU. + */ uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ - uint32_t ch_id; /* channel id */ + + /* + * RX bufring; immediately following ch_txbr. + */ + hv_vmbus_ring_buffer_info ch_rxbr; + + struct taskqueue *ch_tq; + struct task ch_task; + vmbus_chan_callback_t ch_cb; + void *ch_cbarg; + + /* + * TX bufring; at the beginning of ch_bufring. + * + * NOTE: + * Put TX bufring and the following MNF/evtflag to a new + * cacheline, since they will be accessed on all CPUs by + * locking ch_txbr first. + * + * XXX + * TX bufring and following MNF/evtflags do _not_ fit in + * one 64B cacheline. + */ + hv_vmbus_ring_buffer_info ch_txbr __aligned(CACHE_LINE_SIZE); + uint32_t ch_txflags; /* VMBUS_CHAN_TXF_ */ /* * These are based on the vmbus_chanmsg_choffer.chm_montrig. * Save it here for easy access. */ - volatile uint32_t *ch_montrig; /* MNF trigger loc. */ uint32_t ch_montrig_mask;/* MNF trig mask */ + volatile uint32_t *ch_montrig; /* MNF trigger loc. */ /* * These are based on the vmbus_chanmsg_choffer.chm_chanid. * Save it here for easy access. */ - volatile u_long *ch_evtflag; /* event flag loc. */ u_long ch_evtflag_mask;/* event flag */ + volatile u_long *ch_evtflag; /* event flag loc. */ /* - * TX bufring; at the beginning of ch_bufring. - */ - hv_vmbus_ring_buffer_info ch_txbr; - /* - * RX bufring; immediately following ch_txbr. + * Rarely used fields. */ - hv_vmbus_ring_buffer_info ch_rxbr; - - 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; + uint32_t ch_id; /* channel id */ + device_t ch_dev; + struct vmbus_softc *ch_vmbus; + int ch_cpuid; /* owner cpu */ /* * Virtual cpuid for ch_cpuid; it is used to communicate cpuid @@ -141,11 +162,10 @@ typedef struct hv_vmbus_channel { struct hyperv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; -} hv_vmbus_channel; +} hv_vmbus_channel __aligned(CACHE_LINE_SIZE); #define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) -#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 @@ -156,6 +176,8 @@ typedef struct hv_vmbus_channel { */ #define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 +#define VMBUS_CHAN_TXF_HASMNF 0x0001 + #define VMBUS_CHAN_ST_OPENED_SHIFT 0 #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) From owner-svn-src-head@freebsd.org Thu Jul 21 05:46: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 3ED6BB9D400; Thu, 21 Jul 2016 05:46: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 011781BB4; Thu, 21 Jul 2016 05:46: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 u6L5kR2S097773; Thu, 21 Jul 2016 05:46:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L5kQ5N097769; Thu, 21 Jul 2016 05:46:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607210546.u6L5kQ5N097769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 21 Jul 2016 05:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303129 - 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, 21 Jul 2016 05:46:28 -0000 Author: sephe Date: Thu Jul 21 05:46:26 2016 New Revision: 303129 URL: https://svnweb.freebsd.org/changeset/base/303129 Log: hyperv/vmbus: Shuffle function declaration and macro definition. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7259 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/vmbus/vmbus_chanvar.h 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 21 05:38:05 2016 (r303128) +++ head/sys/dev/hyperv/include/hyperv.h Thu Jul 21 05:46:26 2016 (r303129) @@ -58,23 +58,6 @@ #include #include -/* - * VMBUS version is 32 bit, upper 16 bit for major_number and lower - * 16 bit for minor_number. - * - * 0.13 -- Windows Server 2008 - * 1.1 -- Windows 7 - * 2.4 -- Windows 8 - * 3.0 -- Windows 8.1 - */ -#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) - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -83,8 +66,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -struct hv_vmbus_channel; - /** * @brief Get physical address from virtual */ @@ -96,10 +77,4 @@ 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/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Thu Jul 21 05:38:05 2016 (r303128) +++ head/sys/dev/hyperv/include/vmbus.h Thu Jul 21 05:46:26 2016 (r303129) @@ -32,6 +32,23 @@ #include /* + * VMBUS version is 32 bit, upper 16 bit for major_number and lower + * 16 bit for minor_number. + * + * 0.13 -- Windows Server 2008 + * 1.1 -- Windows 7 + * 2.4 -- Windows 8 + * 3.0 -- Windows 8.1 + */ +#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) + +/* * GPA stuffs. */ struct vmbus_gpa_range { @@ -92,6 +109,12 @@ struct hyperv_guid; typedef void (*vmbus_chan_callback_t)(struct hv_vmbus_channel *, void *); +static __inline struct hv_vmbus_channel * +vmbus_get_channel(device_t dev) +{ + return device_get_ivars(dev); +} + int vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg); Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:38:05 2016 (r303128) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:46:26 2016 (r303129) @@ -181,4 +181,12 @@ typedef struct hv_vmbus_channel { #define VMBUS_CHAN_ST_OPENED_SHIFT 0 #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) +struct vmbus_softc; +struct vmbus_message; + +void vmbus_event_proc(struct vmbus_softc *, int); +void vmbus_event_proc_compat(struct vmbus_softc *, int); +void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_chan_destroy_all(struct vmbus_softc *); + #endif /* !_VMBUS_CHANVAR_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 21 05:38:05 2016 (r303128) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 21 05:46:26 2016 (r303129) @@ -143,16 +143,11 @@ struct trapframe; struct vmbus_message; 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 *); - -void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); -void vmbus_chan_destroy_all(struct vmbus_softc *); +uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); struct vmbus_msghc *vmbus_msghc_get(struct vmbus_softc *, size_t); void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); @@ -164,6 +159,4 @@ 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); -uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); - #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-head@freebsd.org Thu Jul 21 06: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 B07DDB9D9CB; Thu, 21 Jul 2016 06:06:12 +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 6964E1731; Thu, 21 Jul 2016 06:06:12 +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 u6L66BHD005437; Thu, 21 Jul 2016 06:06:11 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L66BFx005435; Thu, 21 Jul 2016 06:06:11 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607210606.u6L66BFx005435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 21 Jul 2016 06:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303130 - in head: . share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 06:06:12 -0000 Author: bdrewery Date: Thu Jul 21 06:06:11 2016 New Revision: 303130 URL: https://svnweb.freebsd.org/changeset/base/303130 Log: Add LOCAL_XTOOL_DIRS to add into cross-tools. Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile.inc1 head/share/man/man7/build.7 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Jul 21 05:46:26 2016 (r303129) +++ head/Makefile.inc1 Thu Jul 21 06:06:11 2016 (r303130) @@ -22,6 +22,8 @@ # to be created before files are installed # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools # list +# LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the +# cross-tools target # METALOG="path to metadata log" to write permission and ownership # when NO_ROOT is set. (default: ${DESTDIR}/METALOG) # TARGET="machine" to crossbuild world for a different machine type @@ -1815,6 +1817,7 @@ _usb_tools= sys/boot/usb/tools cross-tools: .MAKE .PHONY .for _tool in \ + ${LOCAL_XTOOL_DIRS} \ ${_clang_libs} \ ${_clang} \ ${_binutils} \ Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Thu Jul 21 05:46:26 2016 (r303129) +++ head/share/man/man7/build.7 Thu Jul 21 06:06:11 2016 (r303130) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 28, 2016 +.Dd July 20, 2016 .Dt BUILD 7 .Os .Sh NAME @@ -462,6 +462,11 @@ If set, this variable supplies a list of the root of the source tree to build as part of the .Cm build-tools target. +.It Va LOCAL_XTOOL_DIRS +If set, this variable supplies a list of additional directories relative to +the root of the source tree to build as part of the +.Cm cross-tools +target. .It Va PORTS_MODULES A list of ports with kernel modules that should be built and installed as part of the From owner-svn-src-head@freebsd.org Thu Jul 21 06: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 2895CB9DA59; Thu, 21 Jul 2016 06:09: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 E9F2318E7; Thu, 21 Jul 2016 06:09: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 u6L69na9005600; Thu, 21 Jul 2016 06:09:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L69lYK005582; Thu, 21 Jul 2016 06:09:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607210609.u6L69lYK005582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 21 Jul 2016 06:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303131 - 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, 21 Jul 2016 06:09:50 -0000 Author: sephe Date: Thu Jul 21 06:09:47 2016 New Revision: 303131 URL: https://svnweb.freebsd.org/changeset/base/303131 Log: hyperv: hv_vmbus_channel -> vmbus_channel MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7260 Modified: head/sys/dev/hyperv/include/vmbus.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.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.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/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/include/vmbus.h Thu Jul 21 06:09:47 2016 (r303131) @@ -104,56 +104,56 @@ struct vmbus_chanpkt_rxbuf { #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 -struct hv_vmbus_channel; +struct vmbus_channel; struct hyperv_guid; -typedef void (*vmbus_chan_callback_t)(struct hv_vmbus_channel *, void *); +typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); -static __inline struct hv_vmbus_channel * +static __inline struct vmbus_channel * vmbus_get_channel(device_t dev) { return device_get_ivars(dev); } -int vmbus_chan_open(struct hv_vmbus_channel *chan, +int vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg); -void vmbus_chan_close(struct hv_vmbus_channel *chan); +void vmbus_chan_close(struct vmbus_channel *chan); -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, +int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); -int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, +int vmbus_chan_gpadl_disconnect(struct 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_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); -void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on); - -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); +void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct vmbus_channel *chan); +struct vmbus_channel * + vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on); + +struct vmbus_channel ** + vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_subchan_rel(struct vmbus_channel **subchan, int subchan_cnt); +void vmbus_subchan_drain(struct vmbus_channel *pri_chan); -int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, +int vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); -int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, +int vmbus_chan_recv_pkt(struct vmbus_channel *chan, struct vmbus_chanpkt_hdr *pkt, int *pktlen); -int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, +int vmbus_chan_send(struct 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, +int vmbus_chan_send_sglist(struct 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, +int vmbus_chan_send_prplist(struct vmbus_channel *chan, struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, uint64_t xactid); -uint32_t vmbus_chan_id(const struct hv_vmbus_channel *chan); -uint32_t vmbus_chan_subidx(const struct hv_vmbus_channel *chan); -bool vmbus_chan_is_primary(const struct hv_vmbus_channel *chan); +uint32_t vmbus_chan_id(const struct vmbus_channel *chan); +uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan); +bool vmbus_chan_is_primary(const struct vmbus_channel *chan); const struct hyperv_guid * - vmbus_chan_guid_inst(const struct hv_vmbus_channel *chan); + vmbus_chan_guid_inst(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Jul 21 06:09:47 2016 (r303131) @@ -54,7 +54,7 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static void hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, +static void hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr); 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 *); @@ -62,11 +62,11 @@ 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 *, const struct vmbus_chanpkt_hdr *pkt); -static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, + struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); +static void hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, - struct hn_rx_ring *rxr, struct hv_vmbus_channel *chan, + struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); /* @@ -639,7 +639,7 @@ hv_nv_disconnect_from_vsp(netvsc_dev *ne } void -hv_nv_subchan_attach(struct hv_vmbus_channel *chan, struct hn_rx_ring *rxr) +hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr) { KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), ("chan%u subidx %u, rxr%d mismatch", @@ -658,7 +658,7 @@ netvsc_dev * hv_nv_on_device_add(struct hn_softc *sc, void *additional_info, struct hn_rx_ring *rxr) { - struct hv_vmbus_channel *chan = sc->hn_prichan; + struct vmbus_channel *chan = sc->hn_prichan; netvsc_dev *net_dev; int ret = 0; @@ -735,7 +735,7 @@ hv_nv_on_device_remove(struct hn_softc * * Net VSC on send completion */ static void -hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, +hv_nv_on_send_completion(netvsc_dev *net_dev, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { const nvsp_msg *nvsp_msg_pkt; @@ -799,7 +799,7 @@ hv_nv_on_send_completion(netvsc_dev *net * Returns 0 on success, non-zero on failure. */ int -hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt) +hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt) { nvsp_msg send_msg; int ret; @@ -838,7 +838,7 @@ hv_nv_on_send(struct hv_vmbus_channel *c */ static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, - struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) + struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; const nvsp_msg *nvsp_msg_pkt; @@ -894,7 +894,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * Send a receive completion packet to RNDIS device (ie NetVsp) */ static void -hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, +hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, uint32_t status) { nvsp_msg rx_comp_msg; @@ -969,7 +969,7 @@ hv_nv_send_table(struct hn_softc *sc, co * Net VSC on channel callback */ static void -hv_nv_on_channel_callback(struct hv_vmbus_channel *chan, void *xrxr) +hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr) { struct hn_rx_ring *rxr = xrxr; struct hn_softc *sc = rxr->hn_ifp->if_softc; Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Jul 21 06:09:47 2016 (r303131) @@ -1082,9 +1082,9 @@ typedef struct netvsc_dev_ { uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; -struct hv_vmbus_channel; +struct vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); +typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) @@ -1207,7 +1207,7 @@ struct hn_tx_ring { struct mtx hn_tx_lock; struct hn_softc *hn_sc; - struct hv_vmbus_channel *hn_chan; + struct vmbus_channel *hn_chan; int hn_direct_tx_size; int hn_tx_chimney_size; @@ -1246,7 +1246,7 @@ typedef struct hn_softc { /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; netvsc_dev *net_dev; - struct hv_vmbus_channel *hn_prichan; + struct vmbus_channel *hn_prichan; int hn_rx_ring_cnt; int hn_rx_ring_inuse; @@ -1273,9 +1273,9 @@ netvsc_dev *hv_nv_on_device_add(struct h void *additional_info, struct hn_rx_ring *rxr); 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_on_send(struct vmbus_channel *chan, netvsc_packet *pkt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); -void hv_nv_subchan_attach(struct hv_vmbus_channel *chan, +void hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr); #endif /* __HV_NET_VSC_H__ */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 21 06:09:47 2016 (r303131) @@ -340,8 +340,8 @@ static int hn_encap(struct hn_tx_ring *, static void hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); 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_channel_attach(struct hn_softc *, struct vmbus_channel *); +static void hn_subchan_attach(struct hn_softc *, struct vmbus_channel *); static void hn_subchan_setup(struct hn_softc *); static int hn_transmit(struct ifnet *, struct mbuf *); @@ -780,7 +780,7 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) +hn_tx_done(struct vmbus_channel *chan, void *xpkt) { netvsc_packet *packet = xpkt; struct hn_txdesc *txd; @@ -2911,7 +2911,7 @@ hn_xmit_txeof_taskfunc(void *xtxr, int p } static void -hn_channel_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) +hn_channel_attach(struct hn_softc *sc, struct vmbus_channel *chan) { struct hn_rx_ring *rxr; int idx; @@ -2950,7 +2950,7 @@ hn_channel_attach(struct hn_softc *sc, s } static void -hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) +hn_subchan_attach(struct hn_softc *sc, struct vmbus_channel *chan) { KASSERT(!vmbus_chan_is_primary(chan), @@ -2961,7 +2961,7 @@ hn_subchan_attach(struct hn_softc *sc, s static void hn_subchan_setup(struct hn_softc *sc) { - struct hv_vmbus_channel **subchans; + struct vmbus_channel **subchans; int subchan_cnt = sc->net_dev->num_channel - 1; int i; @@ -2970,7 +2970,7 @@ hn_subchan_setup(struct hn_softc *sc) /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { - struct hv_vmbus_channel *subchan = subchans[i]; + struct vmbus_channel *subchan = subchans[i]; /* NOTE: Calling order is critical. */ hn_subchan_attach(sc, subchan); Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_rndis.h Thu Jul 21 06:09:47 2016 (r303131) @@ -1082,7 +1082,6 @@ typedef struct rndismp_rx_bufs_info_ { /* * Externs */ -struct hv_vmbus_channel; struct hn_rx_ring; struct hn_tx_ring; Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Thu Jul 21 06:09:47 2016 (r303131) @@ -86,8 +86,8 @@ static int hv_rf_set_packet_filter(rndi static int hv_rf_init_device(rndis_device *device); static int hv_rf_open_device(rndis_device *device); static int hv_rf_close_device(rndis_device *device); -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); +static void hv_rf_on_send_request_completion(struct vmbus_channel *, void *context); +static void hv_rf_on_send_request_halt_completion(struct vmbus_channel *, void *context); int hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads); @@ -1243,7 +1243,7 @@ hv_rf_on_close(struct hn_softc *sc) * RNDIS filter on send request completion callback */ static void -hv_rf_on_send_request_completion(struct hv_vmbus_channel *chan __unused, +hv_rf_on_send_request_completion(struct vmbus_channel *chan __unused, void *context __unused) { } @@ -1252,7 +1252,7 @@ hv_rf_on_send_request_completion(struct * RNDIS filter on send request (halt only) completion callback */ static void -hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *chan __unused, +hv_rf_on_send_request_halt_completion(struct vmbus_channel *chan __unused, void *context) { rndis_request *request = context; Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h Thu Jul 21 06:09:47 2016 (r303131) @@ -111,7 +111,6 @@ typedef struct rndis_device_ { /* * Externs */ -struct hv_vmbus_channel; struct hn_softc; struct hn_rx_ring; Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Thu Jul 21 06:09:47 2016 (r303131) @@ -132,7 +132,7 @@ struct hv_storvsc_request { }; struct storvsc_softc { - struct hv_vmbus_channel *hs_chan; + struct vmbus_channel *hs_chan; LIST_HEAD(, hv_storvsc_request) hs_free_list; struct mtx hs_lock; struct storvsc_driver_props *hs_drv_props; @@ -148,7 +148,7 @@ struct storvsc_softc { struct hv_storvsc_request hs_reset_req; device_t hs_dev; - struct hv_vmbus_channel *hs_cpu2chan[MAXCPU]; + struct vmbus_channel *hs_cpu2chan[MAXCPU]; }; @@ -274,7 +274,7 @@ 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(struct hv_vmbus_channel *chan, void *xsc); +static void hv_storvsc_on_channel_callback(struct vmbus_channel *chan, void *xsc); static void hv_storvsc_on_iocompletion( struct storvsc_softc *sc, struct vstor_packet *vstor_packet, struct hv_storvsc_request *request); @@ -309,7 +309,7 @@ MODULE_DEPEND(storvsc, vmbus, 1, 1, 1); static void storvsc_subchan_attach(struct storvsc_softc *sc, - struct hv_vmbus_channel *new_channel) + struct vmbus_channel *new_channel) { struct vmstor_chan_props props; int ret = 0; @@ -334,7 +334,7 @@ storvsc_subchan_attach(struct storvsc_so static void storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_chans) { - struct hv_vmbus_channel **subchan; + struct vmbus_channel **subchan; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; int request_channels_cnt = 0; @@ -648,7 +648,7 @@ hv_storvsc_io_request(struct storvsc_sof struct hv_storvsc_request *request) { struct vstor_packet *vstor_packet = &request->vstor_packet; - struct hv_vmbus_channel* outgoing_channel = NULL; + struct vmbus_channel* outgoing_channel = NULL; int ret = 0; vstor_packet->flags |= REQUEST_COMPLETION_FLAG; @@ -765,7 +765,7 @@ hv_storvsc_rescan_target(struct storvsc_ } static void -hv_storvsc_on_channel_callback(struct hv_vmbus_channel *channel, void *xsc) +hv_storvsc_on_channel_callback(struct vmbus_channel *channel, void *xsc) { int ret = 0; struct storvsc_softc *sc = xsc; Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Thu Jul 21 06:09:47 2016 (r303131) @@ -49,7 +49,7 @@ static const struct hyperv_guid service_ * Process heartbeat message */ static void -hv_heartbeat_cb(struct hv_vmbus_channel *channel, void *context) +hv_heartbeat_cb(struct vmbus_channel *channel, void *context) { uint8_t* buf; int recvlen; Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Thu Jul 21 06:09:47 2016 (r303131) @@ -334,7 +334,7 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru /* 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; + struct vmbus_channel *chan; char buf[HYPERV_GUID_STRLEN]; /* @@ -616,7 +616,7 @@ static void hv_kvp_process_request(void *context, int pending) { uint8_t *kvp_buf; - struct hv_vmbus_channel *channel; + struct vmbus_channel *channel; uint32_t recvlen = 0; uint64_t requestid; struct hv_vmbus_icmsg_hdr *icmsghdrp; @@ -711,7 +711,7 @@ hv_kvp_process_request(void *context, in * Callback routine that gets called whenever there is a message from host */ static void -hv_kvp_callback(struct hv_vmbus_channel *chan __unused, void *context) +hv_kvp_callback(struct vmbus_channel *chan __unused, void *context) { hv_kvp_sc *sc = (hv_kvp_sc*)context; /* Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Thu Jul 21 06:09:47 2016 (r303131) @@ -53,7 +53,7 @@ static const struct hyperv_guid service_ * Shutdown */ static void -hv_shutdown_cb(struct hv_vmbus_channel *channel, void *context) +hv_shutdown_cb(struct vmbus_channel *channel, void *context) { uint8_t* buf; uint8_t execute_shutdown = 0; Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Thu Jul 21 06:09:47 2016 (r303131) @@ -130,7 +130,7 @@ void hv_adj_guesttime(hv_timesync_sc *sc * Time Sync Channel message handler */ static void -hv_timesync_cb(struct hv_vmbus_channel *channel, void *context) +hv_timesync_cb(struct vmbus_channel *channel, void *context) { hv_vmbus_icmsg_hdr* icmsghdrp; uint32_t recvlen; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_util.c Thu Jul 21 06:09:47 2016 (r303131) @@ -77,7 +77,7 @@ int hv_util_attach(device_t dev) { struct hv_util_sc* softc; - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; int ret; softc = device_get_softc(dev); Modified: head/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/utilities/hv_util.h Thu Jul 21 06:09:47 2016 (r303131) @@ -39,7 +39,7 @@ typedef struct hv_util_sc { /* * function to process Hyper-V messages */ - void (*callback)(struct hv_vmbus_channel *, void *); + void (*callback)(struct vmbus_channel *, void *); uint8_t *receive_buffer; } hv_util_sc; Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/vmbus/vmbus.c Thu Jul 21 06:09:47 2016 (r303131) @@ -992,7 +992,7 @@ 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) { - const struct hv_vmbus_channel *chan; + const struct vmbus_channel *chan; char guidbuf[HYPERV_GUID_STRLEN]; chan = vmbus_get_channel(child); @@ -1013,7 +1013,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } int -vmbus_add_child(struct hv_vmbus_channel *chan) +vmbus_add_child(struct vmbus_channel *chan) { struct vmbus_softc *sc = chan->ch_vmbus; device_t parent = sc->vmbus_dev; @@ -1038,7 +1038,7 @@ done: } int -vmbus_delete_child(struct hv_vmbus_channel *chan) +vmbus_delete_child(struct vmbus_channel *chan) { int error; @@ -1082,7 +1082,7 @@ static int 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); + const struct vmbus_channel *chan = vmbus_get_channel(dev); if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hyperv_guid)) == 0) return 0; @@ -1132,7 +1132,7 @@ vmbus_doattach(struct vmbus_softc *sc) 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, + sizeof(struct vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); /* Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 06:09:47 2016 (r303131) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, - const struct hv_vmbus_channel *); + const struct vmbus_channel *); static void vmbus_chan_task(void *, int); static void vmbus_chan_task_nobatch(void *, int); @@ -80,7 +80,7 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M * Notify host that there are data pending on our TX bufring. */ static __inline void -vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan) +vmbus_chan_signal_tx(const struct vmbus_channel *chan) { atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask); if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF) @@ -92,7 +92,7 @@ vmbus_chan_signal_tx(const struct hv_vmb static int vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) { - struct hv_vmbus_channel *chan = arg1; + struct vmbus_channel *chan = arg1; int mnf = 0; if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF) @@ -101,7 +101,7 @@ vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARG } static void -vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan) +vmbus_chan_sysctl_create(struct vmbus_channel *chan) { struct sysctl_oid *ch_tree, *chid_tree, *br_tree; struct sysctl_ctx_list *ctx; @@ -193,7 +193,7 @@ vmbus_chan_sysctl_create(struct hv_vmbus } int -vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, +vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { struct vmbus_softc *sc = chan->ch_vmbus; @@ -325,7 +325,7 @@ failed: } int -vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, +vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl0) { struct vmbus_softc *sc = chan->ch_vmbus; @@ -455,7 +455,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) +vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan, uint32_t gpadl) { struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; @@ -492,7 +492,7 @@ vmbus_chan_gpadl_disconnect(struct hv_vm } static void -vmbus_chan_close_internal(struct hv_vmbus_channel *chan) +vmbus_chan_close_internal(struct vmbus_channel *chan) { struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; @@ -569,7 +569,7 @@ vmbus_chan_close_internal(struct hv_vmbu * are not being opened. */ void -vmbus_chan_close(struct hv_vmbus_channel *chan) +vmbus_chan_close(struct vmbus_channel *chan) { int subchan_cnt; @@ -586,7 +586,7 @@ vmbus_chan_close(struct hv_vmbus_channel */ subchan_cnt = chan->ch_subchan_cnt; if (subchan_cnt > 0) { - struct hv_vmbus_channel **subchan; + struct vmbus_channel **subchan; int i; subchan = vmbus_subchan_get(chan, subchan_cnt); @@ -600,7 +600,7 @@ vmbus_chan_close(struct hv_vmbus_channel } int -vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, +vmbus_chan_send(struct vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid) { struct vmbus_chanpkt pkt; @@ -633,7 +633,7 @@ vmbus_chan_send(struct hv_vmbus_channel } int -vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, +vmbus_chan_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid) { struct vmbus_chanpkt_sglist pkt; @@ -673,7 +673,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c } int -vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, +vmbus_chan_send_prplist(struct vmbus_channel *chan, struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, uint64_t xactid) { @@ -715,7 +715,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ } int -vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0, +vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen0, uint64_t *xactid) { struct vmbus_chanpkt_hdr pkt; @@ -745,7 +745,7 @@ vmbus_chan_recv(struct hv_vmbus_channel } int -vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, +vmbus_chan_recv_pkt(struct vmbus_channel *chan, struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) { struct vmbus_chanpkt_hdr pkt; @@ -773,7 +773,7 @@ vmbus_chan_recv_pkt(struct hv_vmbus_chan static void vmbus_chan_task(void *xchan, int pending __unused) { - struct hv_vmbus_channel *chan = xchan; + struct vmbus_channel *chan = xchan; vmbus_chan_callback_t cb = chan->ch_cb; void *cbarg = chan->ch_cbarg; @@ -806,7 +806,7 @@ vmbus_chan_task(void *xchan, int pending static void vmbus_chan_task_nobatch(void *xchan, int pending __unused) { - struct hv_vmbus_channel *chan = xchan; + struct vmbus_channel *chan = xchan; chan->ch_cb(chan, chan->ch_cbarg); } @@ -829,7 +829,7 @@ vmbus_event_flags_proc(struct vmbus_soft chid_base = f << VMBUS_EVTFLAG_SHIFT; while ((chid_ofs = ffsl(flags)) != 0) { - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; --chid_ofs; /* NOTE: ffsl is 1-based */ flags &= ~(1UL << chid_ofs); @@ -875,7 +875,7 @@ vmbus_event_proc_compat(struct vmbus_sof static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *sc, - const struct hv_vmbus_channel *chan) + const struct vmbus_channel *chan) { volatile int *flag_cnt_ptr; int flag_cnt; @@ -900,10 +900,10 @@ vmbus_chan_update_evtflagcnt(struct vmbu } } -static struct hv_vmbus_channel * +static struct vmbus_channel * vmbus_chan_alloc(struct vmbus_softc *sc) { - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); @@ -925,7 +925,7 @@ vmbus_chan_alloc(struct vmbus_softc *sc) } static void -vmbus_chan_free(struct hv_vmbus_channel *chan) +vmbus_chan_free(struct vmbus_channel *chan) { /* TODO: assert sub-channel list is empty */ /* TODO: asset no longer on the primary channel's sub-channel list */ @@ -936,10 +936,10 @@ vmbus_chan_free(struct hv_vmbus_channel } static int -vmbus_chan_add(struct hv_vmbus_channel *newchan) +vmbus_chan_add(struct vmbus_channel *newchan) { struct vmbus_softc *sc = newchan->ch_vmbus; - struct hv_vmbus_channel *prichan; + struct vmbus_channel *prichan; if (newchan->ch_id == 0) { /* @@ -1027,7 +1027,7 @@ vmbus_chan_add(struct hv_vmbus_channel * } void -vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu) +vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); @@ -1047,7 +1047,7 @@ vmbus_chan_cpu_set(struct hv_vmbus_chann } void -vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_rr(struct vmbus_channel *chan) { static uint32_t vmbus_chan_nextcpu; int cpu; @@ -1057,7 +1057,7 @@ vmbus_chan_cpu_rr(struct hv_vmbus_channe } static void -vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_default(struct vmbus_channel *chan) { /* * By default, pin the channel to cpu0. Devices having @@ -1072,7 +1072,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ const struct vmbus_message *msg) { const struct vmbus_chanmsg_choffer *offer; - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; int error; offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; @@ -1152,7 +1152,7 @@ vmbus_chan_msgproc_chrescind(struct vmbu const struct vmbus_message *msg) { const struct vmbus_chanmsg_chrescind *note; - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; if (note->chm_chanid > VMBUS_CHAN_MAX) { @@ -1177,7 +1177,7 @@ vmbus_chan_msgproc_chrescind(struct vmbu static void vmbus_chan_detach_task(void *xchan, int pending __unused) { - struct hv_vmbus_channel *chan = xchan; + struct vmbus_channel *chan = xchan; if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ @@ -1185,7 +1185,7 @@ vmbus_chan_detach_task(void *xchan, int /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->ch_vmbus; - struct hv_vmbus_channel *pri_chan = chan->ch_prichan; + struct vmbus_channel *pri_chan = chan->ch_prichan; struct vmbus_chanmsg_chfree *req; struct vmbus_msghc *mh; int error; @@ -1235,7 +1235,7 @@ remove: void vmbus_chan_destroy_all(struct vmbus_softc *sc) { - struct hv_vmbus_channel *chan; + struct vmbus_channel *chan; mtx_lock(&sc->vmbus_prichan_lock); while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { @@ -1249,7 +1249,7 @@ vmbus_chan_destroy_all(struct vmbus_soft mtx_lock(&sc->vmbus_prichan_lock); } bzero(sc->vmbus_chmap, - sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); + sizeof(struct vmbus_channel *) * VMBUS_CHAN_MAX); mtx_unlock(&sc->vmbus_prichan_lock); } @@ -1258,10 +1258,10 @@ vmbus_chan_destroy_all(struct vmbus_soft * be selected. * If no multi-channel, always select primary channel. */ -struct hv_vmbus_channel * -vmbus_chan_cpu2chan(struct hv_vmbus_channel *prichan, int cpu) +struct vmbus_channel * +vmbus_chan_cpu2chan(struct vmbus_channel *prichan, int cpu) { - struct hv_vmbus_channel *sel, *chan; + struct vmbus_channel *sel, *chan; uint32_t vcpu, sel_dist; KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpuid %d", cpu)); @@ -1312,13 +1312,13 @@ do { \ return sel; } -struct hv_vmbus_channel ** -vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +struct vmbus_channel ** +vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt) { - struct hv_vmbus_channel **ret, *chan; + struct vmbus_channel **ret, *chan; int i; - ret = malloc(subchan_cnt * sizeof(struct hv_vmbus_channel *), M_TEMP, + ret = malloc(subchan_cnt * sizeof(struct vmbus_channel *), M_TEMP, M_WAITOK); mtx_lock(&pri_chan->ch_subchan_lock); @@ -1344,14 +1344,14 @@ vmbus_subchan_get(struct hv_vmbus_channe } void -vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +vmbus_subchan_rel(struct vmbus_channel **subchan, int subchan_cnt __unused) { free(subchan, M_TEMP); } void -vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan) +vmbus_subchan_drain(struct vmbus_channel *pri_chan) { mtx_lock(&pri_chan->ch_subchan_lock); while (pri_chan->ch_subchan_cnt > 0) @@ -1375,7 +1375,7 @@ vmbus_chan_msgproc(struct vmbus_softc *s } void -vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on) +vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on) { if (!on) chan->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; @@ -1384,19 +1384,19 @@ vmbus_chan_set_readbatch(struct hv_vmbus } uint32_t -vmbus_chan_id(const struct hv_vmbus_channel *chan) +vmbus_chan_id(const struct vmbus_channel *chan) { return chan->ch_id; } uint32_t -vmbus_chan_subidx(const struct hv_vmbus_channel *chan) +vmbus_chan_subidx(const struct vmbus_channel *chan) { return chan->ch_subidx; } bool -vmbus_chan_is_primary(const struct hv_vmbus_channel *chan) +vmbus_chan_is_primary(const struct vmbus_channel *chan) { if (VMBUS_CHAN_ISPRIMARY(chan)) return true; @@ -1405,7 +1405,7 @@ vmbus_chan_is_primary(const struct hv_vm } const struct hyperv_guid * -vmbus_chan_guid_inst(const struct hv_vmbus_channel *chan) +vmbus_chan_guid_inst(const struct vmbus_channel *chan) { return &chan->ch_guid_inst; } Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 06:09:47 2016 (r303131) @@ -70,7 +70,7 @@ typedef struct { uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; -typedef struct hv_vmbus_channel { +struct vmbus_channel { /* * NOTE: * Fields before ch_txbr are only accessed on this channel's @@ -142,19 +142,19 @@ typedef struct hv_vmbus_channel { * channel. */ struct mtx ch_subchan_lock; - TAILQ_HEAD(, hv_vmbus_channel) ch_subchans; + TAILQ_HEAD(, 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 */ + TAILQ_ENTRY(vmbus_channel) ch_sublink; /* sub-channel link */ + struct vmbus_channel *ch_prichan; /* owner primary chan */ 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 */ + TAILQ_ENTRY(vmbus_channel) ch_prilink; /* primary chan link */ uint32_t ch_subidx; /* subchan index */ volatile uint32_t ch_stflags; /* atomic-op */ /* VMBUS_CHAN_ST_ */ @@ -162,7 +162,7 @@ typedef struct hv_vmbus_channel { struct hyperv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; -} hv_vmbus_channel __aligned(CACHE_LINE_SIZE); +} __aligned(CACHE_LINE_SIZE); #define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 21 06:06:11 2016 (r303130) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Thu Jul 21 06:09:47 2016 (r303131) @@ -86,7 +86,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ - struct hv_vmbus_channel **vmbus_chmap; + struct vmbus_channel **vmbus_chmap; struct vmbus_msghc_ctx *vmbus_msg_hc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; @@ -115,7 +115,7 @@ struct vmbus_softc { /* Primary channels */ struct mtx vmbus_prichan_lock; - TAILQ_HEAD(, hv_vmbus_channel) vmbus_prichans; + TAILQ_HEAD(, vmbus_channel) vmbus_prichans; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ @@ -138,14 +138,14 @@ vmbus_get_device(void) #define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field -struct hv_vmbus_channel; +struct vmbus_channel; struct trapframe; struct vmbus_message; struct vmbus_msghc; void vmbus_handle_intr(struct trapframe *); -int vmbus_add_child(struct hv_vmbus_channel *); -int vmbus_delete_child(struct hv_vmbus_channel *); +int vmbus_add_child(struct vmbus_channel *); +int vmbus_delete_child(struct vmbus_channel *); void vmbus_et_intr(struct trapframe *); uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); From owner-svn-src-head@freebsd.org Thu Jul 21 07:34: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 24288BA00AE; Thu, 21 Jul 2016 07:34:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mail.miracle.cz (mail.miracle.cz [193.84.128.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.miracle.cz", Issuer "Miracle Group Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B6FE147F; Thu, 21 Jul 2016 07:34:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from [193.84.128.50] (meloun.ad.miracle.cz [193.84.128.50]) by mail.miracle.cz (Postfix) with ESMTPSA id 95A523AC9B; Thu, 21 Jul 2016 09:34:39 +0200 (CEST) Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Nathan Whitehorn , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> From: Michal Meloun X-Enigmail-Draft-Status: N1110 Message-ID: <57907B0F.9070204@FreeBSD.org> Date: Thu, 21 Jul 2016 09:34:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.miracle.cz); Thu, 21 Jul 2016 09:34:39 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Thu, 21 Jul 2016 07:34:43 -0000 Dne 20.07.2016 v 17:45 Nathan Whitehorn napsal(a): > > > On 07/20/16 04:28, Michal Meloun wrote: >> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>> >>> >>> On 07/19/16 04:13, Michal Meloun wrote: >>>> Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): >>>> Hi Nathan, >>>> I’m afraid that skra is on vacation, for next 2 weeks (at minimum), so >>>> please don’t expect quick response. >>>> >>>>> Could you please describe what this change is in more detail? >>>> Short description is appended. >>>> >>>>> It breaks a lot of encapsulations we have worked very hard to >>>>> maintain, >>>>> moves ARM code into MI parts of the kernel, and the OFW parts violate >>>>> IEEE 1275 (the Open Firmware standard). In particular, there is no >>>>> guarantee that the interrupts for a newbus (or OF) device are >>>>> encoded in >>>>> a property called "interrupts" (or, indeed, in any property at >>>>> all) on >>>>> that node and there are many, many device trees where that is not the >>>>> case (e.g. ones with interrupt maps, as well as Apple hardware). By >>>>> putting that knowledge into the OF root bus device, which we have >>>>> tried >>>>> to keep it out of, this enforces a standard that doesn't actually >>>>> exist. >>>> Imho, this patch doesn’t change anything in this area. Only >>>> handling of >>>> “interrupts” property is changed, all other cases are unchanged (I >>>> hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. >>> >>> But "interrupts" isn't a generic part of OF. This makes it one, >>> incorrectly. >> How? Can you be little more exact ? > > Because it puts knowledge into ofwbus that expects that children at > arbitrary levels of nesting have interrupts defined by an "interrupts" > property. You could patch this through on sub-devices, of course, but > that's already done correctly by the existing ofw_bus_map_intr() code > in a much more robust way that doesn't involve trying to guess how > sub-buses and devices have chosen to allocate resources. Why reinvent > the wheel all the way through the bus hierarchy? Nope, the code only expect that „interrupts" property is default way hot to get interrupt description. Any device or bus in the hierarchy can fill appropriate resource list, or terminate call at any level. > >>> >>>> >>>>> I'm hesitant to ask for reversion on something that landed 6 weeks >>>>> ago >>>>> without me noticing, but this needs a lot more architectural work >>>>> before >>>>> any parts of the kernel should use it. >>>>> -Nathan >>>> I think that it’s too late. This patch series consist of r301451 >>>> (https://reviews.freebsd.org/D6632), >>>> r301453, r301539 and 301543. And new GPIO interrupts are currently >>>> used >>>> (by in tree drivers or in development trees). >>> >>> Well, then we need in-place rearchitecture. >>> >>>> >>>> >>>> The root of problem is that standard way of delivering interrupt >>>> resource to consumer driver doesn’t works in OFW world. >>>> >>>> So we have some fact: >>>> - the format of interrupt property is dependent of interrupt >>>> controller and only interrupt controller can parse it. >>>> - the interrupt property can have more data than just interrupt >>>> number. >>>> - single interrupt controller must be able to handle multiple >>>> format of interrupt description. >>>> >>>> In pre-patchset era, simplebus enumerates children and attempts to set >>>> memory and interrupts to resource list for them. But the interrupt >>>> controllers are not yet populated so nobody can parse interrupt >>>> property. Moreover, in all cases (parsed or not), we cannot store >>>> complete interrupt description into resource list. >>> >>> We have done this for many years on PowerPC and sparc64 with delayed >>> configuration of interrupts and a look-up table. This handles >>> complicated bus configurations better than this code and requires no >>> changes outside of a few MD files. That is why the (now partially >>> duplicated) OFW_BUS_MAP_INTR() function exists. That one also has >>> the benefit of still working when used in conjunction with, e.g., >>> devices with an interrupt-map-mask property. >>> >>>> >>>> The patch simply postpones reading of interrupt property to >>>> bus_alloc_resource() (called by consumer driver) time. >>>> >>>> Due to this, we can: >>>> - parse interrupt property. The interrupt driver must exist >>>> at this time. >>> >>> This only works with some types of interrupt properties, not all, >>> and breaks if the interrupt driver hasn't attached yet (which it >>> can't be guaranteed to -- some PPC systems have interrupt drivers >>> that live on the PCI bus, for example). >> How you can allocate (and reserve it in rman) interrupt if is not >> mapped (so you have not real IRQ number for it). Just for notice - >> multiple virtual IRQs can be mapped into single real IRQ. > > The core idea is to think of the full interrupt specifier -- the > interrupt parent and the full byte string in the device tree -- as the > IRQ rather than the interrupt pin on some chip (which is usually, but > not always, the first word in that byte string). The "virtual" IRQ > number is just a compression of that longer piece of data, which > usually can't fit in an rman resource. I understand. While this approach can works (and actually works) for single sourced OFW world, it immediately fails if you must be able to parse data from different sources (which uses different encoding) (OFW, UEFI / ACPI, GPIO...) within one system. By this, one byte string in OFW encoding can describe one IRQ and exactly same string in UEFI encoding can describe different IRQ. Or, in reverse, OFW and UEFI can describe same (and compatible) IRQ by two different strings. This is exact reason, why we discards virtual IRQ idea and I think that this fact is root issue of this clash. Probably it doesn't make sense to talk about others, unless we can find consensus on this. > There is no need to actually activate those interrupts before > interrupts are enabled, so you can just cache them in a table until > the end of device probing, which lets you break circular dependency > loops between bus and interrupt topology. > > So long as you keep track of your mapping and the same (parent, > interrupt specifier) parent always gives the same virtual IRQ, there > is no way in this system to map multiple active IRQs onto a single > interrupt pin on the PIC unless your device tree is broken and > specifies two devices with incompatible modes (active high and edge > downgoing or something) on the same pin. In this case, nothing you can > do will save you -- unless your PIC supports interrupts for different > kinds of events, in which case this system will work perfectly by > treating them as different interrupts to the kernel for which the fact > they are on the same pin is immaterial. > > I should note that ARM and MIPS have an almost complete implementation > of this already: maybe some more intr_machdep.c logic is needed for > some cases, but all the rest of the plumbing is there. > >> >>> >>>> - bus_alloc_resource() returns resource, so we can attach parsed >>>> interrupt data to it. By this, the resource itself can be used >>>> for delivering configuration data to subsequent call to >>>> bus_setup_intr() (or to all related bus_() calls). >>>> >>>> >>>> The patched code still accepts delivering of interrupts in resource >>>> list. >>>> >>>> Michal >>>> >>> >>> Given that other code depends on this, fixing it will likely require >>> some complex work. I wish I had known about it when it went in. >>> >>> There are three main problems: >>> 1. It doesn't work for interrupts defined by other mechanisms (e.g. >>> interrupt-map properties) >> I aggree, but missing ' interrupt-map' functioanlity is not caused by >> this patch. > > It is in that the standard system already implements it completely. Really? https://svnweb.freebsd.org/base/head/sys/dev/ofw/ofw_bus_subr.c?revision=301453&view=markup#l521 and https://svnweb.freebsd.org/base/head/sys/arm/arm/nexus.c?revision=301453&view=markup#l411 > >> >>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>> but is both problematically more general and less flexible (it has >>> requirements on timing of PIC attachment vs. driver resource >>> allocation) >> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >> parsed data are magicaly stored within the call. >> The new method, bus_map_intr(), can parse data from multiple >> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It >> also returns parsed data back to caller. > > That is not true. It works as long as you can specify the interrupt > state as a 32-bit key of some kind for the PIC and a string of > arbitrary data, which works with all of those. You could even make the > interrupt data be a pointer to exactly the structs you have chosen to > define here. Nope, in heterogeneous world, same string can describe two different IRQs and/or two different strings can describe single IRQ in compatible manner. > >> And no, it doesn't add any additional timing requirements . > > As far as I can tell, it requires the interrupt controller to be > attached before you can allocate interrupts. Is that not true? Yes, sure. And the patch doesn't change this. Before: https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301263#l1103 After: https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301543#l928 > >> >>> 3. It is not fully transparent to end code. Since it happens at >>> bus_alloc_resource() time, it is complicated to get the appropriate >>> values for IRQs constructed by composite techniques (interrupt-map >>> vs. interrupts vs. hand allocation vs. PCI routing, for example). >> I don't see any limitation - can you be more exact? Why is not >> transparent? Why is more complicated ? > > Suppose that a PCI device adds more IRQs to its resource list or > modifies the ordering. How is whatever bus layer supposed to do > something sensible at allocation time? It requires that RID numbers > mean something to the parent bus after assignment, which is not > guaranteed by anything and is, in more than handful of cases I think > of, not true in practice. Sure. And since the new code allows delivering resources in RL, so I don't see any limitation here. > >>> It is much easier to do this correctly at bus attach time when the >>> resource lists are made (how PPC does it). >>> >> I don't agree. I don't agree. Making this at bus attach time leads >> into complicated 'virtual' IRQ infrastructure, with many unresolved >> corner cases. > > Which unresolved corner cases? This has been working correctly on a > number of platforms in both FreeBSD and Linux for many years. Nope, it doesn't work for ARM yet (for GPIO interrupts for example) and Linux uses EPROBE_DEFER mechanism for a long time. See: http://lxr.free-electrons.com/source/drivers/base/platform.c#L87 > >> >>> (1) is easy to fix without API changes, but (2) and (3) are >>> fundamental architectural problems that will bite us immediately >>> down the road and cause a permanent schism between OF support on >>> different platforms. >>> >>> Let me describe how this is handled on PowerPC (Linux on PPC solves >>> the problem the same way). When constructing a resource list, bus >>> drivers that construct them from OF properties call >>> ofw_bus_map_intr() with the interrupt parent phandle and the array >>> of cells corresponding to the interrupt. This thunks immediately to >>> nexus, which connects to code in intr_machdep.c. Code there assigns >>> a unique made-up virtual IRQ and returns it, caching the interrupt >>> parent ID and opaque interrupt data (if the same string of data >>> reappears later, you get back the same virtual IRQ of course). >>> >>> When PIC drivers attach and register themselves with the interrupt >>> handling layer, all the interrupts for that PIC are passed to it >>> along with the virtual IRQ. The PIC driver is supposed to know what >>> its interrupt data mean, which can be safely guaranteed, and it >>> presents the assigned virtual IRQ number to the kernel when >>> dispatching interrupts. (IRQs configured after PIC attachment are >>> passed through immediately). >>> >>> This accomplishes the following things: >>> 1. Parsing interrupt data is moved to the PIC driver, which is the >>> only place it can be done safely. >> I don't see anything different comparing with INTRNG. > > What I am advocating *is* INTRNG, at least as originally conceived and > implemented. > >>> 2. There is no ordering requirement on PIC attachment vs. the >>> attachment of anything else. >> I think thats is not a true - PIC must exist before >> bus_alloc_resource() / bus_setup_intr() is called. > > It does not with the IRQ mapping infrastructure. Interrupts are set up > at PIC attachment, whenever that occurs. > Assuming that bus_alloc_resource and bus_setup_intr() are close thorougher and in linear piece of code, can i assume that you can call bus_setup_intr() without PIC attached ? >> >>> 3. Changes are extremely minimal relative to the "standard" >>> interrupt flow: you only have to patch code that is already directly >>> dealing with OF interrupts. >> I don't see anything different comparing with INTRNG. > > Again, this was the original INTRNG architecture and is already > implemented. As such, there are *no* changes required on ARM to get > it. bus_map_intr() adds a bunch of new code, in parallel with the old > code that also solves the problem, to no purpose. So, on PPC, how i can get interrupt for GPIO pin described by this property: https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/tegra124-jetson-tk1.dts?revision=295436&view=markup#l1691 > >>> 4. It happens at bus enumeration time, when results can be >>> guaranteed self-consistent. >> Where do you see any potential source of inconsistency in INTRNG? > > See the example above about modified interrupt lists. There is also no > obvious way for a child device to construct an interrupt not assigned > to it by the parent device from device tree properties without knowing > in some detail what kind of interrupt needs to be built. > >> >>> 5. It combines naturally with ofw_bus_lookup_imap() and friends in >>> the interrupt-map case (e.g. for PCI). >> Again, I don't see anything different. Proper parsing of interrupt >> property is not a problem of INTRNG (but must be fixed, of course). > > But it is *already* fixed by the standard code that already exists. > You are introducing a less-functional parallel code path here. NO, its not fixed, at least not for ARM. > >>> >>> I'm not sure what the right path forward is, but this code needs to >>> be fixed. The PowerPC code is fully MI, and was the template for the >>> original INTRNG, so it shouldn't be too bad to replace. >>> -Nathan >>> >> >> So, new INTRNG: >> - Introduces new more general bus method that can parse interrupt >> configuration >> data from any source. Is this step backward? > > Yes, since it is more general in some sense, while simultaneously > handling fewer cases than code that already exists and is implemented. > >> >> - Old INTRNG and PPC code stores unparsed and/or parsed interrupt data in >> INTRNG and each consumer must query for them. This data sharing >> also causes >> significant locking issues. New INTRNG stores interrupt >> configuration data into >> given resource, so each relevant bus method can access it immediately. >> Is this step backward? > > Which locking issues? And yes, it is. > >> >> - New INTRNG is not OFW centric, it can works with virtually >> unlimited number >> of configuration data sources. Is this step backward? > > Also yes, because it makes the interrupt handles less opaque, which > makes the infrastructure less flexible. > >> - New INTRNG correctly uses standard system infrastructure. Real IRQ >> number >> is reserved in rman within bus_alloc_resource() call, interrupt HW is >> configured (only!) within bus_setup_intr() call. Is this step >> backward? > > The "real" IRQ number is not well defined always, so requiring that is > a step backwards, yes. > >> - New INTRNG completely eliminates huge and not always working virtual >> IRQ concept. > > When does it "not always work"? It seems to, in fact, always work on > multiple platforms and have for a long time in the face of all kinds > of totally bizarre topologies and system architectures. > >> >> >> Don’t take me bad, I’m open to any change. But no, at this time, I’m >> not ready to completely revert someone else's work – although I am a >> co-author. > > I would urge, in the strongest possible terms, that this be backed out > from stable/11 at least. We can add the new API back for 11.1 if we > want it, but we totally lose the ability to change it later in the > stable/11 cycle if it stays in now. > -Nathan > The API is part of still unstable, experimental INTRNG, so its not fixed we we can change it at any time, I think. But yes, we forget to wrap new bus_map_intr() method (and associated code) by #ifdef INTRNG. Is this sufficient for you? Michal From owner-svn-src-head@freebsd.org Thu Jul 21 08:08: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 6FE72BA0DB0; Thu, 21 Jul 2016 08:08:05 +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 3994418DB; Thu, 21 Jul 2016 08:08:04 +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 580811FE024; Thu, 21 Jul 2016 10:08:00 +0200 (CEST) Subject: Re: svn commit: r303096 - head/sys/kern To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607201644.u6KGiM3e007023@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <6162a195-05ae-0095-cf9e-115df497e577@selasky.org> Date: Thu, 21 Jul 2016 10:12:02 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201607201644.u6KGiM3e007023@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: Thu, 21 Jul 2016 08:08:05 -0000 On 07/20/16 18:44, Gleb Smirnoff wrote: > Author: glebius > Date: Wed Jul 20 16:44:22 2016 > New Revision: 303096 > URL: https://svnweb.freebsd.org/changeset/base/303096 > > Log: > Revert r303037. It re-introduces the panic with TCP timers. > > Agreed by: rrs, re (gjb) > > Modified: > head/sys/kern/kern_timeout.c > Hi, The panic with TCP timers can also be fixes calling callout_stop() twice instead of once. First time out call it it will return 1,0,-1. Second time only 0 or -1. --HPS From owner-svn-src-head@freebsd.org Thu Jul 21 08:11: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 9C5B6BA0F75; Thu, 21 Jul 2016 08:11:59 +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 645CA1DE5; Thu, 21 Jul 2016 08:11:59 +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 096321FE024; Thu, 21 Jul 2016 10:11:56 +0200 (CEST) Subject: Re: svn commit: r303096 - head/sys/kern To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607201644.u6KGiM3e007023@repo.freebsd.org> <6162a195-05ae-0095-cf9e-115df497e577@selasky.org> From: Hans Petter Selasky Message-ID: <900304a4-aec9-2404-fbfc-4183997fe4ce@selasky.org> Date: Thu, 21 Jul 2016 10:15:59 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <6162a195-05ae-0095-cf9e-115df497e577@selasky.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: Thu, 21 Jul 2016 08:11:59 -0000 On 07/21/16 10:12, Hans Petter Selasky wrote: > On 07/20/16 18:44, Gleb Smirnoff wrote: >> Author: glebius >> Date: Wed Jul 20 16:44:22 2016 >> New Revision: 303096 >> URL: https://svnweb.freebsd.org/changeset/base/303096 >> >> Log: >> Revert r303037. It re-introduces the panic with TCP timers. >> >> Agreed by: rrs, re (gjb) >> >> Modified: >> head/sys/kern/kern_timeout.c >> > > Hi, > > The panic with TCP timers can also be fixes calling callout_stop() twice > instead of once. s/fixes/fixed > > First time out call it it will return 1,0,-1. Second time only 0 or -1. First call will return 1,0,-1 and second time it will return 0 or -1, which is what you are looking for. --HPS From owner-svn-src-head@freebsd.org Thu Jul 21 08:22: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 DEE59B9F470; Thu, 21 Jul 2016 08:22:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD02816E8; Thu, 21 Jul 2016 08:22:26 +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 u6L8MQTo056938; Thu, 21 Jul 2016 08:22:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L8MPkU056936; Thu, 21 Jul 2016 08:22:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201607210822.u6L8MPkU056936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 Jul 2016 08:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303132 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 08:22:27 -0000 Author: trasz Date: Thu Jul 21 08:22:25 2016 New Revision: 303132 URL: https://svnweb.freebsd.org/changeset/base/303132 Log: Add documentation for "ctld -u", the UCL configuration file format. Submitted by: jceel@ Reviewed by: wblock@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7222 Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.8 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Thu Jul 21 06:09:47 2016 (r303131) +++ head/usr.sbin/ctld/ctl.conf.5 Thu Jul 21 08:22:25 2016 (r303132) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 9, 2015 +.Dd July 21, 2016 .Dt CTL.CONF 5 .Os .Sh NAME @@ -481,6 +481,97 @@ target naa.50015178f369f092 { lun 0 example_1 } .Ed +.Pp +An equivalent configuration in UCL format, for use with +.Fl u : +.Bd -literal +auth-group { + ag0 { + chap-mutual = [ + { + user = "user" + secret = "secretsecret" + mutual-user = "mutualuser" + mutual-secret = "mutualsecret" + }, + { + user = "user2" + secret = "secret2secret2" + mutual-user = "mutualuser" + mutual-secret = "mutualsecret" + } + ] + } + + ag1 { + auth-type = none + initiator-name = [ + "iqn.2012-06.com.example:initiatorhost1", + "iqn.2012-06.com.example:initiatorhost2" + ] + initiator-portal = [192.168.1.1/24, "[2001:db8::de:ef]"] + } +} + +portal-group { + pg0 { + discovery-auth-group = no-authentication + listen = [ + 0.0.0.0:3260, + "[::]:3260", + "[fe80::be:ef]:3261" + ] + } +} + +lun { + example_0 { + path = /dev/zvol/tank/example_0 + blocksize = 4096 + size = "4G" + } + + example_1 { + path = /dev/zvol/tank/example_1 + options { + naa = "0x50015178f369f093" + } + } + + example_2 { + path = /dev/zvol/tank/example_2 + options { + vendor = "FreeBSD" + } + } +} + +target { + "iqn.2012-06.com.example:target0" { + alias = "Example target" + auth-group = no-authentication + lun = [ + { number = 0, name = example_0 }, + ] + } + + "iqn.2012-06.com.example:target1" { + auth-group = ag0 + portal-group { name = pg0 } + lun = [ + { number = 0, name = example_1 }, + { number = 1, name = example_2 } + ] + } + + naa.50015178f369f092 { + port = isp0 + lun = [ + { number = 0, name = example_1 } + ] + } +} +.Ed .Sh SEE ALSO .Xr ctl 4 , .Xr ctladm 8 , Modified: head/usr.sbin/ctld/ctld.8 ============================================================================== --- head/usr.sbin/ctld/ctld.8 Thu Jul 21 06:09:47 2016 (r303131) +++ head/usr.sbin/ctld/ctld.8 Thu Jul 21 08:22:25 2016 (r303132) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 22, 2015 +.Dd July 21, 2016 .Dt CTLD 8 .Os .Sh NAME @@ -37,6 +37,7 @@ .Nm .Op Fl d .Op Fl f Ar config-file +.Op Fl u .Sh DESCRIPTION The .Nm @@ -84,6 +85,8 @@ The daemon sends verbose debug output to put itself in the background. The daemon will also not fork and will exit after processing one connection. This option is only intended for debugging the target. +.It Fl u +Use UCL configuration file format instead of the traditional non-UCL format. .El .Sh FILES .Bl -tag -width ".Pa /var/run/ctld.pid" -compact From owner-svn-src-head@freebsd.org Thu Jul 21 09:24: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 127CFB9F1DC; Thu, 21 Jul 2016 09:24:06 +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 D7E471E10; Thu, 21 Jul 2016 09:24:05 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (host81-149-102-120.in-addr.btopenworld.com [81.149.102.120]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id C5785D78FE; Thu, 21 Jul 2016 09:23:34 +0000 (UTC) Date: Thu, 21 Jul 2016 10:23:30 +0100 From: Andrew Turner To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303123 - head/sys/cam Message-ID: <20160721102330.34a848a2@zapp> In-Reply-To: <201607210311.u6L3BZH4041241@repo.freebsd.org> References: <201607210311.u6L3BZH4041241@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: Thu, 21 Jul 2016 09:24:06 -0000 On Thu, 21 Jul 2016 03:11:35 +0000 (UTC) Warner Losh wrote: > Author: imp > Date: Thu Jul 21 03:11:35 2016 > New Revision: 303123 > URL: https://svnweb.freebsd.org/changeset/base/303123 > > Log: > Fix mismerge and include the nvme support. > Also, print out the name of any CCB's functions that's not > supported. > MFC after: 1 week > > Modified: > head/sys/cam/cam_xpt.c > > Modified: head/sys/cam/cam_xpt.c > ============================================================================== > --- head/sys/cam/cam_xpt.c Thu Jul 21 00:53:14 2016 > (r303122) +++ head/sys/cam/cam_xpt.c Thu Jul 21 03:11:35 > 2016 (r303123) @@ -1033,6 +1033,8 @@ > xpt_announce_periph(struct cam_periph *p else if > (path->device->protocol == PROTO_SEMB) semb_print_ident( > (struct sep_identify_data > *)&path->device->ident_data); > + else if (path->device->protocol == PROTO_NVME) > + nvme_print_ident(path->device->nvme_cdata, > path->device->nvme_data); This breaks kernel configs with scbus but not nvme. This seems to be most of the non-x86 configs. linking kernel.full cam_xpt.o: In function `xpt_announce_periph': /usr/home/andrew/freebsd/repo/head-svn/sys/cam/cam_xpt.c:1037: undefined reference to `nvme_print_ident' cam_xpt.o: In function `xpt_denounce_periph': /usr/home/andrew/freebsd/repo/head-svn/sys/cam/cam_xpt.c:1092: undefined reference to `nvme_print_ident' cam_xpt.o: In function `xpt_run_devq': /usr/home/andrew/freebsd/repo/head-svn/sys/cam/cam_xpt.c:3331: undefined reference to `nvme_op_string' /usr/home/andrew/freebsd/repo/head-svn/sys/cam/cam_xpt.c:3331: undefined reference to `nvme_cmd_string' cam_xpt.o: In function `xpt_bus_register': /usr/home/andrew/freebsd/repo/head-svn/sys/cam/cam_xpt.c:3927: undefined reference to `nvme_get_xport' --- kernel.full --- *** [kernel.full] Error code 1 Andrew From owner-svn-src-head@freebsd.org Thu Jul 21 09:32: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 65403B9F496; Thu, 21 Jul 2016 09:32:57 +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 327C414B4; Thu, 21 Jul 2016 09:32:57 +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 u6L9Wuqc082131; Thu, 21 Jul 2016 09:32:56 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L9WuPh082127; Thu, 21 Jul 2016 09:32:56 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607210932.u6L9WuPh082127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Jul 2016 09:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303133 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 09:32:57 -0000 Author: andrew Date: Thu Jul 21 09:32:55 2016 New Revision: 303133 URL: https://svnweb.freebsd.org/changeset/base/303133 Log: Add support for arm64 to uart_dev_acpi by using the _HID property to find the uart class to use in a similar way as the fdt driver. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7248 Added: head/sys/dev/uart/uart_cpu_acpi.h (contents, props changed) Modified: head/sys/dev/uart/uart_bus_acpi.c head/sys/dev/uart/uart_dev_pl011.c Modified: head/sys/dev/uart/uart_bus_acpi.c ============================================================================== --- head/sys/dev/uart/uart_bus_acpi.c Thu Jul 21 08:22:25 2016 (r303132) +++ head/sys/dev/uart/uart_bus_acpi.c Thu Jul 21 09:32:55 2016 (r303133) @@ -39,6 +39,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include +#include +#include static int uart_acpi_probe(device_t dev); @@ -57,6 +62,7 @@ static driver_t uart_acpi_driver = { sizeof(struct uart_softc), }; +#if defined(__i386__) || defined(__amd64__) static struct isa_pnp_id acpi_ns8250_ids[] = { {0x0005d041, "Standard PC COM port"}, /* PNP0500 */ {0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */ @@ -67,6 +73,27 @@ static struct isa_pnp_id acpi_ns8250_ids {0xe502aa1a, "Wacom Tablet at FuS Lifebook T"}, /* FUJ02E5 */ {0} }; +#endif + +#ifdef __aarch64__ +static struct uart_class * +uart_acpi_find_device(device_t dev) +{ + struct acpi_uart_compat_data **cd; + ACPI_HANDLE h; + + if ((h = acpi_get_handle(dev)) == NULL) + return (NULL); + + SET_FOREACH(cd, uart_acpi_class_and_device_set) { + if (acpi_MatchHid(h, (*cd)->hid)) { + return ((*cd)->clas); + } + } + + return (NULL); +} +#endif static int uart_acpi_probe(device_t dev) @@ -77,12 +104,18 @@ uart_acpi_probe(device_t dev) parent = device_get_parent(dev); sc = device_get_softc(dev); +#if defined(__i386__) || defined(__amd64__) if (!ISA_PNP_PROBE(parent, dev, acpi_ns8250_ids)) { sc->sc_class = &uart_ns8250_class; return (uart_bus_probe(dev, 0, 0, 0, 0)); } /* Add checks for non-ns8250 IDs here. */ +#elif defined(__aarch64__) + if ((sc->sc_class = uart_acpi_find_device(dev)) != NULL) + return (uart_bus_probe(dev, 2, 0, 0, 0)); +#endif + return (ENXIO); } Added: head/sys/dev/uart/uart_cpu_acpi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/uart/uart_cpu_acpi.h Thu Jul 21 09:32:55 2016 (r303133) @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2015 Michal Meloun + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_UART_CPU_ACPI_H_ +#define _DEV_UART_CPU_ACPI_H_ + +#include + +struct uart_class; + +struct acpi_uart_compat_data { + const char *hid; + struct uart_class *clas; +}; + +/* + * If your UART driver implements only uart_class and uses uart_cpu_acpi.c + * for device instantiation, then use UART_ACPI_CLASS_AND_DEVICE for its + * declaration + */ +SET_DECLARE(uart_acpi_class_and_device_set, struct acpi_uart_compat_data); +#define UART_ACPI_CLASS_AND_DEVICE(data) \ + DATA_SET(uart_acpi_class_and_device_set, data) + +/* + * If your UART driver implements uart_class and custom device layer, + * then use UART_ACPI_CLASS for its declaration + */ +SET_DECLARE(uart_acpi_class_set, struct acpi_uart_compat_data); +#define UART_ACPI_CLASS(data) \ + DATA_SET(uart_acpi_class_set, data) + +#endif /* _DEV_UART_CPU_ACPI_H_ */ Modified: head/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- head/sys/dev/uart/uart_dev_pl011.c Thu Jul 21 08:22:25 2016 (r303132) +++ head/sys/dev/uart/uart_dev_pl011.c Thu Jul 21 09:32:55 2016 (r303133) @@ -24,6 +24,9 @@ * SUCH DAMAGE. */ +#include "opt_acpi.h" +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -35,7 +38,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_ACPI +#include +#endif +#ifdef FDT #include +#endif #include #include "uart_if.h" @@ -277,11 +285,22 @@ static struct uart_class uart_pl011_clas .uc_rshift = 2 }; + +#ifdef FDT static struct ofw_compat_data compat_data[] = { {"arm,pl011", (uintptr_t)&uart_pl011_class}, {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data); +#endif + +#ifdef DEV_ACPI +static struct acpi_uart_compat_data acpi_compat_data[] = { + {"ARMH0011", &uart_pl011_class}, + {NULL, NULL}, +}; +UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data); +#endif static int uart_pl011_bus_attach(struct uart_softc *sc) From owner-svn-src-head@freebsd.org Thu Jul 21 09:37: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 80958B9F619; Thu, 21 Jul 2016 09:37:18 +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 3D39516CE; Thu, 21 Jul 2016 09:37:18 +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 u6L9bHpu082360; Thu, 21 Jul 2016 09:37:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L9bHsw082359; Thu, 21 Jul 2016 09:37:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607210937.u6L9bHsw082359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Jul 2016 09:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303134 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 09:37:18 -0000 Author: kib Date: Thu Jul 21 09:37:17 2016 New Revision: 303134 URL: https://svnweb.freebsd.org/changeset/base/303134 Log: Improve typesetting. Reviewed by: bapt No objections from: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D7261 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Jul 21 09:32:55 2016 (r303133) +++ head/share/man/man7/arch.7 Thu Jul 21 09:37:17 2016 (r303134) @@ -47,7 +47,7 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent ".Sy Architecture" ".Sy sizeof(void *)" ".Sy "sizeof(long double)" +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy "sizeof(long double)" .It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) .It amd64 Ta 8 Ta 16 .It arm Ta 4 Ta 8 @@ -66,7 +66,7 @@ On all supported architectures, .It sparc64 Ta 8 Ta 16 .El .Ss Endianness and Char Signedness -.Bl -column -offset indent ".Sy Architecture" ".Sy Endianness" ".Sy "char Signedness" +.Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy "char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness .It amd64 Ta little Ta signed .It arm Ta little Ta unsigned @@ -85,7 +85,7 @@ On all supported architectures, .It sparc64 Ta big Ta signed .El .Ss Page Size -.Bl -column -offset indent ".Sy Architecture" ".Sy Page Sizes" +.Bl -column -offset indent "Sy Architecture" "Sy Page Sizes" .It Sy Architecture Ta Sy Page Sizes .It amd64 Ta 4K, 2M, 1G .It arm Ta 4K @@ -104,7 +104,7 @@ On all supported architectures, .It sparc64 Ta 8K .El .Ss Floating Point -.Bl -column -offset indent ".Sy Architecture" ".Sy float, double" ".Sy long double" +.Bl -column -offset indent "Sy Architecture" "Sy float, double" "Sy long double" .It Sy Architecture Ta Sy float, double Ta Sy long double .It amd64 Ta hard Ta hard, 80 bit .It arm Ta soft Ta soft, double precision @@ -134,16 +134,18 @@ cc -x c -Dm -E /dev/null .Ed .Pp Common type size and endianness macros: -.Bl -column -offset indent "BYTE_ORDER" ".Sy Meaning" +.Bl -column -offset indent "BYTE_ORDER" "Sy Meaning" .It Sy Macro Ta Sy Meaning .It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int .It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer .It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . -.Dv PDP11_ENDIAN is not used on FreeBSD. +.Dv PDP11_ENDIAN +is not used on +.Fx . .El .Pp Architecture-specific macros: -.Bl -column -offset indent ".Sy Architecture" ".Sy Predefined macros" +.Bl -column -offset indent "Sy Architecture" "Sy Predefined macros" .It Sy Architecture Ta Sy Predefined macros .It amd64 Ta Dv __amd64__, Dv __x86_64__ .It arm Ta Dv __arm__ From owner-svn-src-head@freebsd.org Thu Jul 21 09:45: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 217B6B9FB4C; Thu, 21 Jul 2016 09:45:47 +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 E72D01DBA; Thu, 21 Jul 2016 09:45:46 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (host81-149-102-120.in-addr.btopenworld.com [81.149.102.120]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 42F04D78FE; Thu, 21 Jul 2016 09:45:16 +0000 (UTC) Date: Thu, 21 Jul 2016 10:45:14 +0100 From: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303133 - head/sys/dev/uart Message-ID: <20160721104514.67c1dc57@zapp> In-Reply-To: <201607210932.u6L9WuPh082127@repo.freebsd.org> References: <201607210932.u6L9WuPh082127@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: Thu, 21 Jul 2016 09:45:47 -0000 On Thu, 21 Jul 2016 09:32:56 +0000 (UTC) Andrew Turner wrote: > Author: andrew > Date: Thu Jul 21 09:32:55 2016 > New Revision: 303133 > URL: https://svnweb.freebsd.org/changeset/base/303133 > > Log: > Add support for arm64 to uart_dev_acpi by using the _HID property > to find the uart class to use in a similar way as the fdt driver. > Reviewed by: jhb > Obtained from: ABT Systems Ltd > MFC after: 1 month > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D7248 Andrew From owner-svn-src-head@freebsd.org Thu Jul 21 12:38: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 EC6A2B9E50F; Thu, 21 Jul 2016 12:38:14 +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 BA2521DD1; Thu, 21 Jul 2016 12:38:14 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-143.nat-2.net.cam.ac.uk [131.111.5.143]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id B7FBAD8320; Thu, 21 Jul 2016 12:37:43 +0000 (UTC) Date: Thu, 21 Jul 2016 13:37:42 +0100 From: Andrew Turner To: Michal Meloun Cc: Nathan Whitehorn , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys Message-ID: <20160721133742.05f0e045@zapp> In-Reply-To: <578F6075.7010500@FreeBSD.org> References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@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: Thu, 21 Jul 2016 12:38:15 -0000 On Wed, 20 Jul 2016 13:28:53 +0200 Michal Meloun wrote: > Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): > > 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), > > but is both problematically more general and less flexible (it has > > requirements on timing of PIC attachment vs. driver resource > > allocation) > OFW_BUS_MAP_INTR() can parse only OFW based data and expect that > parsed data are magicaly stored within the call. > The new method, bus_map_intr(), can parse data from multiple sources > (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also > returns parsed data back to caller. > And no, it doesn't add any additional timing requirements . I've been looking at ACPI on arm64. So far I have not found the need for this with ACPI as we don't need to send the data to the interrupt controller driver to be parsed in the way OFW/FDT needs to. Andrew From owner-svn-src-head@freebsd.org Thu Jul 21 12:53: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 11D7BB9EA40; Thu, 21 Jul 2016 12:53:38 +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 C109B1984; Thu, 21 Jul 2016 12:53:37 +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 u6LCra6T056147; Thu, 21 Jul 2016 12:53:36 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LCrauU056146; Thu, 21 Jul 2016 12:53:36 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607211253.u6LCrauU056146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Thu, 21 Jul 2016 12:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303142 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 12:53:38 -0000 Author: ache Date: Thu Jul 21 12:53:36 2016 New Revision: 303142 URL: https://svnweb.freebsd.org/changeset/base/303142 Log: 1) GLOB_BRACE was somewhat broken. First it repeatedly calls glob0() in globexp1() recursive calls, but glob0() was not supposed to be called repeatedly in the original code. It finalize results by possible adding original pattern for no match case, may return GLOB_NOMATCH error and by sorting all things. Original pattern adding or GLOB_NOMATCH error can happens each time glob0() called repeatedly, and sorting happens for one item only, all things are never sorted. Second, f.e. "a{a" pattern does not match "a{a" file but match "a" file instead (just one example, there are many). Third, some errors (f.e. for limits or overflow) can be ignored by GLOB_BRACE code because it forces return (0). Add non-finalizing flag to glob0() and make globexp0() wrapper around recursively called globexp1() to finalize things like glob0() does. Reorganize braces code to work correctly. 2) Don't allow MB_CUR_MAX * strlen overallocation hits GLOB_LIMIT_STRING (ARG_MAX) limit, use final string length, not malloced space for it. 3) Revive DEBUG-ifdefed section. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Thu Jul 21 12:50:23 2016 (r303141) +++ head/lib/libc/gen/glob.c Thu Jul 21 12:53:36 2016 (r303142) @@ -128,8 +128,6 @@ struct glob_limit { #define RBRACE L'}' #define COMMA L',' -#ifndef DEBUG - #define M_QUOTE 0x8000000000ULL #define M_PROTECT 0x4000000000ULL #define M_MASK 0xffffffffffULL @@ -137,18 +135,6 @@ struct glob_limit { typedef uint_fast64_t Char; -#else - -#define M_QUOTE 0x80 -#define M_PROTECT 0x40 -#define M_MASK 0xff -#define M_CHAR 0x7f - -typedef char Char; - -#endif - - #define CHAR(c) ((Char)((c)&M_CHAR)) #define META(c) ((Char)((c)|M_QUOTE)) #define UNPROT(c) ((c) & ~M_PROTECT) @@ -171,7 +157,7 @@ static const Char *g_strchr(const Char * static Char *g_strcat(Char *, const Char *); #endif static int g_stat(Char *, struct stat *, glob_t *); -static int glob0(const Char *, glob_t *, struct glob_limit *); +static int glob0(const Char *, glob_t *, struct glob_limit *, int); static int glob1(Char *, glob_t *, struct glob_limit *); static int glob2(Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *); @@ -180,8 +166,9 @@ static int glob3(Char *, Char *, Char * static int globextend(const Char *, glob_t *, struct glob_limit *, int); static const Char * globtilde(const Char *, Char *, size_t, glob_t *); +static int globexp0(const Char *, glob_t *, struct glob_limit *); static int globexp1(const Char *, glob_t *, struct glob_limit *); -static int globexp2(const Char *, const Char *, glob_t *, int *, +static int globexp2(const Char *, const Char *, glob_t *, struct glob_limit *); static int match(Char *, Char *, Char *); #ifdef DEBUG @@ -260,9 +247,49 @@ glob(const char * __restrict pattern, in *bufnext = EOS; if (flags & GLOB_BRACE) - return (globexp1(patbuf, pglob, &limit)); + return (globexp0(patbuf, pglob, &limit)); else - return (glob0(patbuf, pglob, &limit)); + return (glob0(patbuf, pglob, &limit, 1)); +} + +static int +globexp0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) +{ + int rv; + size_t oldpathc; + + /* Protect a single {}, for find(1), like csh */ + if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) { + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { + errno = 0; + return (GLOB_NOSPACE); + } + return (glob0(pattern, pglob, limit, 1)); + } + + oldpathc = pglob->gl_pathc; + + if ((rv = globexp1(pattern, pglob, limit)) != 0) + return rv; + /* + * If there was no match we are going to append the pattern + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the pattern did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ + if (pglob->gl_pathc == oldpathc) { + if (((pglob->gl_flags & GLOB_NOCHECK) || + ((pglob->gl_flags & GLOB_NOMAGIC) && + !(pglob->gl_flags & GLOB_MAGCHAR)))) + return (globextend(pattern, pglob, limit, 1)); + else + return (GLOB_NOMATCH); + } + if (!(pglob->gl_flags & GLOB_NOSORT)) + qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, + pglob->gl_pathc - oldpathc, sizeof(char *), compare); + return (0); } /* @@ -273,24 +300,18 @@ glob(const char * __restrict pattern, in static int globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit) { - const Char* ptr = pattern; - int rv; + const Char* ptr; - if ((pglob->gl_flags & GLOB_LIMIT) && - limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { - errno = 0; - return (GLOB_NOSPACE); + if ((ptr = g_strchr(pattern, LBRACE)) != NULL) { + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { + errno = 0; + return (GLOB_NOSPACE); + } + return (globexp2(ptr, pattern, pglob, limit)); } - /* Protect a single {}, for find(1), like csh */ - if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) - return glob0(pattern, pglob, limit); - - while ((ptr = g_strchr(ptr, LBRACE)) != NULL) - if (!globexp2(ptr, pattern, pglob, &rv, limit)) - return rv; - - return glob0(pattern, pglob, limit); + return (glob0(pattern, pglob, limit, 0)); } @@ -300,10 +321,10 @@ globexp1(const Char *pattern, glob_t *pg * If it fails then it tries to glob the rest of the pattern and returns. */ static int -globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, +globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, struct glob_limit *limit) { - int i; + int i, rv; Char *lm, *ls; const Char *pe, *pm, *pm1, *pl; Char patbuf[MAXPATHLEN]; @@ -315,7 +336,7 @@ globexp2(const Char *ptr, const Char *pa ls = lm; /* Find the balanced brace */ - for (i = 0, pe = ++ptr; *pe; pe++) + for (i = 0, pe = ++ptr; *pe != EOS; pe++) if (*pe == LBRACKET) { /* Ignore everything between [] */ for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++) @@ -337,10 +358,8 @@ globexp2(const Char *ptr, const Char *pa } /* Non matching braces; just glob the pattern */ - if (i != 0 || *pe == EOS) { - *rv = glob0(patbuf, pglob, limit); - return (0); - } + if (i != 0 || *pe == EOS) + return (glob0(pattern, pglob, limit, 0)); for (i = 0, pl = pm = ptr; pm <= pe; pm++) switch (*pm) { @@ -385,7 +404,9 @@ globexp2(const Char *ptr, const Char *pa #ifdef DEBUG qprintf("globexp2:", patbuf); #endif - *rv = globexp1(patbuf, pglob, limit); + rv = globexp1(patbuf, pglob, limit); + if (rv) + return (rv); /* move after the comma, to the next string */ pl = pm + 1; @@ -395,7 +416,6 @@ globexp2(const Char *ptr, const Char *pa default: break; } - *rv = 0; return (0); } @@ -517,7 +537,8 @@ globtilde(const Char *pattern, Char *pat * if things went well, nonzero if errors occurred. */ static int -glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) +glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, + int final) { const Char *qpatnext; int err; @@ -587,23 +608,25 @@ glob0(const Char *pattern, glob_t *pglob if ((err = glob1(patbuf, pglob, limit)) != 0) return(err); - /* - * If there was no match we are going to append the pattern - * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified - * and the pattern did not contain any magic characters - * GLOB_NOMAGIC is there just for compatibility with csh. - */ - if (pglob->gl_pathc == oldpathc) { - if (((pglob->gl_flags & GLOB_NOCHECK) || - ((pglob->gl_flags & GLOB_NOMAGIC) && - !(pglob->gl_flags & GLOB_MAGCHAR)))) - return (globextend(pattern, pglob, limit, 1)); - else - return (GLOB_NOMATCH); + if (final) { + /* + * If there was no match we are going to append the pattern + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the pattern did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ + if (pglob->gl_pathc == oldpathc) { + if (((pglob->gl_flags & GLOB_NOCHECK) || + ((pglob->gl_flags & GLOB_NOMAGIC) && + !(pglob->gl_flags & GLOB_MAGCHAR)))) + return (globextend(pattern, pglob, limit, 1)); + else + return (GLOB_NOMATCH); + } + if (!(pglob->gl_flags & GLOB_NOSORT)) + qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, + pglob->gl_pathc - oldpathc, sizeof(char *), compare); } - if (!(pglob->gl_flags & GLOB_NOSORT)) - qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, - pglob->gl_pathc - oldpathc, sizeof(char *), compare); return (0); } @@ -856,18 +879,19 @@ globextend(const Char *path, glob_t *pgl len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ if (prot) len += (size_t)(p - path) - 1; - limit->l_string_cnt += len; - if ((pglob->gl_flags & GLOB_LIMIT) && - limit->l_string_cnt >= GLOB_LIMIT_STRING) { - errno = 0; - return (GLOB_NOSPACE); - } if ((copy = malloc(len)) != NULL) { if (g_Ctoc(path, copy, len, prot)) { free(copy); errno = 0; return (GLOB_NOSPACE); } + limit->l_string_cnt += strlen(copy) + 1; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_string_cnt >= GLOB_LIMIT_STRING) { + free(copy); + errno = 0; + return (GLOB_NOSPACE); + } pathv[pglob->gl_offs + pglob->gl_pathc++] = copy; } pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; @@ -1046,15 +1070,17 @@ qprintf(const char *str, Char *s) { Char *p; - (void)printf("%s:\n", str); - for (p = s; *p; p++) - (void)printf("%c", CHAR(*p)); - (void)printf("\n"); - for (p = s; *p; p++) - (void)printf("%c", *p & M_PROTECT ? '"' : ' '); - (void)printf("\n"); - for (p = s; *p; p++) - (void)printf("%c", ismeta(*p) ? '_' : ' '); - (void)printf("\n"); + (void)printf("%s\n", str); + if (s != NULL) { + for (p = s; *p != EOS; p++) + (void)printf("%c", (char)CHAR(*p)); + (void)printf("\n"); + for (p = s; *p != EOS; p++) + (void)printf("%c", (isprot(*p) ? '\\' : ' ')); + (void)printf("\n"); + for (p = s; *p != EOS; p++) + (void)printf("%c", (ismeta(*p) ? '_' : ' ')); + (void)printf("\n"); + } } #endif From owner-svn-src-head@freebsd.org Thu Jul 21 13:01: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 046B4B9EC5B; Thu, 21 Jul 2016 13:01:37 +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 C22351E47; Thu, 21 Jul 2016 13:01:36 +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 u6LD1ZhI057723; Thu, 21 Jul 2016 13:01:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LD1ZJv057721; Thu, 21 Jul 2016 13:01:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201607211301.u6LD1ZJv057721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 21 Jul 2016 13:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303143 - in head/sys: dev/uart modules/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 13:01:37 -0000 Author: andrew Date: Thu Jul 21 13:01:35 2016 New Revision: 303143 URL: https://svnweb.freebsd.org/changeset/base/303143 Log: Fix the build: * Add acpi_if.h to the SRC list in the uart module * Only include new acpi headers when they are needed Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/uart/uart_bus_acpi.c head/sys/modules/uart/Makefile Modified: head/sys/dev/uart/uart_bus_acpi.c ============================================================================== --- head/sys/dev/uart/uart_bus_acpi.c Thu Jul 21 12:53:36 2016 (r303142) +++ head/sys/dev/uart/uart_bus_acpi.c Thu Jul 21 13:01:35 2016 (r303143) @@ -41,9 +41,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __aarch64__ #include #include #include +#endif static int uart_acpi_probe(device_t dev); Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Thu Jul 21 12:53:36 2016 (r303142) +++ head/sys/modules/uart/Makefile Thu Jul 21 13:01:35 2016 (r303143) @@ -32,7 +32,8 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} u uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c -SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \ +SRCS+= acpi_if.h bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} \ + pci_if.h \ power_if.h pccarddevs.h serdev_if.h SRCS+= opt_platform.h opt_uart.h From owner-svn-src-head@freebsd.org Thu Jul 21 13:26: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 59A09B9F56B; Thu, 21 Jul 2016 13:26:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 191091EB4; Thu, 21 Jul 2016 13:26:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LDQdrG067452; Thu, 21 Jul 2016 13:26:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LDQdhR067451; Thu, 21 Jul 2016 13:26:39 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201607211326.u6LDQdhR067451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 21 Jul 2016 13:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303144 - 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: Thu, 21 Jul 2016 13:26:40 -0000 Author: manu Date: Thu Jul 21 13:26:39 2016 New Revision: 303144 URL: https://svnweb.freebsd.org/changeset/base/303144 Log: We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE Reviewed by: andrew MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7080 Modified: head/sys/arm/allwinner/a10_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Thu Jul 21 13:01:35 2016 (r303143) +++ head/sys/arm/allwinner/a10_gpio.c Thu Jul 21 13:26:39 2016 (r303144) @@ -743,4 +743,4 @@ static driver_t a10_gpio_driver = { }; EARLY_DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 0, 0, - BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); From owner-svn-src-head@freebsd.org Thu Jul 21 13:28: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 C9C6BB9F612; Thu, 21 Jul 2016 13:28:08 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9831611BF; Thu, 21 Jul 2016 13:28:08 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LDS7tO067545; Thu, 21 Jul 2016 13:28:07 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LDS7i7067544; Thu, 21 Jul 2016 13:28:07 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201607211328.u6LDS7i7067544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 21 Jul 2016 13:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303145 - 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: Thu, 21 Jul 2016 13:28:08 -0000 Author: manu Date: Thu Jul 21 13:28:07 2016 New Revision: 303145 URL: https://svnweb.freebsd.org/changeset/base/303145 Log: axp209 needs aw_nmi so attach a bit earlier Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D7081 Modified: head/sys/arm/allwinner/aw_nmi.c Modified: head/sys/arm/allwinner/aw_nmi.c ============================================================================== --- head/sys/arm/allwinner/aw_nmi.c Thu Jul 21 13:26:39 2016 (r303144) +++ head/sys/arm/allwinner/aw_nmi.c Thu Jul 21 13:28:07 2016 (r303145) @@ -401,4 +401,4 @@ static driver_t aw_nmi_driver = { static devclass_t aw_nmi_devclass; EARLY_DRIVER_MODULE(aw_nmi, simplebus, aw_nmi_driver, - aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); + aw_nmi_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); From owner-svn-src-head@freebsd.org Thu Jul 21 13:47: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 BEEEDB9FE7B; Thu, 21 Jul 2016 13:47:01 +0000 (UTC) (envelope-from jtl@freebsd.org) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0113.outbound.protection.outlook.com [104.47.36.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29E531DBE; Thu, 21 Jul 2016 13:47:00 +0000 (UTC) (envelope-from jtl@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=junipernetworks.onmicrosoft.com; s=selector1-junipernetworks-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=i/ApUMeSpyWwVEa735nb1UEmFiQP+/phq540W0dHKQA=; b=GbAtkuVhB8j+qAeRGAIxIgGk82Wj8EtAZA6SqLw7+qzmP9ljV0yjyzXpHfzJ3X0BTh0HBfNSyyVeo21mUDefSZEGko7aj4gjLUZ4GgBV8u5Thurgxjc7ibmwITTbJdAi6knV2Q0lsXm4lA1ytC78SlnwmlNDRulERCg1MMpg3VY= Received: from SN1PR05CA0013.namprd05.prod.outlook.com (10.163.68.151) by BY2PR05MB2344.namprd05.prod.outlook.com (10.166.113.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.5; Thu, 21 Jul 2016 13:12:08 +0000 Received: from BN1BFFO11FD025.protection.gbl (2a01:111:f400:7c10::1:108) by SN1PR05CA0013.outlook.office365.com (2a01:111:e400:5197::23) with Microsoft SMTP Server (TLS) id 15.1.539.14 via Frontend Transport; Thu, 21 Jul 2016 13:12:08 +0000 Authentication-Results: spf=softfail (sender IP is 66.129.239.19) smtp.mailfrom=freebsd.org; freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=freebsd.org; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning freebsd.org discourages use of 66.129.239.19 as permitted sender) Received: from P-EMFE01C-SAC.jnpr.net (66.129.239.19) by BN1BFFO11FD025.mail.protection.outlook.com (10.58.144.88) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Thu, 21 Jul 2016 13:12:07 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMFE01C-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 21 Jul 2016 06:12:05 -0700 Received: from [172.29.35.141] ([172.29.35.141]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id u6LDC4x99091; Thu, 21 Jul 2016 06:12:04 -0700 (PDT) (envelope-from jtl@freebsd.org) User-Agent: Microsoft-MacOutlook/f.18.0.160709 Date: Thu, 21 Jul 2016 09:12:05 -0400 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys From: "Jonathan T. Looney" Sender: Jonathan Looney To: Michal Meloun , Nathan Whitehorn , Svatopluk Kraus , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: <6B1523CF-0456-45C7-AB09-057DBCEA2427@juniper.net> Thread-Topic: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> <57907B0F.9070204@FreeBSD.org> In-Reply-To: <57907B0F.9070204@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.19; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(199003)(24454002)(189002)(377454003)(2906002)(586003)(356003)(76176999)(83506001)(2950100001)(5820100001)(105596002)(106466001)(2501003)(305945005)(54356999)(50986999)(8676002)(77096005)(87936001)(69596002)(47776003)(92566002)(230700001)(93886004)(19580405001)(33656002)(86362001)(450100001)(81166006)(81156014)(8936002)(9686002)(2201001)(107886002)(83716003)(50466002)(16796002)(97736004)(5001770100001)(68736007)(189998001)(82746002)(36756003)(4001350100001)(11100500001)(6806005)(23676002)(19580395003)(104396002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR05MB2344; H:P-EMFE01C-SAC.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD025; 1:2d3tA0cY1xpAt0Mz0Ci9UzxusmBdabA8gpNpQ2ptXyvqd0ozqAXxBhC64mX+ifRc9572d6wOjSK7Ok8VYxxElxGllI1ZW0nfwHUpkvPBR5CFYx0mphYYTbQ0Bbd7CL6wgkEYqNlqs278YGcKbwyCiHacoNGarFZAQF8RrlOpuUFB/0brcf5pET4v3WFkGhrUR1ykFhaTFdhMKRKC/w3lwVJeoZNYK1FmGGVzrnmn1Vb7mNKRmQAu0cgf5IWyBZS+QI+OOrecbNFqeoRyg5cvcqVXkDClvg39/rN+9Jk5RF7AMb0vURxQ/Ah/0aifTYFRWxTmCrqhslbSjda0XLltrw3YDFaBw44uD2M0eFYr0VUfw0g5KxhLlXZl/2mdJnLwSFofAKyGQMhkXTqUGzjmMBXALd+dEoc9hPaSwjQHmLPR70HH8NQESEiRVDD7C/A9oVciEs33foRoYdc57W7r6NXrXS+Sk/dQXeR5Q6WprYMmpLiBFC9CCyOwjnd8DycDXMjbo4hw115uneoFb9lbh3VlsEgmzN2/5ttVdQks320G4nQMYM/Cqawrn482BZOSVJBfAt7AdSaQbf/QqJfjlQ== X-MS-Office365-Filtering-Correlation-Id: 6258b3f7-3c3f-4ec0-331f-08d3b1689f11 X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB2344; 2:FaBrIwYy2ZhoFpDq5G4DY5iWmWM/m2CZLpwASN+bz0qVWPfdQSnEs3+12zkyYr0dYv8rux6QA8yjfApeSR4lcuAbXImRFqmMW2YCRePrcziZmZkA62VTmX+Eisume66vjem6ASBEsPQcC3cskWQV3Ngh1s/XKNG86Dky96XrzHwcjW2D31PGurgbmIjLEZAt; 3:5SAPIVdivEfU7OmTbth6eZVrLRnERDzEvp5N5RoMCCLR34cJT4rBvuguP38hE/CznWDBAPtFDej92dXB1bb8oxySOMWU8EzxbFpFMfPtJRizJJgCGr7Seuj6A1MOdH14d5zkHJJQ1u1OKG5MqcYq5etCQV5dNXW0hBFk+ICJ7CjovhUoBUQfPZoKMT6KA56/IXDBaLKptNVj+vlOQYnImn6rMcYR4w16eigytAMtMiM= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR05MB2344; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB2344; 25:P/ToFk7diKh3ALxA6ywEtAlwEWyxtHDRqkDpnnR2S7rcBVfyIabKkI/UD38gdAo4VmFSgj0C2xlNltPQcA81imYClAJROh0zgItEaD9QVfNgyknvE/G52fUAjj+Y7gGc8bmbnLvXshv0lpVtCcO3XkBXbxJ7TbtV349G7OdOTnZ7G674ZzokxtxRTck3STw2rxclS62+fEvRsekdbxQhZ2dysD7GYKm4QEkyDKvWNbcWvb/D5DaThUnOiWm5hWyzIkmJYxaeobs/+1VeYdeYF4cW9K516IBebACwNnasxJDNPj8pbw1LcQFxQ8/3g3I1TViqO0mdTyd3fAFdY02lojzVpCREX9n1mSUREsJckLNrqWsWFQkEb351i5v3+CJ6VF+xSSUZhV12rZ57XhphWfjlzAm93f3yggIzqxxRjPsHvBeioJ5R5Gbipc/9vuRdwJs7DblK6YJa/Lr/hSIwRLPcmoYsFLx/drDdPlLIuQ4hoazh2CpZemJeDGWQ3CHARZqBdV0iF9ogmGTXEl5J0Wqair9A9dAQb3mqEGCaXf4Qc8zp7NcVxB247PI3wCneYbz1Sg5F+MrzMD/oWt40S0zGfs9AhDBGCFhoBQ+HISDKKyU/iNPYrX0lnyGvaLGOcYMQvIP3pdnQjRHsPLvsN7o4CsyJcXl1p8tgJ/u3MmYrXTK0Og/WHE7m7kjbZjA1DGKZcnAS/W3OTzddA8txNjnc220BFJowR6ebBoxunNA=; 31:M+BfFUgvp0vXr1IZjOdlWcVIrPmkBXyG0dwD44a3KqJsA709ntET3A/ulGJK6K7zXxVuY8vjEZbJhlzS344DYMQolP7q9XtN2yna4d3HeaKqS81SpvnfyqegvFNF69E4e4JpA/gNUnRkTc3anDhQYdYrotbLDTLK4+ptlOUQddnlsn5ATDqcFZ8d/3j8ZeO+k+vtnoAYJqTVIp7cfgkH9A== X-JNPR-Received-From: outside X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB2344; 20:L3xFGDFvUuqnmI1N7Fz2ZobI/9zmC7SPpzb8fS6UTIcb28oZB/GuQ2/UeteC9LmPXDEZyBjMPygbjjW2fkFA1xyWbSB5yGO1orUjYDiEr09FbOl+kMhr0rNFa4Lkh1eUwcWCxEfMhoHmiEJdzI7m6PpQx9iFxHWA1CyKUUXEqrFe28zZW7UtRHgcFyQNTpQ/hoh1MKygxeJwtCd5BHAIGvnBHlyGvP6pDvEBJo+JNXZSKxnu5OJ8UaYSJaWtwGMltl4DyEMUGS7E78bDBr3xwmRZM9+blLbVqvBtB33486FWF3qIaJGv5SvuYN0MQb8eVPNL/n8tdXWA/vYscaK93v/eY2D7gzwxID7wZfzEfJThE4K3WHiZAMxnHZm8R6D/74ZNE/QFEaT1C2+rfM/rOpJXuB4rQQ9brynqnXSap7qzPOiiwPKQ70fmYqNv7YGy0gufOWBNEbCNqX0220JeO0QJcDJq9VfLmUyksRsdlLuwlI78rTHkTh3PCzkRRDBk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13024025)(13023025)(13017025)(13015025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR05MB2344; BCL:0; PCL:0; RULEID:; SRVR:BY2PR05MB2344; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB2344; 4:w4d5S72ugtR5HnVlEPEh4qKjzi70xksFKFwkoRnxrygZ1ssMKjta3rRqR9YkqM/xj9sFVn/6y/c4/k7dkC9MKXEQMaGGBlplgpbJFYtdn9OZ918LDM/swshMuiiXajm6pHXRxU3do4zfRINrQN59hmeNLuNggXssBPBRm8V3QClXDBh0jrq0uw5+l3G1mVuXIQU4KyUDlRD/xanXRMXRDz5NV2kndooFk/dlpVc8P5zuk3nc4Sqn6UFHheBUCIUYgIWh4Cv63c+iaXafYzM2BgBMv62w1h+k89DwLX2bn7cjZ/hLu/3QOnFA7BlEfLW5tj2MHxd0r2AajXtwMVIoIf7B7J/Cm4phQe8iY3aB+jKfwdrg6+RaF0xwXHTDiWzkDo1tYnZTa5q5OsnOlrGc9B3hfQGJTahT4a+48Y2+f3YsoAt6TSCvG9/7lu5rZZ8hhtgVGqP3JYTWgd/LMZDTGfxXP3QRqX293rDOeHSuUrY= X-Forefront-PRVS: 0010D93EFE X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjA1TUIyMzQ0OzIzOnBSeEVyUGRWWTNzc3NjUnJURDVjWlVXRzhK?= =?utf-8?B?R3pucXUwbWFhOTh0V0NwRkpCbDQ3Vy9oS1VIaWdyQytMZ3c2V1N1QTZWTVl2?= =?utf-8?B?L2IrSVhiQ2lzcGZHMGVtTmNqZG92MjYxRXA5M2hML05yUncvSnJPZk1HUTFu?= =?utf-8?B?ODMzT2d0VCtZejRvMUVkRkJyV1pTK3JpZGJqRnVoTWdNcUEvUzdOTlNJVGg5?= =?utf-8?B?enpPNDhrbUhIZ3Q1cUZiZmp4SGp4MWZRd3BOc2dPQ051UVVGTWQyTFNTL3o1?= =?utf-8?B?QUlRdllGTUlKeFNxQ0ZobnBsMTc4c0xRTkFrVmNCSE5ieU9DK1FGdzJQZ2Fz?= =?utf-8?B?TjhtNzJPZnViSW1LTDJXZWNiL1IvSVcrb0o5ZEFCRmhSaHZFcmZ5TkdsRnQ1?= =?utf-8?B?c2N6WENteENTY3NDVTc0U29jckd6ZnNncDUrSW5pNk9rdVNoRWNUWGJXNXdm?= =?utf-8?B?UXNDZE8xcjU3NjFIZThCaDBieTEwZTBSQkNOV0VyMS82Tk5RRWVCSklmMUNJ?= =?utf-8?B?bnNNSTBXZ25LWXM0dHdRS1Ira3Jqd0dXNmpmdDBjeGU1SHEvMGpPYXlyRGpO?= =?utf-8?B?N1UxLzd1eHpieWhXUG5LQkhRcW5NaEQ2OXRLcVRJVEhpVjVWbU85QTQ0WWRh?= =?utf-8?B?VXR4Uldna29wZmhOOE4zU2wrQ2xwalJWVlg4TlM2VWl0VUtMd1F4TGJPTlVn?= =?utf-8?B?am1kOXRlWU1JL25mVVhNTFdyQzU2U3BxZ3Btd0toSW9CaGFHTUt1WGZtd1ZP?= =?utf-8?B?SGtVckJqOGNmOGtGRmRoZnFHQ3FFa1E1Y3BCYjVXS1lpSmdJR2JFSStSYlQw?= =?utf-8?B?T3NFUW1SaEJHSUJnMjVjTm5pZ3gyZm42Uk10SE0rQi9abTNMN1N3QU1KSDVE?= =?utf-8?B?OTE4SEdLWWsvelJXWHdteGtZdklIb3o1WnRNYStvNzNTOGtiRXFuejJhUHht?= =?utf-8?B?R3RCL3lRMGZkdXNuS1RhSUlOWFpZak5tTDNUdTdQTU0xQkYxSGxwNmtWRTBU?= =?utf-8?B?dnpQd1ZJYzl5YlNWN1Jha3BINEw3ZkpXQnNGWUhTcEpNcG9SSDRIQkpKMmlo?= =?utf-8?B?QmFzZXNwNGtpaEZQc051cHNkMXhweitPRUtmL3dWVXZ4WlJNc0ZjZG4zU0VO?= =?utf-8?B?YWVJNmlzV25OY2tCVE0zVHJGQ1UwU0hYZ3dDMHlYMW5oeEs2TjVreEF5L3BN?= =?utf-8?B?R1NtczRBWEt2cjI2NWZMTmJROXpTSGZwSnU4UlRldElCTllRZkM5ZFBvbWNB?= =?utf-8?B?MmZDUCtHeUczSTZqdWNWV0JXTEdoMDNDMmwyamdrdXNmQ1gxalI2eGlJWHVi?= =?utf-8?B?VmMvb0pMaW5uN012WXhWaDRoMG1wUXpjV2oydmREU0hrY3g3Q0VjYzIxN2FK?= =?utf-8?B?cTVCMVhGMjhMM1AxR0xtU2cvTWJwZWlZbmJZMDc2SE13TEdSSDlIVXhkOUJW?= =?utf-8?B?NzAyM2psQ1dYUTBMN2xGUVRBSGJGdFFlV1NiZWVxU1BZa3JNZnpIdHZUTko0?= =?utf-8?B?b3ZZYW81R21obG9pclc2SlQ5U3ZqVkxYY29Ta2I3cUlTRW5YRlVpUkplM25M?= =?utf-8?B?cmk2Q1FpZGhEdE16RkE4Qkp4NGE4eFc1VWM4Y2JWdFVhWFNiUGJEWkFaTTF0?= =?utf-8?B?c1lXYTFOa3g1bDJlODkvRGdwd0d6L0oxa2Rod2FnUVFZcTY3SEw0bW9UMjJh?= =?utf-8?B?MmhCUkhBOXBxeG11bEZ3Ym02WmFraFcra2NRcG9OdXQ4eGNwc1YyVDh3NEk3?= =?utf-8?B?ODdYVmZuditrSk5KTWN4REdKVlIrWC9FZktPNGVkRUdxWWwvblM2dHVYWi9v?= =?utf-8?B?M0YyaiszOWlsc0ZZK1lnM3dKbVpBZ1BJYUdDU3cwNXpuWFE9PQ==?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB2344; 6:zwn9BcTY/zJGYkrT1xth9gdBSVnaBdvg+uxL45Ham4VSSJevms9UNwRF+kV4QOLQljnTw01we/EOIZANJUFzYhMo7HaH8wWcaqO3GpN81aWaz69QnjdHOLQP1/NpDVxt1ESwwQvTgGoICsJ14G7zU/qOtfoRPTs3oRebVM8GPqAmUrq2/lkByGBoBRLo0sKaPRiX4UTN6bx8cOQ6yHdsTuD4wPokgkHVpr2+F6DS4YWe2faNnC95e33fnSc3sGDoLkzmcT5Vh3iFj2RJkczujhxhylaelny/WBXVzYDftBurwbNmEdcDhnTJiA6Xi0PaBKPsOV3Q+0YL4bM1Jb0VkQ==; 5:PMICBmYHuEYgLgvpC0zVOTpcnoTw9PAb3XWNFMKmbo/Y8onlphDc+dPjCpo4Nm1r8R4KZ9bJT4gqd/ZbLfFKKVfo7HnMDSfaYqI4A0R4V3vTbC4UwRk5DAFt7DWO5HEnQ3wonwapq5sA3NleVldrSw==; 24:cvj5oUBj6ey1/n0MZmbPvkWezCSxmgI1H0nxfoIFWVefDEAgCUpnZqbgWojOe63/6wvdcFC9fJ3VxjbLuWpGIHe1DePo/8hvEbTqnUy3bGQ=; 7:5Hzd8U7WfmoZGSqDpUGG0oi9IzbM1Zy5DICGsb+GKCR6h+vUIb0n6oSNE/8NeYgJwMsvsD6KHzJnlm4xfDEe53yL2EtBxtI32+yYr05yQlSef8eMh3rWHhngCtTKVX4+1oq6t7sdoGHU9xTtTLw5VEtfqs70u020QF0IJcfJA4dLrsvpj1SyTKruZMBCOlE24fqBKay7pPM8h87D3PFQaJIVDHLg8Qf6lxjs4t6HMvB+dhaIguM3iY0r1mrMzfz3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2016 13:12:07.4851 (UTC) X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.19]; Helo=[P-EMFE01C-SAC.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB2344 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 13:47:01 -0000 On 7/21/16, 3:34 AM, "owner-src-committers@freebsd.org on behalf of Michal Meloun" wrote: > The API is part of still unstable, experimental INTRNG, so its not fixed we we can > change it at any time, I think. If INTRNG is unstable and experimental, why is it in the GENERIC kernel for arm64? Or, is the entire arm64 architecture considered unstable and experimental in 11.0? (I'm not trying to take sides; these are honest questions.) Jonathan From owner-svn-src-head@freebsd.org Thu Jul 21 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 CA8AABA08BA; Thu, 21 Jul 2016 14:17:37 +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 99DDA1310; Thu, 21 Jul 2016 14:17:37 +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 u6LEHabB086379; Thu, 21 Jul 2016 14:17:36 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LEHaPR086378; Thu, 21 Jul 2016 14:17:36 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607211417.u6LEHaPR086378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 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: r303146 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 14:17:37 -0000 Author: pfg Date: Thu Jul 21 14:17:36 2016 New Revision: 303146 URL: https://svnweb.freebsd.org/changeset/base/303146 Log: sed(1): Appease older GCC. Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Thu Jul 21 13:28:07 2016 (r303145) +++ head/usr.bin/sed/process.c Thu Jul 21 14:17:36 2016 (r303146) @@ -97,11 +97,12 @@ process(void) { struct s_command *cp; SPACE tspace; - size_t oldpsl = 0; + size_t oldpsl; char *p; int oldpsanl; p = NULL; + oldpsanl = oldpsl = 0; for (linenum = 0; mf_fgets(&PS, REPLACE);) { pd = 0; From owner-svn-src-head@freebsd.org Thu Jul 21 14:57: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 18E0EB9F363; Thu, 21 Jul 2016 14:57:25 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 226D61BF7; Thu, 21 Jul 2016 14:57:23 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id d0a51cb3; Thu, 21 Jul 2016 16:57:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=aIFHvmer/zc58Q2XMCM50XEJbIo=; b=ZPfJXMCtu1sF1HDOFj+sgQ/u8bTQ JYGfR8nEve6iZr9G01XFV0bB4/VEHYEyf9vX9XTsxsaw2r70gx/6MeaF0YkgvN80 dm2W+zfbwG1VYuwAHER8EwLg5jeiGIlf4KChALy1olztJArptb/0ivtnrHFA7SK+ 3ZeiTRTqqI4CyOw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=DBuznjkTtVDPW+lnV5saEaLcD+PxVfGfxBfmP9VegpDDXp7w3f0XKnin bRBtuxkihiJuPgfMnJyqLyCYzsNLFqSyncfu4ba7HOyH5lyOQ/K5BdQjimN2RxL/ acxKHhw091Ja6Gan44ZhuCXr6vDa6G9to/xuXRBLZ3ezqbG3SZM= Received: from knuckles.blih.net (ip-54.net-82-216-203.roubaix.rev.numericable.fr [82.216.203.54]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 9d494247 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Thu, 21 Jul 2016 16:57:14 +0200 (CEST) Date: Thu, 21 Jul 2016 16:57:14 +0200 From: Emmanuel Vadot To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303123 - head/sys/cam Message-Id: <20160721165714.e3281bc2b89e9f5e7ec1bd02@bidouilliste.com> In-Reply-To: <201607210311.u6L3BZH4041241@repo.freebsd.org> References: <201607210311.u6L3BZH4041241@repo.freebsd.org> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.29; amd64-portbld-freebsd12.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: Thu, 21 Jul 2016 14:57:25 -0000 Hello Warner, This break every kernel build that don't have nvme(4). On Thu, 21 Jul 2016 03:11:35 +0000 (UTC) Warner Losh wrote: > Author: imp > Date: Thu Jul 21 03:11:35 2016 > New Revision: 303123 > URL: https://svnweb.freebsd.org/changeset/base/303123 > > Log: > Fix mismerge and include the nvme support. > Also, print out the name of any CCB's functions that's not supported. > > MFC after: 1 week > > Modified: > head/sys/cam/cam_xpt.c > > Modified: head/sys/cam/cam_xpt.c > ============================================================================== > --- head/sys/cam/cam_xpt.c Thu Jul 21 00:53:14 2016 (r303122) > +++ head/sys/cam/cam_xpt.c Thu Jul 21 03:11:35 2016 (r303123) > @@ -1033,6 +1033,8 @@ xpt_announce_periph(struct cam_periph *p > else if (path->device->protocol == PROTO_SEMB) > semb_print_ident( > (struct sep_identify_data *)&path->device->ident_data); > + else if (path->device->protocol == PROTO_NVME) > + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); > else > printf("Unknown protocol device\n"); > if (path->device->serial_num_len > 0) { > @@ -1086,6 +1088,8 @@ xpt_denounce_periph(struct cam_periph *p > else if (path->device->protocol == PROTO_SEMB) > semb_print_ident_short( > (struct sep_identify_data *)&path->device->ident_data); > + else if (path->device->protocol == PROTO_NVME) > + nvme_print_ident(path->device->nvme_cdata, path->device->nvme_data); > else > printf("Unknown protocol device"); > if (path->device->serial_num_len > 0) > @@ -2516,6 +2520,10 @@ xpt_action_default(union ccb *start_ccb) > if (start_ccb->ccb_h.func_code == XPT_ATA_IO) > start_ccb->ataio.resid = 0; > /* FALLTHROUGH */ > + case XPT_NVME_IO: > + if (start_ccb->ccb_h.func_code == XPT_NVME_IO) > + start_ccb->nvmeio.resid = 0; > + /* FALLTHROUGH */ > case XPT_RESET_DEV: > case XPT_ENG_EXEC: > case XPT_SMP_IO: > @@ -2655,6 +2663,8 @@ call_sim: > cgd->inq_data = dev->inq_data; > cgd->ident_data = dev->ident_data; > cgd->inq_flags = dev->inq_flags; > + cgd->nvme_data = dev->nvme_data; > + cgd->nvme_cdata = dev->nvme_cdata; > cgd->ccb_h.status = CAM_REQ_CMP; > cgd->serial_num_len = dev->serial_num_len; > if ((dev->serial_num_len > 0) > @@ -3011,8 +3021,10 @@ call_sim: > case XPT_TERM_IO: > case XPT_ENG_INQ: > /* XXX Implement */ > - printf("%s: CCB type %#x not supported\n", __func__, > - start_ccb->ccb_h.func_code); > + xpt_print_path(start_ccb->ccb_h.path); > + printf("%s: CCB type %#x %s not supported\n", __func__, > + start_ccb->ccb_h.func_code, > + xpt_action_name(start_ccb->ccb_h.func_code)); > start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; > if (start_ccb->ccb_h.func_code & XPT_FC_DEV_QUEUED) { > xpt_done(start_ccb); > @@ -3315,6 +3327,13 @@ xpt_run_devq(struct cam_devq *devq) > ata_cmd_string(&work_ccb->ataio.cmd, > cdb_str, sizeof(cdb_str)))); > break; > + case XPT_NVME_IO: > + CAM_DEBUG(work_ccb->ccb_h.path, > + CAM_DEBUG_CDB,("%s. NCB: %s\n", > + nvme_op_string(&work_ccb->nvmeio.cmd), > + nvme_cmd_string(&work_ccb->nvmeio.cmd, > + cdb_str, sizeof(cdb_str)))); > + break; > default: > break; > } > @@ -3904,6 +3923,9 @@ xpt_bus_register(struct cam_sim *sim, de > case XPORT_SATA: > new_bus->xport = ata_get_xport(); > break; > + case XPORT_NVME: > + new_bus->xport = nvme_get_xport(); > + break; > default: > new_bus->xport = &xport_default; > break; -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Thu Jul 21 15:26: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 65BDCB9FAA6; Thu, 21 Jul 2016 15:26: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 36E9F1C00; Thu, 21 Jul 2016 15:26: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 u6LFQLCx012189; Thu, 21 Jul 2016 15:26:21 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LFQLkB012188; Thu, 21 Jul 2016 15:26:21 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201607211526.u6LFQLkB012188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 Jul 2016 15:26:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303147 - head/contrib/binutils/bfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 15:26:22 -0000 Author: pfg Date: Thu Jul 21 15:26:21 2016 New Revision: 303147 URL: https://svnweb.freebsd.org/changeset/base/303147 Log: binutils: fix "Bad value" error in bfd for MIPS when using -Bsymbolic. From OpenBSD's log: Inspired by https://sourceware.org/ml/binutils/2010-08/msg00333.html, but expressed differently so there are no GPLv3 issues. Obtained from: OpenBSD (CVS rev. 1.7) MFC after: 1 month Modified: head/contrib/binutils/bfd/elfxx-mips.c Modified: head/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- head/contrib/binutils/bfd/elfxx-mips.c Thu Jul 21 14:17:36 2016 (r303146) +++ head/contrib/binutils/bfd/elfxx-mips.c Thu Jul 21 15:26:21 2016 (r303147) @@ -4801,7 +4801,7 @@ mips_elf_create_dynamic_relocation (bfd /* We must now calculate the dynamic symbol table index to use in the relocation. */ if (h != NULL - && (!h->root.def_regular + && (sec == NULL || !h->root.def_regular || (info->shared && !info->symbolic && !h->root.forced_local))) { indx = h->root.dynindx; From owner-svn-src-head@freebsd.org Thu Jul 21 15:48: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 A795FBA008F; Thu, 21 Jul 2016 15:48:42 +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 78B541A6A; Thu, 21 Jul 2016 15:48:42 +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 u6LFmfgF019942; Thu, 21 Jul 2016 15:48:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LFmf6A019941; Thu, 21 Jul 2016 15:48:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201607211548.u6LFmf6A019941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 21 Jul 2016 15:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303150 - head/sys/dev/flash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 15:48:42 -0000 Author: adrian Date: Thu Jul 21 15:48:41 2016 New Revision: 303150 URL: https://svnweb.freebsd.org/changeset/base/303150 Log: [mx25l] add new device id. Tested: * (submitter) TP-Link TL-WR1043nd v3 Submitted by: tj@enoti.me Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Thu Jul 21 15:42:19 2016 (r303149) +++ head/sys/dev/flash/mx25l.c Thu Jul 21 15:48:41 2016 (r303150) @@ -133,6 +133,9 @@ struct mx25l_flash_ident flash_devices[] /* Atmel */ { "at25df641", 0x1f, 0x4800, 64 * 1024, 128, FL_ERASE_4K }, + + /* GigaDevice */ + { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-head@freebsd.org Thu Jul 21 15:53: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 E2760BA04EB; Thu, 21 Jul 2016 15:53:34 +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 CAC361F31; Thu, 21 Jul 2016 15:53:34 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6LFrNbB016797 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 21 Jul 2016 08:53:23 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> <57907B0F.9070204@FreeBSD.org> From: Nathan Whitehorn Message-ID: <9d2a224c-b787-2875-5984-a7a2354e8695@freebsd.org> Date: Thu, 21 Jul 2016 08:53:22 -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: <57907B0F.9070204@FreeBSD.org> X-Sonic-CAuth: UmFuZG9tSVb6ZE44LhKfM/K/JviZPOde+Mx5I1V+ghtay/kcsr7tKK0P0toLGDMSw5ESLTSGTEEPFe/GBcfnTLSbVu2PBGo7SgfJinv5Kz0= X-Sonic-ID: C;AgfiQFtP5hG+J5NwxPCmMQ== M;Sm8xQVtP5hG+J5NwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: Thu, 21 Jul 2016 15:53:35 -0000 On 07/21/16 00:34, Michal Meloun wrote: > Dne 20.07.2016 v 17:45 Nathan Whitehorn napsal(a): >> >> >> On 07/20/16 04:28, Michal Meloun wrote: >>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>> >>>> >>>> On 07/19/16 04:13, Michal Meloun wrote: >>>>> Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): >>>>> Hi Nathan, >>>>> I’m afraid that skra is on vacation, for next 2 weeks (at >>>>> minimum), so >>>>> please don’t expect quick response. >>>>> >>>>>> Could you please describe what this change is in more detail? >>>>> Short description is appended. >>>>> >>>>>> It breaks a lot of encapsulations we have worked very hard to >>>>>> maintain, >>>>>> moves ARM code into MI parts of the kernel, and the OFW parts >>>>>> violate >>>>>> IEEE 1275 (the Open Firmware standard). In particular, there is no >>>>>> guarantee that the interrupts for a newbus (or OF) device are >>>>>> encoded in >>>>>> a property called "interrupts" (or, indeed, in any property at >>>>>> all) on >>>>>> that node and there are many, many device trees where that is not >>>>>> the >>>>>> case (e.g. ones with interrupt maps, as well as Apple hardware). By >>>>>> putting that knowledge into the OF root bus device, which we have >>>>>> tried >>>>>> to keep it out of, this enforces a standard that doesn't actually >>>>>> exist. >>>>> Imho, this patch doesn’t change anything in this area. Only >>>>> handling of >>>>> “interrupts” property is changed, all other cases are unchanged (I >>>>> hope). Also, INTRNG code is currently shared by ARM, ARM64 and MIPS. >>>> >>>> But "interrupts" isn't a generic part of OF. This makes it one, >>>> incorrectly. >>> How? Can you be little more exact ? >> >> Because it puts knowledge into ofwbus that expects that children at >> arbitrary levels of nesting have interrupts defined by an >> "interrupts" property. You could patch this through on sub-devices, >> of course, but that's already done correctly by the existing >> ofw_bus_map_intr() code in a much more robust way that doesn't >> involve trying to guess how sub-buses and devices have chosen to >> allocate resources. Why reinvent the wheel all the way through the >> bus hierarchy? > Nope, the code only expect that „interrupts" property is default way > hot to get interrupt description. Any device or bus in the hierarchy > can fill appropriate resource list, or terminate call at any level. "interrupts" should not be the default -- it's part of the OF bindings for the bus and is used (notably) by simplebus. The issue of cross-correlating RIDs is a much larger problem, however. [snip] >> >>>>> >>>>> The patch simply postpones reading of interrupt property to >>>>> bus_alloc_resource() (called by consumer driver) time. >>>>> >>>>> Due to this, we can: >>>>> - parse interrupt property. The interrupt driver must exist >>>>> at this time. >>>> >>>> This only works with some types of interrupt properties, not all, >>>> and breaks if the interrupt driver hasn't attached yet (which it >>>> can't be guaranteed to -- some PPC systems have interrupt drivers >>>> that live on the PCI bus, for example). >>> How you can allocate (and reserve it in rman) interrupt if is not >>> mapped (so you have not real IRQ number for it). Just for notice - >>> multiple virtual IRQs can be mapped into single real IRQ. >> >> The core idea is to think of the full interrupt specifier -- the >> interrupt parent and the full byte string in the device tree -- as >> the IRQ rather than the interrupt pin on some chip (which is usually, >> but not always, the first word in that byte string). The "virtual" >> IRQ number is just a compression of that longer piece of data, which >> usually can't fit in an rman resource. > I understand. While this approach can works (and actually works) for > single sourced OFW world, it immediately fails if you must be able to > parse data from different sources (which uses different encoding) > (OFW, UEFI / ACPI, GPIO...) within one system. On PowerPC, GENERIC64 supports FDT systems (some IBM hardware), OFW systems (Macs, some IBM hardware), systems with no device trees at all (old-style PS3), and systems with a mixture of device tree and no device tree (new-style PS3). On these, there is a mixture of "real" interrupts and GPIO-type interrupts. There is no limitation that this be used only for device-tree-type systems. The system requires two things: an interrupt domain key and an arbitrary unique byte string describing the interrupt. When running with a device tree, these are set to the phandle of the interrupt-parent and the contents of the device tree interrupt specifier, respectively, and the system was of course developed with that in mind. But they don't need to be, and often aren't. You could make the domain an element of an enum (where "ACPI" is a choice, for instance -- this is what PS3 does), or set it to a pointer to a device_t, or really anything you like. Similarly, the interrupt specifier is totally free-form. You could, for instance, set it to one of the structures introduced in r301453 if you wanted to. I would have zero problems with changing the prototype of the existing dev/ofw function to something more generic in name, like: bus_map_intr(device_t dev, uintptr_t iparent, size_t intrlen, void *intr) instead of the existing equivalent: ofw_bus_map_intr(device_t dev, phandle_t iparent, int icells, pcell_t *intr) > By this, one byte string in OFW encoding can describe one IRQ and > exactly same string in UEFI encoding can describe different IRQ. Or, > in reverse, OFW and UEFI can describe same (and compatible) IRQ by two > different strings. > This is exact reason, why we discards virtual IRQ idea and I think > that this fact is root issue of this clash. > Probably it doesn't make sense to talk about others, unless we can > find consensus on this. You have the larger problem if you end up in this situation that you are enumerating the hardware by two different and incompatible techniques. There simply is no way to solve this unless you either (a) segregate the system into an ACPI-enumerated domain and an OF-enumerated domain, in which case the problem vanishes, (b) discard one enumeration, which is what arm64 does and will always do, according to Andrew in another post, or (c) make some incredibly complex merging code that would naturally handle interrupts with everything else. So I don't think this is an actual, real problem. In circumstances where you have a nested, non-device-tree hierarchy (e.g. OPAL on PowerNV or GPIOs or what-have-you), this kind of problem is easily solved by inventing an extra interrupt domain. > >> There is no need to actually activate those interrupts before >> interrupts are enabled, so you can just cache them in a table until >> the end of device probing, which lets you break circular dependency >> loops between bus and interrupt topology. >> >> So long as you keep track of your mapping and the same (parent, >> interrupt specifier) parent always gives the same virtual IRQ, there >> is no way in this system to map multiple active IRQs onto a single >> interrupt pin on the PIC unless your device tree is broken and >> specifies two devices with incompatible modes (active high and edge >> downgoing or something) on the same pin. In this case, nothing you >> can do will save you -- unless your PIC supports interrupts for >> different kinds of events, in which case this system will work >> perfectly by treating them as different interrupts to the kernel for >> which the fact they are on the same pin is immaterial. >> >> I should note that ARM and MIPS have an almost complete >> implementation of this already: maybe some more intr_machdep.c logic >> is needed for some cases, but all the rest of the plumbing is there. >> >>> >>>> >>>>> - bus_alloc_resource() returns resource, so we can attach parsed >>>>> interrupt data to it. By this, the resource itself can be used >>>>> for delivering configuration data to subsequent call to >>>>> bus_setup_intr() (or to all related bus_() calls). >>>>> >>>>> >>>>> The patched code still accepts delivering of interrupts in >>>>> resource list. >>>>> >>>>> Michal >>>>> >>>> >>>> Given that other code depends on this, fixing it will likely >>>> require some complex work. I wish I had known about it when it went >>>> in. >>>> >>>> There are three main problems: >>>> 1. It doesn't work for interrupts defined by other mechanisms (e.g. >>>> interrupt-map properties) >>> I aggree, but missing ' interrupt-map' functioanlity is not caused >>> by this patch. >> >> It is in that the standard system already implements it completely. > Really? > https://svnweb.freebsd.org/base/head/sys/dev/ofw/ofw_bus_subr.c?revision=301453&view=markup#l521 > and > https://svnweb.freebsd.org/base/head/sys/arm/arm/nexus.c?revision=301453&view=markup#l411 That function is questionable and I objected to it at the time; it is meant only as a convenience for simplebus. More complicated cases, like ofwpci.c, use interrupt-map and have for a very long time. Simplebus allows interrupt-map but support has never been added, which is a bug. One of the major problems I have with this patch is that adding it would now require parsing all of that in two places, and cross-correlating them with questionable chance of success, rather than in just one. FreeBSD/PowerPC systems have relied on interrupt-map for ten years now. It's not especially exotic. >> >>> >>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>>> but is both problematically more general and less flexible (it has >>>> requirements on timing of PIC attachment vs. driver resource >>>> allocation) >>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>> parsed data are magicaly stored within the call. >>> The new method, bus_map_intr(), can parse data from multiple >>> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). >>> It also returns parsed data back to caller. >> >> That is not true. It works as long as you can specify the interrupt >> state as a 32-bit key of some kind for the PIC and a string of >> arbitrary data, which works with all of those. You could even make >> the interrupt data be a pointer to exactly the structs you have >> chosen to define here. > Nope, in heterogeneous world, same string can describe two different > IRQs and/or two different strings can describe single IRQ in > compatible manner. Can you give *any* concrete example of this that doesn't involve mixed ACPI/FDT enumeration of a single system where devices appear in both trees, which doesn't actually ever happen? And even in those cases, there is no problem, since the PIC driver can just dispatch both (or more) vectors corresponding to the interrupt pin when the configured interrupt fires. It would have to have special logic to handle decoding unrelated types of interrupt specifiers; adding that would be about 3 lines of code. > >> >>> And no, it doesn't add any additional timing requirements . >> >> As far as I can tell, it requires the interrupt controller to be >> attached before you can allocate interrupts. Is that not true? > Yes, sure. And the patch doesn't change this. > Before: > https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301263#l1103 > After: > https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301543#l928 On PowerPC, we don't require this and never have. The VIRQ stuff is meant explicitly to not require this. >> >>> >>>> 3. It is not fully transparent to end code. Since it happens at >>>> bus_alloc_resource() time, it is complicated to get the appropriate >>>> values for IRQs constructed by composite techniques (interrupt-map >>>> vs. interrupts vs. hand allocation vs. PCI routing, for example). >>> I don't see any limitation - can you be more exact? Why is not >>> transparent? Why is more complicated ? >> >> Suppose that a PCI device adds more IRQs to its resource list or >> modifies the ordering. How is whatever bus layer supposed to do >> something sensible at allocation time? It requires that RID numbers >> mean something to the parent bus after assignment, which is not >> guaranteed by anything and is, in more than handful of cases I think >> of, not true in practice. > Sure. And since the new code allows delivering resources in RL, so I > don't see any limitation here. It indexed mapping by RID and then searches interrupt lists by that to get the interrupt-parent. This is fundamentally a broken design if the child needs to, say, add a second interrupt to its RL on a different interrupt-parent. > >> >>>> It is much easier to do this correctly at bus attach time when the >>>> resource lists are made (how PPC does it). >>>> >>> I don't agree. I don't agree. Making this at bus attach time leads >>> into complicated 'virtual' IRQ infrastructure, with many unresolved >>> corner cases. >> >> Which unresolved corner cases? This has been working correctly on a >> number of platforms in both FreeBSD and Linux for many years. > Nope, it doesn't work for ARM yet (for GPIO interrupts for example) > and Linux uses EPROBE_DEFER mechanism for a long time. > See: http://lxr.free-electrons.com/source/drivers/base/platform.c#L87 There is some missing code on ARM (probably about 30 minutes of work to make it match PowerPC) to make it work in an ideal case, sure, but there is no reason you could not go out right now, with the existing code, and implement GPIO interrupts by declaring the GPIO driver as an interrupt controller. Can you give any concrete case of something that doesn't work? > >> >>> >>>> (1) is easy to fix without API changes, but (2) and (3) are >>>> fundamental architectural problems that will bite us immediately >>>> down the road and cause a permanent schism between OF support on >>>> different platforms. >>>> >>>> Let me describe how this is handled on PowerPC (Linux on PPC solves >>>> the problem the same way). When constructing a resource list, bus >>>> drivers that construct them from OF properties call >>>> ofw_bus_map_intr() with the interrupt parent phandle and the array >>>> of cells corresponding to the interrupt. This thunks immediately to >>>> nexus, which connects to code in intr_machdep.c. Code there assigns >>>> a unique made-up virtual IRQ and returns it, caching the interrupt >>>> parent ID and opaque interrupt data (if the same string of data >>>> reappears later, you get back the same virtual IRQ of course). >>>> >>>> When PIC drivers attach and register themselves with the interrupt >>>> handling layer, all the interrupts for that PIC are passed to it >>>> along with the virtual IRQ. The PIC driver is supposed to know what >>>> its interrupt data mean, which can be safely guaranteed, and it >>>> presents the assigned virtual IRQ number to the kernel when >>>> dispatching interrupts. (IRQs configured after PIC attachment are >>>> passed through immediately). >>>> >>>> This accomplishes the following things: >>>> 1. Parsing interrupt data is moved to the PIC driver, which is the >>>> only place it can be done safely. >>> I don't see anything different comparing with INTRNG. >> >> What I am advocating *is* INTRNG, at least as originally conceived >> and implemented. >> >>>> 2. There is no ordering requirement on PIC attachment vs. the >>>> attachment of anything else. >>> I think thats is not a true - PIC must exist before >>> bus_alloc_resource() / bus_setup_intr() is called. >> >> It does not with the IRQ mapping infrastructure. Interrupts are set >> up at PIC attachment, whenever that occurs. >> > Assuming that bus_alloc_resource and bus_setup_intr() are close > thorougher and in linear piece of code, can i assume that you can call > bus_setup_intr() > without PIC attached ? Yes. >>> >>>> 3. Changes are extremely minimal relative to the "standard" >>>> interrupt flow: you only have to patch code that is already >>>> directly dealing with OF interrupts. >>> I don't see anything different comparing with INTRNG. >> >> Again, this was the original INTRNG architecture and is already >> implemented. As such, there are *no* changes required on ARM to get >> it. bus_map_intr() adds a bunch of new code, in parallel with the old >> code that also solves the problem, to no purpose. > So, on PPC, how i can get interrupt for GPIO pin described by this > property: > https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/tegra124-jetson-tk1.dts?revision=295436&view=markup#l1691 > The GPIO controller registers itself as an interrupt domain and decodes those strings as IRQ specifiers. When interrupts are configured, it does whatever it needs to do to configure them appropriately and dispatches them to the kernel when they occur. It's a pretty trivial cascaded interrupt configuration. And, since the VIRQ code does not need the interrupt controller attached in advance, you don't need to worry about attach order of wherever &gpio points and the SDHCI driver. >> >>>> 4. It happens at bus enumeration time, when results can be >>>> guaranteed self-consistent. >>> Where do you see any potential source of inconsistency in INTRNG? >> >> See the example above about modified interrupt lists. There is also >> no obvious way for a child device to construct an interrupt not >> assigned to it by the parent device from device tree properties >> without knowing in some detail what kind of interrupt needs to be built. >> >>> >>>> 5. It combines naturally with ofw_bus_lookup_imap() and friends in >>>> the interrupt-map case (e.g. for PCI). >>> Again, I don't see anything different. Proper parsing of interrupt >>> property is not a problem of INTRNG (but must be fixed, of course). >> >> But it is *already* fixed by the standard code that already exists. >> You are introducing a less-functional parallel code path here. > NO, its not fixed, at least not for ARM. Why not, concretely? I'm happy to write whatever code is missing if there's a bug. It can't be more than a few tens of lines in arm/intr.c. >> >>>> >>>> I'm not sure what the right path forward is, but this code needs to >>>> be fixed. The PowerPC code is fully MI, and was the template for >>>> the original INTRNG, so it shouldn't be too bad to replace. >>>> -Nathan >>>> >>> >>> So, new INTRNG: >>> - Introduces new more general bus method that can parse interrupt >>> configuration >>> data from any source. Is this step backward? >> >> Yes, since it is more general in some sense, while simultaneously >> handling fewer cases than code that already exists and is implemented. >> >>> >>> - Old INTRNG and PPC code stores unparsed and/or parsed interrupt >>> data in >>> INTRNG and each consumer must query for them. This data sharing >>> also causes >>> significant locking issues. New INTRNG stores interrupt >>> configuration data into >>> given resource, so each relevant bus method can access it immediately. >>> Is this step backward? >> >> Which locking issues? And yes, it is. >> >>> >>> - New INTRNG is not OFW centric, it can works with virtually >>> unlimited number >>> of configuration data sources. Is this step backward? >> >> Also yes, because it makes the interrupt handles less opaque, which >> makes the infrastructure less flexible. >> >>> - New INTRNG correctly uses standard system infrastructure. Real IRQ >>> number >>> is reserved in rman within bus_alloc_resource() call, interrupt HW is >>> configured (only!) within bus_setup_intr() call. Is this step >>> backward? >> >> The "real" IRQ number is not well defined always, so requiring that >> is a step backwards, yes. >> >>> - New INTRNG completely eliminates huge and not always working virtual >>> IRQ concept. >> >> When does it "not always work"? It seems to, in fact, always work on >> multiple platforms and have for a long time in the face of all kinds >> of totally bizarre topologies and system architectures. >> >>> >>> >>> Don’t take me bad, I’m open to any change. But no, at this time, >>> I’m not ready to completely revert someone else's work – although I >>> am a co-author. >> >> I would urge, in the strongest possible terms, that this be backed >> out from stable/11 at least. We can add the new API back for 11.1 if >> we want it, but we totally lose the ability to change it later in the >> stable/11 cycle if it stays in now. >> -Nathan >> > The API is part of still unstable, experimental INTRNG, so its not > fixed we we can change it at any time, I think. > But yes, we forget to wrap new bus_map_intr() method (and associated > code) by #ifdef INTRNG. Is this sufficient for you? For HEAD, yes. I would like it out of stable/11 entirely until this discussion converges. -Nathan From owner-svn-src-head@freebsd.org Thu Jul 21 16:34: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 5FAD0BA0E46; Thu, 21 Jul 2016 16:34:58 +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 13A5C1898; Thu, 21 Jul 2016 16:34:58 +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 u6LGYvhn038342; Thu, 21 Jul 2016 16:34:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LGYvIH038339; Thu, 21 Jul 2016 16:34:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607211634.u6LGYvIH038339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Jul 2016 16:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303151 - in head/sys: dev/pty 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: Thu, 21 Jul 2016 16:34:58 -0000 Author: kib Date: Thu Jul 21 16:34:56 2016 New Revision: 303151 URL: https://svnweb.freebsd.org/changeset/base/303151 Log: Provide counter_warning(9) KPI which allows to issue limited number of warnings for some kernel events, mostly intended for the use of obsoleted or otherwise undersired interfaces. This is an abstracted and race-expelled code from compat pty driver. Requested and reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7270 Modified: head/sys/dev/pty/pty.c head/sys/kern/subr_prf.c head/sys/sys/systm.h Modified: head/sys/dev/pty/pty.c ============================================================================== --- head/sys/dev/pty/pty.c Thu Jul 21 15:48:41 2016 (r303150) +++ head/sys/dev/pty/pty.c Thu Jul 21 16:34:56 2016 (r303151) @@ -52,10 +52,10 @@ __FBSDID("$FreeBSD$"); * binary emulation. */ -static unsigned int pty_warningcnt = 1; +static unsigned pty_warningcnt = 1; SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, - &pty_warningcnt, 0, - "Warnings that will be triggered upon legacy PTY allocation"); + &pty_warningcnt, 0, + "Warnings that will be triggered upon legacy PTY allocation"); static int ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) @@ -77,12 +77,7 @@ ptydev_fdopen(struct cdev *dev, int ffla } /* Raise a warning when a legacy PTY has been allocated. */ - if (pty_warningcnt > 0) { - pty_warningcnt--; - log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", - td->td_proc->p_pid, td->td_name, - pty_warningcnt ? "" : " - not logging anymore"); - } + counted_warning(&pty_warningcnt, "is using legacy pty devices"); return (0); } Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Thu Jul 21 15:48:41 2016 (r303150) +++ head/sys/kern/subr_prf.c Thu Jul 21 16:34:56 2016 (r303151) @@ -1196,3 +1196,22 @@ sbuf_hexdump(struct sbuf *sb, const void } } +void +counted_warning(unsigned *counter, const char *msg) +{ + struct thread *td; + unsigned c; + + for (;;) { + c = *counter; + if (c == 0) + break; + if (atomic_cmpset_int(counter, c, c - 1)) { + td = curthread; + log(LOG_INFO, "pid %d (%s) %s%s\n", + td->td_proc->p_pid, td->td_name, msg, + c > 1 ? "" : " - not logging anymore"); + break; + } + } +} Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Thu Jul 21 15:48:41 2016 (r303150) +++ head/sys/sys/systm.h Thu Jul 21 16:34:56 2016 (r303151) @@ -447,4 +447,6 @@ void intr_prof_stack_use(struct thread * extern void (*softdep_ast_cleanup)(void); +void counted_warning(unsigned *counter, const char *msg); + #endif /* !_SYS_SYSTM_H_ */ From owner-svn-src-head@freebsd.org Thu Jul 21 16:58: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 D1640BA0553; Thu, 21 Jul 2016 16:58:54 +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 96D1A18BE; Thu, 21 Jul 2016 16:58:54 +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 u6LGwrnI045854; Thu, 21 Jul 2016 16:58:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LGwrDC045853; Thu, 21 Jul 2016 16:58:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607211658.u6LGwrDC045853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Jul 2016 16:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303153 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 16:58:54 -0000 Author: kib Date: Thu Jul 21 16:58:53 2016 New Revision: 303153 URL: https://svnweb.freebsd.org/changeset/base/303153 Log: Remove spurious but harmless double-quote. Noted by: jhb Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Jul 21 16:56:04 2016 (r303152) +++ head/share/man/man7/arch.7 Thu Jul 21 16:58:53 2016 (r303153) @@ -47,7 +47,7 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy "sizeof(long double)" +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" .It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) .It amd64 Ta 8 Ta 16 .It arm Ta 4 Ta 8 @@ -66,7 +66,7 @@ On all supported architectures, .It sparc64 Ta 8 Ta 16 .El .Ss Endianness and Char Signedness -.Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy "char Signedness" +.Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness .It amd64 Ta little Ta signed .It arm Ta little Ta unsigned From owner-svn-src-head@freebsd.org Thu Jul 21 17:07: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 13560BA0A29; Thu, 21 Jul 2016 17:07:08 +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 D1A7A1F0C; Thu, 21 Jul 2016 17:07:07 +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 u6LH76gv049438; Thu, 21 Jul 2016 17:07:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LH76Mt049437; Thu, 21 Jul 2016 17:07:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607211707.u6LH76Mt049437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Jul 2016 17:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303154 - 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, 21 Jul 2016 17:07:08 -0000 Author: kib Date: Thu Jul 21 17:07:06 2016 New Revision: 303154 URL: https://svnweb.freebsd.org/changeset/base/303154 Log: Declare aio requests on files from local filesystems safe. Two notes: - I allow AIO on reclaimed vnodes, since it is deterministically terminated fast. - devfs mounts are marked as MNT_LOCAL, but device vnodes have type VCHR, so the slow device io is not allowed. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7273 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Thu Jul 21 16:58:53 2016 (r303153) +++ head/sys/kern/vfs_aio.c Thu Jul 21 17:07:06 2016 (r303154) @@ -1664,7 +1664,10 @@ aio_queue_file(struct file *fp, struct k struct aioliojob *lj; struct kaioinfo *ki; struct kaiocb *job2; + struct vnode *vp; + struct mount *mp; int error, opcode; + bool safe; lj = job->lio; ki = job->userproc->p_aioinfo; @@ -1685,7 +1688,16 @@ aio_queue_file(struct file *fp, struct k goto done; #endif queueit: - if (!enable_aio_unsafe) + safe = false; + if (fp->f_type == DTYPE_VNODE) { + vp = fp->f_vnode; + if (vp->v_type == VREG || vp->v_type == VDIR) { + mp = fp->f_vnode->v_mount; + if (mp == NULL || (mp->mnt_flag & MNT_LOCAL) != 0) + safe = true; + } + } + if (!(safe || enable_aio_unsafe)) return (EOPNOTSUPP); if (opcode == LIO_SYNC) { From owner-svn-src-head@freebsd.org Thu Jul 21 17:54: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 8A767BA14A6; Thu, 21 Jul 2016 17:54:15 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5780B1CFF; Thu, 21 Jul 2016 17:54:14 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from xc1.bsdpad.com ([195.154.136.64]:31941) by ppsw-40.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1bQIAm-000dqG-jg (Exim 4.86_36-e07b163) (return-path ); Thu, 21 Jul 2016 18:54:12 +0100 Date: Thu, 21 Jul 2016 18:52:25 +0100 From: Ruslan Bukin To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303151 - in head/sys: dev/pty kern sys Message-ID: <20160721175225.GA84153@bsdpad.com> References: <201607211634.u6LGYvIH038339@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <201607211634.u6LGYvIH038339@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 17:54:15 -0000 Hi, I get the issues below with GCC 6.1 [...] =3D=3D=3D> lib/libsbuf (obj,all,install) /home/rb743/opt/new17/bin/riscv64-unknown-freebsd11.0-gcc -isystem /home/rb= 743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/include -L/home= /rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/lib --sysroo= t=3D/home/rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp -B/home= /rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/bin -O2 -pi= pe -msoft-float -MD -MF.depend.subr_prf.o -MTsubr_prf.o -std=3Dgnu99 -fs= tack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wn= o-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith= -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-param= eter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-d= ecls -Wold-style-definition -Wno-pointer-sign -Wno-error=3Dunused-function = -Wno-error=3Denum-compare -Wno-error=3Dlogical-not-parentheses -Wno-error= =3Dbool-compare -Wno-error=3Duninitialized -Wno-error=3Darray-bounds -Wno-e= rror=3Dclobbered -Wno-error=3Dcast-align -Wno-error=3Dextra -Wno-error=3Dat= tributes -Wno-error=3Dinline -Wno-error=3Dunused-but-set-variable -Wno-erro= r=3Dunused-value -Wno-error=3Dstrict-aliasing -Wno-error=3Daddress -Wno-err= or=3Dunused-const-variable=3D -Wno-error=3Dnonnull-compare -Wno-error=3Dshi= ft-negative-value -Wno-error=3Dmisleading-indentation -Wno-error=3Dtautolog= ical-compare -c /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/ker= n/subr_prf.c -o subr_prf.o /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1200:1:= error: no previous prototype for 'counted_warning' [-Werror=3Dmissing-prot= otypes] counted_warning(unsigned *counter, const char *msg) ^~~~~~~~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c: In fun= ction 'counted_warning': /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:7:= error: implicit declaration of function 'atomic_cmpset_int' [-Werror=3Dimp= licit-function-declaration] if (atomic_cmpset_int(counter, c, c - 1)) { ^~~~~~~~~~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:3:= error: nested extern declaration of 'atomic_cmpset_int' [-Werror=3Dnested-= externs] if (atomic_cmpset_int(counter, c, c - 1)) { ^~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:9:= error: 'curthread' undeclared (first use in this function) td =3D curthread; ^~~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:9:= note: each undeclared identifier is reported only once for each function i= t appears in /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: implicit declaration of function 'log' [-Werror=3Dimplicit-function= -declaration] log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: incompatible implicit declaration of built-in function 'log' [-Werr= or] /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= note: include '' or provide a declaration of 'log' /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:8:= error: 'LOG_INFO' undeclared (first use in this function) log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~~~~~~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1212:10= : error: dereferencing pointer to incomplete type 'struct thread' td->td_proc->p_pid, td->td_name, msg, ^~ /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:4:= error: too many arguments to function 'log' log(LOG_INFO, "pid %d (%s) %s%s\n", ^~~ cc1: all warnings being treated as errors *** [subr_prf.o] Error code 1 bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf 1 error bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf *** [lib/libsbuf__L] Error code 2 bmake[3]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[3]: stopped in /home/rb743/dev/freebsd-riscv *** [libraries] Error code 2 bmake[2]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[2]: stopped in /home/rb743/dev/freebsd-riscv *** [_libraries] Error code 2 bmake[1]: stopped in /home/rb743/dev/freebsd-riscv 1 error bmake[1]: stopped in /home/rb743/dev/freebsd-riscv *** [buildworld] Error code 2 make: stopped in /home/rb743/dev/freebsd-riscv make: stopped in /home/rb743/dev/freebsd-riscv 0 vica:/home/rb743/dev/freebsd-riscv > On Thu, Jul 21, 2016 at 04:34:57PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Thu Jul 21 16:34:56 2016 > New Revision: 303151 > URL: https://svnweb.freebsd.org/changeset/base/303151 >=20 > Log: > Provide counter_warning(9) KPI which allows to issue limited number of > warnings for some kernel events, mostly intended for the use of > obsoleted or otherwise undersired interfaces. > =20 > This is an abstracted and race-expelled code from compat pty driver. > =20 > Requested and reviewed by: jhb > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D7270 >=20 > Modified: > head/sys/dev/pty/pty.c > head/sys/kern/subr_prf.c > head/sys/sys/systm.h >=20 > Modified: head/sys/dev/pty/pty.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/sys/dev/pty/pty.c Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/dev/pty/pty.c Thu Jul 21 16:34:56 2016 (r303151) > @@ -52,10 +52,10 @@ __FBSDID("$FreeBSD$"); > * binary emulation. > */ > =20 > -static unsigned int pty_warningcnt =3D 1; > +static unsigned pty_warningcnt =3D 1; > SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, > - &pty_warningcnt, 0, > - "Warnings that will be triggered upon legacy PTY allocation"); > + &pty_warningcnt, 0, > + "Warnings that will be triggered upon legacy PTY allocation"); > =20 > static int > ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct fi= le *fp) > @@ -77,12 +77,7 @@ ptydev_fdopen(struct cdev *dev, int ffla > } > =20 > /* Raise a warning when a legacy PTY has been allocated. */ > - if (pty_warningcnt > 0) { > - pty_warningcnt--; > - log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", > - td->td_proc->p_pid, td->td_name, > - pty_warningcnt ? "" : " - not logging anymore"); > - } > + counted_warning(&pty_warningcnt, "is using legacy pty devices"); > =20 > return (0); > } >=20 > Modified: head/sys/kern/subr_prf.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/sys/kern/subr_prf.c Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/kern/subr_prf.c Thu Jul 21 16:34:56 2016 (r303151) > @@ -1196,3 +1196,22 @@ sbuf_hexdump(struct sbuf *sb, const void > } > } > =20 > +void > +counted_warning(unsigned *counter, const char *msg) > +{ > + struct thread *td; > + unsigned c; > + > + for (;;) { > + c =3D *counter; > + if (c =3D=3D 0) > + break; > + if (atomic_cmpset_int(counter, c, c - 1)) { > + td =3D curthread; > + log(LOG_INFO, "pid %d (%s) %s%s\n", > + td->td_proc->p_pid, td->td_name, msg, > + c > 1 ? "" : " - not logging anymore"); > + break; > + } > + } > +} >=20 > Modified: head/sys/sys/systm.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/sys/systm.h Thu Jul 21 15:48:41 2016 (r303150) > +++ head/sys/sys/systm.h Thu Jul 21 16:34:56 2016 (r303151) > @@ -447,4 +447,6 @@ void intr_prof_stack_use(struct thread * > =20 > extern void (*softdep_ast_cleanup)(void); > =20 > +void counted_warning(unsigned *counter, const char *msg); > + > #endif /* !_SYS_SYSTM_H_ */ >=20 From owner-svn-src-head@freebsd.org Thu Jul 21 17:59: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 B5168BA15D3; Thu, 21 Jul 2016 17:59:31 +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 7F1D71003; Thu, 21 Jul 2016 17:59:31 +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 u6LHxUWc068446; Thu, 21 Jul 2016 17:59:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LHxU8W068445; Thu, 21 Jul 2016 17:59:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607211759.u6LHxU8W068445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Jul 2016 17:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303155 - 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, 21 Jul 2016 17:59:31 -0000 Author: kib Date: Thu Jul 21 17:59:30 2016 New Revision: 303155 URL: https://svnweb.freebsd.org/changeset/base/303155 Log: Hide counted_warning(9) under #ifdef _KERNEL braces, to allow building subr_prf.c in userspace for libsbuf. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Thu Jul 21 17:07:06 2016 (r303154) +++ head/sys/kern/subr_prf.c Thu Jul 21 17:59:30 2016 (r303155) @@ -1196,6 +1196,7 @@ sbuf_hexdump(struct sbuf *sb, const void } } +#ifdef _KERNEL void counted_warning(unsigned *counter, const char *msg) { @@ -1215,3 +1216,4 @@ counted_warning(unsigned *counter, const } } } +#endif From owner-svn-src-head@freebsd.org Thu Jul 21 18:01: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 E7114BA1652; Thu, 21 Jul 2016 18:01:21 +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 9110B1373; Thu, 21 Jul 2016 18:01:21 +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 u6LI1BCN031870 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 21 Jul 2016 21:01:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u6LI1BCN031870 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u6LI1BIs031869; Thu, 21 Jul 2016 21:01:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 21 Jul 2016 21:01:11 +0300 From: Konstantin Belousov To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303151 - in head/sys: dev/pty kern sys Message-ID: <20160721180111.GH38613@kib.kiev.ua> References: <201607211634.u6LGYvIH038339@repo.freebsd.org> <20160721175225.GA84153@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20160721175225.GA84153@bsdpad.com> 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: Thu, 21 Jul 2016 18:01:22 -0000 On Thu, Jul 21, 2016 at 06:52:25PM +0100, Ruslan Bukin wrote: > Hi, >=20 > I get the issues below with GCC 6.1 >=20 > [...] > =3D=3D=3D> lib/libsbuf (obj,all,install) > /home/rb743/opt/new17/bin/riscv64-unknown-freebsd11.0-gcc -isystem /home/= rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/include -L/ho= me/rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/lib --sysr= oot=3D/home/rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp -B/ho= me/rb743/obj//riscv.riscv64/home/rb743/dev/freebsd-riscv/tmp/usr/bin -O2 -= pipe -msoft-float -MD -MF.depend.subr_prf.o -MTsubr_prf.o -std=3Dgnu99 -= fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -= Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-ari= th -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-par= ameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant= -decls -Wold-style-definition -Wno-pointer-sign -Wno-error=3Dunused-functio= n -Wno-error=3Denum-compare -Wno-error=3Dlogical-not-parentheses -Wno-error= =3Dbool-compare -Wno-error=3Duninitialized -Wno-error=3Darray-bounds -Wno-e= rror=3Dclobbered -Wno-error=3Dcast-align -Wno-error=3Dextra -Wno-error=3Dat= tributes -Wno-error=3Dinline -Wno-error=3Dunused-but-set-variable -Wno-erro= r=3Dunused-value -Wno-error=3Dstrict-aliasing -Wno-error=3Daddress -Wno-err= or=3Dunused-const-variable=3D -Wno-error=3Dnonnull-compare -Wno-error=3Dshi= ft-negative-value -Wno-error=3Dmisleading-indentation -Wno-error=3Dtautolog= ical-compare -c /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/ker= n/subr_prf.c -o subr_prf.o > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1200:= 1: error: no previous prototype for 'counted_warning' [-Werror=3Dmissing-pr= ototypes] > counted_warning(unsigned *counter, const char *msg) > ^~~~~~~~~~~~~~~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c: In f= unction 'counted_warning': > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:= 7: error: implicit declaration of function 'atomic_cmpset_int' [-Werror=3Di= mplicit-function-declaration] > if (atomic_cmpset_int(counter, c, c - 1)) { > ^~~~~~~~~~~~~~~~~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1209:= 3: error: nested extern declaration of 'atomic_cmpset_int' [-Werror=3Dneste= d-externs] > if (atomic_cmpset_int(counter, c, c - 1)) { > ^~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:= 9: error: 'curthread' undeclared (first use in this function) > td =3D curthread; > ^~~~~~~~~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1210:= 9: note: each undeclared identifier is reported only once for each function= it appears in > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:= 4: error: implicit declaration of function 'log' [-Werror=3Dimplicit-functi= on-declaration] > log(LOG_INFO, "pid %d (%s) %s%s\n", > ^~~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:= 4: error: incompatible implicit declaration of built-in function 'log' [-We= rror] > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:= 4: note: include '' or provide a declaration of 'log' > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:= 8: error: 'LOG_INFO' undeclared (first use in this function) > log(LOG_INFO, "pid %d (%s) %s%s\n", > ^~~~~~~~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1212:= 10: error: dereferencing pointer to incomplete type 'struct thread' > td->td_proc->p_pid, td->td_name, msg, > ^~ > /home/rb743/dev/freebsd-riscv/lib/libsbuf/../../sys/kern/subr_prf.c:1211:= 4: error: too many arguments to function 'log' > log(LOG_INFO, "pid %d (%s) %s%s\n", > ^~~ > cc1: all warnings being treated as errors > *** [subr_prf.o] Error code 1 >=20 > bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf > 1 error >=20 > bmake[4]: stopped in /home/rb743/dev/freebsd-riscv/lib/libsbuf > *** [lib/libsbuf__L] Error code 2 >=20 > bmake[3]: stopped in /home/rb743/dev/freebsd-riscv > 1 error >=20 > bmake[3]: stopped in /home/rb743/dev/freebsd-riscv > *** [libraries] Error code 2 >=20 > bmake[2]: stopped in /home/rb743/dev/freebsd-riscv > 1 error >=20 > bmake[2]: stopped in /home/rb743/dev/freebsd-riscv > *** [_libraries] Error code 2 >=20 > bmake[1]: stopped in /home/rb743/dev/freebsd-riscv > 1 error >=20 > bmake[1]: stopped in /home/rb743/dev/freebsd-riscv > *** [buildworld] Error code 2 >=20 > make: stopped in /home/rb743/dev/freebsd-riscv >=20 > make: stopped in /home/rb743/dev/freebsd-riscv This should be fixed with r303155. From owner-svn-src-head@freebsd.org Thu Jul 21 18:12: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 4FAD8BA1AB5; Thu, 21 Jul 2016 18:12:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C4481F38; Thu, 21 Jul 2016 18:12:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LICd3h075815; Thu, 21 Jul 2016 18:12:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LICdOP075814; Thu, 21 Jul 2016 18:12:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607211812.u6LICdOP075814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Jul 2016 18:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303156 - head/crypto/heimdal/lib/roken X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 18:12:40 -0000 Author: emaste Date: Thu Jul 21 18:12:39 2016 New Revision: 303156 URL: https://svnweb.freebsd.org/changeset/base/303156 Log: Remove duplicate symbols from libroken version-script.map Upstream commit r24759 (efed563) prefixed some symbols with rk_, but introduced 6 duplicate symbols in the version script (because the rk_-prefixed versions of the symbols were already present). Modified: head/crypto/heimdal/lib/roken/version-script.map Modified: head/crypto/heimdal/lib/roken/version-script.map ============================================================================== --- head/crypto/heimdal/lib/roken/version-script.map Thu Jul 21 17:59:30 2016 (r303155) +++ head/crypto/heimdal/lib/roken/version-script.map Thu Jul 21 18:12:39 2016 (r303156) @@ -123,17 +123,12 @@ HEIMDAL_ROKEN_1.0 { rk_strptime; rk_strsep_copy; rk_strsvis; - rk_strsvis; rk_strsvisx; rk_strunvis; - rk_strunvis; rk_strunvisx; rk_strupr; rk_strvis; - rk_strvis; rk_strvisx; - rk_strvisx; - rk_svis; rk_svis; rk_timegm; rk_timevaladd; @@ -148,7 +143,6 @@ HEIMDAL_ROKEN_1.0 { rk_vasnprintf; rk_vasprintf; rk_vis; - rk_vis; rk_vsnprintf; rk_vstrcollect; rk_wait_for_process; From owner-svn-src-head@freebsd.org Thu Jul 21 18:20: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 2585FBA1C45; Thu, 21 Jul 2016 18:20:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC2E3178A; Thu, 21 Jul 2016 18:20:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LIKaEN076262; Thu, 21 Jul 2016 18:20:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LIKagq076261; Thu, 21 Jul 2016 18:20:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607211820.u6LIKagq076261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Jul 2016 18:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303157 - head/contrib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 18:20:37 -0000 Author: emaste Date: Thu Jul 21 18:20:35 2016 New Revision: 303157 URL: https://svnweb.freebsd.org/changeset/base/303157 Log: libcxxrt: add padding in __cxa_allocate_* to fix alignment The addition of the referenceCount to __cxa_allocate_exception put the unwindHeader at offset 0x58 in __cxa_exception, but it requires 16-byte alignment. In order to avoid changing the current __cxa_exception ABI (and thus breaking its consumers), add explicit padding in the allocation routines (and account for it when freeing). This is intended as a lower-risk change for FreeBSD 11. A "more correct" fix should be prepared for upstream and -CURRENT. Reviewed by: dim MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7271 Modified: head/contrib/libcxxrt/exception.cc Modified: head/contrib/libcxxrt/exception.cc ============================================================================== --- head/contrib/libcxxrt/exception.cc Thu Jul 21 18:12:39 2016 (r303156) +++ head/contrib/libcxxrt/exception.cc Thu Jul 21 18:20:35 2016 (r303157) @@ -572,6 +572,19 @@ static void free_exception(char *e) } } +#ifdef __LP64__ +/** + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte + * alignment but it was broken by the addition of the referenceCount. + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep + * compatibility with consumers of the broken __cxa_exception, explicitly add + * padding on allocation (and account for it on free). + */ +static const int exception_alignment_padding = 8; +#else +static const int exception_alignment_padding = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -580,16 +593,19 @@ static void free_exception(char *e) */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + sizeof(__cxa_exception); + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + + thrown_size; char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_exception); + return buffer + exception_alignment_padding + sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = sizeof(__cxa_dependent_exception); + size_t size = exception_alignment_padding + + sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_dependent_exception); + return buffer + exception_alignment_padding + + sizeof(__cxa_dependent_exception); } /** @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(voi } } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } static void releaseException(__cxa_exception *exception) @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } /** From owner-svn-src-head@freebsd.org Thu Jul 21 18:47: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 49DA6BA0266; Thu, 21 Jul 2016 18:47:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CCDA1859; Thu, 21 Jul 2016 18:47:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LIlpOn087469; Thu, 21 Jul 2016 18:47:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LIlpQw087468; Thu, 21 Jul 2016 18:47:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201607211847.u6LIlpQw087468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Jul 2016 18:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303158 - head/lib/libmd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 18:47:52 -0000 Author: emaste Date: Thu Jul 21 18:47:51 2016 New Revision: 303158 URL: https://svnweb.freebsd.org/changeset/base/303158 Log: libmd: strip local absolute symbols (to link with lld) Old versions of gas produce an invalid section index. That is ignored by old versions of ld, but prevents a link with lld. Submitted by: Rafael Ávila de Espíndola (earlier version) Reviewed by: allanjude Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6789 Modified: head/lib/libmd/Makefile Modified: head/lib/libmd/Makefile ============================================================================== --- head/lib/libmd/Makefile Thu Jul 21 18:20:35 2016 (r303157) +++ head/lib/libmd/Makefile Thu Jul 21 18:47:51 2016 (r303158) @@ -93,6 +93,7 @@ SRCS+= rmd160.S CFLAGS+= -DRMD160_ASM .endif .if exists(${MACHINE_ARCH}/skein_block_asm.s) +AFLAGS += --strip-local-absolute SRCS+= skein_block_asm.s CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792 .endif From owner-svn-src-head@freebsd.org Thu Jul 21 19:01: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 40006BA070D; Thu, 21 Jul 2016 19:01:45 +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 238AD12AA; Thu, 21 Jul 2016 19:01:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 1CAA516C5; Thu, 21 Jul 2016 19:01:45 +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 B97681A0B9; Thu, 21 Jul 2016 19:01:44 +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 cDiFbYoMVMSm; Thu, 21 Jul 2016 19:01:37 +0000 (UTC) Subject: Re: svn commit: r303151 - in head/sys: dev/pty kern sys DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 809331A0B4 To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607211634.u6LGYvIH038339@repo.freebsd.org> From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: <78df720f-e94e-7980-d9c4-82b410ecb130@FreeBSD.org> Date: Thu, 21 Jul 2016 12:01:28 -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: <201607211634.u6LGYvIH038339@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WdbjkbOl3CA5vlxSdg9tAUtiChqSVhHX3" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 19:01:45 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WdbjkbOl3CA5vlxSdg9tAUtiChqSVhHX3 Content-Type: multipart/mixed; boundary="gEkD1pDtAiCI3nIv7nJK5FuRuukIPW4xR" From: Bryan Drewery To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <78df720f-e94e-7980-d9c4-82b410ecb130@FreeBSD.org> Subject: Re: svn commit: r303151 - in head/sys: dev/pty kern sys References: <201607211634.u6LGYvIH038339@repo.freebsd.org> In-Reply-To: <201607211634.u6LGYvIH038339@repo.freebsd.org> --gEkD1pDtAiCI3nIv7nJK5FuRuukIPW4xR Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 7/21/2016 9:34 AM, Konstantin Belousov wrote: > Author: kib > Date: Thu Jul 21 16:34:56 2016 > New Revision: 303151 > URL: https://svnweb.freebsd.org/changeset/base/303151 >=20 > Log: > Provide counter_warning(9) KPI which allows to issue limited number o= f > warnings for some kernel events, mostly intended for the use of > obsoleted or otherwise undersired interfaces. > =20 > This is an abstracted and race-expelled code from compat pty driver. This is great. Thanks for this. --=20 Regards, Bryan Drewery --gEkD1pDtAiCI3nIv7nJK5FuRuukIPW4xR-- --WdbjkbOl3CA5vlxSdg9tAUtiChqSVhHX3 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 iQEcBAEBAgAGBQJXkRwSAAoJEDXXcbtuRpfPbq4IALeGrvaf10NTGgphSvKF1n2F V+ZTfnuzZNyoQ2M1N/I5KrCj8R334C6alcKiSAeeGrKXuaPzt0zVbYaSraODAxew j7m3uFLMBKMbWDQ54s0KAu8f0AQ+4IfoRCvIhfAbusiVZPeb09smciT97HBMb4EW zZyzlvq63Xyz2SDD4Uj5ejtB6dzun7bMQ7MqNfXIR867lKjhCuu7FsNEiXdGFQJm y8qRzBSOfFdHLCQZtlkYgVSP72mnOJ2kxwmuhng3mFIQhmcLSD62bXvCMDG6+0YF rQiAd2TUMAX66aeQJBiOVyhIUnx9WghWWhS8UX4iPX2nulNF0evh01Z748RO4SQ= =9kxX -----END PGP SIGNATURE----- --WdbjkbOl3CA5vlxSdg9tAUtiChqSVhHX3-- From owner-svn-src-head@freebsd.org Thu Jul 21 19:27: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 CC32EBA107F; Thu, 21 Jul 2016 19:27:05 +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 8553016B3; Thu, 21 Jul 2016 19:27:05 +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 u6LJR4Ic003142; Thu, 21 Jul 2016 19:27:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LJR4eL003141; Thu, 21 Jul 2016 19:27:04 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201607211927.u6LJR4eL003141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 21 Jul 2016 19:27:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303160 - head/etc/ntp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 19:27:05 -0000 Author: cy Date: Thu Jul 21 19:27:04 2016 New Revision: 303160 URL: https://svnweb.freebsd.org/changeset/base/303160 Log: Update leap-seconds to leap-seconds.3676752000. As per https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16: UTC TIME STEP on the 1st of January 2017 A positive leap second will be introduced at the end of December 2016. The sequence of dates of the UTC second markers will be: 2016 December 31, 23h 59m 59s 2016 December 31, 23h 59m 60s 2017 January 1, 0h 0m 0s The difference between UTC and the International Atomic Time TAI is: from 2015 July 1, 0h UTC, to 2017 January 1 0h UTC : UTC-TAI = - 36s from 2017 January 1, 0h UTC, until further notice : UTC-TAI = - 37s Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3676752000 See also: https://www.iers.org/SharedDocs/News/EN/BulletinC.html https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16 MFC after: 1 week Relnotes: yes Modified: head/etc/ntp/leap-seconds Modified: head/etc/ntp/leap-seconds ============================================================================== --- head/etc/ntp/leap-seconds Thu Jul 21 19:18:49 2016 (r303159) +++ head/etc/ntp/leap-seconds Thu Jul 21 19:27:04 2016 (r303160) @@ -130,7 +130,7 @@ # Washington, DC # jeffrey.prillaman@usno.navy.mil # -# Last Update of leap second values: 11 Jan 2016 +# Last Update of leap second values: 6 Jul 2016 # # The following line shows this last update date in NTP timestamp # format. This is the date on which the most recent change to @@ -138,7 +138,7 @@ # be identified by the unique pair of characters in the first two # columns as shown below. # -#$ 3661459200 +#$ 3676752000 # # The data in this file will be updated periodically as new leap # seconds are announced. In addition to being entered on the line @@ -170,10 +170,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C 51 -# File expires on: 1 Dec 2016 +# Updated through IERS Bulletin C 52 +# File expires on: 1 Jun 2017 # -#@ 3689539200 +#@ 3705264000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -202,6 +202,7 @@ 3439756800 34 # 1 Jan 2009 3550089600 35 # 1 Jul 2012 3644697600 36 # 1 Jul 2015 +3692217600 37 # 1 Jan 2017 # # the following special comment contains the # hash value of the data in this file computed @@ -217,5 +218,5 @@ # the hash line is also ignored in the # computation. # -#h 63b4df04 0907d94f 2dadb7a1 684f7767 2a372421 +#h 63f8fea8 587c099d abcf130a ad525eae 3e105052 # From owner-svn-src-head@freebsd.org Thu Jul 21 21:39: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 01F53BA102D; Thu, 21 Jul 2016 21:39:50 +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 D177A14AD; Thu, 21 Jul 2016 21:39:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5ACC5B94A; Thu, 21 Jul 2016 17:39:48 -0400 (EDT) From: John Baldwin To: Andrew Turner Cc: Michal Meloun , Nathan Whitehorn , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys Date: Thu, 21 Jul 2016 14:35:48 -0700 Message-ID: <13301107.Hm25rxUxW2@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160721133742.05f0e045@zapp> References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578F6075.7010500@FreeBSD.org> <20160721133742.05f0e045@zapp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 21 Jul 2016 17:39:48 -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, 21 Jul 2016 21:39:50 -0000 On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: > On Wed, 20 Jul 2016 13:28:53 +0200 > Michal Meloun wrote: > > Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): > > > 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), > > > but is both problematically more general and less flexible (it has > > > requirements on timing of PIC attachment vs. driver resource > > > allocation) > > OFW_BUS_MAP_INTR() can parse only OFW based data and expect that > > parsed data are magicaly stored within the call. > > The new method, bus_map_intr(), can parse data from multiple sources > > (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also > > returns parsed data back to caller. > > And no, it doesn't add any additional timing requirements . > > I've been looking at ACPI on arm64. So far I have not found the need > for this with ACPI as we don't need to send the data to the interrupt > controller driver to be parsed in the way OFW/FDT needs to. ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ in bus_alloc_resource(). What I had advocated in the discussions leading up to this was to have some sort of opaque structure containing a set of properties (the sort of thing bus_map_resource and make_dev_s use) that was passed up at bus_setup_intr() time. I think it should now be passed up at bus_alloc_resource() time instead, but it would allow bus drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree with properties that the interrupt controller can then associate with the IRQ cookie it allocates in its own code. I would let the particular structure have different layouts for different resource types. On x86 we would replace bus_config_intr by passing the level and trigger-mode in this structure. However, I could also see allowing the memattr to be set for a SYS_RES_MEMORY resource so you could have a much shorter way than an explicit bus_map_resource to map an entire BAR as WC for example: struct alloc_resource_args { size_t len; union { struct { enum intr_trigger trigger; enum intr_polarity polarity; } irq; struct { vm_memattr_t memattr; } memory; } } ... union alloc_resource_args args; init_alloc_resource_args(&args, sizeof(args)); args.memattr = VM_MEMATTR_WRITE_COMBINING; /* Uses WC for the implicit mapping. */ res = bus_alloc_resource(...., &args); ... foobus_alloc_resource(..., union alloc_resource_args *args) { union alloc_resource_args args2; switch (type) { case SYS_RES_IRQ: if (args == NULL) { init_alloc_resource_args(&args2, sizeof(args2)); args = &args2; } /* Replace call to BUS_CONFIG_INTR on ACPI: */ if (args->irq.polarity == INTR_POLARITY_CONFORMING && device_has_polarity_from_CRS) args->irq.polarity = polarity_from_CRS; ... } However, you could associate arbitrary data with a resource request by adding more members to the approriate struct in the union. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 21 21:39: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 B2CB3BA1032; Thu, 21 Jul 2016 21:39:50 +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 932ED14B2; Thu, 21 Jul 2016 21:39:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A1F50B953; Thu, 21 Jul 2016 17:39:49 -0400 (EDT) From: John Baldwin To: cem@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303120 - head/sys/kern Date: Thu, 21 Jul 2016 14:23:53 -0700 Message-ID: <2625109.2GfWm3lyWr@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201607202251.u6KMpX73042960@repo.freebsd.org> <2986227.mkPmo6E96P@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 21 Jul 2016 17:39:49 -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, 21 Jul 2016 21:39:50 -0000 Thanks! On Wednesday, July 20, 2016 05:53:57 PM Conrad Meyer wrote: > Sure =E2=80=94 r303122. >=20 > Conrad >=20 > On Wed, Jul 20, 2016 at 4:09 PM, John Baldwin wrote= : > > On Wednesday, July 20, 2016 10:51:33 PM Conrad E. Meyer wrote: > >> Author: cem > >> Date: Wed Jul 20 22:51:33 2016 > >> New Revision: 303120 > >> URL: https://svnweb.freebsd.org/changeset/base/303120 > >> > >> Log: > >> imgact_elf: Rename the segment iterator to match reality > >> > >> The each_writable_segment routine evaluates segments on a slight= ly little more > >> nuanced metric than simply "writable" or not. Rename the functi= on to more > >> closely match its behavior (each_dumpable_segment). > >> > >> Suggested by: jhb > >> Sponsored by: EMC / Isilon Storage Division > > > > Please do the same rename in gcore's elfcore.c as well. > > > > -- > > John Baldwin >=20 --=20 John Baldwin From owner-svn-src-head@freebsd.org Thu Jul 21 22: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 7E017BA1ED7; Thu, 21 Jul 2016 22:49:49 +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 401F318E4; Thu, 21 Jul 2016 22:49:49 +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 u6LMnmnp076657; Thu, 21 Jul 2016 22:49:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LMnlEJ076651; Thu, 21 Jul 2016 22:49:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607212249.u6LMnlEJ076651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Jul 2016 22:49:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303164 - in head: lib/libc/sys share/man/man4 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, 21 Jul 2016 22:49:49 -0000 Author: jhb Date: Thu Jul 21 22:49:47 2016 New Revision: 303164 URL: https://svnweb.freebsd.org/changeset/base/303164 Log: Add more documentation regarding unsafe AIO requests. The asynchronous I/O changes made previously result in different behavior out of the box. Previously all AIO requests failed with ENOSYS / SIGSYS unless aio.ko was explicitly loaded. Now, some AIO requests complete and others ("unsafe" requests) fail with EOPNOTSUPP. Reword the introductory paragraph in aio(4) to add a general description of AIO before describing the vfs.aio.enable_unsafe sysctl. Remove the ENOSYS error description from aio_fsync(2), aio_read(2), and aio_write(2) and replace it with a description of EOPNOTSUPP. Remove the ENOSYS error description from aio_mlock(2). Log a message to the system log the first time a process requests an "unsafe" AIO request that fails with EOPNOTSUPP. This is modeled on the log message used for processes using the legacy pty devices. Reviewed by: kib (earlier version) MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7151 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/share/man/man4/aio.4 head/sys/kern/vfs_aio.c Modified: head/lib/libc/sys/aio_fsync.2 ============================================================================== --- head/lib/libc/sys/aio_fsync.2 Thu Jul 21 22:13:40 2016 (r303163) +++ head/lib/libc/sys/aio_fsync.2 Thu Jul 21 22:49:47 2016 (r303164) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd July 21, 2016 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -107,10 +107,10 @@ The request was not queued because of sy The asynchronous notification method in .Fa iocb->aio_sigevent.sigev_notify is invalid or not supported. -.It Bq Er ENOSYS -The -.Fn aio_fsync -system call is not supported. +.It Bq Er EOPNOTSUPP +Asynchronous file synchronization operations on the file descriptor +.Fa iocb->aio_fildes +are unsafe and unsafe asynchronous I/O operations are disabled. .It Bq Er EINVAL A value of the .Fa op Modified: head/lib/libc/sys/aio_mlock.2 ============================================================================== --- head/lib/libc/sys/aio_mlock.2 Thu Jul 21 22:13:40 2016 (r303163) +++ head/lib/libc/sys/aio_mlock.2 Thu Jul 21 22:49:47 2016 (r303164) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd July 21, 2016 .Dt AIO_MLOCK 2 .Os .Sh NAME @@ -102,10 +102,6 @@ The request was not queued because of sy The asynchronous notification method in .Fa iocb->aio_sigevent.sigev_notify is invalid or not supported. -.It Bq Er ENOSYS -The -.Fn aio_mlock -system call is not supported. .El .Pp If the request is successfully enqueued, but subsequently cancelled Modified: head/lib/libc/sys/aio_read.2 ============================================================================== --- head/lib/libc/sys/aio_read.2 Thu Jul 21 22:13:40 2016 (r303163) +++ head/lib/libc/sys/aio_read.2 Thu Jul 21 22:49:47 2016 (r303164) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd July 21, 2016 .Dt AIO_READ 2 .Os .Sh NAME @@ -125,10 +125,10 @@ The request was not queued because of sy The asynchronous notification method in .Fa iocb->aio_sigevent.sigev_notify is invalid or not supported. -.It Bq Er ENOSYS -The -.Fn aio_read -system call is not supported. +.It Bq Er EOPNOTSUPP +Asynchronous read operations on the file descriptor +.Fa iocb->aio_fildes +are unsafe and unsafe asynchronous I/O operations are disabled. .El .Pp The following conditions may be synchronously detected when the Modified: head/lib/libc/sys/aio_write.2 ============================================================================== --- head/lib/libc/sys/aio_write.2 Thu Jul 21 22:13:40 2016 (r303163) +++ head/lib/libc/sys/aio_write.2 Thu Jul 21 22:49:47 2016 (r303164) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd July 21, 2016 .Dt AIO_WRITE 2 .Os .Sh NAME @@ -129,10 +129,10 @@ The request was not queued because of sy The asynchronous notification method in .Fa iocb->aio_sigevent.sigev_notify is invalid or not supported. -.It Bq Er ENOSYS -The -.Fn aio_write -system call is not supported. +.It Bq Er EOPNOTSUPP +Asynchronous write operations on the file descriptor +.Fa iocb->aio_fildes +are unsafe and unsafe asynchronous I/O operations are disabled. .El .Pp The following conditions may be synchronously detected when the Modified: head/share/man/man4/aio.4 ============================================================================== --- head/share/man/man4/aio.4 Thu Jul 21 22:13:40 2016 (r303163) +++ head/share/man/man4/aio.4 Thu Jul 21 22:49:47 2016 (r303164) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd July 21, 2016 .Dt AIO 4 .Os .Sh NAME @@ -37,17 +37,25 @@ The .Nm facility provides system calls for asynchronous I/O. -However, asynchronous I/O operations are only enabled for certain file -types by default. -Asynchronous I/O operations for other file types may block an AIO daemon -indefinitely resulting in process and/or system hangs. -Asynchronous I/O operations can be enabled for all file types by setting +Asynchronous I/O operations are not completed synchronously by the +calling thread. +Instead, the calling thread invokes one system call to request an +asynchronous I/O operation. +The status of a completed request is retrieved later via a separate +system call. +.Pp +Asynchronous I/O operations on some file descriptor types may block an +AIO daemon indefinitely resulting in process and/or system hangs. +Operations on these file descriptor types are considered +.Dq unsafe +and disabled by default. +They can be enabled by setting the .Va vfs.aio.enable_unsafe sysctl node to a non-zero value. .Pp Asynchronous I/O operations on sockets and raw disk devices do not block -indefinitely and are enabled by default. +indefinitely and are always enabled. .Pp The .Nm Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Thu Jul 21 22:13:40 2016 (r303163) +++ head/sys/kern/vfs_aio.c Thu Jul 21 22:49:47 2016 (r303164) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -110,6 +111,11 @@ static int enable_aio_unsafe = 0; SYSCTL_INT(_vfs_aio, OID_AUTO, enable_unsafe, CTLFLAG_RW, &enable_aio_unsafe, 0, "Permit asynchronous IO on all file types, not just known-safe types"); +static unsigned int unsafe_warningcnt = 1; +SYSCTL_UINT(_vfs_aio, OID_AUTO, unsafe_warningcnt, CTLFLAG_RW, + &unsafe_warningcnt, 0, + "Warnings that will be triggered upon failed IO requests on unsafe files"); + static int max_aio_procs = MAX_AIO_PROCS; SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_procs, CTLFLAG_RW, &max_aio_procs, 0, "Maximum number of kernel processes to use for handling async IO "); @@ -1697,8 +1703,11 @@ queueit: safe = true; } } - if (!(safe || enable_aio_unsafe)) + if (!(safe || enable_aio_unsafe)) { + counted_warning(&unsafe_warningcnt, + "is attempting to use unsafe AIO requests"); return (EOPNOTSUPP); + } if (opcode == LIO_SYNC) { AIO_LOCK(ki); From owner-svn-src-head@freebsd.org Thu Jul 21 23:29: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 0283AB9F5EC; Thu, 21 Jul 2016 23:29:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2EC017D0; Thu, 21 Jul 2016 23:29:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LNTD1t091359; Thu, 21 Jul 2016 23:29:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LNTDOH091358; Thu, 21 Jul 2016 23:29:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607212329.u6LNTDOH091358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 23:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303165 - 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: Thu, 21 Jul 2016 23:29:15 -0000 Author: imp Date: Thu Jul 21 23:29:13 2016 New Revision: 303165 URL: https://svnweb.freebsd.org/changeset/base/303165 Log: Fix cam builds w/o nvme. This is a stop-gap fix until the real fix of dynamically loading XPTs is done and tested. MFC After: 1 week Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jul 21 22:49:47 2016 (r303164) +++ head/sys/conf/files Thu Jul 21 23:29:13 2016 (r303165) @@ -86,9 +86,9 @@ cam/cam_xpt.c optional scbus cam/ata/ata_all.c optional scbus cam/ata/ata_xpt.c optional scbus cam/ata/ata_pmp.c optional scbus -cam/nvme/nvme_all.c optional scbus nvme +cam/nvme/nvme_all.c optional scbus cam/nvme/nvme_da.c optional scbus nvme da !nvd -cam/nvme/nvme_xpt.c optional scbus nvme +cam/nvme/nvme_xpt.c optional scbus cam/scsi/scsi_xpt.c optional scbus cam/scsi/scsi_all.c optional scbus cam/scsi/scsi_cd.c optional cd From owner-svn-src-head@freebsd.org Thu Jul 21 23:29: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 4A368B9F5FA; Thu, 21 Jul 2016 23:29:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D6E417D1; Thu, 21 Jul 2016 23:29:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LNTGKV091404; Thu, 21 Jul 2016 23:29:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LNTG4r091403; Thu, 21 Jul 2016 23:29:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201607212329.u6LNTG4r091403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Jul 2016 23:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303166 - head/sys/modules/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 21 Jul 2016 23:29:17 -0000 Author: imp Date: Thu Jul 21 23:29:16 2016 New Revision: 303166 URL: https://svnweb.freebsd.org/changeset/base/303166 Log: Add opt_ddb.h. MFC after: 1 week Modified: head/sys/modules/cam/Makefile Modified: head/sys/modules/cam/Makefile ============================================================================== --- head/sys/modules/cam/Makefile Thu Jul 21 23:29:13 2016 (r303165) +++ head/sys/modules/cam/Makefile Thu Jul 21 23:29:16 2016 (r303166) @@ -14,6 +14,7 @@ SRCS+= opt_cd.h SRCS+= opt_pt.h SRCS+= opt_sa.h SRCS+= opt_ses.h +SRCS+= opt_ddb.h SRCS+= device_if.h bus_if.h vnode_if.h SRCS+= cam.c SRCS+= cam_compat.c From owner-svn-src-head@freebsd.org Fri Jul 22 02:11: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 7A03BBA106E; Fri, 22 Jul 2016 02:11:50 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 342B91969; Fri, 22 Jul 2016 02:11:50 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6M2BnmO052398; Fri, 22 Jul 2016 02:11:49 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6M2BnQb052396; Fri, 22 Jul 2016 02:11:49 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201607220211.u6M2BnQb052396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Fri, 22 Jul 2016 02:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303171 - in head/sys: netinet 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, 22 Jul 2016 02:11:50 -0000 Author: karels Date: Fri Jul 22 02:11:49 2016 New Revision: 303171 URL: https://svnweb.freebsd.org/changeset/base/303171 Log: Fix per-connection L2 caching in fast path r301217 re-added per-connection L2 caching from a previous change, but it omitted caching in the fast path. Add it. Reviewed By: gallatin Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D7239 Modified: head/sys/netinet/if_ether.c head/sys/netinet6/nd6.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Jul 22 01:16:56 2016 (r303170) +++ head/sys/netinet/if_ether.c Fri Jul 22 02:11:49 2016 (r303171) @@ -607,7 +607,7 @@ arpresolve(struct ifnet *ifp, int is_gw, } IF_AFDATA_RLOCK(ifp); - la = lla_lookup(LLTABLE(ifp), LLE_UNLOCKED, dst); + la = lla_lookup(LLTABLE(ifp), plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, dst); if (la != NULL && (la->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(la->r_linkdata, desten, la->r_hdrlen); @@ -619,9 +619,16 @@ arpresolve(struct ifnet *ifp, int is_gw, la->r_skip_req = 0; /* Notify that entry was used */ LLE_REQ_UNLOCK(la); } + if (plle) { + LLE_ADDREF(la); + *plle = la; + LLE_WUNLOCK(la); + } IF_AFDATA_RUNLOCK(ifp); return (0); } + if (plle && la) + LLE_WUNLOCK(la); IF_AFDATA_RUNLOCK(ifp); return (arpresolve_full(ifp, is_gw, la == NULL ? LLE_CREATE : 0, m, dst, Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Jul 22 01:16:56 2016 (r303170) +++ head/sys/netinet6/nd6.c Fri Jul 22 02:11:49 2016 (r303171) @@ -2222,7 +2222,8 @@ nd6_resolve(struct ifnet *ifp, int is_gw } IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(&dst6->sin6_addr, LLE_UNLOCKED, ifp); + ln = nd6_lookup(&dst6->sin6_addr, plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, + ifp); if (ln != NULL && (ln->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(ln->r_linkdata, desten, ln->r_hdrlen); @@ -2235,9 +2236,15 @@ nd6_resolve(struct ifnet *ifp, int is_gw ln->lle_hittime = time_uptime; LLE_REQ_UNLOCK(ln); } + if (plle) { + LLE_ADDREF(ln); + *plle = ln; + LLE_WUNLOCK(ln); + } IF_AFDATA_RUNLOCK(ifp); return (0); - } + } else if (plle && ln) + LLE_WUNLOCK(ln); IF_AFDATA_RUNLOCK(ifp); return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); From owner-svn-src-head@freebsd.org Fri Jul 22 03:30: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 40735BA1EF4; Fri, 22 Jul 2016 03:30: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 0DFBF19F9; Fri, 22 Jul 2016 03:30: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 u6M3U0Sd082620; Fri, 22 Jul 2016 03:30:00 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6M3U0PO082619; Fri, 22 Jul 2016 03:30:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607220330.u6M3U0PO082619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 22 Jul 2016 03:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303178 - 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, 22 Jul 2016 03:30:01 -0000 Author: sephe Date: Fri Jul 22 03:30:00 2016 New Revision: 303178 URL: https://svnweb.freebsd.org/changeset/base/303178 Log: hyperv/vmbus: Cosmetic bufring cleanup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7267 Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 03:26:01 2016 (r303177) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 03:30:00 2016 (r303178) @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include @@ -35,8 +34,14 @@ #include "hv_vmbus_priv.h" /* Amount of space to write to */ -#define HV_BYTES_AVAIL_TO_WRITE(r, w, z) ((w) >= (r))? \ - ((z) - ((w) - (r))):((r) - (w)) +#define HV_BYTES_AVAIL_TO_WRITE(r, w, z) \ + ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)) + +static uint32_t copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + uint32_t start_write_offset, const uint8_t *src, + uint32_t src_len); +static uint32_t copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + char *dest, uint32_t dest_len, uint32_t start_read_offset); static int hv_rbi_sysctl_stats(SYSCTL_HANDLER_ARGS) @@ -54,40 +59,30 @@ hv_rbi_sysctl_stats(SYSCTL_HANDLER_ARGS) write_avail = HV_BYTES_AVAIL_TO_WRITE(read_index, write_index, sz); read_avail = sz - write_avail; - snprintf(rbi_stats, sizeof(rbi_stats), - "r_idx:%d " - "w_idx:%d " - "int_mask:%d " - "r_avail:%d " - "w_avail:%d", - read_index, write_index, interrupt_mask, - read_avail, write_avail); - return (sysctl_handle_string(oidp, rbi_stats, - sizeof(rbi_stats), req)); + snprintf(rbi_stats, sizeof(rbi_stats), + "r_idx:%d w_idx:%d int_mask:%d r_avail:%d w_avail:%d", + read_index, write_index, interrupt_mask, read_avail, write_avail); + return sysctl_handle_string(oidp, rbi_stats, sizeof(rbi_stats), req); } void -hv_ring_buffer_stat( - struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *tree_node, - hv_vmbus_ring_buffer_info *rbi, - const char *desc) +hv_ring_buffer_stat(struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *tree_node, hv_vmbus_ring_buffer_info *rbi, + const char *desc) { SYSCTL_ADD_PROC(ctx, tree_node, OID_AUTO, - "ring_buffer_stats", - CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, rbi, 0, - hv_rbi_sysctl_stats, "A", desc); + "ring_buffer_stats", CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, + rbi, 0, hv_rbi_sysctl_stats, "A", desc); } + /** * @brief Get number of bytes available to read and to write to * for the specified ring buffer */ -static inline void -get_ring_buffer_avail_bytes( - hv_vmbus_ring_buffer_info* rbi, - uint32_t* read, - uint32_t* write) +static __inline void +get_ring_buffer_avail_bytes(hv_vmbus_ring_buffer_info *rbi, uint32_t *read, + uint32_t *write) { uint32_t read_loc, write_loc; @@ -97,28 +92,26 @@ get_ring_buffer_avail_bytes( read_loc = rbi->ring_buffer->read_index; write_loc = rbi->ring_buffer->write_index; - *write = HV_BYTES_AVAIL_TO_WRITE( - read_loc, write_loc, rbi->ring_data_size); + *write = HV_BYTES_AVAIL_TO_WRITE(read_loc, write_loc, + rbi->ring_data_size); *read = rbi->ring_data_size - *write; } /** * @brief Get the next write location for the specified ring buffer */ -static inline uint32_t -get_next_write_location(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_next_write_location(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t next = ring_info->ring_buffer->write_index; - return (next); + return ring_info->ring_buffer->write_index; } /** * @brief Set the next write location for the specified ring buffer */ -static inline void -set_next_write_location( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t next_write_location) +static __inline void +set_next_write_location(hv_vmbus_ring_buffer_info *ring_info, + uint32_t next_write_location) { ring_info->ring_buffer->write_index = next_write_location; } @@ -126,23 +119,22 @@ set_next_write_location( /** * @brief Get the next read location for the specified ring buffer */ -static inline uint32_t -get_next_read_location(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_next_read_location(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t next = ring_info->ring_buffer->read_index; - return (next); + return ring_info->ring_buffer->read_index; } /** * @brief Get the next read location + offset for the specified ring buffer. * This allows the caller to skip. */ -static inline uint32_t -get_next_read_location_with_offset( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t offset) +static __inline uint32_t +get_next_read_location_with_offset(hv_vmbus_ring_buffer_info *ring_info, + uint32_t offset) { uint32_t next = ring_info->ring_buffer->read_index; + next += offset; next %= ring_info->ring_data_size; return (next); @@ -151,10 +143,9 @@ get_next_read_location_with_offset( /** * @brief Set the next read location for the specified ring buffer */ -static inline void -set_next_read_location( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t next_read_location) +static __inline void +set_next_read_location(hv_vmbus_ring_buffer_info *ring_info, + uint32_t next_read_location) { ring_info->ring_buffer->read_index = next_read_location; } @@ -162,17 +153,17 @@ set_next_read_location( /** * @brief Get the start of the ring buffer */ -static inline void * -get_ring_buffer(hv_vmbus_ring_buffer_info* ring_info) +static __inline void * +get_ring_buffer(hv_vmbus_ring_buffer_info *ring_info) { - return (void *) ring_info->ring_buffer->buffer; + return ring_info->ring_buffer->buffer; } /** * @brief Get the size of the ring buffer. */ -static inline uint32_t -get_ring_buffer_size(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_ring_buffer_size(hv_vmbus_ring_buffer_info *ring_info) { return ring_info->ring_data_size; } @@ -180,25 +171,23 @@ get_ring_buffer_size(hv_vmbus_ring_buffe /** * Get the read and write indices as uint64_t of the specified ring buffer. */ -static inline uint64_t -get_ring_buffer_indices(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint64_t +get_ring_buffer_indices(hv_vmbus_ring_buffer_info *ring_info) { - return (uint64_t) ring_info->ring_buffer->write_index << 32; + return ((uint64_t)ring_info->ring_buffer->write_index) << 32; } void -hv_ring_buffer_read_begin( - hv_vmbus_ring_buffer_info* ring_info) +hv_ring_buffer_read_begin(hv_vmbus_ring_buffer_info *ring_info) { ring_info->ring_buffer->interrupt_mask = 1; mb(); } uint32_t -hv_ring_buffer_read_end( - hv_vmbus_ring_buffer_info* ring_info) +hv_ring_buffer_read_end(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t read, write; + uint32_t read, write; ring_info->ring_buffer->interrupt_mask = 0; mb(); @@ -209,7 +198,6 @@ hv_ring_buffer_read_end( * incoming messages. */ get_ring_buffer_avail_bytes(ring_info, &read, &write); - return (read); } @@ -229,9 +217,8 @@ hv_ring_buffer_read_end( * arrived. */ static boolean_t -hv_ring_buffer_needsig_on_write( - uint32_t old_write_location, - hv_vmbus_ring_buffer_info* rbi) +hv_ring_buffer_needsig_on_write(uint32_t old_write_location, + hv_vmbus_ring_buffer_info *rbi) { mb(); if (rbi->ring_buffer->interrupt_mask) @@ -249,35 +236,20 @@ hv_ring_buffer_needsig_on_write( return (FALSE); } -static uint32_t copy_to_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t start_write_offset, - const uint8_t *src, - uint32_t src_len); - -static uint32_t copy_from_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - char* dest, - uint32_t dest_len, - uint32_t start_read_offset); - /** * @brief Initialize the ring buffer. */ int -hv_vmbus_ring_buffer_init( - hv_vmbus_ring_buffer_info* ring_info, - void* buffer, - uint32_t buffer_len) +hv_vmbus_ring_buffer_init(hv_vmbus_ring_buffer_info *ring_info, void *buffer, + uint32_t buffer_len) { memset(ring_info, 0, sizeof(hv_vmbus_ring_buffer_info)); - ring_info->ring_buffer = (hv_vmbus_ring_buffer*) buffer; - ring_info->ring_buffer->read_index = - ring_info->ring_buffer->write_index = 0; + ring_info->ring_buffer = buffer; + ring_info->ring_buffer->read_index = 0; + ring_info->ring_buffer->write_index = 0; ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer); - mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); return (0); @@ -286,7 +258,8 @@ hv_vmbus_ring_buffer_init( /** * @brief Cleanup the ring buffer. */ -void hv_ring_buffer_cleanup(hv_vmbus_ring_buffer_info* ring_info) +void +hv_ring_buffer_cleanup(hv_vmbus_ring_buffer_info *ring_info) { mtx_destroy(&ring_info->ring_lock); } @@ -295,24 +268,19 @@ void hv_ring_buffer_cleanup(hv_vmbus_rin * @brief Write to the ring buffer. */ int -hv_ring_buffer_write( - hv_vmbus_ring_buffer_info* out_ring_info, - const struct iovec iov[], - uint32_t iovlen, - boolean_t *need_sig) +hv_ring_buffer_write(hv_vmbus_ring_buffer_info *out_ring_info, + const struct iovec iov[], uint32_t iovlen, boolean_t *need_sig) { int i = 0; uint32_t byte_avail_to_write; uint32_t byte_avail_to_read; uint32_t old_write_location; uint32_t total_bytes_to_write = 0; - volatile uint32_t next_write_location; uint64_t prev_indices = 0; - for (i = 0; i < iovlen; i++) { - total_bytes_to_write += iov[i].iov_len; - } + for (i = 0; i < iovlen; i++) + total_bytes_to_write += iov[i].iov_len; total_bytes_to_write += sizeof(uint64_t); @@ -326,11 +294,9 @@ hv_ring_buffer_write( * Otherwise, the next time around, we think the ring buffer * is empty since the read index == write index */ - if (byte_avail_to_write <= total_bytes_to_write) { - - mtx_unlock_spin(&out_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&out_ring_info->ring_lock); + return (EAGAIN); } /* @@ -341,8 +307,8 @@ hv_ring_buffer_write( old_write_location = next_write_location; for (i = 0; i < iovlen; i++) { - next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, iov[i].iov_base, iov[i].iov_len); + next_write_location = copy_to_ring_buffer(out_ring_info, + next_write_location, iov[i].iov_base, iov[i].iov_len); } /* @@ -350,9 +316,8 @@ hv_ring_buffer_write( */ prev_indices = get_ring_buffer_indices(out_ring_info); - next_write_location = copy_to_ring_buffer( - out_ring_info, next_write_location, - (char *) &prev_indices, sizeof(uint64_t)); + next_write_location = copy_to_ring_buffer(out_ring_info, + next_write_location, (char *)&prev_indices, sizeof(uint64_t)); /* * Full memory barrier before upding the write index. @@ -376,10 +341,8 @@ hv_ring_buffer_write( * @brief Read without advancing the read index. */ int -hv_ring_buffer_peek( - hv_vmbus_ring_buffer_info* in_ring_info, - void* buffer, - uint32_t buffer_len) +hv_ring_buffer_peek(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, + uint32_t buffer_len) { uint32_t bytesAvailToWrite; uint32_t bytesAvailToRead; @@ -388,14 +351,14 @@ hv_ring_buffer_peek( mtx_lock_spin(&in_ring_info->ring_lock); get_ring_buffer_avail_bytes(in_ring_info, &bytesAvailToRead, - &bytesAvailToWrite); + &bytesAvailToWrite); /* * Make sure there is something to read */ if (bytesAvailToRead < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&in_ring_info->ring_lock); + return (EAGAIN); } /* @@ -403,8 +366,8 @@ hv_ring_buffer_peek( */ nextReadLocation = get_next_read_location(in_ring_info); - nextReadLocation = copy_from_ring_buffer( - in_ring_info, (char *)buffer, buffer_len, nextReadLocation); + nextReadLocation = copy_from_ring_buffer(in_ring_info, + (char *)buffer, buffer_len, nextReadLocation); mtx_unlock_spin(&in_ring_info->ring_lock); @@ -415,11 +378,8 @@ hv_ring_buffer_peek( * @brief Read and advance the read index. */ int -hv_ring_buffer_read( - hv_vmbus_ring_buffer_info* in_ring_info, - void* buffer, - uint32_t buffer_len, - uint32_t offset) +hv_ring_buffer_read(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, + uint32_t buffer_len, uint32_t offset) { uint32_t bytes_avail_to_write; uint32_t bytes_avail_to_read; @@ -427,37 +387,29 @@ hv_ring_buffer_read( uint64_t prev_indices = 0; if (buffer_len <= 0) - return (EINVAL); + return (EINVAL); mtx_lock_spin(&in_ring_info->ring_lock); - get_ring_buffer_avail_bytes( - in_ring_info, &bytes_avail_to_read, + get_ring_buffer_avail_bytes(in_ring_info, &bytes_avail_to_read, &bytes_avail_to_write); /* * Make sure there is something to read */ if (bytes_avail_to_read < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&in_ring_info->ring_lock); + return (EAGAIN); } - next_read_location = get_next_read_location_with_offset( - in_ring_info, + next_read_location = get_next_read_location_with_offset(in_ring_info, offset); - next_read_location = copy_from_ring_buffer( - in_ring_info, - (char *) buffer, - buffer_len, - next_read_location); - - next_read_location = copy_from_ring_buffer( - in_ring_info, - (char *) &prev_indices, - sizeof(uint64_t), - next_read_location); + next_read_location = copy_from_ring_buffer(in_ring_info, (char *)buffer, + buffer_len, next_read_location); + + next_read_location = copy_from_ring_buffer(in_ring_info, + (char *)&prev_indices, sizeof(uint64_t), next_read_location); /* * Make sure all reads are done before we update the read index since @@ -482,23 +434,20 @@ hv_ring_buffer_read( * Assume there is enough room. Handles wrap-around in dest case only! */ static uint32_t -copy_to_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t start_write_offset, - const uint8_t *src, - uint32_t src_len) +copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + uint32_t start_write_offset, const uint8_t *src, uint32_t src_len) { char *ring_buffer = get_ring_buffer(ring_info); uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); uint32_t fragLen; - if (src_len > ring_buffer_size - start_write_offset) { - /* wrap-around detected! */ - fragLen = ring_buffer_size - start_write_offset; - memcpy(ring_buffer + start_write_offset, src, fragLen); - memcpy(ring_buffer, src + fragLen, src_len - fragLen); + if (src_len > ring_buffer_size - start_write_offset) { + /* wrap-around detected! */ + fragLen = ring_buffer_size - start_write_offset; + memcpy(ring_buffer + start_write_offset, src, fragLen); + memcpy(ring_buffer, src + fragLen, src_len - fragLen); } else { - memcpy(ring_buffer + start_write_offset, src, src_len); + memcpy(ring_buffer + start_write_offset, src, src_len); } start_write_offset += src_len; @@ -512,24 +461,21 @@ copy_to_ring_buffer( * * Assume there is enough room. Handles wrap-around in src case only! */ -uint32_t -copy_from_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - char* dest, - uint32_t dest_len, - uint32_t start_read_offset) +static uint32_t +copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, char *dest, + uint32_t dest_len, uint32_t start_read_offset) { uint32_t fragLen; char *ring_buffer = get_ring_buffer(ring_info); uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); if (dest_len > ring_buffer_size - start_read_offset) { - /* wrap-around detected at the src */ - fragLen = ring_buffer_size - start_read_offset; - memcpy(dest, ring_buffer + start_read_offset, fragLen); - memcpy(dest + fragLen, ring_buffer, dest_len - fragLen); + /* wrap-around detected at the src */ + fragLen = ring_buffer_size - start_read_offset; + memcpy(dest, ring_buffer + start_read_offset, fragLen); + memcpy(dest + fragLen, ring_buffer, dest_len - fragLen); } else { - memcpy(dest, ring_buffer + start_read_offset, dest_len); + memcpy(dest, ring_buffer + start_read_offset, dest_len); } start_read_offset += dest_len; @@ -537,4 +483,3 @@ copy_from_ring_buffer( return (start_read_offset); } - From owner-svn-src-head@freebsd.org Fri Jul 22 03:42: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 AB730BA040C; Fri, 22 Jul 2016 03:42: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 801AB143C; Fri, 22 Jul 2016 03:42: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 u6M3gWnf089664; Fri, 22 Jul 2016 03:42:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6M3gWN3089661; Fri, 22 Jul 2016 03:42:32 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607220342.u6M3gWN3089661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 22 Jul 2016 03:42:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303180 - 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, 22 Jul 2016 03:42:33 -0000 Author: sephe Date: Fri Jul 22 03:42:32 2016 New Revision: 303180 URL: https://svnweb.freebsd.org/changeset/base/303180 Log: hyperv/vmbus: Cleanup and augment bufring sysctl tree creation Binary state node is added, so that userland programs do not have to parse human readable state string. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7268 Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 03:34:15 2016 (r303179) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 03:42:32 2016 (r303180) @@ -44,36 +44,74 @@ static uint32_t copy_from_ring_buffer(hv char *dest, uint32_t dest_len, uint32_t start_read_offset); static int -hv_rbi_sysctl_stats(SYSCTL_HANDLER_ARGS) +vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) { - hv_vmbus_ring_buffer_info* rbi; - uint32_t read_index, write_index, interrupt_mask, sz; - uint32_t read_avail, write_avail; - char rbi_stats[256]; - - rbi = (hv_vmbus_ring_buffer_info*)arg1; - read_index = rbi->ring_buffer->read_index; - write_index = rbi->ring_buffer->write_index; - interrupt_mask = rbi->ring_buffer->interrupt_mask; - sz = rbi->ring_data_size; - write_avail = HV_BYTES_AVAIL_TO_WRITE(read_index, - write_index, sz); - read_avail = sz - write_avail; - - snprintf(rbi_stats, sizeof(rbi_stats), - "r_idx:%d w_idx:%d int_mask:%d r_avail:%d w_avail:%d", - read_index, write_index, interrupt_mask, read_avail, write_avail); - return sysctl_handle_string(oidp, rbi_stats, sizeof(rbi_stats), req); + const hv_vmbus_ring_buffer_info *br = arg1; + uint32_t rindex, windex, intr_mask, ravail, wavail; + char state[256]; + + rindex = br->ring_buffer->read_index; + windex = br->ring_buffer->write_index; + intr_mask = br->ring_buffer->interrupt_mask; + wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); + ravail = br->ring_data_size - wavail; + + snprintf(state, sizeof(state), + "rindex:%u windex:%u intr_mask:%u ravail:%u wavail:%u", + rindex, windex, intr_mask, ravail, wavail); + return sysctl_handle_string(oidp, state, sizeof(state), req); +} + +/* + * Binary bufring states. + */ +static int +vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS) +{ +#define BR_STATE_RIDX 0 +#define BR_STATE_WIDX 1 +#define BR_STATE_IMSK 2 +#define BR_STATE_RSPC 3 +#define BR_STATE_WSPC 4 +#define BR_STATE_MAX 5 + + const hv_vmbus_ring_buffer_info *br = arg1; + uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; + + rindex = br->ring_buffer->read_index; + windex = br->ring_buffer->write_index; + wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); + + state[BR_STATE_RIDX] = rindex; + state[BR_STATE_WIDX] = windex; + state[BR_STATE_IMSK] = br->ring_buffer->interrupt_mask; + state[BR_STATE_WSPC] = wavail; + state[BR_STATE_RSPC] = br->ring_data_size - wavail; + + return sysctl_handle_opaque(oidp, state, sizeof(state), req); } void -hv_ring_buffer_stat(struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *tree_node, hv_vmbus_ring_buffer_info *rbi, - const char *desc) -{ - SYSCTL_ADD_PROC(ctx, tree_node, OID_AUTO, - "ring_buffer_stats", CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, - rbi, 0, hv_rbi_sysctl_stats, "A", desc); +vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, + hv_vmbus_ring_buffer_info *br, const char *name) +{ + struct sysctl_oid *tree; + char desc[64]; + + tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(br_tree), OID_AUTO, + name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (tree == NULL) + return; + + snprintf(desc, sizeof(desc), "%s state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state, "A", desc); + + snprintf(desc, sizeof(desc), "%s binary state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state_bin", + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state_bin, "IU", desc); } /** Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 22 03:34:15 2016 (r303179) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Fri Jul 22 03:42:32 2016 (r303180) @@ -45,13 +45,11 @@ struct vmbus_softc; * Private, VM Bus functions */ struct sysctl_ctx_list; -struct sysctl_oid_list; +struct sysctl_oid; -void hv_ring_buffer_stat( - struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *tree_node, - hv_vmbus_ring_buffer_info *rbi, - const char *desc); +void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, + struct sysctl_oid *br_tree, hv_vmbus_ring_buffer_info *br, + const char *name); int hv_vmbus_ring_buffer_init( hv_vmbus_ring_buffer_info *ring_info, Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Jul 22 03:34:15 2016 (r303179) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Jul 22 03:42:32 2016 (r303180) @@ -171,24 +171,17 @@ vmbus_chan_sysctl_create(struct vmbus_ch 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->ch_rxbr, "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, ""); + "br", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); if (br_tree != NULL) { - hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), - &chan->ch_txbr, "outbound ring buffer stats"); + /* + * Create sysctl tree for RX bufring. + */ + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr, "rx"); + /* + * Create sysctl tree for TX bufring. + */ + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr, "tx"); } } From owner-svn-src-head@freebsd.org Fri Jul 22 04:35: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 25E7FBA1433; Fri, 22 Jul 2016 04:35:36 +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 1C0411EDE; Fri, 22 Jul 2016 04:35:36 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 1AEC2181B; Fri, 22 Jul 2016 04:35:36 +0000 (UTC) Date: Fri, 22 Jul 2016 04:35:36 +0000 From: Alexey Dokuchaev To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303146 - head/usr.bin/sed Message-ID: <20160722043536.GB37437@FreeBSD.org> References: <201607211417.u6LEHaPR086378@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201607211417.u6LEHaPR086378@repo.freebsd.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, 22 Jul 2016 04:35:36 -0000 On Thu, Jul 21, 2016 at 02:17:36PM +0000, Pedro F. Giffuni wrote: > New Revision: 303146 > URL: https://svnweb.freebsd.org/changeset/base/303146 > > Log: > sed(1): Appease older GCC. Isn't it also being dictated by style(9) and common sense? :) ./danfe > Modified: > head/usr.bin/sed/process.c > > @@ -97,11 +97,12 @@ process(void) > { > struct s_command *cp; > SPACE tspace; > - size_t oldpsl = 0; > + size_t oldpsl; > char *p; > int oldpsanl; > > p = NULL; > + oldpsanl = oldpsl = 0; From owner-svn-src-head@freebsd.org Fri Jul 22 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 44D47BA18DD; Fri, 22 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 009261D75; Fri, 22 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 u6M599LU019659; Fri, 22 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 u6M598KA019656; Fri, 22 Jul 2016 05:09:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607220509.u6M598KA019656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 22 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: r303182 - 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, 22 Jul 2016 05:09:10 -0000 Author: sephe Date: Fri Jul 22 05:09:08 2016 New Revision: 303182 URL: https://svnweb.freebsd.org/changeset/base/303182 Log: hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h And add more comment about its fields. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7269 Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h head/sys/dev/hyperv/vmbus/vmbus_reg.h Modified: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 03:48:44 2016 (r303181) +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c Fri Jul 22 05:09:08 2016 (r303182) @@ -32,6 +32,7 @@ #include #include "hv_vmbus_priv.h" +#include /* Amount of space to write to */ #define HV_BYTES_AVAIL_TO_WRITE(r, w, z) \ @@ -50,9 +51,9 @@ vmbus_br_sysctl_state(SYSCTL_HANDLER_ARG uint32_t rindex, windex, intr_mask, ravail, wavail; char state[256]; - rindex = br->ring_buffer->read_index; - windex = br->ring_buffer->write_index; - intr_mask = br->ring_buffer->interrupt_mask; + rindex = br->ring_buffer->br_rindex; + windex = br->ring_buffer->br_windex; + intr_mask = br->ring_buffer->br_imask; wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); ravail = br->ring_data_size - wavail; @@ -78,13 +79,13 @@ vmbus_br_sysctl_state_bin(SYSCTL_HANDLER const hv_vmbus_ring_buffer_info *br = arg1; uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; - rindex = br->ring_buffer->read_index; - windex = br->ring_buffer->write_index; + rindex = br->ring_buffer->br_rindex; + windex = br->ring_buffer->br_windex; wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); state[BR_STATE_RIDX] = rindex; state[BR_STATE_WIDX] = windex; - state[BR_STATE_IMSK] = br->ring_buffer->interrupt_mask; + state[BR_STATE_IMSK] = br->ring_buffer->br_imask; state[BR_STATE_WSPC] = wavail; state[BR_STATE_RSPC] = br->ring_data_size - wavail; @@ -127,8 +128,8 @@ get_ring_buffer_avail_bytes(hv_vmbus_rin /* * Capture the read/write indices before they changed */ - read_loc = rbi->ring_buffer->read_index; - write_loc = rbi->ring_buffer->write_index; + read_loc = rbi->ring_buffer->br_rindex; + write_loc = rbi->ring_buffer->br_windex; *write = HV_BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_data_size); @@ -141,7 +142,7 @@ get_ring_buffer_avail_bytes(hv_vmbus_rin static __inline uint32_t get_next_write_location(hv_vmbus_ring_buffer_info *ring_info) { - return ring_info->ring_buffer->write_index; + return ring_info->ring_buffer->br_windex; } /** @@ -151,7 +152,7 @@ static __inline void set_next_write_location(hv_vmbus_ring_buffer_info *ring_info, uint32_t next_write_location) { - ring_info->ring_buffer->write_index = next_write_location; + ring_info->ring_buffer->br_windex = next_write_location; } /** @@ -160,7 +161,7 @@ set_next_write_location(hv_vmbus_ring_bu static __inline uint32_t get_next_read_location(hv_vmbus_ring_buffer_info *ring_info) { - return ring_info->ring_buffer->read_index; + return ring_info->ring_buffer->br_rindex; } /** @@ -171,7 +172,7 @@ static __inline uint32_t get_next_read_location_with_offset(hv_vmbus_ring_buffer_info *ring_info, uint32_t offset) { - uint32_t next = ring_info->ring_buffer->read_index; + uint32_t next = ring_info->ring_buffer->br_rindex; next += offset; next %= ring_info->ring_data_size; @@ -185,7 +186,7 @@ static __inline void set_next_read_location(hv_vmbus_ring_buffer_info *ring_info, uint32_t next_read_location) { - ring_info->ring_buffer->read_index = next_read_location; + ring_info->ring_buffer->br_rindex = next_read_location; } /** @@ -194,7 +195,7 @@ set_next_read_location(hv_vmbus_ring_buf static __inline void * get_ring_buffer(hv_vmbus_ring_buffer_info *ring_info) { - return ring_info->ring_buffer->buffer; + return ring_info->ring_buffer->br_data; } /** @@ -212,13 +213,13 @@ get_ring_buffer_size(hv_vmbus_ring_buffe static __inline uint64_t get_ring_buffer_indices(hv_vmbus_ring_buffer_info *ring_info) { - return ((uint64_t)ring_info->ring_buffer->write_index) << 32; + return ((uint64_t)ring_info->ring_buffer->br_windex) << 32; } void hv_ring_buffer_read_begin(hv_vmbus_ring_buffer_info *ring_info) { - ring_info->ring_buffer->interrupt_mask = 1; + ring_info->ring_buffer->br_imask = 1; mb(); } @@ -227,7 +228,7 @@ hv_ring_buffer_read_end(hv_vmbus_ring_bu { uint32_t read, write; - ring_info->ring_buffer->interrupt_mask = 0; + ring_info->ring_buffer->br_imask = 0; mb(); /* @@ -259,7 +260,7 @@ hv_ring_buffer_needsig_on_write(uint32_t hv_vmbus_ring_buffer_info *rbi) { mb(); - if (rbi->ring_buffer->interrupt_mask) + if (rbi->ring_buffer->br_imask) return (FALSE); /* Read memory barrier */ @@ -268,7 +269,7 @@ hv_ring_buffer_needsig_on_write(uint32_t * This is the only case we need to signal when the * ring transitions from being empty to non-empty. */ - if (old_write_location == rbi->ring_buffer->read_index) + if (old_write_location == rbi->ring_buffer->br_rindex) return (TRUE); return (FALSE); @@ -284,10 +285,10 @@ hv_vmbus_ring_buffer_init(hv_vmbus_ring_ memset(ring_info, 0, sizeof(hv_vmbus_ring_buffer_info)); ring_info->ring_buffer = buffer; - ring_info->ring_buffer->read_index = 0; - ring_info->ring_buffer->write_index = 0; + ring_info->ring_buffer->br_rindex = 0; + ring_info->ring_buffer->br_windex = 0; - ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer); + ring_info->ring_data_size = buffer_len - sizeof(struct vmbus_bufring); mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); return (0); Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Fri Jul 22 03:48:44 2016 (r303181) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Fri Jul 22 05:09:08 2016 (r303182) @@ -41,31 +41,7 @@ #include typedef struct { - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t write_index; - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t read_index; - /* - * NOTE: The interrupt_mask field is used only for channels, but - * vmbus connection also uses this data structure - */ - volatile uint32_t interrupt_mask; - /* pad it to PAGE_SIZE so that data starts on a page */ - uint8_t reserved[4084]; - - /* - * WARNING: Ring data starts here - * !!! DO NOT place any fields below this !!! - */ - uint8_t buffer[0]; /* doubles as interrupt mask */ -} __packed hv_vmbus_ring_buffer; - -typedef struct { - hv_vmbus_ring_buffer* ring_buffer; + struct vmbus_bufring *ring_buffer; struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; Modified: head/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 22 03:48:44 2016 (r303181) +++ head/sys/dev/hyperv/vmbus/vmbus_reg.h Fri Jul 22 05:09:08 2016 (r303182) @@ -102,6 +102,37 @@ struct vmbus_mnf { CTASSERT(sizeof(struct vmbus_mnf) == PAGE_SIZE); /* + * Buffer ring + */ +struct vmbus_bufring { + /* + * If br_windex == br_rindex, this bufring is empty; this + * means we can _not_ write data to the bufring, if the + * write is going to make br_windex same as br_rindex. + */ + volatile uint32_t br_windex; + volatile uint32_t br_rindex; + + /* + * Interrupt mask {0,1} + * + * For TX bufring, host set this to 1, when it is processing + * the TX bufring, so that we can safely skip the TX event + * notification to host. + * + * For RX bufring, once this is set to 1 by us, host will not + * further dispatch interrupts to us, even if there are data + * pending on the RX bufring. This effectively disables the + * interrupt of the channel to which this RX bufring is attached. + */ + volatile uint32_t br_imask; + + uint8_t br_rsvd[4084]; + uint8_t br_data[]; +} __packed; +CTASSERT(sizeof(struct vmbus_bufring) == PAGE_SIZE); + +/* * Channel */ From owner-svn-src-head@freebsd.org Fri Jul 22 05:51: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 BFDA7BA1E98; Fri, 22 Jul 2016 05:51:29 +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 A46DD1DE7; Fri, 22 Jul 2016 05:51:29 +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 u6M5pKLv007017 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 21 Jul 2016 22:51:20 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: John Baldwin , Andrew Turner References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578F6075.7010500@FreeBSD.org> <20160721133742.05f0e045@zapp> <13301107.Hm25rxUxW2@ralph.baldwin.cx> Cc: Michal Meloun , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Nathan Whitehorn Message-ID: <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> Date: Thu, 21 Jul 2016 22:51:20 -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: <13301107.Hm25rxUxW2@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbYawnepQAe1PF0BqBTxPf5l0T1d5QKZisjH8BrcAFE4KoXgJ6UCg5YhgKJwnPBa/qDtRh7bBTel4+AuT1HRCcHnp8YLS1d+cI= X-Sonic-ID: C;8t5dUNBP5hG1l5tMTlz00w== M;AkC6UNBP5hG1l5tMTlz00w== 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: Fri, 22 Jul 2016 05:51:29 -0000 On 07/21/16 14:35, John Baldwin wrote: > On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: >> On Wed, 20 Jul 2016 13:28:53 +0200 >> Michal Meloun wrote: >>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>>> but is both problematically more general and less flexible (it has >>>> requirements on timing of PIC attachment vs. driver resource >>>> allocation) >>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>> parsed data are magicaly stored within the call. >>> The new method, bus_map_intr(), can parse data from multiple sources >>> (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also >>> returns parsed data back to caller. >>> And no, it doesn't add any additional timing requirements . >> I've been looking at ACPI on arm64. So far I have not found the need >> for this with ACPI as we don't need to send the data to the interrupt >> controller driver to be parsed in the way OFW/FDT needs to. > ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ > in bus_alloc_resource(). I hadn't realized that. It looks like you could do essentially the same thing we do on PowerPC to clean this up by explicitly mapping the ACPI interrupt domains to different PICs with varying default interrupt properties. > What I had advocated in the discussions > leading up to this was to have some sort of opaque structure containing > a set of properties (the sort of thing bus_map_resource and make_dev_s > use) that was passed up at bus_setup_intr() time. > I think it should now > be passed up at bus_alloc_resource() time instead, but it would allow bus > drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree > with properties that the interrupt controller can then associate with > the IRQ cookie it allocates in its own code. We used to do this on PPC and MIPS, and the current code still supports it, but it turned out not to be useful in the end for IRQs. The hierarchy for IRQs rarely (read: almost never) follows the bus hierarchy and often is enumerated in a different order. I have hardware, for example, where the children of a single parent bus are all wired to different interrupt controllers and sometimes to a mixture of interrupt controllers. Those controllers are cascaded in ways that cross the newbus tree laterally and, on some of them, the parent device from the bus topology has interrupts handled by its own (bus) children. Trying to make the newbus parents do something sensible with all of this would be crazy and, in the case where parents depend on resources provided by their own children, impossible. This is all to say that, since you want the interrupts to be decorated along a path that usually has nothing to do with the newbus hierarchy, it doesn't add much to add extra features to resource allocation. ofw_bus_map_intr() is a newbus method to support this kind of thing but, on all supported platforms, it is implemented only in nexus and no cases have appeared where anyone ever wanted anything at the intermediate layers. > I would let the particular > structure have different layouts for different resource types. On x86 we > would replace bus_config_intr by passing the level and trigger-mode in > this structure. However, I could also see allowing the memattr to be > set for a SYS_RES_MEMORY resource so you could have a much shorter way > than an explicit bus_map_resource to map an entire BAR as WC for example: > > struct alloc_resource_args { > size_t len; > union { > struct { > enum intr_trigger trigger; > enum intr_polarity polarity; > } irq; > struct { > vm_memattr_t memattr; > } memory; > } > } > > ... > > union alloc_resource_args args; > > init_alloc_resource_args(&args, sizeof(args)); > args.memattr = VM_MEMATTR_WRITE_COMBINING; > > /* Uses WC for the implicit mapping. */ > res = bus_alloc_resource(...., &args); > > ... > > foobus_alloc_resource(..., union alloc_resource_args *args) > { > union alloc_resource_args args2; > > switch (type) { > case SYS_RES_IRQ: > if (args == NULL) { > init_alloc_resource_args(&args2, sizeof(args2)); > args = &args2; > } > /* Replace call to BUS_CONFIG_INTR on ACPI: */ > if (args->irq.polarity == INTR_POLARITY_CONFORMING && > device_has_polarity_from_CRS) > args->irq.polarity = polarity_from_CRS; > ... > } > > However, you could associate arbitrary data with a resource request by > adding more members to the approriate struct in the union. > For memory, I think this is an interesting concept, but it really doesn't match well with what you would want to do for interrupts or for, say, GPIOs in which the lines of control are fundamentally unrelated to the newbus hierarchy. -Nathan From owner-svn-src-head@freebsd.org Fri Jul 22 06:21: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 EAB86BA1358; Fri, 22 Jul 2016 06:21:04 +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 BB4091946; Fri, 22 Jul 2016 06:21:04 +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 u6M6L3bD045273; Fri, 22 Jul 2016 06:21:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6M6L39J045272; Fri, 22 Jul 2016 06:21:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607220621.u6M6L39J045272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 22 Jul 2016 06:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303183 - head/sys/modules/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 06:21:05 -0000 Author: kib Date: Fri Jul 22 06:21:03 2016 New Revision: 303183 URL: https://svnweb.freebsd.org/changeset/base/303183 Log: Make cam.ko loadable. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/modules/cam/Makefile Modified: head/sys/modules/cam/Makefile ============================================================================== --- head/sys/modules/cam/Makefile Fri Jul 22 05:09:08 2016 (r303182) +++ head/sys/modules/cam/Makefile Fri Jul 22 06:21:03 2016 (r303183) @@ -2,7 +2,7 @@ S= ${.CURDIR}/../.. -.PATH: $S/cam $S/cam/scsi $S/cam/ata $S/${MACHINE}/${MACHINE} +.PATH: $S/cam $S/cam/scsi $S/cam/ata $S/cam/nvme $S/${MACHINE}/${MACHINE} KMOD= cam @@ -41,6 +41,8 @@ SRCS+= ata_da.c SRCS+= ata_machdep.c .endif SRCS+= ata_pmp.c +SRCS+= nvme_all.c +SRCS+= nvme_xpt.c EXPORT_SYMS= YES # XXX evaluate From owner-svn-src-head@freebsd.org Fri Jul 22 07:45: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 53750BA1525; Fri, 22 Jul 2016 07:45:59 +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 1BE7F1F68; Fri, 22 Jul 2016 07:45:58 +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 D722A104483D; Fri, 22 Jul 2016 17:13:59 +1000 (AEST) Date: Fri, 22 Jul 2016 17:13:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev cc: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303146 - head/usr.bin/sed In-Reply-To: <20160722043536.GB37437@FreeBSD.org> Message-ID: <20160722165435.C2805@besplex.bde.org> References: <201607211417.u6LEHaPR086378@repo.freebsd.org> <20160722043536.GB37437@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=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=W6mxSz3NVuVsKJmdymQA: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: Fri, 22 Jul 2016 07:45:59 -0000 On Fri, 22 Jul 2016, Alexey Dokuchaev wrote: >> Log: >> sed(1): Appease older GCC. "Appease" actually seems to be the correct wording here since gcc's detection of a variable that might be used unitialized seems to report one that is not used uninitialized. > Isn't it also being dictated by style(9) and common sense? :) You missed that this combines a style fix in previous gcc appeasement (or just excessive paranoia) in one variable with appeasement for another variable, since copying the previous appeasement would copy its style bug. The 2 variables are used in exactly the same limited way. >> Modified: >> head/usr.bin/sed/process.c >> >> @@ -97,11 +97,12 @@ process(void) >> { >> struct s_command *cp; >> SPACE tspace; >> - size_t oldpsl = 0; >> + size_t oldpsl; >> char *p; >> int oldpsanl; >> >> p = NULL; >> + oldpsanl = oldpsl = 0; Multiple assignments on a single line is not very good style and is probably not KNF. Here it is further from being good style since the variables have different types. Since both types are integral and the value is 0 the implicit type conversions don't change the value. However, compilers should warn about down-converting a size_t to an int unless they do the analysis that this is safe because the value in the size_t is known to fit in the int. Bruce From owner-svn-src-head@freebsd.org Fri Jul 22 14:39: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 C336BBA12D6; Fri, 22 Jul 2016 14:39:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F4B81BDF; Fri, 22 Jul 2016 14:39:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MEdtx9029652; Fri, 22 Jul 2016 14:39:55 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MEdtID029651; Fri, 22 Jul 2016 14:39:55 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201607221439.u6MEdtID029651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 22 Jul 2016 14:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303186 - head/sys/arm/allwinner/a20 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 14:39:56 -0000 Author: manu Date: Fri Jul 22 14:39:55 2016 New Revision: 303186 URL: https://svnweb.freebsd.org/changeset/base/303186 Log: PC5 doesn't have mmc2 function. Modified: head/sys/arm/allwinner/a20/a20_padconf.c Modified: head/sys/arm/allwinner/a20/a20_padconf.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_padconf.c Fri Jul 22 14:24:17 2016 (r303185) +++ head/sys/arm/allwinner/a20/a20_padconf.c Fri Jul 22 14:39:55 2016 (r303186) @@ -87,7 +87,7 @@ const static struct allwinner_pins a20_p {"PC2", 2, 2, {"gpio_in", "gpio_out", "nand0", "spi0", NULL, NULL, NULL, NULL}}, {"PC3", 2, 3, {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, NULL, NULL}}, {"PC4", 2, 4, {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, NULL, NULL}}, - {"PC5", 2, 5, {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, NULL, NULL}}, + {"PC5", 2, 5, {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, NULL, NULL}}, {"PC6", 2, 6, {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, NULL, NULL}}, {"PC7", 2, 7, {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, NULL, NULL}}, {"PC8", 2, 8, {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, NULL, NULL}}, From owner-svn-src-head@freebsd.org Fri Jul 22 14: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 2C9DEBA166E for ; Fri, 22 Jul 2016 14:52:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm20.bullet.mail.bf1.yahoo.com (nm20.bullet.mail.bf1.yahoo.com [98.139.212.179]) (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 D96E014EE for ; Fri, 22 Jul 2016 14:52:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1469199117; bh=WgJd9D1VJ3g4OAHmBCdiJeVVn6S7ZIQvkH0rGCFQBjY=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=hh4SD+ntSUHpje1hf2HBNeF5YFBylWbqZX/D09bHLIy+/270C4FPbPL08EjEaw2ycfAPkp66rqbLVYvTNCZoS5RZnkiNfUK1n/CXB+G8j8hR61exa3AxKOULhDXQNY7K3VCcDx+auaqoSPUYqnCqZhdwECManIlrSq6qb/1LeeiXIOZXUX2azPpL4vItXloXgbQbcJ44ilPSYI/E29OAGBnU469Z0+mPLYqCLFWEzOuAR5IDEUGr49fiy4OM8Tv4JzfDGl/W0oxIRkmxkHmEKKW8gOZKzmOfiwpcrUrgLjQyNEE8QXfmWdhv1SxfI44/S7GYhakmhgZC/uzuc3mi/Q== Received: from [66.196.81.173] by nm20.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 Received: from [98.139.211.204] by tm19.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 Received: from [127.0.0.1] by smtp213.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 X-Yahoo-Newman-Id: 450564.16098.bm@smtp213.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: _u.xcr0VM1kCK_lObeOEPTfBWsOp2XhH_5UzDXtKl7eeYHJ wOlpODEtLvczs5H7HYAzzAh_c5F3HTR5hgtQD5P.gvRIKA_qE1ZpyqmNkmri xmoyOk3jUliVa4mcsWNWs42492Cp_dlghf.1B8NLNx1qVceU_NCe3Qpx2o3y ZwqCy0QWAJm9mpg0u1jIIg4M6fdP6bCQC.QrVd9h7lFPi5TZof_D9aTDvuN. 0CN9qpIu01PfMjso0uoHuzGp5G5vflunO1hsbOznavNgG_y.Cq_3k4sgHouC haEBWyp7d15R4QUO10SjhxNpJTmPNNYFq.VA3u6mnvZ6yuTUXBhKPR9C6u16 Ad6_qtRUYdCWB4VlfbMEkrtaEI9y9gtPIfi4SDQpKrcoN8JivEPzzkqxhULx Ll8EZhAyHzSAdcF3PSopVquSADTpKP0kq4DPuwsztAyU5k.GuH1.rl0wSeIO HN56na1qzjg22JpeOJKfSIkS.io.Jf8oFZMFeBy8pKCWr7OYcpibhtIlO_hG fNYuhVvC0LAXiP.mpyld.TXqsbEJy.L6vGAUFQmc4wiiZ5A-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303146 - head/usr.bin/sed To: Bruce Evans , Alexey Dokuchaev References: <201607211417.u6LEHaPR086378@repo.freebsd.org> <20160722043536.GB37437@FreeBSD.org> <20160722165435.C2805@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: Date: Fri, 22 Jul 2016 09:52:04 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160722165435.C2805@besplex.bde.org> 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: Fri, 22 Jul 2016 14:52:05 -0000 On 07/22/16 02:13, Bruce Evans wrote: > On Fri, 22 Jul 2016, Alexey Dokuchaev wrote: > >>> Log: >>> sed(1): Appease older GCC. > > "Appease" actually seems to be the correct wording here since gcc's > detection > of a variable that might be used unitialized seems to report one that is > not used uninitialized. > >> Isn't it also being dictated by style(9) and common sense? :) > > You missed that this combines a style fix in previous gcc appeasement > (or just excessive paranoia) in one variable with appeasement for > another variable, since copying the previous appeasement would copy > its style bug. The 2 variables are used in exactly the same limited > way. > Yes, the first one is just a style fix while I was there. The oldpsanl bogusness was breaking the build with gcc42. gcc48+, clang and coverity all agree it was a false positive. It was likely a side effect of raising the WARNS level to 5. >>> Modified: >>> head/usr.bin/sed/process.c >>> >>> @@ -97,11 +97,12 @@ process(void) >>> { >>> struct s_command *cp; >>> SPACE tspace; >>> - size_t oldpsl = 0; >>> + size_t oldpsl; >>> char *p; >>> int oldpsanl; >>> >>> p = NULL; >>> + oldpsanl = oldpsl = 0; > > Multiple assignments on a single line is not very good style and is > probably > not KNF. Here it is further from being good style since the variables > have different types. Since both types are integral and the value is 0 > the implicit type conversions don't change the value. However, compilers > should warn about down-converting a size_t to an int unless they do the > analysis that this is safe because the value in the size_t is known to > fit in the int. > Doing the multiple assignment seemed natural and readable as both are (perhaps equally bogus) initializations. I did notice the different types after committing. Perhaps swapping the assignment would have been preferable? I suspect the compiler manages to optimize out the casting. Pedro. From owner-svn-src-head@freebsd.org Fri Jul 22 14:57: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 C1E8ABA1764; Fri, 22 Jul 2016 14:57:27 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DE4D176A; Fri, 22 Jul 2016 14:57:27 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MEvQTm037019; Fri, 22 Jul 2016 14:57:26 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MEvQro037018; Fri, 22 Jul 2016 14:57:26 GMT (envelope-from br@FreeBSD.org) Message-Id: <201607221457.u6MEvQro037018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 22 Jul 2016 14:57:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303187 - head/contrib/llvm/projects/libunwind/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: Fri, 22 Jul 2016 14:57:27 -0000 Author: br Date: Fri Jul 22 14:57:26 2016 New Revision: 303187 URL: https://svnweb.freebsd.org/changeset/base/303187 Log: Set real values for context/cursor sizes for RISC-V to prevent static assertions. Reviewed by: emaste Sponsored by: DARPA, AFRL Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Fri Jul 22 14:39:55 2016 (r303186) +++ head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Fri Jul 22 14:57:26 2016 (r303187) @@ -50,8 +50,8 @@ # define _LIBUNWIND_MAX_REGISTER 32 # elif defined(__riscv__) # define _LIBUNWIND_TARGET_RISCV 1 -# define _LIBUNWIND_CONTEXT_SIZE 128 /* XXX */ -# define _LIBUNWIND_CURSOR_SIZE 140 /* XXX */ +# define _LIBUNWIND_CONTEXT_SIZE 64 +# define _LIBUNWIND_CURSOR_SIZE 76 # define _LIBUNWIND_MAX_REGISTER 96 # else # error "Unsupported architecture." From owner-svn-src-head@freebsd.org Fri Jul 22 15: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 3533CBA1801; Fri, 22 Jul 2016 15:00:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08A4E19C8; Fri, 22 Jul 2016 15:00:38 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MF0c6q037490; Fri, 22 Jul 2016 15:00:38 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MF0c3S037470; Fri, 22 Jul 2016 15:00:38 GMT (envelope-from br@FreeBSD.org) Message-Id: <201607221500.u6MF0c3S037470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 22 Jul 2016 15:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303188 - head/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: Fri, 22 Jul 2016 15:00:39 -0000 Author: br Date: Fri Jul 22 15:00:38 2016 New Revision: 303188 URL: https://svnweb.freebsd.org/changeset/base/303188 Log: Add warn flags for GCC 6.1 compiler. Sponsored by: DARPA, AFRL Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri Jul 22 14:57:26 2016 (r303187) +++ head/share/mk/bsd.sys.mk Fri Jul 22 15:00:38 2016 (r303188) @@ -114,6 +114,11 @@ CWARNFLAGS+= -Wno-format CWARNFLAGS+= -Wno-error=unused-function -Wno-error=enum-compare -Wno-error=logical-not-parentheses -Wno-error=bool-compare -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=clobbered -Wno-error=cast-align -Wno-error=extra -Wno-error=attributes -Wno-error=inline -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=strict-aliasing -Wno-error=address .endif +# GCC 6.1.0 +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 +CWARNFLAGS+= -Wno-error=unused-const-variable= -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=misleading-indentation -Wno-error=tautological-compare +.endif + # How to handle FreeBSD custom printf format specifiers. .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600 FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__ From owner-svn-src-head@freebsd.org Fri Jul 22 15:22: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 098E6BA1E03; Fri, 22 Jul 2016 15:22:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF1B117C0; Fri, 22 Jul 2016 15:22:50 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MFMoEg048262; Fri, 22 Jul 2016 15:22:50 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MFMofl048261; Fri, 22 Jul 2016 15:22:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201607221522.u6MFMofl048261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 22 Jul 2016 15:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303189 - head/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: Fri, 22 Jul 2016 15:22:51 -0000 Author: br Date: Fri Jul 22 15:22:49 2016 New Revision: 303189 URL: https://svnweb.freebsd.org/changeset/base/303189 Log: Set the soft-float flag for assembly code as well. This fixes compilation with GCC 6.1. Sponsored by: DARPA, AFRL Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Fri Jul 22 15:00:38 2016 (r303188) +++ head/share/mk/bsd.cpu.mk Fri Jul 22 15:22:49 2016 (r303189) @@ -329,6 +329,7 @@ CFLAGS += -mfloat-abi=softfp .if ${MACHINE_CPUARCH} == "riscv" CFLAGS += -msoft-float +ACFLAGS += -msoft-float .endif # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk From owner-svn-src-head@freebsd.org Fri Jul 22 16:15: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 14357B9FC90; Fri, 22 Jul 2016 16:15:37 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C82CE12CF; Fri, 22 Jul 2016 16:15:36 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MGFZN9066649; Fri, 22 Jul 2016 16:15:35 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MGFZgA066648; Fri, 22 Jul 2016 16:15:35 GMT (envelope-from br@FreeBSD.org) Message-Id: <201607221615.u6MGFZgA066648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 22 Jul 2016 16:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303190 - 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: Fri, 22 Jul 2016 16:15:37 -0000 Author: br Date: Fri Jul 22 16:15:35 2016 New Revision: 303190 URL: https://svnweb.freebsd.org/changeset/base/303190 Log: Add GCC 6.1 warn flags for kernel as well. Sponsored by: DARPA, AFRL Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Fri Jul 22 15:22:49 2016 (r303189) +++ head/sys/conf/kern.mk Fri Jul 22 16:15:35 2016 (r303190) @@ -50,6 +50,9 @@ CWARNEXTRA?= -Wno-error=inline -Wno-erro -Wno-error=array-bounds -Wno-error=address \ -Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes \ -Wno-error=strict-overflow -Wno-error=overflow +.if ${COMPILER_VERSION} >= 60100 +CWARNEXTRA+= -Wno-error=nonnull-compare -Wno-error=shift-overflow= +.endif .else # For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars. CWARNEXTRA?= -Wno-uninitialized From owner-svn-src-head@freebsd.org Fri Jul 22 17:23: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 B82C8BA1EFD; Fri, 22 Jul 2016 17:23:27 +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 A7EF11D64; Fri, 22 Jul 2016 17:23:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id A125817F1; Fri, 22 Jul 2016 17:23:27 +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 55963220BE; Fri, 22 Jul 2016 17:23:27 +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 sW3aA4U3KD0s; Fri, 22 Jul 2016 17:23:24 +0000 (UTC) Subject: Re: svn commit: r300349 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 49B22220B8 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, sbruno@FreeBSD.org, Ed Maste References: <201605210132.u4L1W75d033196@repo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <170a5233-9625-52b9-aaf7-840be1a5ce9d@FreeBSD.org> Date: Fri, 22 Jul 2016 10:23:22 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201605210132.u4L1W75d033196@repo.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, 22 Jul 2016 17:23:27 -0000 On 5/20/16 6:32 PM, Bryan Drewery wrote: > Author: bdrewery > Date: Sat May 21 01:32:07 2016 > New Revision: 300349 > URL: https://svnweb.freebsd.org/changeset/base/300349 > > Log: > Enable and utilize WITHOUT_CROSS_COMPILER logic for external CC. > > This is a NOP. > It turns out it isn't a NOP! > Reviewed by: brooks, bapt > Sponsored by: EMC / Isilon Storage Division > Differential Revision: https://reviews.freebsd.org/D6354 > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > ============================================================================== > --- head/Makefile.inc1 Sat May 21 01:32:04 2016 (r300348) > +++ head/Makefile.inc1 Sat May 21 01:32:07 2016 (r300349) > @@ -91,6 +91,12 @@ X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${ > X${BINUTIL}?= ${${BINUTIL}} > .endif > .endfor > +# If a full path to an external cross compiler is given, don't build > +# a cross compiler. > +.if ${XCC:N${CCACHE_BIN}:M/*} > +MK_CROSS_COMPILER= no > +.endif Now MK_CROSS_COMPILER=no is set. > + > .include # don't depend on src.opts.mk doing it > .include "share/mk/src.opts.mk" > src.opts.mk has: .if ${MK_CROSS_COMPILER} == "no" MK_BINUTILS_BOOTSTRAP:= no MK_CLANG_BOOTSTRAP:= no MK_ELFTOOLCHAIN_BOOTSTRAP:= no MK_GCC_BOOTSTRAP:= no .endif So binutils and elftoolchain don't get built. In my SYSTEM_COMPILER commit r300354 I had intended that binutils and elftoolchain continue to build as they lack version checks like were added for the compiler. I'll get some sort of fix in today for this. > @@ -454,7 +460,7 @@ BFLAGS+= -B${CROSS_BINUTILS_PREFIX} > .endif > > # External compiler needs sysroot and target flags. > -.if ${XCC:N${CCACHE_BIN}:M/*} || ${MK_CROSS_COMPILER} == "no" > +.if ${MK_CROSS_COMPILER} == "no" > .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) > BFLAGS+= -B${WORLDTMP}/usr/bin > .endif > @@ -478,7 +484,7 @@ XCFLAGS+= -target ${TARGET_TRIPLE} > .endif > XCFLAGS+= --sysroot=${WORLDTMP} > .else > -.endif # ${XCC:M/*} || ${MK_CROSS_COMPILER} == "no" > +.endif # ${MK_CROSS_COMPILER} == "no" > > .if !empty(BFLAGS) > XCFLAGS+= ${BFLAGS} > @@ -1714,9 +1720,7 @@ _elftctools= lib/libelftc \ > usr.bin/elfcopy > .endif > > -# If an full path to an external cross compiler is given, don't build > -# a cross compiler. > -.if ${XCC:N${CCACHE_BIN}:M/*} == "" && ${MK_CROSS_COMPILER} != "no" > +.if ${MK_CROSS_COMPILER} != "no" > .if ${MK_CLANG_BOOTSTRAP} != "no" > _clang= usr.bin/clang > _clang_libs= lib/clang > -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Fri Jul 22 17:31: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 8C3D1BA1224; Fri, 22 Jul 2016 17:31:15 +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 5928114E5; Fri, 22 Jul 2016 17:31:15 +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 u6MHVEXk095090; Fri, 22 Jul 2016 17:31:14 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MHVE50095088; Fri, 22 Jul 2016 17:31:14 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607221731.u6MHVE50095088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 22 Jul 2016 17:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303195 - 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: Fri, 22 Jul 2016 17:31:15 -0000 Author: bdrewery Date: Fri Jul 22 17:31:14 2016 New Revision: 303195 URL: https://svnweb.freebsd.org/changeset/base/303195 Log: Don't run find(1) for __MPATH with NO_MODULES set. It's a waste of time when it won't be used. Submitted by: bde MFC after: 3 days Modified: head/sys/conf/config.mk head/sys/conf/kern.pre.mk Modified: head/sys/conf/config.mk ============================================================================== --- head/sys/conf/config.mk Fri Jul 22 17:25:28 2016 (r303194) +++ head/sys/conf/config.mk Fri Jul 22 17:31:14 2016 (r303195) @@ -54,7 +54,7 @@ KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | .export KERN_OPTS .endif -.if !defined(__MPATH) +.if !defined(NO_MODULES) && !defined(__MPATH) __MPATH!=find ${SYSDIR:tA}/ -name \*_if.m .export __MPATH .endif Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Fri Jul 22 17:25:28 2016 (r303194) +++ head/sys/conf/kern.pre.mk Fri Jul 22 17:31:14 2016 (r303195) @@ -192,7 +192,7 @@ SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symb SYSTEM_DEP+= ${LDSCRIPT} # Calculate path for .m files early, if needed. -.if !defined(__MPATH) +.if !defined(NO_MODULES) && !defined(__MPATH) __MPATH!=find ${S:tA}/ -name \*_if.m .endif @@ -212,7 +212,9 @@ MKMODULESENV+= MODULES_OVERRIDE="${MODUL .if defined(DEBUG) MKMODULESENV+= DEBUG_FLAGS="${DEBUG}" .endif +.if !defined(NO_MODULES) MKMODULESENV+= __MPATH="${__MPATH}" +.endif # Architecture and output format arguments for objdump to convert image to # object file From owner-svn-src-head@freebsd.org Fri Jul 22 19:28: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 2535CBA1E0A; Fri, 22 Jul 2016 19:28:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC75B1229; Fri, 22 Jul 2016 19:28:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MJSOM4037031; Fri, 22 Jul 2016 19:28:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MJSOSP037030; Fri, 22 Jul 2016 19:28:24 GMT (envelope-from np@FreeBSD.org) Message-Id: <201607221928.u6MJSOSP037030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 22 Jul 2016 19:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303199 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 19:28:25 -0000 Author: np Date: Fri Jul 22 19:28:23 2016 New Revision: 303199 URL: https://svnweb.freebsd.org/changeset/base/303199 Log: ctld(8): Fix MaxBurstLength negotiation. The target must reply with the selected value of MaxBurstSize instead of just echoing back the initiator's offered value. Reviewed by: mav@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D7278 Modified: head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Fri Jul 22 17:36:40 2016 (r303198) +++ head/usr.sbin/ctld/login.c Fri Jul 22 19:28:23 2016 (r303199) @@ -569,7 +569,7 @@ login_negotiate_key(struct pdu *request, tmp = MAX_BURST_LENGTH; } conn->conn_max_burst_length = tmp; - keys_add(response_keys, name, value); + keys_add_int(response_keys, name, tmp); } else if (strcmp(name, "FirstBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) { From owner-svn-src-head@freebsd.org Fri Jul 22 20: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 E698BBA10F0; Fri, 22 Jul 2016 20:35:27 +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 BFA031ECD; Fri, 22 Jul 2016 20:35:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8862FB946; Fri, 22 Jul 2016 16:35:26 -0400 (EDT) From: John Baldwin To: Nathan Whitehorn Cc: Andrew Turner , Michal Meloun , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys Date: Fri, 22 Jul 2016 13:19:32 -0700 Message-ID: <2764416.DJT1n7EiEe@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> References: <201606051620.u55GKD5S066398@repo.freebsd.org> <13301107.Hm25rxUxW2@ralph.baldwin.cx> <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jul 2016 16:35:26 -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: Fri, 22 Jul 2016 20:35:28 -0000 On Thursday, July 21, 2016 10:51:20 PM Nathan Whitehorn wrote: > > On 07/21/16 14:35, John Baldwin wrote: > > On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: > >> On Wed, 20 Jul 2016 13:28:53 +0200 > >> Michal Meloun wrote: > >>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): > >>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), > >>>> but is both problematically more general and less flexible (it has > >>>> requirements on timing of PIC attachment vs. driver resource > >>>> allocation) > >>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that > >>> parsed data are magicaly stored within the call. > >>> The new method, bus_map_intr(), can parse data from multiple sources > >>> (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also > >>> returns parsed data back to caller. > >>> And no, it doesn't add any additional timing requirements . > >> I've been looking at ACPI on arm64. So far I have not found the need > >> for this with ACPI as we don't need to send the data to the interrupt > >> controller driver to be parsed in the way OFW/FDT needs to. > > ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ > > in bus_alloc_resource(). > > I hadn't realized that. It looks like you could do essentially the same > thing we do on PowerPC to clean this up by explicitly mapping the ACPI > interrupt domains to different PICs with varying default interrupt > properties. > > > What I had advocated in the discussions > > leading up to this was to have some sort of opaque structure containing > > a set of properties (the sort of thing bus_map_resource and make_dev_s > > use) that was passed up at bus_setup_intr() time. > > > I think it should now > > be passed up at bus_alloc_resource() time instead, but it would allow bus > > drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree > > with properties that the interrupt controller can then associate with > > the IRQ cookie it allocates in its own code. > > > We used to do this on PPC and MIPS, and the current code still supports > it, but it turned out not to be useful in the end for IRQs. The > hierarchy for IRQs rarely (read: almost never) follows the bus hierarchy > and often is enumerated in a different order. I have hardware, for > example, where the children of a single parent bus are all wired to > different interrupt controllers and sometimes to a mixture of interrupt > controllers. Those controllers are cascaded in ways that cross the > newbus tree laterally and, on some of them, the parent device from the > bus topology has interrupts handled by its own (bus) children. Trying to > make the newbus parents do something sensible with all of this would be > crazy and, in the case where parents depend on resources provided by > their own children, impossible. > > This is all to say that, since you want the interrupts to be decorated > along a path that usually has nothing to do with the newbus hierarchy, > it doesn't add much to add extra features to resource allocation. > ofw_bus_map_intr() is a newbus method to support this kind of thing but, > on all supported platforms, it is implemented only in nexus and no cases > have appeared where anyone ever wanted anything at the intermediate layers. Mmm. Another idea that has been bandied about is to create a separate "plane" in new-bus for an interrupt hierarchy and allow devices to have "interrupt" parents that are not the same as the "bus" parent. (Additional planes for power and clocks might also make sense.) The idea is borrowed from IOKit on Darwin which has multiple planes. The "bus" plane is always fully populated, but the other planes (Darwin has one for power for example) can be sparse. ACPI has methods that effectively describe the power plane on x86. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Jul 22 20: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 6365BBA1105; Fri, 22 Jul 2016 20:35:30 +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 41D651ED4; Fri, 22 Jul 2016 20:35:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3CDEDB98D; Fri, 22 Jul 2016 16:35:29 -0400 (EDT) From: John Baldwin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303188 - head/share/mk Date: Fri, 22 Jul 2016 13:09:57 -0700 Message-ID: <1980140.IgFQbb5iVz@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201607221500.u6MF0c3S037470@repo.freebsd.org> References: <201607221500.u6MF0c3S037470@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jul 2016 16:35:29 -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: Fri, 22 Jul 2016 20:35:30 -0000 On Friday, July 22, 2016 03:00:38 PM Ruslan Bukin wrote: > Author: br > Date: Fri Jul 22 15:00:38 2016 > New Revision: 303188 > URL: https://svnweb.freebsd.org/changeset/base/303188 > > Log: > Add warn flags for GCC 6.1 compiler. > > Sponsored by: DARPA, AFRL > > Modified: > head/share/mk/bsd.sys.mk > > Modified: head/share/mk/bsd.sys.mk > ============================================================================== > --- head/share/mk/bsd.sys.mk Fri Jul 22 14:57:26 2016 (r303187) > +++ head/share/mk/bsd.sys.mk Fri Jul 22 15:00:38 2016 (r303188) > @@ -114,6 +114,11 @@ CWARNFLAGS+= -Wno-format > CWARNFLAGS+= -Wno-error=unused-function -Wno-error=enum-compare -Wno-error=logical-not-parentheses -Wno-error=bool-compare -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=clobbered -Wno-error=cast-align -Wno-error=extra -Wno-error=attributes -Wno-error=inline -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=strict-aliasing -Wno-error=address > .endif > > +# GCC 6.1.0 > +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 > +CWARNFLAGS+= -Wno-error=unused-const-variable= -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=misleading-indentation -Wno-error=tautological-compare > +.endif Extra trailing = in the first one as well? -- John Baldwin From owner-svn-src-head@freebsd.org Fri Jul 22 20:35: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 D911DBA1118; Fri, 22 Jul 2016 20:35:31 +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 B179D1F12; Fri, 22 Jul 2016 20:35:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A9C42B99B; Fri, 22 Jul 2016 16:35:30 -0400 (EDT) From: John Baldwin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303190 - head/sys/conf Date: Fri, 22 Jul 2016 13:08:19 -0700 Message-ID: <4772915.f2DiQz7AkI@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201607221615.u6MGFZgA066648@repo.freebsd.org> References: <201607221615.u6MGFZgA066648@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jul 2016 16:35:30 -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: Fri, 22 Jul 2016 20:35:32 -0000 On Friday, July 22, 2016 04:15:35 PM Ruslan Bukin wrote: > Author: br > Date: Fri Jul 22 16:15:35 2016 > New Revision: 303190 > URL: https://svnweb.freebsd.org/changeset/base/303190 > > Log: > Add GCC 6.1 warn flags for kernel as well. > > Sponsored by: DARPA, AFRL > > Modified: > head/sys/conf/kern.mk > > Modified: head/sys/conf/kern.mk > ============================================================================== > --- head/sys/conf/kern.mk Fri Jul 22 15:22:49 2016 (r303189) > +++ head/sys/conf/kern.mk Fri Jul 22 16:15:35 2016 (r303190) > @@ -50,6 +50,9 @@ CWARNEXTRA?= -Wno-error=inline -Wno-erro > -Wno-error=array-bounds -Wno-error=address \ > -Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes \ > -Wno-error=strict-overflow -Wno-error=overflow > +.if ${COMPILER_VERSION} >= 60100 > +CWARNEXTRA+= -Wno-error=nonnull-compare -Wno-error=shift-overflow= Extra trailing =? -- John Baldwin From owner-svn-src-head@freebsd.org Fri Jul 22 20: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 992D8BA139D; Fri, 22 Jul 2016 20:42:10 +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 84A301877; Fri, 22 Jul 2016 20:42:10 +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 u6MKg2at007406 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 22 Jul 2016 13:42:03 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: John Baldwin References: <201606051620.u55GKD5S066398@repo.freebsd.org> <13301107.Hm25rxUxW2@ralph.baldwin.cx> <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> <2764416.DJT1n7EiEe@ralph.baldwin.cx> Cc: Andrew Turner , Michal Meloun , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Nathan Whitehorn Message-ID: <1a118114-836f-92bf-dbc3-38d4266668bb@freebsd.org> Date: Fri, 22 Jul 2016 13:42:02 -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: <2764416.DJT1n7EiEe@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbjSRoqxOZFI06ZzF5WEBWTG8xORVk4thdYcBA3B6dR1cr7MedZu3F9Ntfo1vcujkPHWnTLTza+Y7DN3Y1rngAopWvpo/qz6pE= X-Sonic-ID: C;4v2fvkxQ5hGggpNwxPCmMQ== M;BoLKvkxQ5hGggpNwxPCmMQ== 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: Fri, 22 Jul 2016 20:42:10 -0000 On 07/22/16 13:19, John Baldwin wrote: > On Thursday, July 21, 2016 10:51:20 PM Nathan Whitehorn wrote: >> On 07/21/16 14:35, John Baldwin wrote: >>> On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: >>>> On Wed, 20 Jul 2016 13:28:53 +0200 >>>> Michal Meloun wrote: >>>>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>>>>> but is both problematically more general and less flexible (it has >>>>>> requirements on timing of PIC attachment vs. driver resource >>>>>> allocation) >>>>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>>>> parsed data are magicaly stored within the call. >>>>> The new method, bus_map_intr(), can parse data from multiple sources >>>>> (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also >>>>> returns parsed data back to caller. >>>>> And no, it doesn't add any additional timing requirements . >>>> I've been looking at ACPI on arm64. So far I have not found the need >>>> for this with ACPI as we don't need to send the data to the interrupt >>>> controller driver to be parsed in the way OFW/FDT needs to. >>> ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ >>> in bus_alloc_resource(). >> I hadn't realized that. It looks like you could do essentially the same >> thing we do on PowerPC to clean this up by explicitly mapping the ACPI >> interrupt domains to different PICs with varying default interrupt >> properties. >> >>> What I had advocated in the discussions >>> leading up to this was to have some sort of opaque structure containing >>> a set of properties (the sort of thing bus_map_resource and make_dev_s >>> use) that was passed up at bus_setup_intr() time. >>> I think it should now >>> be passed up at bus_alloc_resource() time instead, but it would allow bus >>> drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree >>> with properties that the interrupt controller can then associate with >>> the IRQ cookie it allocates in its own code. >> >> We used to do this on PPC and MIPS, and the current code still supports >> it, but it turned out not to be useful in the end for IRQs. The >> hierarchy for IRQs rarely (read: almost never) follows the bus hierarchy >> and often is enumerated in a different order. I have hardware, for >> example, where the children of a single parent bus are all wired to >> different interrupt controllers and sometimes to a mixture of interrupt >> controllers. Those controllers are cascaded in ways that cross the >> newbus tree laterally and, on some of them, the parent device from the >> bus topology has interrupts handled by its own (bus) children. Trying to >> make the newbus parents do something sensible with all of this would be >> crazy and, in the case where parents depend on resources provided by >> their own children, impossible. >> >> This is all to say that, since you want the interrupts to be decorated >> along a path that usually has nothing to do with the newbus hierarchy, >> it doesn't add much to add extra features to resource allocation. >> ofw_bus_map_intr() is a newbus method to support this kind of thing but, >> on all supported platforms, it is implemented only in nexus and no cases >> have appeared where anyone ever wanted anything at the intermediate layers. > Mmm. Another idea that has been bandied about is to create a separate > "plane" in new-bus for an interrupt hierarchy and allow devices to have > "interrupt" parents that are not the same as the "bus" parent. (Additional > planes for power and clocks might also make sense.) The idea is borrowed > from IOKit on Darwin which has multiple planes. The "bus" plane is always > fully populated, but the other planes (Darwin has one for power for example) > can be sparse. ACPI has methods that effectively describe the power plane > on x86. > That's basically what the virtual IRQ code does: it implements a separate IRQ "plane" that is lazily interconnected during bus attachment and then strongly interconnected at configure_final() (i.e. it panics at that point if the topology hasn't converged yet). A generalized version of this concept would be useful for a number of other resource types (power, clocks, GPIOs, etc.) and I would be very happy to see it as a standard part of the OS. -Nathan From owner-svn-src-head@freebsd.org Fri Jul 22 20: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 1CB97BA169C; Fri, 22 Jul 2016 20:52:42 +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 E0F711F53; Fri, 22 Jul 2016 20:52:41 +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 u6MKqfZK075686; Fri, 22 Jul 2016 20:52:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MKqfwW075685; Fri, 22 Jul 2016 20:52:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607222052.u6MKqfwW075685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 Jul 2016 20:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303202 - 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: Fri, 22 Jul 2016 20:52:42 -0000 Author: jhb Date: Fri Jul 22 20:52:40 2016 New Revision: 303202 URL: https://svnweb.freebsd.org/changeset/base/303202 Log: Update after r303154 to note that operations on local files are safe. Modified: head/share/man/man4/aio.4 Modified: head/share/man/man4/aio.4 ============================================================================== --- head/share/man/man4/aio.4 Fri Jul 22 19:36:11 2016 (r303201) +++ head/share/man/man4/aio.4 Fri Jul 22 20:52:40 2016 (r303202) @@ -54,7 +54,9 @@ the .Va vfs.aio.enable_unsafe sysctl node to a non-zero value. .Pp -Asynchronous I/O operations on sockets and raw disk devices do not block +Asynchronous I/O operations on sockets, +raw disk devices, +and regular files on local filesystems do not block indefinitely and are always enabled. .Pp The From owner-svn-src-head@freebsd.org Fri Jul 22 20:54: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 4D395BA1723; Fri, 22 Jul 2016 20:54:31 +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 1A8DC125F; Fri, 22 Jul 2016 20:54:30 +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 3E0CFD78FE; Fri, 22 Jul 2016 20:53:55 +0000 (UTC) Date: Fri, 22 Jul 2016 21:53:51 +0100 From: Andrew Turner To: John Baldwin Cc: Nathan Whitehorn , Michal Meloun , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys Message-ID: <20160722215351.5fbb2a49@zapp> In-Reply-To: <2764416.DJT1n7EiEe@ralph.baldwin.cx> References: <201606051620.u55GKD5S066398@repo.freebsd.org> <13301107.Hm25rxUxW2@ralph.baldwin.cx> <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> <2764416.DJT1n7EiEe@ralph.baldwin.cx> 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: Fri, 22 Jul 2016 20:54:31 -0000 On Fri, 22 Jul 2016 13:19:32 -0700 John Baldwin wrote: > On Thursday, July 21, 2016 10:51:20 PM Nathan Whitehorn wrote: > > > > On 07/21/16 14:35, John Baldwin wrote: > > > On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: > > >> On Wed, 20 Jul 2016 13:28:53 +0200 > > >> Michal Meloun wrote: > > >>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): > > >>>> 2. It partially duplicates the functionality of > > >>>> OFW_BUS_MAP_INTR(), but is both problematically more general > > >>>> and less flexible (it has requirements on timing of PIC > > >>>> attachment vs. driver resource allocation) > > >>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect > > >>> that parsed data are magicaly stored within the call. > > >>> The new method, bus_map_intr(), can parse data from multiple > > >>> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin > > >>> number]). It also returns parsed data back to caller. > > >>> And no, it doesn't add any additional timing requirements . > > >> I've been looking at ACPI on arm64. So far I have not found the > > >> need for this with ACPI as we don't need to send the data to the > > >> interrupt controller driver to be parsed in the way OFW/FDT > > >> needs to. > > > ACPI though has a gross hack where we call BUS_CONFIG_INTR on the > > > IRQ in bus_alloc_resource(). > > > > I hadn't realized that. It looks like you could do essentially the > > same thing we do on PowerPC to clean this up by explicitly mapping > > the ACPI interrupt domains to different PICs with varying default > > interrupt properties. > > > > > What I had advocated in the discussions > > > leading up to this was to have some sort of opaque structure > > > containing a set of properties (the sort of thing > > > bus_map_resource and make_dev_s use) that was passed up at > > > bus_setup_intr() time. > > > > > I think it should now > > > be passed up at bus_alloc_resource() time instead, but it would > > > allow bus drivers to "decorate" a SYS_RES_IRQ request as it goes > > > up the device tree with properties that the interrupt controller > > > can then associate with the IRQ cookie it allocates in its own > > > code. > > > > > > We used to do this on PPC and MIPS, and the current code still > > supports it, but it turned out not to be useful in the end for > > IRQs. The hierarchy for IRQs rarely (read: almost never) follows > > the bus hierarchy and often is enumerated in a different order. I > > have hardware, for example, where the children of a single parent > > bus are all wired to different interrupt controllers and sometimes > > to a mixture of interrupt controllers. Those controllers are > > cascaded in ways that cross the newbus tree laterally and, on some > > of them, the parent device from the bus topology has interrupts > > handled by its own (bus) children. Trying to make the newbus > > parents do something sensible with all of this would be crazy and, > > in the case where parents depend on resources provided by their own > > children, impossible. > > > > This is all to say that, since you want the interrupts to be > > decorated along a path that usually has nothing to do with the > > newbus hierarchy, it doesn't add much to add extra features to > > resource allocation. ofw_bus_map_intr() is a newbus method to > > support this kind of thing but, on all supported platforms, it is > > implemented only in nexus and no cases have appeared where anyone > > ever wanted anything at the intermediate layers. > > Mmm. Another idea that has been bandied about is to create a separate > "plane" in new-bus for an interrupt hierarchy and allow devices to > have "interrupt" parents that are not the same as the "bus" parent. > (Additional planes for power and clocks might also make sense.) The > idea is borrowed from IOKit on Darwin which has multiple planes. The > "bus" plane is always fully populated, but the other planes (Darwin > has one for power for example) can be sparse. ACPI has methods that > effectively describe the power plane on x86. For some planes the structure would look more like a directed graph. Devices can have multiple clock parents, e.g. one for the register interface, and another to drive the external bus. I can also imagine the case where a device could have multiple interrupt parents, an MMC/SD controller comes to mind where it may have an interrupt on a GPIO line to detect the card being inserted, with another for command completion, etc. In this case one parent would be the standard interrupt controller, with the other being the GPIO controller. Andrew From owner-svn-src-head@freebsd.org Fri Jul 22 21:00: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 8D4FDBA1805; Fri, 22 Jul 2016 21:00:00 +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 77E9F1502; Fri, 22 Jul 2016 21:00:00 +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 u6MKxwKM027862 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 22 Jul 2016 13:59:58 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Andrew Turner , John Baldwin References: <201606051620.u55GKD5S066398@repo.freebsd.org> <13301107.Hm25rxUxW2@ralph.baldwin.cx> <03bcc081-5b93-c2ba-4e9b-e51d0b2e773a@freebsd.org> <2764416.DJT1n7EiEe@ralph.baldwin.cx> <20160722215351.5fbb2a49@zapp> Cc: Michal Meloun , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Nathan Whitehorn Message-ID: <32fbc7f3-eb27-29f6-f7d7-7e05b7c2f07e@freebsd.org> Date: Fri, 22 Jul 2016 13:59:58 -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: <20160722215351.5fbb2a49@zapp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVbDZgjPIjLf106nj/Blm0n1rCygC+q+N3O9hR/h0Q6R5XAkKWGRoNBT7LxeWAXAW5w7HTQbUjq6TPDwuAIrjdC8Mx8cEIbxrVw= X-Sonic-ID: C;DkfZP09Q5hGckpNwxPCmMQ== M;Do8EQE9Q5hGckpNwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 2.5/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: Fri, 22 Jul 2016 21:00:00 -0000 On 07/22/16 13:53, Andrew Turner wrote: > On Fri, 22 Jul 2016 13:19:32 -0700 > John Baldwin wrote: > >> On Thursday, July 21, 2016 10:51:20 PM Nathan Whitehorn wrote: >>> On 07/21/16 14:35, John Baldwin wrote: >>>> On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: >>>>> On Wed, 20 Jul 2016 13:28:53 +0200 >>>>> Michal Meloun wrote: >>>>>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>>>>> 2. It partially duplicates the functionality of >>>>>>> OFW_BUS_MAP_INTR(), but is both problematically more general >>>>>>> and less flexible (it has requirements on timing of PIC >>>>>>> attachment vs. driver resource allocation) >>>>>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect >>>>>> that parsed data are magicaly stored within the call. >>>>>> The new method, bus_map_intr(), can parse data from multiple >>>>>> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin >>>>>> number]). It also returns parsed data back to caller. >>>>>> And no, it doesn't add any additional timing requirements . >>>>> I've been looking at ACPI on arm64. So far I have not found the >>>>> need for this with ACPI as we don't need to send the data to the >>>>> interrupt controller driver to be parsed in the way OFW/FDT >>>>> needs to. >>>> ACPI though has a gross hack where we call BUS_CONFIG_INTR on the >>>> IRQ in bus_alloc_resource(). >>> I hadn't realized that. It looks like you could do essentially the >>> same thing we do on PowerPC to clean this up by explicitly mapping >>> the ACPI interrupt domains to different PICs with varying default >>> interrupt properties. >>> >>>> What I had advocated in the discussions >>>> leading up to this was to have some sort of opaque structure >>>> containing a set of properties (the sort of thing >>>> bus_map_resource and make_dev_s use) that was passed up at >>>> bus_setup_intr() time. >>> >>>> I think it should now >>>> be passed up at bus_alloc_resource() time instead, but it would >>>> allow bus drivers to "decorate" a SYS_RES_IRQ request as it goes >>>> up the device tree with properties that the interrupt controller >>>> can then associate with the IRQ cookie it allocates in its own >>>> code. >>> >>> We used to do this on PPC and MIPS, and the current code still >>> supports it, but it turned out not to be useful in the end for >>> IRQs. The hierarchy for IRQs rarely (read: almost never) follows >>> the bus hierarchy and often is enumerated in a different order. I >>> have hardware, for example, where the children of a single parent >>> bus are all wired to different interrupt controllers and sometimes >>> to a mixture of interrupt controllers. Those controllers are >>> cascaded in ways that cross the newbus tree laterally and, on some >>> of them, the parent device from the bus topology has interrupts >>> handled by its own (bus) children. Trying to make the newbus >>> parents do something sensible with all of this would be crazy and, >>> in the case where parents depend on resources provided by their own >>> children, impossible. >>> >>> This is all to say that, since you want the interrupts to be >>> decorated along a path that usually has nothing to do with the >>> newbus hierarchy, it doesn't add much to add extra features to >>> resource allocation. ofw_bus_map_intr() is a newbus method to >>> support this kind of thing but, on all supported platforms, it is >>> implemented only in nexus and no cases have appeared where anyone >>> ever wanted anything at the intermediate layers. >> Mmm. Another idea that has been bandied about is to create a separate >> "plane" in new-bus for an interrupt hierarchy and allow devices to >> have "interrupt" parents that are not the same as the "bus" parent. >> (Additional planes for power and clocks might also make sense.) The >> idea is borrowed from IOKit on Darwin which has multiple planes. The >> "bus" plane is always fully populated, but the other planes (Darwin >> has one for power for example) can be sparse. ACPI has methods that >> effectively describe the power plane on x86. > For some planes the structure would look more like a directed > graph. Devices can have multiple clock parents, e.g. one for the > register interface, and another to drive the external bus. > > I can also imagine the case where a device could have multiple > interrupt parents, an MMC/SD controller comes to mind where it may have > an interrupt on a GPIO line to detect the card being inserted, with > another for command completion, etc. In this case one parent would be > the standard interrupt controller, with the other being the GPIO > controller. > > Andrew > That's a good point for the generalized system (this already works for the specific case of interrupts, of course). It's more the resources that have a non-bus parent than the device. There are also devices with multiple bus parents, but those are more oddball kinds of things (Apple made some on-board PCI devices that are also connected by a second non-PCI path). -Nathan From owner-svn-src-head@freebsd.org Fri Jul 22 21:42: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 6DC18B9E2CF; Fri, 22 Jul 2016 21:42:57 +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 4DEB51A9E; Fri, 22 Jul 2016 21:42:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0925BB96E; Fri, 22 Jul 2016 17:42:56 -0400 (EDT) From: John Baldwin To: Roger Pau =?ISO-8859-1?Q?Monn=E9?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303076 - head/sys/dev/fb Date: Fri, 22 Jul 2016 14:42:51 -0700 Message-ID: <3203650.y8tuqEfyUM@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201607200929.u6K9Td8S040645@repo.freebsd.org> References: <201607200929.u6K9Td8S040645@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jul 2016 17:42:56 -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: Fri, 22 Jul 2016 21:42:57 -0000 On Wednesday, July 20, 2016 09:29:39 AM Roger Pau Monn=E9 wrote: > Author: royger > Date: Wed Jul 20 09:29:39 2016 > New Revision: 303076 > URL: https://svnweb.freebsd.org/changeset/base/303076 >=20 > Log: > vesa: fix panic on suspend > =20 > Fix the following panic seen when migrating a FreeBSD guest on Xen:= > =20 > panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:5= 41 > cpuid =3D 0 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffff= e001d2fa4f0 > vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570 > kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0 > __mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa6= 30 > vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfff= ffe001d2fa680 > vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0 > isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0 > bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame= > [...] > =20 > This is caused because vga_sub_configure (which is called if the VG= A adapter > is attached after VESA tried to initialize), points to vesa_configu= re, which > doesn't initialize the VESA mutex. In order to fix it, make sure > vga_sub_configure points to vesa_load, so that all the needed vesa > components are properly initialized. This panics a box without VESA (a dumb VGA) since vesa_init_done doesn'= t get set to true if VESA fails to find anything during its probe, so the mutex c= an be initialized twice. I think it is better to just revert this change and= use MTX_SYSINIT to initialize the mutex instead. vga0: at port 0x3d0-0x3db iomem 0xb8000-0xbffff on is= a0 panic: lock "VESA lock" 0xffffffff81c64af0 already initialized cpuid =3D 0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff8= 24ec7a0 kdb_backtrace() at kdb_backtrace+0x39/frame 0xffffffff824ec850 vpanic() at vpanic+0x181/frame 0xffffffff824ec8d0 kassert_panic() at kassert_panic+0x17d/frame 0xffffffff824ec960 lock_init() at lock_init+0x186/frame 0xffffffff824ec9a0 _mtx_init() at _mtx_init+0x90/frame 0xffffffff824ec9e0 vesa_late_load() at vesa_late_load+0x2d/frame 0xffffffff824eca00 vga_init() at vga_init+0x65/frame 0xffffffff824eca20 vga_attach_unit() at vga_attach_unit+0x4b/frame 0xffffffff824eca50 isavga_attach() at isavga_attach+0x6c/frame 0xffffffff824eca90 DEVICE_ATTACH() at DEVICE_ATTACH+0x44/frame 0xffffffff824ecab0 https://reviews.freebsd.org/D7290 is a suggested patch that works in my= test case. --=20 John Baldwin From owner-svn-src-head@freebsd.org Fri Jul 22 21:49: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 E34B0B9E3A9; Fri, 22 Jul 2016 21:49:42 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5F331D0F; Fri, 22 Jul 2016 21:49:42 +0000 (UTC) (envelope-from mizhka@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6MLnf4g099345; Fri, 22 Jul 2016 21:49:41 GMT (envelope-from mizhka@FreeBSD.org) Received: (from mizhka@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MLnfUp099344; Fri, 22 Jul 2016 21:49:41 GMT (envelope-from mizhka@FreeBSD.org) Message-Id: <201607222149.u6MLnfUp099344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mizhka set sender to mizhka@FreeBSD.org using -f From: Michael Zhilin Date: Fri, 22 Jul 2016 21:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303203 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 21:49:43 -0000 Author: mizhka Date: Fri Jul 22 21:49:41 2016 New Revision: 303203 URL: https://svnweb.freebsd.org/changeset/base/303203 Log: [new-committer:mizhka] add committer into graph Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7288 Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Jul 22 20:52:40 2016 (r303202) +++ head/share/misc/committers-src.dot Fri Jul 22 21:49:41 2016 (r303203) @@ -237,6 +237,7 @@ maxim [label="Maxim Konovalov\nmaxim@Fre mdf [label="Matthew Fleming\nmdf@FreeBSD.org\n2010/06/04"] mdodd [label="Matthew N. Dodd\nmdodd@FreeBSD.org\n1999/07/27"] melifaro [label="Alexander V. Chernikov\nmelifaro@FreeBSD.org\n2011/10/04"] +mizhka [label="Michael Zhilin\nmizhka@FreeBSD.org\n2016/07/19"] mjacob [label="Matt Jacob\nmjacob@FreeBSD.org\n1997/08/13"] mjg [label="Mateusz Guzik\nmjg@FreeBSD.org\n2012/06/04"] mlaier [label="Max Laier\nmlaier@FreeBSD.org\n2004/02/10"] @@ -353,6 +354,7 @@ adrian -> jmcneill adrian -> landonf adrian -> lidl adrian -> loos +adrian -> mizhka adrian -> monthadar adrian -> ray adrian -> rmh From owner-svn-src-head@freebsd.org Fri Jul 22 21:52: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 2CB3BB9E51D; Fri, 22 Jul 2016 21:52:09 +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 0137811BC; Fri, 22 Jul 2016 21:52:08 +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 u6MLq8w5002917; Fri, 22 Jul 2016 21:52:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MLq8UN002916; Fri, 22 Jul 2016 21:52:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607222152.u6MLq8UN002916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 Jul 2016 21:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303204 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 21:52:09 -0000 Author: jhb Date: Fri Jul 22 21:52:07 2016 New Revision: 303204 URL: https://svnweb.freebsd.org/changeset/base/303204 Log: Install a handler for firmware work request error messages. If a driver sends an malformed or disallowed work request, the firmware responds with a work request error. Previously the driver treated this is as an unexpected message and panicked. Now it decodes the error message to aid in debugging. Reviewed by: np (older version) MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D6950 Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Jul 22 21:49:41 2016 (r303203) +++ head/sys/dev/cxgbe/t4_sge.c Fri Jul 22 21:52:07 2016 (r303204) @@ -244,6 +244,7 @@ static int handle_sge_egr_update(struct struct mbuf *); static int handle_fw_msg(struct sge_iq *, const struct rss_header *, struct mbuf *); +static int t4_handle_wrerr_rpl(struct adapter *, const __be64 *); static void wrq_tx_drain(void *, int); static void drain_wrq_wr_list(struct adapter *, struct sge_wrq *); @@ -402,6 +403,7 @@ t4_sge_modload(void) t4_register_cpl_handler(CPL_SGE_EGR_UPDATE, handle_sge_egr_update); t4_register_cpl_handler(CPL_RX_PKT, t4_eth_rx); t4_register_fw_msg_handler(FW6_TYPE_CMD_RPL, t4_handle_fw_rpl); + t4_register_fw_msg_handler(FW6_TYPE_WRERR_RPL, t4_handle_wrerr_rpl); } void @@ -4782,6 +4784,71 @@ handle_fw_msg(struct sge_iq *iq, const s return (t4_fw_msg_handler[cpl->type](sc, &cpl->data[0])); } +/** + * t4_handle_wrerr_rpl - process a FW work request error message + * @adap: the adapter + * @rpl: start of the FW message + */ +static int +t4_handle_wrerr_rpl(struct adapter *adap, const __be64 *rpl) +{ + u8 opcode = *(const u8 *)rpl; + const struct fw_error_cmd *e = (const void *)rpl; + unsigned int i; + + if (opcode != FW_ERROR_CMD) { + log(LOG_ERR, + "%s: Received WRERR_RPL message with opcode %#x\n", + device_get_nameunit(adap->dev), opcode); + return (EINVAL); + } + log(LOG_ERR, "%s: FW_ERROR (%s) ", device_get_nameunit(adap->dev), + G_FW_ERROR_CMD_FATAL(be32toh(e->op_to_type)) ? "fatal" : + "non-fatal"); + switch (G_FW_ERROR_CMD_TYPE(be32toh(e->op_to_type))) { + case FW_ERROR_TYPE_EXCEPTION: + log(LOG_ERR, "exception info:\n"); + for (i = 0; i < nitems(e->u.exception.info); i++) + log(LOG_ERR, "%s%08x", i == 0 ? "\t" : " ", + be32toh(e->u.exception.info[i])); + log(LOG_ERR, "\n"); + break; + case FW_ERROR_TYPE_HWMODULE: + log(LOG_ERR, "HW module regaddr %08x regval %08x\n", + be32toh(e->u.hwmodule.regaddr), + be32toh(e->u.hwmodule.regval)); + break; + case FW_ERROR_TYPE_WR: + log(LOG_ERR, "WR cidx %d PF %d VF %d eqid %d hdr:\n", + be16toh(e->u.wr.cidx), + G_FW_ERROR_CMD_PFN(be16toh(e->u.wr.pfn_vfn)), + G_FW_ERROR_CMD_VFN(be16toh(e->u.wr.pfn_vfn)), + be32toh(e->u.wr.eqid)); + for (i = 0; i < nitems(e->u.wr.wrhdr); i++) + log(LOG_ERR, "%s%02x", i == 0 ? "\t" : " ", + e->u.wr.wrhdr[i]); + log(LOG_ERR, "\n"); + break; + case FW_ERROR_TYPE_ACL: + log(LOG_ERR, "ACL cidx %d PF %d VF %d eqid %d %s", + be16toh(e->u.acl.cidx), + G_FW_ERROR_CMD_PFN(be16toh(e->u.acl.pfn_vfn)), + G_FW_ERROR_CMD_VFN(be16toh(e->u.acl.pfn_vfn)), + be32toh(e->u.acl.eqid), + G_FW_ERROR_CMD_MV(be16toh(e->u.acl.mv_pkd)) ? "vlanid" : + "MAC"); + for (i = 0; i < nitems(e->u.acl.val); i++) + log(LOG_ERR, " %02x", e->u.acl.val[i]); + log(LOG_ERR, "\n"); + break; + default: + log(LOG_ERR, "type %#x\n", + G_FW_ERROR_CMD_TYPE(be32toh(e->op_to_type))); + return (EINVAL); + } + return (0); +} + static int sysctl_uint16(SYSCTL_HANDLER_ARGS) { From owner-svn-src-head@freebsd.org Fri Jul 22 21:57: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 B053DB9E5E6; Fri, 22 Jul 2016 21:57:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 3B5B61439; Fri, 22 Jul 2016 21:57:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-149.carlnfd1.nsw.optusnet.com.au [110.21.100.149]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 35819785BDE; Sat, 23 Jul 2016 07:57:24 +1000 (AEST) Date: Sat, 23 Jul 2016 07:57:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303188 - head/share/mk In-Reply-To: <1980140.IgFQbb5iVz@ralph.baldwin.cx> Message-ID: <20160723073428.K1265@besplex.bde.org> References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> 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=VIkg5I7X c=1 sm=1 tr=0 a=XDAe9YG+7EcdVXYrgT+/UQ==:117 a=XDAe9YG+7EcdVXYrgT+/UQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=-_n7_GSXjfI_3vEHYuMA: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: Fri, 22 Jul 2016 21:57:33 -0000 On Fri, 22 Jul 2016, John Baldwin wrote: > On Friday, July 22, 2016 03:00:38 PM Ruslan Bukin wrote: >> >> Log: >> Add warn flags for GCC 6.1 compiler. >> >> Sponsored by: DARPA, AFRL >> >> Modified: >> head/share/mk/bsd.sys.mk >> >> Modified: head/share/mk/bsd.sys.mk >> ============================================================================== >> --- head/share/mk/bsd.sys.mk Fri Jul 22 14:57:26 2016 (r303187) >> +++ head/share/mk/bsd.sys.mk Fri Jul 22 15:00:38 2016 (r303188) >> @@ -114,6 +114,11 @@ CWARNFLAGS+= -Wno-format >> CWARNFLAGS+= -Wno-error=unused-function -Wno-error=enum-compare -Wno-error=logical-not-parentheses -Wno-error=bool-compare -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=clobbered -Wno-error=cast-align -Wno-error=extra -Wno-error=attributes -Wno-error=inline -Wno-error=unused-but-set-variable -Wno-error=unused-value -Wno-error=strict-aliasing -Wno-error=address >> .endif >> >> +# GCC 6.1.0 >> +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 >> +CWARNFLAGS+= -Wno-error=unused-const-variable= -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=misleading-indentation -Wno-error=tautological-compare >> +.endif > > Extra trailing = in the first one as well? I don't see one. I see only unreadably long lines containing unreadably unordered flags. Perhaps your mail client mangled the line splitting, but the above quite displays OK in mutt and vi here (except mutt makes the line wrapping especially ugly by highlighting it). Bruce From owner-svn-src-head@freebsd.org Fri Jul 22 22:20: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 BA0D2B9E9E4; Fri, 22 Jul 2016 22:20:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com [IPv6:2607:f8b0:400d:c09::22f]) (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 389311C58; Fri, 22 Jul 2016 22:20:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22f.google.com with SMTP id o67so113415569qke.1; Fri, 22 Jul 2016 15:20:54 -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=CyQf2i8776FVb03S5O1LqlnjiWKAXpd4yHSazd2hdcg=; b=gSxwRBIGymz4ccN0AmGjXPKypr3rYws9nIcsWSBhpiyVfnMIYrcu8ie0hNdrdlGZJP YHw/3055rKsSsoDVNs3S+MaEjE0YZewYW/JOmCDEcvvK4LGhKzqsdLuzCOikrmG6saXY e6kr51lANW9+DE6qoUSLUHlFU73nT42SuthnzMGG1WyDaTi7C0Z9w8g/cLD2MBDTDuIl RnH+dl4bAaqsJGDmK1FH17X4up3BMrI2R6EKIOcuMBEqTW5OQUql3ZEocMP1OPqhCna4 pHTe0NwpdzP4ON5wtnXHn2cMwb3/Ym0BAyE/+GtD5Hf0zLYkDO2WLzEUH3TpsI91vloS wcMw== 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=CyQf2i8776FVb03S5O1LqlnjiWKAXpd4yHSazd2hdcg=; b=V5PIFFwRXyog5YbpOctHuvz/KV/ysSfnZ8pbM/8UQjMSrAvP3aXyhMp9wFYFI0/PGS xj0rBCuVz6Dim2s7Rnc2jP1iVgvVLUWCo2irHih8qQK7S+6yePtizpZ/XsdLuasFzaDu n2ESsdCRmrrKj80CbvDVwczgY9wdPpsHn1hbyKkgQELPoNDhvPQPx27iXeACjYgJ2FDp 2+5X9ug7FD/pwJVEaS1U2DgMQB2VbPRRhavGLzb8QMldAqHb+6kZkP8ebiPto1N2OPNJ lv6ACsNH9rTWAprNowyJGirTSDdqIGQdTrbyjf3GmAV3LsBonzqP4EFY32J4i28DHFQF Xo+Q== X-Gm-Message-State: AEkooutz813tvhaNdaNLiskv2KCYW7O15vBDwC5CIVomZISGrXh/0yn5tFSI6yAdeS8To2+j8Qh3cVm2h2APKw== X-Received: by 10.55.48.19 with SMTP id w19mr7645749qkw.141.1469226052390; Fri, 22 Jul 2016 15:20:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.233.216.194 with HTTP; Fri, 22 Jul 2016 15:20:51 -0700 (PDT) In-Reply-To: <20160723073428.K1265@besplex.bde.org> References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> <20160723073428.K1265@besplex.bde.org> From: Ngie Cooper Date: Fri, 22 Jul 2016 15:20:51 -0700 Message-ID: Subject: Re: svn commit: r303188 - head/share/mk To: Bruce Evans Cc: John Baldwin , Ruslan Bukin , "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, 22 Jul 2016 22:20:54 -0000 On Fri, Jul 22, 2016 at 2:57 PM, Bruce Evans wrote: ... >>> +# GCC 6.1.0 >>> +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 >>> +CWARNFLAGS+= -Wno-error=unused-const-variable= >>> -Wno-error=nonnull-compare -Wno-error=shift-negative-value >>> -Wno-error=misleading-indentation -Wno-error=tautological-compare >>> +.endif >> >> >> Extra trailing = in the first one as well? > > I don't see one. I see only unreadably long lines containing unreadably > unordered flags. Perhaps your mail client mangled the line splitting, > but the above quite displays OK in mutt and vi here (except mutt makes > the line wrapping especially ugly by highlighting it). Look for "-Wno-error=unused-const-variable=". Thanks, -Ngie From owner-svn-src-head@freebsd.org Fri Jul 22 22:46: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 401B1BA1176; Fri, 22 Jul 2016 22:46:43 +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 09D0419F1; Fri, 22 Jul 2016 22:46:42 +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 u6MMkgdB021101; Fri, 22 Jul 2016 22:46:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6MMkfQh021096; Fri, 22 Jul 2016 22:46:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607222246.u6MMkfQh021096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 22 Jul 2016 22:46:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303205 - in head/sys: conf dev/cxgbe modules/cxgbe/if_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 22:46:43 -0000 Author: jhb Date: Fri Jul 22 22:46:41 2016 New Revision: 303205 URL: https://svnweb.freebsd.org/changeset/base/303205 Log: Add a driver to create VF devices on Chelsio T4/T5 NICs. Chelsio NICs are a bit unique compared to some other NICs in that they expose different functionality on different physical functions. In particular, PF4 is used to manage the NIC interfaces ('t4nex' and 't5nex'). However, PF4 is not able to create VF devices. Instead, VFs are only supported by physical functions 0 through 3. This commit adds 't4iov' and 't5iov' drivers that attach to PF0-3. One extra wrinkle is that the iov devices cannot enable SR-IOV until the firwmare has been initialized by the main PF4 driver. To handle this case, a new t4_if kobj interface has been added to permit cross-calls between the PF drivers. The PF4 driver notifies sibling drivers when it is fully attached. It also requests sibling drivers to detach before it detaches. Sibling drivers query the PF4 driver during their attach routine to see if it is attached. If not, the sibling drivers defer their attach actions until the PF4 driver informs them it is attached. VF devices are associated with a single port on the NIC. VF devices created from PF0 are associated with the first port on the NIC, VFs from PF1 are associated with the second port, etc. VF devices can only be created from a PF device that has an associated port. Thus, on a 2-port card, VFs are only supported on PF0 and PF1. Reviewed by: np (earlier versions) MFC after: 1 month Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/t4_if.m (contents, props changed) head/sys/dev/cxgbe/t4_iov.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/t4_main.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Jul 22 21:52:07 2016 (r303204) +++ head/sys/conf/files Fri Jul 22 22:46:41 2016 (r303205) @@ -1243,6 +1243,8 @@ dev/cxgb/sys/uipc_mvec.c optional cxgb p compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \ compile-with "${NORMAL_C} -I$S/dev/cxgb" +dev/cxgbe/t4_iov.c optional cxgbe pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_mp_ring.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_main.c optional cxgbe pci \ Added: head/sys/dev/cxgbe/t4_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_if.m Fri Jul 22 22:46:41 2016 (r303205) @@ -0,0 +1,65 @@ +#- +# Copyright (c) 2015-2016 Chelsio Communications, Inc. +# All rights reserved. +# Written by: John Baldwin +# +# 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$ +# + +#include + +INTERFACE t4; + +# The "main" device of a T4/T5 NIC is the PF4 device. Drivers for other +# functions on the NIC need to wait for the main device to be initialized +# before finishing attach. These routines allow drivers for other devices +# to coordinate with the main driver for the PF4. + +# Called by a driver during attach to determine if the PF4 driver is +# initialized. If the main driver is not ready, the driver should defer +# further initialization until 'attach_child'. +METHOD int is_main_ready { + device_t dev; +}; + +# Called by the PF4 driver on each sibling device when the PF4 driver is +# initialized. +METHOD int attach_child { + device_t dev; +}; + +# Called by the PF4 driver on each sibling device when the PF4 driver is +# preparing to detach. +METHOD int detach_child { + device_t dev; +}; + +# Called by a driver to query the PF4 driver for the unit number to use +# for a given port. If the port is not enabled on the adapter, this +# will fail. +METHOD int read_port_unit { + device_t dev; + int port; + int *unit; +}; Added: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_iov.c Fri Jul 22 22:46:41 2016 (r303205) @@ -0,0 +1,289 @@ +/*- + * Copyright (c) 2015-2016 Chelsio Communications, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * 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 +#include +#include + +#ifdef PCI_IOV +#include +#include +#include +#endif + +#include "t4_if.h" + +struct t4iov_softc { + device_t sc_dev; + device_t sc_main; + bool sc_attached; +}; + +struct { + uint16_t device; + char *desc; +} t4iov_pciids[] = { + {0x4000, "Chelsio T440-dbg"}, + {0x4001, "Chelsio T420-CR"}, + {0x4002, "Chelsio T422-CR"}, + {0x4003, "Chelsio T440-CR"}, + {0x4004, "Chelsio T420-BCH"}, + {0x4005, "Chelsio T440-BCH"}, + {0x4006, "Chelsio T440-CH"}, + {0x4007, "Chelsio T420-SO"}, + {0x4008, "Chelsio T420-CX"}, + {0x4009, "Chelsio T420-BT"}, + {0x400a, "Chelsio T404-BT"}, + {0x400e, "Chelsio T440-LP-CR"}, +}, t5iov_pciids[] = { + {0x5000, "Chelsio T580-dbg"}, + {0x5001, "Chelsio T520-CR"}, /* 2 x 10G */ + {0x5002, "Chelsio T522-CR"}, /* 2 x 10G, 2 X 1G */ + {0x5003, "Chelsio T540-CR"}, /* 4 x 10G */ + {0x5007, "Chelsio T520-SO"}, /* 2 x 10G, nomem */ + {0x5009, "Chelsio T520-BT"}, /* 2 x 10GBaseT */ + {0x500a, "Chelsio T504-BT"}, /* 4 x 1G */ + {0x500d, "Chelsio T580-CR"}, /* 2 x 40G */ + {0x500e, "Chelsio T540-LP-CR"}, /* 4 x 10G */ + {0x5010, "Chelsio T580-LP-CR"}, /* 2 x 40G */ + {0x5011, "Chelsio T520-LL-CR"}, /* 2 x 10G */ + {0x5012, "Chelsio T560-CR"}, /* 1 x 40G, 2 x 10G */ + {0x5014, "Chelsio T580-LP-SO-CR"}, /* 2 x 40G, nomem */ + {0x5015, "Chelsio T502-BT"}, /* 2 x 1G */ +#ifdef notyet + {0x5004, "Chelsio T520-BCH"}, + {0x5005, "Chelsio T540-BCH"}, + {0x5006, "Chelsio T540-CH"}, + {0x5008, "Chelsio T520-CX"}, + {0x500b, "Chelsio B520-SR"}, + {0x500c, "Chelsio B504-BT"}, + {0x500f, "Chelsio Amsterdam"}, + {0x5013, "Chelsio T580-CHR"}, +#endif +}; + +static int t4iov_attach_child(device_t dev); + +static int +t4iov_probe(device_t dev) +{ + uint16_t d; + size_t i; + + d = pci_get_device(dev); + for (i = 0; i < nitems(t4iov_pciids); i++) { + if (d == t4iov_pciids[i].device) { + device_set_desc(dev, t4iov_pciids[i].desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +static int +t5iov_probe(device_t dev) +{ + uint16_t d; + size_t i; + + d = pci_get_device(dev); + for (i = 0; i < nitems(t5iov_pciids); i++) { + if (d == t5iov_pciids[i].device) { + device_set_desc(dev, t5iov_pciids[i].desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +static int +t4iov_attach(device_t dev) +{ + struct t4iov_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + sc->sc_main = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev), + pci_get_slot(dev), 4); + if (T4_IS_MAIN_READY(sc->sc_main) == 0) + return (t4iov_attach_child(dev)); + return (0); +} + +static int +t4iov_attach_child(device_t dev) +{ + struct t4iov_softc *sc; +#ifdef PCI_IOV + nvlist_t *pf_schema, *vf_schema; +#endif + int error, unit; + + sc = device_get_softc(dev); + MPASS(!sc->sc_attached); + + /* + * PF0-3 are associated with a specific port on the NIC (PF0 + * with port 0, etc.). Ask the PF4 driver for the unit number + * for this function's associated port to determine if the port + * is present. + */ + error = T4_READ_PORT_UNIT(sc->sc_main, pci_get_function(dev), &unit); + if (error) + return (0); + +#ifdef PCI_IOV + pf_schema = pci_iov_schema_alloc_node(); + vf_schema = pci_iov_schema_alloc_node(); + error = pci_iov_attach(dev, pf_schema, vf_schema); + if (error) { + device_printf(dev, "Failed to initialize SR-IOV: %d\n", error); + return (0); + } +#endif + + sc->sc_attached = true; + return (0); +} + +static int +t4iov_detach_child(device_t dev) +{ + struct t4iov_softc *sc; +#ifdef PCI_IOV + int error; +#endif + + sc = device_get_softc(dev); + if (!sc->sc_attached) + return (0); + +#ifdef PCI_IOV + error = pci_iov_detach(dev); + if (error != 0) { + device_printf(dev, "Failed to disable SR-IOV\n"); + return (error); + } +#endif + + sc->sc_attached = false; + return (0); +} + +static int +t4iov_detach(device_t dev) +{ + struct t4iov_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_attached) + return (t4iov_detach_child(dev)); + return (0); +} + +#ifdef PCI_IOV +static int +t4iov_iov_init(device_t dev, uint16_t num_vfs, const struct nvlist *config) +{ + + /* XXX: The Linux driver sets up a vf_monitor task on T4 adapters. */ + return (0); +} + +static void +t4iov_iov_uninit(device_t dev) +{ +} + +static int +t4iov_add_vf(device_t dev, uint16_t vfnum, const struct nvlist *config) +{ + + return (0); +} +#endif + +static device_method_t t4iov_methods[] = { + DEVMETHOD(device_probe, t4iov_probe), + DEVMETHOD(device_attach, t4iov_attach), + DEVMETHOD(device_detach, t4iov_detach), + +#ifdef PCI_IOV + DEVMETHOD(pci_iov_init, t4iov_iov_init), + DEVMETHOD(pci_iov_uninit, t4iov_iov_uninit), + DEVMETHOD(pci_iov_add_vf, t4iov_add_vf), +#endif + + DEVMETHOD(t4_attach_child, t4iov_attach_child), + DEVMETHOD(t4_detach_child, t4iov_detach_child), + + DEVMETHOD_END +}; + +static driver_t t4iov_driver = { + "t4iov", + t4iov_methods, + sizeof(struct t4iov_softc) +}; + +static device_method_t t5iov_methods[] = { + DEVMETHOD(device_probe, t5iov_probe), + DEVMETHOD(device_attach, t4iov_attach), + DEVMETHOD(device_detach, t4iov_detach), + +#ifdef PCI_IOV + DEVMETHOD(pci_iov_init, t4iov_iov_init), + DEVMETHOD(pci_iov_uninit, t4iov_iov_uninit), + DEVMETHOD(pci_iov_add_vf, t4iov_add_vf), +#endif + + DEVMETHOD(t4_attach_child, t4iov_attach_child), + DEVMETHOD(t4_detach_child, t4iov_detach_child), + + DEVMETHOD_END +}; + +static driver_t t5iov_driver = { + "t5iov", + t5iov_methods, + sizeof(struct t4iov_softc) +}; + +static devclass_t t4iov_devclass, t5iov_devclass; + +DRIVER_MODULE(t4iov, pci, t4iov_driver, t4iov_devclass, 0, 0); +MODULE_VERSION(t4iov, 1); + +DRIVER_MODULE(t5iov, pci, t5iov_driver, t5iov_devclass, 0, 0); +MODULE_VERSION(t5iov, 1); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jul 22 21:52:07 2016 (r303204) +++ head/sys/dev/cxgbe/t4_main.c Fri Jul 22 22:46:41 2016 (r303205) @@ -76,16 +76,22 @@ __FBSDID("$FreeBSD$"); #include "t4_ioctl.h" #include "t4_l2t.h" #include "t4_mp_ring.h" +#include "t4_if.h" /* T4 bus driver interface */ static int t4_probe(device_t); static int t4_attach(device_t); static int t4_detach(device_t); +static int t4_ready(device_t); +static int t4_read_port_unit(device_t, int, int *); static device_method_t t4_methods[] = { DEVMETHOD(device_probe, t4_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(t4_is_main_ready, t4_ready), + DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD_END }; static driver_t t4_driver = { @@ -147,6 +153,9 @@ static device_method_t t5_methods[] = { DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), + DEVMETHOD(t4_is_main_ready, t4_ready), + DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD_END }; static driver_t t5_driver = { @@ -533,6 +542,7 @@ static int set_sched_queue(struct adapte static int toe_capability(struct vi_info *, int); #endif static int mod_event(module_t, int, void *); +static int notify_siblings(device_t, int); struct { uint16_t device; @@ -1062,6 +1072,8 @@ t4_attach(device_t dev) t4_set_desc(sc); + notify_siblings(dev, 0); + done: if (rc != 0 && sc->cdev) { /* cdev was created and so cxgbetool works; recover that way. */ @@ -1078,6 +1090,57 @@ done: return (rc); } +static int +t4_ready(device_t dev) +{ + struct adapter *sc; + + sc = device_get_softc(dev); + if (sc->flags & FW_OK) + return (0); + return (ENXIO); +} + +static int +t4_read_port_unit(device_t dev, int port, int *unit) +{ + struct adapter *sc; + struct port_info *pi; + + sc = device_get_softc(dev); + if (port < 0 || port >= MAX_NPORTS) + return (EINVAL); + pi = sc->port[port]; + if (pi == NULL || pi->dev == NULL) + return (ENXIO); + *unit = device_get_unit(pi->dev); + return (0); +} + +static int +notify_siblings(device_t dev, int detaching) +{ + device_t sibling; + int error, i; + + error = 0; + for (i = 0; i < PCI_FUNCMAX; i++) { + if (i == pci_get_function(dev)) + continue; + sibling = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev), + pci_get_slot(dev), i); + if (sibling == NULL || !device_is_attached(sibling)) + continue; + if (detaching) + error = T4_DETACH_CHILD(sibling); + else + (void)T4_ATTACH_CHILD(sibling); + if (error) + break; + } + return (error); +} + /* * Idempotent */ @@ -1090,6 +1153,13 @@ t4_detach(device_t dev) sc = device_get_softc(dev); + rc = notify_siblings(dev, 1); + if (rc) { + device_printf(dev, + "failed to detach sibling devices: %d\n", rc); + return (rc); + } + if (sc->flags & FULL_INIT_DONE) t4_intr_disable(sc); Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Jul 22 21:52:07 2016 (r303204) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Jul 22 22:46:41 2016 (r303205) @@ -13,8 +13,10 @@ SRCS+= opt_inet.h SRCS+= opt_inet6.h SRCS+= opt_ofed.h SRCS+= opt_rss.h -SRCS+= pci_if.h +SRCS+= pci_if.h pci_iov_if.h +SRCS+= t4_if.c t4_if.h SRCS+= t4_hw.c +SRCS+= t4_iov.c SRCS+= t4_l2t.c SRCS+= t4_main.c SRCS+= t4_mp_ring.c From owner-svn-src-head@freebsd.org Fri Jul 22 23:22: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 747BCBA17AF; Fri, 22 Jul 2016 23:22:23 +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 4E7F719AD; Fri, 22 Jul 2016 23:22:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EA7A8B946; Fri, 22 Jul 2016 19:22:21 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303205 - in head/sys: conf dev/cxgbe modules/cxgbe/if_cxgbe Date: Fri, 22 Jul 2016 16:15:37 -0700 Message-ID: <8075415.uQxp9geTMj@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201607222246.u6MMkfQh021096@repo.freebsd.org> References: <201607222246.u6MMkfQh021096@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 22 Jul 2016 19:22:22 -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: Fri, 22 Jul 2016 23:22:23 -0000 On Friday, July 22, 2016 10:46:41 PM John Baldwin wrote: > Author: jhb > Date: Fri Jul 22 22:46:41 2016 > New Revision: 303205 > URL: https://svnweb.freebsd.org/changeset/base/303205 > > Log: > Add a driver to create VF devices on Chelsio T4/T5 NICs. > > Chelsio NICs are a bit unique compared to some other NICs in that they > expose different functionality on different physical functions. In > particular, PF4 is used to manage the NIC interfaces ('t4nex' and 't5nex'). > However, PF4 is not able to create VF devices. Instead, VFs are only > supported by physical functions 0 through 3. This commit adds 't4iov' > and 't5iov' drivers that attach to PF0-3. > > One extra wrinkle is that the iov devices cannot enable SR-IOV until the > firwmare has been initialized by the main PF4 driver. To handle this > case, a new t4_if kobj interface has been added to permit cross-calls > between the PF drivers. The PF4 driver notifies sibling drivers when it > is fully attached. It also requests sibling drivers to detach before it > detaches. Sibling drivers query the PF4 driver during their attach > routine to see if it is attached. If not, the sibling drivers defer > their attach actions until the PF4 driver informs them it is attached. > > VF devices are associated with a single port on the NIC. VF devices > created from PF0 are associated with the first port on the NIC, VFs > from PF1 are associated with the second port, etc. VF devices can > only be created from a PF device that has an associated port. Thus, > on a 2-port card, VFs are only supported on PF0 and PF1. > > Reviewed by: np (earlier versions) > MFC after: 1 month > Sponsored by: Chelsio Communications Note that this only permits the creation of VFs, it does not include a driver for these VFs. I have a mostly working driver, but it is against an older HEAD and has to be rebased. In addition, Linux VF drivers will not work without some hacks to the FreeBSD cxgbe/cxl driver because the Linux VF driver only wants page-sized buffers whereas the FreeBSD drivers use 2k buffers (since that is an mbuf cluster). -- John Baldwin From owner-svn-src-head@freebsd.org Fri Jul 22 23:31: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 8A0C0BA18E3; Fri, 22 Jul 2016 23:31:29 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-31.csi.cam.ac.uk (ppsw-31.csi.cam.ac.uk [131.111.8.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54BDF1CFA; Fri, 22 Jul 2016 23:31:28 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from xc1.bsdpad.com ([195.154.136.64]:42209) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1bQjuf-000Qef-K4 (Exim 4.86_36-e07b163) (return-path ); Sat, 23 Jul 2016 00:31:25 +0100 Date: Sat, 23 Jul 2016 00:29:36 +0100 From: Ruslan Bukin To: Ngie Cooper Cc: Bruce Evans , John Baldwin , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303188 - head/share/mk Message-ID: <20160722232936.GA2631@bsdpad.com> References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> <20160723073428.K1265@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 22 Jul 2016 23:31:29 -0000 On Fri, Jul 22, 2016 at 03:20:51PM -0700, Ngie Cooper wrote: > On Fri, Jul 22, 2016 at 2:57 PM, Bruce Evans wrote: > ... > >>> +# GCC 6.1.0 > >>> +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 > >>> +CWARNFLAGS+= -Wno-error=unused-const-variable= > >>> -Wno-error=nonnull-compare -Wno-error=shift-negative-value > >>> -Wno-error=misleading-indentation -Wno-error=tautological-compare > >>> +.endif > >> > >> > >> Extra trailing = in the first one as well? > > > > I don't see one. I see only unreadably long lines containing unreadably > > unordered flags. Perhaps your mail client mangled the line splitting, > > but the above quite displays OK in mutt and vi here (except mutt makes > > the line wrapping especially ugly by highlighting it). > > Look for "-Wno-error=unused-const-variable=". I copy-pasted this from compiler error message: /home/rb743/dev/freebsd-riscv/lib/libc/isc/ev_timers.c:23:19: error: 'rcsid' defined but not used [-Werror=unused-const-variable=] static const char rcsid[] = "$Id: ev_timers.c,v 1.6 2005/04/27 04:56:36 sra Exp $"; I am not sure yet why compiler set extra trailing = for some errors only Ruslan From owner-svn-src-head@freebsd.org Sat Jul 23 00:26: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 434F2BA2509; Sat, 23 Jul 2016 00:26:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id AEC50171C; Sat, 23 Jul 2016 00:25:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-149.carlnfd1.nsw.optusnet.com.au [110.21.100.149]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id D12583C554B; Sat, 23 Jul 2016 10:25:48 +1000 (AEST) Date: Sat, 23 Jul 2016 10:25:48 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ngie Cooper cc: Bruce Evans , John Baldwin , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303188 - head/share/mk In-Reply-To: Message-ID: <20160723100100.K1644@besplex.bde.org> References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> <20160723073428.K1265@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=XDAe9YG+7EcdVXYrgT+/UQ==:117 a=XDAe9YG+7EcdVXYrgT+/UQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=khO1dhh0rlZb77YnPP0A: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: Sat, 23 Jul 2016 00:26:00 -0000 On Fri, 22 Jul 2016, Ngie Cooper wrote: > On Fri, Jul 22, 2016 at 2:57 PM, Bruce Evans wrote: > ... >>>> +# GCC 6.1.0 >>>> +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60100 >>>> +CWARNFLAGS+= -Wno-error=unused-const-variable= >>>> -Wno-error=nonnull-compare -Wno-error=shift-negative-value >>>> -Wno-error=misleading-indentation -Wno-error=tautological-compare >>>> +.endif >>> >>> >>> Extra trailing = in the first one as well? >> >> I don't see one. I see only unreadably long lines containing unreadably >> unordered flags. Perhaps your mail client mangled the line splitting, >> but the above quite displays OK in mutt and vi here (except mutt makes >> the line wrapping especially ugly by highlighting it). > > Look for "-Wno-error=unused-const-variable=". It is not trailing :-). It is only trailing in the above quote and apparently in the mail as seen by jhb because some mail programs mangle the formatting worse than others. In the above quote as seen by me in EDITOR=vi, the long line is split and each part is quoted. But in the previous quote, the line wasn't split. Since it was unreadable by me, I used the editor search function to check if it had a trailing '=' using a regexp, and none was found. The corresponding line for gcc 5.2.0 in bsd.sys.mk has the same quality. The '='s in the correct part of the syntax are not very good either. I think they break our policy that all warnings are fatal unless NO_WERROR is set. Already clang allows too many things to compile without even warnings. I think this allows them to compile with gcc's stricter warnings, but only with newer gcc's. NO_WERROR is too global, but is at least easy to understand. Bruce From owner-svn-src-head@freebsd.org Sat Jul 23 01:21: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 7F34ABA2F97; Sat, 23 Jul 2016 01:21:59 +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 5A9BA1228; Sat, 23 Jul 2016 01:21:59 +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 u6N1LwmF077832; Sat, 23 Jul 2016 01:21:58 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N1LwA8077831; Sat, 23 Jul 2016 01:21:58 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607230121.u6N1LwA8077831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 23 Jul 2016 01:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303208 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 01:21:59 -0000 Author: ache Date: Sat Jul 23 01:21:58 2016 New Revision: 303208 URL: https://svnweb.freebsd.org/changeset/base/303208 Log: 1) We need the original pattern (in the next round of changes) not only in case it fully constructed, but for half-constructed too, so have no other choice to pass original pattern from glob() down to globextend() instead of attempt to reconstruct I implement previously. 2) Instead of copy&paste the same big enough code, make function for it: globfinal(). Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Fri Jul 22 23:13:25 2016 (r303207) +++ head/lib/libc/gen/glob.c Sat Jul 23 01:21:58 2016 (r303208) @@ -145,11 +145,12 @@ typedef uint_fast64_t Char; #define M_RNG META(L'-') #define M_SET META(L'[') #define ismeta(c) (((c)&M_QUOTE) != 0) +#ifdef DEBUG #define isprot(c) (((c)&M_PROTECT) != 0) - +#endif static int compare(const void *, const void *); -static int g_Ctoc(const Char *, char *, size_t, int); +static int g_Ctoc(const Char *, char *, size_t); static int g_lstat(Char *, struct stat *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static const Char *g_strchr(const Char *, wchar_t); @@ -157,19 +158,24 @@ static const Char *g_strchr(const Char * static Char *g_strcat(Char *, const Char *); #endif static int g_stat(Char *, struct stat *, glob_t *); -static int glob0(const Char *, glob_t *, struct glob_limit *, int); +static int glob0(const Char *, glob_t *, struct glob_limit *, + const char *); static int glob1(Char *, glob_t *, struct glob_limit *); static int glob2(Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *); static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *); -static int globextend(const Char *, glob_t *, struct glob_limit *, int); +static int globextend(const Char *, glob_t *, struct glob_limit *, + const char *); static const Char * globtilde(const Char *, Char *, size_t, glob_t *); -static int globexp0(const Char *, glob_t *, struct glob_limit *); +static int globexp0(const Char *, glob_t *, struct glob_limit *, + const char *); static int globexp1(const Char *, glob_t *, struct glob_limit *); static int globexp2(const Char *, const Char *, glob_t *, struct glob_limit *); +static int globfinal(glob_t *, struct glob_limit *, size_t, + const char *); static int match(Char *, Char *, Char *); #ifdef DEBUG static void qprintf(const char *, Char *); @@ -247,14 +253,14 @@ glob(const char * __restrict pattern, in *bufnext = EOS; if (flags & GLOB_BRACE) - return (globexp0(patbuf, pglob, &limit)); + return (globexp0(patbuf, pglob, &limit, pattern)); else - return (glob0(patbuf, pglob, &limit, 1)); + return (glob0(patbuf, pglob, &limit, pattern)); } static int -globexp0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) -{ +globexp0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, + const char *origpat) { int rv; size_t oldpathc; @@ -265,31 +271,15 @@ globexp0(const Char *pattern, glob_t *pg errno = 0; return (GLOB_NOSPACE); } - return (glob0(pattern, pglob, limit, 1)); + return (glob0(pattern, pglob, limit, origpat)); } oldpathc = pglob->gl_pathc; if ((rv = globexp1(pattern, pglob, limit)) != 0) return rv; - /* - * If there was no match we are going to append the pattern - * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified - * and the pattern did not contain any magic characters - * GLOB_NOMAGIC is there just for compatibility with csh. - */ - if (pglob->gl_pathc == oldpathc) { - if (((pglob->gl_flags & GLOB_NOCHECK) || - ((pglob->gl_flags & GLOB_NOMAGIC) && - !(pglob->gl_flags & GLOB_MAGCHAR)))) - return (globextend(pattern, pglob, limit, 1)); - else - return (GLOB_NOMATCH); - } - if (!(pglob->gl_flags & GLOB_NOSORT)) - qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, - pglob->gl_pathc - oldpathc, sizeof(char *), compare); - return (0); + + return (globfinal(pglob, limit, oldpathc, origpat)); } /* @@ -311,7 +301,7 @@ globexp1(const Char *pattern, glob_t *pg return (globexp2(ptr, pattern, pglob, limit)); } - return (glob0(pattern, pglob, limit, 0)); + return (glob0(pattern, pglob, limit, NULL)); } @@ -359,7 +349,7 @@ globexp2(const Char *ptr, const Char *pa /* Non matching braces; just glob the pattern */ if (i != 0 || *pe == EOS) - return (glob0(pattern, pglob, limit, 0)); + return (glob0(pattern, pglob, limit, NULL)); for (i = 0, pl = pm = ptr; pm <= pe; pm++) switch (*pm) { @@ -475,7 +465,7 @@ globtilde(const Char *pattern, Char *pat /* * Expand a ~user */ - if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf), 0)) + if (g_Ctoc(patbuf, (char *)wbuf, sizeof(wbuf))) return (NULL); if ((pwd = getpwnam((char *)wbuf)) == NULL) return (pattern); @@ -538,8 +528,7 @@ globtilde(const Char *pattern, Char *pat */ static int glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, - int final) -{ + const char *origpat) { const Char *qpatnext; int err; size_t oldpathc; @@ -608,25 +597,33 @@ glob0(const Char *pattern, glob_t *pglob if ((err = glob1(patbuf, pglob, limit)) != 0) return(err); - if (final) { - /* - * If there was no match we are going to append the pattern - * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified - * and the pattern did not contain any magic characters - * GLOB_NOMAGIC is there just for compatibility with csh. - */ - if (pglob->gl_pathc == oldpathc) { - if (((pglob->gl_flags & GLOB_NOCHECK) || - ((pglob->gl_flags & GLOB_NOMAGIC) && - !(pglob->gl_flags & GLOB_MAGCHAR)))) - return (globextend(pattern, pglob, limit, 1)); - else - return (GLOB_NOMATCH); - } - if (!(pglob->gl_flags & GLOB_NOSORT)) - qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, - pglob->gl_pathc - oldpathc, sizeof(char *), compare); + if (origpat != NULL) + return (globfinal(pglob, limit, oldpathc, origpat)); + + return (0); +} + +static int +globfinal(glob_t *pglob, struct glob_limit *limit, size_t oldpathc, + const char *origpat) { + /* + * If there was no match we are going to append the origpat + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the origpat did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ + if (pglob->gl_pathc == oldpathc) { + if (origpat != NULL && ((pglob->gl_flags & GLOB_NOCHECK) || + ((pglob->gl_flags & GLOB_NOMAGIC) && + !(pglob->gl_flags & GLOB_MAGCHAR)))) + return (globextend(NULL, pglob, limit, origpat)); + else + return (GLOB_NOMATCH); } + if (!(pglob->gl_flags & GLOB_NOSORT)) + qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, + pglob->gl_pathc - oldpathc, sizeof(char *), compare); + return (0); } @@ -690,7 +687,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend = EOS; } ++pglob->gl_matchc; - return (globextend(pathbuf, pglob, limit, 0)); + return (globextend(pathbuf, pglob, limit, NULL)); } /* Find end of next segment, copy tentatively to pathend. */ @@ -741,7 +738,7 @@ glob3(Char *pathbuf, Char *pathend, Char } *pathend = EOS; if (pglob->gl_errfunc != NULL && - g_Ctoc(pathbuf, buf, sizeof(buf), 0)) { + g_Ctoc(pathbuf, buf, sizeof(buf))) { errno = 0; return (GLOB_NOSPACE); } @@ -847,7 +844,7 @@ glob3(Char *pathbuf, Char *pathend, Char */ static int globextend(const Char *path, glob_t *pglob, struct glob_limit *limit, - int prot) + const char *origpat) { char **pathv; size_t i, newsize, len; @@ -874,17 +871,21 @@ globextend(const Char *path, glob_t *pgl } pglob->gl_pathv = pathv; - for (p = path; *p++ != EOS;) - continue; - len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ - if (prot) - len += (size_t)(p - path) - 1; - if ((copy = malloc(len)) != NULL) { - if (g_Ctoc(path, copy, len, prot)) { - free(copy); - errno = 0; - return (GLOB_NOSPACE); + if (origpat != NULL) + copy = strdup(origpat); + else { + for (p = path; *p++ != EOS;) + continue; + len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ + if ((copy = malloc(len)) != NULL) { + if (g_Ctoc(path, copy, len)) { + free(copy); + errno = 0; + return (GLOB_NOSPACE); + } } + } + if (copy != NULL) { limit->l_string_cnt += strlen(copy) + 1; if ((pglob->gl_flags & GLOB_LIMIT) && limit->l_string_cnt >= GLOB_LIMIT_STRING) { @@ -981,7 +982,7 @@ g_opendir(Char *str, glob_t *pglob) if (*str == EOS) strcpy(buf, "."); else { - if (g_Ctoc(str, buf, sizeof(buf), 0)) { + if (g_Ctoc(str, buf, sizeof(buf))) { errno = ENAMETOOLONG; return (NULL); } @@ -998,7 +999,7 @@ g_lstat(Char *fn, struct stat *sb, glob_ { char buf[MAXPATHLEN + MB_LEN_MAX - 1]; - if (g_Ctoc(fn, buf, sizeof(buf), 0)) { + if (g_Ctoc(fn, buf, sizeof(buf))) { errno = ENAMETOOLONG; return (-1); } @@ -1012,7 +1013,7 @@ g_stat(Char *fn, struct stat *sb, glob_t { char buf[MAXPATHLEN + MB_LEN_MAX - 1]; - if (g_Ctoc(fn, buf, sizeof(buf), 0)) { + if (g_Ctoc(fn, buf, sizeof(buf))) { errno = ENAMETOOLONG; return (-1); } @@ -1033,31 +1034,23 @@ g_strchr(const Char *str, wchar_t ch) } static int -g_Ctoc(const Char *str, char *buf, size_t len, int prot) +g_Ctoc(const Char *str, char *buf, size_t len) { mbstate_t mbs; size_t clen; - Char Ch; - Ch = *str; memset(&mbs, 0, sizeof(mbs)); while (len >= MB_CUR_MAX) { - if (prot && isprot(Ch)) { - Ch = UNPROT(Ch); - *buf++ = '\\'; - len--; - continue; - } - clen = wcrtomb(buf, CHAR(Ch), &mbs); + clen = wcrtomb(buf, CHAR(*str), &mbs); if (clen == (size_t)-1) { /* XXX See initial comment #2. */ - *buf = (char)CHAR(Ch); + *buf = (char)CHAR(*str); clen = 1; memset(&mbs, 0, sizeof(mbs)); } - if (CHAR(Ch) == EOS) + if (CHAR(*str) == EOS) return (0); - Ch = *++str; + str++; buf += clen; len -= clen; } From owner-svn-src-head@freebsd.org Sat Jul 23 01:24: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 628EDBA000F; Sat, 23 Jul 2016 01:24:43 +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 395511472; Sat, 23 Jul 2016 01:24:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id E7D7314F5; Sat, 23 Jul 2016 01:24:42 +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 926C22363A; Sat, 23 Jul 2016 01:24:42 +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 WGdVMV_FUfS8; Sat, 23 Jul 2016 01:24:39 +0000 (UTC) Subject: Re: svn commit: r303188 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 8EC5123634 To: Bruce Evans , Ngie Cooper References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> <20160723073428.K1265@besplex.bde.org> <20160723100100.K1644@besplex.bde.org> Cc: John Baldwin , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Fri, 22 Jul 2016 18:24:41 -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: <20160723100100.K1644@besplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hWg8axHEw5p9tjwWoIrq85ucH17TTiRqs" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 01:24:43 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hWg8axHEw5p9tjwWoIrq85ucH17TTiRqs Content-Type: multipart/mixed; boundary="3KrF1axrX0xGX63RMlHQPaAmMCHPOLCLf" From: Bryan Drewery To: Bruce Evans , Ngie Cooper Cc: John Baldwin , Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: Subject: Re: svn commit: r303188 - head/share/mk References: <201607221500.u6MF0c3S037470@repo.freebsd.org> <1980140.IgFQbb5iVz@ralph.baldwin.cx> <20160723073428.K1265@besplex.bde.org> <20160723100100.K1644@besplex.bde.org> In-Reply-To: <20160723100100.K1644@besplex.bde.org> --3KrF1axrX0xGX63RMlHQPaAmMCHPOLCLf Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 7/22/2016 5:25 PM, Bruce Evans wrote: > On Fri, 22 Jul 2016, Ngie Cooper wrote: >=20 >> On Fri, Jul 22, 2016 at 2:57 PM, Bruce Evans >> wrote: >> ... >>>>> +# GCC 6.1.0 >>>>> +.if ${COMPILER_TYPE} =3D=3D "gcc" && ${COMPILER_VERSION} >=3D 6010= 0 >>>>> +CWARNFLAGS+=3D -Wno-error=3Dunused-const-variable=3D >>>>> -Wno-error=3Dnonnull-compare -Wno-error=3Dshift-negative-value >>>>> -Wno-error=3Dmisleading-indentation -Wno-error=3Dtautological-compa= re >>>>> +.endif >>>> >>>> >>>> Extra trailing =3D in the first one as well? >>> >>> I don't see one. I see only unreadably long lines containing unreada= bly >>> unordered flags. Perhaps your mail client mangled the line splitting= , >>> but the above quite displays OK in mutt and vi here (except mutt make= s >>> the line wrapping especially ugly by highlighting it). >> >> Look for "-Wno-error=3Dunused-const-variable=3D". >=20 > It is not trailing :-). It is only trailing in the above quote and > apparently in the mail as seen by jhb because some mail programs mangle= > the formatting worse than others. In the above quote as seen by me > in EDITOR=3Dvi, the long line is split and each part is quoted. But in= > the previous quote, the line wasn't split. Since it was unreadable > by me, I used the editor search function to check if it had a trailing > '=3D' using a regexp, and none was found. It's not a mail issue. It is in the actual file. See https://svnweb.freebsd.org/base/head/share/mk/bsd.sys.mk?r1=3D303188&r2=3D= 303187&pathrev=3D303188 and https://svnweb.freebsd.org/base/head/share/mk/bsd.sys.mk?revision=3D30318= 8&view=3Dmarkup&pathrev=3D303188#l119 Specifically "-Wno-error=3Dunused-const-variable=3D", the first value. --=20 Regards, Bryan Drewery --3KrF1axrX0xGX63RMlHQPaAmMCHPOLCLf-- --hWg8axHEw5p9tjwWoIrq85ucH17TTiRqs 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 iQEcBAEBAgAGBQJXksdZAAoJEDXXcbtuRpfPnYkIANN/gpwkavD5NUHntyP7F1DW e9r3K8caZkOulpN0MYVdlHe6NP1K5ktLS/JDrM/4+iByNAuBIYI9BxCfbtGP8UVA Qm1a0Zj+VGtK0AVm1P4fAz6i0ZZG5FNdeOf4vDDMNH+/We9y79kLlIhDHLWRM9T8 5fKQbIiIRDQOIbV1ZJ9NNdImbG931hSkA/dFQSDpUckNykIbK9pLGdP/NyHeGJ5Y J6y/dJThxEMZjcXuODL/tFoxUmQ8t4fFb/L+baZ1cSu1Bb4jL8R3jWaGKvo+l4EM uQkM4fGZ+hg5YKy8tfzomIBooo+PwLXnhgq6EiGmVKYmIoVnHhhgFTU31j0gE9o= =UudZ -----END PGP SIGNATURE----- --hWg8axHEw5p9tjwWoIrq85ucH17TTiRqs-- From owner-svn-src-head@freebsd.org Sat Jul 23 02:27: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 5E27EBA0CFC; Sat, 23 Jul 2016 02:27:43 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D071B84; Sat, 23 Jul 2016 02:27:43 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6N2Rga3002224; Sat, 23 Jul 2016 02:27:42 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N2Rgiw002223; Sat, 23 Jul 2016 02:27:42 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201607230227.u6N2Rgiw002223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 23 Jul 2016 02:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303209 - head/sys/powerpc/booke X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 02:27:43 -0000 Author: jhibbits Date: Sat Jul 23 02:27:42 2016 New Revision: 303209 URL: https://svnweb.freebsd.org/changeset/base/303209 Log: Use label math instead of hard-coding offsets for return addresses. Though the chances of the code in these sections changing are low, future-proof the sections and use label math. Renumber the surrounding areas to avoid duplicate label numbers. Modified: head/sys/powerpc/booke/locore.S Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Sat Jul 23 01:21:58 2016 (r303208) +++ head/sys/powerpc/booke/locore.S Sat Jul 23 02:27:42 2016 (r303209) @@ -171,7 +171,7 @@ __start: ori %r3, %r3, (PSL_IS | PSL_DS) bl 2f 2: mflr %r4 - addi %r4, %r4, 20 + addi %r4, %r4, (3f - 2b) mtspr SPR_SRR0, %r4 mtspr SPR_SRR1, %r3 rfi /* Switch context */ @@ -179,6 +179,7 @@ __start: /* * Invalidate initial entry */ +3: mr %r3, %r29 bl tlb1_inval_entry @@ -224,7 +225,7 @@ __start: rlwinm %r4, %r4, 0, 8, 31 /* Current offset from kernel load address */ rlwinm %r3, %r3, 0, 0, 19 add %r4, %r4, %r3 /* Convert to kernel virtual address */ - addi %r4, %r4, 36 + addi %r4, %r4, (5f - 4b) li %r3, PSL_DE /* Note AS=0 */ mtspr SPR_SRR0, %r4 mtspr SPR_SRR1, %r3 @@ -233,6 +234,7 @@ __start: /* * Invalidate temp mapping */ +5: mr %r3, %r28 bl tlb1_inval_entry @@ -362,7 +364,7 @@ bp_kernload: ori %r3, %r3, (PSL_IS | PSL_DS) bl 3f 3: mflr %r4 - addi %r4, %r4, 20 + addi %r4, %r4, (4f - 3b) mtspr SPR_SRR0, %r4 mtspr SPR_SRR1, %r3 rfi /* Switch context */ @@ -370,6 +372,7 @@ bp_kernload: /* * Invalidate initial entry */ +4: mr %r3, %r29 bl tlb1_inval_entry @@ -395,10 +398,10 @@ bp_kernload: isync /* Retrieve kernel load [physical] address from bp_kernload */ - bl 4f + bl 5f .long bp_kernload .long __boot_page -4: mflr %r3 +5: mflr %r3 lwz %r4, 0(%r3) lwz %r5, 4(%r3) rlwinm %r3, %r3, 0, 0, 19 @@ -414,15 +417,16 @@ bp_kernload: msync /* Switch to the final mapping */ - bl 5f -5: mflr %r3 + bl 6f +6: mflr %r3 rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */ add %r3, %r3, %r5 /* Make this virtual address */ - addi %r3, %r3, 32 + addi %r3, %r3, (7f - 6b) li %r4, 0 /* Note AS=0 */ mtspr SPR_SRR0, %r3 mtspr SPR_SRR1, %r4 rfi +7: /* * At this point we're running at virtual addresses KERNBASE and beyond so From owner-svn-src-head@freebsd.org Sat Jul 23 03:28: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 F3B68BA263E; Sat, 23 Jul 2016 03:28:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id BAE8D16AC; Sat, 23 Jul 2016 03:28:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c110-21-100-149.carlnfd1.nsw.optusnet.com.au [110.21.100.149]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id EC56078139C; Sat, 23 Jul 2016 13:28:01 +1000 (AEST) Date: Sat, 23 Jul 2016 13:28:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303209 - head/sys/powerpc/booke In-Reply-To: <201607230227.u6N2Rgiw002223@repo.freebsd.org> Message-ID: <20160723130540.Q2164@besplex.bde.org> References: <201607230227.u6N2Rgiw002223@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=VIkg5I7X c=1 sm=1 tr=0 a=XDAe9YG+7EcdVXYrgT+/UQ==:117 a=XDAe9YG+7EcdVXYrgT+/UQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=HFGmMxYJA0FTgHnMFwcA: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: Sat, 23 Jul 2016 03:28:07 -0000 On Sat, 23 Jul 2016, Justin Hibbits wrote: > Log: > Use label math instead of hard-coding offsets for return addresses. > > Though the chances of the code in these sections changing are low, future-proof > the sections and use label math. Not with numeric labels. > Renumber the surrounding areas to avoid duplicate label numbers. New numeric labels tend to move the addresses of old labels. Renumbering to give unique numeric labels more than defeats their reason for existence -- you have to manage them on every change to a label anywhere in the file (and perhaps in macros and included files). You never get a error for a duplicated numeric label. Non-unique numeric labels are also a good obfuscation. Given a branch to 1f or 1b, grepping the file for 1: may find many labels 1:. You have to examine all the labels named 1: or search only near the jump to see where 1 is. Its name is supposed to not matter, but perhaps it does. Numeric labels should only be used in macros, and then only when the macro processor is too feeble to support generating unique non-numeric labels. Standard cpp is too feeble for this. I managed to remove all numeric labels in i386/exception.s (except in macros and included files), and none came back. amd64/exception.S has 19 of them, 7 with the additional style bug of being on a line with a statement or comment. Bruce From owner-svn-src-head@freebsd.org Sat Jul 23 03:49: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 D571ABA28BE; Sat, 23 Jul 2016 03:49:03 +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 8D29C1E30; Sat, 23 Jul 2016 03:49:03 +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 u6N3n2WR032501; Sat, 23 Jul 2016 03:49:02 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N3n2VN032500; Sat, 23 Jul 2016 03:49:02 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607230349.u6N3n2VN032500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sat, 23 Jul 2016 03:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303210 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 03:49:03 -0000 Author: ache Date: Sat Jul 23 03:49:02 2016 New Revision: 303210 URL: https://svnweb.freebsd.org/changeset/base/303210 Log: 1) POSIX defines well when GLOB_NOMATCH or original pattern (instead) should be returned, so we can't return GLOB_NOMATCH blindly just because we dislike something in the pattern. 2) Remove extra condition. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sat Jul 23 02:27:42 2016 (r303209) +++ head/lib/libc/gen/glob.c Sat Jul 23 03:49:02 2016 (r303210) @@ -217,7 +217,8 @@ glob(const char * __restrict pattern, in while (bufnext <= bufend) { clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) - return (GLOB_NOMATCH); + return (globfinal(pglob, &limit, + pglob->gl_pathc, pattern)); else if (clen == 0) { too_long = 0; break; @@ -239,7 +240,8 @@ glob(const char * __restrict pattern, in prot = 0; clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs); if (clen == (size_t)-1 || clen == (size_t)-2) - return (GLOB_NOMATCH); + return (globfinal(pglob, &limit, + pglob->gl_pathc, pattern)); else if (clen == 0) { too_long = 0; break; @@ -249,7 +251,7 @@ glob(const char * __restrict pattern, in } } if (too_long) - return (GLOB_NOMATCH); + return (globfinal(pglob, &limit, pglob->gl_pathc, pattern)); *bufnext = EOS; if (flags & GLOB_BRACE) @@ -613,9 +615,9 @@ globfinal(glob_t *pglob, struct glob_lim * GLOB_NOMAGIC is there just for compatibility with csh. */ if (pglob->gl_pathc == oldpathc) { - if (origpat != NULL && ((pglob->gl_flags & GLOB_NOCHECK) || + if ((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && - !(pglob->gl_flags & GLOB_MAGCHAR)))) + !(pglob->gl_flags & GLOB_MAGCHAR))) return (globextend(NULL, pglob, limit, origpat)); else return (GLOB_NOMATCH); From owner-svn-src-head@freebsd.org Sat Jul 23 05:30: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 9A33BBA0AE7; Sat, 23 Jul 2016 05:30:56 +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 6C0011A68; Sat, 23 Jul 2016 05:30:56 +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 u6N5UtLH069561; Sat, 23 Jul 2016 05:30:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N5UtVJ069556; Sat, 23 Jul 2016 05:30:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607230530.u6N5UtVJ069556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 Jul 2016 05:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303211 - in head: share/man/man9 sys/kern 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: Sat, 23 Jul 2016 05:30:56 -0000 Author: kib Date: Sat Jul 23 05:30:55 2016 New Revision: 303211 URL: https://svnweb.freebsd.org/changeset/base/303211 Log: Implement mtx_trylock_spin(9). Discussed with: bde Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7192 Modified: head/share/man/man9/Makefile head/share/man/man9/mutex.9 head/sys/kern/kern_mutex.c head/sys/sys/mutex.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sat Jul 23 03:49:02 2016 (r303210) +++ head/share/man/man9/Makefile Sat Jul 23 05:30:55 2016 (r303211) @@ -1181,6 +1181,8 @@ MLINKS+=mutex.9 mtx_assert.9 \ mutex.9 MTX_SYSINIT.9 \ mutex.9 mtx_trylock.9 \ mutex.9 mtx_trylock_flags.9 \ + mutex.9 mtx_trylock_spin.9 \ + mutex.9 mtx_trylock_spin_flags.9 \ mutex.9 mtx_unlock.9 \ mutex.9 mtx_unlock_flags.9 \ mutex.9 mtx_unlock_spin.9 \ Modified: head/share/man/man9/mutex.9 ============================================================================== --- head/share/man/man9/mutex.9 Sat Jul 23 03:49:02 2016 (r303210) +++ head/share/man/man9/mutex.9 Sat Jul 23 05:30:55 2016 (r303211) @@ -28,7 +28,7 @@ .\" from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $ .\" $FreeBSD$ .\" -.Dd December 13, 2014 +.Dd July 18, 2016 .Dt MUTEX 9 .Os .Sh NAME @@ -41,6 +41,8 @@ .Nm mtx_lock_spin_flags , .Nm mtx_trylock , .Nm mtx_trylock_flags , +.Nm mtx_trylock_spin , +.Nm mtx_trylock_spin_flags , .Nm mtx_unlock , .Nm mtx_unlock_spin , .Nm mtx_unlock_flags , @@ -73,6 +75,10 @@ .Ft int .Fn mtx_trylock_flags "struct mtx *mutex" "int flags" .Ft void +.Fn mtx_trylock_spin "struct mtx *mutex" +.Ft int +.Fn mtx_trylock_spin_flags "struct mtx *mutex" "int flags" +.Ft void .Fn mtx_unlock "struct mtx *mutex" .Ft void .Fn mtx_unlock_spin "struct mtx *mutex" @@ -249,26 +255,33 @@ argument, then the mutex can be acquired .Pp The .Fn mtx_trylock -attempts to acquire the +and +.Fn mtx_trylock_spin +functions attempt to acquire a .Dv MTX_DEF -mutex pointed to by +or +.Dv MTX_SPIN +mutex, respectively, pointed to by .Fa mutex . -If the mutex cannot be immediately acquired -.Fn mtx_trylock -will return 0, -otherwise the mutex will be acquired -and a non-zero value will be returned. +If the mutex cannot be immediately acquired, the functions will return 0, +otherwise the mutex will be acquired and a non-zero value will be returned. .Pp The .Fn mtx_trylock_flags -function has the same behavior as +and +.Fn mtx_trylock_spin_flags +functions have the same behavior as .Fn mtx_trylock -but should be used when the caller desires to pass in a +and +.Fn mtx_trylock_spin +respectively, but should be used when the caller desires to pass in a .Fa flags value. Presently, the only valid value in the .Fn mtx_trylock -case is +and +.Fn mtx_trylock_spin +cases is .Dv MTX_QUIET , and its effects are identical to those described for .Fn mtx_lock @@ -447,6 +460,13 @@ while any spin lock is held. .It Dv MTX_RECURSE Specifies that the initialized mutex is allowed to recurse. This bit must be present if the mutex is permitted to recurse. +.Pp +Note that neither +.Fn mtx_trylock +nor +.Fn mtx_trylock_spin +support recursion; +that is, attempting to acquire an already-owned mutex fails. .It Dv MTX_QUIET Do not log any mutex operations for this lock. .It Dv MTX_NOWITNESS @@ -534,3 +554,7 @@ functions appeared in .Bsx 4.1 and .Fx 5.0 . +The +.Fn mtx_trylock_spin +function was added in +.Fx 12.0 . Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sat Jul 23 03:49:02 2016 (r303210) +++ head/sys/kern/kern_mutex.c Sat Jul 23 05:30:55 2016 (r303211) @@ -281,6 +281,34 @@ __mtx_lock_spin_flags(volatile uintptr_t WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); } +int +__mtx_trylock_spin_flags(volatile uintptr_t *c, int opts, const char *file, + int line) +{ + struct mtx *m; + + if (SCHEDULER_STOPPED()) + return (1); + + m = mtxlock2mtx(c); + + KASSERT(m->mtx_lock != MTX_DESTROYED, + ("mtx_trylock_spin() of destroyed mutex @ %s:%d", file, line)); + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin, + ("mtx_trylock_spin() of sleep mutex %s @ %s:%d", + m->lock_object.lo_name, file, line)); + KASSERT((opts & MTX_RECURSE) == 0, + ("mtx_trylock_spin: unsupp. opt MTX_RECURSE on mutex %s @ %s:%d\n", + m->lock_object.lo_name, file, line)); + if (__mtx_trylock_spin(m, curthread, opts, file, line)) { + LOCK_LOG_TRY("LOCK", &m->lock_object, opts, 1, file, line); + WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); + return (1); + } + LOCK_LOG_TRY("LOCK", &m->lock_object, opts, 0, file, line); + return (0); +} + void __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts, const char *file, int line) Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Sat Jul 23 03:49:02 2016 (r303210) +++ head/sys/sys/mutex.h Sat Jul 23 05:30:55 2016 (r303211) @@ -112,6 +112,8 @@ void __mtx_unlock_flags(volatile uintptr int line); void __mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file, int line); +int __mtx_trylock_spin_flags(volatile uintptr_t *c, int opts, + const char *file, int line); void __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) @@ -152,6 +154,8 @@ void thread_lock_flags_(struct thread *, __mtx_unlock_flags(&(m)->mtx_lock, o, f, l) #define _mtx_lock_spin_flags(m, o, f, l) \ __mtx_lock_spin_flags(&(m)->mtx_lock, o, f, l) +#define _mtx_trylock_spin_flags(m, o, f, l) \ + __mtx_trylock_spin_flags(&(m)->mtx_lock, o, f, l) #define _mtx_unlock_spin_flags(m, o, f, l) \ __mtx_unlock_spin_flags(&(m)->mtx_lock, o, f, l) #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) @@ -212,6 +216,21 @@ void thread_lock_flags_(struct thread *, LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, \ mp, 0, 0, file, line); \ } while (0) +#define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \ + uintptr_t _tid = (uintptr_t)(tid); \ + int _ret; \ + \ + spinlock_enter(); \ + if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid))) {\ + spinlock_exit(); \ + _ret = 0; \ + } else { \ + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, \ + mp, 0, 0, file, line); \ + _ret = 1; \ + } \ + _ret; \ +}) #else /* SMP */ #define __mtx_lock_spin(mp, tid, opts, file, line) do { \ uintptr_t _tid = (uintptr_t)(tid); \ @@ -224,6 +243,20 @@ void thread_lock_flags_(struct thread *, (mp)->mtx_lock = _tid; \ } \ } while (0) +#define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \ + uintptr_t _tid = (uintptr_t)(tid); \ + int _ret; \ + \ + spinlock_enter(); \ + if ((mp)->mtx_lock != MTX_UNOWNED) { \ + spinlock_exit(); \ + _ret = 0; \ + } else { \ + (mp)->mtx_lock = _tid; \ + _ret = 1; \ + } \ + _ret; \ +}) #endif /* SMP */ /* Unlock a normal mutex. */ @@ -293,6 +326,10 @@ void thread_lock_flags_(struct thread *, * mtx_trylock_flags(m, opts) is used the same way as mtx_trylock() but accepts * relevant option flags `opts.' * + * mtx_trylock_spin(m) attempts to acquire MTX_SPIN mutex `m' but doesn't + * spin if it cannot. Rather, it returns 0 on failure and non-zero on + * success. It always returns failure for recursed lock attempts. + * * mtx_initialized(m) returns non-zero if the lock `m' has been initialized. * * mtx_owned(m) returns non-zero if the current thread owns the lock `m' @@ -302,6 +339,7 @@ void thread_lock_flags_(struct thread *, #define mtx_lock(m) mtx_lock_flags((m), 0) #define mtx_lock_spin(m) mtx_lock_spin_flags((m), 0) #define mtx_trylock(m) mtx_trylock_flags((m), 0) +#define mtx_trylock_spin(m) mtx_trylock_spin_flags((m), 0) #define mtx_unlock(m) mtx_unlock_flags((m), 0) #define mtx_unlock_spin(m) mtx_unlock_spin_flags((m), 0) @@ -335,6 +373,8 @@ extern struct mtx_pool *mtxpool_sleep; _mtx_unlock_flags((m), (opts), (file), (line)) #define mtx_lock_spin_flags_(m, opts, file, line) \ _mtx_lock_spin_flags((m), (opts), (file), (line)) +#define mtx_trylock_spin_flags_(m, opts, file, line) \ + _mtx_trylock_spin_flags((m), (opts), (file), (line)) #define mtx_unlock_spin_flags_(m, opts, file, line) \ _mtx_unlock_spin_flags((m), (opts), (file), (line)) #else /* LOCK_DEBUG == 0 && !MUTEX_NOINLINE */ @@ -344,6 +384,8 @@ extern struct mtx_pool *mtxpool_sleep; __mtx_unlock((m), curthread, (opts), (file), (line)) #define mtx_lock_spin_flags_(m, opts, file, line) \ __mtx_lock_spin((m), curthread, (opts), (file), (line)) +#define mtx_trylock_spin_flags_(m, opts, file, line) \ + __mtx_trylock_spin((m), curthread, (opts), (file), (line)) #define mtx_unlock_spin_flags_(m, opts, file, line) \ __mtx_unlock_spin((m)) #endif /* LOCK_DEBUG > 0 || MUTEX_NOINLINE */ @@ -369,6 +411,8 @@ extern struct mtx_pool *mtxpool_sleep; mtx_unlock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_trylock_flags(m, opts) \ mtx_trylock_flags_((m), (opts), LOCK_FILE, LOCK_LINE) +#define mtx_trylock_spin_flags(m, opts) \ + mtx_trylock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE) #define mtx_assert(m, what) \ mtx_assert_((m), (what), __FILE__, __LINE__) From owner-svn-src-head@freebsd.org Sat Jul 23 05:49: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 1B98EBA0D5E; Sat, 23 Jul 2016 05:49:20 +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 B854F119B; Sat, 23 Jul 2016 05:49:19 +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 u6N5nInD076810; Sat, 23 Jul 2016 05:49:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N5nIGm076807; Sat, 23 Jul 2016 05:49:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607230549.u6N5nIGm076807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 23 Jul 2016 05:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303212 - in head: etc/mtree tools/build/mk usr.sbin/chown/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: Sat, 23 Jul 2016 05:49:20 -0000 Author: bdrewery Date: Sat Jul 23 05:49:18 2016 New Revision: 303212 URL: https://svnweb.freebsd.org/changeset/base/303212 Log: Move chown tests to proper path Sponsored by: EMC / Isilon Storage Division Modified: head/etc/mtree/BSD.tests.dist head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/chown/tests/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sat Jul 23 05:30:55 2016 (r303211) +++ head/etc/mtree/BSD.tests.dist Sat Jul 23 05:49:18 2016 (r303212) @@ -8,8 +8,6 @@ bin cat .. - chown - .. date .. dd @@ -652,6 +650,8 @@ .. .. usr.sbin + chown + .. etcupdate .. extattr Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Jul 23 05:30:55 2016 (r303211) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Jul 23 05:49:18 2016 (r303212) @@ -7419,6 +7419,9 @@ OLD_FILES+=usr/share/aclocal/atf-c.m4 OLD_FILES+=usr/share/aclocal/atf-common.m4 OLD_FILES+=usr/share/aclocal/atf-sh.m4 OLD_DIRS+=usr/share/aclocal +OLD_DIRS+=usr/tests/bin/chown +OLD_FILES+=usr/tests/bin/chown/Kyuafile +OLD_FILES+=usr/tests/bin/chown/chown-f_test OLD_FILES+=usr/tests/bin/chown/units_basics OLD_FILES+=usr/tests/bin/date/legacy_test OLD_FILES+=usr/tests/bin/sh/legacy_test Modified: head/usr.sbin/chown/tests/Makefile ============================================================================== --- head/usr.sbin/chown/tests/Makefile Sat Jul 23 05:30:55 2016 (r303211) +++ head/usr.sbin/chown/tests/Makefile Sat Jul 23 05:49:18 2016 (r303212) @@ -2,7 +2,7 @@ .include -TESTSDIR= ${TESTSBASE}/bin/chown +TESTSDIR= ${TESTSBASE}/usr.sbin/chown TAP_TESTS_SH= chown-f_test From owner-svn-src-head@freebsd.org Sat Jul 23 06:30: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 96916BA152D; Sat, 23 Jul 2016 06:30:01 +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 59B3B130E; Sat, 23 Jul 2016 06:30:01 +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 u6N6U0Ep092039; Sat, 23 Jul 2016 06:30:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6N6U0bu092038; Sat, 23 Jul 2016 06:30:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607230630.u6N6U0bu092038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 Jul 2016 06:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303213 - head/bin/ps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 06:30:01 -0000 Author: kib Date: Sat Jul 23 06:30:00 2016 New Revision: 303213 URL: https://svnweb.freebsd.org/changeset/base/303213 Log: Addm missed required call to xo_finish() when only header is printed. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/bin/ps/ps.c Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Sat Jul 23 05:49:18 2016 (r303212) +++ head/bin/ps/ps.c Sat Jul 23 06:30:00 2016 (r303213) @@ -612,6 +612,7 @@ main(int argc, char *argv[]) if (nkept == 0) { printheader(); + xo_finish(); exit(1); } From owner-svn-src-head@freebsd.org Sat Jul 23 10:19: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 ACFE4BA1934; Sat, 23 Jul 2016 10:19:11 +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 7FC561949; Sat, 23 Jul 2016 10:19:11 +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 u6NAJAaB077921; Sat, 23 Jul 2016 10:19:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NAJAxg077919; Sat, 23 Jul 2016 10:19:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607231019.u6NAJAxg077919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Jul 2016 10:19:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303217 - 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: Sat, 23 Jul 2016 10:19:11 -0000 Author: bapt Date: Sat Jul 23 10:19:10 2016 New Revision: 303217 URL: https://svnweb.freebsd.org/changeset/base/303217 Log: Do not try to delete the home of the user if is is not a directory for example "/dev/null" PR: 211195 Submitted by: rday Reported by: eniorm MFC after: 1 day Modified: head/usr.sbin/pw/rm_r.c head/usr.sbin/pw/tests/pw_userdel.sh Modified: head/usr.sbin/pw/rm_r.c ============================================================================== --- head/usr.sbin/pw/rm_r.c Sat Jul 23 08:23:57 2016 (r303216) +++ head/usr.sbin/pw/rm_r.c Sat Jul 23 10:19:10 2016 (r303217) @@ -50,6 +50,9 @@ rm_r(int rootfd, const char *path, uid_t path++; dirfd = openat(rootfd, path, O_DIRECTORY); + if (dirfd == -1) { + return; + } d = fdopendir(dirfd); while ((e = readdir(d)) != NULL) { Modified: head/usr.sbin/pw/tests/pw_userdel.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_userdel.sh Sat Jul 23 08:23:57 2016 (r303216) +++ head/usr.sbin/pw/tests/pw_userdel.sh Sat Jul 23 10:19:10 2016 (r303217) @@ -59,9 +59,18 @@ delete_numeric_name_body() { ${PW} userdel -n 4001 } +atf_test_case home_not_a_dir +home_not_a_dir_body() { + populate_root_etc_skel + touch ${HOME}/foo + atf_check ${RPW} useradd foo -d /foo + atf_check ${RPW} userdel foo -r +} + atf_init_test_cases() { atf_add_test_case rmuser_seperate_group atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown atf_add_test_case delete_files atf_add_test_case delete_numeric_name + atf_add_test_case home_not_a_dir } From owner-svn-src-head@freebsd.org Sat Jul 23 10:45: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 08135BA17C0; Sat, 23 Jul 2016 10:45:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mail.miracle.cz (mail.miracle.cz [193.84.128.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.miracle.cz", Issuer "Miracle Group Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F8E21EE1; Sat, 23 Jul 2016 10:45:26 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from [193.84.128.50] (meloun.ad.miracle.cz [193.84.128.50]) by mail.miracle.cz (Postfix) with ESMTPSA id 5BD8A3AC9C; Sat, 23 Jul 2016 12:45:18 +0200 (CEST) Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Nathan Whitehorn , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> <57907B0F.9070204@FreeBSD.org> <9d2a224c-b787-2875-5984-a7a2354e8695@freebsd.org> From: Michal Meloun X-Enigmail-Draft-Status: N1110 Message-ID: <57934ABD.6010807@FreeBSD.org> Date: Sat, 23 Jul 2016 12:45:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <9d2a224c-b787-2875-5984-a7a2354e8695@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.miracle.cz); Sat, 23 Jul 2016 12:45:18 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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: Sat, 23 Jul 2016 10:45:27 -0000 Dne 21.07.2016 v 17:53 Nathan Whitehorn napsal(a): > > > On 07/21/16 00:34, Michal Meloun wrote: >> Dne 20.07.2016 v 17:45 Nathan Whitehorn napsal(a): >>> >>> >>> On 07/20/16 04:28, Michal Meloun wrote: >>>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>>> >>>>> >>>>> On 07/19/16 04:13, Michal Meloun wrote: >>>>>> Dne 19.07.2016 v 2:11 Nathan Whitehorn napsal(a): >>>>>> Hi Nathan, >>>>>> I’m afraid that skra is on vacation, for next 2 weeks (at >>>>>> minimum), so >>>>>> please don’t expect quick response. >>>>>> >>>>>>> Could you please describe what this change is in more detail? >>>>>> Short description is appended. >>>>>> >>>>>>> It breaks a lot of encapsulations we have worked very hard to >>>>>>> maintain, >>>>>>> moves ARM code into MI parts of the kernel, and the OFW parts >>>>>>> violate >>>>>>> IEEE 1275 (the Open Firmware standard). In particular, there is no >>>>>>> guarantee that the interrupts for a newbus (or OF) device are >>>>>>> encoded in >>>>>>> a property called "interrupts" (or, indeed, in any property at >>>>>>> all) on >>>>>>> that node and there are many, many device trees where that is >>>>>>> not the >>>>>>> case (e.g. ones with interrupt maps, as well as Apple hardware). By >>>>>>> putting that knowledge into the OF root bus device, which we >>>>>>> have tried >>>>>>> to keep it out of, this enforces a standard that doesn't >>>>>>> actually exist. >>>>>> Imho, this patch doesn’t change anything in this area. Only >>>>>> handling of >>>>>> “interrupts” property is changed, all other cases are unchanged (I >>>>>> hope). Also, INTRNG code is currently shared by ARM, ARM64 and >>>>>> MIPS. >>>>> >>>>> But "interrupts" isn't a generic part of OF. This makes it one, >>>>> incorrectly. >>>> How? Can you be little more exact ? >>> >>> Because it puts knowledge into ofwbus that expects that children at >>> arbitrary levels of nesting have interrupts defined by an >>> "interrupts" property. You could patch this through on sub-devices, >>> of course, but that's already done correctly by the existing >>> ofw_bus_map_intr() code in a much more robust way that doesn't >>> involve trying to guess how sub-buses and devices have chosen to >>> allocate resources. Why reinvent the wheel all the way through the >>> bus hierarchy? >> Nope, the code only expect that „interrupts" property is default way >> hot to get interrupt description. Any device or bus in the hierarchy >> can fill appropriate resource list, or terminate call at any level. > > "interrupts" should not be the default -- it's part of the OF bindings > for the bus and is used (notably) by simplebus. The issue of > cross-correlating RIDs is a much larger problem, however. > Can we postpone this problem while, please? > [snip] >>> >>>>>> >>>>>> The patch simply postpones reading of interrupt property to >>>>>> bus_alloc_resource() (called by consumer driver) time. >>>>>> >>>>>> Due to this, we can: >>>>>> - parse interrupt property. The interrupt driver must exist >>>>>> at this time. >>>>> >>>>> This only works with some types of interrupt properties, not all, >>>>> and breaks if the interrupt driver hasn't attached yet (which it >>>>> can't be guaranteed to -- some PPC systems have interrupt drivers >>>>> that live on the PCI bus, for example). >>>> How you can allocate (and reserve it in rman) interrupt if is not >>>> mapped (so you have not real IRQ number for it). Just for notice - >>>> multiple virtual IRQs can be mapped into single real IRQ. >>> >>> The core idea is to think of the full interrupt specifier -- the >>> interrupt parent and the full byte string in the device tree -- as >>> the IRQ rather than the interrupt pin on some chip (which is >>> usually, but not always, the first word in that byte string). The >>> "virtual" IRQ number is just a compression of that longer piece of >>> data, which usually can't fit in an rman resource. >> I understand. While this approach can works (and actually works) for >> single sourced OFW world, it immediately fails if you must be able to >> parse data from different sources (which uses different encoding) >> (OFW, UEFI / ACPI, GPIO...) within one system. > > > On PowerPC, GENERIC64 supports FDT systems (some IBM hardware), OFW > systems (Macs, some IBM hardware), systems with no device trees at all > (old-style PS3), and systems with a mixture of device tree and no > device tree (new-style PS3). On these, there is a mixture of "real" > interrupts and GPIO-type interrupts. There is no limitation that this > be used only for device-tree-type systems. > > The system requires two things: an interrupt domain key and an > arbitrary unique byte string describing the interrupt. When running > with a device tree, these are set to the phandle of the > interrupt-parent and the contents of the device tree interrupt > specifier, respectively, and the system was of course developed with > that in mind. But they don't need to be, and often aren't. You could > make the domain an element of an enum (where "ACPI" is a choice, for > instance -- this is what PS3 does), or set it to a pointer to a > device_t, or really anything you like. Similarly, the interrupt > specifier is totally free-form. Yes, I agree. and i think that we followed the same direction. But i see two problems with this approach. - in some cases (OFW, device_t) you don't have control over domain key value, so you cannot guarantee its uniqueness. Of course, probability of collision is low, but it is. - within ofw_bus_map_intr() (or later - at the time when byte string must be decoded) you are not able (easily) to differentiate between different formats, thus you are not able to select appropriate decoder. The GPIO controller, for example, must be able to handle interrupts defined by standard OFW property, or by pair concurrently. For this reason we makes domain key composite, in our model, the domain key consist of "domain key type" and "domain key value". This composite key guarantees uniqueness and it also allows to select proper parser for byte string. This is, imho, only one difference between us. > You could, for instance, set it to one of the structures introduced in > r301453 if you wanted to. > > I would have zero problems with changing the prototype of the existing > dev/ofw function to something more generic in name, like: > > bus_map_intr(device_t dev, uintptr_t iparent, size_t intrlen, void *intr) > > instead of the existing equivalent: > > ofw_bus_map_intr(device_t dev, phandle_t iparent, int icells, pcell_t > *intr) > Our bus_map_intr() method is not indeed as replacement of ofw_bus_map_intr(). Its evolution of "how we can store more complex data to resource list (from bus enumerator) and transfer it to bus_allocate_resource() and/or to bus_setup_intr()" in driver independent way. We found no reasonable way to do it, so we postponed reading of properties to bus_allocate_resource() time. But now jhb@ gives us alternative and I must say that this looks like a clean and elegant way how to make this (assuming that we can expand resource_list_entry by pointer to alloc_resource_args) >> By this, one byte string in OFW encoding can describe one IRQ and >> exactly same string in UEFI encoding can describe different IRQ. Or, >> in reverse, OFW and UEFI can describe same (and compatible) IRQ by >> two different strings. >> This is exact reason, why we discards virtual IRQ idea and I think >> that this fact is root issue of this clash. >> Probably it doesn't make sense to talk about others, unless we can >> find consensus on this. > > You have the larger problem if you end up in this situation that you > are enumerating the hardware by two different and incompatible > techniques. There simply is no way to solve this unless you either (a) > segregate the system into an ACPI-enumerated domain and an > OF-enumerated domain, in which case the problem vanishes, (b) discard > one enumeration, which is what arm64 does and will always do, > according to Andrew in another post, or (c) make some incredibly > complex merging code that would naturally handle interrupts with > everything else. So I don't think this is an actual, real problem. > I think that above proposed solution resolves this gracefully. > In circumstances where you have a nested, non-device-tree hierarchy > (e.g. OPAL on PowerNV or GPIOs or what-have-you), this kind of problem > is easily solved by inventing an extra interrupt domain. > >> >>> There is no need to actually activate those interrupts before >>> interrupts are enabled, so you can just cache them in a table until >>> the end of device probing, which lets you break circular dependency >>> loops between bus and interrupt topology. >>> >>> So long as you keep track of your mapping and the same (parent, >>> interrupt specifier) parent always gives the same virtual IRQ, there >>> is no way in this system to map multiple active IRQs onto a single >>> interrupt pin on the PIC unless your device tree is broken and >>> specifies two devices with incompatible modes (active high and edge >>> downgoing or something) on the same pin. In this case, nothing you >>> can do will save you -- unless your PIC supports interrupts for >>> different kinds of events, in which case this system will work >>> perfectly by treating them as different interrupts to the kernel for >>> which the fact they are on the same pin is immaterial. >>> >>> I should note that ARM and MIPS have an almost complete >>> implementation of this already: maybe some more intr_machdep.c logic >>> is needed for some cases, but all the rest of the plumbing is there. >>> >>>> >>>>> >>>>>> - bus_alloc_resource() returns resource, so we can attach parsed >>>>>> interrupt data to it. By this, the resource itself can be used >>>>>> for delivering configuration data to subsequent call to >>>>>> bus_setup_intr() (or to all related bus_() calls). >>>>>> >>>>>> >>>>>> The patched code still accepts delivering of interrupts in >>>>>> resource list. >>>>>> >>>>>> Michal >>>>>> >>>>> >>>>> Given that other code depends on this, fixing it will likely >>>>> require some complex work. I wish I had known about it when it >>>>> went in. >>>>> >>>>> There are three main problems: >>>>> 1. It doesn't work for interrupts defined by other mechanisms >>>>> (e.g. interrupt-map properties) >>>> I aggree, but missing ' interrupt-map' functioanlity is not caused >>>> by this patch. >>> >>> It is in that the standard system already implements it completely. >> Really? >> https://svnweb.freebsd.org/base/head/sys/dev/ofw/ofw_bus_subr.c?revision=301453&view=markup#l521 >> and >> https://svnweb.freebsd.org/base/head/sys/arm/arm/nexus.c?revision=301453&view=markup#l411 > > That function is questionable and I objected to it at the time; it is > meant only as a convenience for simplebus. More complicated cases, > like ofwpci.c, use interrupt-map and have for a very long time. > Simplebus allows interrupt-map but support has never been added, which > is a bug. One of the major problems I have with this patch is that > adding it would now require parsing all of that in two places, and > cross-correlating them with questionable chance of success, rather > than in just one. > > FreeBSD/PowerPC systems have relied on interrupt-map for ten years > now. It's not especially exotic. > >>> >>>> >>>>> 2. It partially duplicates the functionality of >>>>> OFW_BUS_MAP_INTR(), but is both problematically more general and >>>>> less flexible (it has requirements on timing of PIC attachment vs. >>>>> driver resource allocation) >>>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>>> parsed data are magicaly stored within the call. >>>> The new method, bus_map_intr(), can parse data from multiple >>>> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). >>>> It also returns parsed data back to caller. >>> >>> That is not true. It works as long as you can specify the interrupt >>> state as a 32-bit key of some kind for the PIC and a string of >>> arbitrary data, which works with all of those. You could even make >>> the interrupt data be a pointer to exactly the structs you have >>> chosen to define here. >> Nope, in heterogeneous world, same string can describe two different >> IRQs and/or two different strings can describe single IRQ in >> compatible manner. > > Can you give *any* concrete example of this that doesn't involve mixed > ACPI/FDT enumeration of a single system where devices appear in both > trees, which doesn't actually ever happen? GPIO - its interrupt function can be accessed by regular "interrupts" property, or it can be derived from GPIO pin. > > And even in those cases, there is no problem, since the PIC driver can > just dispatch both (or more) vectors corresponding to the interrupt > pin when the configured interrupt fires. It would have to have special > logic to handle decoding unrelated types of interrupt specifiers; > adding that would be about 3 lines of code. > >> >>> >>>> And no, it doesn't add any additional timing requirements . >>> >>> As far as I can tell, it requires the interrupt controller to be >>> attached before you can allocate interrupts. Is that not true? >> Yes, sure. And the patch doesn't change this. >> Before: >> https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301263#l1103 >> After: >> https://svnweb.freebsd.org/base/head/sys/kern/subr_intr.c?view=markup&pathrev=301543#l928 > > On PowerPC, we don't require this and never have. The VIRQ stuff is > meant explicitly to not require this. > >>> >>>> >>>>> 3. It is not fully transparent to end code. Since it happens at >>>>> bus_alloc_resource() time, it is complicated to get the >>>>> appropriate values for IRQs constructed by composite techniques >>>>> (interrupt-map vs. interrupts vs. hand allocation vs. PCI routing, >>>>> for example). >>>> I don't see any limitation - can you be more exact? Why is not >>>> transparent? Why is more complicated ? >>> >>> Suppose that a PCI device adds more IRQs to its resource list or >>> modifies the ordering. How is whatever bus layer supposed to do >>> something sensible at allocation time? It requires that RID numbers >>> mean something to the parent bus after assignment, which is not >>> guaranteed by anything and is, in more than handful of cases I think >>> of, not true in practice. >> Sure. And since the new code allows delivering resources in RL, so I >> don't see any limitation here. > > It indexed mapping by RID and then searches interrupt lists by that to > get the interrupt-parent. This is fundamentally a broken design if the > child needs to, say, add a second interrupt to its RL on a different > interrupt-parent. ?? I don't understand. The new code doesn't need this. > >> >>> >>>>> It is much easier to do this correctly at bus attach time when the >>>>> resource lists are made (how PPC does it). >>>>> >>>> I don't agree. I don't agree. Making this at bus attach time leads >>>> into complicated 'virtual' IRQ infrastructure, with many unresolved >>>> corner cases. >>> >>> Which unresolved corner cases? This has been working correctly on a >>> number of platforms in both FreeBSD and Linux for many years. >> Nope, it doesn't work for ARM yet (for GPIO interrupts for example) >> and Linux uses EPROBE_DEFER mechanism for a long time. >> See: http://lxr.free-electrons.com/source/drivers/base/platform.c#L87 > > There is some missing code on ARM (probably about 30 minutes of work > to make it match PowerPC) to make it work in an ideal case, sure, but > there is no reason you could not go out right now, with the existing > code, and implement GPIO interrupts by declaring the GPIO driver as an > interrupt controller. > > Can you give any concrete case of something that doesn't work? GPIO again. How you can allocate interrupt associated with given gpio pin installed by "cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;" >> >>> >>>> >>>>> (1) is easy to fix without API changes, but (2) and (3) are >>>>> fundamental architectural problems that will bite us immediately >>>>> down the road and cause a permanent schism between OF support on >>>>> different platforms. >>>>> >>>>> Let me describe how this is handled on PowerPC (Linux on PPC >>>>> solves the problem the same way). When constructing a resource >>>>> list, bus drivers that construct them from OF properties call >>>>> ofw_bus_map_intr() with the interrupt parent phandle and the array >>>>> of cells corresponding to the interrupt. This thunks immediately >>>>> to nexus, which connects to code in intr_machdep.c. Code there >>>>> assigns a unique made-up virtual IRQ and returns it, caching the >>>>> interrupt parent ID and opaque interrupt data (if the same string >>>>> of data reappears later, you get back the same virtual IRQ of >>>>> course). >>>>> >>>>> When PIC drivers attach and register themselves with the interrupt >>>>> handling layer, all the interrupts for that PIC are passed to it >>>>> along with the virtual IRQ. The PIC driver is supposed to know >>>>> what its interrupt data mean, which can be safely guaranteed, and >>>>> it presents the assigned virtual IRQ number to the kernel when >>>>> dispatching interrupts. (IRQs configured after PIC attachment are >>>>> passed through immediately). >>>>> >>>>> This accomplishes the following things: >>>>> 1. Parsing interrupt data is moved to the PIC driver, which is the >>>>> only place it can be done safely. >>>> I don't see anything different comparing with INTRNG. >>> >>> What I am advocating *is* INTRNG, at least as originally conceived >>> and implemented. >>> >>>>> 2. There is no ordering requirement on PIC attachment vs. the >>>>> attachment of anything else. >>>> I think thats is not a true - PIC must exist before >>>> bus_alloc_resource() / bus_setup_intr() is called. >>> >>> It does not with the IRQ mapping infrastructure. Interrupts are set >>> up at PIC attachment, whenever that occurs. >>> >> Assuming that bus_alloc_resource and bus_setup_intr() are close >> thorougher and in linear piece of code, can i assume that you can >> call bus_setup_intr() >> without PIC attached ? > > Yes. So driver can request and/or setup any random IRQ and gets success from bus_alloc_resource() or bus_setup_intr()? Do you think that is this right behavior? > >>>> >>>>> 3. Changes are extremely minimal relative to the "standard" >>>>> interrupt flow: you only have to patch code that is already >>>>> directly dealing with OF interrupts. >>>> I don't see anything different comparing with INTRNG. >>> >>> Again, this was the original INTRNG architecture and is already >>> implemented. As such, there are *no* changes required on ARM to get >>> it. bus_map_intr() adds a bunch of new code, in parallel with the >>> old code that also solves the problem, to no purpose. >> So, on PPC, how i can get interrupt for GPIO pin described by this >> property: >> https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/tegra124-jetson-tk1.dts?revision=295436&view=markup#l1691 >> > > The GPIO controller registers itself as an interrupt domain and > decodes those strings as IRQ specifiers. When interrupts are > configured, it does whatever it needs to do to configure them > appropriately and dispatches them to the kernel when they occur. It's > a pretty trivial cascaded interrupt configuration. And, since the VIRQ > code does not need the interrupt controller attached in advance, you > don't need to worry about attach order of wherever &gpio points and > the SDHCI driver. > >>> >>>>> 4. It happens at bus enumeration time, when results can be >>>>> guaranteed self-consistent. >>>> Where do you see any potential source of inconsistency in INTRNG? >>> >>> See the example above about modified interrupt lists. There is also >>> no obvious way for a child device to construct an interrupt not >>> assigned to it by the parent device from device tree properties >>> without knowing in some detail what kind of interrupt needs to be built. >>> >>>> >>>>> 5. It combines naturally with ofw_bus_lookup_imap() and friends in >>>>> the interrupt-map case (e.g. for PCI). >>>> Again, I don't see anything different. Proper parsing of interrupt >>>> property is not a problem of INTRNG (but must be fixed, of course). >>> >>> But it is *already* fixed by the standard code that already exists. >>> You are introducing a less-functional parallel code path here. >> NO, its not fixed, at least not for ARM. > > Why not, concretely? I'm happy to write whatever code is missing if > there's a bug. It can't be more than a few tens of lines in arm/intr.c. Interrupt maps are not covered by current ARM code. >>> >>>>> >>>>> I'm not sure what the right path forward is, but this code needs >>>>> to be fixed. The PowerPC code is fully MI, and was the template >>>>> for the original INTRNG, so it shouldn't be too bad to replace. >>>>> -Nathan >>>>> >>>> >>>> So, new INTRNG: >>>> - Introduces new more general bus method that can parse interrupt >>>> configuration >>>> data from any source. Is this step backward? >>> >>> Yes, since it is more general in some sense, while simultaneously >>> handling fewer cases than code that already exists and is implemented. >>> >>>> >>>> - Old INTRNG and PPC code stores unparsed and/or parsed interrupt >>>> data in >>>> INTRNG and each consumer must query for them. This data sharing >>>> also causes >>>> significant locking issues. New INTRNG stores interrupt >>>> configuration data into >>>> given resource, so each relevant bus method can access it >>>> immediately. >>>> Is this step backward? >>> >>> Which locking issues? And yes, it is. >>> >>>> >>>> - New INTRNG is not OFW centric, it can works with virtually >>>> unlimited number >>>> of configuration data sources. Is this step backward? >>> >>> Also yes, because it makes the interrupt handles less opaque, which >>> makes the infrastructure less flexible. >>> >>>> - New INTRNG correctly uses standard system infrastructure. Real >>>> IRQ number >>>> is reserved in rman within bus_alloc_resource() call, interrupt >>>> HW is >>>> configured (only!) within bus_setup_intr() call. Is this step >>>> backward? >>> >>> The "real" IRQ number is not well defined always, so requiring that >>> is a step backwards, yes. >>> >>>> - New INTRNG completely eliminates huge and not always working virtual >>>> IRQ concept. >>> >>> When does it "not always work"? It seems to, in fact, always work on >>> multiple platforms and have for a long time in the face of all kinds >>> of totally bizarre topologies and system architectures. >>> >>>> >>>> >>>> Don’t take me bad, I’m open to any change. But no, at this time, >>>> I’m not ready to completely revert someone else's work – although I >>>> am a co-author. >>> >>> I would urge, in the strongest possible terms, that this be backed >>> out from stable/11 at least. We can add the new API back for 11.1 if >>> we want it, but we totally lose the ability to change it later in >>> the stable/11 cycle if it stays in now. >>> -Nathan >>> >> The API is part of still unstable, experimental INTRNG, so its not >> fixed we we can change it at any time, I think. >> But yes, we forget to wrap new bus_map_intr() method (and associated >> code) by #ifdef INTRNG. Is this sufficient for you? > > For HEAD, yes. I would like it out of stable/11 entirely until this > discussion converges. > -Nathan The current code (in stable/11) works and is tested. I simple cannot commit any untested change for stable tree mainly if is in BETA2 stage. And I cannot fully test the requested change, at this time i have access to single ARM platform. But we're in the same situation - both have the same commit bit, neither one of us is the author of the disputed commit and neither of us are not able to fully test it. So feel free to commit what you want, if you have courage to commit untested code. I haven't it...\ Michal From owner-svn-src-head@freebsd.org Sat Jul 23 11:04: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 B1A7CBA1EFC; Sat, 23 Jul 2016 11:04:11 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mail.miracle.cz (mail.miracle.cz [193.84.128.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.miracle.cz", Issuer "Miracle Group Root CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DB0C18B2; Sat, 23 Jul 2016 11:04:10 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from [193.84.128.50] (meloun.ad.miracle.cz [193.84.128.50]) by mail.miracle.cz (Postfix) with ESMTPSA id D671E3AC9C; Sat, 23 Jul 2016 13:04:07 +0200 (CEST) Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: John Baldwin , Andrew Turner References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578F6075.7010500@FreeBSD.org> <20160721133742.05f0e045@zapp> <13301107.Hm25rxUxW2@ralph.baldwin.cx> Cc: Nathan Whitehorn , Svatopluk Kraus , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Michal Meloun X-Enigmail-Draft-Status: N1110 Message-ID: <57934F27.9070800@FreeBSD.org> Date: Sat, 23 Jul 2016 13:04:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <13301107.Hm25rxUxW2@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.miracle.cz); Sat, 23 Jul 2016 13:04:07 +0200 (CEST) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 11:04:11 -0000 Dne 21.07.2016 v 23:35 John Baldwin napsal(a): > On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: >> On Wed, 20 Jul 2016 13:28:53 +0200 >> Michal Meloun wrote: >>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>>> but is both problematically more general and less flexible (it has >>>> requirements on timing of PIC attachment vs. driver resource >>>> allocation) >>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>> parsed data are magicaly stored within the call. >>> The new method, bus_map_intr(), can parse data from multiple sources >>> (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also >>> returns parsed data back to caller. >>> And no, it doesn't add any additional timing requirements . >> I've been looking at ACPI on arm64. So far I have not found the need >> for this with ACPI as we don't need to send the data to the interrupt >> controller driver to be parsed in the way OFW/FDT needs to. > ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ > in bus_alloc_resource(). What I had advocated in the discussions > leading up to this was to have some sort of opaque structure containing > a set of properties (the sort of thing bus_map_resource and make_dev_s > use) that was passed up at bus_setup_intr() time. I think it should now > be passed up at bus_alloc_resource() time instead, but it would allow bus > drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree > with properties that the interrupt controller can then associate with > the IRQ cookie it allocates in its own code. I would let the particular > structure have different layouts for different resource types. On x86 we > would replace bus_config_intr by passing the level and trigger-mode in > this structure. However, I could also see allowing the memattr to be > set for a SYS_RES_MEMORY resource so you could have a much shorter way > than an explicit bus_map_resource to map an entire BAR as WC for example: > > struct alloc_resource_args { > size_t len; > union { > struct { > enum intr_trigger trigger; > enum intr_polarity polarity; > } irq; > struct { > vm_memattr_t memattr; > } memory; > } > } > > ... > > union alloc_resource_args args; > > init_alloc_resource_args(&args, sizeof(args)); > args.memattr = VM_MEMATTR_WRITE_COMBINING; > > /* Uses WC for the implicit mapping. */ > res = bus_alloc_resource(...., &args); > > ... > > foobus_alloc_resource(..., union alloc_resource_args *args) > { > union alloc_resource_args args2; > > switch (type) { > case SYS_RES_IRQ: > if (args == NULL) { > init_alloc_resource_args(&args2, sizeof(args2)); > args = &args2; > } > /* Replace call to BUS_CONFIG_INTR on ACPI: */ > if (args->irq.polarity == INTR_POLARITY_CONFORMING && > device_has_polarity_from_CRS) > args->irq.polarity = polarity_from_CRS; > ... > } > > However, you could associate arbitrary data with a resource request by > adding more members to the approriate struct in the union. > I like this idea. Mainly if we can add 'struct alloc_resource_args' into 'struct resource_list_entry' and, eventually, also into struct resource_i. Inability to pass something more complex as single integer between bus enumerator (aka resource_list_entry creator) and bus_alloc_resource() (aka resource_list_entry consumer) is serious limitation. At lest for me :) Michal From owner-svn-src-head@freebsd.org Sat Jul 23 11:24: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 1155DBA263D; Sat, 23 Jul 2016 11:24:07 +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 CAC9C135D; Sat, 23 Jul 2016 11:24:06 +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 u6NBO5mb003825; Sat, 23 Jul 2016 11:24:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NBO5aJ003824; Sat, 23 Jul 2016 11:24:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607231124.u6NBO5aJ003824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Jul 2016 11:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303218 - head/tools/tools/locale/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, 23 Jul 2016 11:24:07 -0000 Author: bapt Date: Sat Jul 23 11:24:05 2016 New Revision: 303218 URL: https://svnweb.freebsd.org/changeset/base/303218 Log: Add another hack to add weekday to date format to more locales While here only initialize the iconv converter when needed Modified: head/tools/tools/locale/tools/cldr2def.pl Modified: head/tools/tools/locale/tools/cldr2def.pl ============================================================================== --- head/tools/tools/locale/tools/cldr2def.pl Sat Jul 23 10:19:10 2016 (r303217) +++ head/tools/tools/locale/tools/cldr2def.pl Sat Jul 23 11:24:05 2016 (r303218) @@ -201,12 +201,12 @@ sub callback_ampm { my $s = shift; my $nl = $callback{data}{l} . "_" . $callback{data}{c}; my $enc = $callback{data}{e}; - my $converter = Text::Iconv->new("utf-8", "$enc"); if ($nl eq 'ru_RU') { if ($enc eq 'UTF-8') { $s = 'дп;пп'; } else { + my $converter = Text::Iconv->new("utf-8", "$enc"); $s = $converter->convert("дп;пп"); } } @@ -220,6 +220,7 @@ sub callback_cformat { $s =~ s/\.,/\./; $s =~ s/ %Z//; $s =~ s/ %z//; + $s =~ s/^"%e\./%A %e/; $s =~ s/^"(%B %e, )/"%A, $1/; $s =~ s/^"(%e %B )/"%A $1/; return $s; @@ -241,6 +242,7 @@ sub callback_dtformat { $s =~ s/(> )(%H)/$1%A $2/; } $s =~ s/\.,/\./; + $s =~ s/^"%e\./%A %e/; $s =~ s/^"(%B %e, )/"%A, $1/; $s =~ s/^"(%e %B )/"%A $1/; return $s; From owner-svn-src-head@freebsd.org Sat Jul 23 11: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 ED463BA26E0; Sat, 23 Jul 2016 11:25:37 +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 C4D00155F; Sat, 23 Jul 2016 11:25:37 +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 u6NBParI003939; Sat, 23 Jul 2016 11:25:36 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NBPYs1003917; Sat, 23 Jul 2016 11:25:34 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607231125.u6NBPYs1003917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Jul 2016 11:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303219 - head/share/timedef X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 11:25:38 -0000 Author: bapt Date: Sat Jul 23 11:25:34 2016 New Revision: 303219 URL: https://svnweb.freebsd.org/changeset/base/303219 Log: Add weekday to the date format of more locales MFC after: 1 day Modified: head/share/timedef/cs_CZ.ISO8859-2.src head/share/timedef/cs_CZ.UTF-8.src head/share/timedef/da_DK.ISO8859-15.src head/share/timedef/da_DK.UTF-8.src head/share/timedef/de_AT.ISO8859-15.src head/share/timedef/de_AT.UTF-8.src head/share/timedef/de_DE.ISO8859-15.src head/share/timedef/de_DE.UTF-8.src head/share/timedef/et_EE.ISO8859-15.src head/share/timedef/et_EE.UTF-8.src head/share/timedef/fi_FI.ISO8859-15.src head/share/timedef/fi_FI.UTF-8.src head/share/timedef/hr_HR.ISO8859-2.src head/share/timedef/hr_HR.UTF-8.src head/share/timedef/is_IS.ISO8859-15.src head/share/timedef/is_IS.UTF-8.src head/share/timedef/nb_NO.ISO8859-15.src head/share/timedef/nb_NO.UTF-8.src head/share/timedef/nn_NO.ISO8859-15.src head/share/timedef/nn_NO.UTF-8.src head/share/timedef/sk_SK.ISO8859-2.src head/share/timedef/sk_SK.UTF-8.src Modified: head/share/timedef/cs_CZ.ISO8859-2.src ============================================================================== --- head/share/timedef/cs_CZ.ISO8859-2.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/cs_CZ.ISO8859-2.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ sobota %d.%m.%y # # c_fmt -%e. %B %Y %H:%M:%S +%A %e %B %Y %H:%M:%S # # AM/PM dopoledne odpoledne # # date_fmt -%e. %B %Y %H:%M:%S %Z +%A %e %B %Y %H:%M:%S %Z # # Long month names (without case ending) leden Modified: head/share/timedef/cs_CZ.UTF-8.src ============================================================================== --- head/share/timedef/cs_CZ.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/cs_CZ.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ sobota %d.%m.%y # # c_fmt -%e. %B %Y %H:%M:%S +%A %e %B %Y %H:%M:%S # # AM/PM dopoledne odpoledne # # date_fmt -%e. %B %Y %H:%M:%S %Z +%A %e %B %Y %H:%M:%S %Z # # Long month names (without case ending) leden Modified: head/share/timedef/da_DK.ISO8859-15.src ============================================================================== --- head/share/timedef/da_DK.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/da_DK.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lrdag %d/%m/%Y # # c_fmt -%e. %B %Y kl. %H.%M.%S +%A %e %B %Y kl. %H.%M.%S # # AM/PM AM PM # # date_fmt -%e. %B %Y kl. %H.%M.%S %Z +%A %e %B %Y kl. %H.%M.%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/da_DK.UTF-8.src ============================================================================== --- head/share/timedef/da_DK.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/da_DK.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lørdag %d/%m/%Y # # c_fmt -%e. %B %Y kl. %H.%M.%S +%A %e %B %Y kl. %H.%M.%S # # AM/PM AM PM # # date_fmt -%e. %B %Y kl. %H.%M.%S %Z +%A %e %B %Y kl. %H.%M.%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/de_AT.ISO8859-15.src ============================================================================== --- head/share/timedef/de_AT.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/de_AT.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ Samstag %d.%m.%y # # c_fmt -%e. %B %Y um %H:%M:%S +%A %e %B %Y um %H:%M:%S # # AM/PM vorm. nachm. # # date_fmt -%e. %B %Y um %H:%M:%S %Z +%A %e %B %Y um %H:%M:%S %Z # # Long month names (without case ending) Jnner Modified: head/share/timedef/de_AT.UTF-8.src ============================================================================== --- head/share/timedef/de_AT.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/de_AT.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ Samstag %d.%m.%y # # c_fmt -%e. %B %Y um %H:%M:%S +%A %e %B %Y um %H:%M:%S # # AM/PM vorm. nachm. # # date_fmt -%e. %B %Y um %H:%M:%S %Z +%A %e %B %Y um %H:%M:%S %Z # # Long month names (without case ending) Jänner Modified: head/share/timedef/de_DE.ISO8859-15.src ============================================================================== --- head/share/timedef/de_DE.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/de_DE.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ Samstag %d.%m.%y # # c_fmt -%e. %B %Y um %H:%M:%S +%A %e %B %Y um %H:%M:%S # # AM/PM vorm. nachm. # # date_fmt -%e. %B %Y um %H:%M:%S %Z +%A %e %B %Y um %H:%M:%S %Z # # Long month names (without case ending) Januar Modified: head/share/timedef/de_DE.UTF-8.src ============================================================================== --- head/share/timedef/de_DE.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/de_DE.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ Samstag %d.%m.%y # # c_fmt -%e. %B %Y um %H:%M:%S +%A %e %B %Y um %H:%M:%S # # AM/PM vorm. nachm. # # date_fmt -%e. %B %Y um %H:%M:%S %Z +%A %e %B %Y um %H:%M:%S %Z # # Long month names (without case ending) Januar Modified: head/share/timedef/et_EE.ISO8859-15.src ============================================================================== --- head/share/timedef/et_EE.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/et_EE.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laupev %d.%m.%y # # c_fmt -%e. %B %Y %H:%M.%S +%A %e %B %Y %H:%M.%S # # AM/PM AM PM # # date_fmt -%e. %B %Y %H:%M.%S %Z +%A %e %B %Y %H:%M.%S %Z # # Long month names (without case ending) jaanuar Modified: head/share/timedef/et_EE.UTF-8.src ============================================================================== --- head/share/timedef/et_EE.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/et_EE.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laupäev %d.%m.%y # # c_fmt -%e. %B %Y %H:%M.%S +%A %e %B %Y %H:%M.%S # # AM/PM AM PM # # date_fmt -%e. %B %Y %H:%M.%S %Z +%A %e %B %Y %H:%M.%S %Z # # Long month names (without case ending) jaanuar Modified: head/share/timedef/fi_FI.ISO8859-15.src ============================================================================== --- head/share/timedef/fi_FI.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/fi_FI.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lauantaina %d.%m.%Y # # c_fmt -%e. %B %Y klo %H.%M.%S +%A %e %B %Y klo %H.%M.%S # # AM/PM ap. ip. # # date_fmt -%e. %B %Y klo %H.%M.%S %Z +%A %e %B %Y klo %H.%M.%S %Z # # Long month names (without case ending) tammikuuta Modified: head/share/timedef/fi_FI.UTF-8.src ============================================================================== --- head/share/timedef/fi_FI.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/fi_FI.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lauantaina %d.%m.%Y # # c_fmt -%e. %B %Y klo %H.%M.%S +%A %e %B %Y klo %H.%M.%S # # AM/PM ap. ip. # # date_fmt -%e. %B %Y klo %H.%M.%S %Z +%A %e %B %Y klo %H.%M.%S %Z # # Long month names (without case ending) tammikuuta Modified: head/share/timedef/hr_HR.ISO8859-2.src ============================================================================== --- head/share/timedef/hr_HR.ISO8859-2.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/hr_HR.ISO8859-2.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ subota %d.%m.%Y. # # c_fmt -%e. %B %Y. u %H:%M:%S +%A %e %B %Y. u %H:%M:%S # # AM/PM AM PM # # date_fmt -%e. %B %Y. u %H:%M:%S %Z +%A %e %B %Y. u %H:%M:%S %Z # # Long month names (without case ending) sijenja Modified: head/share/timedef/hr_HR.UTF-8.src ============================================================================== --- head/share/timedef/hr_HR.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/hr_HR.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ subota %d.%m.%Y. # # c_fmt -%e. %B %Y. u %H:%M:%S +%A %e %B %Y. u %H:%M:%S # # AM/PM AM PM # # date_fmt -%e. %B %Y. u %H:%M:%S %Z +%A %e %B %Y. u %H:%M:%S %Z # # Long month names (without case ending) siječnja Modified: head/share/timedef/is_IS.ISO8859-15.src ============================================================================== --- head/share/timedef/is_IS.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/is_IS.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laugardagur %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H:%M:%S +%A %e %B %Y kl. %H:%M:%S # # AM/PM f.h. e.h. # # date_fmt -%e. %B %Y kl. %H:%M:%S %Z +%A %e %B %Y kl. %H:%M:%S %Z # # Long month names (without case ending) janar Modified: head/share/timedef/is_IS.UTF-8.src ============================================================================== --- head/share/timedef/is_IS.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/is_IS.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laugardagur %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H:%M:%S +%A %e %B %Y kl. %H:%M:%S # # AM/PM f.h. e.h. # # date_fmt -%e. %B %Y kl. %H:%M:%S %Z +%A %e %B %Y kl. %H:%M:%S %Z # # Long month names (without case ending) janúar Modified: head/share/timedef/nb_NO.ISO8859-15.src ============================================================================== --- head/share/timedef/nb_NO.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/nb_NO.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lrdag %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H.%M.%S +%A %e %B %Y kl. %H.%M.%S # # AM/PM a.m. p.m. # # date_fmt -%e. %B %Y kl. %H.%M.%S %Z +%A %e %B %Y kl. %H.%M.%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/nb_NO.UTF-8.src ============================================================================== --- head/share/timedef/nb_NO.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/nb_NO.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ lørdag %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H.%M.%S +%A %e %B %Y kl. %H.%M.%S # # AM/PM a.m. p.m. # # date_fmt -%e. %B %Y kl. %H.%M.%S %Z +%A %e %B %Y kl. %H.%M.%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/nn_NO.ISO8859-15.src ============================================================================== --- head/share/timedef/nn_NO.ISO8859-15.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/nn_NO.ISO8859-15.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laurdag %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H:%M:%S +%A %e %B %Y kl. %H:%M:%S # # AM/PM formiddag ettermiddag # # date_fmt -%e. %B %Y kl. %H:%M:%S %Z +%A %e %B %Y kl. %H:%M:%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/nn_NO.UTF-8.src ============================================================================== --- head/share/timedef/nn_NO.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/nn_NO.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ laurdag %d.%m.%Y # # c_fmt -%e. %B %Y kl. %H:%M:%S +%A %e %B %Y kl. %H:%M:%S # # AM/PM formiddag ettermiddag # # date_fmt -%e. %B %Y kl. %H:%M:%S %Z +%A %e %B %Y kl. %H:%M:%S %Z # # Long month names (without case ending) januar Modified: head/share/timedef/sk_SK.ISO8859-2.src ============================================================================== --- head/share/timedef/sk_SK.ISO8859-2.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/sk_SK.ISO8859-2.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ sobota %d.%m.%y # # c_fmt -%e. %B %Y, %H:%M:%S +%A %e %B %Y, %H:%M:%S # # AM/PM dopoludnia odpoludnia # # date_fmt -%e. %B %Y, %H:%M:%S %Z +%A %e %B %Y, %H:%M:%S %Z # # Long month names (without case ending) janura Modified: head/share/timedef/sk_SK.UTF-8.src ============================================================================== --- head/share/timedef/sk_SK.UTF-8.src Sat Jul 23 11:24:05 2016 (r303218) +++ head/share/timedef/sk_SK.UTF-8.src Sat Jul 23 11:25:34 2016 (r303219) @@ -56,14 +56,14 @@ sobota %d.%m.%y # # c_fmt -%e. %B %Y, %H:%M:%S +%A %e %B %Y, %H:%M:%S # # AM/PM dopoludnia odpoludnia # # date_fmt -%e. %B %Y, %H:%M:%S %Z +%A %e %B %Y, %H:%M:%S %Z # # Long month names (without case ending) januára From owner-svn-src-head@freebsd.org Sat Jul 23 11:41: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 8EB25BA2D37 for ; Sat, 23 Jul 2016 11:41:50 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (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 24C821F57 for ; Sat, 23 Jul 2016 11:41:50 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f47.google.com with SMTP id g62so101054833lfe.3 for ; Sat, 23 Jul 2016 04:41:49 -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:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=SE0WS6TKNTh250Lxh7he14fzck/7f39yv3gBAKeK/Mw=; b=XfMd5KobiJ5NcDDXzf2CS9Ge/UWl4nozWHdhLw7ic9bNo4PntLswXqhHqwL/CFw1tQ UIS+FrN6RFYF+x7qdYfgKfSPq+g9thCuGYdOKgGmGCMq6qdxjsfxkLalfdTKi5wb1Duq n+0QAdqKNKRso6P61kWtkMAzjeKqHaJnjwFbXFod5/hJtngI6loMGj99A0VhsOs98jUJ 2jBrvpy/CnbkDD2DWH11pPtZCJS+a5bWTvvccvqPrG0tSzV+T9meIzXQao594LldCSKj 3tYnFpKKcvcx1ooBIJKSAQxXSMmelVDGBzjQDaiahX1s+M3SKoB2ZBhejnSoQSDaragJ BH5A== X-Gm-Message-State: AEkoout49D8xdywicIMpPhZxJQi1+KquOWxM+CHmHVwA+B4F1NgjPjoPgPd1HGcPvVAbuw== X-Received: by 10.25.152.135 with SMTP id a129mr3909455lfe.226.1469274101848; Sat, 23 Jul 2016 04:41:41 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id w16sm3837739lfd.29.2016.07.23.04.41.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jul 2016 04:41:41 -0700 (PDT) Subject: Re: svn commit: r303218 - head/tools/tools/locale/tools To: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201607231124.u6NBO5aJ003824@repo.freebsd.org> From: Andrey Chernov Message-ID: <97566d46-1d37-8c95-f276-f55b190bddbb@freebsd.org> Date: Sat, 23 Jul 2016 14:41:39 +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: <201607231124.u6NBO5aJ003824@repo.freebsd.org> 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: Sat, 23 Jul 2016 11:41:50 -0000 On 23.07.2016 14:24, Baptiste Daroussin wrote: > Author: bapt > Date: Sat Jul 23 11:24:05 2016 > New Revision: 303218 > URL: https://svnweb.freebsd.org/changeset/base/303218 > > Log: > Add another hack to add weekday to date format to more locales > > While here only initialize the iconv converter when needed > > Modified: > head/tools/tools/locale/tools/cldr2def.pl BTW, is there any progress in generating all collates with -m ${area} as you planned? From owner-svn-src-head@freebsd.org Sat Jul 23 11:52: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 A4783BA2F95; Sat, 23 Jul 2016 11:52:47 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::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 2F2AB186F; Sat, 23 Jul 2016 11:52:47 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id o80so97667581wme.1; Sat, 23 Jul 2016 04:52:47 -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=tqSu/i5wN6MLqswUedDvm3dwCsXrtJnRK+Uj9ZD3VXs=; b=b6LhAxEhhhKS7/hVgL4ZzxFOxxEgRTyCjMEkn3OVnWUPXu0scoWPkcP8tlME9Rr1eM 23fvIaiyd4QykRlzE5t1JWX9svfNSFIYJhf/FV7GNfOcy4YUtwQnplN2HNdq+vUeN5RC euFVt5r9K+6wADUD5tV8lDqZmgneO/l0g9GWN7eXQ20G5TumeUF8JYZTEp2GDPagl+WZ SPGvmPwR2gCyBXSKSwWjY6IvowOJn2eugQtb4ZpU+t9yCXonZR2DIJYd6tRBhLP0xGxL fLoREmUeJ0SkZBp95SM2FTf8mugXtSMcQUaR7LmPbE6Lm522SEDbFf99NQb7v6QOLN+Y cHxw== 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=tqSu/i5wN6MLqswUedDvm3dwCsXrtJnRK+Uj9ZD3VXs=; b=lAkOb4AzHypKxyj02RI55owvgQRjUiG+lkvPR1N2NNVW/XTH1fzKK6E5THmnrnOD77 +22aK9wllbfSX403RxEMiLIxN2CztFUiVKaA8DGqIMuq+fVEFYHGj1sSUVZZzXMlDDPr GP0zRH+8fkG4ATfkr+9rx7Mx0gWhRearXn1fDHvXcehPfn2N48PyAFXr1HuMSWdxx4cr z/yU3pvbVf5DEsKnv/UP9zu+Jm5Dpi+RQCS0nBB3S5FhBpS4uAiTxWGTS+oy1lZjtsNE 4xz4Wm+SPMnbvidOKeUcPkE0BUqZidUvAW4wkVxhrdN00IItTey6kwuzKBOVi9ovsAz7 nxEg== X-Gm-Message-State: ALyK8tISpVMB7LBhDuMrmCRH9kRsfYVVXcS9U+iuCVa5FBo6q+UqTzQcZxVwdsj+hBd68g== X-Received: by 10.28.185.202 with SMTP id j193mr31232396wmf.78.1469274765491; Sat, 23 Jul 2016 04:52:45 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id u125sm17134869wmg.22.2016.07.23.04.52.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jul 2016 04:52:44 -0700 (PDT) Sender: Baptiste Daroussin Date: Sat, 23 Jul 2016 13:52:44 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303218 - head/tools/tools/locale/tools Message-ID: <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> References: <201607231124.u6NBO5aJ003824@repo.freebsd.org> <97566d46-1d37-8c95-f276-f55b190bddbb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zphgh5vkc6b3wmb6" Content-Disposition: inline In-Reply-To: <97566d46-1d37-8c95-f276-f55b190bddbb@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: Sat, 23 Jul 2016 11:52:47 -0000 --zphgh5vkc6b3wmb6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 23, 2016 at 02:41:39PM +0300, Andrey Chernov wrote: > On 23.07.2016 14:24, Baptiste Daroussin wrote: > > Author: bapt > > Date: Sat Jul 23 11:24:05 2016 > > New Revision: 303218 > > URL: https://svnweb.freebsd.org/changeset/base/303218 > >=20 > > Log: > > Add another hack to add weekday to date format to more locales > > > > While here only initialize the iconv converter when needed > > > > Modified: > > head/tools/tools/locale/tools/cldr2def.pl >=20 > BTW, is there any progress in generating all collates with -m ${area} as > you planned? >=20 you mean the @modifier? Bapt --zphgh5vkc6b3wmb6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXk1qLAAoJEGOJi9zxtz5awD8P/R7+vKd8EUgw0X11jvQZtezj nRk5hs2SR5X9Ebx5mQKEzzqHdEM3cL0FbOXu+bqXJJ0IF50YY5BbXjYlts9ZpMyz 6KLJMcM/ruATalK6GgDdPdqDpSBrdIjf6HTB22YSMldpFO/iGizh51IJ/aXBep/a fjkoTmbfyC9h91DXjR3e2vLd2bc2TbE51IIkbTF1NlHwcFev80wzjwNaSmHQ5pJM t+Aki8L6W1Hy9Ub/jtWdxJMiUciG5wEzx6e7gyq0gG9rQy3h8xMhLwHF+V+yv0/C R265E1hJryvYvkJrV5bYY2c7KeFazNYCg9+VxG3o7LF5Yzo42pGtCybdiz73ty5u PYHHVvkRbWwBWj/nyEgM3aCQgNNYQZPIbni2sXhMQatd94U7y5DKD8bUoxMRnqRu BU2j2F9Wja9ecoqJsQRZKuz/0cXDnlQoh1RfNjFAmYMZYAiGUCHUCeTkqf2PYtjk AfLcjeaTdqM1/LUkteVd2sDvRyUrfefPpeUxw3+/JW61NnaIh+cbwiE7xEPIUZIA AqH7iI9W2vIv0WnUsP/fQ/yWmQrYAUgXh/P3FOrEpAaBKjMlawkZPIe/fje26Et0 oXsHLBrw/cxiHXkz76VGrnubwWV3jnDT7EoPHiMNTsRFb8NUG01ouvY0MO0VNnmD UO+li5GBC9LpNcKqmeu9 =lY89 -----END PGP SIGNATURE----- --zphgh5vkc6b3wmb6-- From owner-svn-src-head@freebsd.org Sat Jul 23 11:55: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 A2893BA201C; Sat, 23 Jul 2016 11:55:17 +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 3E5A81A28; Sat, 23 Jul 2016 11:55:17 +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 u6NBtGGV014806; Sat, 23 Jul 2016 11:55:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NBtF03014799; Sat, 23 Jul 2016 11:55:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607231155.u6NBtF03014799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Jul 2016 11:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303223 - head/contrib/mdocml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 11:55:17 -0000 Author: bapt Date: Sat Jul 23 11:55:15 2016 New Revision: 303223 URL: https://svnweb.freebsd.org/changeset/base/303223 Log: Update mandoc to 1.13.4 release Added: head/contrib/mdocml/man.cgi.3 - copied unchanged from r303222, vendor/mdocml/dist/man.cgi.3 Modified: head/contrib/mdocml/INSTALL head/contrib/mdocml/LICENSE head/contrib/mdocml/Makefile head/contrib/mdocml/NEWS head/contrib/mdocml/TODO head/contrib/mdocml/cgi.c head/contrib/mdocml/cgi.h.example head/contrib/mdocml/configure head/contrib/mdocml/configure.local.example head/contrib/mdocml/demandoc.c head/contrib/mdocml/libmandoc.h head/contrib/mdocml/main.c head/contrib/mdocml/main.h head/contrib/mdocml/man.1 head/contrib/mdocml/man.cgi.8 head/contrib/mdocml/mandoc.3 head/contrib/mdocml/mandoc.css head/contrib/mdocml/mandoc.db.5 head/contrib/mdocml/mandoc_headers.3 head/contrib/mdocml/mandoc_malloc.3 head/contrib/mdocml/mandocdb.c head/contrib/mdocml/manpage.c head/contrib/mdocml/manpath.c head/contrib/mdocml/mansearch.c head/contrib/mdocml/mchars_alloc.3 head/contrib/mdocml/read.c head/contrib/mdocml/tag.c head/contrib/mdocml/term.c head/contrib/mdocml/term_ascii.c head/contrib/mdocml/test-rewb-bsd.c head/contrib/mdocml/test-rewb-sysv.c Directory Properties: head/contrib/mdocml/ (props changed) Modified: head/contrib/mdocml/INSTALL ============================================================================== --- head/contrib/mdocml/INSTALL Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/INSTALL Sat Jul 23 11:55:15 2016 (r303223) @@ -1,4 +1,4 @@ -$Id: INSTALL,v 1.13 2015/11/07 14:01:16 schwarze Exp $ +$Id: INSTALL,v 1.15 2016/07/14 11:09:06 schwarze Exp $ About mdocml, the portable mandoc distribution ---------------------------------------------- @@ -16,7 +16,7 @@ tech@ mailing list, too. Enjoy using the mandoc toolset! -Ingo Schwarze, Karlsruhe, March 2015 +Ingo Schwarze, Karlsruhe, July 2016 Installation @@ -52,7 +52,7 @@ and go back to step 2. 4. Run "make -n install" and check whether everything will be installed to the intended places. Otherwise, put some *DIR or *NM* -variables into "configure.local" and go back to step2. +variables into "configure.local" and go back to step 2. 5. Run "sudo make install". If you intend to build a binary package using some kind of fake root mechanism, you may need a @@ -63,7 +63,7 @@ in the "Makefile" to understand how DEST manpath(1), make sure it is configured correctly, in particular, it returns all directory trees where manual pages are installed. Otherwise, if your system uses man.conf(5), make sure it contains -a "_whatdb" line for each directory tree, and the order of these +a "manpath" line for each directory tree, and the order of these lines meets your wishes. 7. If you compiled with database support, run the command "sudo Modified: head/contrib/mdocml/LICENSE ============================================================================== --- head/contrib/mdocml/LICENSE Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/LICENSE Sat Jul 23 11:55:15 2016 (r303223) @@ -1,11 +1,11 @@ -$Id: LICENSE,v 1.11 2015/11/07 17:58:55 schwarze Exp $ +$Id: LICENSE,v 1.12 2016/07/07 23:46:36 schwarze Exp $ With the exceptions noted below, all code and documentation contained in the mdocml toolkit is protected by the Copyright of the following developers: Copyright (c) 2008-2012, 2014 Kristaps Dzonsons -Copyright (c) 2010-2015 Ingo Schwarze +Copyright (c) 2010-2016 Ingo Schwarze Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger Copyright (c) 2013 Franco Fichtner Copyright (c) 2014 Baptiste Daroussin Modified: head/contrib/mdocml/Makefile ============================================================================== --- head/contrib/mdocml/Makefile Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/Makefile Sat Jul 23 11:55:15 2016 (r303223) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.480 2015/11/07 21:53:14 schwarze Exp $ +# $Id: Makefile,v 1.488 2016/07/12 05:18:38 kristaps Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons -# Copyright (c) 2011, 2013, 2014, 2015 Ingo Schwarze +# Copyright (c) 2011, 2013-2016 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -VERSION = 1.13.3 +VERSION = 1.13.4 # === LIST OF FILES ==================================================== @@ -31,6 +31,9 @@ TESTSRCS = test-dirent-namlen.c \ test-pledge.c \ test-progname.c \ test-reallocarray.c \ + test-rewb-bsd.c \ + test-rewb-sysv.c \ + test-sandbox_init.c \ test-sqlite3.c \ test-sqlite3_errstr.c \ test-strcasestr.c \ @@ -138,6 +141,7 @@ DISTFILES = INSTALL \ makewhatis.8 \ man.1 \ man.7 \ + man.cgi.3 \ man.cgi.8 \ man.conf.5 \ man.h \ @@ -164,6 +168,7 @@ DISTFILES = INSTALL \ predefs.in \ roff.7 \ roff.h \ + roff_int.h \ soelim.1 \ st.in \ tag.h \ @@ -293,6 +298,7 @@ WWW_MANS = apropos.1.html \ roff.7.html \ tbl.7.html \ makewhatis.8.html \ + man.cgi.3.html \ man.cgi.8.html \ man.h.html \ manconf.h.html \ @@ -392,34 +398,30 @@ db-install: base-build cgi-install: cgi-build mkdir -p $(DESTDIR)$(CGIBINDIR) mkdir -p $(DESTDIR)$(HTDOCDIR) - mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1 - mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) $(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR) - $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/ - $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/ Makefile.local config.h: configure ${TESTSRCS} @echo "$@ is out of date; please run ./configure" @exit 1 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) - $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) mandoc: $(MAIN_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MAIN_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD) manpage: $(MANPAGE_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(MANPAGE_OBJS) libmandoc.a $(LDADD) man.cgi: $(CGI_OBJS) libmandoc.a - $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) + $(CC) $(STATIC) -o $@ $(LDFLAGS) $(CGI_OBJS) libmandoc.a $(LDADD) demandoc: $(DEMANDOC_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD) soelim: $(SOELIM_OBJS) - $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) + $(CC) -o $@ $(LDFLAGS) $(SOELIM_OBJS) # --- maintainer targets --- @@ -439,6 +441,8 @@ depend: config.h Makefile.depend > Makefile.tmp mv Makefile.tmp Makefile.depend +dist: mdocml.sha256 + mdocml.sha256: mdocml.tar.gz sha256 mdocml.tar.gz > $@ Modified: head/contrib/mdocml/NEWS ============================================================================== --- head/contrib/mdocml/NEWS Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/NEWS Sat Jul 23 11:55:15 2016 (r303223) @@ -1,7 +1,140 @@ -$Id: NEWS,v 1.10 2015/11/05 16:58:20 schwarze Exp $ +$Id: NEWS,v 1.12 2016/07/14 11:09:06 schwarze Exp $ This file lists the most important changes in the mdocml.bsd.lv distribution. +Changes in version 1.13.4, released on July 14, 2016 + + --- MAJOR NEW FEATURES --- + * man.conf(5): Design and implement a simpler configuration file format. + * man(1): Leverage less(1) -T and :t in a way resembling ctags(1) + to jump to the definitions of various terms inside manual pages. + * soelim(1): New implementation by Baptiste Daroussin. + * privilege limitation: Use OpenBSD pledge(2) or OS X sandbox_init(3) + when available. + * man.cgi(8): Support short URIs like http://man.openbsd.org/mdoc . + * mandoc.css: Use one unified stylesheet rather than three different ones. + --- MAJOR FUNCTIONALLY RELEVANT BUGFIXES --- + * mdoc(7): Fix multiple aspects of SYNOPSIS .Nm formatting. + * man(1): Fix process group handling, avoiding unclean shutdowns. + --- PORTABILITY IMPROVEMENTS --- + * Correctly use the ohash(3) compatibility implementation + even when building without SQLite support. + * Add compat glue for building on Solaris 9 and 10. + * Let ./configure select a supported RE syntax for word boundaries. + * Support LDFLAGS, to be used for example for hardening options. + * Avoid mixing putchar(3) and putwchar(3) on the same file descriptor, + it resulted in output corruption on some platforms. + * Avoid reusing va_lists, use va_copy(3) for better portability. + * Do not hardcode the path to the more(1) program. + --- MINOR NEW FEATURES --- + * roff(7): Implement \n(.$ (number of macro arguments). + * roff(7): Fully implement \z (do not advance cursor). + * roff(7): Implement the `r' conditional (register exists). + * roff(7): Implement \\$* (interpolate all arguments). + * roff(7): Parse and ignore \, and \/ (italic corrections). + * When there is no -m, no -M, no MANPATH and no /etc/man.conf, + fall back to /usr/share/man:/usr/X11R6/man:/usr/local/man. + * man(1): Give manuals in purely numerical sections priority over + manuals of the same name in sections with an alphabetical suffix. + * man.cgi(8): Support "header.html" and "footer.html". + * man.cgi(8): Set the "autofocus" attribute on the query text box. + * man.cgi(8): Simplify the search form, drop two useless buttons. + * man.cgi(8): Delete the pseudo-manpath "mandoc", assume that + apropos(1) and man.cgi(8) are installed in the default manpath. + --- RELIABILITY BUGFIXES --- + * mdoc(7): Avoid a use after free and an assertion failure when nodes + are deleted during validation. + * mdoc(7): Avoid a NULL pointer access when .Bd has no arguments. + * mdoc(7): Avoid a NULL pointer access triggered by mismatching end macros. + * mdoc(7): Avoid an assertion when .Fo has no argument. + * mdoc(7): Avoid an assertion when .Ta occurs in .Bl -column. + * mdoc(7): Avoid an assertion when a body gets broken and has a tail. + * roff(7): Avoid an assertion caused by blanks inside \o. + * roff(7): Make .so links to gziped manuals work without mandoc.db(5). + * tbl(7): Avoid a use after free when the last line of a layout is empty. + * eqn(7): Avoid an infinite loop caused by recursive "define". + * makewhatis(8): Avoid a segfault caused by unusual directory structures. + * Fix handling of leading, trailing, and double colons in MANPATH and -m. + --- MINOR BUGFIXES --- + * mdoc(7): Put arguments to end macros of broken partial explicit blocks + inside the breaking block. + * mdoc(7): Let .Dv force normal font. + * mdoc(7): Make trailing whitespace significant in .Bl -tag widths. + * mdoc(7): Fix macro interpretation around tabs in .Bl -column. + * man(7): Use the default width for .RS without arguments. + * man(7): On a new RS nesting level, the saved width starts from + the default width, not from the saved width of the previous level. + * man(7): Allow .PD in next-line scope. + * man(7): Improve handling of empty .HP. + * man(7): Improve formatting of .br and .sp inside .HP. + * man(7): Do not mistreat empty arguments to font alternating + macros as vertical spacing requests. + * man(7): Allow fill mode changes in tagged paragraph next-line scope. + * man(7): Fix minor bugs in block rewinding and simplify the related code. + * man(7): Add missing line breaks before subsection headers. + * man(7): Give section and subsection headers hanging indentation. + * man(7): Make trailing whitespace significant in .TP widths. + * roff(7): Don't allow breaking the output line after hyphens + that immediately follow escape sequences. + * roff(7): Ignore blank characters at the beginning of conditional blocks. + * roff(7): Escape breakable hyphens only after handling input line traps. + * roff(7): Reject \[uD800] to \[uDFFF] (surrogates) in the parser. + * tbl(7): Allow more than one data field after T} on the same input line. + * terminal output: Apply bold and italic to non-ASCII Unicode codepoints. + * terminal output: Improve rounding rules for horizontal scaling widths. + * HTML output: Render ASCII_NBRSP as " ", not "-". + * man(1): Do not match the first part of a name if it continues with a dot. + * man(1): Keep working even if the current directory is unusable. + * man(1): Better error message when $PAGER is invalid. + * makewhatis(8): Improve handling of .Va and .Vt macros. + * apropos(1): Print "nothing appropriate" to stderr when appropriate. + * apropos(1): Abort with a useful error message when elementary + database operations like preparing queries or binding variables fail. + --- STRUCTURAL CHANGES, no functional change --- + * mdoc(7) and man(7): Unified data structures struct roff_node etc. + * mdoc(7) and man(7): Unified node handling library in roff.c. + * mdoc(7) and man(7): Seperate validation phase from parsing. + * roff(7): Major character table cleanup. + * Link with libz rather than forking gunzip(1). + --- THANKS TO --- + * Baptiste Daroussin (FreeBSD) for the new soelim(1) + and for release testing. + * Anthony Bentley (OpenBSD) for unifying mandoc.css, two nice + patches for man.cgi(8), some documentation patches, some bug + reports, and various useful discussions. + * Todd Miller (OpenBSD) for lots of help with process group and + signal handling, a few patches, some bug reports and some useful + discussions. + * Jonathan Gray (OpenBSD) for yet more testing with afl(1) + again resulting in more than half a dozen important bug reports. + * Svyatoslav Mishyn (Crux Linux) for some patches, several bug + reports, and extensive release testing. + * Christian Neukirchen (void Linux) for a number of compatibility + patches and suggestions and several bug reports. + * Christos Zoulas (NetBSD) for a bug fix patch and some useful + suggestions for cleanup. + * Florian Obser (OpenBSD) for a bugfix patch and some bug reports. + * Sevan Janiyan for help with Solaris compatibility and release + testing on many platforms. + * Jan Holzhueter and OpenCSW in general for help with Solaris + compatibility, and for providing me with a Solaris 9/10/11 testing + environment. + * Michael McConville (OpenBSD) for some simple cleanup patches. + * Thomas Klausner (NetBSD) for some bug reports and release testing. + * Christian Weisgerber, Dmitrij Czarkoff, Igor Sobrado, + Ken Westerback, Marc Espie, Mike Belopuhov, Rafael Neves, + Ted Unangst, Tim van der Molen, Theo Buehler, Theo de Raadt + (OpenBSD), Kurt Jaeger, Dag Erling Smoergrav (FreeBSD), + Joerg Sonnenberger (NetBSD), Carsten Kunze (Heirloom troff), + Daniel Levai, Fabian Raetz, Jan Stary, Jean-Yves Migeon, + Lorenzo Beretta, Markus Waldeck, Maxim Belooussov, Michael Reed, + Peter Bray, and Serguey Parkhomovsky for bug reports and feature + suggestions. + * Alexander Hall, Andrew Fresh, Antoine Jacoutot, Doug Hogan, + Jason McIntyre, Jasper Lievisse Adriaanse, Kent Spillner, + Nicholas Marriott, Peter Hessler, Sebastien Marie, Stefan Sperling, + and Theo de Raadt (OpenBSD) for helpful discussions and feedback. + Changes in version 1.13.3, released on March 13, 2015 --- MAJOR NEW FEATURES --- Modified: head/contrib/mdocml/TODO ============================================================================== --- head/contrib/mdocml/TODO Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/TODO Sat Jul 23 11:55:15 2016 (r303223) @@ -1,6 +1,6 @@ ************************************************************************ * Official mandoc TODO. -* $Id: TODO,v 1.216 2016/01/08 01:37:32 schwarze Exp $ +* $Id: TODO,v 1.218 2016/06/05 21:06:04 schwarze Exp $ ************************************************************************ Many issues are annotated for difficulty as follows: @@ -416,6 +416,11 @@ are mere guesses, and some may be wrong. see also matthew@ Fri, 18 Jul 2014 19:25:12 -0700 loc * exist * algo ** size * imp *** +- In -man -Thtml, .nf does not preserve indentation. + It should either convert blanks to   + or use
 rather than 
(like .Bd -literal does). + Reported by afresh1@ 12 Apr 2016 14:35:45 -0700 + - .Bf at the beginning of a paragraph inserts a bogus 1ex horizontal space, see for example random(3). Introduced in http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_html.c.diff?r1=1.91&r2=1.92 @@ -583,8 +588,6 @@ are mere guesses, and some may be wrong. to tech@mdocml, naddy@ Wed, 28 Sep 2011 11:21:46 +0200 wait! kristaps@ Sun, 02 Oct 2011 17:12:52 +0200 -- for system errors, use errno/strerror/warn/err - ************************************************************************ * documentation issues ************************************************************************ @@ -628,9 +631,6 @@ Several areas can be cleaned up to make * structural issues ************************************************************************ -- Use libz directly instead of forking gunzip(1). - Suggested by bapt at FreeBSD among others. - - We use the input line number at several places to distinguish same-line from different-line input. That plainly doesn't work with user-defined macros, leading to random breakage. Modified: head/contrib/mdocml/cgi.c ============================================================================== --- head/contrib/mdocml/cgi.c Sat Jul 23 11:47:04 2016 (r303222) +++ head/contrib/mdocml/cgi.c Sat Jul 23 11:55:15 2016 (r303223) @@ -1,7 +1,7 @@ -/* $Id: cgi.c,v 1.116 2016/01/04 12:36:26 schwarze Exp $ */ +/* $Id: cgi.c,v 1.135 2016/07/11 22:48:37 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons - * Copyright (c) 2014, 2015 Ingo Schwarze + * Copyright (c) 2014, 2015, 2016 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -55,15 +56,20 @@ struct req { struct query q; char **p; /* array of available manpaths */ size_t psz; /* number of available manpaths */ + int isquery; /* QUERY_STRING used, not PATH_INFO */ +}; + +enum focus { + FOCUS_NONE = 0, + FOCUS_QUERY }; -static void catman(const struct req *, const char *); -static void format(const struct req *, const char *); static void html_print(const char *); static void html_putchar(char); static int http_decode(char *); -static void http_parse(struct req *, const char *); -static void pathgen(struct req *); +static void parse_manpath_conf(struct req *); +static void parse_path_info(struct req *req, const char *path); +static void parse_query_string(struct req *, const char *); static void pg_error_badrequest(const char *); static void pg_error_internal(void); static void pg_index(const struct req *); @@ -74,16 +80,18 @@ static void pg_searchres(const struct static void pg_show(struct req *, const char *); static void resp_begin_html(int, const char *); static void resp_begin_http(int, const char *); +static void resp_catman(const struct req *, const char *); static void resp_copy(const char *); static void resp_end_html(void); -static void resp_searchform(const struct req *); +static void resp_format(const struct req *, const char *); +static void resp_searchform(const struct req *, enum focus); static void resp_show(const struct req *, const char *); static void set_query_attr(char **, char **); static int validate_filename(const char *); static int validate_manpath(const struct req *, const char *); static int validate_urifrag(const char *); -static const char *scriptname; /* CGI script name */ +static const char *scriptname = SCRIPT_NAME; static const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9}; static const char *const sec_numbers[] = { @@ -106,16 +114,16 @@ static const int sec_MAX = sizeof(sec_na static const char *const arch_names[] = { "amd64", "alpha", "armish", "armv7", - "aviion", "hppa", "hppa64", "i386", - "ia64", "landisk", "loongson", "luna88k", - "macppc", "mips64", "octeon", "sgi", - "socppc", "solbourne", "sparc", "sparc64", - "vax", "zaurus", + "hppa", "hppa64", "i386", "landisk", + "loongson", "luna88k", "macppc", "mips64", + "octeon", "sgi", "socppc", "sparc", + "sparc64", "zaurus", "amiga", "arc", "arm32", "atari", - "beagle", "cats", "hp300", "mac68k", - "mvme68k", "mvme88k", "mvmeppc", "palm", - "pc532", "pegasos", "pmax", "powerpc", - "sun3", "wgrisc", "x68k" + "aviion", "beagle", "cats", "hp300", + "ia64", "mac68k", "mvme68k", "mvme88k", + "mvmeppc", "palm", "pc532", "pegasos", + "pmax", "powerpc", "solbourne", "sun3", + "vax", "wgrisc", "x68k" }; static const int arch_MAX = sizeof(arch_names) / sizeof(char *); @@ -182,11 +190,12 @@ set_query_attr(char **attr, char **val) * and store the values into the query structure. */ static void -http_parse(struct req *req, const char *qs) +parse_query_string(struct req *req, const char *qs) { char *key, *val; size_t keysz, valsz; + req->isquery = 1; req->q.manpath = NULL; req->q.arch = NULL; req->q.sec = NULL; @@ -338,14 +347,14 @@ resp_begin_html(int code, const char *ms resp_begin_http(code, msg); printf("\n" - "\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "\n" + "\n" + "\n" + "\n" + "\n" + "%s\n" + "\n" + "\n" "\n", CSS_DIR, CUSTOMIZE_TITLE); @@ -358,103 +367,87 @@ resp_end_html(void) resp_copy(MAN_DIR "/footer.html"); - puts("\n" - ""); + puts("\n" + ""); } static void -resp_searchform(const struct req *req) +resp_searchform(const struct req *req, enum focus focus) { int i; puts(""); - printf("
\n" - "
\n" - "
\n" - "Manual Page Search Parameters\n", + printf("
\n" + "\n" + "
\n" + "Manual Page Search Parameters\n", scriptname); /* Write query input box. */ - printf( "
\n" - "q.query) + printf("q.query != NULL) html_print(req->q.query); - puts("\" SIZE=\"40\">"); - - /* Write submission and reset buttons. */ - - printf( "\n" - "\n"); - - /* Write show radio button */ - - printf( "\n" - "q.equal) - printf("CHECKED=\"checked\" "); - printf( "NAME=\"apropos\" ID=\"show\" VALUE=\"0\">\n" - "\n"); + printf( "\" size=\"40\""); + if (focus == FOCUS_QUERY) + printf(" autofocus"); + puts(">"); + + /* Write submission buttons. */ + + printf( "\n" + "\n
\n"); /* Write section selector. */ - puts( "
\n" - ""); for (i = 0; i < sec_MAX; i++) { - printf("\n", sec_names[i]); + printf(" selected=\"selected\""); + printf(">%s\n", sec_names[i]); } - puts(""); + puts(""); /* Write architecture selector. */ - printf( ""); + puts(""); /* Write manpath selector. */ if (req->psz > 1) { - puts(""); for (i = 0; i < (int)req->psz; i++) { - printf(""); + puts(""); } - puts(""); + puts(""); } - /* Write search radio button */ - - printf( "\n" - "q.equal) - printf("CHECKED=\"checked\" "); - printf( "NAME=\"apropos\" ID=\"search\" VALUE=\"1\">\n" - "\n"); - - puts("
\n" - "
\n" - "\n" - "
"); + puts("
\n" + "\n" + "
"); puts(""); } @@ -477,9 +470,6 @@ validate_manpath(const struct req *req, { size_t i; - if ( ! strcmp(manpath, "mandoc")) - return 1; - for (i = 0; i < req->psz; i++) if ( ! strcmp(manpath, req->p[i])) return 1; @@ -503,15 +493,16 @@ pg_index(const struct req *req) { resp_begin_html(200, NULL); - resp_searchform(req); - printf("

\n" + resp_searchform(req, FOCUS_QUERY); + printf("

\n" "This web interface is documented in the\n" - "man.cgi\n" + "man.cgi(8)\n" "manual, and the\n" - "apropos\n" + "apropos(1)\n" "manual explains the query syntax.\n" - "

\n", - scriptname, scriptname); + "

\n", + scriptname, *scriptname == '\0' ? "" : "/", + scriptname, *scriptname == '\0' ? "" : "/"); resp_end_html(); } @@ -519,10 +510,10 @@ static void pg_noresult(const struct req *req, const char *msg) { resp_begin_html(200, NULL); - resp_searchform(req); - puts("

"); + resp_searchform(req, FOCUS_QUERY); + puts("

"); puts(msg); - puts("

"); + puts("

"); resp_end_html(); } @@ -531,12 +522,12 @@ pg_error_badrequest(const char *msg) { resp_begin_html(400, "Bad Request"); - puts("

Bad Request

\n" - "

\n"); + puts("

Bad Request

\n" + "

\n"); puts(msg); printf("Try again from the\n" - "main page.\n" - "

", scriptname); + "main page.\n" + "

", scriptname); resp_end_html(); } @@ -544,7 +535,7 @@ static void pg_error_internal(void) { resp_begin_html(500, "Internal Server Error"); - puts("

Internal Server Error

"); + puts("

Internal Server Error

"); resp_end_html(); } @@ -552,28 +543,30 @@ static void pg_searchres(const struct req *req, struct manpage *r, size_t sz) { char *arch, *archend; - size_t i, iuse, isec; + const char *sec; + size_t i, iuse; int archprio, archpriouse; int prio, priouse; - char sec; for (i = 0; i < sz; i++) { if (validate_filename(r[i].file)) continue; - fprintf(stderr, "invalid filename %s in %s database\n", + warnx("invalid filename %s in %s database", r[i].file, req->q.manpath); pg_error_internal(); return; } - if (1 == sz) { + if (req->isquery && sz == 1) { /* * If we have just one result, then jump there now * without any delay. */ printf("Status: 303 See Other\r\n"); - printf("Location: http://%s%s/%s/%s", - HTTP_HOST, scriptname, req->q.manpath, r[0].file); + printf("Location: http://%s/%s%s%s/%s", + HTTP_HOST, scriptname, + *scriptname == '\0' ? "" : "/", + req->q.manpath, r[0].file); printf("\r\n" "Content-Type: text/html; charset=utf-8\r\n" "\r\n"); @@ -581,50 +574,57 @@ pg_searchres(const struct req *req, stru } resp_begin_html(200, NULL); - resp_searchform(req); - puts("
"); - puts(""); + resp_searchform(req, + req->q.equal || sz == 1 ? FOCUS_NONE : FOCUS_QUERY); - for (i = 0; i < sz; i++) { - printf("\n" - "\n" - "\n" - ""); - } + if (sz > 1) { + puts("
"); + puts("
\n" - "q.manpath, r[i].file); - printf("\">"); - html_print(r[i].names); - printf("\n" - ""); - html_print(r[i].output); - puts("
"); - puts("
\n" - "
"); + for (i = 0; i < sz; i++) { + printf("\n" + "\n" + "q.manpath, r[i].file); + printf("\">"); + html_print(r[i].names); + printf("\n" + "\n" + ""); + html_print(r[i].output); + puts("\n" + ""); + } + + puts("\n" + "
"); + } /* * In man(1) mode, show one of the pages * even if more than one is found. */ - if (req->q.equal) { - puts("
"); + if (req->q.equal || sz == 1) { + puts("
"); iuse = 0; - priouse = 10; + priouse = 20; archpriouse = 3; for (i = 0; i < sz; i++) { - isec = strcspn(r[i].file, "123456789"); - sec = r[i].file[isec]; - if ('\0' == sec) + sec = r[i].file; + sec += strcspn(sec, "123456789"); + if (sec[0] == '\0') continue; - prio = sec_prios[sec - '1']; - if (NULL == req->q.arch) { + prio = sec_prios[sec[0] - '1']; + if (sec[1] != '/') + prio += 10; + if (req->q.arch == NULL) { archprio = - (NULL == (arch = strchr( - r[i].file + isec, '/'))) ? 3 : - (NULL == (archend = strchr( - arch + 1, '/'))) ? 0 : + ((arch = strchr(sec + 1, '/')) + == NULL) ? 3 : + ((archend = strchr(arch + 1, '/')) + == NULL) ? 0 : strncmp(arch, "amd64/", archend - arch) ? 2 : 1; if (archprio < archpriouse) { @@ -648,7 +648,7 @@ pg_searchres(const struct req *req, stru } static void -catman(const struct req *req, const char *file) +resp_catman(const struct req *req, const char *file) { FILE *f; char *p; @@ -658,12 +658,12 @@ catman(const struct req *req, const char int italic, bold; if ((f = fopen(file, "r")) == NULL) { - puts("

You specified an invalid manual file.

"); + puts("

You specified an invalid manual file.

"); return; } - puts("
\n" - "
");
+	puts("
\n" + "
");
 
 	p = NULL;
 	sz = 0;
@@ -689,9 +689,9 @@ catman(const struct req *req, const char
 
 			if ('\b' != p[i + 1]) {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				html_putchar(p[i]);
 				continue;
@@ -702,9 +702,9 @@ catman(const struct req *req, const char
 
 			if ('_' == p[i]) {
 				if (bold)
-					printf("");
+					printf("");
 				if ( ! italic)
-					printf("");
+					printf("");
 				bold = 0;
 				italic = 1;
 				i += 2;
@@ -726,9 +726,9 @@ catman(const struct req *req, const char
 					('*' == p[i] && '|' == p[i + 2]) ||
 					('|' == p[i] && '*' == p[i + 2]))  {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				putchar('*');
 				i += 2;
@@ -740,9 +740,9 @@ catman(const struct req *req, const char
 					('+' == p[i] && '|' == p[i + 1]) ||
 					('|' == p[i] && '+' == p[i + 1]))  {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				putchar('+');
 				i += 2;
@@ -752,9 +752,9 @@ catman(const struct req *req, const char
 			/* Bold mode. */
 
 			if (italic)
-				printf("");
+				printf("");
 			if ( ! bold)
-				printf("");
+				printf("");
 			bold = 1;
 			italic = 0;
 			i += 2;
@@ -767,9 +767,9 @@ catman(const struct req *req, const char
 		 */
 
 		if (italic)
-			printf("");
+			printf("");
 		if (bold)
-			printf("");
+			printf("");
 
 		if (i == len - 1 && p[i] != '\n')
 			html_putchar(p[i]);
@@ -778,14 +778,14 @@ catman(const struct req *req, const char
 	}
 	free(p);
 
-	puts("
\n" - "
"); + puts("
\n" + "
"); fclose(f); } static void -format(const struct req *req, const char *file) +resp_format(const struct req *req, const char *file) { struct manoutput conf; struct mparse *mp; @@ -795,7 +795,7 @@ format(const struct req *req, const char int usepath; if (-1 == (fd = open(file, O_RDONLY, 0))) { - puts("

You specified an invalid manual file.

"); + puts("

You specified an invalid manual file.

"); return; } @@ -807,17 +807,12 @@ format(const struct req *req, const char memset(&conf, 0, sizeof(conf)); conf.fragment = 1; usepath = strcmp(req->q.manpath, req->p[0]); - mandoc_asprintf(&conf.man, "%s?query=%%N&sec=%%S%s%s%s%s", - scriptname, - req->q.arch ? "&arch=" : "", - req->q.arch ? req->q.arch : "", - usepath ? "&manpath=" : "", - usepath ? req->q.manpath : ""); + mandoc_asprintf(&conf.man, "/%s%s%%N.%%S", + usepath ? req->q.manpath : "", usepath ? "/" : ""); mparse_result(mp, &man, NULL); if (man == NULL) { - fprintf(stderr, "fatal mandoc error: %s/%s\n", - req->q.manpath, file); + warnx("fatal mandoc error: %s/%s", req->q.manpath, file); pg_error_internal(); mparse_free(mp); mchars_free(); @@ -848,9 +843,9 @@ resp_show(const struct req *req, const c file += 2; if ('c' == *file) - catman(req, file); + resp_catman(req, file); else - format(req, file); + resp_format(req, file); } static void @@ -881,18 +876,12 @@ pg_show(struct req *req, const char *ful */ if (chdir(manpath) == -1) { - fprintf(stderr, "chdir %s: %s\n", - manpath, strerror(errno)); + warn("chdir %s", manpath); pg_error_internal(); free(manpath); return; } - - if (strcmp(manpath, "mandoc")) { - free(req->q.manpath); - req->q.manpath = manpath; - } else - free(manpath); + free(manpath); if ( ! validate_filename(file)) { pg_error_badrequest( @@ -901,7 +890,7 @@ pg_show(struct req *req, const char *ful } resp_begin_html(200, NULL); - resp_searchform(req); + resp_searchform(req, FOCUS_NONE); resp_show(req, file); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Jul 23 11:58: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 12D9CBA20DB for ; Sat, 23 Jul 2016 11:58:37 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) (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 881EC1C08 for ; Sat, 23 Jul 2016 11:58:36 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f42.google.com with SMTP id l69so101208070lfg.1 for ; Sat, 23 Jul 2016 04:58:35 -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; bh=XcOD73ngZ0WvoMbGTmuJTnOYJC5YUnmqG4MmqwS+lZk=; b=OegUdIdFE7sMCe2uvp34cYi13mptyHiwcD/xeXYH6bKpFQASgIyG2sI53IWfdaErPk seA+g1oCjUw0rO7zGyPpbF9kW+QSaoeUmQtGx3bEE70uJ8E0zRxgHdN1/vWoZ/ZUFkQT k1irk9ogPZm8DcJ65B3C+tb9Ww0XLUnepamBbZHyeLJHtsnsdxKrlYAHNf0Ozpnin7G9 Q42g3PgthXNNTLRP43qTCxPdp23Q0+k+g7mndShc6L5bfF6GR9Bhu3eIWjhp3mZnpEQ9 jFVu9BYLD5a0Vfe++bFzA7f+etp8veoLypQPzqLj2mM1YdAjxohRvdu1f5XRYb5RWK2z lLKA== X-Gm-Message-State: AEkoouu5MKJF4SsGrPSuppXE9zFHjI01WG+92mymRtX3A/CUbh8wOK9cm8rVxWGagaLIOA== X-Received: by 10.46.71.134 with SMTP id u128mr4325959lja.67.1469275113848; Sat, 23 Jul 2016 04:58:33 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id 88sm3822753lfr.23.2016.07.23.04.58.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jul 2016 04:58:33 -0700 (PDT) Subject: Re: svn commit: r303218 - head/tools/tools/locale/tools To: Baptiste Daroussin References: <201607231124.u6NBO5aJ003824@repo.freebsd.org> <97566d46-1d37-8c95-f276-f55b190bddbb@freebsd.org> <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: <2ddb2814-9edf-82a9-350c-aebf34cdb4ab@freebsd.org> Date: Sat, 23 Jul 2016 14:58:31 +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: <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c719DQnWuwRDbuGWadllGI5ds0xRVXSk1" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 11:58:37 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --c719DQnWuwRDbuGWadllGI5ds0xRVXSk1 Content-Type: multipart/mixed; boundary="QGlqblNLqdwlrsXHVr44uwFH7Jr9wgQr7" From: Andrey Chernov To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <2ddb2814-9edf-82a9-350c-aebf34cdb4ab@freebsd.org> Subject: Re: svn commit: r303218 - head/tools/tools/locale/tools References: <201607231124.u6NBO5aJ003824@repo.freebsd.org> <97566d46-1d37-8c95-f276-f55b190bddbb@freebsd.org> <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> In-Reply-To: <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> --QGlqblNLqdwlrsXHVr44uwFH7Jr9wgQr7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 23.07.2016 14:52, Baptiste Daroussin wrote: > On Sat, Jul 23, 2016 at 02:41:39PM +0300, Andrey Chernov wrote: >> On 23.07.2016 14:24, Baptiste Daroussin wrote: >>> Author: bapt >>> Date: Sat Jul 23 11:24:05 2016 >>> New Revision: 303218 >>> URL: https://svnweb.freebsd.org/changeset/base/303218 >>> >>> Log: >>> Add another hack to add weekday to date format to more locales >>> >>> While here only initialize the iconv converter when needed >>> >>> Modified: >>> head/tools/tools/locale/tools/cldr2def.pl >> >> BTW, is there any progress in generating all collates with -m ${area} = as >> you planned? >> > you mean the @modifier? No, I mean that: >> Perhaps all uk_UA should be generated with -m ${area} too - Ukrainians= >> have extended Cyrillics in their alphabet and I am not sure that their= >> order match default Unicode order for Cyrillic. The same about be_BY, >> bg_BG and sr_Cyrl_RS. They may match or may not, I don't check such >deeply. >> >> It seems the safest side will be to generate all with -m ${area} >> >Yes that is my plan, except for the 1 or 2 that cannot be generated >from cldr >directly --QGlqblNLqdwlrsXHVr44uwFH7Jr9wgQr7-- --c719DQnWuwRDbuGWadllGI5ds0xRVXSk1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJXk1vnAAoJEKUckv0MjfbKT44H/2btp8AhZ8B/vZJbtSnf90HP xRIDLOsCzGPiZb7AS+K8gvET1CrayExyQ8WBor8bilGYO297er/JP3PDEGQ4FKC0 5D0Q6g4JwWoIZSdQVgXk6f4vrIeZ3DF+gK1j4GU1rPX7WGbUhNJPemubZQ6GvHJD XiVKh96NrcaowFj7lYHGkmeQvLU8Ir0XE2vBNc53Y4wFH4HC0cYks/CCwBy8O9CW 0YEmtGT4XeQeghoP4g9QyR1FcG/+S5REKxKFrNoNNo8BpV4yXZ+immWhzOk9liln LzhDU/dP07uyg4ZUM/IAo/0jpumL8yPuCtBA9XLjRoZ2e/syhov40tgDjvzbvqs= =moAl -----END PGP SIGNATURE----- --c719DQnWuwRDbuGWadllGI5ds0xRVXSk1-- From owner-svn-src-head@freebsd.org Sat Jul 23 12:32: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 44200BA1280; Sat, 23 Jul 2016 12:32:33 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) (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 C1E091355; Sat, 23 Jul 2016 12:32:32 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x230.google.com with SMTP id i5so98327481wmg.0; Sat, 23 Jul 2016 05:32:32 -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=YiY5mmwzoPunz1HiFMlxrC46ks+QBQ3LeuTziKq2ZlA=; b=dteWADFzg6TvV36pJGJTrGegHB8mbpeJ+zlq3wjR9mKcwIDPKVJL1UKJNlzk9zuTd8 kXmhvmPAl8k98FUfP9TRCoCEQHnTctD2Jr1qw8cSJBOb0mxIFJIYt2RzLgS8Whq+T5Id KxAHPOt6HtjC7dRdq+vYtvvIFcWFuHIn1+xFnCF1mXgiHv1U9KOc2UufJvTwqgV8tjZT P+ljeA5RcKhSlgEvcUir2GFDagn4ux1GF/YA1cpQxmsCc03zABya4X6rggcf+N/ZfjBh r41ZwPI/hbwMT8+MWcHjDnWzZj7Zk2zhjmyH0/A2Gk20yUKt7t6eZpZm/3BwvTduYrVe fuoQ== 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=YiY5mmwzoPunz1HiFMlxrC46ks+QBQ3LeuTziKq2ZlA=; b=Rrm+KudbeZ4BWQeZRV+j84qwcO3xj7TaZU9U/bfbNte3odqTH0zu+o9Mkb/eO/k7G0 EbCn9Zs3rj1s/oydCkHpg18s9CaZgKvjgsAGvJnuojFBRL+CVdlQphDpsazJXSOv4Pkm An07vkQJPtstbzy1ecuKQaWepDC4KVW5MJBzbTinrYnrP0H+Dzg6QQvHUT9JLhPAPNsJ /Kj/9ZhgkaUeimdFduHAnSNaxOg66rsZOaxeNBDC/yBBRiI1Ejxadj4S8/FtsTEXhBVa 50J0xXyUrGG/tMzrrYoXw7w712FChqI8AiZIMO5rmtJrGdA/wrGpWkJAHMmtiSLKvoKP 0JMA== X-Gm-Message-State: AEkoouun4MYh0+y9TIRyR0yFU/XH82dKMp1vgswAo9hCxHtiN6bvtevERMYthel4K8ztiQ== X-Received: by 10.194.178.102 with SMTP id cx6mr6137713wjc.58.1469277150399; Sat, 23 Jul 2016 05:32:30 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id t188sm17330818wme.19.2016.07.23.05.32.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jul 2016 05:32:29 -0700 (PDT) Sender: Baptiste Daroussin Date: Sat, 23 Jul 2016 14:32:29 +0200 From: Baptiste Daroussin To: Andrey Chernov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303218 - head/tools/tools/locale/tools Message-ID: <20160723123228.i2tmxaklkoad6vkh@ivaldir.etoilebsd.net> References: <201607231124.u6NBO5aJ003824@repo.freebsd.org> <97566d46-1d37-8c95-f276-f55b190bddbb@freebsd.org> <20160723115244.76vhhzl55qoyw4kf@ivaldir.etoilebsd.net> <2ddb2814-9edf-82a9-350c-aebf34cdb4ab@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mkz54hc4x5cp7rya" Content-Disposition: inline In-Reply-To: <2ddb2814-9edf-82a9-350c-aebf34cdb4ab@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: Sat, 23 Jul 2016 12:32:33 -0000 --mkz54hc4x5cp7rya Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 23, 2016 at 02:58:31PM +0300, Andrey Chernov wrote: > On 23.07.2016 14:52, Baptiste Daroussin wrote: > > On Sat, Jul 23, 2016 at 02:41:39PM +0300, Andrey Chernov wrote: > >> On 23.07.2016 14:24, Baptiste Daroussin wrote: > >>> Author: bapt > >>> Date: Sat Jul 23 11:24:05 2016 > >>> New Revision: 303218 > >>> URL: https://svnweb.freebsd.org/changeset/base/303218 > >>> > >>> Log: > >>> Add another hack to add weekday to date format to more locales > >>> > >>> While here only initialize the iconv converter when needed > >>> > >>> Modified: > >>> head/tools/tools/locale/tools/cldr2def.pl > >> > >> BTW, is there any progress in generating all collates with -m ${area} = as > >> you planned? > >> > > you mean the @modifier? >=20 > No, I mean that: > >> Perhaps all uk_UA should be generated with -m ${area} too - Ukrainians > >> have extended Cyrillics in their alphabet and I am not sure that their > >> order match default Unicode order for Cyrillic. The same about be_BY, > >> bg_BG and sr_Cyrl_RS. They may match or may not, I don't check such > >deeply. > >> > >> It seems the safest side will be to generate all with -m ${area} > >> > >Yes that is my plan, except for the 1 or 2 that cannot be generated > >from cldr > >directly >=20 Nope I haven't made any progress, and I actually did a bunch of tests of so= me (honnestly not all locales) trying to get a representative set and could not find differnce in ordering between locales generated with -m ${area}. It would also needs lots of work on the generation tools. I first need to write a tool that compares collation rules for various ${ar= ea} (not done yet) to see how much this is really needed and use it in the generation tools. I will try to do that for 12 if it is really worth it (based on the result = =66rom that comparison tools) Best regards, Bapt --mkz54hc4x5cp7rya Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXk2PaAAoJEGOJi9zxtz5a/ywQAJqKPdKwDY+TLBb8P9viypoK JmZu57T2eB6uXN8cviu3uZ5h9leG079fsQX/vaeWkKhHcDlWSDXMkKpv8aK9bvZk 1VcSIdqX/kmadVcyBkKJ5K5GRR1I1ZCcFmlx78myKoSEmvjhdRUHMWrPOhoXK8mk f7XmBv7sACKikf4MN5Mxv4OiOfm42nViZoNlNgu/1BqLOGX5Z8RjojCjZ2B5I80c BdiGbeMQ2MHw3MTqNTM4gSgjW9/4r3Pdb+zx964I95q5L+WfrUsUAMrT2TIZ60ud JgILKuSLFC0NkG79mHNHkWhx5jH6lIf22W9LcbssxsMhqqh1qo+ykQ+900mAF2gQ lYvUn6uZu9udAKtP47HcJ++SkuLNt/hjJYlKq+BeyzQtPKrjhNUkhNES4nQ1SsJO BeOpxUx8bmGKEJ7oVN5Q7YqTdhXDl6k2HIYxKCA5JXVVjEmVW5MR3uHyW29AdS7v Q9kMyxTyFRFTgaYm1zNkCnx8qhXeAcQrfgjT6dIuzNC72n6HXRhfP/ZQrLUje+Xb 6r+bCDzV95OZMsrCr8aQNUYWb/q7CXtgjyCWMLObFwbfN+U7banONoWhEv+Og4ms RaOQl071/syCHuweNRfik9675FUkcp2i6YgAz5BKaaFaXW7CBGv9Piav+s9tYW/i d96JaXXhVc1vvU9M1X7J =XQyw -----END PGP SIGNATURE----- --mkz54hc4x5cp7rya-- From owner-svn-src-head@freebsd.org Sat Jul 23 12: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 71B08BA1353; Sat, 23 Jul 2016 12:34:33 +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 449A0154E; Sat, 23 Jul 2016 12:34:33 +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 u6NCYW9r029825; Sat, 23 Jul 2016 12:34:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NCYWkH029824; Sat, 23 Jul 2016 12:34:32 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607231234.u6NCYWkH029824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Jul 2016 12:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303224 - head/tools/tools/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: Sat, 23 Jul 2016 12:34:33 -0000 Author: bapt Date: Sat Jul 23 12:34:32 2016 New Revision: 303224 URL: https://svnweb.freebsd.org/changeset/base/303224 Log: Recode the new dependency on converters/p5-Text-Iconv Modified: head/tools/tools/locale/README Modified: head/tools/tools/locale/README ============================================================================== --- head/tools/tools/locale/README Sat Jul 23 11:55:15 2016 (r303223) +++ head/tools/tools/locale/README Sat Jul 23 12:34:32 2016 (r303224) @@ -2,7 +2,7 @@ To generate the locales: -Tools needed: java, perl and devel/p5-Tie-IxHash +Tools needed: java, perl, devel/p5-Tie-IxHash and converters/p5-Text-Iconv fetch cldr data from: http://cldr.unicode.org extract in a directory ~/unicode/cldr/v27.0.1 for example From owner-svn-src-head@freebsd.org Sat Jul 23 14:38: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 C51DABA2143; Sat, 23 Jul 2016 14:38:10 +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 7D0B41BC2; Sat, 23 Jul 2016 14:38:10 +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 u6NEc99F075709; Sat, 23 Jul 2016 14:38:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NEc9fG075708; Sat, 23 Jul 2016 14:38:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607231438.u6NEc9fG075708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 23 Jul 2016 14:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303225 - head/sys/dev/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 14:38:10 -0000 Author: jhb Date: Sat Jul 23 14:38:09 2016 New Revision: 303225 URL: https://svnweb.freebsd.org/changeset/base/303225 Log: Use MTX_SYSINIT for the VESA lock. vesa_init_done isn't a reliable guard for the mutex init. If vesa_configure() doesn't find valid VESA info it will not set vesa_init_done, but the lock will remain initialized. Revert r303076 and use MTX_SYSINIT to deterministically init the lock. Reviewed by: royger MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7290 Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Sat Jul 23 12:34:32 2016 (r303224) +++ head/sys/dev/fb/vesa.c Sat Jul 23 14:38:09 2016 (r303225) @@ -79,6 +79,7 @@ struct adp_state { typedef struct adp_state adp_state_t; static struct mtx vesa_lock; +MTX_SYSINIT(vesa_lock, &vesa_lock, "VESA lock", MTX_DEF); static int vesa_state; static void *vesa_state_buf; @@ -134,7 +135,6 @@ static vi_fill_rect_t vesa_fill_rect; static vi_bitblt_t vesa_bitblt; static vi_diag_t vesa_diag; static int vesa_bios_info(int level); -static int vesa_late_load(int flags); static video_switch_t vesavidsw = { vesa_probe, @@ -1142,7 +1142,7 @@ vesa_configure(int flags) * initialization for now and try again later. */ if (adp == NULL) { - vga_sub_configure = vesa_late_load; + vga_sub_configure = vesa_configure; return (ENODEV); } @@ -1910,27 +1910,14 @@ vesa_bios_info(int level) static int vesa_load(void) { - - return (vesa_late_load(0)); -} - -/* - * To be called from the vga_sub_configure hook in case the VGA adapter is - * not found when VESA is loaded. - */ -static int -vesa_late_load(int flags) -{ int error; if (vesa_init_done) return (0); - mtx_init(&vesa_lock, "VESA lock", NULL, MTX_DEF); - /* locate a VGA adapter */ vesa_adp = NULL; - error = vesa_configure(flags); + error = vesa_configure(0); if (error == 0) vesa_bios_info(bootverbose); @@ -1966,7 +1953,6 @@ vesa_unload(void) } vesa_bios_uninit(); - mtx_destroy(&vesa_lock); return (error); } From owner-svn-src-head@freebsd.org Sat Jul 23 15:12: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 8EEF1BA29DB; Sat, 23 Jul 2016 15:12:04 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58FDF1AE7; Sat, 23 Jul 2016 15:12:04 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6NFC3dP089401; Sat, 23 Jul 2016 15:12:03 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NFC3DD089400; Sat, 23 Jul 2016 15:12:03 GMT (envelope-from np@FreeBSD.org) Message-Id: <201607231512.u6NFC3DD089400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 23 Jul 2016 15:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303226 - 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: Sat, 23 Jul 2016 15:12:04 -0000 Author: np Date: Sat Jul 23 15:12:03 2016 New Revision: 303226 URL: https://svnweb.freebsd.org/changeset/base/303226 Log: Fix kernel builds with "device cxgbe". Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Jul 23 14:38:09 2016 (r303225) +++ head/sys/conf/files Sat Jul 23 15:12:03 2016 (r303226) @@ -1243,6 +1243,7 @@ dev/cxgb/sys/uipc_mvec.c optional cxgb p compile-with "${NORMAL_C} -I$S/dev/cxgb" dev/cxgb/cxgb_t3fw.c optional cxgb cxgb_t3fw \ compile-with "${NORMAL_C} -I$S/dev/cxgb" +dev/cxgbe/t4_if.m optional cxgbe pci dev/cxgbe/t4_iov.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_mp_ring.c optional cxgbe pci \ From owner-svn-src-head@freebsd.org Sat Jul 23 17:36: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 28B33BA1964; Sat, 23 Jul 2016 17:36:19 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDA218F7; Sat, 23 Jul 2016 17:36:18 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6NHaIwN042072; Sat, 23 Jul 2016 17:36:18 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NHaISG042071; Sat, 23 Jul 2016 17:36:18 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201607231736.u6NHaISG042071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 23 Jul 2016 17:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303227 - head/sys/arm/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: Sat, 23 Jul 2016 17:36:19 -0000 Author: loos Date: Sat Jul 23 17:36:17 2016 New Revision: 303227 URL: https://svnweb.freebsd.org/changeset/base/303227 Log: Remove unused USB ethernet driver from BEAGLEBONE/AM335x kernel. Modified: head/sys/arm/conf/BEAGLEBONE Modified: head/sys/arm/conf/BEAGLEBONE ============================================================================== --- head/sys/arm/conf/BEAGLEBONE Sat Jul 23 15:12:03 2016 (r303226) +++ head/sys/arm/conf/BEAGLEBONE Sat Jul 23 17:36:17 2016 (r303227) @@ -113,7 +113,6 @@ device bpf # USB Ethernet support, requires miibus device miibus -device axe # ASIX Electronics USB Ethernet # Device mode support and USFS template device usb_template # Control of the gadget From owner-svn-src-head@freebsd.org Sat Jul 23 18: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 C5719BA23D7; Sat, 23 Jul 2016 18:16:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95C9B1C0C; Sat, 23 Jul 2016 18:16:41 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6NIGefM056931; Sat, 23 Jul 2016 18:16:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NIGeXm056929; Sat, 23 Jul 2016 18:16:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201607231816.u6NIGeXm056929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 23 Jul 2016 18:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303230 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: 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, 23 Jul 2016 18:16:41 -0000 Author: loos Date: Sat Jul 23 18:16:40 2016 New Revision: 303230 URL: https://svnweb.freebsd.org/changeset/base/303230 Log: Add support for the Microchip/Micrel KSZ9031 Gigabit Ethernet PHY. Tested on uBMC and uFW. Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/dev/mii/micphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/micphy.c ============================================================================== --- head/sys/dev/mii/micphy.c Sat Jul 23 17:41:47 2016 (r303229) +++ head/sys/dev/mii/micphy.c Sat Jul 23 18:16:40 2016 (r303230) @@ -67,6 +67,14 @@ __FBSDID("$FreeBSD$"); #define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104 #define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 #define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 +/* KSZ9031 */ +#define MII_KSZ9031_MMD_ACCESS_CTRL 0x0d +#define MII_KSZ9031_MMD_ACCESS_DATA 0x0e +#define MII_KSZ9031_MMD_DATA_NOINC (1 << 14) +#define MII_KSZ9031_CONTROL_PAD_SKEW 0x4 +#define MII_KSZ9031_RX_DATA_PAD_SKEW 0x5 +#define MII_KSZ9031_TX_DATA_PAD_SKEW 0x6 +#define MII_KSZ9031_CLOCK_PAD_SKEW 0x8 #define PS_TO_REG(p) ((p) / 200) @@ -95,6 +103,7 @@ DRIVER_MODULE(micphy, miibus, micphy_dri static const struct mii_phydesc micphys[] = { MII_PHY_DESC(MICREL, KSZ9021), + MII_PHY_DESC(MICREL, KSZ9031), MII_PHY_END }; @@ -104,48 +113,128 @@ static const struct mii_phy_funcs micphy mii_phy_reset }; +static uint32_t +ksz9031_read(struct mii_softc *sc, uint32_t devaddr, uint32_t reg) +{ + /* Set up device address and register. */ + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_CTRL, devaddr); + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_DATA, reg); + + /* Select register data for MMD and read the value. */ + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_CTRL, + MII_KSZ9031_MMD_DATA_NOINC | devaddr); + + return (PHY_READ(sc, MII_KSZ9031_MMD_ACCESS_DATA)); +} + +static void +ksz9031_write(struct mii_softc *sc, uint32_t devaddr, uint32_t reg, + uint32_t val) +{ + + /* Set up device address and register. */ + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_CTRL, devaddr); + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_DATA, reg); + + /* Select register data for MMD and write the value. */ + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_CTRL, + MII_KSZ9031_MMD_DATA_NOINC | devaddr); + PHY_WRITE(sc, MII_KSZ9031_MMD_ACCESS_DATA, val); +} + +static uint32_t +ksz9021_read(struct mii_softc *sc, uint32_t reg) +{ + + PHY_WRITE(sc, MII_KSZPHY_EXTREG, reg); + + return (PHY_READ(sc, MII_KSZPHY_EXTREG_READ)); +} + static void -micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) +ksz9021_write(struct mii_softc *sc, uint32_t reg, uint32_t val) { PHY_WRITE(sc, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | reg); PHY_WRITE(sc, MII_KSZPHY_EXTREG_WRITE, val); } -static int -ksz9021_load_values(struct mii_softc *sc, phandle_t node, uint32_t reg, - char *field1, char *field2, - char *field3, char *field4) +static void +ksz90x1_load_values(struct mii_softc *sc, phandle_t node, + uint32_t dev, uint32_t reg, char *field1, uint32_t f1mask, int f1off, + char *field2, uint32_t f2mask, int f2off, char *field3, uint32_t f3mask, + int f3off, char *field4, uint32_t f4mask, int f4off) { pcell_t dts_value[1]; int len; int val; - val = 0; + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031) + val = ksz9031_read(sc, dev, reg); + else + val = ksz9021_read(sc, reg); if ((len = OF_getproplen(node, field1)) > 0) { OF_getencprop(node, field1, dts_value, len); - val = PS_TO_REG(dts_value[0]); + val &= ~(f1mask << f1off); + val |= (PS_TO_REG(dts_value[0]) & f1mask) << f1off; } - if ((len = OF_getproplen(node, field2)) > 0) { + if (field2 != NULL && (len = OF_getproplen(node, field2)) > 0) { OF_getencprop(node, field2, dts_value, len); - val |= PS_TO_REG(dts_value[0]) << 4; + val &= ~(f2mask << f2off); + val |= (PS_TO_REG(dts_value[0]) & f2mask) << f2off; } - if ((len = OF_getproplen(node, field3)) > 0) { + if (field3 != NULL && (len = OF_getproplen(node, field3)) > 0) { OF_getencprop(node, field3, dts_value, len); - val |= PS_TO_REG(dts_value[0]) << 8; + val &= ~(f3mask << f3off); + val |= (PS_TO_REG(dts_value[0]) & f3mask) << f3off; } - if ((len = OF_getproplen(node, field4)) > 0) { + if (field4 != NULL && (len = OF_getproplen(node, field4)) > 0) { OF_getencprop(node, field4, dts_value, len); - val |= PS_TO_REG(dts_value[0]) << 12; + val &= ~(f4mask << f4off); + val |= (PS_TO_REG(dts_value[0]) & f4mask) << f4off; } - micphy_write(sc, reg, val); + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031) + ksz9031_write(sc, dev, reg, val); + else + ksz9021_write(sc, reg, val); +} - return (0); +static void +ksz9031_load_values(struct mii_softc *sc, phandle_t node) +{ + + ksz90x1_load_values(sc, node, 2, MII_KSZ9031_CONTROL_PAD_SKEW, + "txen-skew-ps", 0xf, 0, "rxdv-skew-ps", 0xf, 4, + NULL, 0, 0, NULL, 0, 0); + ksz90x1_load_values(sc, node, 2, MII_KSZ9031_RX_DATA_PAD_SKEW, + "rxd0-skew-ps", 0xf, 0, "rxd1-skew-ps", 0xf, 4, + "rxd2-skew-ps", 0xf, 8, "rxd3-skew-ps", 0xf, 12); + ksz90x1_load_values(sc, node, 2, MII_KSZ9031_TX_DATA_PAD_SKEW, + "txd0-skew-ps", 0xf, 0, "txd1-skew-ps", 0xf, 4, + "txd2-skew-ps", 0xf, 8, "txd3-skew-ps", 0xf, 12); + ksz90x1_load_values(sc, node, 2, MII_KSZ9031_CLOCK_PAD_SKEW, + "rxc-skew-ps", 0x1f, 0, "txc-skew-ps", 0x1f, 5, + NULL, 0, 0, NULL, 0, 0); +} + +static void +ksz9021_load_values(struct mii_softc *sc, phandle_t node) +{ + + ksz90x1_load_values(sc, node, 0, MII_KSZPHY_CLK_CONTROL_PAD_SKEW, + "txen-skew-ps", 0xf, 0, "txc-skew-ps", 0xf, 4, + "rxdv-skew-ps", 0xf, 8, "rxc-skew-ps", 0xf, 12); + ksz90x1_load_values(sc, node, 0, MII_KSZPHY_RX_DATA_PAD_SKEW, + "rxd0-skew-ps", 0xf, 0, "rxd1-skew-ps", 0xf, 4, + "rxd2-skew-ps", 0xf, 8, "rxd3-skew-ps", 0xf, 12); + ksz90x1_load_values(sc, node, 0, MII_KSZPHY_TX_DATA_PAD_SKEW, + "txd0-skew-ps", 0xf, 0, "txd1-skew-ps", 0xf, 4, + "txd2-skew-ps", 0xf, 8, "txd3-skew-ps", 0xf, 12); } static int @@ -174,17 +263,10 @@ micphy_attach(device_t dev) if ((node = ofw_bus_get_node(parent)) == -1) return (ENXIO); - ksz9021_load_values(sc, node, MII_KSZPHY_CLK_CONTROL_PAD_SKEW, - "txen-skew-ps", "txc-skew-ps", - "rxdv-skew-ps", "rxc-skew-ps"); - - ksz9021_load_values(sc, node, MII_KSZPHY_RX_DATA_PAD_SKEW, - "rxd0-skew-ps", "rxd1-skew-ps", - "rxd2-skew-ps", "rxd3-skew-ps"); - - ksz9021_load_values(sc, node, MII_KSZPHY_TX_DATA_PAD_SKEW, - "txd0-skew-ps", "txd1-skew-ps", - "txd2-skew-ps", "txd3-skew-ps"); + if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031) + ksz9031_load_values(sc, node); + else + ksz9021_load_values(sc, node); return (0); } Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Sat Jul 23 17:41:47 2016 (r303229) +++ head/sys/dev/mii/miidevs Sat Jul 23 18:16:40 2016 (r303230) @@ -283,6 +283,7 @@ model MARVELL E1111 0x000c Marvell 88E1 /* Micrel PHYs */ model MICREL KSZ9021 0x0021 Micrel KSZ9021 10/100/1000 PHY +model MICREL KSZ9031 0x0022 Micrel KSZ9031 10/100/1000 PHY /* Myson Technology PHYs */ model xxMYSON MTD972 0x0000 MTD972 10/100 media interface From owner-svn-src-head@freebsd.org Sat Jul 23 18:35: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 37B20BA2760; Sat, 23 Jul 2016 18:35:46 +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 1F35C1708; Sat, 23 Jul 2016 18:35:45 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6NIZeSY028874 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 23 Jul 2016 11:35:41 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578E0B5D.3070105@FreeBSD.org> <578F6075.7010500@FreeBSD.org> <05a80ac6-4285-ec9d-36e9-2f92c609f746@freebsd.org> <57907B0F.9070204@FreeBSD.org> <9d2a224c-b787-2875-5984-a7a2354e8695@freebsd.org> <57934ABD.6010807@FreeBSD.org> From: Nathan Whitehorn Message-ID: <4e7a3e8f-cc21-f5f2-e3e0-4dbd554a4cd0@freebsd.org> Date: Sat, 23 Jul 2016 11:35:40 -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: <57934ABD.6010807@FreeBSD.org> X-Sonic-CAuth: UmFuZG9tSVYYrYWhzVAAn8xzx+7OfzqbRxvYg0t+VLfN/Rm73SUmdhq48vGTVVEVFJMVuIr5eCdLMjJpwACwzxBSCz2IOla/OiZZVsxy5NI= X-Sonic-ID: C;HBzGQQRR5hGwZpNwxPCmMQ== M;xFwFQgRR5hGwZpNwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: Sat, 23 Jul 2016 18:35:46 -0000 On 07/23/16 03:45, Michal Meloun wrote: > Dne 21.07.2016 v 17:53 Nathan Whitehorn napsal(a): >> >> On PowerPC, GENERIC64 supports FDT systems (some IBM hardware), OFW >> systems (Macs, some IBM hardware), systems with no device trees at >> all (old-style PS3), and systems with a mixture of device tree and no >> device tree (new-style PS3). On these, there is a mixture of "real" >> interrupts and GPIO-type interrupts. There is no limitation that this >> be used only for device-tree-type systems. >> >> The system requires two things: an interrupt domain key and an >> arbitrary unique byte string describing the interrupt. When running >> with a device tree, these are set to the phandle of the >> interrupt-parent and the contents of the device tree interrupt >> specifier, respectively, and the system was of course developed with >> that in mind. But they don't need to be, and often aren't. You could >> make the domain an element of an enum (where "ACPI" is a choice, for >> instance -- this is what PS3 does), or set it to a pointer to a >> device_t, or really anything you like. Similarly, the interrupt >> specifier is totally free-form. > > Yes, I agree. and i think that we followed the same direction. But i > see two problems with this approach. > - in some cases (OFW, device_t) you don't have control over domain > key value, so you cannot guarantee its uniqueness. > Of course, probability of collision is low, but it is. We could solve this in a number of ways, for example widening to 64 bits, or adding another value (domain type, for example). You could also make an acpi_bus_map_intr() to go with the OFW one that connect in some machine-dependent code if you have fundamentally incompatible bus enumeration mechanisms that you expect to exist simultaneously -- but, of course, no systems like this seem to actually exist, so the problem is both easily solved and totally theoretical. > - within ofw_bus_map_intr() (or later - at the time when byte string > must be decoded) you are not able (easily) to differentiate > between different formats, thus you are not able to select > appropriate decoder. The GPIO controller, for example, > must be able to handle interrupts defined by standard OFW property, > or by pair concurrently. In principle, you could solve that as above, or by registering a second interrupt domain for the same controller. In practice, it doesn't matter since, in the GPIO case, for example, the GPIO controller is never itself also a normal interrupt controller (i.e. the GIC and GPIO controller are always different devices). As such, the theoretical does not occur in practice. > For this reason we makes domain key composite, in our model, the > domain key consist of "domain key type" > and "domain key value". This composite key guarantees uniqueness and > it also allows to select proper parser for byte string. Yes, but this solves what is a nonexistant problem by making the system substantially less flexible and more invasive. Which is not a good tradeoff. > This is, imho, only one difference between us. One of many, yes. > >> You could, for instance, set it to one of the structures introduced >> in r301453 if you wanted to. >> >> I would have zero problems with changing the prototype of the >> existing dev/ofw function to something more generic in name, like: >> >> bus_map_intr(device_t dev, uintptr_t iparent, size_t intrlen, void *intr) >> >> instead of the existing equivalent: >> >> ofw_bus_map_intr(device_t dev, phandle_t iparent, int icells, pcell_t >> *intr) >> > Our bus_map_intr() method is not indeed as replacement of > ofw_bus_map_intr(). Its evolution of "how we can store more complex > data to resource list (from bus enumerator) and transfer it to > bus_allocate_resource() and/or to bus_setup_intr()" in driver > independent way. We found no reasonable way to do it, so we postponed > reading of properties to bus_allocate_resource() time. Right, but that is (a) a solved problem with ofw_bus_map_intr() and (b) this code doesn't solve it as completely. What does it let you do that the existing code does not? There has not been a single concrete example of something anyone wants to do on actual hardware so far in this discussion. > But now jhb@ gives us alternative and I must say that this looks like > a clean and elegant way how to make this (assuming that we can expand > resource_list_entry by pointer to alloc_resource_args) Except that jhb@'s suggestion doesn't actually work for interrupts for the reasons I and others have pointed out. We could make such a system, but it would be a different one. > >>> By this, one byte string in OFW encoding can describe one IRQ and >>> exactly same string in UEFI encoding can describe different IRQ. >>> Or, in reverse, OFW and UEFI can describe same (and compatible) IRQ >>> by two different strings. >>> This is exact reason, why we discards virtual IRQ idea and I think >>> that this fact is root issue of this clash. >>> Probably it doesn't make sense to talk about others, unless we can >>> find consensus on this. >> >> You have the larger problem if you end up in this situation that you >> are enumerating the hardware by two different and incompatible >> techniques. There simply is no way to solve this unless you either >> (a) segregate the system into an ACPI-enumerated domain and an >> OF-enumerated domain, in which case the problem vanishes, (b) discard >> one enumeration, which is what arm64 does and will always do, >> according to Andrew in another post, or (c) make some incredibly >> complex merging code that would naturally handle interrupts with >> everything else. So I don't think this is an actual, real problem. >> > I think that above proposed solution resolves this gracefully. Assuming you are talking about jhb's decoration plan in the bus hierarchy, it doesn't actually work for interrupts at all because of lateral connections and circular dependencies. > >> >>>> >>>>> >>>>>> 2. It partially duplicates the functionality of >>>>>> OFW_BUS_MAP_INTR(), but is both problematically more general and >>>>>> less flexible (it has requirements on timing of PIC attachment >>>>>> vs. driver resource allocation) >>>>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>>>> parsed data are magicaly stored within the call. >>>>> The new method, bus_map_intr(), can parse data from multiple >>>>> sources (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). >>>>> It also returns parsed data back to caller. >>>> >>>> That is not true. It works as long as you can specify the interrupt >>>> state as a 32-bit key of some kind for the PIC and a string of >>>> arbitrary data, which works with all of those. You could even make >>>> the interrupt data be a pointer to exactly the structs you have >>>> chosen to define here. >>> Nope, in heterogeneous world, same string can describe two different >>> IRQs and/or two different strings can describe single IRQ in >>> compatible manner. >> >> Can you give *any* concrete example of this that doesn't involve >> mixed ACPI/FDT enumeration of a single system where devices appear in >> both trees, which doesn't actually ever happen? > GPIO - its interrupt function can be accessed by regular "interrupts" > property, or it can be derived from GPIO pin. The GPIO controller has one or more interrupts assigned to it that are part of its parent's interrupt domain. It cascades them to one or more virtual interrupts that belong to its own domain. Where is the ambiguity or complication here? >> >>>> >>>>> >>>>>> 3. It is not fully transparent to end code. Since it happens at >>>>>> bus_alloc_resource() time, it is complicated to get the >>>>>> appropriate values for IRQs constructed by composite techniques >>>>>> (interrupt-map vs. interrupts vs. hand allocation vs. PCI >>>>>> routing, for example). >>>>> I don't see any limitation - can you be more exact? Why is not >>>>> transparent? Why is more complicated ? >>>> >>>> Suppose that a PCI device adds more IRQs to its resource list or >>>> modifies the ordering. How is whatever bus layer supposed to do >>>> something sensible at allocation time? It requires that RID numbers >>>> mean something to the parent bus after assignment, which is not >>>> guaranteed by anything and is, in more than handful of cases I >>>> think of, not true in practice. >>> Sure. And since the new code allows delivering resources in RL, so I >>> don't see any limitation here. >> >> It indexed mapping by RID and then searches interrupt lists by that >> to get the interrupt-parent. This is fundamentally a broken design if >> the child needs to, say, add a second interrupt to its RL on a >> different interrupt-parent. > ?? I don't understand. The new code doesn't need this. int bus_generic_map_intr(device_t dev, device_t child, int *rid, rman_res_t *start, rman_res_t *end, rman_res_t *count, struct intr_map_data **imd); This works either by rid or by rman_res_t. In the event of a self-assigned interrupt from the child, which is a fairly common case, neither of these values are meaningfully parseable by the bus parent, especially if the interrupt is on a different controller. The main issue is that this code goes back to the device tree according to the *parent*'s idea of how it should be parsed and there are many cases (GPIO interrupts, for example) when the *child* needs to amend the list in a different way. > >> >>> >>>> >>>>>> It is much easier to do this correctly at bus attach time when >>>>>> the resource lists are made (how PPC does it). >>>>>> >>>>> I don't agree. I don't agree. Making this at bus attach time leads >>>>> into complicated 'virtual' IRQ infrastructure, with many >>>>> unresolved corner cases. >>>> >>>> Which unresolved corner cases? This has been working correctly on a >>>> number of platforms in both FreeBSD and Linux for many years. >>> Nope, it doesn't work for ARM yet (for GPIO interrupts for example) >>> and Linux uses EPROBE_DEFER mechanism for a long time. >>> See: http://lxr.free-electrons.com/source/drivers/base/platform.c#L87 >> >> There is some missing code on ARM (probably about 30 minutes of work >> to make it match PowerPC) to make it work in an ideal case, sure, but >> there is no reason you could not go out right now, with the existing >> code, and implement GPIO interrupts by declaring the GPIO driver as >> an interrupt controller. >> >> Can you give any concrete case of something that doesn't work? > GPIO again. How you can allocate interrupt associated with given gpio > pin installed by "cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;" You parse that as an interrupt on a interrupt domain associated with the GPIO controller referenced by &gpio. In pseudo-code: int irq = ofw_bus_map_intr(dev, <&gpio>, ncells, ); The GPIO controller, meanwhile, has registered an interrupt domain for <&gpio> and is asked to decode and configure the interrupt defined by , which it knows how to parse. This is simple and straightforward. > >>> >>>> >>>>> >>>>>> (1) is easy to fix without API changes, but (2) and (3) are >>>>>> fundamental architectural problems that will bite us immediately >>>>>> down the road and cause a permanent schism between OF support on >>>>>> different platforms. >>>>>> >>>>>> Let me describe how this is handled on PowerPC (Linux on PPC >>>>>> solves the problem the same way). When constructing a resource >>>>>> list, bus drivers that construct them from OF properties call >>>>>> ofw_bus_map_intr() with the interrupt parent phandle and the >>>>>> array of cells corresponding to the interrupt. This thunks >>>>>> immediately to nexus, which connects to code in intr_machdep.c. >>>>>> Code there assigns a unique made-up virtual IRQ and returns it, >>>>>> caching the interrupt parent ID and opaque interrupt data (if the >>>>>> same string of data reappears later, you get back the same >>>>>> virtual IRQ of course). >>>>>> >>>>>> When PIC drivers attach and register themselves with the >>>>>> interrupt handling layer, all the interrupts for that PIC are >>>>>> passed to it along with the virtual IRQ. The PIC driver is >>>>>> supposed to know what its interrupt data mean, which can be >>>>>> safely guaranteed, and it presents the assigned virtual IRQ >>>>>> number to the kernel when dispatching interrupts. (IRQs >>>>>> configured after PIC attachment are passed through immediately). >>>>>> >>>>>> This accomplishes the following things: >>>>>> 1. Parsing interrupt data is moved to the PIC driver, which is >>>>>> the only place it can be done safely. >>>>> I don't see anything different comparing with INTRNG. >>>> >>>> What I am advocating *is* INTRNG, at least as originally conceived >>>> and implemented. >>>> >>>>>> 2. There is no ordering requirement on PIC attachment vs. the >>>>>> attachment of anything else. >>>>> I think thats is not a true - PIC must exist before >>>>> bus_alloc_resource() / bus_setup_intr() is called. >>>> >>>> It does not with the IRQ mapping infrastructure. Interrupts are set >>>> up at PIC attachment, whenever that occurs. >>>> >>> Assuming that bus_alloc_resource and bus_setup_intr() are close >>> thorougher and in linear piece of code, can i assume that you can >>> call bus_setup_intr() >>> without PIC attached ? >> >> Yes. > So driver can request and/or setup any random IRQ and gets success > from bus_alloc_resource() or bus_setup_intr()? > Do you think that is this right behavior? Yes. And it is a behavior required by newbus. >> >>>>> >>>>>> 3. Changes are extremely minimal relative to the "standard" >>>>>> interrupt flow: you only have to patch code that is already >>>>>> directly dealing with OF interrupts. >>>>> I don't see anything different comparing with INTRNG. >>>> >>>> Again, this was the original INTRNG architecture and is already >>>> implemented. As such, there are *no* changes required on ARM to get >>>> it. bus_map_intr() adds a bunch of new code, in parallel with the >>>> old code that also solves the problem, to no purpose. >>> So, on PPC, how i can get interrupt for GPIO pin described by this >>> property: >>> https://svnweb.freebsd.org/base/head/sys/gnu/dts/arm/tegra124-jetson-tk1.dts?revision=295436&view=markup#l1691 >>> >> >> The GPIO controller registers itself as an interrupt domain and >> decodes those strings as IRQ specifiers. When interrupts are >> configured, it does whatever it needs to do to configure them >> appropriately and dispatches them to the kernel when they occur. It's >> a pretty trivial cascaded interrupt configuration. And, since the >> VIRQ code does not need the interrupt controller attached in advance, >> you don't need to worry about attach order of wherever &gpio points >> and the SDHCI driver. >> >>>> >>>>>> 4. It happens at bus enumeration time, when results can be >>>>>> guaranteed self-consistent. >>>>> Where do you see any potential source of inconsistency in INTRNG? >>>> >>>> See the example above about modified interrupt lists. There is also >>>> no obvious way for a child device to construct an interrupt not >>>> assigned to it by the parent device from device tree properties >>>> without knowing in some detail what kind of interrupt needs to be >>>> built. >>>> >>>>> >>>>>> 5. It combines naturally with ofw_bus_lookup_imap() and friends >>>>>> in the interrupt-map case (e.g. for PCI). >>>>> Again, I don't see anything different. Proper parsing of interrupt >>>>> property is not a problem of INTRNG (but must be fixed, of course). >>>> >>>> But it is *already* fixed by the standard code that already exists. >>>> You are introducing a less-functional parallel code path here. >>> NO, its not fixed, at least not for ARM. >> >> Why not, concretely? I'm happy to write whatever code is missing if >> there's a bug. It can't be more than a few tens of lines in arm/intr.c. > Interrupt maps are not covered by current ARM code. This suggests otherwise: files.arm:dev/ofw/ofwpci.c optional fdt pci But it's quite possible that code is not being used as widely as it should, since it's a new introduction to the ARM tree. That the existing code is not being used broadly enough is hardly a reasonable to invent something new. >>>> >>>>>> >>>>>> I'm not sure what the right path forward is, but this code needs >>>>>> to be fixed. The PowerPC code is fully MI, and was the template >>>>>> for the original INTRNG, so it shouldn't be too bad to replace. >>>>>> -Nathan >>>>>> >>>>> >>>>> So, new INTRNG: >>>>> - Introduces new more general bus method that can parse interrupt >>>>> configuration >>>>> data from any source. Is this step backward? >>>> >>>> Yes, since it is more general in some sense, while simultaneously >>>> handling fewer cases than code that already exists and is implemented. >>>> >>>>> >>>>> - Old INTRNG and PPC code stores unparsed and/or parsed interrupt >>>>> data in >>>>> INTRNG and each consumer must query for them. This data sharing >>>>> also causes >>>>> significant locking issues. New INTRNG stores interrupt >>>>> configuration data into >>>>> given resource, so each relevant bus method can access it >>>>> immediately. >>>>> Is this step backward? >>>> >>>> Which locking issues? And yes, it is. >>>> >>>>> >>>>> - New INTRNG is not OFW centric, it can works with virtually >>>>> unlimited number >>>>> of configuration data sources. Is this step backward? >>>> >>>> Also yes, because it makes the interrupt handles less opaque, which >>>> makes the infrastructure less flexible. >>>> >>>>> - New INTRNG correctly uses standard system infrastructure. Real >>>>> IRQ number >>>>> is reserved in rman within bus_alloc_resource() call, interrupt >>>>> HW is >>>>> configured (only!) within bus_setup_intr() call. Is this step >>>>> backward? >>>> >>>> The "real" IRQ number is not well defined always, so requiring that >>>> is a step backwards, yes. >>>> >>>>> - New INTRNG completely eliminates huge and not always working virtual >>>>> IRQ concept. >>>> >>>> When does it "not always work"? It seems to, in fact, always work >>>> on multiple platforms and have for a long time in the face of all >>>> kinds of totally bizarre topologies and system architectures. >>>> >>>>> >>>>> >>>>> Don’t take me bad, I’m open to any change. But no, at this time, >>>>> I’m not ready to completely revert someone else's work – although >>>>> I am a co-author. >>>> >>>> I would urge, in the strongest possible terms, that this be backed >>>> out from stable/11 at least. We can add the new API back for 11.1 >>>> if we want it, but we totally lose the ability to change it later >>>> in the stable/11 cycle if it stays in now. >>>> -Nathan >>>> >>> The API is part of still unstable, experimental INTRNG, so its not >>> fixed we we can change it at any time, I think. >>> But yes, we forget to wrap new bus_map_intr() method (and >>> associated code) by #ifdef INTRNG. Is this sufficient for you? >> >> For HEAD, yes. I would like it out of stable/11 entirely until this >> discussion converges. >> -Nathan > The current code (in stable/11) works and is tested. I simple cannot > commit any untested change for stable tree mainly if is in BETA2 > stage. And I cannot fully test the requested change, at this time i > have access to single ARM platform. > But we're in the same situation - both have the same commit bit, > neither one of us is the author of the disputed commit and neither of > us are not able to fully test it. > So feel free to commit what you want, if you have courage to commit > untested code. I haven't it...\ > Michal > Well, the code isn't actually used anywhere in stable/11, or HEAD, so it can't possibly be either tested or important for the functionality of any current code. As such, I will revert from HEAD on Monday and request an MFC from re@ following that if the author has not appeared by that time. -Nathan From owner-svn-src-head@freebsd.org Sat Jul 23 18:36: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 C07CDBA27CE; Sat, 23 Jul 2016 18:36:48 +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 ABF0118B3; Sat, 23 Jul 2016 18:36:48 +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 d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6NIakko030364 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 23 Jul 2016 11:36:46 -0700 Subject: Re: svn commit: r301453 - in head/sys: arm/arm arm64/arm64 dev/fdt dev/gpio dev/iicbus dev/ofw dev/pci dev/vnic kern mips/mips sys To: Michal Meloun , John Baldwin , Andrew Turner References: <201606051620.u55GKD5S066398@repo.freebsd.org> <578F6075.7010500@FreeBSD.org> <20160721133742.05f0e045@zapp> <13301107.Hm25rxUxW2@ralph.baldwin.cx> <57934F27.9070800@FreeBSD.org> Cc: Svatopluk Kraus , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org From: Nathan Whitehorn Message-ID: <2d0b7e5f-bdd8-095e-dd1f-1044164edc40@freebsd.org> Date: Sat, 23 Jul 2016 11:36:46 -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: <57934F27.9070800@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVY/tYnEpPkDU6/jsU+yO6cmoPh93qmLkCJo28VH+hU8C1XJd//sH23km3K8X3A+/L/jh7NmXT6PtozP5seFc5Ui2TOr1hxas40= X-Sonic-ID: C;DsrWaARR5hGeK5NwxPCmMQ== M;YGcUaQRR5hGeK5NwxPCmMQ== 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: Sat, 23 Jul 2016 18:36:48 -0000 On 07/23/16 04:04, Michal Meloun wrote: > Dne 21.07.2016 v 23:35 John Baldwin napsal(a): >> On Thursday, July 21, 2016 01:37:42 PM Andrew Turner wrote: >>> On Wed, 20 Jul 2016 13:28:53 +0200 >>> Michal Meloun wrote: >>>> Dne 19.07.2016 v 17:06 Nathan Whitehorn napsal(a): >>>>> 2. It partially duplicates the functionality of OFW_BUS_MAP_INTR(), >>>>> but is both problematically more general and less flexible (it has >>>>> requirements on timing of PIC attachment vs. driver resource >>>>> allocation) >>>> OFW_BUS_MAP_INTR() can parse only OFW based data and expect that >>>> parsed data are magicaly stored within the call. >>>> The new method, bus_map_intr(), can parse data from multiple sources >>>> (OFW, UEFI / ACPI, synthetic[gpio device + pin number]). It also >>>> returns parsed data back to caller. >>>> And no, it doesn't add any additional timing requirements . >>> I've been looking at ACPI on arm64. So far I have not found the need >>> for this with ACPI as we don't need to send the data to the interrupt >>> controller driver to be parsed in the way OFW/FDT needs to. >> ACPI though has a gross hack where we call BUS_CONFIG_INTR on the IRQ >> in bus_alloc_resource(). What I had advocated in the discussions >> leading up to this was to have some sort of opaque structure containing >> a set of properties (the sort of thing bus_map_resource and make_dev_s >> use) that was passed up at bus_setup_intr() time. I think it should now >> be passed up at bus_alloc_resource() time instead, but it would allow bus >> drivers to "decorate" a SYS_RES_IRQ request as it goes up the device tree >> with properties that the interrupt controller can then associate with >> the IRQ cookie it allocates in its own code. I would let the particular >> structure have different layouts for different resource types. On x86 we >> would replace bus_config_intr by passing the level and trigger-mode in >> this structure. However, I could also see allowing the memattr to be >> set for a SYS_RES_MEMORY resource so you could have a much shorter way >> than an explicit bus_map_resource to map an entire BAR as WC for example: >> >> struct alloc_resource_args { >> size_t len; >> union { >> struct { >> enum intr_trigger trigger; >> enum intr_polarity polarity; >> } irq; >> struct { >> vm_memattr_t memattr; >> } memory; >> } >> } >> >> ... >> >> union alloc_resource_args args; >> >> init_alloc_resource_args(&args, sizeof(args)); >> args.memattr = VM_MEMATTR_WRITE_COMBINING; >> >> /* Uses WC for the implicit mapping. */ >> res = bus_alloc_resource(...., &args); >> >> ... >> >> foobus_alloc_resource(..., union alloc_resource_args *args) >> { >> union alloc_resource_args args2; >> >> switch (type) { >> case SYS_RES_IRQ: >> if (args == NULL) { >> init_alloc_resource_args(&args2, sizeof(args2)); >> args = &args2; >> } >> /* Replace call to BUS_CONFIG_INTR on ACPI: */ >> if (args->irq.polarity == INTR_POLARITY_CONFORMING && >> device_has_polarity_from_CRS) >> args->irq.polarity = polarity_from_CRS; >> ... >> } >> >> However, you could associate arbitrary data with a resource request by >> adding more members to the approriate struct in the union. >> > I like this idea. Mainly if we can add 'struct alloc_resource_args' into > 'struct resource_list_entry' and, eventually, also into struct resource_i. > Inability to pass something more complex as single integer between bus > enumerator (aka resource_list_entry creator) and bus_alloc_resource() > (aka resource_list_entry consumer) is serious limitation. At lest for me :) > Michal > > Unfortunately, it doesn't actually work for resources that don't follow the bus hierarchy, however (see earlier follow-up emails to jhb from myself and others). -Nathan From owner-svn-src-head@freebsd.org Sat Jul 23 21:02: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 AB82CBA20AE; Sat, 23 Jul 2016 21:02:37 +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 7CABC1B00; Sat, 23 Jul 2016 21:02:37 +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 u6NL2a3f020000; Sat, 23 Jul 2016 21:02:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NL2aDD019999; Sat, 23 Jul 2016 21:02:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607232102.u6NL2aDD019999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 23 Jul 2016 21:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303243 - 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: Sat, 23 Jul 2016 21:02:37 -0000 Author: markj Date: Sat Jul 23 21:02:36 2016 New Revision: 303243 URL: https://svnweb.freebsd.org/changeset/base/303243 Log: Update a comment in vm_page_advise() to match behaviour after r290529. Reviewed by: alc MFC after: 3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Jul 23 20:50:47 2016 (r303242) +++ head/sys/vm/vm_page.c Sat Jul 23 21:02:36 2016 (r303243) @@ -3411,9 +3411,11 @@ vm_page_advise(vm_page_t m, int advice) vm_page_dirty(m); /* - * Place clean pages at the head of the inactive queue rather than the - * tail, thus defeating the queue's LRU operation and ensuring that the - * page will be reused quickly. + * Place clean pages near the head of the inactive queue rather than + * the tail, thus defeating the queue's LRU operation and ensuring that + * the page will be reused quickly. Dirty pages are given a chance to + * cycle once through the inactive queue before becoming eligible for + * laundering. */ _vm_page_deactivate(m, m->dirty == 0); } From owner-svn-src-head@freebsd.org Sat Jul 23 21:03: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 46433BA211F; Sat, 23 Jul 2016 21:03:26 +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 16B751C98; Sat, 23 Jul 2016 21:03:26 +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 u6NL3P56020077; Sat, 23 Jul 2016 21:03:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NL3PZx020076; Sat, 23 Jul 2016 21:03:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201607232103.u6NL3PZx020076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 23 Jul 2016 21:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303244 - 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: Sat, 23 Jul 2016 21:03:26 -0000 Author: markj Date: Sat Jul 23 21:03:25 2016 New Revision: 303244 URL: https://svnweb.freebsd.org/changeset/base/303244 Log: Correct a comment - each page queue has its own lock. Reviewed by: alc MFC after: 3 days Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Jul 23 21:02:36 2016 (r303243) +++ head/sys/vm/vm_pageout.c Sat Jul 23 21:03:25 2016 (r303244) @@ -267,7 +267,7 @@ vm_pageout_init_marker(vm_page_t marker, * * Lock vm object currently associated with `m'. VM_OBJECT_TRYWLOCK is * known to have failed and page queue must be either PQ_ACTIVE or - * PQ_INACTIVE. To avoid lock order violation, unlock the page queues + * PQ_INACTIVE. To avoid lock order violation, unlock the page queue * while locking the vm object. Use marker page to detect page queue * changes and maintain notion of next page on page queue. Return * TRUE if no changes were detected, FALSE otherwise. vm object is From owner-svn-src-head@freebsd.org Sat Jul 23 23:02: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 6B6B7BA3C2D; Sat, 23 Jul 2016 23:02:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id EC3191B76; Sat, 23 Jul 2016 23:02:07 +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 mail106.syd.optusnet.com.au (Postfix) with ESMTPS id BA0753C413C; Sun, 24 Jul 2016 09:02:01 +1000 (AEST) Date: Sun, 24 Jul 2016 09:02:01 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303225 - head/sys/dev/fb In-Reply-To: <201607231438.u6NEc9fG075708@repo.freebsd.org> Message-ID: <20160724032749.E841@besplex.bde.org> References: <201607231438.u6NEc9fG075708@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=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=S5zLlAOFFy1I2lzo9_AA: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: Sat, 23 Jul 2016 23:02:08 -0000 On Sat, 23 Jul 2016, John Baldwin wrote: > Log: > Use MTX_SYSINIT for the VESA lock. I wouldn't trust this either. > vesa_init_done isn't a reliable guard for the mutex init. If > vesa_configure() doesn't find valid VESA info it will not set > vesa_init_done, but the lock will remain initialized. Revert r303076 > and use MTX_SYSINIT to deterministically init the lock. I'm fixing consoles and needed very delicate modifications for the sio_inited guard that you added in sio. That basically works, but it needs complicated atomic locking. Early initialization is better, but MTX_SYSINIT()'s obfuscated order is wrong for console drivers: X enum sysinit_sub_id { X SI_SUB_DUMMY = 0x0000000, /* not executed; for linker*/ X SI_SUB_DONE = 0x0000001, /* processed*/ X SI_SUB_TUNABLES = 0x0700000, /* establish tunable values */ X SI_SUB_COPYRIGHT = 0x0800001, /* first use of console*/ X SI_SUB_VM = 0x1000000, /* virtual memory system init*/ X ... X SI_SUB_WITNESS = 0x1A80000, /* witness initialization */ X SI_SUB_MTX_POOL_DYNAMIC = 0x1AC0000, /* dynamic mutex pool */ X SI_SUB_LOCK = 0x1B00000, /* various locks */ MTX_SYSINIT() is in SI_SUB_LOCK, but console drivers want mutexes in (actually before) SI_SUB_COPYRIGHT, to avoid special cases. There are many other ordering bugs near here. The copyright never was the first use use of the console, at least on x86. kdb was. The careful ordering to get consoles initialized as early as practical so that kdb could be used is very broken now. In my i386 configuration, crashes or hangs for vm86 being used uninitialized just before kdb can be run to debug it. printf()s to consoles in getmemsize() are also broken. printf()s to the message buffer always were broken until after getmemsize(). amd64 doesn't use vm86 so it doesn't crash. The order in init386() is not as obfuscated as the above. syscons initializes its main lock (video_mtx) using mtx_init() before SI_SUB_COPYRIGHT, and that seems to work right. It guards this with 'cold' but that is bogus so I removed it. 'cold' is true until much later and is not needed early. Uninitialization is more broken for consoles than initialization, but is less of a problem since it is usually unreachable. It is only obviously reachable for dcons, and is obviously wrong there (cnremove() doesn't actually remove the console, but dcons tries it; no other driver even tries it). The SCHEDULER_STOPPED() hack caused me problems. My fixed console drivers know a little more about when it is safe to call mutex code than the mutex system does, except they don't want to know about this hack. They do a check like mtx_unowned() (but more fragile). mtx_unowned() also doesn't know about SCHEDULER_STOPPED(). mtx_unowned() works accidentally in more cases without INVARIANTS because the inlined mutex functions also don't know about SCHEDULER_STOPPED(). Usually they work normally. But when they would normally block, they call the public functions that don't block and do leave the mutex in an inconsistent state. Then without INVARIANTS, mtx_owned() in KASSERT() is annulled but direct mtx_owned() finds inconsistencies. Bruce