From owner-svn-src-all@freebsd.org Sun Sep 4 00:04:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC4DFBCFBBB; Sun, 4 Sep 2016 00:04:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC12C18F; Sun, 4 Sep 2016 00:04:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x235.google.com with SMTP id fu3so43236909pad.3; Sat, 03 Sep 2016 17:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=y0ol6cpD8dvuatRXA0/y6UQk85TXBkrekN2NFRv1VVI=; b=ffchu3h9PWoTWO7nz1PIHlbRBfFFnFnRyxuBmLwv9ieNYM0iWUxiUvHOeIlPCSko0/ UryVE9xEiUsFnI0qaiWPGRLmuPfKUOp+OkfLCzHFzBymV3sPLuQeK8UAwR+xRngLWOKU Yzp+eRvrwpGmLxlFYG8oHHJ9XAO4am8Sc5zSHnhqGvlb1qCXsF2R7UVIzd0UHlW2iyjU vbNBKlIDNd2looIUK6ZoUMBu2+p0uopRLocYwmLQxKi53Xosw4Zj7S9A3dTpMr8aawbs FjF5MtG1wVxFUrnGeAPWrvmZj/F+RaVZvEVYrw+y4wMMpBtliBkFzYqwMnARPU7VL5NC fpHA== 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=y0ol6cpD8dvuatRXA0/y6UQk85TXBkrekN2NFRv1VVI=; b=ScVefBiuldP4NUzd6rFXvACUWk1sV6PmnlWhvJyty3IjGyijmmjGoA0t6m+ZBIzs/u 644URCB3cNnf6FJO3fhOjYZxYcfEZEwHKQ0EEVJ/jGUhafa8YR+JiDN5GqheIr+C2+9t gC2/jEimAUI1KjjYbkyVuf8fBeGqod6dqCtNRO12/H1lJTlj8V62vtBgI9xtGxGXzTUH NwS4JTYx7TFoexgcp7mCRh5pkQTGI4v8MeqLicWQxuq0O63PkkxSvWgL1ezAyk9rVYcB BUfI/ZB0dxKeHXMiJCWI0GkXCWhZJVWj3bCku5oktf0e/5wbAQEoyoXDjXSq6rUqDr/H avsg== X-Gm-Message-State: AE9vXwNP3/9X4d0Z8UofUnUHrtQ+/bgqxKXZYK04RUCLUFeNewBbcqREtaUCzF0qyutPGQ== X-Received: by 10.66.151.9 with SMTP id um9mr26026722pab.85.1472947485098; Sat, 03 Sep 2016 17:04:45 -0700 (PDT) Received: from ?IPv6:2607:fb90:f32:78bf:2c41:bfdb:c7d9:2099? ([2607:fb90:f32:78bf:2c41:bfdb:c7d9:2099]) by smtp.gmail.com with ESMTPSA id xn11sm24135331pac.38.2016.09.03.17.04.44 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 03 Sep 2016 17:04:44 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r304947 - stable/11/tests/sys/kern/acct From: Ngie Cooper X-Mailer: iPhone Mail (13G36) In-Reply-To: <20160828174315.E1696@besplex.bde.org> Date: Sat, 3 Sep 2016 17:04:43 -0700 Cc: Garrett Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201608280710.u7S7Am7X057748@repo.freebsd.org> <20160828174315.E1696@besplex.bde.org> To: Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:04:46 -0000 > On Aug 28, 2016, at 01:49, Bruce Evans wrote: ... I agree. This commit in effect papered over the problem. More investigation w= ill be done with the PR that introduced the expected failure. Thanks! -Ngie >=20 > This can't depend on 64-bitness. It might depend on FLT_EPSILON, but > IEEE might require a specific representation of floats and we only have > and only support one. >=20 > This is probably a bug in the tests that shows up on arches with extra > precision. Perhaps just a complier bug. >=20 >> Modified: stable/11/tests/sys/kern/acct/acct_test.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 >> --- stable/11/tests/sys/kern/acct/acct_test.c Sun Aug 28 07:09:45 2016= (r304946) >> +++ stable/11/tests/sys/kern/acct/acct_test.c Sun Aug 28 07:10:48 2016= (r304947) >> @@ -204,7 +204,10 @@ ATF_TC_BODY(encode_tv_random_million, tc >> struct timeval tv; >> long k; >>=20 >> - atf_tc_expect_fail("the testcase violates FLT_EPSILON"); >> +#ifdef __LP64__ >> + atf_tc_expect_fail("the testcase violates FLT_EPSILON on 64-bit " >> + "platforms, e.g. amd64"); >> +#endif >>=20 >> ATF_REQUIRE_MSG(unsetenv("TZ") =3D=3D 0, "unsetting TZ failed; errno=3D= %d", errno); >=20 > The rest of the function is: >=20 > X for (k =3D 1; k < 1000000L; k++) { > X tv.tv_sec =3D random(); > X tv.tv_usec =3D (random() % 1000000L); > X v.c =3D encode_timeval(tv); > X check_result(atf_tc_get_ident(tc), > X (float)tv.tv_sec * AHZ + tv.tv_usec, v); > X } >=20 > AHZ here is less than an obfuscation of literal 10000000 or just 1e6 or > 1e6F. It doesn't even have the style bug of an L suffix like the nearby > literals. Types are important here, but the L isn't. >=20 > AHZ used to be a constant related to fixed-point conversions in acct.h. > It used to have value 1000. Note much like the AHZ. now > devfines AHZV1 and this has value 64. This is for a legacy API. Not > very compatible. >=20 > This file doesn't include except possibly via namespace > pollution, so it doesn't get any AHZ*. It only uses AHZ to convert > tv_sec to usec. This was magical and may be broken. The file convert.c > is included. This is a converted copy of kern_acct.c. Back when AHZ > existed in acct.h, kern_acct.c used to use AHZ with its different value. > I don't see how overriding that value either didn't cause a redefinition > error or inconsistencies. Now kern_acct.c doesn't use either AHZ* so > this definition is not magical. >=20 > So AHZ should be replaced by literal 1000000 except possibly for type > problems. IIRC, C99 specifies the dubious behaviour of converting > integers to float in float expressions to support the dubious behaviour > of evaluating float expressions in float precision. 1000000 is even > exactly representable in float precision. But the result of the > mutliplication isn't in general. Adding a small tv_usec to a not > very large tv_sec converted to usec is almost certain to not be > representable in a 32-bit float after a few random choices. So > we expect innacuracies. >=20 > The float expression may be evaluated in extra precision, and is on > i386. So we expect smaller inaccuracies on i386. >=20 > It is not clear if remaining bugs are in the test or the compiler. > Probably both. The test asks for inaccuracies and gets them in the > expression sometimes. It doesn't try to force the inaccuracies by > casting to float, and only C90+ compilers do this cast as specified > since the specification specifies behaviour that is too pessimal to > use. C90+ compilers are in short supply, but gcc later than aout > 4.6 properlay pessimizes the cast when instructed to by certain > compiler flags. >=20 > But the test it calls a function which should do the conversion. It > takes excessive inlining combined with the de-pessimization to not > do the conversion. Apparently, clang does do the excessive inlining. > Otherwise the result would be the same on i386 as on amd64. >=20 > The test seems to be quite broken. encode_timeval() does some > conversion which is presumably correct. We calculate a value in > usec to compare against. This is only done in float precision > (possibly higher, but we don't control this). We expect a relative > error of about FLT_EPSILON in this. Later we convert to a relative > error, so this is only slightly broken. encode_timeval() must > have a rounding error, and our calculation has one and the scaling > has more. So we should expect errors of several times FLT_EPSILON. > So the test only seems to be slightly broken. Strictly less than > FLT_EPSILON is too strict if the calculations are actually done in > float precision since it is too difficult to calculate the reference > and do the scaling without increasing the error. The worst case > for the reference is tv_sec =3D 2**31-1 (31 bits) and tv_usec =3D 999999 > (20 bits). That is exactly representable in 53 bits (double precision) > so we should use that. >=20 > Bruce From owner-svn-src-all@freebsd.org Sun Sep 4 00:25:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FADBA94151; Sun, 4 Sep 2016 00:25: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 DCB90BC1; Sun, 4 Sep 2016 00:25:50 +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 u840Ponn019423; Sun, 4 Sep 2016 00:25:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840Po7f019422; Sun, 4 Sep 2016 00:25:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609040025.u840Po7f019422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 4 Sep 2016 00:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305367 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:25:51 -0000 Author: markj Date: Sun Sep 4 00:25:49 2016 New Revision: 305367 URL: https://svnweb.freebsd.org/changeset/base/305367 Log: Respect the caller's hints when performing swap readahead. The pager getpages interface allows the caller to bound the number of readahead and readbehind pages, and vm_fault_hold() makes use of this feature. These bounds were ignored after r305056, causing the swap pager to potentially page in more than the specified number of pages. Reported and reviewed by: alc X-MFC with: r305056 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Sep 3 23:57:17 2016 (r305366) +++ head/sys/vm/swap_pager.c Sun Sep 4 00:25:49 2016 (r305367) @@ -1086,7 +1086,7 @@ swap_pager_getpages(vm_object_t object, vm_page_t mpred, msucc, p; vm_pindex_t pindex; daddr_t blk; - int i, j, reqcount, shift; + int i, j, maxahead, maxbehind, reqcount, shift; reqcount = count; @@ -1094,7 +1094,7 @@ swap_pager_getpages(vm_object_t object, bp = getpbuf(&nsw_rcount); VM_OBJECT_WLOCK(object); - if (!swap_pager_haspage(object, m[0]->pindex, rbehind, rahead)) { + if (!swap_pager_haspage(object, m[0]->pindex, &maxbehind, &maxahead)) { relpbuf(bp, &nsw_rcount); return (VM_PAGER_FAIL); } @@ -1103,15 +1103,16 @@ swap_pager_getpages(vm_object_t object, * Clip the readahead and readbehind ranges to exclude resident pages. */ if (rahead != NULL) { - KASSERT(reqcount - 1 <= *rahead, + KASSERT(reqcount - 1 <= maxahead, ("page count %d extends beyond swap block", reqcount)); - *rahead -= reqcount - 1; + *rahead = imin(*rahead, maxahead - (reqcount - 1)); pindex = m[reqcount - 1]->pindex; msucc = TAILQ_NEXT(m[reqcount - 1], listq); if (msucc != NULL && msucc->pindex - pindex - 1 < *rahead) *rahead = msucc->pindex - pindex - 1; } if (rbehind != NULL) { + *rbehind = imin(*rbehind, maxbehind); pindex = m[0]->pindex; mpred = TAILQ_PREV(m[0], pglist, listq); if (mpred != NULL && pindex - mpred->pindex - 1 < *rbehind) From owner-svn-src-all@freebsd.org Sun Sep 4 00:29:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 236C0A941E9; Sun, 4 Sep 2016 00:29:50 +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 DD524D5D; Sun, 4 Sep 2016 00:29:49 +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 u840TnfI019585; Sun, 4 Sep 2016 00:29:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840Tn5D019584; Sun, 4 Sep 2016 00:29:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609040029.u840Tn5D019584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 4 Sep 2016 00:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305368 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:29:50 -0000 Author: markj Date: Sun Sep 4 00:29:48 2016 New Revision: 305368 URL: https://svnweb.freebsd.org/changeset/base/305368 Log: Micro-optimize sleepq_signal(). Lift a comparison out of the loop that finds the highest-priority thread on the queue. MFC after: 1 week Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Sun Sep 4 00:25:49 2016 (r305367) +++ head/sys/kern/subr_sleepqueue.c Sun Sep 4 00:29:48 2016 (r305368) @@ -861,9 +861,9 @@ sleepq_signal(void *wchan, int flags, in * been sleeping the longest since threads are always added to * the tail of sleep queues. */ - besttd = NULL; + besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) { - if (besttd == NULL || td->td_priority < besttd->td_priority) + if (td->td_priority < besttd->td_priority) besttd = td; } MPASS(besttd != NULL); From owner-svn-src-all@freebsd.org Sun Sep 4 00:34:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02927A9435F; Sun, 4 Sep 2016 00:34:17 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C42A1132; Sun, 4 Sep 2016 00:34:16 +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 u840YF3j023111; Sun, 4 Sep 2016 00:34:15 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840YFOu023110; Sun, 4 Sep 2016 00:34:15 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609040034.u840YFOu023110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 4 Sep 2016 00:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305369 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:34:17 -0000 Author: ache Date: Sun Sep 4 00:34:15 2016 New Revision: 305369 URL: https://svnweb.freebsd.org/changeset/base/305369 Log: MFC r305219 If error happens, don't overwrite original errno comes from __mbrtowc() and __srefill(). Modified: stable/10/lib/libc/stdio/fgetwc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fgetwc.c ============================================================================== --- stable/10/lib/libc/stdio/fgetwc.c Sun Sep 4 00:29:48 2016 (r305368) +++ stable/10/lib/libc/stdio/fgetwc.c Sun Sep 4 00:34:15 2016 (r305369) @@ -84,9 +84,10 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i return (WEOF); do { nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); - if (nconv == (size_t)-1) - break; - else if (nconv == (size_t)-2) + if (nconv == (size_t)-1) { + fp->_flags |= __SERR; + return (WEOF); + } else if (nconv == (size_t)-2) continue; else if (nconv == 0) { fp->_p++; @@ -100,7 +101,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i return (wc); } } while (__srefill(fp) == 0); - fp->_flags |= __SERR; - errno = EILSEQ; + if (__sfeof(fp)) { + fp->_flags |= __SERR; + errno = EILSEQ; + } return (WEOF); } From owner-svn-src-all@freebsd.org Sun Sep 4 00:35:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26343A943CD; Sun, 4 Sep 2016 00:35:57 +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 EC74F2A6; Sun, 4 Sep 2016 00:35:56 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u840ZuC1023222; Sun, 4 Sep 2016 00:35:56 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840ZuGL023221; Sun, 4 Sep 2016 00:35:56 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201609040035.u840ZuGL023221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 4 Sep 2016 00:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305370 - stable/11/lib/libc/stdio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:35:57 -0000 Author: ache Date: Sun Sep 4 00:35:55 2016 New Revision: 305370 URL: https://svnweb.freebsd.org/changeset/base/305370 Log: MFC r305219 If error happens, don't overwrite original errno comes from __mbrtowc() and __srefill(). Modified: stable/11/lib/libc/stdio/fgetwc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdio/fgetwc.c ============================================================================== --- stable/11/lib/libc/stdio/fgetwc.c Sun Sep 4 00:34:15 2016 (r305369) +++ stable/11/lib/libc/stdio/fgetwc.c Sun Sep 4 00:35:55 2016 (r305370) @@ -84,9 +84,10 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i return (WEOF); do { nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); - if (nconv == (size_t)-1) - break; - else if (nconv == (size_t)-2) + if (nconv == (size_t)-1) { + fp->_flags |= __SERR; + return (WEOF); + } else if (nconv == (size_t)-2) continue; else if (nconv == 0) { fp->_p++; @@ -100,7 +101,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, i return (wc); } } while (__srefill(fp) == 0); - fp->_flags |= __SERR; - errno = EILSEQ; + if (__sfeof(fp)) { + fp->_flags |= __SERR; + errno = EILSEQ; + } return (WEOF); } From owner-svn-src-all@freebsd.org Sun Sep 4 00:58:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DD58A94871; Sun, 4 Sep 2016 00:58:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A034ED9F; Sun, 4 Sep 2016 00:58:21 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u840wKnB030877; Sun, 4 Sep 2016 00:58:20 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u840wJVs030864; Sun, 4 Sep 2016 00:58:19 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040058.u840wJVs030864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 00:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305371 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/siba dev/bwn mips/broadcom modules/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 00:58:22 -0000 Author: landonf Date: Sun Sep 4 00:58:19 2016 New Revision: 305371 URL: https://svnweb.freebsd.org/changeset/base/305371 Log: Migrate bhndb(4) to the new bhnd_erom API. Adds support for probing and initializing bhndb(4) bridge state using the bhnd_erom API, ensuring that full bridge configuration is available *prior* to actually attaching and enumerating the bhnd(4) child device, allowing us to safely allocate bus-level agent/device resources during bhnd(4) bus enumeration. - Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue to the existing bhnd_erom_probe_static() method, and allows the bhndb bridge to discover the best available erom parser class prior to newbus probing of its children. - Add support for supplying identification hints when probing erom devices. This is required on early EXTIF-only chipsets, where chip identification registers are not available. - Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info records rather than bridged bhnd(4) device_t references to determine the bridged chipsets' capability/bridge configuration. - The bhndb parent (e.g. if_bwn) is now required to supply a hardware priority table to the bridge. The default table is currently sufficient for our supported devices. - Drop the two-pass attach approach we used for compatibility with bhndb(4) in the bhnd(4) bus drivers, and instead perform bus enumeration immediately, and allocate bridged per-child bus-level resources during that enumeration. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D7768 Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_bhndb.c head/sys/dev/bhnd/bcma/bcma_erom.c head/sys/dev/bhnd/bcma/bcma_eromvar.h head/sys/dev/bhnd/bcma/bcma_nexus.c head/sys/dev/bhnd/bcma/bcma_subr.c head/sys/dev/bhnd/bcma/bcmavar.h head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_erom.c head/sys/dev/bhnd/bhnd_erom.h head/sys/dev/bhnd/bhnd_erom_if.m head/sys/dev/bhnd/bhnd_match.h head/sys/dev/bhnd/bhnd_nexus.c head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_bus_if.m head/sys/dev/bhnd/bhndb/bhndb_if.m head/sys/dev/bhnd/bhndb/bhndb_pci.c head/sys/dev/bhnd/bhndb/bhndb_private.h head/sys/dev/bhnd/bhndb/bhndb_subr.c head/sys/dev/bhnd/bhndb/bhndbvar.h head/sys/dev/bhnd/cores/chipc/chipcreg.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/dev/bhnd/siba/siba_erom.c head/sys/dev/bhnd/siba/siba_nexus.c head/sys/dev/bhnd/siba/sibavar.h head/sys/dev/bwn/if_bwn_pci.c head/sys/dev/bwn/if_bwn_pcivar.h head/sys/mips/broadcom/bcm_machdep.c head/sys/modules/bhnd/bhndb/Makefile Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma.c Sun Sep 4 00:58:19 2016 (r305371) @@ -48,6 +48,12 @@ __FBSDID("$FreeBSD$"); /* RID used when allocating EROM table */ #define BCMA_EROM_RID 0 +static bhnd_erom_class_t * +bcma_get_erom_class(driver_t *driver) +{ + return (&bcma_erom_parser); +} + int bcma_probe(device_t dev) { @@ -55,70 +61,25 @@ bcma_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +/** + * Default bcma(4) bus driver implementation of DEVICE_ATTACH(). + * + * This implementation initializes internal bcma(4) state and performs + * bus enumeration, and must be called by subclassing drivers in + * DEVICE_ATTACH() before any other bus methods. + */ int bcma_attach(device_t dev) { - struct bcma_devinfo *dinfo; - device_t *devs, child; - int ndevs; - int error; + int error; - - if ((error = device_get_children(dev, &devs, &ndevs))) + /* Enumerate children */ + if ((error = bcma_add_children(dev))) { + device_delete_children(dev); return (error); - - /* - * Map our children's agent register block. - */ - for (int i = 0; i < ndevs; i++) { - bhnd_addr_t addr; - bhnd_size_t size; - rman_res_t r_start, r_count, r_end; - - child = devs[i]; - dinfo = device_get_ivars(child); - - KASSERT(!device_is_suspended(child), - ("bcma(4) stateful suspend handling requires that devices " - "not be suspended before bcma_attach()")); - - /* Verify that the agent register block exists and is - * mappable */ - if (bhnd_get_port_rid(child, BHND_PORT_AGENT, 0, 0) == -1) - continue; - - /* Fetch the address of the agent register block */ - error = bhnd_get_region_addr(child, BHND_PORT_AGENT, 0, 0, - &addr, &size); - if (error) { - device_printf(dev, "failed fetching agent register " - "block address for core %d\n", i); - goto cleanup; - } - - /* Allocate the resource */ - r_start = addr; - r_count = size; - r_end = r_start + r_count - 1; - - dinfo->rid_agent = i + 1; - dinfo->res_agent = BHND_BUS_ALLOC_RESOURCE(dev, dev, - SYS_RES_MEMORY, &dinfo->rid_agent, r_start, r_end, r_count, - RF_ACTIVE); - if (dinfo->res_agent == NULL) { - device_printf(dev, "failed allocating agent register " - "block for core %d\n", i); - error = ENXIO; - goto cleanup; - } } -cleanup: - free(devs, M_BHND); - if (error) - return (error); - - return (bhnd_generic_attach(dev)); + return (0); } int @@ -191,15 +152,6 @@ bcma_get_resource_list(device_t dev, dev return (&dinfo->resources); } -static device_t -bcma_find_hostb_device(device_t dev) -{ - struct bcma_softc *sc = device_get_softc(dev); - - /* This is set (or not) by the concrete bcma driver subclass. */ - return (sc->hostb_dev); -} - static int bcma_reset_core(device_t dev, device_t child, uint16_t flags) { @@ -516,8 +468,7 @@ bcma_add_children(device_t bus) corecfg = NULL; /* Allocate our EROM parser */ - erom = bhnd_erom_alloc(&bcma_erom_parser, bus, BCMA_EROM_RID, - cid->enum_addr); + erom = bhnd_erom_alloc(&bcma_erom_parser, cid, bus, BCMA_EROM_RID); if (erom == NULL) return (ENODEV); @@ -528,17 +479,21 @@ bcma_add_children(device_t bus) child = BUS_ADD_CHILD(bus, 0, NULL, -1); if (child == NULL) { error = ENXIO; - goto failed; + goto cleanup; } /* Initialize device ivars */ dinfo = device_get_ivars(child); if ((error = bcma_init_dinfo(bus, dinfo, corecfg))) - goto failed; + goto cleanup; /* The dinfo instance now owns the corecfg value */ corecfg = NULL; + /* Allocate device's agent registers, if any */ + if ((error = bcma_dinfo_alloc_agent(bus, child, dinfo))) + goto cleanup; + /* If pins are floating or the hardware is otherwise * unpopulated, the device shouldn't be used. */ if (bhnd_is_hw_disabled(child)) @@ -548,16 +503,19 @@ bcma_add_children(device_t bus) BHND_BUS_CHILD_ADDED(bus, child); } - /* Hit EOF parsing cores? */ + /* EOF while parsing cores is expected */ if (error == ENOENT) error = 0; -failed: +cleanup: bhnd_erom_free(erom); if (corecfg != NULL) bcma_free_corecfg(corecfg); + if (error) + device_delete_children(bus); + return (error); } @@ -574,7 +532,7 @@ static device_method_t bcma_methods[] = DEVMETHOD(bus_get_resource_list, bcma_get_resource_list), /* BHND interface */ - DEVMETHOD(bhnd_bus_find_hostb_device, bcma_find_hostb_device), + DEVMETHOD(bhnd_bus_get_erom_class, bcma_get_erom_class), DEVMETHOD(bhnd_bus_alloc_devinfo, bcma_alloc_bhnd_dinfo), DEVMETHOD(bhnd_bus_free_devinfo, bcma_free_bhnd_dinfo), DEVMETHOD(bhnd_bus_reset_core, bcma_reset_core), Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_bhndb.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Sun Sep 4 00:58:19 2016 (r305371) @@ -72,26 +72,21 @@ bcma_bhndb_probe(device_t dev) static int bcma_bhndb_attach(device_t dev) { - struct bcma_softc *sc; - int error; + int error; - sc = device_get_softc(dev); + /* Perform initial attach and enumerate our children. */ + if ((error = bcma_attach(dev))) + goto failed; + + /* Delegate remainder to standard bhnd method implementation */ + if ((error = bhnd_generic_attach(dev))) + goto failed; - /* Enumerate our children. */ - if ((error = bcma_add_children(dev))) - return (error); - - /* Initialize full bridge configuration */ - error = BHNDB_INIT_FULL_CONFIG(device_get_parent(dev), dev, - bhndb_bcma_priority_table); - if (error) - return (error); - - /* Ask our parent bridge to find the corresponding bridge core */ - sc->hostb_dev = BHNDB_FIND_HOSTB_DEVICE(device_get_parent(dev), dev); + return (0); - /* Call our superclass' implementation */ - return (bcma_attach(dev)); +failed: + device_delete_children(dev); + return (error); } static int Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Sun Sep 4 00:58:19 2016 (r305371) @@ -58,7 +58,13 @@ __FBSDID("$FreeBSD$"); * marker. */ +struct bcma_erom_io; + static const char *bcma_erom_entry_type_name (uint8_t entry); + +static uint32_t bcma_eio_read4(struct bcma_erom_io *io, + bus_size_t offset); + static int bcma_erom_read32(struct bcma_erom *erom, uint32_t *entry); static int bcma_erom_skip32(struct bcma_erom *erom); @@ -72,8 +78,10 @@ static int bcma_erom_seek_next(struct static int bcma_erom_region_to_port_type(struct bcma_erom *erom, uint8_t region_type, bhnd_port_type *port_type); + static int bcma_erom_peek32(struct bcma_erom *erom, uint32_t *entry); + static bus_size_t bcma_erom_tell(struct bcma_erom *erom); static void bcma_erom_seek(struct bcma_erom *erom, bus_size_t offset); @@ -96,9 +104,33 @@ static void bcma_erom_to_core_info(con u_int core_idx, int core_unit, struct bhnd_core_info *info); +/** + * BCMA EROM generic I/O context + */ +struct bcma_erom_io { + struct bhnd_resource *res; /**< memory resource, or NULL if initialized + with bus space tag and handle */ + int rid; /**< memory resource id, or -1 */ + + bus_space_tag_t bst; /**< bus space tag, if any */ + bus_space_handle_t bsh; /**< bus space handle, if any */ + + bus_size_t start; /**< base read offset */ +}; + +/** + * BCMA EROM per-instance state. + */ +struct bcma_erom { + struct bhnd_erom obj; + device_t dev; /**< parent device, or NULL if none. */ + struct bcma_erom_io io; /**< I/O context */ + bus_size_t offset; /**< current read offset */ +}; + #define EROM_LOG(erom, fmt, ...) do { \ if (erom->dev != NULL) { \ - device_printf(erom->dev, "erom[0x%llx]: " fmt, \ + device_printf(erom->dev, "erom[0x%llx]: " fmt, \ (unsigned long long) (erom->offset), ##__VA_ARGS__);\ } else { \ printf("erom[0x%llx]: " fmt, \ @@ -106,7 +138,6 @@ static void bcma_erom_to_core_info(con } \ } while(0) - /** Return the type name for an EROM entry */ static const char * bcma_erom_entry_type_name (uint8_t entry) @@ -123,47 +154,112 @@ bcma_erom_entry_type_name (uint8_t entry } } + +/** + * Read a 32-bit value from an EROM I/O context. + * + * @param io EROM I/O context. + * @param offset Read offset. + */ +static uint32_t +bcma_eio_read4(struct bcma_erom_io *io, bus_size_t offset) +{ + bus_size_t read_off; + + read_off = io->start + offset; + if (io->res != NULL) + return (bhnd_bus_read_4(io->res, read_off)); + else + return (bus_space_read_4(io->bst, io->bsh, read_off)); +} + +/* Initialize bcma_erom resource I/O context */ +static void +bcma_eio_init(struct bcma_erom_io *io, struct bhnd_resource *res, int rid, + bus_size_t offset) +{ + io->res = res; + io->rid = rid; + io->start = offset; +} + +/* Initialize bcma_erom bus space I/O context */ +static void +bcma_eio_init_static(struct bcma_erom_io *io, bus_space_tag_t bst, + bus_space_handle_t bsh, bus_size_t offset) +{ + io->res = NULL; + io->rid = -1; + io->bst = bst; + io->bsh = bsh; + io->start = offset; +} + +/* BCMA implementation of BHND_EROM_INIT() */ static int -bcma_erom_init(bhnd_erom_t *erom, device_t parent, int rid, bus_addr_t enum_addr) +bcma_erom_init(bhnd_erom_t *erom, const struct bhnd_chipid *cid, + device_t parent, int rid) { - struct bcma_erom *sc = (struct bcma_erom *)erom; + struct bcma_erom *sc; + struct bhnd_resource *res; + sc = (struct bcma_erom *)erom; sc->dev = parent; + sc->offset = 0; + + res = bhnd_alloc_resource(parent, SYS_RES_MEMORY, &rid, cid->enum_addr, + cid->enum_addr + BCMA_EROM_TABLE_SIZE - 1, BCMA_EROM_TABLE_SIZE, + RF_ACTIVE|RF_SHAREABLE); - sc->rid = rid; - sc->res = bhnd_alloc_resource(parent, SYS_RES_MEMORY, &sc->rid, - enum_addr, enum_addr + BCMA_EROM_TABLE_SIZE - 1, - BCMA_EROM_TABLE_SIZE, RF_ACTIVE|RF_SHAREABLE); - if (sc->res == NULL) + if (res == NULL) return (ENOMEM); - - sc->start = BCMA_EROM_TABLE_START; + + bcma_eio_init(&sc->io, res, rid, BCMA_EROM_TABLE_START); + + return (0); +} + +/* BCMA implementation of BHND_EROM_INIT_STATIC() */ +static int +bcma_erom_init_static(bhnd_erom_t *erom, const struct bhnd_chipid *cid, + bus_space_tag_t bst, bus_space_handle_t bsh) +{ + struct bcma_erom *sc; + + sc = (struct bcma_erom *)erom; + sc->dev = NULL; sc->offset = 0; + bcma_eio_init_static(&sc->io, bst, bsh, BCMA_EROM_TABLE_START); + return (0); } +/* Common implementation of BHND_EROM_PROBE/BHND_EROM_PROBE_STATIC */ static int -bcma_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, struct bhnd_chipid *cid) +bcma_erom_probe_common(struct bcma_erom_io *io, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) { - uint32_t idreg, eaddr; - uint8_t chip_type; + uint32_t idreg, eromptr; - idreg = bus_space_read_4(bst, bsh, CHIPC_ID); - chip_type = CHIPC_GET_BITS(idreg, CHIPC_ID_BUS); + /* Hints aren't supported; all BCMA devices have a ChipCommon + * core */ + if (hint != NULL) + return (EINVAL); - /* Fetch EROM physical address */ - if (!BHND_CHIPTYPE_HAS_EROM(chip_type)) + /* Confirm CHIPC_EROMPTR availability */ + idreg = bcma_eio_read4(io, CHIPC_ID); + if (!BHND_CHIPTYPE_HAS_EROM(CHIPC_GET_BITS(idreg, CHIPC_ID_BUS))) return (ENXIO); - eaddr = bus_space_read_4(bst, bsh, CHIPC_EROMPTR); + /* Fetch EROM address */ + eromptr = bcma_eio_read4(io, CHIPC_EROMPTR); /* Parse chip identifier */ - *cid = bhnd_parse_chipid(idreg, eaddr); + *cid = bhnd_parse_chipid(idreg, eromptr); /* Verify chip type */ - switch (chip_type) { + switch (cid->chip_type) { case BHND_CHIPTYPE_BCMA: return (BUS_PROBE_DEFAULT); @@ -173,37 +269,44 @@ bcma_erom_probe_static(bhnd_erom_class_t default: return (ENXIO); - } + } } static int -bcma_erom_init_static(bhnd_erom_t *erom, bus_space_tag_t bst, - bus_space_handle_t bsh) +bcma_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, + bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) { - struct bcma_erom *sc = (struct bcma_erom *)erom; + struct bcma_erom_io io; - sc->dev = NULL; - sc->rid = -1; - sc->res = NULL; - sc->bst = bst; - sc->bsh = bsh; - sc->start = BCMA_EROM_TABLE_START; - sc->offset = 0; + bcma_eio_init(&io, res, rman_get_rid(res->res), + offset + BCMA_EROM_TABLE_START); - return (0); + return (bcma_erom_probe_common(&io, hint, cid)); } +static int +bcma_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, + bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) +{ + struct bcma_erom_io io; + + bcma_eio_init_static(&io, bst, bsh, BCMA_EROM_TABLE_START); + return (bcma_erom_probe_common(&io, hint, cid)); +} + + static void bcma_erom_fini(bhnd_erom_t *erom) { struct bcma_erom *sc = (struct bcma_erom *)erom; - if (sc->res != NULL) { - bhnd_release_resource(sc->dev, SYS_RES_MEMORY, sc->rid, - sc->res); + if (sc->io.res != NULL) { + bhnd_release_resource(sc->dev, SYS_RES_MEMORY, sc->io.rid, + sc->io.res); - sc->res = NULL; - sc->rid = -1; + sc->io.res = NULL; + sc->io.rid = -1; } } @@ -484,19 +587,12 @@ bcma_erom_seek(struct bcma_erom *erom, b static int bcma_erom_peek32(struct bcma_erom *erom, uint32_t *entry) { - bus_size_t off; - - if (erom->offset >= BCMA_EROM_TABLE_SIZE) { + if (erom->offset >= (BCMA_EROM_TABLE_SIZE - sizeof(uint32_t))) { EROM_LOG(erom, "BCMA EROM table missing terminating EOF\n"); return (EINVAL); } - - off = erom->start + erom->offset; - if (erom->res != NULL) - *entry = bhnd_bus_read_4(erom->res, off); - else - *entry = bus_space_read_4(erom->bst, erom->bsh, off); - + + *entry = bcma_eio_read4(&erom->io, erom->offset); return (0); } @@ -1259,6 +1355,7 @@ failed: } static kobj_method_t bcma_erom_methods[] = { + KOBJMETHOD(bhnd_erom_probe, bcma_erom_probe), KOBJMETHOD(bhnd_erom_probe_static, bcma_erom_probe_static), KOBJMETHOD(bhnd_erom_init, bcma_erom_init), KOBJMETHOD(bhnd_erom_init_static, bcma_erom_init_static), Modified: head/sys/dev/bhnd/bcma/bcma_eromvar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_eromvar.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_eromvar.h Sun Sep 4 00:58:19 2016 (r305371) @@ -42,25 +42,6 @@ struct bcma_erom; int bcma_erom_next_corecfg(struct bcma_erom *sc, struct bcma_corecfg **result); -/** - * BCMA EROM per-instance state. - */ -struct bcma_erom { - struct bhnd_erom obj; - device_t dev; /**< EROM parent device, or NULL - if none. */ - struct bhnd_resource *res; /**< EROM table resource, or - NULL if initialized with - bus space tag and handle */ - int rid; /**< EROM table rid, or -1 */ - - bus_space_tag_t bst; /**< EROM table bus space */ - bus_space_handle_t bsh; /**< EROM table bus handle */ - - bus_size_t start; /**< EROM table offset */ - bus_size_t offset; /**< current read offset */ -}; - /** EROM core descriptor. */ struct bcma_erom_core { uint16_t vendor; /**< core's designer */ Modified: head/sys/dev/bhnd/bcma/bcma_nexus.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_nexus.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_nexus.c Sun Sep 4 00:58:19 2016 (r305371) @@ -93,10 +93,19 @@ bcma_nexus_attach(device_t dev) { int error; - if ((error = bcma_add_children(dev))) - return (error); - - return (bcma_attach(dev)); + /* Perform initial attach and enumerate our children. */ + if ((error = bcma_attach(dev))) + goto failed; + + /* Delegate remainder to standard bhnd method implementation */ + if ((error = bhnd_generic_attach(dev))) + goto failed; + + return (0); + +failed: + device_delete_children(dev); + return (error); } static const struct bhnd_chipid * Modified: head/sys/dev/bhnd/bcma/bcma_subr.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_subr.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcma_subr.c Sun Sep 4 00:58:19 2016 (r305371) @@ -43,6 +43,10 @@ __FBSDID("$FreeBSD$"); #include "bcmavar.h" +/* Return the resource ID for a device's agent register allocation */ +#define BCMA_AGENT_RID(_dinfo) \ + (BCMA_AGENT_RID_BASE + BCMA_DINFO_COREIDX(_dinfo)) + /** * Allocate and initialize new core config structure. * @@ -244,6 +248,63 @@ bcma_init_dinfo(device_t bus, struct bcm return (0); } + +/** + * Allocate the per-core agent register block for a device info structure + * previous initialized via bcma_init_dinfo(). + * + * If an agent0.0 region is not defined on @p dinfo, the device info + * agent resource is set to NULL and 0 is returned. + * + * @param bus The requesting bus device. + * @param child The bcma child device. + * @param dinfo The device info associated with @p child + * + * @retval 0 success + * @retval non-zero resource allocation failed. + */ +int +bcma_dinfo_alloc_agent(device_t bus, device_t child, struct bcma_devinfo *dinfo) +{ + bhnd_addr_t addr; + bhnd_size_t size; + rman_res_t r_start, r_count, r_end; + int error; + + KASSERT(dinfo->res_agent == NULL, ("double allocation of agent")); + + /* Verify that the agent register block exists and is + * mappable */ + if (bhnd_get_port_rid(child, BHND_PORT_AGENT, 0, 0) == -1) + return (0); /* nothing to do */ + + /* Fetch the address of the agent register block */ + error = bhnd_get_region_addr(child, BHND_PORT_AGENT, 0, 0, + &addr, &size); + if (error) { + device_printf(bus, "failed fetching agent register block " + "address for core %u\n", BCMA_DINFO_COREIDX(dinfo)); + return (error); + } + + /* Allocate the resource */ + r_start = addr; + r_count = size; + r_end = r_start + r_count - 1; + + dinfo->rid_agent = BCMA_AGENT_RID(dinfo); + dinfo->res_agent = BHND_BUS_ALLOC_RESOURCE(bus, bus, SYS_RES_MEMORY, + &dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE); + if (dinfo->res_agent == NULL) { + device_printf(bus, "failed allocating agent register block for " + "core %u\n", BCMA_DINFO_COREIDX(dinfo)); + return (ENXIO); + } + + return (0); +} + + /** * Deallocate the given device info structure and any associated resources. * Modified: head/sys/dev/bhnd/bcma/bcmavar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcmavar.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bcma/bcmavar.h Sun Sep 4 00:58:19 2016 (r305371) @@ -45,6 +45,18 @@ * Internal definitions shared by bcma(4) driver implementations. */ +/** Base resource ID for per-core agent register allocations */ +#define BCMA_AGENT_RID_BASE 100 + +/** + * Return the device's core index. + * + * @param _dinfo The bcma_devinfo instance to query. + */ +#define BCMA_DINFO_COREIDX(_dinfo) \ + ((_dinfo)->corecfg->core_info.core_idx) + + /** BCMA port identifier. */ typedef u_int bcma_pid_t; #define BCMA_PID_MAX UINT_MAX /**< Maximum bcma_pid_t value */ @@ -72,6 +84,8 @@ struct bcma_devinfo *bcma_alloc_dinfo(de int bcma_init_dinfo(device_t bus, struct bcma_devinfo *dinfo, struct bcma_corecfg *corecfg); +int bcma_dinfo_alloc_agent(device_t bus, device_t child, + struct bcma_devinfo *dinfo); void bcma_free_dinfo(device_t bus, struct bcma_devinfo *dinfo); @@ -147,7 +161,6 @@ struct bcma_devinfo { /** BMCA per-instance state */ struct bcma_softc { struct bhnd_softc bhnd_sc; /**< bhnd state */ - device_t hostb_dev; /**< host bridge core, or NULL */ }; #endif /* _BCMA_BCMAVAR_H_ */ Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd.h Sun Sep 4 00:58:19 2016 (r305371) @@ -39,6 +39,7 @@ #include "bhnd_ids.h" #include "bhnd_types.h" +#include "bhnd_erom_types.h" #include "bhnd_debug.h" #include "bhnd_bus_if.h" #include "bhnd_match.h" @@ -188,6 +189,12 @@ struct bhnd_resource { * is MMIO accessible. */ }; +/** Wrap the active resource @p _r in a bhnd_resource structure */ +#define BHND_DIRECT_RESOURCE(_r) ((struct bhnd_resource) { \ + .res = (_r), \ + .direct = true, \ +}) + /** * Device quirk table descriptor. */ @@ -278,6 +285,13 @@ const struct bhnd_core_info *bhnd_find_c const struct bhnd_core_info *cores, u_int num_cores, bhnd_devclass_t class); +struct bhnd_core_match bhnd_core_get_match_desc( + const struct bhnd_core_info *core); + +bool bhnd_cores_equal( + const struct bhnd_core_info *lhs, + const struct bhnd_core_info *rhs); + bool bhnd_core_matches( const struct bhnd_core_info *core, const struct bhnd_core_match *desc); @@ -389,7 +403,16 @@ int bhnd_bus_generic_deactivate_reso bhnd_attach_type bhnd_bus_generic_get_attach_type(device_t dev, device_t child); - +/** + * Return the bhnd(4) bus driver's device enumeration parser class + * + * @param driver A bhnd bus driver instance. + */ +static inline bhnd_erom_class_t * +bhnd_driver_get_erom_class(driver_t *driver) +{ + return (BHND_BUS_GET_EROM_CLASS(driver)); +} /** * Return the active host bridge core for the bhnd bus, if any, or NULL if Modified: head/sys/dev/bhnd/bhnd_bus_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_bus_if.m Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_bus_if.m Sun Sep 4 00:58:19 2016 (r305371) @@ -29,6 +29,7 @@ #include #include +#include INTERFACE bhnd_bus; @@ -49,7 +50,13 @@ CODE { #include #include - + + static bhnd_erom_class_t * + bhnd_bus_null_get_erom_class(driver_t *driver) + { + return (NULL); + } + static struct bhnd_chipid * bhnd_bus_null_get_chipid(device_t dev, device_t child) { @@ -152,7 +159,7 @@ CODE { static device_t bhnd_bus_null_find_hostb_device(device_t dev) { - panic("bhnd_bus_find_hostb_device unimplemented"); + return (NULL); } static bool @@ -199,6 +206,15 @@ CODE { } /** + * Return the bhnd(4) bus driver's device enumeration parser class. + * + * @param driver The bhnd bus driver instance. + */ +STATICMETHOD bhnd_erom_class_t * get_erom_class { + driver_t *driver; +} DEFAULT bhnd_bus_null_get_erom_class; + +/** * Return the active host bridge core for the bhnd bus, if any. * * @param dev The bhnd bus device. Modified: head/sys/dev/bhnd/bhnd_erom.c ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.c Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom.c Sun Sep 4 00:58:19 2016 (r305371) @@ -45,15 +45,15 @@ __FBSDID("$FreeBSD$"); * be allocated. * @param rid The resource ID to be used when allocating EROM * resources. - * @param enum_addr The base address of the device enumeration table. + * @param cid The device's chip identifier. * * @retval non-NULL success * @retval NULL if an error occured allocating or initializing the * EROM parser. */ bhnd_erom_t * -bhnd_erom_alloc(bhnd_erom_class_t *cls, device_t parent, int rid, - bus_addr_t enum_addr) +bhnd_erom_alloc(bhnd_erom_class_t *cls, const struct bhnd_chipid *cid, + device_t parent, int rid) { bhnd_erom_t *erom; int error; @@ -61,9 +61,9 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, erom = (bhnd_erom_t *)kobj_create((kobj_class_t)cls, M_BHND, M_WAITOK|M_ZERO); - if ((error = BHND_EROM_INIT(erom, parent, rid, enum_addr))) { + if ((error = BHND_EROM_INIT(erom, cid, parent, rid))) { printf("error initializing %s parser at %#jx with " - "rid %d: %d\n", cls->name, (uintmax_t)enum_addr, rid, + "rid %d: %d\n", cls->name, (uintmax_t)cid->enum_addr, rid, error); kobj_delete((kobj_t)erom, M_BHND); @@ -86,6 +86,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, * @param esize The total available number of bytes allocated for * @p erom. If this is less than is required by @p cls, * ENOMEM will be returned. + * @param cid The device's chip identifier. * @param bst Bus space tag. * @param bsh Bus space handle mapping the device enumeration * space. @@ -97,7 +98,7 @@ bhnd_erom_alloc(bhnd_erom_class_t *cls, */ int bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_erom_t *erom, size_t esize, - bus_space_tag_t bst, bus_space_handle_t bsh) + const struct bhnd_chipid *cid, bus_space_tag_t bst, bus_space_handle_t bsh) { kobj_class_t kcls; @@ -109,7 +110,7 @@ bhnd_erom_init_static(bhnd_erom_class_t /* Perform instance initialization */ kobj_init_static((kobj_t)erom, kcls); - return (BHND_EROM_INIT_STATIC(erom, bst, bsh)); + return (BHND_EROM_INIT_STATIC(erom, cid, bst, bsh)); } /** Modified: head/sys/dev/bhnd/bhnd_erom.h ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.h Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom.h Sun Sep 4 00:58:19 2016 (r305371) @@ -42,11 +42,12 @@ #include "bhnd_erom_if.h" bhnd_erom_t *bhnd_erom_alloc(bhnd_erom_class_t *cls, - device_t parent, int rid, - bus_addr_t enum_addr); + const struct bhnd_chipid *cid, + device_t parent, int rid); int bhnd_erom_init_static(bhnd_erom_class_t *cls, bhnd_erom_t *erom, size_t esize, + const struct bhnd_chipid *cid, bus_space_tag_t bst, bus_space_handle_t bsh); @@ -94,15 +95,48 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_er /** * Probe to see if this device enumeration class supports the bhnd bus + * mapped by the given resource, returning a standard newbus device probe + * result (see BUS_PROBE_*) and the probed chip identification. + * + * @param cls The erom class to probe. + * @param res A resource mapping the first bus core (EXTIF or + * ChipCommon) + * @param offset Offset to the first bus core within @p res. + * @param hint Identification hint used to identify the device. If + * chipset supports standard chip identification registers + * within the first core, this parameter should be NULL. + * @param[out] cid On success, the probed chip identifier. + * + * @retval 0 if this is the only possible device enumeration + * parser for the probed bus. + * @retval negative if the probe succeeds, a negative value should be + * returned; the parser returning the highest negative + * value will be selected to handle device enumeration. + * @retval ENXIO If the bhnd bus type is not handled by this parser. + * @retval positive if an error occurs during probing, a regular unix error + * code should be returned. + */ +static inline int +bhnd_erom_probe(bhnd_erom_class_t *cls, struct bhnd_resource *res, + bus_size_t offset, const struct bhnd_chipid *hint, struct bhnd_chipid *cid) +{ + return (BHND_EROM_PROBE(cls, res, offset, hint, cid)); +} + +/** + * Probe to see if this device enumeration class supports the bhnd bus * mapped at the given bus space tag and handle, returning a standard * newbus device probe result (see BUS_PROBE_*) and the probed * chip identification. * - * @param cls The parser class to be probed. + * @param cls The erom class to probe. * @param bst Bus space tag. * @param bsh Bus space handle mapping the EXTIF or ChipCommon core. * @param paddr The physical address of the core mapped by @p bst and * @p bsh. + * @param hint Identification hint used to identify the device. If + * chipset supports standard chip identification registers + * within the first core, this parameter should be NULL. * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration @@ -116,9 +150,10 @@ SET_DECLARE(bhnd_erom_class_set, bhnd_er */ static inline int bhnd_erom_probe_static(bhnd_erom_class_t *cls, bus_space_tag_t bst, - bus_space_handle_t bsh, bus_addr_t paddr, struct bhnd_chipid *cid) + bus_space_handle_t bsh, bus_addr_t paddr, const struct bhnd_chipid *hint, + struct bhnd_chipid *cid) { - return (BHND_EROM_PROBE_STATIC(cls, bst, bsh, paddr, cid)); + return (BHND_EROM_PROBE_STATIC(cls, bst, bsh, paddr, hint, cid)); } /** Modified: head/sys/dev/bhnd/bhnd_erom_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_erom_if.m Sun Sep 4 00:35:55 2016 (r305370) +++ head/sys/dev/bhnd/bhnd_erom_if.m Sun Sep 4 00:58:19 2016 (r305371) @@ -45,15 +45,48 @@ INTERFACE bhnd_erom; /** * Probe to see if this device enumeration class supports the bhnd bus + * mapped by the given resource, returning a standard newbus device probe + * result (see BUS_PROBE_*) and the probed chip identification. + * + * @param cls The erom class to probe. + * @param res A resource mapping the first bus core. + * @param offset Offset to the first bus core within @p res. + * @param hint Hint used to identify the device. If chipset supports + * standard chip identification registers within the first + * core, this parameter should be NULL. + * @param[out] cid On success, the probed chip identifier. + * + * @retval 0 if this is the only possible device enumeration + * parser for the probed bus. + * @retval negative if the probe succeeds, a negative value should be + * returned; the parser returning the highest negative + * value will be selected to handle device enumeration. + * @retval ENXIO If the bhnd bus type is not handled by this parser. + * @retval positive if an error occurs during probing, a regular unix error + * code should be returned. + */ +STATICMETHOD int probe { + bhnd_erom_class_t *cls; + struct bhnd_resource *res; + bus_size_t offset; + const struct bhnd_chipid *hint; + struct bhnd_chipid *cid; +}; + +/** + * Probe to see if this device enumeration class supports the bhnd bus * mapped at the given bus space tag and handle, returning a standard * newbus device probe result (see BUS_PROBE_*) and the probed * chip identification. * - * @param cls The erom parse class to probe. + * @param cls The erom class to probe. * @param bst Bus space tag. - * @param bsh Bus space handle mapping the EXTIF or ChipCommon core. + * @param bsh Bus space handle mapping the first bus core. * @param paddr The physical address of the core mapped by @p bst and * @p bsh. + * @param hint Hint used to identify the device. If chipset supports + * standard chip identification registers within the first + * core, this parameter should be NULL. * @param[out] cid On success, the probed chip identifier. * * @retval 0 if this is the only possible device enumeration @@ -66,51 +99,54 @@ INTERFACE bhnd_erom; * code should be returned. */ STATICMETHOD int probe_static { - bhnd_erom_class_t *cls; - bus_space_tag_t bst; - bus_space_handle_t bsh; - bus_addr_t paddr; - struct bhnd_chipid *cid; + bhnd_erom_class_t *cls; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_addr_t paddr; + const struct bhnd_chipid *hint; + struct bhnd_chipid *cid; }; /** *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 4 01:17:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02976A94DF0; Sun, 4 Sep 2016 01:17:18 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE10F7BE; Sun, 4 Sep 2016 01:17:17 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841HGlk038161; Sun, 4 Sep 2016 01:17:16 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841HGDO038160; Sun, 4 Sep 2016 01:17:16 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040117.u841HGDO038160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305372 - in head/sys: dev/bhnd/pmu dev/bhnd/soc mips/sentry5 modules/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 01:17:18 -0000 Author: landonf Date: Sun Sep 4 01:17:16 2016 New Revision: 305372 URL: https://svnweb.freebsd.org/changeset/base/305372 Log: Remove empty directories left by r299241, r302190, r304870, and r301410 Approved by: adrian (mentor, implicit) Deleted: head/sys/dev/bhnd/pmu/ head/sys/dev/bhnd/soc/ head/sys/mips/sentry5/ head/sys/modules/bhnd/nvram/ From owner-svn-src-all@freebsd.org Sun Sep 4 01:25:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E221B781EE; Sun, 4 Sep 2016 01:25:47 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E8E7CBE; Sun, 4 Sep 2016 01:25:47 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841PkfW041725; Sun, 4 Sep 2016 01:25:46 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841PkJH041724; Sun, 4 Sep 2016 01:25:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040125.u841PkJH041724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305373 - head/sys/dev/bhnd/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 01:25:47 -0000 Author: landonf Date: Sun Sep 4 01:25:46 2016 New Revision: 305373 URL: https://svnweb.freebsd.org/changeset/base/305373 Log: siba(4): Add missing bhnd_device/bhnd_device_quirk table terminator entries. This resulted in an over-read on siba chipsets that failed to match the existing entries. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/siba/siba_bhndb.c Modified: head/sys/dev/bhnd/siba/siba_bhndb.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep 4 01:17:16 2016 (r305372) +++ head/sys/dev/bhnd/siba/siba_bhndb.c Sun Sep 4 01:25:46 2016 (r305373) @@ -71,10 +71,12 @@ enum { static struct bhnd_device_quirk bridge_quirks[] = { BHND_CHIP_QUIRK(4311, HWREV_EQ(2), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT), BHND_CHIP_QUIRK(4312, HWREV_EQ(0), SIBA_QUIRK_PCIE_D11_SB_TIMEOUT), + BHND_DEVICE_QUIRK_END }; static struct bhnd_device bridge_devs[] = { BHND_DEVICE(BCM, PCI, NULL, bridge_quirks), + BHND_DEVICE_END }; static int From owner-svn-src-all@freebsd.org Sun Sep 4 01:43:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C6A7B786E1; Sun, 4 Sep 2016 01:43:56 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B34B65E; Sun, 4 Sep 2016 01:43:56 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841htiB049150; Sun, 4 Sep 2016 01:43:55 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841htkf049147; Sun, 4 Sep 2016 01:43:55 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040143.u841htkf049147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305374 - head/sys/dev/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 01:43:56 -0000 Author: landonf Date: Sun Sep 4 01:43:54 2016 New Revision: 305374 URL: https://svnweb.freebsd.org/changeset/base/305374 Log: bhndb(4): Skip disabled cores when performing bridge configuration probing. On BCM4321 chipsets, both PCI and PCIe cores are included, with one of the cores potentially left floating. Since the PCI core appears first in the device table, and the PCI profiles appear first in the resource configuration tables, this resulted in incorrectly matching and using the PCI/v1 resource configuration on PCIe devices, rather than the correct PCIe/v1 profile. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_if.m Modified: head/sys/dev/bhnd/bhndb/bhnd_bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhnd_bhndb.c Sun Sep 4 01:43:54 2016 (r305374) @@ -66,6 +66,17 @@ bhnd_bhndb_get_attach_type(device_t dev, return (BHND_ATTACH_ADAPTER); } + +static bool +bhnd_bhndb_is_hw_disabled(device_t dev, device_t child) +{ + struct bhnd_core_info core = bhnd_get_core_info(child); + + /* Delegate to parent bridge */ + return (BHNDB_IS_CORE_DISABLED(device_get_parent(dev), dev, &core)); +} + + static device_t bhnd_bhndb_find_hostb_device(device_t dev) { @@ -112,6 +123,7 @@ bhnd_bhndb_pwrctl_ungate_clock(device_t static device_method_t bhnd_bhndb_methods[] = { /* BHND interface */ DEVMETHOD(bhnd_bus_get_attach_type, bhnd_bhndb_get_attach_type), + DEVMETHOD(bhnd_bus_is_hw_disabled, bhnd_bhndb_is_hw_disabled), DEVMETHOD(bhnd_bus_find_hostb_device, bhnd_bhndb_find_hostb_device), DEVMETHOD(bhnd_bus_read_board_info, bhnd_bhndb_read_board_info), Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhndb.c Sun Sep 4 01:43:54 2016 (r305374) @@ -85,8 +85,9 @@ static int bhndb_init_full_config(str static struct bhnd_core_info *bhndb_get_bridge_core(struct bhndb_softc *sc); -static bool bhndb_hw_matches(struct bhnd_core_info *cores, - u_int ncores, const struct bhndb_hw *hw); +static bool bhndb_hw_matches(struct bhndb_softc *sc, + struct bhnd_core_info *cores, u_int ncores, + const struct bhndb_hw *hw); static int bhndb_init_region_cfg(struct bhndb_softc *sc, bhnd_erom_t *erom, @@ -212,14 +213,15 @@ bhndb_get_bridge_core(struct bhndb_softc /** * Return true if @p cores matches the @p hw specification. - * + * + * @param sc BHNDB device state. * @param cores A device table to match against. * @param ncores The number of cores in @p cores. * @param hw The hardware description to be matched against. */ static bool -bhndb_hw_matches(struct bhnd_core_info *cores, u_int ncores, - const struct bhndb_hw *hw) +bhndb_hw_matches(struct bhndb_softc *sc, struct bhnd_core_info *cores, + u_int ncores, const struct bhndb_hw *hw) { for (u_int i = 0; i < hw->num_hw_reqs; i++) { const struct bhnd_core_match *match; @@ -229,7 +231,12 @@ bhndb_hw_matches(struct bhnd_core_info * found = false; for (u_int d = 0; d < ncores; d++) { - if (!bhnd_core_matches(&cores[d], match)) + struct bhnd_core_info *core = &cores[d]; + + if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core)) + continue; + + if (!bhnd_core_matches(core, match)) continue; found = true; @@ -353,7 +360,7 @@ bhndb_init_region_cfg(struct bhndb_softc */ /* ... do not require bridge resources */ - if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, sc->dev, core)) + if (BHNDB_IS_CORE_DISABLED(sc->dev, sc->bus_dev, core)) continue; /* ... do not have a priority table entry */ @@ -475,7 +482,7 @@ bhndb_find_hwspec(struct bhndb_softc *sc /* Search for the first matching hardware config. */ hw_table = BHNDB_BUS_GET_HARDWARE_TABLE(sc->parent_dev, sc->dev); for (next = hw_table; next->hw_reqs != NULL; next++) { - if (!bhndb_hw_matches(cores, ncores, next)) + if (!bhndb_hw_matches(sc, cores, ncores, next)) continue; /* Found */ @@ -1166,30 +1173,27 @@ bhndb_get_chipid(device_t dev, device_t return (&sc->chipid); } - /** - * Default implementation of BHND_BUS_IS_HW_DISABLED(). + * Default implementation of BHNDB_IS_CORE_DISABLED(). */ static bool -bhndb_is_hw_disabled(device_t dev, device_t child) +bhndb_is_core_disabled(device_t dev, device_t child, + struct bhnd_core_info *core) { struct bhndb_softc *sc; struct bhnd_core_info *bridge_core; - struct bhnd_core_info core; sc = device_get_softc(dev); - core = bhnd_get_core_info(child); - /* Try to defer to the bhndb bus parent */ - if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, dev, &core)) + if (BHNDB_BUS_IS_CORE_DISABLED(sc->parent_dev, dev, core)) return (true); /* Otherwise, we treat bridge-capable cores as unpopulated if they're * not the configured host bridge */ bridge_core = bhndb_get_bridge_core(sc); - if (BHND_DEVCLASS_SUPPORTS_HOSTB(bhnd_core_class(&core))) - return (!bhnd_cores_equal(&core, bridge_core)); + if (BHND_DEVCLASS_SUPPORTS_HOSTB(bhnd_core_class(core))) + return (!bhnd_cores_equal(core, bridge_core)); /* Assume the core is populated */ return (false); @@ -2153,12 +2157,12 @@ static device_method_t bhndb_methods[] = /* BHNDB interface */ DEVMETHOD(bhndb_get_chipid, bhndb_get_chipid), + DEVMETHOD(bhndb_is_core_disabled, bhndb_is_core_disabled), DEVMETHOD(bhndb_get_hostb_core, bhndb_get_hostb_core), DEVMETHOD(bhndb_suspend_resource, bhndb_suspend_resource), DEVMETHOD(bhndb_resume_resource, bhndb_resume_resource), /* BHND interface */ - DEVMETHOD(bhnd_bus_is_hw_disabled, bhndb_is_hw_disabled), DEVMETHOD(bhnd_bus_get_chipid, bhndb_get_chipid), DEVMETHOD(bhnd_bus_activate_resource, bhndb_activate_bhnd_resource), DEVMETHOD(bhnd_bus_deactivate_resource, bhndb_deactivate_bhnd_resource), Modified: head/sys/dev/bhnd/bhndb/bhndb_if.m ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_if.m Sun Sep 4 01:25:46 2016 (r305373) +++ head/sys/dev/bhnd/bhndb/bhndb_if.m Sun Sep 4 01:43:54 2016 (r305374) @@ -61,7 +61,14 @@ CODE { { panic("bhndb_populate_board_info unimplemented"); } - + + static int + bhndb_null_is_core_disabled(device_t dev, device_t child, + struct bhnd_core_info *core) + { + panic("bhndb_is_core_disabled unimplemented"); + } + static int bhndb_null_get_hostb_core(device_t dev, device_t child, struct bhnd_core_info *core) @@ -118,6 +125,24 @@ METHOD int populate_board_info { } DEFAULT bhndb_null_populate_board_info; /** + * Return true if the hardware required by @p core is unpopulated or + * otherwise unusable. + * + * In some cases, the core's pins may be left floating, or the hardware + * may otherwise be non-functional; this method allows the parent device + * to explicitly specify whether @p core should be disabled. + * + * @param dev The parent device of @p child. + * @param child The attached bhnd device. + * @param core A core discovered on @p child. + */ +METHOD bool is_core_disabled { + device_t dev; + device_t child; + struct bhnd_core_info *core; +} DEFAULT bhndb_null_is_core_disabled; + +/** * Get the host bridge core info for the attached bhnd bus. * * @param dev The bridge device. From owner-svn-src-all@freebsd.org Sun Sep 4 01:47:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4995B788D2; Sun, 4 Sep 2016 01:47:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4F4A9A8; Sun, 4 Sep 2016 01:47:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u841lLhQ049326; Sun, 4 Sep 2016 01:47:21 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u841lL2G049325; Sun, 4 Sep 2016 01:47:21 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201609040147.u841lL2G049325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Sun, 4 Sep 2016 01:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305375 - head/sys/dev/bhnd/bhndb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 01:47:22 -0000 Author: landonf Date: Sun Sep 4 01:47:21 2016 New Revision: 305375 URL: https://svnweb.freebsd.org/changeset/base/305375 Log: bhndb(4): Fix probing of bhndb-attached bhnd_nvram devices. This fixes bhnd(4) nvram handling on devices that map SPROM CSRs via PCI configuration space. The probe method previously required that a bhnd(4) device be attached to the parent bridge; now that the bhnd_nvram device is always attached first, this unnecessary sanity check always failed. Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Modified: head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Sun Sep 4 01:43:54 2016 (r305374) +++ head/sys/dev/bhnd/bhndb/bhndb_pci_sprom.c Sun Sep 4 01:47:21 2016 (r305375) @@ -60,17 +60,13 @@ __FBSDID("$FreeBSD$"); static int bhndb_pci_sprom_probe(device_t dev) { - device_t bridge, bus; + device_t bridge; int error; - /* Our parent must be a PCI-BHND bridge with an attached bhnd bus */ + /* Our parent must be a PCI-BHND bridge */ bridge = device_get_parent(dev); if (device_get_driver(bridge) != &bhndb_pci_driver) return (ENXIO); - - bus = device_find_child(bridge, devclass_get_name(bhnd_devclass), 0); - if (bus == NULL) - return (ENXIO); /* Defer to default driver implementation */ if ((error = bhnd_sprom_probe(dev)) > 0) From owner-svn-src-all@freebsd.org Sun Sep 4 04:12:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53964BCE644; Sun, 4 Sep 2016 04:12:06 +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 ECC03B16; Sun, 4 Sep 2016 04:12:05 +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 068F9D4A9FA; Sun, 4 Sep 2016 14:11:51 +1000 (AEST) Date: Sun, 4 Sep 2016 14:11:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305362 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/i386/i386 sys/i386/include sys/mips/mips sys/powerpc/aim sys/powerpc/booke sys/powerpc/powerpc... In-Reply-To: <201609032038.u83KcDYA033362@repo.freebsd.org> Message-ID: <20160904131717.I913@besplex.bde.org> References: <201609032038.u83KcDYA033362@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=CoZCCSMD 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=TwZxhBisbO2s35zHJhEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 04:12:06 -0000 On Sat, 3 Sep 2016, Mark Johnston wrote: > Log: > Remove support for idle page zeroing. > > Idle page zeroing has been disabled by default on all architectures since > r170816 and has some bugs that make it seemingly unusable. Specifically, > the idle-priority pagezero thread exacerbates contention for the free page > lock, and yields the CPU without releasing it in non-preemptive kernels. The > pagezero thread also does not behave correctly when superpage reservations > are enabled: its target is a function of v_free_count, which includes > reserved-but-free pages, but it is only able to zero pages belonging to the > physical memory allocator. > > Reviewed by: alc, imp, kib It worked well in 2007. I tried to fix it, and asked alc to fix it, in 2008, but didn't get anywhere. Now another problem is obvious. Memories and CPUs are a bit faster, but context switches are still very slow. My newest system can "rep stosb" at 16-128GB/sec or 1/32-1/4usec per page, but it takes 1 usec for a (user) context switch. So to amortize the cost of a context switch, idlezero needs to zero many pages per switch, perhaps hundreds, and to ensure this it must run at high (numerically low) priority and schedule itself to not become too active, but it does exactly the opposite (idle priority, and then if PREEMPTION is configured, scheduled generally with the opposite policy). But if it schedules itself to do many pages at a time, this gives bad latency. Zeroing in idle last worked correctly in FreeBSD-4 with UP. Then there were no kernel context switches and vm_page_zero_idle() was just a function call away from the idle loop. However, the version with context switching was better than nothing with slow memory in 2007. This is not fixed in the following patch for a ~2008 version: X Index: vm_phys.c X =================================================================== X --- vm_phys.c (revision 181737) X +++ vm_phys.c (working copy) X @@ -41,6 +41,8 @@ X #include X #include X +#include X #include X #include X +#include X #include X #include X @@ -552,7 +554,18 @@ X cnt.v_free_count--; X mtx_unlock(&vm_page_queue_free_mtx); X +#ifndef PREEMPTION_AND_PREEMPTION_WORKS X + if (sched_runnable()) { X + thread_lock(curthread); X + critical_exit(); X + mi_switch(SW_VOL | SWT_IDLE, X + NULL); X + thread_unlock(curthread); X + } else X +#endif X + critical_exit(); X pmap_zero_page_idle(m_tmp); X m_tmp->flags |= PG_ZERO; X mtx_lock(&vm_page_queue_free_mtx); X + critical_enter(); X cnt.v_free_count++; X vm_phys_free_pages(m_tmp, 0); X Index: vm_zeroidle.c X =================================================================== X --- vm_zeroidle.c (revision 181737) X +++ vm_zeroidle.c (working copy) X @@ -122,18 +122,14 @@ X X mtx_lock(&vm_page_queue_free_mtx); X + critical_enter(); X for (;;) { X if (vm_page_zero_check()) { X vm_page_zero_idle(); X -#ifndef PREEMPTION X - if (sched_runnable()) { X - thread_lock(curthread); X - mi_switch(SW_VOL | SWT_IDLE, NULL); X - thread_unlock(curthread); X - } X -#endif X } else { X wakeup_needed = TRUE; X + critical_exit(); X msleep(&zero_state, &vm_page_queue_free_mtx, 0, X "pgzero", hz * 300); X + critical_enter(); X } X } PREEMPTION had to be turned off for best results. This is only practical for SMP systems. It was more broken (gave too many context switches) in 2007 than now. I still turn it off for SMP. Perhaps the extra context switches had a lot to do with this idlezero problem. Any time the system goes idle for a short time, idlezero runs for a short time. Then it gets preempted, but still holds the lock, so there may be another context switch back to it. This might be repeated several times per page. The version in FreeBSD-5.2 is threaded and uses preemption if available, but has vestiges of the FreeBSD-4 scheduling. It sleeps voluntarily after zeroing maxrun pages. But maxrun defaults to 16. A system too new to run FreeBSD-4 is just warming up after doing 16 pages. So my only idea for making this work is: - do it from the idle loop (first remove idle threads, a larger task) - do only 1 page at a time, at high priority - use trylock (while at high priority) and not lock (at idle priority) so see if the lock can be acquired. I now remember that it already raised its priority while holding the lock, using a critical section. Doesn't that work? My fix has something to do with this -- I enlarged the critical section. It should be around acquiring the lock too, so that we never get preempted while holding the lock, but that needs trylock. Bruce From owner-svn-src-all@freebsd.org Sun Sep 4 05:11:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90BACBCC25F; Sun, 4 Sep 2016 05:11:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::232]) (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 5B0C5AB; Sun, 4 Sep 2016 05:11:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x232.google.com with SMTP id p64so54808781pfb.1; Sat, 03 Sep 2016 22:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/jfVrV1LdCaGJGwe3BwXauLRKaepHRuMKsGDNSk6yVY=; b=VxPxoAioCXtuW5WQYJeDL7J7TJP8SDqZe/fJqj+a2pB/+6sudulxKzfESDTkCJ0Von k8i47TE4+BrWSShJmAFT+/Lcg/Jw9SMhN4h8pDIMimzdVZ49To0QD2+Dt/eN9/PP5u2u UgxHC0BrQKHIC6YWcOQ0/0u6YY0mjrPwDAkI/jiLyap+AYsbnCr7JbJCraJ38hvLOv+p dPEzZW2P3jmwkwmPieGt2M1ysdOABnBKTpPmjSL0yc19sT9e26DM2vkbzDPsBpP4qc48 6MIEoUJHk/xJgsqFNwbBeRDi/b8ZLJJX8tHEgM+vMQ7v87fpBJI2LvLMBwpPXwuABRRQ 8JvA== 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=/jfVrV1LdCaGJGwe3BwXauLRKaepHRuMKsGDNSk6yVY=; b=TZ2lhYVxqH767NNkxgsMEYyweZEzPVqL+khHZKsxIrboXWLHainoEmEJSQbSD0qU0U 3KfWlCvc7Yv8R7jwZSkAdPGvbIqB/E6XzmaUnWdAJaEMCQlfTOKoH107JZssv8fWcALv 2Xaj7LagoISKjxbLU35q+uGsPehAh+LAqJO2OlDEPH60kgsgkOGkFbTblQ1yy3M/n/8G ayZhGttkI9GknYqde4TTHJcglh3RyD50FfCSLm3qmr9d/MUWvUBNK2GjayCfG09UPZVs Iv1s2l1pJpdjqcO7LLGP/BgUlOQPfbvS/csMh1UXYmaECwv2kzkTrnJdkKPmUlZVRER3 X5Jw== X-Gm-Message-State: AE9vXwNUx//Rtt6gr+74gLjVdJ/0SkKSrru2hin9LzR61+zZv8HsD65gij8SLkfju8DLHQ== X-Received: by 10.98.106.65 with SMTP id f62mr51108644pfc.107.1472965901719; Sat, 03 Sep 2016 22:11:41 -0700 (PDT) Received: from ?IPv6:2607:fb90:f32:78bf:b53f:4873:1528:4d33? ([2607:fb90:f32:78bf:b53f:4873:1528:4d33]) by smtp.gmail.com with ESMTPSA id ww14sm25008015pac.34.2016.09.03.22.11.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 03 Sep 2016 22:11:41 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r305084 - head/tools/regression/capsicum/syscalls From: Ngie Cooper X-Mailer: iPhone Mail (13G36) In-Reply-To: <20160831070607.GA3259@jarvis> Date: Sat, 3 Sep 2016 22:11:39 -0700 Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <201608301958.u7UJwf1G032550@repo.freebsd.org> <20160831070607.GA3259@jarvis> To: Mariusz Zaborski X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 05:11:42 -0000 > On Aug 31, 2016, at 00:06, Mariusz Zaborski wrote: >=20 >> On Tue, Aug 30, 2016 at 06:04:50PM -0700, Ngie Cooper wrote: >>> On Tue, Aug 30, 2016 at 12:58 PM, Mariusz Zaborski = wrote: >>> Author: oshogbo >>> Date: Tue Aug 30 19:58:41 2016 >>> New Revision: 305084 >>> URL: https://svnweb.freebsd.org/changeset/base/305084 >>>=20 >>> Log: >>> Fix Capsicum syscalls test suite. >>=20 >> Do you plan on MFCing the change? > emaste@ suggested to change it to the kyua tests, what would you think abo= ut > MFCing after that? Sure. Let's work out the kinks with the tests, then we can push that back to= ^/stable/11. Thanks! -Ngie= From owner-svn-src-all@freebsd.org Sun Sep 4 08:52:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCFF5BCEB7D; Sun, 4 Sep 2016 08:52:10 +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 6F1A495D; Sun, 4 Sep 2016 08:52:10 +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 u848q9nh054308; Sun, 4 Sep 2016 08:52:09 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848q9fk054306; Sun, 4 Sep 2016 08:52:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201609040852.u848q9fk054306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 4 Sep 2016 08:52:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305376 - stable/11/sys/boot/efi/boot1 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 08:52:10 -0000 Author: manu Date: Sun Sep 4 08:52:09 2016 New Revision: 305376 URL: https://svnweb.freebsd.org/changeset/base/305376 Log: MFC 304221 and 304271 Use %ju modifier for u_int64_t and %jd modifier for off_t. off_t is long long on arm32 and long on amd64 Correctly print and cast u_int64_t and off_t. Modified: stable/11/sys/boot/efi/boot1/ufs_module.c stable/11/sys/boot/efi/boot1/zfs_module.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/boot1/ufs_module.c ============================================================================== --- stable/11/sys/boot/efi/boot1/ufs_module.c Sun Sep 4 01:47:21 2016 (r305375) +++ stable/11/sys/boot/efi/boot1/ufs_module.c Sun Sep 4 08:52:09 2016 (r305376) @@ -56,9 +56,9 @@ dskread(void *buf, u_int64_t lba, int nb devinfo->dev->Media->MediaId, lba, size, buf); if (status != EFI_SUCCESS) { - DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, " + DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " "status: %lu\n", devinfo->dev, - devinfo->dev->Media->MediaId, lba, size, + devinfo->dev->Media->MediaId, (uintmax_t)lba, size, EFI_ERROR_CODE(status)); return (-1); } Modified: stable/11/sys/boot/efi/boot1/zfs_module.c ============================================================================== --- stable/11/sys/boot/efi/boot1/zfs_module.c Sun Sep 4 01:47:21 2016 (r305375) +++ stable/11/sys/boot/efi/boot1/zfs_module.c Sun Sep 4 08:52:09 2016 (r305376) @@ -53,10 +53,10 @@ vdev_read(vdev_t *vdev, void *priv, off_ status = devinfo->dev->ReadBlocks(devinfo->dev, devinfo->dev->Media->MediaId, lba, bytes, buf); if (status != EFI_SUCCESS) { - DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %zu, size: %zu," - " status: %lu\n", devinfo->dev, - devinfo->dev->Media->MediaId, lba, bytes, - EFI_ERROR_CODE(status)); + DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %jd, size: %zu," + " status: %lu\n", devinfo->dev, + devinfo->dev->Media->MediaId, (intmax_t)lba, bytes, + EFI_ERROR_CODE(status)); return (-1); } From owner-svn-src-all@freebsd.org Sun Sep 4 08:53:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63FCCBCEC08; Sun, 4 Sep 2016 08:53:59 +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 33D9CB0D; Sun, 4 Sep 2016 08:53:59 +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 u848rwuc055087; Sun, 4 Sep 2016 08:53:58 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848rwMX055086; Sun, 4 Sep 2016 08:53:58 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201609040853.u848rwMX055086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 4 Sep 2016 08:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305377 - stable/11/sys/boot/efi/libefi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 08:53:59 -0000 Author: manu Date: Sun Sep 4 08:53:58 2016 New Revision: 305377 URL: https://svnweb.freebsd.org/changeset/base/305377 Log: MFC 304222 Only use WaitForKeys event if it exists, this is not the case in u-boot efi implementation. Modified: stable/11/sys/boot/efi/libefi/efi_console.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/libefi/efi_console.c ============================================================================== --- stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep 4 08:52:09 2016 (r305376) +++ stable/11/sys/boot/efi/libefi/efi_console.c Sun Sep 4 08:53:58 2016 (r305377) @@ -438,8 +438,10 @@ efi_cons_getchar() /* Try to read a key stroke. We wait for one if none is pending. */ status = conin->ReadKeyStroke(conin, &key); - if (status == EFI_NOT_READY) { - BS->WaitForEvent(1, &conin->WaitForKey, &junk); + while (status == EFI_NOT_READY) { + /* Some EFI implementation (u-boot for example) do not support WaitForKey */ + if (conin->WaitForKey != NULL) + BS->WaitForEvent(1, &conin->WaitForKey, &junk); status = conin->ReadKeyStroke(conin, &key); } switch (key.ScanCode) { @@ -454,6 +456,9 @@ efi_cons_getchar() int efi_cons_poll() { + + if (conin->WaitForKey == NULL) + return (1); /* This can clear the signaled state. */ return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS); } From owner-svn-src-all@freebsd.org Sun Sep 4 08:55:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6826BBCEC96; Sun, 4 Sep 2016 08:55:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45B7AC83; Sun, 4 Sep 2016 08:55:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u848tFsG055196; Sun, 4 Sep 2016 08:55:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848tFbF055195; Sun, 4 Sep 2016 08:55:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609040855.u848tFbF055195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 08:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305378 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 08:55:16 -0000 Author: mjg Date: Sun Sep 4 08:55:15 2016 New Revision: 305378 URL: https://svnweb.freebsd.org/changeset/base/305378 Log: cache: put all negative entry management code into dedicated functions Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 08:53:58 2016 (r305377) +++ head/sys/kern/vfs_cache.c Sun Sep 4 08:55:15 2016 (r305378) @@ -433,6 +433,50 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n #endif /* + * Negative entries management + */ +static void +cache_negative_hit(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + TAILQ_REMOVE(&ncneg, ncp, nc_dst); + TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); +} + +static void +cache_negative_insert(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + MPASS(ncp->nc_vp == NULL); + TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + numneg++; +} + +static void +cache_negative_remove(struct namecache *ncp) +{ + + rw_assert(&cache_lock, RA_WLOCKED); + MPASS(ncp->nc_vp == NULL); + TAILQ_REMOVE(&ncneg, ncp, nc_dst); + numneg--; +} + +static void +cache_negative_zap_one(void) +{ + struct namecache *ncp; + + rw_assert(&cache_lock, RA_WLOCKED); + ncp = TAILQ_FIRST(&ncneg); + KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", + ncp, ncp->nc_vp)); + cache_zap(ncp); +} + +/* * cache_zap(): * * Removes a namecache entry from cache, whether it contains an actual @@ -469,8 +513,7 @@ cache_zap(struct namecache *ncp) if (ncp == ncp->nc_vp->v_cache_dd) ncp->nc_vp->v_cache_dd = NULL; } else { - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - numneg--; + cache_negative_remove(ncp); } numcache--; cache_free(ncp); @@ -640,14 +683,7 @@ negative_success: if (!wlocked && !CACHE_UPGRADE_LOCK()) goto wlock; counter_u64_add(numneghits, 1); - /* - * We found a "negative" match, so we shift it to the end of - * the "negative" cache entries queue to satisfy LRU. Also, - * check to see if the entry is a whiteout; indicate this to - * the componentname, if so. - */ - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + cache_negative_hit(ncp); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, @@ -759,15 +795,13 @@ cache_enter_time(struct vnode *dvp, stru TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); } else { - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - numneg--; + cache_negative_remove(ncp); } if (vp != NULL) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); } else { - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - numneg++; + cache_negative_insert(ncp); } ncp->nc_vp = vp; CACHE_WUNLOCK(); @@ -893,17 +927,12 @@ cache_enter_time(struct vnode *dvp, stru } else { if (cnp->cn_flags & ISWHITEOUT) ncp->nc_flag |= NCF_WHITE; - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - numneg++; + cache_negative_insert(ncp); SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, nc_get_name(ncp)); } - if (numneg * ncnegfactor > numcache) { - ncp = TAILQ_FIRST(&ncneg); - KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", - ncp, ncp->nc_vp)); - cache_zap(ncp); - } + if (numneg * ncnegfactor > numcache) + cache_negative_zap_one(); CACHE_WUNLOCK(); } From owner-svn-src-all@freebsd.org Sun Sep 4 08:58:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB450BCED41; Sun, 4 Sep 2016 08:58:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 947C3E1F; Sun, 4 Sep 2016 08:58:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u848wZ9g055340; Sun, 4 Sep 2016 08:58:35 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u848wZgt055339; Sun, 4 Sep 2016 08:58:35 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609040858.u848wZgt055339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 08:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305379 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 08:58:37 -0000 Author: mjg Date: Sun Sep 4 08:58:35 2016 New Revision: 305379 URL: https://svnweb.freebsd.org/changeset/base/305379 Log: cache: manage negative entry list with a dedicated lock Since negative entries are managed with a LRU list, a hit requires a modificaton. Currently the code tries to upgrade the global lock if needed and is forced to retry the lookup if it fails. Provide a dedicated lock for use when the cache is only shared-locked. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 08:55:15 2016 (r305378) +++ head/sys/kern/vfs_cache.c Sun Sep 4 08:58:35 2016 (r305379) @@ -186,6 +186,9 @@ RW_SYSINIT(vfscache, &cache_lock, "Name #define CACHE_WLOCK() rw_wlock(&cache_lock) #define CACHE_WUNLOCK() rw_wunlock(&cache_lock) +static struct mtx_padalign ncneg_mtx; +MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "Name Cache neg", MTX_DEF); + /* * UMA zones for the VFS cache. * @@ -436,12 +439,21 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n * Negative entries management */ static void -cache_negative_hit(struct namecache *ncp) +cache_negative_hit(struct namecache *ncp, int wlocked) { - rw_assert(&cache_lock, RA_WLOCKED); + if (!wlocked) { + rw_assert(&cache_lock, RA_RLOCKED); + mtx_lock(&ncneg_mtx); + } else { + rw_assert(&cache_lock, RA_WLOCKED); + } + TAILQ_REMOVE(&ncneg, ncp, nc_dst); TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); + + if (!wlocked) + mtx_unlock(&ncneg_mtx); } static void @@ -680,16 +692,17 @@ negative_success: return (0); } - if (!wlocked && !CACHE_UPGRADE_LOCK()) - goto wlock; counter_u64_add(numneghits, 1); - cache_negative_hit(ncp); + cache_negative_hit(ncp, wlocked); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, nc_get_name(ncp)); cache_out_ts(ncp, tsp, ticksp); - CACHE_WUNLOCK(); + if (wlocked) + CACHE_WUNLOCK(); + else + CACHE_RUNLOCK(); return (ENOENT); wlock: From owner-svn-src-all@freebsd.org Sun Sep 4 12:01:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79862A9D8E8; Sun, 4 Sep 2016 12:01:33 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD22937; Sun, 4 Sep 2016 12:01:33 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84C1WmK023928; Sun, 4 Sep 2016 12:01:32 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84C1W0o023927; Sun, 4 Sep 2016 12:01:32 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041201.u84C1W0o023927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 12:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305380 - head/lib/msun/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 12:01:33 -0000 Author: bde Date: Sun Sep 4 12:01:32 2016 New Revision: 305380 URL: https://svnweb.freebsd.org/changeset/base/305380 Log: Fix missing fmodl() on arches with 53-bit long doubles. PR: 199422, 211965 MFC after: 1 week Modified: head/lib/msun/src/e_fmod.c Modified: head/lib/msun/src/e_fmod.c ============================================================================== --- head/lib/msun/src/e_fmod.c Sun Sep 4 08:58:35 2016 (r305379) +++ head/lib/msun/src/e_fmod.c Sun Sep 4 12:01:32 2016 (r305380) @@ -20,6 +20,8 @@ __FBSDID("$FreeBSD$"); * Method: shift and subtract */ +#include + #include "math.h" #include "math_private.h" @@ -130,3 +132,7 @@ __ieee754_fmod(double x, double y) } return x; /* exact output */ } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(fmod, fmodl); +#endif From owner-svn-src-all@freebsd.org Sun Sep 4 12:17:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE6D0A9DCEC; Sun, 4 Sep 2016 12:17:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A03C1FE8; Sun, 4 Sep 2016 12:17:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84CHwmj031660; Sun, 4 Sep 2016 12:17:58 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84CHww3031651; Sun, 4 Sep 2016 12:17:58 GMT (envelope-from des@FreeBSD.org) Message-Id: <201609041217.u84CHww3031651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sun, 4 Sep 2016 12:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305381 - in head: contrib/unbound contrib/unbound/cachedb contrib/unbound/compat contrib/unbound/daemon contrib/unbound/dns64 contrib/unbound/dnstap contrib/unbound/doc contrib/unbound... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 12:18:00 -0000 Author: des Date: Sun Sep 4 12:17:57 2016 New Revision: 305381 URL: https://svnweb.freebsd.org/changeset/base/305381 Log: Upgrade to Unbound 1.5.9. Added: head/contrib/unbound/cachedb/ - copied from r305347, vendor/unbound/dist/cachedb/ head/contrib/unbound/compat/strsep.c - copied unchanged from r305347, vendor/unbound/dist/compat/strsep.c head/contrib/unbound/util/ub_event.c - copied unchanged from r305347, vendor/unbound/dist/util/ub_event.c head/contrib/unbound/util/ub_event.h - copied, changed from r305347, vendor/unbound/dist/util/ub_event.h head/contrib/unbound/util/ub_event_pluggable.c - copied unchanged from r305347, vendor/unbound/dist/util/ub_event_pluggable.c Modified: head/contrib/unbound/Makefile.in head/contrib/unbound/acx_nlnetlabs.m4 head/contrib/unbound/compat/explicit_bzero.c head/contrib/unbound/compat/getentropy_linux.c head/contrib/unbound/config.h head/contrib/unbound/config.h.in head/contrib/unbound/configure head/contrib/unbound/configure.ac head/contrib/unbound/daemon/daemon.c head/contrib/unbound/daemon/daemon.h head/contrib/unbound/daemon/remote.c head/contrib/unbound/daemon/unbound.c head/contrib/unbound/daemon/worker.c head/contrib/unbound/dns64/dns64.c head/contrib/unbound/dnstap/dnstap.c head/contrib/unbound/doc/Changelog head/contrib/unbound/doc/README head/contrib/unbound/doc/example.conf head/contrib/unbound/doc/example.conf.in head/contrib/unbound/doc/libunbound.3 head/contrib/unbound/doc/libunbound.3.in head/contrib/unbound/doc/unbound-anchor.8 head/contrib/unbound/doc/unbound-anchor.8.in head/contrib/unbound/doc/unbound-checkconf.8 head/contrib/unbound/doc/unbound-checkconf.8.in head/contrib/unbound/doc/unbound-control.8 head/contrib/unbound/doc/unbound-control.8.in head/contrib/unbound/doc/unbound-host.1 head/contrib/unbound/doc/unbound-host.1.in head/contrib/unbound/doc/unbound.8 head/contrib/unbound/doc/unbound.8.in head/contrib/unbound/doc/unbound.conf.5 head/contrib/unbound/doc/unbound.conf.5.in head/contrib/unbound/iterator/iter_fwd.c head/contrib/unbound/iterator/iter_utils.c head/contrib/unbound/iterator/iter_utils.h head/contrib/unbound/iterator/iterator.c head/contrib/unbound/iterator/iterator.h head/contrib/unbound/libunbound/context.h head/contrib/unbound/libunbound/libunbound.c head/contrib/unbound/libunbound/libworker.c head/contrib/unbound/libunbound/libworker.h head/contrib/unbound/libunbound/python/libunbound.i head/contrib/unbound/libunbound/ubsyms.def head/contrib/unbound/libunbound/unbound-event.h head/contrib/unbound/libunbound/worker.h head/contrib/unbound/services/cache/dns.c head/contrib/unbound/services/listen_dnsport.c head/contrib/unbound/services/listen_dnsport.h head/contrib/unbound/services/localzone.c head/contrib/unbound/services/localzone.h head/contrib/unbound/services/mesh.c head/contrib/unbound/services/modstack.c head/contrib/unbound/services/outside_network.c head/contrib/unbound/services/outside_network.h head/contrib/unbound/sldns/keyraw.c head/contrib/unbound/sldns/parseutil.c head/contrib/unbound/sldns/rrdef.h head/contrib/unbound/sldns/str2wire.c head/contrib/unbound/sldns/wire2str.c head/contrib/unbound/smallapp/unbound-checkconf.c head/contrib/unbound/smallapp/unbound-control.c head/contrib/unbound/smallapp/worker_cb.c head/contrib/unbound/util/config_file.c head/contrib/unbound/util/config_file.h head/contrib/unbound/util/configlexer.lex head/contrib/unbound/util/configparser.y head/contrib/unbound/util/data/dname.c head/contrib/unbound/util/data/msgencode.c head/contrib/unbound/util/data/msgparse.c head/contrib/unbound/util/data/msgparse.h head/contrib/unbound/util/data/msgreply.c head/contrib/unbound/util/data/msgreply.h head/contrib/unbound/util/fptr_wlist.c head/contrib/unbound/util/fptr_wlist.h head/contrib/unbound/util/iana_ports.inc head/contrib/unbound/util/module.h head/contrib/unbound/util/net_help.c head/contrib/unbound/util/netevent.c head/contrib/unbound/util/netevent.h head/contrib/unbound/util/tube.c head/contrib/unbound/util/tube.h head/contrib/unbound/validator/autotrust.c head/contrib/unbound/validator/val_anchor.c head/contrib/unbound/validator/val_secalgo.c head/contrib/unbound/validator/val_secalgo.h head/lib/libunbound/Makefile head/usr.sbin/unbound/checkconf/Makefile head/usr.sbin/unbound/control/Makefile head/usr.sbin/unbound/daemon/Makefile Directory Properties: head/contrib/unbound/ (props changed) Modified: head/contrib/unbound/Makefile.in ============================================================================== --- head/contrib/unbound/Makefile.in Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/Makefile.in Sun Sep 4 12:17:57 2016 (r305381) @@ -108,11 +108,12 @@ util/fptr_wlist.c util/locks.c util/log. util/netevent.c util/net_help.c util/random.c util/rbtree.c util/regional.c \ util/rtt.c util/storage/dnstree.c util/storage/lookup3.c \ util/storage/lruhash.c util/storage/slabhash.c util/timehist.c util/tube.c \ -util/winsock_event.c validator/autotrust.c validator/val_anchor.c \ -validator/validator.c validator/val_kcache.c validator/val_kentry.c \ -validator/val_neg.c validator/val_nsec3.c validator/val_nsec.c \ -validator/val_secalgo.c validator/val_sigcrypt.c \ -validator/val_utils.c dns64/dns64.c $(CHECKLOCK_SRC) $(DNSTAP_SRC) +util/ub_event.c util/ub_event_pluggable.c util/winsock_event.c \ +validator/autotrust.c validator/val_anchor.c validator/validator.c \ +validator/val_kcache.c validator/val_kentry.c validator/val_neg.c \ +validator/val_nsec3.c validator/val_nsec.c validator/val_secalgo.c \ +validator/val_sigcrypt.c validator/val_utils.c dns64/dns64.c cachedb/cachedb.c $(CHECKLOCK_SRC) \ +$(DNSTAP_SRC) COMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \ as112.lo msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \ iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \ @@ -122,10 +123,11 @@ fptr_wlist.lo locks.lo log.lo mini_event random.lo rbtree.lo regional.lo rtt.lo dnstree.lo lookup3.lo lruhash.lo \ slabhash.lo timehist.lo tube.lo winsock_event.lo autotrust.lo val_anchor.lo \ validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \ -val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo \ +val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo \ $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ) $(DNSTAP_OBJ) -COMMON_OBJ=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ +COMMON_OBJ_WITHOUT_UB_EVENT=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ outside_network.lo +COMMON_OBJ=$(COMMON_OBJ_WITHOUT_UB_EVENT) ub_event.lo # set to $COMMON_OBJ or to "" if --enableallsymbols COMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@ COMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \ @@ -134,7 +136,8 @@ compat/memcmp.c compat/memmove.c compat/ compat/strlcpy.c compat/strptime.c compat/getentropy_linux.c \ compat/getentropy_osx.c compat/getentropy_solaris.c compat/getentropy_win.c \ compat/explicit_bzero.c compat/arc4random.c compat/arc4random_uniform.c \ -compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c +compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c \ +compat/strsep.c COMPAT_OBJ=$(LIBOBJS:.o=.lo) COMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo) COMPAT_OBJ_WITHOUT_CTIMEARC4=$(LIBOBJ_WITHOUT_CTIMEARC4:.o=.lo) @@ -177,7 +180,8 @@ daemon/worker.c daemon/acl_list.c daemon testcode/replay.c testcode/fake_event.c TESTBOUND_OBJ=testbound.lo replay.lo fake_event.lo TESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) testpkts.lo worker.lo acl_list.lo \ -daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(SLDNS_OBJ) $(COMPAT_OBJ) +daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) ub_event.lo $(SLDNS_OBJ) \ +$(COMPAT_OBJ) LOCKVERIFY_SRC=testcode/lock_verify.c LOCKVERIFY_OBJ=lock_verify.lo LOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ @@ -209,8 +213,8 @@ DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_c $(SLDNS_OBJ) LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \ libunbound/libworker.c -LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo -LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ) +LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo ub_event_pluggable.lo +LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ_WITHOUT_UB_EVENT) $(SLDNS_OBJ) $(COMPAT_OBJ) # win apps or "" if not on windows WINAPPS=@WINAPPS@ @@ -552,7 +556,7 @@ uninstall: $(PYTHONMOD_UNINSTALL) $(PYUN @echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand" iana_update: - curl -o port-numbers.tmp http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed + curl -o port-numbers.tmp https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed if file port-numbers.tmp | grep 'gzip' >/dev/null; then zcat port-numbers.tmp; else cat port-numbers.tmp; fi | awk '// {p=0;} /udp/ {p=1;} /[^u]/ {p=0;} /Decomissioned|Decommissioned|Removed|De-registered|unassigned|Unassigned|Reserved/ {u=1;} // { if(u==1) {u=0;} else { if(p==1) { match($$0,/[0-9]+/); print substr($$0, RSTART, RLENGTH) ","}}}' | sort -nu > util/iana_ports.inc rm -f port-numbers.tmp @@ -596,7 +600,6 @@ depend: rm -f $(DEPEND_TMP) $(DEPEND_TMP2) # Dependencies -as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/msgreply.h \ @@ -614,6 +617,7 @@ rrset.lo rrset.o: $(srcdir)/services/cac $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h +as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dname.lo dname.o: $(srcdir)/util/data/dname.c config.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/storage/lookup3.h $(srcdir)/sldns/sbuffer.h @@ -624,9 +628,9 @@ msgencode.lo msgencode.o: $(srcdir)/util $(srcdir)/sldns/sbuffer.h msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c config.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h \ - $(srcdir)/sldns/wire2str.h + $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \ @@ -718,7 +722,7 @@ modstack.lo modstack.o: $(srcdir)/servic $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \ - $(srcdir)/validator/val_utils.h + $(srcdir)/validator/val_utils.h $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \ $(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h @@ -762,7 +766,8 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/ut $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \ $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h + $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h \ + $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ @@ -773,12 +778,12 @@ mini_event.lo mini_event.o: $(srcdir)/ut module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h -netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ +netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/ub_event.h \ + $(srcdir)/util/log.h $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/dnstap/dnstap.h net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -808,7 +813,15 @@ tube.lo tube.o: $(srcdir)/util/tube.c co $(srcdir)/util/netevent.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h + $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/ub_event.h +ub_event.lo ub_event.o: $(srcdir)/util/ub_event.c config.h $(srcdir)/util/ub_event.h $(srcdir)/util/log.h \ + $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h +ub_event_pluggable.lo ub_event_pluggable.o: $(srcdir)/util/ub_event_pluggable.c config.h $(srcdir)/util/ub_event.h \ + $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h $(srcdir)/validator/autotrust.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -822,8 +835,8 @@ autotrust.lo autotrust.o: $(srcdir)/vali val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h $(srcdir)/validator/val_anchor.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h $(srcdir)/util/as112.h + $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/as112.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h validator.lo validator.o: $(srcdir)/validator/validator.c config.h $(srcdir)/validator/validator.h \ $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -880,7 +893,7 @@ val_utils.lo val_utils.o: $(srcdir)/vali $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h + $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h dns64.lo dns64.o: $(srcdir)/dns64/dns64.c config.h $(srcdir)/dns64/dns64.h $(srcdir)/util/module.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ @@ -888,6 +901,14 @@ dns64.lo dns64.o: $(srcdir)/dns64/dns64. $(srcdir)/util/storage/slabhash.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h +cachedb.lo cachedb.o: $(srcdir)/cachedb/cachedb.c config.h $(srcdir)/cachedb/cachedb.h $(srcdir)/util/module.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \ + $(srcdir)/util/data/msgencode.h $(srcdir)/services/cache/dns.h $(srcdir)/validator/val_neg.h \ + $(srcdir)/util/rbtree.h $(srcdir)/validator/val_secalgo.h $(srcdir)/iterator/iter_utils.h \ + $(srcdir)/iterator/iter_resptype.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \ + $(srcdir)/sldns/sbuffer.h checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/testcode/checklocks.h unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ @@ -994,7 +1015,7 @@ unbound.lo unbound.o: $(srcdir)/daemon/u $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/util/ub_event.h worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ @@ -1020,7 +1041,7 @@ testbound.lo testbound.o: $(srcdir)/test $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h @@ -1101,7 +1122,7 @@ unbound-checkconf.lo unbound-checkconf.o $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/localzone.h \ - $(srcdir)/sldns/sbuffer.h + $(srcdir)/sldns/sbuffer.h $(PYTHONMOD_HEADER) worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -1121,9 +1142,10 @@ libunbound.lo libunbound.o: $(srcdir)/li $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/services/localzone.h \ - $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/util/ub_event.h \ + $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/sldns/sbuffer.h libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ @@ -1163,14 +1185,15 @@ pythonmod_utils.lo pythonmod_utils.o: $( $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \ $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h \ + win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \ $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/winsock_event.h + $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/ub_event.h w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h unbound-service-install.lo unbound-service-install.o: $(srcdir)/winrc/unbound-service-install.c config.h \ $(srcdir)/winrc/w_inst.h @@ -1202,6 +1225,7 @@ snprintf.lo snprintf.o: $(srcdir)/compat strlcat.lo strlcat.o: $(srcdir)/compat/strlcat.c config.h strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c config.h strptime.lo strptime.o: $(srcdir)/compat/strptime.c config.h +strsep.lo strsep.o: $(srcdir)/compat/strsep.c config.h getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c config.h getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c config.h getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c config.h Modified: head/contrib/unbound/acx_nlnetlabs.m4 ============================================================================== --- head/contrib/unbound/acx_nlnetlabs.m4 Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/acx_nlnetlabs.m4 Sun Sep 4 12:17:57 2016 (r305381) @@ -2,7 +2,9 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 32 +# Version 34 +# 2016-03-21 Check -ldl -pthread for libcrypto for ldns and openssl 1.1.0. +# 2016-03-21 Use HMAC_Update instead of HMAC_CTX_Init (for openssl-1.1.0). # 2016-01-04 -D_DEFAULT_SOURCE defined with -D_BSD_SOURCE for Linux glibc 2.20 # 2015-12-11 FLTO check for new OSX, clang. # 2015-11-18 spelling check fix. @@ -671,16 +673,16 @@ AC_DEFUN([ACX_SSL_CHECKS], [ ACX_RUNTIME_PATH_ADD([$ssldir/lib]) fi - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + AC_MSG_CHECKING([for HMAC_Update in -lcrypto]) LIBS="$LIBS -lcrypto" LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ], [ AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) ], [ AC_MSG_RESULT(no) # check if -lwsock32 or -lgdi32 are needed. @@ -690,11 +692,11 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) @@ -704,15 +706,30 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -ldl" AC_MSG_CHECKING([if -lcrypto needs -ldl]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl -pthread" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread" + AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread]) + AC_TRY_LINK([], [ + int HMAC_Update(void); + (void)HMAC_Update(); + ],[ + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + ]) ]) ]) ]) Modified: head/contrib/unbound/compat/explicit_bzero.c ============================================================================== --- head/contrib/unbound/compat/explicit_bzero.c Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/compat/explicit_bzero.c Sun Sep 4 12:17:57 2016 (r305381) @@ -6,7 +6,11 @@ #include "config.h" #include +#ifdef HAVE_ATTR_WEAK __attribute__((weak)) void +#else +void +#endif __explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) { } Modified: head/contrib/unbound/compat/getentropy_linux.c ============================================================================== --- head/contrib/unbound/compat/getentropy_linux.c Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/compat/getentropy_linux.c Sun Sep 4 12:17:57 2016 (r305381) @@ -94,7 +94,7 @@ int getentropy(void *buf, size_t len); extern int main(int, char *argv[]); #endif static int gotdata(char *buf, size_t len); -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len); #endif static int getentropy_urandom(void *buf, size_t len); @@ -113,7 +113,7 @@ getentropy(void *buf, size_t len) return -1; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) /* * Try descriptor-less getrandom() */ @@ -209,7 +209,7 @@ gotdata(char *buf, size_t len) return 0; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len) { Copied: head/contrib/unbound/compat/strsep.c (from r305347, vendor/unbound/dist/compat/strsep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/unbound/compat/strsep.c Sun Sep 4 12:17:57 2016 (r305381, copy of r305347, vendor/unbound/dist/compat/strsep.c) @@ -0,0 +1,65 @@ +/** + * strsep implementation for compatibility. + * + * LICENSE + * Copyright (c) 2016, NLnet Labs + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of NLnetLabs 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 "config.h" + +/** see if character is in the delimiter array */ +static int +in_delim(char c, const char* delim) +{ + const char* p; + if(!delim) + return 0; + for(p=delim; *p; p++) { + if(*p == c) + return 1; + } + return 0; +} + +char *strsep(char **stringp, const char *delim) +{ + char* s; + char* orig; + if(stringp == NULL || *stringp == NULL) + return NULL; + orig = *stringp; + s = *stringp; + while(*s && !in_delim(*s, delim)) + s++; + if(*s) { + *s = 0; + *stringp = s+1; + } else { + *stringp = NULL; + } + return orig; +} Modified: head/contrib/unbound/config.h ============================================================================== --- head/contrib/unbound/config.h Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/config.h Sun Sep 4 12:17:57 2016 (r305381) @@ -43,6 +43,9 @@ /* Whether the C compiler accepts the "unused" attribute */ #define HAVE_ATTR_UNUSED 1 +/* Whether the C compiler accepts the "weak" attribute */ +#define HAVE_ATTR_WEAK 1 + /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 @@ -126,6 +129,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_EVENT_H */ +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +/* #undef HAVE_EVP_MD_CTX_NEW */ + /* Define to 1 if you have the `EVP_sha1' function. */ #define HAVE_EVP_SHA1 1 @@ -189,8 +195,8 @@ /* Define to 1 if you have the header file. */ #define HAVE_GRP_H 1 -/* If you have HMAC_CTX_init */ -#define HAVE_HMAC_CTX_INIT 1 +/* If you have HMAC_Update */ +#define HAVE_HMAC_UPDATE 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 @@ -378,6 +384,9 @@ /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 +/* Define to 1 if you have the `strsep' function. */ +#define HAVE_STRSEP 1 + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ /* #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST */ @@ -515,7 +524,7 @@ #define PACKAGE_NAME "unbound" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "unbound 1.5.8" +#define PACKAGE_STRING "unbound 1.5.9" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "unbound" @@ -524,7 +533,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.5.8" +#define PACKAGE_VERSION "1.5.9" /* default pidfile location */ #define PIDFILE "/var/unbound/unbound.pid" @@ -543,7 +552,7 @@ #define ROOT_CERT_FILE "/var/unbound/icannbundle.pem" /* version number for resource files */ -#define RSRC_PACKAGE_VERSION 1,5,8,0 +#define RSRC_PACKAGE_VERSION 1,5,9,0 /* Directory to chdir to */ #define RUN_DIR "/var/unbound" @@ -581,9 +590,15 @@ /* define this to enable debug checks. */ /* #undef UNBOUND_DEBUG */ +/* Define to 1 to use cachedb support */ +/* #undef USE_CACHEDB */ + /* Define to 1 to enable dnstap support */ /* #undef USE_DNSTAP */ +/* Define this to enable DSA support. */ +#define USE_DSA 1 + /* Define this to enable ECDSA support. */ #define USE_ECDSA 1 @@ -980,6 +995,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: head/contrib/unbound/config.h.in ============================================================================== --- head/contrib/unbound/config.h.in Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/config.h.in Sun Sep 4 12:17:57 2016 (r305381) @@ -42,6 +42,9 @@ /* Whether the C compiler accepts the "unused" attribute */ #undef HAVE_ATTR_UNUSED +/* Whether the C compiler accepts the "weak" attribute */ +#undef HAVE_ATTR_WEAK + /* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN @@ -125,6 +128,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_EVENT_H +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +#undef HAVE_EVP_MD_CTX_NEW + /* Define to 1 if you have the `EVP_sha1' function. */ #undef HAVE_EVP_SHA1 @@ -188,8 +194,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT +/* If you have HMAC_Update */ +#undef HAVE_HMAC_UPDATE /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON @@ -377,6 +383,9 @@ /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST @@ -580,9 +589,15 @@ /* define this to enable debug checks. */ #undef UNBOUND_DEBUG +/* Define to 1 to use cachedb support */ +#undef USE_CACHEDB + /* Define to 1 to enable dnstap support */ #undef USE_DNSTAP +/* Define this to enable DSA support. */ +#undef USE_DSA + /* Define this to enable ECDSA support. */ #undef USE_ECDSA @@ -979,6 +994,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: head/contrib/unbound/configure ============================================================================== --- head/contrib/unbound/configure Sun Sep 4 12:01:32 2016 (r305380) +++ head/contrib/unbound/configure Sun Sep 4 12:17:57 2016 (r305381) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unbound 1.5.8. +# Generated by GNU Autoconf 2.69 for unbound 1.5.9. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unbound' PACKAGE_TARNAME='unbound' -PACKAGE_VERSION='1.5.8' -PACKAGE_STRING='unbound 1.5.8' +PACKAGE_VERSION='1.5.9' +PACKAGE_STRING='unbound 1.5.9' PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl' PACKAGE_URL='' @@ -832,6 +832,7 @@ with_ssl enable_sha2 enable_gost enable_ecdsa +enable_dsa enable_event_api with_libevent with_libexpat @@ -842,6 +843,7 @@ enable_dnstap with_dnstap_socket_path with_protobuf_c with_libfstrm +enable_cachedb with_libunbound_only ' ac_precious_vars='build_alias @@ -1397,7 +1399,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unbound 1.5.8 to adapt to many kinds of systems. +\`configure' configures unbound 1.5.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1462,7 +1464,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unbound 1.5.8:";; + short | recursive ) echo "Configuration of unbound 1.5.9:";; esac cat <<\_ACEOF @@ -1495,8 +1497,9 @@ Optional Features: --disable-sha2 Disable SHA256 and SHA512 RRSIG support --disable-gost Disable GOST support --disable-ecdsa Disable ECDSA support - --enable-event-api Enable (experimental) libevent-based libunbound API - installed to unbound-event.h + --disable-dsa Disable DSA support + --enable-event-api Enable (experimental) pluggable event base + libunbound API installed to unbound-event.h --enable-static-exe enable to compile executables statically against (event) libs, for debug purposes --enable-lock-checks enable to check lock and unlock calls, for debug @@ -1505,6 +1508,8 @@ Optional Features: to it, smaller install size but libunbound export table is polluted by internal symbols --enable-dnstap Enable dnstap support (requires fstrm, protobuf-c) + --enable-cachedb enable cachedb module that can use external cache + storage Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1647,7 +1652,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unbound configure 1.5.8 +unbound configure 1.5.9 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2356,7 +2361,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unbound $as_me 1.5.8, which was +It was created by unbound $as_me 1.5.9, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2708,11 +2713,11 @@ UNBOUND_VERSION_MAJOR=1 UNBOUND_VERSION_MINOR=5 -UNBOUND_VERSION_MICRO=8 +UNBOUND_VERSION_MICRO=9 LIBUNBOUND_CURRENT=6 -LIBUNBOUND_REVISION=0 +LIBUNBOUND_REVISION=1 LIBUNBOUND_AGE=4 # 1.0.0 had 0:12:0 # 1.0.1 had 0:13:0 @@ -2760,6 +2765,7 @@ LIBUNBOUND_AGE=4 # 1.5.6 had 5:9:3 # 1.5.7 had 5:10:3 # 1.5.8 had 6:0:4 # adds ub_ctx_set_stub +# 1.5.9 had 6:1:4 # Current -- the number of the binary API that we're implementing # Revision -- which iteration of the implementation of the binary @@ -6117,6 +6123,48 @@ $as_echo "#define HAVE_ATTR_UNUSED 1" >> fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"weak\" attribute" >&5 +$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"weak\" attribute... " >&6; } +if ${ac_cv_c_weak_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_weak_attribute=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +__attribute__((weak)) void f(int x) { printf("%d", x); } + +int +main () +{ + + f(1); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_weak_attribute="yes" +else + ac_cv_c_weak_attribute="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_weak_attribute" >&5 +$as_echo "$ac_cv_c_weak_attribute" >&6; } +if test $ac_cv_c_weak_attribute = yes; then + +$as_echo "#define HAVE_ATTR_WEAK 1" >>confdefs.h + +fi + + if test "$srcdir" != "."; then CPPFLAGS="$CPPFLAGS -I$srcdir" fi @@ -17064,8 +17112,8 @@ $as_echo "found in $ssldir" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Update in -lcrypto" >&5 +$as_echo_n "checking for HMAC_Update in -lcrypto... " >&6; } LIBS="$LIBS -lcrypto" LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17075,8 +17123,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17087,7 +17135,7 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h else @@ -17108,8 +17156,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17118,7 +17166,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -17140,8 +17188,8 @@ int main () { - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ; return 0; @@ -17150,7 +17198,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -17159,7 +17207,43 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl -pthread" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5 +$as_echo_n "checking if -lcrypto needs -ldl -pthread... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_Update(void); + (void)HMAC_Update(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_UPDATE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ @@ -17404,7 +17488,7 @@ fi done -for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode +for ac_func in OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512 FIPS_mode EVP_MD_CTX_new do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17771,15 +17855,46 @@ _ACEOF ;; esac +# Check whether --enable-dsa was given. +if test "${enable_dsa+set}" = set; then : + enableval=$enable_dsa; +fi + +use_dsa="no" +case "$enable_ecdsa" in + no) + ;; + *) + # detect if DSA is supported, and turn it off if not. + ac_fn_c_check_func "$LINENO" "EVP_dss1" "ac_cv_func_EVP_dss1" +if test "x$ac_cv_func_EVP_dss1" = xyes; then : + + +cat >>confdefs.h <<_ACEOF +#define USE_DSA 1 +_ACEOF + + +else + if test "x$enable_dsa" = "xyes"; then as_fn_error $? "OpenSSL does not support DSA and you used --enable-dsa." "$LINENO" 5 + fi +fi + + ;; +esac + + # Check whether --enable-event-api was given. if test "${enable_event_api+set}" = set; then : enableval=$enable_event_api; fi -use_unbound_event="no" case "$enable_event_api" in yes) - use_unbound_event="yes" + UNBOUND_EVENT_INSTALL=unbound-event-install + + UNBOUND_EVENT_UNINSTALL=unbound-event-uninstall + ;; *) ;; @@ -18126,12 +18241,6 @@ done if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi - if test "$use_unbound_event" = "yes"; then - UNBOUND_EVENT_INSTALL=unbound-event-install - - UNBOUND_EVENT_UNINSTALL=unbound-event-uninstall - - fi else $as_echo "#define USE_MINI_EVENT 1" >>confdefs.h @@ -19237,6 +19346,20 @@ esac fi +ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" +if test "x$ac_cv_func_strsep" = xyes; then : + $as_echo "#define HAVE_STRSEP 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" strsep.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strsep.$ac_objext" + ;; +esac + +fi + + # Check whether --enable-allsymbols was given. if test "${enable_allsymbols+set}" = set; then : @@ -19520,6 +19643,23 @@ _ACEOF fi *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Sep 4 12:22:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4822A9D05F; Sun, 4 Sep 2016 12:22:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A853169D; Sun, 4 Sep 2016 12:22:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84CMEsH033142; Sun, 4 Sep 2016 12:22:14 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84CMEdM033135; Sun, 4 Sep 2016 12:22:14 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041222.u84CMEdM033135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 12:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305382 - in head/lib/msun: amd64 i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 12:22:16 -0000 Author: bde Date: Sun Sep 4 12:22:14 2016 New Revision: 305382 URL: https://svnweb.freebsd.org/changeset/base/305382 Log: Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm versions of fmodf() amd fmodl() on i387. fmod is similar to remainder, and the C versions are 3 to 9 times slower than the asm versions on x86 for both, but we had the strange mixture of all 6 variants of remainder in asm and only 1 of 6 variants of fmod in asm. Added: head/lib/msun/amd64/e_fmod.S (contents, props changed) head/lib/msun/amd64/e_fmodf.S (contents, props changed) head/lib/msun/amd64/e_fmodl.S (contents, props changed) head/lib/msun/i387/e_fmodf.S (contents, props changed) head/lib/msun/i387/e_fmodl.S (contents, props changed) Modified: head/lib/msun/amd64/Makefile.inc head/lib/msun/i387/Makefile.inc Modified: head/lib/msun/amd64/Makefile.inc ============================================================================== --- head/lib/msun/amd64/Makefile.inc Sun Sep 4 12:17:57 2016 (r305381) +++ head/lib/msun/amd64/Makefile.inc Sun Sep 4 12:22:14 2016 (r305382) @@ -1,6 +1,7 @@ # $FreeBSD$ -ARCH_SRCS = e_remainder.S e_remainderf.S e_remainderl.S \ +ARCH_SRCS = e_fmod.S e_fmodf.S e_fmodl.S \ + e_remainder.S e_remainderf.S e_remainderl.S \ e_sqrt.S e_sqrtf.S e_sqrtl.S \ s_llrint.S s_llrintf.S s_llrintl.S \ s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \ Added: head/lib/msun/amd64/e_fmod.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmod) + movsd %xmm0,-8(%rsp) + movsd %xmm1,-16(%rsp) + fldl -16(%rsp) + fldl -8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 + fstp %st + ret +END(fmod) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/amd64/e_fmodf.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmodf.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,24 @@ +/* + * Based on the i387 version written by J.T. Conklin . + * Public domain. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodf) + movss %xmm0,-4(%rsp) + movss %xmm1,-8(%rsp) + flds -8(%rsp) + flds -4(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstps -4(%rsp) + movss -4(%rsp),%xmm0 + fstp %st + ret +END(fmodf) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/amd64/e_fmodl.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/amd64/e_fmodl.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodl) + fldt 24(%rsp) + fldt 8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstp %st(1) + ret +END(fmodl) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/Makefile.inc ============================================================================== --- head/lib/msun/i387/Makefile.inc Sun Sep 4 12:17:57 2016 (r305381) +++ head/lib/msun/i387/Makefile.inc Sun Sep 4 12:22:14 2016 (r305382) @@ -7,13 +7,14 @@ ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_l s_trunc.S # float counterparts -ARCH_SRCS+= e_log10f.S e_logf.S e_remainderf.S \ +ARCH_SRCS+= e_fmodf.S e_log10f.S e_logf.S e_remainderf.S \ e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S \ s_llrintf.S s_logbf.S s_lrintf.S \ s_remquof.S s_rintf.S s_scalbnf.S s_significandf.S s_truncf.S # long double counterparts -ARCH_SRCS+= e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \ +ARCH_SRCS+= e_fmodl.S \ + e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \ s_floorl.S s_llrintl.S \ s_logbl.S s_lrintl.S s_remquol.S s_rintl.S s_scalbnl.S s_truncl.S Added: head/lib/msun/i387/e_fmodf.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/i387/e_fmodf.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,24 @@ +/* + * Based on the i387 version written by J.T. Conklin . + * Public domain. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodf) + movss %xmm0,-4(%rsp) + movss %xmm1,-8(%rsp) + flds -8(%rsp) + flds -4(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstps -4(%rsp) + movss -4(%rsp),%xmm0 + fstp %st + ret +END(fmodf) + + .section .note.GNU-stack,"",%progbits Added: head/lib/msun/i387/e_fmodl.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/msun/i387/e_fmodl.S Sun Sep 4 12:22:14 2016 (r305382) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, 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. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + +#include +__FBSDID("$FreeBSD$") + +ENTRY(fmodl) + fldt 24(%rsp) + fldt 8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstp %st(1) + ret +END(fmodl) + + .section .note.GNU-stack,"",%progbits From owner-svn-src-all@freebsd.org Sun Sep 4 13:31:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32DA6A9D271; Sun, 4 Sep 2016 13:31:59 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00C74918; Sun, 4 Sep 2016 13:31:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84DVwBd061145; Sun, 4 Sep 2016 13:31:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84DVwIX061144; Sun, 4 Sep 2016 13:31:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609041331.u84DVwIX061144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 13:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305383 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 13:31:59 -0000 Author: mjg Date: Sun Sep 4 13:31:57 2016 New Revision: 305383 URL: https://svnweb.freebsd.org/changeset/base/305383 Log: fd: fix up fdeget_file It was supposed to return NULL if a fp is not installed. Facepalm-by: mjg Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd static __inline struct filedescent * fdeget_locked(struct filedesc *fdp, int fd) { + struct filedescent *fde; FILEDESC_LOCK_ASSERT(fdp); if (fd < 0 || fd > fdp->fd_lastfile) return (NULL); - return (&fdp->fd_ofiles[fd]); + fde = &fdp->fd_ofiles[fd]; + if (fde->fde_file == NULL) + return (NULL); + + return (fde); } static __inline bool From owner-svn-src-all@freebsd.org Sun Sep 4 14:12:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDB1DA9D9FC; Sun, 4 Sep 2016 14:12:20 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DF37AC8; Sun, 4 Sep 2016 14:12:20 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84ECJtD074227; Sun, 4 Sep 2016 14:12:19 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84ECJo7074226; Sun, 4 Sep 2016 14:12:19 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041412.u84ECJo7074226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 14:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305384 - head/lib/msun/i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 14:12:20 -0000 Author: bde Date: Sun Sep 4 14:12:19 2016 New Revision: 305384 URL: https://svnweb.freebsd.org/changeset/base/305384 Log: Disconnect the "optimized" asm variants of cos(), sin() and tan() from the build on i386. Leave them in the source tree for regression tests. The asm functions were always much less accurate (by a factor of more than 10**18 in the worst case). They were faster on old CPUs. But with each new generation of CPUs they get relatively slower. The double precision C version's average advantage is about a factor of 2 on Haswell. The asm functions were already intentionally avoided in float and long double precision on i386 and in all precisions on amd64. Float precision and amd64 give larger advantages to the C version. The long double precision C code and compilers' understanding of long double precision are not so good, so the i387 is still slightly faster for long double precision, except for the unimportant subcase of huge args where the sub-optimal C code now somehow beats the i387 by about a factor of 2. Modified: head/lib/msun/i387/Makefile.inc Modified: head/lib/msun/i387/Makefile.inc ============================================================================== --- head/lib/msun/i387/Makefile.inc Sun Sep 4 13:31:57 2016 (r305383) +++ head/lib/msun/i387/Makefile.inc Sun Sep 4 14:12:19 2016 (r305384) @@ -2,8 +2,8 @@ ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \ e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \ - s_cos.S s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \ - s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S \ + s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \ + s_remquo.S s_rint.S s_scalbn.S s_significand.S \ s_trunc.S # float counterparts From owner-svn-src-all@freebsd.org Sun Sep 4 14:49:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 772ABA9D4EA; Sun, 4 Sep 2016 14:49:07 +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 07E08F56; Sun, 4 Sep 2016 14:49:06 +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 u84Emxw9065173 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 4 Sep 2016 17:48:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u84Emxw9065173 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u84Emxjo065172; Sun, 4 Sep 2016 17:48:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 4 Sep 2016 17:48:59 +0300 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305382 - in head/lib/msun: amd64 i387 Message-ID: <20160904144859.GC83214@kib.kiev.ua> References: <201609041222.u84CMEdM033135@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201609041222.u84CMEdM033135@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 14:49:07 -0000 On Sun, Sep 04, 2016 at 12:22:14PM +0000, Bruce Evans wrote: > Author: bde > Date: Sun Sep 4 12:22:14 2016 > New Revision: 305382 > URL: https://svnweb.freebsd.org/changeset/base/305382 > > Log: > Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm > versions of fmodf() amd fmodl() on i387. > > fmod is similar to remainder, and the C versions are 3 to 9 times > slower than the asm versions on x86 for both, but we had the strange > mixture of all 6 variants of remainder in asm and only 1 of 6 > variants of fmod in asm. > > Added: > head/lib/msun/amd64/e_fmod.S (contents, props changed) > head/lib/msun/amd64/e_fmodf.S (contents, props changed) > head/lib/msun/amd64/e_fmodl.S (contents, props changed) > head/lib/msun/i387/e_fmodf.S (contents, props changed) It seems that wrong version of i387/f_fmodf.S, it is identical to the amd64 version. > Added: head/lib/msun/amd64/e_fmod.S > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) > +ENTRY(fmod) > + movsd %xmm0,-8(%rsp) > + movsd %xmm1,-16(%rsp) > + fldl -16(%rsp) > + fldl -8(%rsp) > +1: fprem > + fstsw %ax > + testw $0x400,%ax > + jne 1b > + fstpl -8(%rsp) > + movsd -8(%rsp),%xmm0 > + fstp %st > + ret > +END(fmod) I see that this is not a new approach in the amd64 subdirectory, to use x87 FPU on amd64. Please note that it might have non-obvious effects on the performance, in particular, on the speed of the context switches and handling of #NM exception. Newer Intel and possibly AMD CPUs have an optimization which allows coprocessor code to save and restore state to not save and restore state which was not changed. In other words, for typical amd64 binary which uses %xmm register file but did not touched %st nor %ymm, only %xmm bits are spilled and then loaded. Touching %st defeats the optimization, possible for the whole lifetime of the thread. This feature (XSAVEOPT) is available at least starting from Haswell microarchitecture, not sure about IvyBridge. From owner-svn-src-all@freebsd.org Sun Sep 4 15:08:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E371A9D9BE; Sun, 4 Sep 2016 15:08:16 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EB51BAF; Sun, 4 Sep 2016 15:08:15 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84F8F6x096083; Sun, 4 Sep 2016 15:08:15 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84F8F5k096081; Sun, 4 Sep 2016 15:08:15 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609041508.u84F8F5k096081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 4 Sep 2016 15:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305385 - head/lib/msun/i387 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 15:08:16 -0000 Author: bde Date: Sun Sep 4 15:08:14 2016 New Revision: 305385 URL: https://svnweb.freebsd.org/changeset/base/305385 Log: Oops, the previous i386 version of e_fmodf.S and e_fmodl.S was actually the amd64 version. Modified: head/lib/msun/i387/e_fmodf.S head/lib/msun/i387/e_fmodl.S Modified: head/lib/msun/i387/e_fmodf.S ============================================================================== --- head/lib/msun/i387/e_fmodf.S Sun Sep 4 14:12:19 2016 (r305384) +++ head/lib/msun/i387/e_fmodf.S Sun Sep 4 15:08:14 2016 (r305385) @@ -1,5 +1,5 @@ /* - * Based on the i387 version written by J.T. Conklin . + * Written by J.T. Conklin . * Public domain. */ @@ -7,17 +7,13 @@ __FBSDID("$FreeBSD$") ENTRY(fmodf) - movss %xmm0,-4(%rsp) - movss %xmm1,-8(%rsp) - flds -8(%rsp) - flds -4(%rsp) + flds 8(%esp) + flds 4(%esp) 1: fprem fstsw %ax - testw $0x400,%ax - jne 1b - fstps -4(%rsp) - movss -4(%rsp),%xmm0 - fstp %st + sahf + jp 1b + fstp %st(1) ret END(fmodf) Modified: head/lib/msun/i387/e_fmodl.S ============================================================================== --- head/lib/msun/i387/e_fmodl.S Sun Sep 4 14:12:19 2016 (r305384) +++ head/lib/msun/i387/e_fmodl.S Sun Sep 4 15:08:14 2016 (r305385) @@ -29,7 +29,7 @@ */ /* - * Based on the i387 version written by: + * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ @@ -37,12 +37,12 @@ __FBSDID("$FreeBSD$") ENTRY(fmodl) - fldt 24(%rsp) - fldt 8(%rsp) + fldt 16(%esp) + fldt 4(%esp) 1: fprem fstsw %ax - testw $0x400,%ax - jne 1b + sahf + jp 1b fstp %st(1) ret END(fmodl) From owner-svn-src-all@freebsd.org Sun Sep 4 15:56:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F21B8A9D7CD; Sun, 4 Sep 2016 15:56:52 +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 88538391; Sun, 4 Sep 2016 15:56:51 +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 C727DD485B9; Mon, 5 Sep 2016 01:56:48 +1000 (AEST) Date: Mon, 5 Sep 2016 01:56:48 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r305382 - in head/lib/msun: amd64 i387 In-Reply-To: <20160904144859.GC83214@kib.kiev.ua> Message-ID: <20160905012859.L6221@besplex.bde.org> References: <201609041222.u84CMEdM033135@repo.freebsd.org> <20160904144859.GC83214@kib.kiev.ua> 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=djm5zUDtHYgCdv4C8OwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 15:56:53 -0000 On Sun, 4 Sep 2016, Konstantin Belousov wrote: > On Sun, Sep 04, 2016 at 12:22:14PM +0000, Bruce Evans wrote: > ... >> Log: >> Add asm versions of fmod(), fmodf() and fmodl() on amd64. Add asm >> versions of fmodf() amd fmodl() on i387. >> ... > It seems that wrong version of i387/f_fmodf.S, it is identical to the > amd64 version. Indeed. Fixed. >> Added: head/lib/msun/amd64/e_fmod.S >> ============================================================================== >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/lib/msun/amd64/e_fmod.S Sun Sep 4 12:22:14 2016 (r305382) >> +ENTRY(fmod) >> + movsd %xmm0,-8(%rsp) >> + movsd %xmm1,-16(%rsp) >> + fldl -16(%rsp) >> + fldl -8(%rsp) >> +1: fprem >> + fstsw %ax >> + testw $0x400,%ax >> + jne 1b >> + fstpl -8(%rsp) >> + movsd -8(%rsp),%xmm0 >> + fstp %st >> + ret >> +END(fmod) > > I see that this is not a new approach in the amd64 subdirectory, to use > x87 FPU on amd64. Please note that it might have non-obvious effects on > the performance, in particular, on the speed of the context switches and > handling of #NM exception. For long double functions, the i387 gets used anyway. This function is very slow even with the i387. It takes about 500 cycles per call on args uniformly distributed in double precision space, but this distribution is very non-average since it gives many huge args. The loop iterates many times on huge args. This is still better the the C code which takes 3 or more times longer or > 1500 cycles. It does a loop on the bits using integer code. The C code is relatively even slower when there are fewer bits (something like 9 times slower for args uniformly distributed in float precision space). > Newer Intel and possibly AMD CPUs have an optimization which allows > coprocessor code to save and restore state to not save and restore state > which was not changed. In other words, for typical amd64 binary which > uses %xmm register file but did not touched %st nor %ymm, only %xmm > bits are spilled and then loaded. Touching %st defeats the optimization, > possible for the whole lifetime of the thread. > > This feature (XSAVEOPT) is available at least starting from Haswell > microarchitecture, not sure about IvyBridge. Isn't the i386 space too small to matter much? There should be the same number of NM#'s and just 100 bytes extra to save. Avoiding use of larger register sets by using only the i387 might save more :-). The other amd64 asm uses of the i387 for floats and doubles are: - 3 files for remainder and 3 files for remquo. Needed for the same reason as for fmod - s_scalbn.S, s_scalbnf.S. To use i387 fscale. Probably a mistake. The functions themselves are too slow to be very useful too. libm almost never uses them internally, and in optimized functions like exp* the exponent scaling is done inline using special integer code. I have spent many hours fighting the compiler to stop it pessimizing the memory accesses to give pipeline stalls for this integer code. Using fscale probably tends to give another type of pipeline stall. I plan to remove many more i387 uses on i386, but there aren't many more on amd64. Bruce From owner-svn-src-all@freebsd.org Sun Sep 4 16:00:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7A0BA9D9C4; Sun, 4 Sep 2016 16:00:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.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 6F3628BF; Sun, 4 Sep 2016 16:00:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id e124so114064276ith.0; Sun, 04 Sep 2016 09:00: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=wfhgXsTgz7fcU5FK2rbTaBXPEtaGMJgdaRHhH6ye0FY=; b=M54OdEzOMzee2bB2zZQtfuvrgu1Kv3GXwKJi29DqD5g9vWtz+nhSCaXKI19OIPAyHe XVb1VNEQcMepr8pZ/W+l08CN6xOYscjRYWDm2f3+vKdzb6nAnbbCq3ZwgnLNnuTZSneO oL4uItSG6HVP9riRAtkX9aywCusPpkclJZ+J9fe8kj4NFieO8HDoXz+5kseaf3hmsT13 2Ml0Z5nQryfjoI2KeIiAoQmXGcuACY5cXxfq2C9Gm+jZYInPryir4N+tgV6eUZXztsE6 myo10M4Bm042JqRWhH+AqexRF4MVx2ezTOAWS9kaTaTtG38p9CJv26X5L8Rm4OVdC6HD r65w== X-Gm-Message-State: AE9vXwPDTsoIxzfgfiwOc4yY/Ov/jyQu/w4ugFn4+FvhCqAh2o0QYC9EwwftrkJyPaMhaQ== X-Received: by 10.36.196.133 with SMTP id v127mr17066686itf.84.1473004839534; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com. [209.85.214.42]) by smtp.gmail.com with ESMTPSA id v124sm7505824ita.22.2016.09.04.09.00.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 09:00:39 -0700 (PDT) Received: by mail-it0-f42.google.com with SMTP id e124so113274933ith.0; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) X-Received: by 10.36.227.73 with SMTP id d70mr16394560ith.97.1473004839057; Sun, 04 Sep 2016 09:00:39 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 09:00:38 -0700 (PDT) In-Reply-To: <201609041331.u84DVwIX061144@repo.freebsd.org> References: <201609041331.u84DVwIX061144@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 09:00:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305383 - head/sys/sys To: Mateusz Guzik Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 16:00:45 -0000 Do you know which revision this was introduced (i.e. what revision range should be avoided)? The most relevant commit seems to be r305093 but I'm not sure how that would have broken this (nothing in that diff was checking fde_file before). Best, Conrad On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik wrote: > Author: mjg > Date: Sun Sep 4 13:31:57 2016 > New Revision: 305383 > URL: https://svnweb.freebsd.org/changeset/base/305383 > > Log: > fd: fix up fdeget_file > > It was supposed to return NULL if a fp is not installed. > > Facepalm-by: mjg > > Modified: > head/sys/sys/filedesc.h > > Modified: head/sys/sys/filedesc.h > ============================================================================== > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > static __inline struct filedescent * > fdeget_locked(struct filedesc *fdp, int fd) > { > + struct filedescent *fde; > > FILEDESC_LOCK_ASSERT(fdp); > > if (fd < 0 || fd > fdp->fd_lastfile) > return (NULL); > > - return (&fdp->fd_ofiles[fd]); > + fde = &fdp->fd_ofiles[fd]; > + if (fde->fde_file == NULL) > + return (NULL); > + > + return (fde); > } > > static __inline bool > From owner-svn-src-all@freebsd.org Sun Sep 4 16:05:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70936A9DAAF; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.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 0085FC5D; Sun, 4 Sep 2016 16:05:53 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id 1so101051045wmz.1; Sun, 04 Sep 2016 09:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=sQQ9yoaSo/kDXt/o9FNp41+/tedCG0kT48ibDzxRJxIuuL7IGO1hPl5JPjMwD+TOzG YpaLarV0ogs4MPi217OgxN8+M5wfY89mgqJvSSfWp7H4ypaTeYa4OB55d4f+2IWtcIk/ 0D3seIXvFE8JKI3NfyTpZp5MBy3qJPznRMIYQO+aWdJ10Qvjkvihoi0UmkfGEwjhzV+4 sTVs19SWneBVMQJzAhd4mo08zwnpeymsOnBXu0k73J8b4Aq+Uw+7BK3zJwmOCoh8yOAM lTxeilvXOQ+w1bQjauNgWaITsdt+GaVAMJQWF2M+FHW2w69AX4tR6S/WIAbMKmnUfHTJ NHhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WnFMQ9yEeX41srBWF7V9jeXV2AZkyx71Qj/lDXnUExQ=; b=eSkfmvDAiFpxfCdXckOko2HHdmIwEcLvKcZzc6qOYaX5xZzqU858LqTWeQht3PkslS ZyUtFlQretfFr+u5BEtA+CdRu3dRYQ7T4LOJGxUI5ng00kxdjhaT8hvfXCCmi2FpCHrV n5GE/C5aM5tvtO7rijc+O6ugA9rhh4iXhH1TsaVH36CgMOkYUAIcmI7LwO8l9vxV5TzX bS1BJk1oRsUMcGyzZWouTwdKKVdkgg+bRAGQXxk7OUP2CGFo/AfjyWyWxYEtu7pCh75w 6R+r1HasiR/oWOzY1/uGZCVYD8Lfix8jBkCbyqmSbRcXgYTMN7rNuWoMoCZMmdpcx4yR eDdA== X-Gm-Message-State: AE9vXwOiLvNsW7dWj0k1dPCpSgH2rSvjyVVZF2RvV9bRg66jgb7bAud2VFpm9oAp47YIUQ== X-Received: by 10.194.112.233 with SMTP id it9mr4358546wjb.176.1473005150958; Sun, 04 Sep 2016 09:05:50 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id u7sm13949263wmf.8.2016.09.04.09.05.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 04 Sep 2016 09:05:50 -0700 (PDT) Date: Sun, 4 Sep 2016 18:05:48 +0200 From: Mateusz Guzik To: Conrad Meyer Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r305383 - head/sys/sys Message-ID: <20160904160547.GD25473@dft-labs.eu> References: <201609041331.u84DVwIX061144@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 16:05:53 -0000 On Sun, Sep 04, 2016 at 09:00:38AM -0700, Conrad Meyer wrote: > Do you know which revision this was introduced (i.e. what revision > range should be avoided)? The most relevant commit seems to be > r305093 but I'm not sure how that would have broken this (nothing in > that diff was checking fde_file before). > The problem was present since r305093 to this very commit. The problem affects weird programs which do F_GETFD to see if they got given fd installed, like bash. Prior to r305093 they would get EBADF. But due to incorrect test in fdeget_locked, they would get 0 instead. > Best, > Conrad > > On Sun, Sep 4, 2016 at 6:31 AM, Mateusz Guzik wrote: > > Author: mjg > > Date: Sun Sep 4 13:31:57 2016 > > New Revision: 305383 > > URL: https://svnweb.freebsd.org/changeset/base/305383 > > > > Log: > > fd: fix up fdeget_file > > > > It was supposed to return NULL if a fp is not installed. > > > > Facepalm-by: mjg > > > > Modified: > > head/sys/sys/filedesc.h > > > > Modified: head/sys/sys/filedesc.h > > ============================================================================== > > --- head/sys/sys/filedesc.h Sun Sep 4 12:22:14 2016 (r305382) > > +++ head/sys/sys/filedesc.h Sun Sep 4 13:31:57 2016 (r305383) > > @@ -210,13 +210,18 @@ fget_locked(struct filedesc *fdp, int fd > > static __inline struct filedescent * > > fdeget_locked(struct filedesc *fdp, int fd) > > { > > + struct filedescent *fde; > > > > FILEDESC_LOCK_ASSERT(fdp); > > > > if (fd < 0 || fd > fdp->fd_lastfile) > > return (NULL); > > > > - return (&fdp->fd_ofiles[fd]); > > + fde = &fdp->fd_ofiles[fd]; > > + if (fde->fde_file == NULL) > > + return (NULL); > > + > > + return (fde); > > } > > > > static __inline bool > > -- Mateusz Guzik From owner-svn-src-all@freebsd.org Sun Sep 4 16:52:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 538EDA9D925; Sun, 4 Sep 2016 16:52:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C77A8AA; Sun, 4 Sep 2016 16:52:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84GqErY037276; Sun, 4 Sep 2016 16:52:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84GqE5s037275; Sun, 4 Sep 2016 16:52:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201609041652.u84GqE5s037275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 4 Sep 2016 16:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305386 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 16:52:15 -0000 Author: mjg Date: Sun Sep 4 16:52:14 2016 New Revision: 305386 URL: https://svnweb.freebsd.org/changeset/base/305386 Log: cache: defer freeing entries until after the global lock is dropped This also defers vdrop for held vnodes. Glanced at by: kib Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Sep 4 15:08:14 2016 (r305385) +++ head/sys/kern/vfs_cache.c Sun Sep 4 16:52:14 2016 (r305386) @@ -131,6 +131,7 @@ struct namecache_ts { #define NCF_ISDOTDOT 0x02 #define NCF_TS 0x04 #define NCF_DTS 0x08 +#define NCF_DVDROP 0x10 /* * Name caching works as follows: @@ -227,6 +228,8 @@ cache_free(struct namecache *ncp) if (ncp == NULL) return; ts = ncp->nc_flag & NCF_TS; + if ((ncp->nc_flag & NCF_DVDROP) != 0) + vdrop(ncp->nc_dvp); if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { if (ts) uma_zfree(cache_zone_small_ts, ncp); @@ -476,7 +479,7 @@ cache_negative_remove(struct namecache * numneg--; } -static void +static struct namecache * cache_negative_zap_one(void) { struct namecache *ncp; @@ -486,6 +489,7 @@ cache_negative_zap_one(void) KASSERT(ncp->nc_vp == NULL, ("ncp %p vp %p on ncneg", ncp, ncp->nc_vp)); cache_zap(ncp); + return (ncp); } /* @@ -497,7 +501,6 @@ cache_negative_zap_one(void) static void cache_zap(struct namecache *ncp) { - struct vnode *vp; rw_assert(&cache_lock, RA_WLOCKED); CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); @@ -508,7 +511,6 @@ cache_zap(struct namecache *ncp) SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, nc_get_name(ncp)); } - vp = NULL; LIST_REMOVE(ncp, nc_hash); if (ncp->nc_flag & NCF_ISDOTDOT) { if (ncp == ncp->nc_dvp->v_cache_dd) @@ -516,7 +518,7 @@ cache_zap(struct namecache *ncp) } else { LIST_REMOVE(ncp, nc_src); if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { - vp = ncp->nc_dvp; + ncp->nc_flag |= NCF_DVDROP; numcachehv--; } } @@ -528,9 +530,6 @@ cache_zap(struct namecache *ncp) cache_negative_remove(ncp); } numcache--; - cache_free(ncp); - if (vp != NULL) - vdrop(vp); } /* @@ -611,10 +610,14 @@ retry_wlocked: if ((cnp->cn_flags & MAKEENTRY) == 0) { if (!wlocked && !CACHE_UPGRADE_LOCK()) goto wlock; - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) - cache_zap(dvp->v_cache_dd); + ncp = NULL; + if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) { + ncp = dvp->v_cache_dd; + cache_zap(ncp); + } dvp->v_cache_dd = NULL; CACHE_WUNLOCK(); + cache_free(ncp); return (0); } ncp = dvp->v_cache_dd; @@ -666,6 +669,7 @@ retry_wlocked: goto wlock; cache_zap(ncp); CACHE_WUNLOCK(); + cache_free(ncp); return (0); } @@ -689,6 +693,7 @@ negative_success: goto wlock; cache_zap(ncp); CACHE_WUNLOCK(); + cache_free(ncp); return (0); } @@ -767,7 +772,7 @@ void cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct timespec *tsp, struct timespec *dtsp) { - struct namecache *ncp, *n2; + struct namecache *ncp, *n2, *ndd, *nneg; struct namecache_ts *n3; struct nchashhead *ncpp; uint32_t hash; @@ -789,6 +794,7 @@ cache_enter_time(struct vnode *dvp, stru if (numcache >= desiredvnodes * ncsizefactor) return; + ndd = nneg = NULL; flag = 0; if (cnp->cn_nameptr[0] == '.') { if (cnp->cn_namelen == 1) @@ -905,9 +911,12 @@ cache_enter_time(struct vnode *dvp, stru * directory name in it and the name ".." for the * directory's parent. */ - if ((n2 = vp->v_cache_dd) != NULL && - (n2->nc_flag & NCF_ISDOTDOT) != 0) - cache_zap(n2); + if ((ndd = vp->v_cache_dd) != NULL) { + if ((ndd->nc_flag & NCF_ISDOTDOT) != 0) + cache_zap(ndd); + else + ndd = NULL; + } vp->v_cache_dd = ncp; } } else { @@ -945,8 +954,10 @@ cache_enter_time(struct vnode *dvp, stru nc_get_name(ncp)); } if (numneg * ncnegfactor > numcache) - cache_negative_zap_one(); + nneg = cache_negative_zap_one(); CACHE_WUNLOCK(); + cache_free(ndd); + cache_free(nneg); } /* @@ -1034,21 +1045,35 @@ cache_changesize(int newmaxvnodes) void cache_purge(struct vnode *vp) { + TAILQ_HEAD(, namecache) ncps; + struct namecache *ncp, *nnp; CTR1(KTR_VFS, "cache_purge(%p)", vp); SDT_PROBE1(vfs, namecache, purge, done, vp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); - while (!LIST_EMPTY(&vp->v_cache_src)) - cache_zap(LIST_FIRST(&vp->v_cache_src)); - while (!TAILQ_EMPTY(&vp->v_cache_dst)) - cache_zap(TAILQ_FIRST(&vp->v_cache_dst)); + while (!LIST_EMPTY(&vp->v_cache_src)) { + ncp = LIST_FIRST(&vp->v_cache_src); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + } + while (!TAILQ_EMPTY(&vp->v_cache_dst)) { + ncp = TAILQ_FIRST(&vp->v_cache_dst); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + } if (vp->v_cache_dd != NULL) { - KASSERT(vp->v_cache_dd->nc_flag & NCF_ISDOTDOT, + ncp = vp->v_cache_dd; + KASSERT(ncp->nc_flag & NCF_ISDOTDOT, ("lost dotdot link")); - cache_zap(vp->v_cache_dd); + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } KASSERT(vp->v_cache_dd == NULL, ("incomplete purge")); CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* @@ -1057,16 +1082,23 @@ cache_purge(struct vnode *vp) void cache_purge_negative(struct vnode *vp) { - struct namecache *cp, *ncp; + TAILQ_HEAD(, namecache) ncps; + struct namecache *ncp, *nnp; CTR1(KTR_VFS, "cache_purge_negative(%p)", vp); SDT_PROBE1(vfs, namecache, purge_negative, done, vp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); - LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) { - if (cp->nc_vp == NULL) - cache_zap(cp); + LIST_FOREACH_SAFE(ncp, &vp->v_cache_src, nc_src, nnp) { + if (ncp->nc_vp != NULL) + continue; + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* @@ -1075,19 +1107,26 @@ cache_purge_negative(struct vnode *vp) void cache_purgevfs(struct mount *mp) { + TAILQ_HEAD(, namecache) ncps; struct nchashhead *ncpp; struct namecache *ncp, *nnp; /* Scan hash tables for applicable entries */ SDT_PROBE1(vfs, namecache, purgevfs, done, mp); + TAILQ_INIT(&ncps); CACHE_WLOCK(); for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { - if (ncp->nc_dvp->v_mount == mp) - cache_zap(ncp); + if (ncp->nc_dvp->v_mount != mp) + continue; + cache_zap(ncp); + TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); } } CACHE_WUNLOCK(); + TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { + cache_free(ncp); + } } /* From owner-svn-src-all@freebsd.org Sun Sep 4 16:59:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F64A9DCC8; Sun, 4 Sep 2016 16:59:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6D3CC57; Sun, 4 Sep 2016 16:59:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84GxZ6q037812; Sun, 4 Sep 2016 16:59:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84GxZi5037811; Sun, 4 Sep 2016 16:59:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041659.u84GxZi5037811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 16:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305388 - head/sys/dev/usb/serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 16:59:37 -0000 Author: dim Date: Sun Sep 4 16:59:35 2016 New Revision: 305388 URL: https://svnweb.freebsd.org/changeset/base/305388 Log: With clang 3.9.0, compiling uplcom results in the following warnings: sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion] if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) ~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~ sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE' #define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE) ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ This is because UT_READ is 0x80, so the int8_t argument is wrapped to a negative value. Fix this by using uint8_t instead. Reviewed by: imp, hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7776 Modified: head/sys/dev/usb/serial/uplcom.c Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Sun Sep 4 16:54:55 2016 (r305387) +++ head/sys/dev/usb/serial/uplcom.c Sun Sep 4 16:59:35 2016 (r305388) @@ -166,7 +166,7 @@ struct uplcom_softc { /* prototypes */ static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *); -static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t, +static usb_error_t uplcom_pl2303_do(struct usb_device *, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t); static int uplcom_pl2303_init(struct usb_device *, uint8_t); static void uplcom_free(struct ucom_softc *); @@ -514,7 +514,7 @@ uplcom_reset(struct uplcom_softc *sc, st } static usb_error_t -uplcom_pl2303_do(struct usb_device *udev, int8_t req_type, uint8_t request, +uplcom_pl2303_do(struct usb_device *udev, uint8_t req_type, uint8_t request, uint16_t value, uint16_t index, uint16_t length) { struct usb_device_request req; From owner-svn-src-all@freebsd.org Sun Sep 4 17:23:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEFFEB711DD; Sun, 4 Sep 2016 17:23:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 822359B4; Sun, 4 Sep 2016 17:23:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84HNA98048692; Sun, 4 Sep 2016 17:23:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HNAda048691; Sun, 4 Sep 2016 17:23:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041723.u84HNAda048691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305389 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 17:23:11 -0000 Author: dim Date: Sun Sep 4 17:23:10 2016 New Revision: 305389 URL: https://svnweb.freebsd.org/changeset/base/305389 Log: With clang 3.9.0, compiling sys/netinet/igmp.c results in the following warning: sys/netinet/igmp.c:546:21: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion] p->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ ~ ^~~~~~~~ sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA' #define IPOPT_RA 148 /* router alert */ ^~~ This is because ipopt_list is an array of char, so IPOPT_RA is wrapped to a negative value. It would be nice to change ipopt_list to an array of u_char, but it changes the signature of the public struct ipoption, so add an explicit cast to suppress the warning. Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7777 Modified: head/sys/netinet/igmp.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Sep 4 16:59:35 2016 (r305388) +++ head/sys/netinet/igmp.c Sun Sep 4 17:23:10 2016 (r305389) @@ -543,10 +543,10 @@ igmp_ra_alloc(void) m = m_get(M_WAITOK, MT_DATA); p = mtod(m, struct ipoption *); p->ipopt_dst.s_addr = INADDR_ANY; - p->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ - p->ipopt_list[1] = 0x04; /* 4 bytes long */ - p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */ - p->ipopt_list[3] = 0x00; /* pad byte */ + p->ipopt_list[0] = (char)IPOPT_RA; /* Router Alert Option */ + p->ipopt_list[1] = 0x04; /* 4 bytes long */ + p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */ + p->ipopt_list[3] = 0x00; /* pad byte */ m->m_len = sizeof(p->ipopt_dst) + p->ipopt_list[1]; return (m); From owner-svn-src-all@freebsd.org Sun Sep 4 17:50:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC4C5B71856; Sun, 4 Sep 2016 17:50:24 +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 8F2817DD; Sun, 4 Sep 2016 17:50:24 +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 u84HoNGR056565; Sun, 4 Sep 2016 17:50:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HoNtn056564; Sun, 4 Sep 2016 17:50:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609041750.u84HoNtn056564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 4 Sep 2016 17:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305391 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 17:50:24 -0000 Author: andrew Date: Sun Sep 4 17:50:23 2016 New Revision: 305391 URL: https://svnweb.freebsd.org/changeset/base/305391 Log: Enable superpages on arm64 by default. These seem to be stable, having survived multiple world and kernel builds, and of poudriere building full package sets. I have observed a 3% reduction in buildworld times with superpages enabled, however further testing is needed to see if this is observed in other workloads. Obtained from: ABT Systems Ltd MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Sep 4 17:26:42 2016 (r305390) +++ head/sys/arm64/arm64/pmap.c Sun Sep 4 17:50:23 2016 (r305391) @@ -242,7 +242,7 @@ extern pt_entry_t pagetable_dmap[]; static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); -static int superpages_enabled = 0; +static int superpages_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &superpages_enabled, 0, "Are large page mappings enabled?"); From owner-svn-src-all@freebsd.org Sun Sep 4 17:55:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38D65B719AF; Sun, 4 Sep 2016 17:55:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0227DBB4; Sun, 4 Sep 2016 17:55:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84HtMV3060051; Sun, 4 Sep 2016 17:55:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84HtMa5060050; Sun, 4 Sep 2016 17:55:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041755.u84HtMa5060050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305392 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 17:55:23 -0000 Author: dim Date: Sun Sep 4 17:55:22 2016 New Revision: 305392 URL: https://svnweb.freebsd.org/changeset/base/305392 Log: For kernel builds, instead of suppressing certain clang warnings, make them non-fatal, so there is some incentive to fix them eventually. Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # kernel where fixing them is more trouble than it is worth, or where there is # a false positive. .if ${COMPILER_TYPE} == "clang" -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow -NO_WSELF_ASSIGN= -Wno-self-assign -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow +NO_WSELF_ASSIGN= -Wno-error-self-assign +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized -NO_WCAST_QUAL= -Wno-cast-qual +NO_WCAST_QUAL= -Wno-error-cast-qual # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. From owner-svn-src-all@freebsd.org Sun Sep 4 17:56:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90384B71A93; Sun, 4 Sep 2016 17:56:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 495CAD49; Sun, 4 Sep 2016 17:56:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84HutIc060146; Sun, 4 Sep 2016 17:56:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84Hut9d060144; Sun, 4 Sep 2016 17:56:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609041756.u84Hut9d060144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 4 Sep 2016 17:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305393 - in head/sys: conf modules/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 17:56:56 -0000 Author: dim Date: Sun Sep 4 17:56:55 2016 New Revision: 305393 URL: https://svnweb.freebsd.org/changeset/base/305393 Log: Make some additional -Wconstant-conversion warnings from clang 3.9.0 in bwn(4) non-fatal for now. Modified: head/sys/conf/files head/sys/modules/bwn/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Sep 4 17:55:22 2016 (r305392) +++ head/sys/conf/files Sun Sep 4 17:56:55 2016 (r305393) @@ -1211,13 +1211,13 @@ dev/bwi/bwiphy.c optional bwi dev/bwi/bwirf.c optional bwi dev/bwi/if_bwi.c optional bwi dev/bwi/if_bwi_pci.c optional bwi pci -# XXX Work around clang warning, until maintainer approves fix. +# XXX Work around clang warnings, until maintainer approves fix. dev/bwn/if_bwn.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bwn/if_bwn_pci.c optional bwn pci bhnd dev/bwn/if_bwn_phy_common.c optional bwn siba_bwn dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \ - compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" + compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION}" dev/bwn/if_bwn_phy_lp.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bwn/if_bwn_phy_n.c optional bwn siba_bwn Modified: head/sys/modules/bwn/Makefile ============================================================================== --- head/sys/modules/bwn/Makefile Sun Sep 4 17:55:22 2016 (r305392) +++ head/sys/modules/bwn/Makefile Sun Sep 4 17:56:55 2016 (r305393) @@ -28,7 +28,7 @@ SRCS+= device_if.h bus_if.h pci_if.h opt .include -# XXX Work around clang warning, until maintainer approves fix. +# XXX Work around clang warnings, until maintainer approves fix. CWARNFLAGS.if_bwn.c= ${NO_WSOMETIMES_UNINITIALIZED} -CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED} +CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION} CWARNFLAGS.if_bwn_phy_lp.c= ${NO_WSOMETIMES_UNINITIALIZED} From owner-svn-src-all@freebsd.org Sun Sep 4 18:02:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3938AB71C70; Sun, 4 Sep 2016 18:02:48 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01ABD283; Sun, 4 Sep 2016 18:02:47 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.15.0.59/8.15.0.59) with SMTP id u84I1Atf019146; Sun, 4 Sep 2016 13:02:45 -0500 Received: from mh3.mail.rice.edu (mh3.mail.rice.edu [128.42.199.10]) by pp2.rice.edu with ESMTP id 257sjj0av3-1; Sun, 04 Sep 2016 13:02:45 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh3.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-205.lightspeed.hstntx.sbcglobal.net [108.254.203.205]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh3.mail.rice.edu (Postfix) with ESMTPSA id 48C3740434; Sun, 4 Sep 2016 13:02:45 -0500 (CDT) Subject: Re: svn commit: r305391 - head/sys/arm64/arm64 To: Andrew Turner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201609041750.u84HoNtn056564@repo.freebsd.org> From: Alan Cox Message-ID: <61bfdc1a-24f6-a63d-7f33-b02d8c92dd21@rice.edu> Date: Sun, 4 Sep 2016 13:02:44 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <201609041750.u84HoNtn056564@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609040276 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 18:02:48 -0000 On 09/04/2016 12:50, Andrew Turner wrote: > Author: andrew > Date: Sun Sep 4 17:50:23 2016 > New Revision: 305391 > URL: https://svnweb.freebsd.org/changeset/base/305391 > > Log: > Enable superpages on arm64 by default. These seem to be stable, havin= g > survived multiple world and kernel builds, and of poudriere building = full > package sets. > =20 > I have observed a 3% reduction in buildworld times with superpages en= abled, > however further testing is needed to see if this is observed in other= > workloads. > =20 Is the starting address of the text section on arm64 superpage aligned, like it is on amd64? If so, I expect that the reduction will increase if you implement support for superpage mappings in pmap_enter_object(). From owner-svn-src-all@freebsd.org Sun Sep 4 19:03:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74573A9DC47; Sun, 4 Sep 2016 19:03:58 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f42.google.com (mail-it0-f42.google.com [209.85.214.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 443F6FDC; Sun, 4 Sep 2016 19:03:58 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f42.google.com with SMTP id c198so118953613ith.1; Sun, 04 Sep 2016 12:03:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=e2zggkQK7AzZxFk0H4+fiVQX180axxHMntO9vDkto5M=; b=M0J63y6LN3/ogTOPqhVdTNud67X+s+H1RSXrgghahjZC6CmvLIYHBLONnm835n5iHS TSW7NWpmRW7dHg4pRc7VEB6/U80V8ZlihFMZIlYoCwtQboWqo2CUonMWsu3zseRGIlY+ 5PjmMv5+boYtnaWChxIQpH/mx29R1ub+ZJFYJ/czWk8DqT0oD6KJLQFnee7zvjcYyRhR uuA5WCIiplRX9VTCUazeeWUxr9oMSnuBl2mn+lKJGWF5x5LrNtTVP1xV2ZpgjsQedz/f 4wcKYt+EZDpnMAGUAURgLSg/mtDtGraSkfJhFtf7B9I4zuyS+inh0uaDC+wT6O4W0zkG fV3Q== X-Gm-Message-State: AE9vXwOCp/7f7ZjqG6CoXGURt6baXg4/cWhABdtxt01fR7Eon27hbNg9eOd5A11yg28kfw== X-Received: by 10.36.238.134 with SMTP id b128mr17477980iti.72.1473015434441; Sun, 04 Sep 2016 11:57:14 -0700 (PDT) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com. [209.85.214.51]) by smtp.gmail.com with ESMTPSA id r124sm7912111itc.19.2016.09.04.11.57.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 11:57:14 -0700 (PDT) Received: by mail-it0-f51.google.com with SMTP id i184so117865006itf.1; Sun, 04 Sep 2016 11:57:14 -0700 (PDT) X-Received: by 10.36.227.73 with SMTP id d70mr17167870ith.97.1473015433978; Sun, 04 Sep 2016 11:57:13 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 11:57:13 -0700 (PDT) In-Reply-To: <201609041755.u84HtMa5060050@repo.freebsd.org> References: <201609041755.u84HtMa5060050@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 11:57:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305392 - head/sys/conf To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 19:03:58 -0000 On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: > Author: dim > Date: Sun Sep 4 17:55:22 2016 > New Revision: 305392 > URL: https://svnweb.freebsd.org/changeset/base/305392 > > Log: > For kernel builds, instead of suppressing certain clang warnings, make > them non-fatal, so there is some incentive to fix them eventually. > > Modified: > head/sys/conf/kern.mk > > Modified: head/sys/conf/kern.mk > ============================================================================== > --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) > +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) > @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn > # kernel where fixing them is more trouble than it is worth, or where there is > # a false positive. > .if ${COMPILER_TYPE} == "clang" > -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion > -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative > -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow > -NO_WSELF_ASSIGN= -Wno-self-assign > -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration > +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion > +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative > +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow > +NO_WSELF_ASSIGN= -Wno-error-self-assign > +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration > NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized > -NO_WCAST_QUAL= -Wno-cast-qual > +NO_WCAST_QUAL= -Wno-error-cast-qual I like goal of the change. Shouldn't these be -Wno-error=cast-qual, etc., though? Best, Conrad From owner-svn-src-all@freebsd.org Sun Sep 4 19:31:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02830B712AC; Sun, 4 Sep 2016 19:31:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8982DF9; Sun, 4 Sep 2016 19:31:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::cc0e:18d9:a9a1:d549] (unknown [IPv6:2001:7b8:3a7:0:cc0e:18d9:a9a1:d549]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 4D24545418; Sun, 4 Sep 2016 21:31:25 +0200 (CEST) Subject: Re: svn commit: r305392 - head/sys/conf Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6.1 From: Dimitry Andric In-Reply-To: Date: Sun, 4 Sep 2016 21:31:19 +0200 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201609041755.u84HtMa5060050@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 19:31:29 -0000 --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >=20 > On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric = wrote: >> Author: dim >> Date: Sun Sep 4 17:55:22 2016 >> New Revision: 305392 >> URL: https://svnweb.freebsd.org/changeset/base/305392 >>=20 >> Log: >> For kernel builds, instead of suppressing certain clang warnings, = make >> them non-fatal, so there is some incentive to fix them eventually. >>=20 >> Modified: >> head/sys/conf/kern.mk >>=20 >> Modified: head/sys/conf/kern.mk >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 = (r305391) >> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 = (r305392) >> @@ -17,13 +17,13 @@ CWARNFLAGS?=3D -Wall -Wredundant-decls -Wn >> # kernel where fixing them is more trouble than it is worth, or where = there is >> # a false positive. >> .if ${COMPILER_TYPE} =3D=3D "clang" >> -NO_WCONSTANT_CONVERSION=3D -Wno-constant-conversion >> -NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-shift-count-negative >> -NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-shift-count-overflow >> -NO_WSELF_ASSIGN=3D -Wno-self-assign >> -NO_WUNNEEDED_INTERNAL_DECL=3D -Wno-unneeded-internal-declaration >> +NO_WCONSTANT_CONVERSION=3D -Wno-error-constant-conversion >> +NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-error-shift-count-negative >> +NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-error-shift-count-overflow >> +NO_WSELF_ASSIGN=3D -Wno-error-self-assign >> +NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-error-unneeded-internal-declaration >> NO_WSOMETIMES_UNINITIALIZED=3D -Wno-error-sometimes-uninitialized >> -NO_WCAST_QUAL=3D -Wno-cast-qual >> +NO_WCAST_QUAL=3D -Wno-error-cast-qual >=20 > I like goal of the change. Shouldn't these be -Wno-error=3Dcast-qual, > etc., though? That's how gcc spells them. Clang accepts both forms, there is no functional difference. -Dimitry --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5 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 iEYEARECAAYFAlfMdowACgkQsF6jCi4glqPnhACdFylP/bc8HHq32x9433fJ/5/8 nTAAoMICtdS+0AMgU0F+hmi/ZXbwNn2H =SbgV -----END PGP SIGNATURE----- --Apple-Mail=_72F95BE3-AB11-43AC-A7D8-F1111E331EB5-- From owner-svn-src-all@freebsd.org Sun Sep 4 19:55:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4E3FB716A3 for ; Sun, 4 Sep 2016 19:55:23 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:c:538::195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81F6384F for ; Sun, 4 Sep 2016 19:55:23 +0000 (UTC) (envelope-from joerg@bec.de) Received: from britannica.bec.de (p200300D2ABCFC4104639C4FFFE599710.dip0.t-ipconnect.de [IPv6:2003:d2:abcf:c410:4639:c4ff:fe59:9710]) (Authenticated sender: joerg@bec.de) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 224BBA80C0 for ; Sun, 4 Sep 2016 21:55:19 +0200 (CEST) Date: Sun, 4 Sep 2016 21:55:15 +0200 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r305392 - head/sys/conf Message-ID: <20160904195515.GA1728@britannica.bec.de> References: <201609041755.u84HtMa5060050@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.2 (2016-07-01) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 19:55:23 -0000 On Sun, Sep 04, 2016 at 09:31:19PM +0200, Dimitry Andric wrote: > On 04 Sep 2016, at 20:57, Conrad Meyer wrote: > > > > On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: > >> Author: dim > >> Date: Sun Sep 4 17:55:22 2016 > >> New Revision: 305392 > >> URL: https://svnweb.freebsd.org/changeset/base/305392 > >> > >> Log: > >> For kernel builds, instead of suppressing certain clang warnings, make > >> them non-fatal, so there is some incentive to fix them eventually. > >> > >> Modified: > >> head/sys/conf/kern.mk > >> > >> Modified: head/sys/conf/kern.mk > >> ============================================================================== > >> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) > >> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) > >> @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn > >> # kernel where fixing them is more trouble than it is worth, or where there is > >> # a false positive. > >> .if ${COMPILER_TYPE} == "clang" > >> -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion > >> -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative > >> -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow > >> -NO_WSELF_ASSIGN= -Wno-self-assign > >> -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration > >> +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion > >> +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative > >> +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow > >> +NO_WSELF_ASSIGN= -Wno-error-self-assign > >> +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration > >> NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized > >> -NO_WCAST_QUAL= -Wno-cast-qual > >> +NO_WCAST_QUAL= -Wno-error-cast-qual > > > > I like goal of the change. Shouldn't these be -Wno-error=cast-qual, > > etc., though? > > That's how gcc spells them. Clang accepts both forms, there is no > functional difference. Actually, GCC documents them as -W(no-)error=* as well. Joerg From owner-svn-src-all@freebsd.org Sun Sep 4 20:03:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 529D6B71858; Sun, 4 Sep 2016 20:03:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) (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 25E49B3D; Sun, 4 Sep 2016 20:03:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f45.google.com with SMTP id e124so119051447ith.0; Sun, 04 Sep 2016 13:03:05 -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=lP2z6S0SJchlQDso0ieY+ysOzATYPINlZ0g9NaZHYwA=; b=biHgSKCuF658WavkaS8UQzI21K7YEOuP5t+9NAvFNNR6negcmgmRAXVxE6ABOxcXKS ZKKh69gJdGBga34nOQZEewoisgRha7PUFHTAiywS7tsOHEyUCjWRqsVg0GkJsObxmHZG ueuv/ZwBlOzTZmsj8ZVkNlHOoYrqy4Wezc95hwZaiK9hrXF3JsY295PFDQLA2/sXDk6m xxYQpzCZEYvcPRUzZ91cOqHajZ0xXkgUqcM+5BZX6wKoEiyj96DTnconWmaTN0TzSvgq uO6/RzsHKglSVUvmaLWUCGFkJfsIpnpl8sEC+a0wjaRH7yueIXNImDPlT1HH4nYPTaVJ twew== X-Gm-Message-State: AE9vXwOy1N0i4XLRPjVzfYaKoJ/BvOVAO8uhiJVRywFZZeYO8bCIfFCERRUhtf5yhxMoWw== X-Received: by 10.36.57.215 with SMTP id l206mr19735837ita.5.1473019384639; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) Received: from mail-it0-f50.google.com (mail-it0-f50.google.com. [209.85.214.50]) by smtp.gmail.com with ESMTPSA id f2sm4465604ite.20.2016.09.04.13.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 13:03:04 -0700 (PDT) Received: by mail-it0-f50.google.com with SMTP id i184so119175504itf.1; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) X-Received: by 10.36.189.68 with SMTP id x65mr17345010ite.97.1473019384143; Sun, 04 Sep 2016 13:03:04 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Sun, 4 Sep 2016 13:03:03 -0700 (PDT) In-Reply-To: References: <201609041755.u84HtMa5060050@repo.freebsd.org> From: Conrad Meyer Date: Sun, 4 Sep 2016 13:03:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305392 - head/sys/conf To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 20:03:06 -0000 Assuming we'd like to enable building with both compilers for now, isn't it better to use a form both accept? Best, Conrad On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric wrote: > On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >> >> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric wrote: >>> Author: dim >>> Date: Sun Sep 4 17:55:22 2016 >>> New Revision: 305392 >>> URL: https://svnweb.freebsd.org/changeset/base/305392 >>> >>> Log: >>> For kernel builds, instead of suppressing certain clang warnings, make >>> them non-fatal, so there is some incentive to fix them eventually. >>> >>> Modified: >>> head/sys/conf/kern.mk >>> >>> Modified: head/sys/conf/kern.mk >>> ============================================================================== >>> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 (r305391) >>> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 (r305392) >>> @@ -17,13 +17,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn >>> # kernel where fixing them is more trouble than it is worth, or where there is >>> # a false positive. >>> .if ${COMPILER_TYPE} == "clang" >>> -NO_WCONSTANT_CONVERSION= -Wno-constant-conversion >>> -NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative >>> -NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow >>> -NO_WSELF_ASSIGN= -Wno-self-assign >>> -NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration >>> +NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion >>> +NO_WSHIFT_COUNT_NEGATIVE= -Wno-error-shift-count-negative >>> +NO_WSHIFT_COUNT_OVERFLOW= -Wno-error-shift-count-overflow >>> +NO_WSELF_ASSIGN= -Wno-error-self-assign >>> +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration >>> NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized >>> -NO_WCAST_QUAL= -Wno-cast-qual >>> +NO_WCAST_QUAL= -Wno-error-cast-qual >> >> I like goal of the change. Shouldn't these be -Wno-error=cast-qual, >> etc., though? > > That's how gcc spells them. Clang accepts both forms, there is no > functional difference. > > -Dimitry > From owner-svn-src-all@freebsd.org Sun Sep 4 20:36:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEACCB71034; Sun, 4 Sep 2016 20:36:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C03A938; Sun, 4 Sep 2016 20:36:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::cc0e:18d9:a9a1:d549] (unknown [IPv6:2001:7b8:3a7:0:cc0e:18d9:a9a1:d549]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 634BB2F749; Sun, 4 Sep 2016 22:36:15 +0200 (CEST) Subject: Re: svn commit: r305392 - head/sys/conf Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6.1 From: Dimitry Andric In-Reply-To: Date: Sun, 4 Sep 2016 22:36:03 +0200 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <000B5E66-D804-4317-9957-8BDEDBD6B7F6@FreeBSD.org> References: <201609041755.u84HtMa5060050@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 20:36:18 -0000 --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Not in this particular case, as the section is exclusively meant for clang. Most of these warning options are completely different from gcc's. The gcc related section is just below this part in kern.mk. -Dimitry > On 04 Sep 2016, at 22:03, Conrad Meyer wrote: >=20 > Assuming we'd like to enable building with both compilers for now, > isn't it better to use a form both accept? >=20 > Best, > Conrad >=20 > On Sun, Sep 4, 2016 at 12:31 PM, Dimitry Andric = wrote: >> On 04 Sep 2016, at 20:57, Conrad Meyer wrote: >>>=20 >>> On Sun, Sep 4, 2016 at 10:55 AM, Dimitry Andric = wrote: >>>> Author: dim >>>> Date: Sun Sep 4 17:55:22 2016 >>>> New Revision: 305392 >>>> URL: https://svnweb.freebsd.org/changeset/base/305392 >>>>=20 >>>> Log: >>>> For kernel builds, instead of suppressing certain clang warnings, = make >>>> them non-fatal, so there is some incentive to fix them eventually. >>>>=20 >>>> Modified: >>>> head/sys/conf/kern.mk >>>>=20 >>>> Modified: head/sys/conf/kern.mk >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/conf/kern.mk Sun Sep 4 17:50:23 2016 = (r305391) >>>> +++ head/sys/conf/kern.mk Sun Sep 4 17:55:22 2016 = (r305392) >>>> @@ -17,13 +17,13 @@ CWARNFLAGS?=3D -Wall -Wredundant-decls = -Wn >>>> # kernel where fixing them is more trouble than it is worth, or = where there is >>>> # a false positive. >>>> .if ${COMPILER_TYPE} =3D=3D "clang" >>>> -NO_WCONSTANT_CONVERSION=3D -Wno-constant-conversion >>>> -NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-shift-count-negative >>>> -NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-shift-count-overflow >>>> -NO_WSELF_ASSIGN=3D -Wno-self-assign >>>> -NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-unneeded-internal-declaration >>>> +NO_WCONSTANT_CONVERSION=3D -Wno-error-constant-conversion >>>> +NO_WSHIFT_COUNT_NEGATIVE=3D -Wno-error-shift-count-negative >>>> +NO_WSHIFT_COUNT_OVERFLOW=3D -Wno-error-shift-count-overflow >>>> +NO_WSELF_ASSIGN=3D -Wno-error-self-assign >>>> +NO_WUNNEEDED_INTERNAL_DECL=3D = -Wno-error-unneeded-internal-declaration >>>> NO_WSOMETIMES_UNINITIALIZED=3D -Wno-error-sometimes-uninitialized >>>> -NO_WCAST_QUAL=3D -Wno-cast-qual >>>> +NO_WCAST_QUAL=3D -Wno-error-cast-qual >>>=20 >>> I like goal of the change. Shouldn't these be -Wno-error=3Dcast-qual,= >>> etc., though? >>=20 >> That's how gcc spells them. Clang accepts both forms, there is no >> functional difference. >>=20 >> -Dimitry >>=20 --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C 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 iEYEARECAAYFAlfMhb4ACgkQsF6jCi4glqPQMACgxdHRlWFuIBabA/Dv2tbiwnod JvwAnRlpczNqvpT0/3ES5XNnRzy24mCh =KuBb -----END PGP SIGNATURE----- --Apple-Mail=_1F03A32E-ADC4-4716-B563-D553E7C8610C-- From owner-svn-src-all@freebsd.org Sun Sep 4 20:55:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2015B714F9; Sun, 4 Sep 2016 20:55:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72841153; Sun, 4 Sep 2016 20:55:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u84KtSgE027390; Sun, 4 Sep 2016 20:55:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u84KtSUu027382; Sun, 4 Sep 2016 20:55:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201609042055.u84KtSUu027382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 4 Sep 2016 20:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305395 - in head: lib/libifconfig share/examples/libifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2016 20:55:29 -0000 Author: kp Date: Sun Sep 4 20:55:27 2016 New Revision: 305395 URL: https://svnweb.freebsd.org/changeset/base/305395 Log: libifconfig: style(9) fixes Also switch from BSD 3-clause to 2-clause license where possible, and consolidate duplicate 3-clause license into one. Submitted by: Marie Helene Kvello-Aune Reviewed by: cem, kp Differential Revision: https://reviews.freebsd.org/D7764 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h head/lib/libifconfig/libifconfig_internal.c head/lib/libifconfig/libifconfig_internal.h head/share/examples/libifconfig/ifcreate.c head/share/examples/libifconfig/ifdestroy.c head/share/examples/libifconfig/setdescription.c head/share/examples/libifconfig/setmtu.c Modified: head/lib/libifconfig/libifconfig.c ============================================================================== --- head/lib/libifconfig/libifconfig.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig.c Sun Sep 4 20:55:27 2016 (r305395) @@ -57,6 +57,8 @@ * 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 @@ -80,19 +82,17 @@ ifconfig_open(void) { struct ifconfig_handle *h; - h = calloc(1, sizeof(struct ifconfig_handle)); - + h = calloc(1, sizeof(*h)); for (int i = 0; i <= AF_MAX; i++) { h->sockets[i] = -1; } - return (h); } - void ifconfig_close(ifconfig_handle_t *h) { + for (int i = 0; i <= AF_MAX; i++) { if (h->sockets[i] != -1) { (void)close(h->sockets[i]); @@ -101,37 +101,40 @@ ifconfig_close(ifconfig_handle_t *h) free(h); } - ifconfig_errtype ifconfig_err_errtype(ifconfig_handle_t *h) { + return (h->error.errtype); } - int ifconfig_err_errno(ifconfig_handle_t *h) { + return (h->error.errcode); } - unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h) { + return (h->error.ioctl_request); } - int -ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description) +ifconfig_get_description(ifconfig_handle_t *h, const char *name, + char **description) { struct ifreq ifr; - char *descr = NULL; - size_t descrlen = 64; + char *descr; + size_t descrlen; - memset(&ifr, 0, sizeof(struct ifreq)); + descr = NULL; + descrlen = 64; + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + for (;;) { if ((descr = reallocf(descr, descrlen)) == NULL) { h->error.errtype = OTHER; @@ -141,8 +144,7 @@ ifconfig_get_description(ifconfig_handle ifr.ifr_buffer.buffer = descr; ifr.ifr_buffer.length = descrlen; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, - &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDESCR, &ifr) != 0) { return (-1); } @@ -164,7 +166,6 @@ ifconfig_get_description(ifconfig_handle return (-1); } - int ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription) @@ -172,7 +173,7 @@ ifconfig_set_description(ifconfig_handle struct ifreq ifr; int desclen; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); desclen = strlen(newdescription); /* @@ -184,46 +185,49 @@ ifconfig_set_description(ifconfig_handle } (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_buffer.length = desclen + 1; ifr.ifr_buffer.buffer = strdup(newdescription); + if (ifr.ifr_buffer.buffer == NULL) { h->error.errtype = OTHER; h->error.errcode = ENOMEM; return (-1); } - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, + &ifr) != 0) { free(ifr.ifr_buffer.buffer); return (-1); } + free(ifr.ifr_buffer.buffer); return (0); } - -int ifconfig_unset_description(ifconfig_handle_t *h, const char *name) +int +ifconfig_unset_description(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_buffer.length = 0; ifr.ifr_buffer.buffer = NULL; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFDESCR, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname) +int +ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname) { struct ifreq ifr; char *tmpname; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); tmpname = strdup(newname); if (tmpname == NULL) { h->error.errtype = OTHER; @@ -233,82 +237,96 @@ int ifconfig_set_name(ifconfig_handle_t (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_data = tmpname; - - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, &ifr) != 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFNAME, + &ifr) != 0) { free(tmpname); return (-1); } + free(tmpname); return (0); } - -int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu) +int +ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, &ifr) < 0) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMTU, + &ifr) < 0) { return (-1); } + return (0); } - -int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu) +int +ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, &ifr) == -1) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMTU, + &ifr) == -1) { return (-1); } + *mtu = ifr.ifr_mtu; return (0); } - -int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) +int +ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int mtu) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, &ifr) < 0) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFMETRIC, + &ifr) < 0) { return (-1); } + return (0); } - -int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric) +int +ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, &ifr) == -1) { + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFMETRIC, + &ifr) == -1) { return (-1); } + *metric = ifr.ifr_metric; return (0); } - -int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, +int +ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability) { struct ifreq ifr; struct ifconfig_capabilities ifcap; - int flags; - int value; + int flags, value; - memset(&ifr, 0, sizeof(struct ifreq)); - if (ifconfig_get_capability(h, name, &ifcap) != 0) { + memset(&ifr, 0, sizeof(ifr)); + + if (ifconfig_get_capability(h, name, + &ifcap) != 0) { return (-1); } @@ -329,22 +347,24 @@ int ifconfig_set_capability(ifconfig_han * set for this request. */ ifr.ifr_reqcap = flags; - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCSIFCAP, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, +int +ifconfig_get_capability(ifconfig_handle_t *h, const char *name, struct ifconfig_capabilities *capability) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFCAP, + &ifr) < 0) { return (-1); } capability->curcap = ifr.ifr_curcap; @@ -352,26 +372,27 @@ int ifconfig_get_capability(ifconfig_han return (0); } - -int ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) +int +ifconfig_destroy_interface(ifconfig_handle_t *h, const char *name) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, &ifr) < 0) { + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFDESTROY, + &ifr) < 0) { return (-1); } return (0); } - -int ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname) +int +ifconfig_create_interface(ifconfig_handle_t *h, const char *name, char **ifname) { struct ifreq ifr; - memset(&ifr, 0, sizeof(struct ifreq)); + memset(&ifr, 0, sizeof(ifr)); (void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); /* @@ -379,19 +400,22 @@ int ifconfig_create_interface(ifconfig_h * Insert special snowflake handling here. See GitHub issue #12 for details. * In the meantime, hard-nosupport interfaces that need special handling. */ - if ((strncmp(name, "wlan", strlen("wlan")) == 0) || - (strncmp(name, "vlan", strlen("vlan")) == 0) || - (strncmp(name, "vxlan", strlen("vxlan")) == 0)) { + if ((strncmp(name, "wlan", + strlen("wlan")) == 0) || + (strncmp(name, "vlan", + strlen("vlan")) == 0) || + (strncmp(name, "vxlan", + strlen("vxlan")) == 0)) { h->error.errtype = OTHER; h->error.errcode = ENOSYS; return (-1); } /* No special handling for this interface type. */ - if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFCREATE2, &ifr) < 0) { return (-1); } + *ifname = strdup(ifr.ifr_name); return (0); } Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig.h Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 @@ -50,7 +46,6 @@ struct ifconfig_capabilities { int reqcap; }; - /** Retrieves a new state object for use in other API calls. * Example usage: *{@code @@ -80,19 +75,18 @@ int ifconfig_err_errno(ifconfig_handle_t /** If error type was IOCTL, this identifies which request failed. */ unsigned long ifconfig_err_ioctlreq(ifconfig_handle_t *h); - int ifconfig_get_description(ifconfig_handle_t *h, const char *name, char **description); int ifconfig_set_description(ifconfig_handle_t *h, const char *name, const char *newdescription); int ifconfig_unset_description(ifconfig_handle_t *h, const char *name); -int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname); +int ifconfig_set_name(ifconfig_handle_t *h, const char *name, + const char *newname); int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); int ifconfig_get_mtu(ifconfig_handle_t *h, const char *name, int *mtu); - -int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, const int metric); +int ifconfig_set_metric(ifconfig_handle_t *h, const char *name, + const int metric); int ifconfig_get_metric(ifconfig_handle_t *h, const char *name, int *metric); - int ifconfig_set_capability(ifconfig_handle_t *h, const char *name, const int capability); int ifconfig_get_capability(ifconfig_handle_t *h, const char *name, Modified: head/lib/libifconfig/libifconfig_internal.c ============================================================================== --- head/lib/libifconfig/libifconfig_internal.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig_internal.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 @@ -30,31 +26,32 @@ * $FreeBSD$ */ +#include #include #include #include #include -#include #include - #include "libifconfig.h" // Needed for ifconfig_errstate #include "libifconfig_internal.h" + int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode) { + if (rcode != 0) { h->error.errtype = IOCTL; h->error.ioctl_request = request; h->error.errcode = errno; } + return (rcode); } - int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, unsigned long request, struct ifreq *ifr) @@ -69,13 +66,14 @@ ifconfig_ioctlwrap(ifconfig_handle_t *h, return (ifconfig_ioctlwrap_ret(h, request, rcode)); } - /* * Function to get socket for the specified address family. * If the socket doesn't already exist, attempt to create it. */ -int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) +int +ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s) { + if (addressfamily > AF_MAX) { h->error.errtype = SOCKET; h->error.errcode = EINVAL; Modified: head/lib/libifconfig/libifconfig_internal.h ============================================================================== --- head/lib/libifconfig/libifconfig_internal.h Sun Sep 4 18:00:14 2016 (r305394) +++ head/lib/libifconfig/libifconfig_internal.h Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 @@ -80,7 +76,8 @@ struct ifconfig_handle { int ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s); /** Function used by other wrapper functions to populate _errstate when appropriate.*/ -int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, int rcode); +int ifconfig_ioctlwrap_ret(ifconfig_handle_t *h, unsigned long request, + int rcode); /** Function to wrap ioctl() and automatically populate ifconfig_errstate when appropriate.*/ int ifconfig_ioctlwrap(ifconfig_handle_t *h, const int addressfamily, Modified: head/share/examples/libifconfig/ifcreate.c ============================================================================== --- head/share/examples/libifconfig/ifcreate.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/ifcreate.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 @@ -40,16 +36,17 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname, *ifactualname; + if (argc != 2) { errx(EINVAL, "Invalid number of arguments." " Only one argument is accepted, and it should be the name" " of the interface to be created."); } - char *ifname, *ifactualname; - /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); @@ -63,31 +60,31 @@ int main(int argc, char *argv[]) free(ifname); free(ifactualname); return (0); - } else { - switch (ifconfig_err_errtype(lifh)) { - case SOCKET: - warnx("couldn't create socket. This shouldn't happen.\n"); - break; - case IOCTL: - if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { - warnx( - "Failed to create interface (SIOCIFCREATE2)\n"); - } - break; - default: + } + + switch (ifconfig_err_errtype(lifh)) { + case SOCKET: + warnx("couldn't create socket. This shouldn't happen.\n"); + break; + case IOCTL: + if (ifconfig_err_ioctlreq(lifh) == SIOCIFCREATE2) { warnx( - "This is a thorough example accommodating for temporary" - " 'not implemented yet' errors. That's likely what happened" - " now. If not, your guess is as good as mine. ;)" - " Error code: %d\n", ifconfig_err_errno( - lifh)); - break; + "Failed to create interface (SIOCIFCREATE2)\n"); } - - ifconfig_close(lifh); - lifh = NULL; - free(ifname); - free(ifactualname); - return (-1); + break; + default: + warnx( + "This is a thorough example accommodating for temporary" + " 'not implemented yet' errors. That's likely what happened" + " now. If not, your guess is as good as mine. ;)" + " Error code: %d\n", ifconfig_err_errno( + lifh)); + break; } + + ifconfig_close(lifh); + lifh = NULL; + free(ifname); + free(ifactualname); + return (-1); } Modified: head/share/examples/libifconfig/ifdestroy.c ============================================================================== --- head/share/examples/libifconfig/ifdestroy.c Sun Sep 4 18:00:14 2016 (r305394) +++ head/share/examples/libifconfig/ifdestroy.c Sun Sep 4 20:55:27 2016 (r305395) @@ -12,10 +12,6 @@ * this list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * - * 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 @@ -40,16 +36,17 @@ #include -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { + char *ifname; + if (argc != 2) { errx(EINVAL, "Invalid number of arguments." " Only one argument is accepted, and it should be the name" " of the interface to be destroyed."); } - char *ifname; - /* We have a static number of arguments. Therefore we can do it simple. */ ifname = strdup(argv[1]); @@ -62,26 +59,26 @@ int main(int argc, char *argv[]) lifh = NULL; free(ifname); return (0); - } else { - switch (ifconfig_err_errtype(lifh)) { - case SOCKET: - warnx("couldn't create socket. This shouldn't happen.\n"); - break; - case IOCTL: - if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { - warnx( - "Failed to destroy interface (SIOCIFDESTROY)\n"); - } - break; - default: + } + + switch (ifconfig_err_errtype(lifh)) { + case SOCKET: + warnx("couldn't create socket. This shouldn't happen.\n"); + break; + case IOCTL: + if (ifconfig_err_ioctlreq(lifh) == SIOCIFDESTROY) { warnx( - "Should basically never end up here in this example.\n"); - break; + "Failed to destroy interface (SIOCIFDESTROY)\n"); } - - ifconfig_close(lifh); -